From fa858fa3ccd6ba2f6d9958934e6ba55d272abf75 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 8 Aug 2011 12:35:41 -0400 Subject: [PATCH 0001/1057] chlog: freetdm: SS7 - added TX of CPG message in progress media state --- .../ftmod_sangoma_ss7_main.c | 4 +-- .../ftmod_sangoma_ss7_main.h | 1 + .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 29 +++++++++++++++++++ 3 files changed, 32 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 6601c2e91a..34f1211234 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 @@ -656,10 +656,10 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { /* inform the user there is media avai */ sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS_MEDIA); + } else { + ft_to_sngss7_cpg(ftdmchan); } - - /* nothing to do at this time */ break; /**************************************************************************/ case FTDM_CHANNEL_STATE_UP: /*call is accpeted...both incoming and outgoing */ 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 b433bfb20d..159a02fc01 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 @@ -739,6 +739,7 @@ int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state); /* in ftmod_sangoma_ss7_out.c */ void ft_to_sngss7_iam(ftdm_channel_t *ftdmchan); void ft_to_sngss7_acm(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_cpg (ftdm_channel_t *ftdmchan); void ft_to_sngss7_anm(ftdm_channel_t *ftdmchan); void ft_to_sngss7_rel(ftdm_channel_t *ftdmchan); void ft_to_sngss7_rlc(ftdm_channel_t *ftdmchan); 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 56238abdf9..11ac14891d 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 @@ -36,6 +36,8 @@ /******************************************************************************/ /* DEFINES ********************************************************************/ +#define SNGSS7_EVNTINFO_IND_INBAND_AVAIL 0x03 +/******************************************************************************/ /* GLOBALS ********************************************************************/ @@ -171,6 +173,7 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) acm.optBckCalInd.simpleSegmInd.pres = PRSNT_DEF; acm.optBckCalInd.mlppUserInd.pres = PRSNT_DEF; acm.optBckCalInd.usrNetIneractInd.pres = PRSNT_DEF; + acm.optBckCalInd.netExcDelInd.pres = PRSNT_DEF; } /* if (sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA)) */ /* send the ACM request to LibSngSS7 */ @@ -187,6 +190,32 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) return; } +void ft_to_sngss7_cpg (ftdm_channel_t *ftdmchan) +{ + SiCnStEvnt cpg; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + + memset (&cpg, 0, sizeof (cpg)); + + cpg.evntInfo.eh.pres = PRSNT_NODEF; + + cpg.evntInfo.evntInd.pres = PRSNT_NODEF; + cpg.evntInfo.evntInd.val = SNGSS7_EVNTINFO_IND_INBAND_AVAIL; /* Event Indicator = In-band info is now available */ + + cpg.evntInfo.evntPresResInd.pres = PRSNT_NODEF; + cpg.evntInfo.evntPresResInd.val = 0; /* Event presentation restricted indicator = no indication */ + + /* send the CPG request to LibSngSS7 */ + sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &cpg, PROGRESS); + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "[CIC:%d]Tx CPG\n", sngss7_info->circuit->cic); + ftdm_call_clear_vars(&ftdmchan->caller_data); + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); From 9aa887fe2bab84e60e4242fce24cda2145e11152 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 26 Aug 2011 17:49:34 -0400 Subject: [PATCH 0002/1057] freetdm: SS7 - CIC value stored in freetdm_ss7_cic variable (cherry-picked from releases.3.3) Conflicts: libs/freetdm/mod_freetdm/mod_freetdm.c libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c --- libs/freetdm/mod_freetdm/mod_freetdm.c | 6 ++++- .../ftmod_sangoma_ss7_handle.c | 22 +++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 5117c6dbe8..caee4dcec9 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1703,7 +1703,6 @@ 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-Plan", "%d", channel_caller_data->rdnis.plan); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", ftdm_calling_party_category2str(channel_caller_data->cpc)); - 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); @@ -1754,6 +1753,11 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-IAM", "%s", var_value); } + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_cic"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CIC", "%s", 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_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 20e9a1261c..b541e1b551 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 @@ -89,12 +89,13 @@ ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) { - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - char nadi[2]; - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - memset(nadi, '\0', sizeof(nadi)); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + char var[10]; + + memset(var, '\0', sizeof(var)); /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -209,11 +210,14 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* add any special variables for the dialplan */ - sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_clg_nadi", nadi); + sprintf(var, "%d", siConEvnt->cgPtyNum.natAddrInd.val); + sngss7_add_var(sngss7_info, "ss7_clg_nadi", var); - sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_cld_nadi", nadi); + sprintf(var, "%d", siConEvnt->cdPtyNum.natAddrInd.val); + sngss7_add_var(sngss7_info, "ss7_cld_nadi", var); + + sprintf(var, "%d", sngss7_info->circuit->cic); + sngss7_add_var(sngss7_info, "ss7_cic", var); if (sngss7_info->circuit->transparent_iam) { sngss7_save_iam(ftdmchan, siConEvnt); From d6f3a02b9493989c1331184067c9951b5c4cb569 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 15 Sep 2011 12:08:32 -0400 Subject: [PATCH 0003/1057] freetdm: fix compile issue with previous commit (undeclared function) --- libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 1 - 1 file changed, 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 11ac14891d..b729552092 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 @@ -212,7 +212,6 @@ void ft_to_sngss7_cpg (ftdm_channel_t *ftdmchan) sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &cpg, PROGRESS); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "[CIC:%d]Tx CPG\n", sngss7_info->circuit->cic); - ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } From 199e4397b5e764bebe3d733298d5c43c476fad9b Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 14 Sep 2011 10:46:32 -0400 Subject: [PATCH 0004/1057] freetdm: do not warn on io status changes, leave as debug messages --- libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 6c945e1512..0f6f7db939 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -860,7 +860,7 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t /* HDLC channels do not always transmit, so its ok for drivers to fill with idle * also do not report idle warning when we just started transmitting */ if (ftdmchan->iostats.tx.packets && FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle changed from %d to %d\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Tx idle changed from %d to %d\n", ftdmchan->iostats.tx.idle_packets, tx_stats->wp_api_tx_hdr_tx_idle_packets); } ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; @@ -913,21 +913,21 @@ static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx } if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded 80% threshold (%d/%d)\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length exceeded 80% threshold (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue length reduced 80% threshold (%d/%d)\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length reduced 80% threshold (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } if (ftdmchan->iostats.rx.queue_len >= ftdmchan->iostats.rx.queue_size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue Full (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue no longer full (%d/%d)\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue no longer full (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } From 4cdd74dccd8fdda5c58d869ebb6da8c30c7793d9 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 21 Aug 2011 19:49:07 -0400 Subject: [PATCH 0005/1057] freetdm: ss7 test pattern should be SANGOMA --- .../ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 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 34d79837f0..9ad2efa8e7 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 @@ -913,13 +913,14 @@ int ftmod_ss7_mtp3_dlsap_config(int id) #endif /* SDT2 */ cfg.t.cfg.s.snDLSAP.lnkId = 0; /* signalling link allocation procedure identity */ cfg.t.cfg.s.snDLSAP.lnkTstSLC = k->slc; /* link selection code for link test */ - cfg.t.cfg.s.snDLSAP.tstLen = 6; /* link test pattern length */ - cfg.t.cfg.s.snDLSAP.tst[0] = 'K'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[1] = 'O'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tstLen = 7; /* link test pattern length */ + cfg.t.cfg.s.snDLSAP.tst[0] = 'S'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[1] = 'A'; /* link test pattern */ cfg.t.cfg.s.snDLSAP.tst[2] = 'N'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[3] = 'R'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[4] = 'A'; /* link test pattern */ - cfg.t.cfg.s.snDLSAP.tst[5] = 'D'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[3] = 'G'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[4] = 'O'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[5] = 'M'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[6] = 'A'; /* link test pattern */ cfg.t.cfg.s.snDLSAP.ssf = k->ssf; /* sub service field */ cfg.t.cfg.s.snDLSAP.dstProcId = k->mtp2ProcId; /* destination processor id */ cfg.t.cfg.s.snDLSAP.dstEnt = ENTSD; /* entity */ From bb942e2329bb0fb5fe7e81eb22e3a542ff6371b1 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 20 Sep 2011 19:15:05 -0400 Subject: [PATCH 0006/1057] freetdm: Fix for sending CPG without sending ACM prior to that --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 4 ++++ 1 file changed, 4 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 34f1211234..d8c45fd482 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 @@ -657,6 +657,10 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* inform the user there is media avai */ sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS_MEDIA); } else { + if (!sngss7_test_ckt_flag(sngss7_info, FLAG_SENT_ACM)) { + sngss7_set_ckt_flag(sngss7_info, FLAG_SENT_ACM); + ft_to_sngss7_acm(ftdmchan); + } ft_to_sngss7_cpg(ftdmchan); } From 8bf6312a0e66a6708e2b136639081f579ac49ea4 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 13 Jun 2011 17:33:41 -0400 Subject: [PATCH 0007/1057] freetdm: set proper flags when a given layer (ISUP, MTP3 etc) is started and verify such flags on shutdown to avoid segfault when shutting down a layer that was never started - fix issue #741 --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c | 22 ++++++++----- .../ftmod_sangoma_ss7_main.c | 31 +++++++++++-------- .../ftmod_sangoma_ss7_main.h | 26 +++++++++++----- .../ftmod_sangoma_ss7_relay.c | 2 +- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 12 +++---- 5 files changed, 58 insertions(+), 35 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 9ad2efa8e7..dd1058f420 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 @@ -99,17 +99,18 @@ int ft_to_sngss7_cfg_all(void) return 1; } else { SS7_INFO("Started Stack Manager!\n"); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED); } /* check if the configuration had a Relay Channel */ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_PRESENT)) { /* start up the relay task */ if (sng_isup_init_relay()) { SS7_CRITICAL("Failed to start Relay\n"); return 1; } else { SS7_INFO("Started Relay!\n"); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED); } /* run general configuration on the relay task */ @@ -122,12 +123,13 @@ int ft_to_sngss7_cfg_all(void) } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) */ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_PRESENT)) { if (sng_isup_init_cc()) { SS7_CRITICAL("Failed to start Call-Control\n"); return 1; } else { SS7_INFO("Started Call-Control!\n"); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED); } if (ftmod_ss7_cc_gen_config()) { SS7_CRITICAL("CC General configuration FAILED!\n"); @@ -143,12 +145,13 @@ int ft_to_sngss7_cfg_all(void) } } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) */ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_PRESENT)) { if (sng_isup_init_isup()) { SS7_CRITICAL("Failed to start ISUP\n"); return 1; } else { SS7_INFO("Started ISUP!\n"); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED); } if (ftmod_ss7_isup_gen_config()) { SS7_CRITICAL("ISUP General configuration FAILED!\n"); @@ -158,12 +161,13 @@ int ft_to_sngss7_cfg_all(void) } } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) */ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_PRESENT)) { if (sng_isup_init_mtp3()) { SS7_CRITICAL("Failed to start MTP3\n"); return 1; } else { SS7_INFO("Started MTP3!\n"); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_STARTED); } if (ftmod_ss7_mtp3_gen_config()) { @@ -174,18 +178,20 @@ int ft_to_sngss7_cfg_all(void) } } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) */ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_PRESENT)) { if (sng_isup_init_mtp2()) { SS7_CRITICAL("Failed to start MTP2\n"); return 1; } else { SS7_INFO("Started MTP2!\n"); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED); } if (sng_isup_init_mtp1()) { - SS7_CRITICAL("Failed to start MTP2\n"); + SS7_CRITICAL("Failed to start MTP1\n"); return 1; } else { SS7_INFO("Started MTP1!\n"); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_STARTED); } if (ftmod_ss7_mtp1_gen_config()) { SS7_CRITICAL("MTP1 General configuration FAILED!\n"); @@ -376,7 +382,7 @@ int ft_to_sngss7_cfg_all(void) x++; } /* while (x < (MAX_ISAPS)) */ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED)) { x = 1; while (x < (MAX_ISUP_INFS)) { /* check if this link has been configured already */ 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 d8c45fd482..a849bf2f62 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 @@ -1628,32 +1628,36 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) ftdm_log (FTDM_LOG_INFO, "Starting ftmod_sangoma_ss7 unload...\n"); - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED)) { sng_isup_free_cc(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC); + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED); } - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED)) { ftmod_ss7_shutdown_isup(); sng_isup_free_isup(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP); + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_STARTED); } - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_STARTED)) { ftmod_ss7_shutdown_mtp3(); sng_isup_free_mtp3(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3); + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_STARTED); } - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED)) { ftmod_ss7_shutdown_mtp2(); sng_isup_free_mtp2(); - sng_isup_free_mtp1(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2); + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED); } - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) { - /* go through all the relays channels and configure it */ + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_STARTED)) { + sng_isup_free_mtp1(); + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_STARTED); + } + + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED)) { + /* go through all the relays channels and disable them */ x = 1; while (x < (MAX_RELAY_CHANNELS)) { /* check if this relay channel has been configured already */ @@ -1675,11 +1679,12 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) ftmod_ss7_shutdown_relay(); sng_isup_free_relay(); - sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY); + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED); } - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED)) { sng_isup_free_sm(); + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED); } sng_isup_free_gen(); 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 159a02fc01..cda6225217 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 @@ -636,13 +636,25 @@ typedef enum { } sng_cfg_flag_t; typedef enum { - SNGSS7_SM = (1 << 0), - SNGSS7_RY = (1 << 1), - SNGSS7_MTP1 = (1 << 2), - SNGSS7_MTP2 = (1 << 3), - SNGSS7_MTP3 = (1 << 4), - SNGSS7_ISUP = (1 << 5), - SNGSS7_CC = (1 << 6) + SNGSS7_SM_STARTED = (1 << 0), + + SNGSS7_RY_PRESENT = (1 << 2), + SNGSS7_RY_STARTED = (1 << 3), + + SNGSS7_MTP1_PRESENT = (1 << 4), + SNGSS7_MTP1_STARTED = (1 << 5), + + SNGSS7_MTP2_PRESENT = (1 << 6), + SNGSS7_MTP2_STARTED = (1 << 7), + + SNGSS7_MTP3_PRESENT = (1 << 8), + SNGSS7_MTP3_STARTED = (1 << 9), + + SNGSS7_ISUP_PRESENT = (1 << 10), + SNGSS7_ISUP_STARTED = (1 << 11), + + SNGSS7_CC_PRESENT = (1 << 12), + SNGSS7_CC_STARTED = (1 << 13), } sng_task_flag_t; /******************************************************************************/ 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 16624cc902..bfb6971297 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 @@ -300,7 +300,7 @@ ftdm_status_t disable_all_sigs_for_relay(uint32_t procId) ftdm_status_t disble_all_mtp2_sigs_for_relay(void) { /* check if there is a local mtp2 link*/ - if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) { + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED)) { SS7_INFO("Disalbing all mtp2 sig links on local system\n"); ftmod_ss7_disable_grp_mtp2Link(1); 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 69016113b0..2794eb497c 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 @@ -2082,7 +2082,7 @@ static int ftmod_ss7_fill_in_relay_channel(sng_relay_t *relay_channel) relay_channel->port, relay_channel->procId, relay_channel->id); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_PRESENT); } else { relay_channel->id = i; SS7_DEBUG("found existing relay channel on type:%d, hostname:%s, port:%d, procId:%d, id = %d\n", @@ -2116,7 +2116,7 @@ static int ftmod_ss7_fill_in_mtp1_link(sng_mtp1_link_t *mtp1Link) /* check if this id value has been used already */ if (g_ftdm_sngss7_data.cfg.mtp1Link[i].id == 0) { SS7_DEBUG("Found new MTP1 Link: id=%d, name=%s\n", mtp1Link->id, mtp1Link->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP1_PRESENT); } else { SS7_DEBUG("Found an existing MTP1 Link: id=%d, name=%s (old name=%s)\n", mtp1Link->id, @@ -2142,7 +2142,7 @@ static int ftmod_ss7_fill_in_mtp2_link(sng_mtp2_link_t *mtp2Link) /* check if this id value has been used already */ if (g_ftdm_sngss7_data.cfg.mtp2Link[i].id == 0) { SS7_DEBUG("Found new MTP2 Link: id=%d, name=%s\n", mtp2Link->id, mtp2Link->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_PRESENT); } else { SS7_DEBUG("Found an existing MTP2 Link: id=%d, name=%s (old name=%s)\n", mtp2Link->id, @@ -2219,7 +2219,7 @@ static int ftmod_ss7_fill_in_mtp3_link(sng_mtp3_link_t *mtp3Link) /* check if this id value has been used already */ if (g_ftdm_sngss7_data.cfg.mtp3Link[i].id == 0) { SS7_DEBUG("Found new MTP3 Link: id=%d, name=%s\n", mtp3Link->id, mtp3Link->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP3_PRESENT); } else { SS7_DEBUG("Found an existing MTP3 Link: id=%d, name=%s (old name=%s)\n", mtp3Link->id, @@ -2560,7 +2560,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) /* check if this id value has been used already */ if (g_ftdm_sngss7_data.cfg.isupIntf[i].id == 0) { SS7_DEBUG("Found new ISUP Interface: id=%d, name=%s\n", sng_isup->id, sng_isup->name); - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP_PRESENT); } else { SS7_DEBUG("Found an existing ISUP Interface: id=%d, name=%s (old name=%s)\n", sng_isup->id, @@ -2908,7 +2908,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) g_ftdm_sngss7_data.cfg.isupCkt[x].type = SNG_CKT_VOICE; /* throw the flag to indicate that we need to start call control */ - sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC); + sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_PRESENT); } if (timeslot.channel) { From 4c64d53efbbb4526dcd0cd2e9862c639fde9ae6b Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 21 Sep 2011 15:15:19 -0400 Subject: [PATCH 0008/1057] freetdm: Manually merged relay code from branch jz.smg_ss7 (based on releases.3.3) - Added relay and other misc commands - Misc fixes in hardware blocks, hw alarm etc - Fix crash on shutdown in relay --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 833 ++++++++++++++---- .../ftmod_sangoma_ss7_handle.c | 16 +- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c | 68 +- .../ftmod_sangoma_ss7_logger.c | 8 +- .../ftmod_sangoma_ss7_main.c | 174 +++- .../ftmod_sangoma_ss7_main.h | 37 +- 6 files changed, 898 insertions(+), 238 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 5f87ffd877..9ff19bac02 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 @@ -31,6 +31,10 @@ * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if 0 +#define SMG_RELAY_DBG +#endif + /* INCLUDE ********************************************************************/ #include "ftmod_sangoma_ss7_main.h" /******************************************************************************/ @@ -44,7 +48,7 @@ /* PROTOTYPES *****************************************************************/ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); -static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream); +static ftdm_status_t handle_print_usage(ftdm_stream_handle_t *stream); static ftdm_status_t handle_show_procId(ftdm_stream_handle_t *stream); @@ -88,8 +92,31 @@ static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char * static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan); static ftdm_status_t check_arg_count(int args, int min); -/******************************************************************************/ + + +static ftdm_status_t cli_ss7_show_general(ftdm_stream_handle_t *stream); + +static ftdm_status_t cli_ss7_show_mtp2link_by_id(ftdm_stream_handle_t *stream, int rcId); +static ftdm_status_t cli_ss7_show_mtp2link_by_name(ftdm_stream_handle_t *stream, char *name); +static ftdm_status_t cli_ss7_show_all_mtp2link(ftdm_stream_handle_t *stream); + +static ftdm_status_t cli_ss7_show_mtp3link_by_id(ftdm_stream_handle_t *stream, int rcId); +static ftdm_status_t cli_ss7_show_mtp3link_by_name(ftdm_stream_handle_t *stream, char *name); +static ftdm_status_t cli_ss7_show_all_mtp3link(ftdm_stream_handle_t *stream); + +static ftdm_status_t cli_ss7_show_relay_by_id(ftdm_stream_handle_t *stream, int rcId); +static ftdm_status_t cli_ss7_show_relay_by_name(ftdm_stream_handle_t *stream, char *name); +static ftdm_status_t cli_ss7_show_all_relay(ftdm_stream_handle_t *stream); + +static ftdm_status_t cli_ss7_show_channel_detail_of_span(ftdm_stream_handle_t *stream, char *span_id, char *chan_id); +static ftdm_status_t cli_ss7_show_all_channels_of_span(ftdm_stream_handle_t *stream, char *span_id); + +static ftdm_status_t cli_ss7_show_span_by_id(ftdm_stream_handle_t *stream, char *span_id); +static ftdm_status_t cli_ss7_show_all_spans_general(ftdm_stream_handle_t *stream); +static ftdm_status_t cli_ss7_show_all_spans_detail(ftdm_stream_handle_t *stream); + +/******************************************************************************/ /* FUNCTIONS ******************************************************************/ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data) { @@ -109,16 +136,72 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha argc = ftdm_separate_string(mycmd, ' ', argv, ftdm_array_len(argv)); } - if (check_arg_count(argc, 1)) goto handle_cli_error_argc; - + if (check_arg_count(argc, 1)) { + goto handle_cli_error_argc; + } + if (!strcasecmp(argv[c], "show")) { /**************************************************************************/ - if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + if (check_arg_count(argc, 2)) { + cli_ss7_show_general(stream); + return FTDM_SUCCESS; + } c++; - if (!strcasecmp(argv[c], "status")) { + if (!strcasecmp(argv[c], "relay")) { /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + handle_status_relay(stream, argv[c]); + + } else if (!strcasecmp(argv[c], "span")) { + /**********************************************************************/ + switch (argc) { + case 2: + { + /* > ftdm ss7 show span */ + cli_ss7_show_all_spans_general(stream); + } + break; + + case 3: + { + if (!strcasecmp(argv[2], "all")) { + /* > ftdm ss7 show span all */ + cli_ss7_show_all_spans_detail(stream); + } else { + /* > ftdm ss7 show span 1 */ + cli_ss7_show_span_by_id(stream, argv[2]); + } + } + break; + + case 4: + { + /* > ftdm ss7 show span 1 chan */ + cli_ss7_show_all_channels_of_span(stream, argv[2]); + } + break; + + case 5: + default: + { + if (!strcasecmp(argv[3], "chan")) { + /* > ftdm ss7 show span 1 chan 2 */ + cli_ss7_show_channel_detail_of_span(stream, argv[2], argv[4]); + } else { + /* > ftdm ss7 show span 1 bla bla bla*/ + cli_ss7_show_all_channels_of_span(stream, argv[2]); + } + } + break; + } + } else if (!strcasecmp(argv[c], "status")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) { + cli_ss7_show_general(stream); + return FTDM_SUCCESS; + } + c++; if (!strcasecmp(argv[c], "mtp3")) { @@ -675,38 +758,40 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha handle_cli_error_argc: stream->write_function(stream, "Invalid # of arguments in command\n"); - handle_print_usuage(stream); + handle_print_usage(stream); return FTDM_SUCCESS; handle_cli_error_span_chan: stream->write_function(stream, "Unknown \"span\\chan\" command\n"); - handle_print_usuage(stream); + handle_print_usage(stream); return FTDM_SUCCESS; handle_cli_error: stream->write_function(stream, "Unknown command requested\n"); - handle_print_usuage(stream); + handle_print_usage(stream); return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) +static ftdm_status_t handle_print_usage(ftdm_stream_handle_t *stream) { - stream->write_function(stream, "Sangoma SS7 CLI usuage:\n\n"); + stream->write_function(stream, "Sangoma SS7 CLI usage:\n\n"); - stream->write_function(stream, "Ftmod_sangoma_ss7 general control:\n"); + stream->write_function(stream, "ftmod_sangoma_ss7 general control:\n"); stream->write_function(stream, "ftdm ss7 set ftrace X Y\n"); stream->write_function(stream, "ftdm ss7 set mtrace X Y\n"); stream->write_function(stream, "\n"); - stream->write_function(stream, "Ftmod_sangoma_ss7 information:\n"); + stream->write_function(stream, "ftmod_sangoma_ss7 information:\n"); stream->write_function(stream, "ftdm ss7 show status mtp3 X\n"); stream->write_function(stream, "ftdm ss7 show status mtp2 X\n"); stream->write_function(stream, "ftdm ss7 show status span X chan Y\n"); stream->write_function(stream, "ftdm ss7 show free span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 show blocks span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 show inuse span X chan Y\n"); stream->write_function(stream, "ftdm ss7 show inreset span X chan Y\n"); stream->write_function(stream, "\n"); - stream->write_function(stream, "Ftmod_sangoma_ss7 circuit control:\n"); + stream->write_function(stream, "ftmod_sangoma_ss7 circuit control:\n"); stream->write_function(stream, "ftdm ss7 blo span X chan Y\n"); stream->write_function(stream, "ftdm ss7 ubl span X chan Y\n"); stream->write_function(stream, "ftdm ss7 rsc span X chan Y\n"); @@ -714,7 +799,7 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) stream->write_function(stream, "ftdm ss7 cgb span X chan Y range Z\n"); stream->write_function(stream, "ftdm ss7 cgu span X chan Y range Z\n"); stream->write_function(stream, "\n"); - stream->write_function(stream, "Ftmod_sangoma_ss7 link control:\n"); + stream->write_function(stream, "ftmod_sangoma_ss7 link control:\n"); stream->write_function(stream, "ftdm ss7 inhibit link X\n"); stream->write_function(stream, "ftdm ss7 uninhibit link X\n"); stream->write_function(stream, "ftdm ss7 activate link X\n"); @@ -724,8 +809,14 @@ 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, "ftmod_sangoma_ss7 Relay status:\n"); stream->write_function(stream, "ftdm ss7 show status relay X\n"); + stream->write_function(stream, "ftdm ss7 show relay X\n"); + stream->write_function(stream, "ftdm ss7 show relay\n"); + stream->write_function(stream, "\n"); + stream->write_function(stream, "\n"); return FTDM_SUCCESS; @@ -1106,6 +1197,9 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span, stream->write_function(stream, "l_ucic=N|"); } +#ifdef SMG_RELAY_DBG + stream->write_function(stream, " blk_flag= %x ckt_flag = %d", ss7_info->blk_flags, ss7_info->ckt_flags ); +#endif stream->write_function(stream, "\n"); } /* if ( span and chan) */ @@ -1217,6 +1311,9 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, } } +#ifdef SMG_RELAY_DBG + stream->write_function(stream," blk_flag= %x ckt_flag = %d", ss7_info->blk_flags, ss7_info->ckt_flags ); +#endif stream->write_function(stream, "\n"); } /* if ( hole, sig, voice) */ } /* if ( span and chan) */ @@ -1226,6 +1323,7 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, return FTDM_SUCCESS; } + /******************************************************************************/ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { @@ -1263,7 +1361,7 @@ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int c if (check_for_state_change(ftdmchan)) { SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); /* check if we need to die */ - SS7_ASSERT; + ftdm_assert(0, "State change not completed\n"); /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); /* move to the next channel */ @@ -1329,7 +1427,7 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c if (check_for_state_change(ftdmchan)) { SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); /* check if we need to die */ - SS7_ASSERT; + ftdm_assert(0, "State change not completed\n"); /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); /* move to the next channel */ @@ -1341,6 +1439,9 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c /* clear the block flag */ sngss7_clear_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); + /* check group blocking */ + sngss7_clear_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX); + /* set the channel to suspended state */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } @@ -1348,103 +1449,47 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); - } /* if ( span and chan) */ + } - } /* if ( cic != 0) */ + } /* go the next circuit */ x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + } handle_show_blocks(stream, span, chan, verbose); return FTDM_SUCCESS; } + /******************************************************************************/ static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char *name) { - int x = 0; - SnMngmt sta; + SS7_RELAY_DBG_FUN(handle_status_mtp3link); - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Invalid stream\n"); - /* send the status request */ - if (ftmod_ss7_mtp3link_sta(x, &sta)) { - stream->write_function(stream, "Failed to read link=%s status\n", name); - return FTDM_FAIL; - } + if (!name) { + return cli_ss7_show_all_mtp3link(stream); + } - /* print the results */ - stream->write_function(stream, "%s|span=%d|chan=%d|sap=%d|state=%s|l_blk=%s|r_blk=%s|l_inhbt=%s|r_inhbt=%s\n", - name, - g_ftdm_sngss7_data.cfg.mtp1Link[x].span, - g_ftdm_sngss7_data.cfg.mtp1Link[x].chan, - g_ftdm_sngss7_data.cfg.mtp3Link[x].id, - DECODE_LSN_LINK_STATUS(sta.t.ssta.s.snDLSAP.state), - (sta.t.ssta.s.snDLSAP.locBlkd) ? "Y":"N", - (sta.t.ssta.s.snDLSAP.remBlkd) ? "Y":"N", - (sta.t.ssta.s.snDLSAP.locInhbt) ? "Y":"N", - (sta.t.ssta.s.snDLSAP.rmtInhbt) ? "Y":"N"); - - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Failed to find link=\"%s\"\n", name); - -success: - return FTDM_SUCCESS; + return cli_ss7_show_mtp3link_by_name(stream, name); } + /******************************************************************************/ static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char *name) { - int x = 0; - SdMngmt sta; + SS7_RELAY_DBG_FUN(handle_status_mtp2link); - /* find the link request by it's name */ - x = 1; - while(x < (MAX_MTP_LINKS+1)) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp2Link[x].name, name)) { + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Invalid stream\n"); - /* send the status request */ - if (ftmod_ss7_mtp2link_sta(x, &sta)) { - stream->write_function(stream, "Failed to read link=%s status\n", name); - return FTDM_FAIL; - } + if (!name) { + return cli_ss7_show_all_mtp2link(stream); + } - /* print the results */ - stream->write_function(stream, "%s|span=%d|chan=%d|sap=%d|state=%s|outsFrm=%d|drpdFrm=%d|lclStatus=%s|rmtStatus=%s|fsn=%d|bsn=%d\n", - name, - g_ftdm_sngss7_data.cfg.mtp1Link[x].span, - g_ftdm_sngss7_data.cfg.mtp1Link[x].chan, - g_ftdm_sngss7_data.cfg.mtp2Link[x].id, - DECODE_LSD_LINK_STATUS(sta.t.ssta.s.sdDLSAP.hlSt), - sta.t.ssta.s.sdDLSAP.psOutsFrm, - sta.t.ssta.s.sdDLSAP.cntMaDrop, - (sta.t.ssta.s.sdDLSAP.lclBsy) ? "Y":"N", - (sta.t.ssta.s.sdDLSAP.remBsy) ? "Y":"N", - sta.t.ssta.s.sdDLSAP.fsn, - sta.t.ssta.s.sdDLSAP.bsn); - - goto success; - } - - /* move to the next link */ - x++; - } /* while (x < (MAX_MTP_LINKS+1)) */ - - stream->write_function(stream, "Failed to find link=\"%s\"\n", name); - -success: - return FTDM_SUCCESS; + return cli_ss7_show_mtp2link_by_name(stream, name); } /******************************************************************************/ @@ -1721,8 +1766,8 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c memset (&sigev, 0, sizeof (sigev)); - if (range > 31) { - stream->write_function(stream, "Invalid range value %d", range); + if (range <= 1 || range > 31) { + stream->write_function(stream, "Invalid range value %d. Range value must be greater than 1 and less than 31. \n", range); return FTDM_SUCCESS; } @@ -1740,7 +1785,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + ftdm_channel_lock(ftdmchan); /* throw the grp maint. block flag */ sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); @@ -1753,9 +1798,11 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c /* attach the cgb information */ main_chan = ftdmchan; sngss7_span->tx_cgb.circuit = sngss7_info->circuit->id; - sngss7_span->tx_cgb.range = range-1; + sngss7_span->tx_cgb.range = 0; sngss7_span->tx_cgb.type = 0; /* maintenace block */ - } /* if (ftdmchan->physical_chan_id == chan) */ + } else { + ((sngss7_span_data_t*)(main_chan->span->signal_data))->tx_cgb.range++; + } /* update the status field */ sngss7_span->tx_cgb.status[byte] = (sngss7_span->tx_cgb.status[byte] | (1 << bit)); @@ -1768,12 +1815,12 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c } /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - } /* if ( span and chan) */ - } /* if ( cic == voice) */ + ftdm_channel_unlock(ftdmchan); + } + } /* go the next circuit */ x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + } if (!main_chan) { stream->write_function(stream, "Failed to find a voice cic in span %d chan %d range %d", span, chan, range); @@ -1794,7 +1841,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c if ((ftdmchan->physical_span_id == span) && ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - handle_show_status(stream, span, chan, verbose); + handle_show_status(stream, ftdmchan->physical_span_id, ftdmchan->physical_chan_id, verbose); } } /* if ( cic == voice) */ @@ -1809,24 +1856,48 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c /******************************************************************************/ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose) { - int x; - sngss7_chan_data_t *sngss7_info; - ftdm_channel_t *ftdmchan; - ftdm_channel_t *main_chan = NULL; - sngss7_span_data_t *sngss7_span; - int byte = 0; - int bit = 0; - ftdm_sigmsg_t sigev; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + ftdm_channel_t *main_chan = NULL; + sngss7_span_data_t *sngss7_span = NULL; + sngss7_chan_data_t *ubl_sng_info[MAX_CIC_MAP_LENGTH+1]; + int x = 0; + int byte = 0; + int bit = 0; + int ubl_sng_info_idx = 1; + ftdm_sigmsg_t sigev; + memset(ubl_sng_info, 0, sizeof(ubl_sng_info)); memset (&sigev, 0, sizeof (sigev)); - - if (range > 31) { - stream->write_function(stream, "Invalid range value %d", range); + if (range <= 1 || range > 31) { + stream->write_function(stream, "Invalid range value %d. Range value must be greater than 1 and less than 31.\n", range); return FTDM_SUCCESS; } - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; + /* verify that there is not hardware block in the range. + * if there is any channel within the group unblock range, do not execute the group unblock */ + x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; + sngss7_span = ftdmchan->span->signal_data; + + if ( (ftdmchan->physical_span_id == span) + && (ftdmchan->physical_chan_id >= chan) + && (ftdmchan->physical_chan_id < (chan+range)) + && sngss7_test_ckt_blk_flag(sngss7_info, (FLAG_GRP_HW_BLOCK_TX | FLAG_GRP_HW_BLOCK_TX_DN)) + ) { + stream->write_function(stream, "There is at least one channel with hardware block. Group unblock operation not allowed at this time.\n"); + return FTDM_SUCCESS; + } + } + x++; + } + + + x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { @@ -1840,10 +1911,15 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + ftdm_channel_lock(ftdmchan); /* throw the grp maint. block flag */ sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); + + if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN)) { + ubl_sng_info[ubl_sng_info_idx] = sngss7_info; + ubl_sng_info_idx++; + } /* bring the sig status up */ sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); @@ -1853,9 +1929,11 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c /* attach the cgb information */ main_chan = ftdmchan; sngss7_span->tx_cgu.circuit = sngss7_info->circuit->id; - sngss7_span->tx_cgu.range = range-1; + sngss7_span->tx_cgu.range = 0; sngss7_span->tx_cgu.type = 0; /* maintenace block */ - } /* if (ftdmchan->physical_chan_id == chan) */ + } else { + ((sngss7_span_data_t*)(main_chan->span->signal_data))->tx_cgu.range++; + } /* update the status field */ sngss7_span->tx_cgu.status[byte] = (sngss7_span->tx_cgu.status[byte] | (1 << bit)); @@ -1868,12 +1946,12 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c } /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - } /* if ( span and chan) */ - } /* if ( cic == voice) */ + ftdm_channel_unlock(ftdmchan); + } + } /* go the next circuit */ x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + } if (!main_chan) { stream->write_function(stream, "Failed to find a voice cic in span %d chan %d range %d", span, chan, range); @@ -1883,6 +1961,13 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c /* send the circuit group block */ ft_to_sngss7_cgu(main_chan); + /* clearing blocking flags */ + for (x = 1; ubl_sng_info[x]; x++) { + sngss7_info = ubl_sng_info[x]; + 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); + } + 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 == SNG_CKT_VOICE) { @@ -1894,7 +1979,8 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c if ((ftdmchan->physical_span_id == span) && ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { - handle_show_status(stream, span, chan, verbose); + handle_show_status(stream, ftdmchan->physical_span_id, ftdmchan->physical_chan_id, verbose); + } } /* if ( cic == voice) */ @@ -2158,42 +2244,11 @@ success: /******************************************************************************/ static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *name) { - RyMngmt sta; - int x = 0; - - memset(&sta, 0x0, sizeof(sta)); - - - /* find the channel request by it's name */ - x = 1; - 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)) { - stream->write_function(stream, "Failed to read relay =%s status\n", name); - return FTDM_FAIL; - } - - /* print the results */ - stream->write_function(stream, "%s|sap=%d|type=%d|port=%d|hostname=%s|procId=%d|status=%s\n", - name, - g_ftdm_sngss7_data.cfg.relay[x].id, - g_ftdm_sngss7_data.cfg.relay[x].type, - g_ftdm_sngss7_data.cfg.relay[x].port, - g_ftdm_sngss7_data.cfg.relay[x].hostname, - g_ftdm_sngss7_data.cfg.relay[x].procId, - DECODE_LRY_CHAN_STATUS(sta.t.ssta.rySta.cStatus)); - - goto success; - } - - /* move to the next link */ - x++; - - } /* x < (MAX_RELAY_CHANNELS) */ - -success: - return FTDM_SUCCESS; + SS7_RELAY_DBG_FUN(handle_status_relay); + if (!name) { + return cli_ss7_show_all_relay(stream); + } + return cli_ss7_show_relay_by_name(stream, name); } /******************************************************************************/ @@ -2426,6 +2481,468 @@ static ftdm_status_t check_arg_count(int args, int min) } } + +/****************************************************************************** +* Fun: cli_ss7_show_mtp2link_by_id() +* Desc: display mtp3 link information with id +* Param: +* stream : output stream object +* rcId : mtp2 link's id +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_mtp2link_by_id(ftdm_stream_handle_t *stream, int rcId) +{ + SdMngmt sta; + + SS7_RELAY_DBG_FUN(cli_ss7_show_mtp2link_by_id); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + if (ftmod_ss7_mtp2link_sta(rcId, &sta)) { + stream->write_function(stream, "Failed to read status of MTP2 link, id=%d \n", rcId); + return FTDM_FAIL; + } + + stream->write_function(stream, "name=%s|span=%d|chan=%d|sap=%d|state=%s|outsFrm=%d|drpdFrm=%d|lclStatus=%s|rmtStatus=%s|fsn=%d|bsn=%d\n", + g_ftdm_sngss7_data.cfg.mtp2Link[rcId].name, + g_ftdm_sngss7_data.cfg.mtp1Link[rcId].span, + g_ftdm_sngss7_data.cfg.mtp1Link[rcId].chan, + g_ftdm_sngss7_data.cfg.mtp2Link[rcId].id, + DECODE_LSD_LINK_STATUS(sta.t.ssta.s.sdDLSAP.hlSt), + sta.t.ssta.s.sdDLSAP.psOutsFrm, + sta.t.ssta.s.sdDLSAP.cntMaDrop, + (sta.t.ssta.s.sdDLSAP.lclBsy) ? "Y":"N", + (sta.t.ssta.s.sdDLSAP.remBsy) ? "Y":"N", + sta.t.ssta.s.sdDLSAP.fsn, + sta.t.ssta.s.sdDLSAP.bsn + ); + + return FTDM_SUCCESS; +} + +/****************************************************************************** +* Fun: cli_ss7_show_mtp2link_by_name() +* Desc: display all relay channels information +* Param: +* stream : output stream object +* rcName: mtp2 link's name +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_mtp2link_by_name(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + SS7_RELAY_DBG_FUN(cli_ss7_show_mtp2link_by_name); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + ftdm_assert_return(!ftdm_strlen_zero(name), FTDM_FAIL, "Null MTP2 link name\n"); + + for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { + if (0 == strcasecmp(g_ftdm_sngss7_data.cfg.mtp2Link[x].name, name)) { + return cli_ss7_show_mtp2link_by_id( stream, x ); + } + } + + stream->write_function (stream, "The MTP2 link with name \'%s\' is not found. \n", name); + return FTDM_FAIL; +} + +/****************************************************************************** +* Fun: cli_ss7_show_all_mtp2link() +* Desc: display all mtp2 links information +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_all_mtp2link(ftdm_stream_handle_t *stream) +{ + int x = 0; + + SS7_RELAY_DBG_FUN(cli_ss7_show_all_mtp2link); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { + if (!ftdm_strlen_zero( g_ftdm_sngss7_data.cfg.mtp2Link[x].name)) { + cli_ss7_show_mtp2link_by_id(stream, x ); + } + } + + return FTDM_SUCCESS; +} + +/****************************************************************************** +* Fun: cli_ss7_show_mtp3link_by_id() +* Desc: display mtp3 link information with id +* Param: +* stream : output stream object +* rcId : mtp3 link's id +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_mtp3link_by_id(ftdm_stream_handle_t *stream, int rcId) +{ + SnMngmt sta; + + SS7_RELAY_DBG_FUN(cli_ss7_show_mtp3link_by_id); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + memset(&sta, 0, sizeof(sta)); + if (ftmod_ss7_mtp3link_sta(rcId, &sta)) { + stream->write_function(stream, "Failed to read status of MTP3 link, id=%d \n", rcId); + return FTDM_FAIL; + } + + stream->write_function(stream, "name=%s|span=%d|chan=%d|sap=%d|state=%s|l_blk=%s|r_blk=%s|l_inhbt=%s|r_inhbt=%s\n", + g_ftdm_sngss7_data.cfg.mtp3Link[rcId].name, + g_ftdm_sngss7_data.cfg.mtp1Link[rcId].span, + g_ftdm_sngss7_data.cfg.mtp1Link[rcId].chan, + g_ftdm_sngss7_data.cfg.mtp3Link[rcId].id, + DECODE_LSN_LINK_STATUS(sta.t.ssta.s.snDLSAP.state), + (sta.t.ssta.s.snDLSAP.locBlkd) ? "Y":"N", + (sta.t.ssta.s.snDLSAP.remBlkd) ? "Y":"N", + (sta.t.ssta.s.snDLSAP.locInhbt) ? "Y":"N", + (sta.t.ssta.s.snDLSAP.rmtInhbt) ? "Y":"N" + ); + + return FTDM_SUCCESS; +} + +/****************************************************************************** +* Fun: cli_ss7_show_mtp3link_by_name() +* Desc: display all relay channels information +* Param: +* stream : output stream object +* rcName: mtp3 link's name +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_mtp3link_by_name(ftdm_stream_handle_t *stream, char *name) +{ + int x=0; + SS7_RELAY_DBG_FUN(cli_ss7_show_mtp3link_by_name); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + ftdm_assert_return(!ftdm_strlen_zero(name), FTDM_FAIL, "Null MTP3 link name\n"); + + for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { + return cli_ss7_show_mtp3link_by_id(stream, x ); + } + } + + stream->write_function(stream, "The MTP3 link with name \'%s\' is not found. \n", name); + return FTDM_FAIL; +} +/****************************************************************************** +* Fun: cli_ss7_show_all_mtp3link() +* Desc: display all mtp3 links information +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_all_mtp3link(ftdm_stream_handle_t *stream) +{ + int x = 0; + + SS7_RELAY_DBG_FUN(cli_ss7_show_all_mtp3link); + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + for (x = 0; x < (MAX_MTP_LINKS + 1); x++) { + if (!ftdm_strlen_zero(g_ftdm_sngss7_data.cfg.mtp3Link[x].name)) { + cli_ss7_show_mtp3link_by_id(stream, x); + } + } + + return FTDM_SUCCESS; +} + + +/****************************************************************************** +* Fun: cli_ss7_show_all_linkset() +* Desc: display all mtp3 linksets information +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_all_linkset(ftdm_stream_handle_t *stream) +{ + int x = 0; + SnMngmt sta; + + SS7_RELAY_DBG_FUN(cli_ss7_show_all_linkset); + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + x = 1; + while(x < (MAX_MTP_LINKSETS+1)) { + if (!ftdm_strlen_zero(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name)) { + if (ftmod_ss7_mtplinkSet_sta(x, &sta)) { + stream->write_function(stream, "Failed to read linkset=%s status\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); + } else { + stream->write_function(stream, "name=%s|state=%s|nmbActLnk=%d\n", + g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, + DECODE_LSN_LINKSET_STATUS(sta.t.ssta.s.snLnkSet.state), sta.t.ssta.s.snLnkSet.nmbActLnks + ); + } + } + x++; + } + return FTDM_SUCCESS; +} + + +/****************************************************************************** +* Fun: cli_ss7_show_general() +* Desc: display all general information about ss7 +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_general(ftdm_stream_handle_t *stream) +{ + SS7_RELAY_DBG_FUN(cli_ss7_show_general); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + stream->write_function(stream, "MTP2 status: \n"); + cli_ss7_show_all_mtp2link(stream); + + stream->write_function(stream, "\nMTP3 status: \n"); + cli_ss7_show_all_mtp3link(stream); + + stream->write_function(stream, "\nMTP3 linkset status: \n"); + cli_ss7_show_all_linkset(stream); + +#if 0 + stream->write_function(stream, "\nMTP3 link route status: \n"); + + stream->write_function(stream, "\nISUP status: \n"); +#endif + + stream->write_function(stream, "\nRelay status: \n"); + cli_ss7_show_all_relay(stream); + + return FTDM_SUCCESS; +} + +/****************************************************************************** +* Fun: cli_ss7_show_relay_by_id() +* Desc: display all relay channels information +* Param: +* stream : output stream object +* rcId : channel's id +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_relay_by_id(ftdm_stream_handle_t *stream, int rcId) +{ + RyMngmt sta; + + SS7_RELAY_DBG_FUN(cli_ss7_show_relay_by_id); + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + memset(&sta, 0x0, sizeof(sta)); + if (ftmod_ss7_relay_status(g_ftdm_sngss7_data.cfg.relay[rcId].id, &sta)) { + stream->write_function(stream, "Failed to read relay =%s status\n", g_ftdm_sngss7_data.cfg.relay[rcId].name); + return FTDM_FAIL; + } + + stream->write_function(stream, "name=%s|sap=%d|type=%d|port=%d|hostname=%s|procId=%d|status=%s\n", + g_ftdm_sngss7_data.cfg.relay[rcId].name, + g_ftdm_sngss7_data.cfg.relay[rcId].id, + g_ftdm_sngss7_data.cfg.relay[rcId].type, + g_ftdm_sngss7_data.cfg.relay[rcId].port, + g_ftdm_sngss7_data.cfg.relay[rcId].hostname, + g_ftdm_sngss7_data.cfg.relay[rcId].procId, + DECODE_LRY_CHAN_STATUS(sta.t.ssta.rySta.cStatus) + ); + + return FTDM_SUCCESS; +} +/****************************************************************************** +* Fun: cli_ss7_show_relay_by_name() +* Desc: display all relay channels information +* Param: +* stream : output stream object +* rcName: channel's name +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_relay_by_name(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + SS7_RELAY_DBG_FUN(cli_ss7_show_relay_by_name); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + ftdm_assert_return(!ftdm_strlen_zero(name), FTDM_FAIL, "Null relay link name\n"); + + for (x = 1; x < MAX_RELAY_CHANNELS; x++) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.relay[x].name, name)) { + return cli_ss7_show_relay_by_id(stream, x); + } + } + + stream->write_function( stream, "The relay channel with name \'%s\' is not found. \n", name); + return FTDM_FAIL; + +} +/****************************************************************************** +* Fun: cli_ss7_show_all_relay() +* Desc: display all relay channels information +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_all_relay(ftdm_stream_handle_t *stream) +{ + int x = 0; + SS7_RELAY_DBG_FUN(cli_ss7_show_relay_by_name); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + + for (x = 1; x < MAX_RELAY_CHANNELS; x++) { + if (!ftdm_strlen_zero(g_ftdm_sngss7_data.cfg.relay[x].name)) { + cli_ss7_show_relay_by_id (stream, x); + } + } + + return FTDM_SUCCESS; +} + + +/****************************************************************************** +* Fun: cli_ss7_show_channel_detail_of_span() +* Desc: display span information of a given id +* Param: +* stream : output stream object +* span_id : span id string received from cli +* chan_id : channel id string received from cli +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_channel_detail_of_span(ftdm_stream_handle_t *stream, char *span_id, char *chan_id) +{ + int x, y; + + SS7_RELAY_DBG_FUN(cli_ss7_show_channel_detail_of_span); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + ftdm_assert_return(span_id != 0, FTDM_FAIL, "Invalid span id\n"); + ftdm_assert_return(chan_id != 0, FTDM_FAIL, "Invalid chan id\n"); + + x = atoi(span_id); + y = atoi(chan_id); + if (!x) { + stream->write_function( stream, "Span \'%s\' does not exist. \n", span_id); + return FTDM_FAIL; + } + + return handle_show_status(stream, x, y, 1); +} + +/****************************************************************************** +* Fun: cli_ss7_show_all_channels_of_span() +* Desc: display span information of a given id +* Param: +* stream : output stream object +* span_id : span id string received from cli +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_all_channels_of_span(ftdm_stream_handle_t *stream, char *span_id) +{ + int x=-1; + SS7_RELAY_DBG_FUN(cli_ss7_show_all_channels_of_span); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + ftdm_assert_return(span_id != 0, FTDM_FAIL, "Invalid span id\n"); + + x = atoi(span_id); + if (!x) { + stream->write_function( stream, "Span \'%s\' does not exist. \n", span_id); + return FTDM_FAIL; + } + return handle_show_status(stream, x, 0, 1); +} + +/****************************************************************************** +* Fun: cli_ss7_show_span_by_id() +* Desc: display span information of a given id +* Param: +* stream : output stream object +* span_id : span id string received from cli +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_span_by_id(ftdm_stream_handle_t *stream, char *span_id) +{ + int x = -1; + + SS7_RELAY_DBG_FUN(cli_ss7_show_span_by_id); + + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + ftdm_assert_return(span_id != 0, FTDM_FAIL, "Invalid span id\n"); + + x = atoi(span_id); + if (!x) { + stream->write_function(stream, "Span \'%s\' does not exist. \n", span_id); + return FTDM_FAIL; + } + +#if 0 + stream->write_function( stream, "JZ: we should display span details here \n" ); +#endif + + cli_ss7_show_all_channels_of_span(stream, span_id); + + return FTDM_FAIL; +} + + +/****************************************************************************** +* Fun: cli_ss7_show_all_spans_detail() +* Desc: display all spans information in detail +* Param: +* stream : output stream object +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_all_spans_detail(ftdm_stream_handle_t *stream) +{ + SS7_RELAY_DBG_FUN(cli_ss7_show_all_spans_detail); + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + return handle_show_status(stream, 0, 0, 1); +} + +/****************************************************************************** +* Fun: cli_ss7_show_all_spans_general() +* Desc: display all spans information in general +* Param: +* stream : output stream object +* Ret: FTDM_SUCCESS | FTDM_FAIL +* Note: +* author: James Zhang +*******************************************************************************/ +static ftdm_status_t cli_ss7_show_all_spans_general(ftdm_stream_handle_t *stream) +{ + SS7_RELAY_DBG_FUN(cli_ss7_show_all_spans_general); + ftdm_assert_return(stream != NULL, FTDM_FAIL, "Null stream\n"); + return FTDM_FAIL; +} + /******************************************************************************/ /* 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 b541e1b551..26356220ec 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 @@ -1643,8 +1643,8 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_mutex_lock(ftdmchan->mutex); /* check if the channel is blocked */ - if (!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) { - SS7_WARN("Received UBL on circuit that is not blocked!\n"); + if (!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) && !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) { + SS7_WARN("Received UBL on circuit that is not blocked! span= %d, chan= %d , flag = %x \n", g_ftdm_sngss7_data.cfg.isupCkt[circuit].span, g_ftdm_sngss7_data.cfg.isupCkt[circuit].chan,sngss7_info->blk_flags ); } /* throw the unblock flag */ @@ -1652,6 +1652,8 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* clear the block flag */ sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX_DN); /* set the channel to suspended state */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); @@ -1692,14 +1694,6 @@ ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ DECODE_LCC_EVENT(evntType)); } - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* KONRAD FIX ME */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; } @@ -2453,6 +2447,8 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**********************************************************************/ case 0: /* maintenance oriented */ sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); + 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); break; /**********************************************************************/ case 1: /* hardware failure oriented */ 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 4c6c16350d..b13c98b1e6 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 @@ -486,47 +486,47 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic); } - x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; + x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; while ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) && - (g_ftdm_sngss7_data.cfg.isupCkt[x].id < ((g_ftdm_sngss7_data.cfg.procId +1) * 1000))) { - /**********************************************************************/ + (g_ftdm_sngss7_data.cfg.isupCkt[x].id < ((g_ftdm_sngss7_data.cfg.procId + 1) * MAX_CIC_MAP_LENGTH))) { + /**********************************************************************/ /* confirm this is a voice channel and not a gap/sig (no ftdmchan there) */ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != SNG_CKT_VOICE) goto move_along; + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { + /* compare the intfIds */ + if (g_ftdm_sngss7_data.cfg.isupCkt[x].infId == intfId) { + /* we have a match, setup the pointers to the correct values */ + circuit = x; - /* compare the intfIds */ - if (g_ftdm_sngss7_data.cfg.isupCkt[x].infId == intfId) { - /* we have a match, setup the pointers to the correct values */ - circuit = x; + /* 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_DEBUG("[CIC:%d]Rx %s but circuit is not active yet, skipping!\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + x++; + continue; + } - /* 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_DEBUG("[CIC:%d]Rx %s but circuit is not active yet, skipping!\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - DECODE_LCC_EVENT(evntType)); - continue; - } - - 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; + 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; + } + + /* bounce out of the loop */ + break; } + } - /* bounce out of the loop */ - break; - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].intfId == intfId) */ - -move_along: - /* move along ... nothing to see here */ x++; - - /**********************************************************************/ - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ + /**********************************************************************/ + } /* check if we found any circuits that are on the intfId, drop the message - * if none are found - */ - if (ftdmchan == NULL) goto sta_ind_end; + * if none are found */ + if (!ftdmchan) { + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } break; /**************************************************************************/ @@ -544,7 +544,6 @@ move_along: SS7_FUNC_TRACE_EXIT(__FUNCTION__); return; } - break; /**************************************************************************/ } /* switch (evntType) */ @@ -571,9 +570,6 @@ move_along: /* enqueue this event */ ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); - -sta_ind_end: - SS7_FUNC_TRACE_EXIT(__FUNCTION__); } /******************************************************************************/ 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 4b5787c0cb..bddcd39eca 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 @@ -31,6 +31,7 @@ * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /* INCLUDE ********************************************************************/ #include "ftmod_sangoma_ss7_main.h" /******************************************************************************/ @@ -353,6 +354,8 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) char buf[50]; int x = 1; + SS7_RELAY_DBG_FUN(handle_sng_mtp3_alarm); + memset(buf, '\0', sizeof(buf)); switch (sta->hdr.elmId.elmnt) { @@ -492,6 +495,8 @@ void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta) char tmp[25]; char *p = NULL; int x = 0; + + SS7_RELAY_DBG_FUN(handle_sng_isup_alarm); /* initalize the msg variable to NULLs */ memset(&msg[0], '\0', sizeof(&msg)); @@ -502,7 +507,6 @@ void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta) return; } - /* point p to the first spot in msg */ p = &msg[0]; @@ -742,6 +746,7 @@ void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta) void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta) { + SS7_RELAY_DBG_FUN(handle_sng_cc_alarm); return; } /* handle_cc_alarm */ @@ -749,6 +754,7 @@ void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta) void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta) { + SS7_RELAY_DBG_FUN(handle_sng_relay_alarm); switch (sta->hdr.elmId.elmnt) { /**************************************************************************/ 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 a849bf2f62..9f2cbbac25 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 @@ -60,6 +60,7 @@ static ftdm_status_t ftdm_sangoma_ss7_stop (ftdm_span_t * span); static ftdm_status_t ftdm_sangoma_ss7_start (ftdm_span_t * span); /******************************************************************************/ + /* STATE MAP ******************************************************************/ ftdm_state_map_t sangoma_ss7_state_map = { { @@ -281,7 +282,37 @@ ftdm_state_map_t sangoma_ss7_state_map = { } }; -/******************************************************************************/ +static void handle_hw_alarm(ftdm_event_t *e) +{ + sngss7_chan_data_t *ss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + int x = 0; + + ftdm_assert(e != NULL, "Null event!\n"); + + for (x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0; x++) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + if (e->channel->span_id == ftdmchan->physical_span_id && + e->channel->chan_id == ftdmchan->physical_chan_id) { + if (e->enum_id == FTDM_OOB_ALARM_TRAP) { + sngss7_set_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX); + if (ftdmchan->state != FTDM_CHANNEL_STATE_SUSPENDED) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + } + } else { + sngss7_set_ckt_blk_flag(ss7_info, FLAG_GRP_HW_UNBLK_TX); + sngss7_clear_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX); + if (ftdmchan->state != FTDM_CHANNEL_STATE_SUSPENDED) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + } + } + } + } + } +} /* MONITIOR THREADS ***********************************************************/ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) @@ -293,6 +324,9 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) sngss7_event_data_t *sngss7_event = NULL; sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; + int b_alarm_test = 1; + sngss7_chan_data_t *ss7_info=NULL; + ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id); /* set IN_THREAD flag so that we know this thread is running */ @@ -311,6 +345,30 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) } while (ftdm_running () && !(ftdm_test_flag (ftdmspan, FTDM_SPAN_STOP_THREAD))) { + int x = 0; + if (b_alarm_test) { + b_alarm_test = 0; + for (x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1; + g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0; x++) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + if (!ftdmchan) { + continue; + } + + if (ftdmchan->alarm_flags != 0) { /* we'll send out block */ + sngss7_set_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX ); + } else { /* we'll send out reset */ + sngss7_clear_ckt_blk_flag( ss7_info, FLAG_GRP_HW_BLOCK_TX ); + sngss7_clear_ckt_blk_flag( ss7_info, FLAG_GRP_HW_BLOCK_TX_DN ); + sngss7_set_ckt_blk_flag (ss7_info, FLAG_GRP_HW_UNBLK_TX); + } + } + usleep(50); + } + ftdmchan = NULL; + } /* check the channel state queue for an event*/ switch ((ftdm_interrupt_multiple_wait(ftdm_sangoma_ss7_int, 2, 100))) { @@ -388,7 +446,11 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) switch (ftdm_span_poll_event(ftdmspan, 0, NULL)) { /**********************************************************************/ case FTDM_SUCCESS: - while (ftdm_span_next_event(ftdmspan, &event) == FTDM_SUCCESS); + while (ftdm_span_next_event(ftdmspan, &event) == FTDM_SUCCESS) { + if (event->e_type == FTDM_EVENT_OOB) { + handle_hw_alarm(event); + } + } break; /**********************************************************************/ case FTDM_TIMEOUT: @@ -1106,16 +1168,97 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* clear the unblock flag */ sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX); - /* bring the sig status up */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); + /* not bring the cic up if there is a hardware block */ + if( !sngss7_test_ckt_blk_flag(sngss7_info, (FLAG_GRP_HW_BLOCK_TX | FLAG_GRP_HW_BLOCK_TX_DN) ) ) { + /* bring the sig status up */ + sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - /* send a uba */ - ft_to_sngss7_uba (ftdmchan); + /* send a uba */ + ft_to_sngss7_uba (ftdmchan); + } /* check the last state and return to it to allow the call to finish */ goto suspend_goto_last; } + + /**********************************************************************/ + /* hardware block/unblock tx */ + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_GRP_HW_BLOCK_TX ) && + !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN )) { + + SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_BLOCK_TX flag %s\n", ""); + sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); + + /* dont send block again if the channel is already blocked by maintenance */ + 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) + ) { + ft_to_sngss7_blo(ftdmchan); + } + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN); + + goto suspend_goto_last; + } + + if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_TX)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_UNBLK_TX flag %s\n", ""); + + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX_DN); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_TX); + + /* do not set the channel up if it's blocked by blo/cgb command OR blocked by receiving blo/cgb */ + if (!sngss7_test_ckt_blk_flag(sngss7_info, ( FLAG_CKT_MN_BLOCK_TX + | FLAG_CKT_MN_BLOCK_TX + | FLAG_GRP_MN_BLOCK_TX + | FLAG_GRP_MN_BLOCK_TX_DN + | FLAG_CKT_MN_BLOCK_RX + | FLAG_CKT_MN_BLOCK_RX_DN + | FLAG_GRP_MN_BLOCK_RX + | FLAG_GRP_MN_BLOCK_RX_DN + ) + ) + ) { + sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); + ft_to_sngss7_ubl(ftdmchan); + } + + goto suspend_goto_last; + } +#if 0 +//jz: there is no such thing of "remote hw block". for receiver, there are only block and unblock + + /**********************************************************************/ + // jz: hardware block/unblock rx + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_GRP_HW_BLOCK_RX ) && + !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN )) { + + SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_BLOCK_RX flag %s\n", ""); + + sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); + ft_to_sngss7_bla(ftdmchan); + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN); + + goto suspend_goto_last; + } + + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_GRP_HW_UNBLK_RX )){ + SS7_DEBUG_CHAN(ftdmchan, "Processing FLAG_GRP_HW_UNBLK_RX flag %s\n", ""); + + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX_DN); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_UNBLK_RX); + sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); + + ft_to_sngss7_uba(ftdmchan); + + goto suspend_goto_last; + } +#endif + + + /**********************************************************************/ 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)) { @@ -1146,11 +1289,14 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* clear the unblock flag */ 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); + /* not bring the cic up if there is a hardware block */ + if (!sngss7_test_ckt_blk_flag(sngss7_info, (FLAG_GRP_HW_BLOCK_TX | FLAG_GRP_HW_BLOCK_TX_DN))) { + /* bring the sig status up */ + sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); - /* send a ubl */ - ft_to_sngss7_ubl (ftdmchan); + /* send a ubl */ + ft_to_sngss7_ubl(ftdmchan); + } /* check the last state and return to it to allow the call to finish */ goto suspend_goto_last; @@ -1628,6 +1774,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) ftdm_log (FTDM_LOG_INFO, "Starting ftmod_sangoma_ss7 unload...\n"); + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED)) { sng_isup_free_cc(); sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC_STARTED); @@ -1666,13 +1813,15 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) /* send the specific configuration */ if (ftmod_ss7_disable_relay_channel(x)) { SS7_CRITICAL("Relay Channel %d disable failed!\n", x); - return 1; + /* jz: dont leave like this + * 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; + g_ftdm_sngss7_data.cfg.relay[x].flags &= ~(SNGSS7_CONFIGURED); } /* if !SNGSS7_CONFIGURED */ x++; } /* while (x < (MAX_RELAY_CHANNELS)) */ @@ -1682,6 +1831,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY_STARTED); } + if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED)) { sng_isup_free_sm(); sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_SM_STARTED); 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 cda6225217..7a116ecbb4 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 @@ -64,12 +64,10 @@ (switchtype == LSI_SW_ANS92) || \ (switchtype == LSI_SW_ANS95) -typedef struct ftdm2trillium -{ +typedef struct ftdm2trillium { uint8_t ftdm_val; uint8_t trillium_val; -}ftdm2trillium_t; - +} ftdm2trillium_t; typedef enum { SNGSS7_CON_IND_EVENT = 0, @@ -609,22 +607,20 @@ typedef enum { "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", \ + "RX GRP MN BLK", \ + "RX GRP MN BLK DN", \ + "TX GRP MN BLK", \ + "TX GRP MN BLK DN", \ "TX GRP HW UNBLK", \ - "TX GRP HW UNBLK DN" + "TX GRP HW UNBLK DN", \ + "TX GRP MN UNBLK", \ + "TX GRP MN UNBLK DN", \ + "RX GRP HW UNBLK", \ + "RX 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 */ @@ -1042,13 +1038,12 @@ if (ftdmchan->state == new_state) { \ #define sngss7_set_options(obj, option) ((obj)->options |= (option)) -#ifdef SS7_PRODUCTION -# define SS7_ASSERT \ - SS7_INFO_CHAN(ftdmchan,"Production Mode, continuing%s\n", ""); +#ifdef SMG_RELAY_DBG +#define SS7_RELAY_DBG(a,...) printf(a"\n", ##__VA_ARGS__) +#define SS7_RELAY_DBG_FUN(a) printf(#a"\n") #else -# define SS7_ASSERT \ - SS7_ERROR_CHAN(ftdmchan, "Debugging Mode, ending%s\n", ""); \ - *(int*)0=0; +#define SS7_RELAY_DBG(a, ...) +#define SS7_RELAY_DBG_FUN(a) #endif /******************************************************************************/ From 339b26e83deaa35c58fd5aa5ab9e18f7acce8701 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 28 Sep 2011 11:56:19 -0400 Subject: [PATCH 0009/1057] mod_sofia: Resolved issue #1547 - SIP INFO not working The dtmf_type member was incorrectly being set to NONE if the SDP does not advertise RFC2833 support (which has nothing to do with SIP INFO) --- src/mod/endpoints/mod_sofia/mod_sofia.c | 5 +++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3165484b0e..2f78a4182b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1359,10 +1359,12 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi switch (dtmf_type) { case DTMF_2833: { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Enqueuing RFC2833 DTMF %c of length %d\n", dtmf->digit, dtmf->duration); return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf); } case DTMF_INFO: { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending INFO DTMF %c of length %d\n", dtmf->digit, dtmf->duration); snprintf(message, sizeof(message), "Signal=%c\r\nDuration=%d\r\n", dtmf->digit, dtmf->duration / 8); switch_mutex_lock(tech_pvt->sofia_mutex); nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"), SIPTAG_PAYLOAD_STR(message), TAG_END()); @@ -1370,6 +1372,9 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi } break; case DTMF_NONE: + { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding DTMF %c of length %d, DTMF type is NONE\n", dtmf->digit, dtmf->duration); + } break; default: switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unhandled DTMF type!\n"); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 062da61a98..ae10ccc0aa 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4847,10 +4847,12 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } } 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; + if (tech_pvt->dtmf_type == DTMF_2833) { + 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 ac693947f95e8aec1b2659418b1b5a96c87a653c Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 28 Sep 2011 13:23:30 -0400 Subject: [PATCH 0010/1057] freetdm: Fix SS7 T35 timer --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c | 7 ++++--- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c index ff66cc6b41..10afc65bc9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c @@ -56,21 +56,22 @@ void handle_isup_t35(void *userdata) ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + ftdm_channel_lock(ftdmchan); + /* Q.764 2.2.5 Address incomplete (T35 expiry action is hangup with cause 28 according to Table A.1/Q.764) */ SS7_ERROR("[Call-Control] Timer 35 expired on CIC = %d\n", sngss7_info->circuit->cic); /* set the flag to indicate this hangup is started from the local side */ sngss7_set_ckt_flag(sngss7_info, FLAG_LOCAL_REL); /* hang up on timer expiry */ - ftdmchan->caller_data.hangup_cause = 28; + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_INVALID_NUMBER_FORMAT; /* end the call */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); /*unlock*/ - ftdm_mutex_unlock(ftdmchan->mutex); + ftdm_channel_unlock(ftdmchan); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return; 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 2794eb497c..d7fc553e2f 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 @@ -2966,9 +2966,10 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = ccSpan->t17; } if (ccSpan->t35 == 0) { - g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 170; + /* Q.764 2.2.5 Address incomplete (T35 is 15-20 seconds according to Table A.1/Q.764) */ + g_ftdm_sngss7_data.cfg.isupCkt[x].t35 = 170; } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = ccSpan->t35; + g_ftdm_sngss7_data.cfg.isupCkt[x].t35 = ccSpan->t35; } if (ccSpan->tval == 0) { g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10; From 5f0d27fdb4cea004902d9936126a9cf66c5d52b7 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 28 Sep 2011 19:15:35 -0400 Subject: [PATCH 0011/1057] freetdm: Fix SS7 ISUP T10 (Overlap digit timeout) - issue #1445 --- .../ftmod_sangoma_ss7_handle.c | 2 ++ .../ftmod_sangoma_ss7_main.c | 35 ++++++++++++++++--- .../ftmod_sangoma_ss7_main.h | 4 ++- .../ftmod_sangoma_ss7_timers.c | 35 ++++++++++++++++++- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 30 +++++++++------- 5 files changed, 87 insertions(+), 19 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 26356220ec..213c4c8d4d 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 @@ -405,6 +405,8 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ append_tknStr_from_sngss7(siCnStEvnt->subNum.addrSig, ftdmchan->caller_data.dnis.digits, siCnStEvnt->subNum.oddEven); + SS7_DEBUG_CHAN(ftdmchan,"[CIC:%d]Rx SAM (digits = %s)\n", sngss7_info->circuit->cic, + ftdmchan->caller_data.dnis.digits); } else { SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in SAM!%s\n", " "); } 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 9f2cbbac25..5341983e46 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 @@ -592,6 +592,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) i++; } + /* kill t10 if active */ + if (sngss7_info->t10.hb_timer_id) { + ftdm_sched_cancel_timer (sngss7_info->t10.sched, sngss7_info->t10.hb_timer_id); + } + /* check if the end of pulsing (ST) character has arrived or the right number of digits */ if (ftdmchan->caller_data.dnis.digits[i-1] == 'F') { SS7_DEBUG_CHAN(ftdmchan, "Received the end of pulsing character %s\n", ""); @@ -613,7 +618,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } else { /* if we are coming from idle state then we have already been here once before */ if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) { - SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n", + SS7_INFO_CHAN(ftdmchan, "Received %d out of %d so far: %s...starting T35\n", i, sngss7_info->circuit->min_digits, ftdmchan->caller_data.dnis.digits); @@ -628,7 +633,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); - ftdmchan->caller_data.hangup_cause = 41; + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; /* set the flag to indicate this hangup is started from the local side */ sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); @@ -636,9 +641,29 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* end the call */ state_flag = 0; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } /* if (ftdm_sched_timer(sngss7_info->t35.sched, */ - } /* if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) */ - } /* checking ST/#digits */ + } + } + + /* start ISUP t10 */ + if (ftdm_sched_timer (sngss7_info->t10.sched, + "t10", + sngss7_info->t10.beat, + sngss7_info->t10.callback, + &sngss7_info->t10, + &sngss7_info->t10.hb_timer_id)) { + + SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); + + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; + + /* set the flag to indicate this hangup is started from the local side */ + sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL); + + /* end the call */ + state_flag = 0; + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + } + } 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 7a116ecbb4..d58d2a5331 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 @@ -288,7 +288,6 @@ typedef struct sng_isup_intf { uint32_t ssf; uint32_t isap; uint16_t t4; - uint32_t t10; uint32_t t11; uint32_t t18; uint32_t t19; @@ -344,6 +343,7 @@ typedef struct sng_isup_ckt { uint8_t transparent_iam; void *obj; uint16_t t3; + uint32_t t10; uint16_t t12; uint16_t t13; uint16_t t14; @@ -471,6 +471,7 @@ typedef struct sngss7_chan_data { void *raw_data; /* send on next sigevent */ sngss7_glare_data_t glare; sngss7_timer_data_t t35; + sngss7_timer_data_t t10; sngss7_group_data_t rx_grs; sngss7_group_data_t rx_gra; sngss7_group_data_t tx_grs; @@ -887,6 +888,7 @@ ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data /* in ftmod_sangoma_ss7_timers.c */ void handle_isup_t35(void *userdata); +void handle_isup_t10(void *userdata); /******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c index 10afc65bc9..6138ea34b0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2009, Konrad Hammel + * Copyright (c) 2009, Sangoma Technologies + * Konrad Hammel * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,6 +30,11 @@ * 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. + * + * Contributors: + * + * Moises Silva + * */ /* INCLUDE ********************************************************************/ @@ -70,12 +76,39 @@ void handle_isup_t35(void *userdata) /* end the call */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + /* kill t10 if active */ + if (sngss7_info->t10.hb_timer_id) { + ftdm_sched_cancel_timer (sngss7_info->t10.sched, sngss7_info->t10.hb_timer_id); + } + /*unlock*/ ftdm_channel_unlock(ftdmchan); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return; } + + +void handle_isup_t10(void *userdata) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_timer_data_t *timer = userdata; + sngss7_chan_data_t *sngss7_info = timer->sngss7_info; + ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; + + ftdm_channel_lock(ftdmchan); + + SS7_DEBUG("[Call-Control] Timer 10 expired on CIC = %d\n", sngss7_info->circuit->cic); + + /* send the call to the user */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + + ftdm_channel_unlock(ftdmchan); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); +} + /******************************************************************************/ /* 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 d7fc553e2f..acb29ba385 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 @@ -127,6 +127,7 @@ typedef struct sng_ccSpan uint8_t itx_auto_reply; uint8_t transparent_iam; uint32_t t3; + uint32_t t10; uint32_t t12; uint32_t t13; uint32_t t14; @@ -1570,11 +1571,6 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) sng_isap.t9 = atoi(parm->val); SS7_DEBUG("Found isup t9 = %d\n",sng_isap.t9); /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isup.t10")) { - /**********************************************************************/ - sng_isup.t10 = atoi(parm->val); - SS7_DEBUG("Found isup t10 = %d\n",sng_isup.t10); - /**********************************************************************/ } else if (!strcasecmp(parm->var, "isup.t11")) { /**********************************************************************/ sng_isup.t11 = atoi(parm->val); @@ -1965,6 +1961,10 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) /**********************************************************************/ sng_ccSpan.t3 = atoi(parm->val); SS7_DEBUG("Found isup t3 = %d\n", sng_ccSpan.t3); + } else if (!strcasecmp(parm->var, "isup.t10")) { + /**********************************************************************/ + sng_ccSpan.t10 = atoi(parm->val); + SS7_DEBUG("Found isup t10 = %d\n", sng_ccSpan.t10); /**********************************************************************/ } else if (!strcasecmp(parm->var, "isup.t12")) { /**********************************************************************/ @@ -2584,11 +2584,6 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) } else { g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = 3000; } - if (sng_isup->t10 != 0) { - g_ftdm_sngss7_data.cfg.isupIntf[i].t10 = sng_isup->t10; - } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].t10 = 50; - } if (sng_isup->t11 != 0) { g_ftdm_sngss7_data.cfg.isupIntf[i].t11 = sng_isup->t11; } else { @@ -2935,6 +2930,11 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) } else { g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = ccSpan->t3; } + if (ccSpan->t10 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t10 = 50; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t10 = ccSpan->t10; + } if (ccSpan->t12 == 0) { g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300; } else { @@ -3063,12 +3063,18 @@ static int ftmod_ss7_fill_in_circuits(sng_span_t *sngSpan) ftdmchan->call_data = ss7_info; /* prepare the timer structures */ - ss7_info->t35.sched = ((sngss7_span_data_t *)(ftdmspan->signal_data))->sched; + ss7_info->t35.sched = ((sngss7_span_data_t *)(ftdmspan->signal_data))->sched; ss7_info->t35.counter = 1; - ss7_info->t35.beat = (isupCkt->t35) * 100; /* beat is in ms, t35 is in 100ms */ + ss7_info->t35.beat = (isupCkt->t35) * 100; /* beat is in ms, t35 is in 100ms */ ss7_info->t35.callback = handle_isup_t35; ss7_info->t35.sngss7_info = ss7_info; + ss7_info->t10.sched = ((sngss7_span_data_t *)(ftdmspan->signal_data))->sched; + ss7_info->t10.counter = 1; + ss7_info->t10.beat = (isupCkt->t10) * 100; /* beat is in ms, t10 is in 100ms */ + ss7_info->t10.callback = handle_isup_t10; + ss7_info->t10.sngss7_info = ss7_info; + /**************************************************************************/ } /* for (i == 1; i < ftdmspan->chan_count; i++) */ From 7a598e8f33961fffab369aec7a0241aa77162223 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 30 Sep 2011 16:45:46 -0400 Subject: [PATCH 0012/1057] Added option for Dynamic TEI on BRI PTP --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 1 + .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c | 5 ++++- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c | 8 +++++++- 3 files changed, 12 insertions(+), 2 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 8d36511b91..e1de27a889 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 @@ -262,6 +262,7 @@ typedef struct sngisdn_span_data { uint8_t raw_trace_q921; /* TODO: combine with trace_flags */ uint8_t timer_t3; uint8_t restart_opt; + uint8_t dynamic_tei; uint8_t restart_timeout; uint8_t force_sending_complete; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; 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 b53c37fbe9..363ecd2769 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 @@ -284,6 +284,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT; signal_data->timer_t3 = 8; signal_data->restart_opt = SNGISDN_OPT_DEFAULT; + signal_data->dynamic_tei = SNGISDN_OPT_DEFAULT; signal_data->link_id = span->span_id; signal_data->transfer_timeout = 20000; signal_data->att_remove_dtmf = SNGISDN_OPT_DEFAULT; @@ -361,7 +362,9 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ parse_yesno(var, val, &signal_data->restart_opt); } else if (!strcasecmp(var, "channel-restart-timeout")) { signal_data->restart_timeout = atoi(val); - } else if (!strcasecmp(var, "local-number")) { + } else if (!strcasecmp(var, "dynamic-tei")) { + parse_yesno(var, val, &signal_data->dynamic_tei); + } else if (!strcasecmp(var, "local-number")) { if (add_local_number(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } 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 9402cd34a8..a92831d425 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 @@ -846,7 +846,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.dChannelNum = 0; /* Unused for BRI */ cfg.t.cfg.s.inDLSAP.nmbBearChan = NUM_BRI_CHANNELS_PER_SPAN; cfg.t.cfg.s.inDLSAP.firstBChanNum = 1; - cfg.t.cfg.s.inDLSAP.callRefLen = 1; + cfg.t.cfg.s.inDLSAP.callRefLen = 1; cfg.t.cfg.s.inDLSAP.teiAlloc = IN_STATIC; cfg.t.cfg.s.inDLSAP.intCfg = IN_INTCFG_PTPT; break; @@ -863,6 +863,12 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) return FTDM_FAIL; } + /* Override TEI teiAlloc Option if user specified it */ + if (signal_data->dynamic_tei != SNGISDN_OPT_DEFAULT ) { + ftdm_log(FTDM_LOG_DEBUG, "%s: TEI allocation set to %s\n", (signal_data->dynamic_tei == SNGISDN_OPT_TRUE)? "dynamic": "static"); + cfg.t.cfg.s.inDLSAP.teiAlloc = (signal_data->dynamic_tei==SNGISDN_OPT_TRUE)?IN_DYNAMIC:IN_STATIC; + } + if (sng_isdn_q931_config(&pst, &cfg)) { return FTDM_FAIL; } From 36619284e915aba8ee007e80a240fee73b0e3e34 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 30 Sep 2011 17:15:36 -0400 Subject: [PATCH 0013/1057] freetdm: typo in print --- .../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 a92831d425..8033fad305 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 @@ -865,7 +865,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) /* Override TEI teiAlloc Option if user specified it */ if (signal_data->dynamic_tei != SNGISDN_OPT_DEFAULT ) { - ftdm_log(FTDM_LOG_DEBUG, "%s: TEI allocation set to %s\n", (signal_data->dynamic_tei == SNGISDN_OPT_TRUE)? "dynamic": "static"); + ftdm_log(FTDM_LOG_DEBUG, "%s: TEI allocation set to %s\n", span->name, (signal_data->dynamic_tei == SNGISDN_OPT_TRUE)? "dynamic": "static"); cfg.t.cfg.s.inDLSAP.teiAlloc = (signal_data->dynamic_tei==SNGISDN_OPT_TRUE)?IN_DYNAMIC:IN_STATIC; } From 621337ff1535e679ef0383e5e0950f5b07aee0f3 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 4 Oct 2011 13:20:58 -0400 Subject: [PATCH 0014/1057] freetdm: Increased T310 to 120 sec on network side, added check for ces when handling Restarts --- .../ftmod_sangoma_isdn_stack_cfg.c | 21 +++++-- .../ftmod_sangoma_isdn_stack_hndl.c | 62 ++++++++++++------- .../ftmod_sangoma_isdn_stack_rcv.c | 14 ++--- 3 files changed, 63 insertions(+), 34 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 8033fad305..2b9bceea25 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 @@ -681,7 +681,11 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.clrGlr = FALSE; /* in case of glare, do not clear local call */ cfg.t.cfg.s.inDLSAP.statEnqOpt = TRUE; - cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; + if (signal_data->ftdm_span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } else { + cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; + } } else { cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; cfg.t.cfg.s.inDLSAP.intType = USER; @@ -772,15 +776,13 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.tmr.t307.val = 35; cfg.t.cfg.s.inDLSAP.tmr.t308.enb = TRUE; cfg.t.cfg.s.inDLSAP.tmr.t308.val = 4; + cfg.t.cfg.s.inDLSAP.tmr.t310.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t310.val = 120; if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - cfg.t.cfg.s.inDLSAP.tmr.t310.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t310.val = 10; cfg.t.cfg.s.inDLSAP.tmr.t312.enb = TRUE; cfg.t.cfg.s.inDLSAP.tmr.t312.val = cfg.t.cfg.s.inDLSAP.tmr.t303.val+2; } else { - cfg.t.cfg.s.inDLSAP.tmr.t310.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t310.val = 120; cfg.t.cfg.s.inDLSAP.tmr.t312.enb = FALSE; } @@ -908,7 +910,14 @@ ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span) cfg.t.cfg.s.inLCe.sapId = signal_data->dchan_id; - cfg.t.cfg.s.inLCe.lnkUpDwnInd = TRUE; + if (span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + /* Stack will send Restart CFM's each time link is established (TEI negotiated), + and we do not want thi s event */ + cfg.t.cfg.s.inLCe.lnkUpDwnInd = FALSE; + } else { + cfg.t.cfg.s.inLCe.lnkUpDwnInd = TRUE; + } + cfg.t.cfg.s.inLCe.tCon.enb = TRUE; cfg.t.cfg.s.inLCe.tCon.val = 35; cfg.t.cfg.s.inLCe.tDisc.enb = TRUE; 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 e95a582a45..19a9b62b0a 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 @@ -1178,7 +1178,16 @@ void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) ftdm_log(FTDM_LOG_CRIT, "Received RESTART CFM on unconfigured span (suId:%d)\n", suId); return; } - + + ftdm_log(FTDM_LOG_DEBUG, "%s: Processing RESTART CFM (suId:%u dChan:%d ces:%d %s(%d))\n", + signal_data->ftdm_span->name, + suId, dChan, ces, + (evntType == IN_LNK_DWN)?"LNK_DOWN": + (evntType == IN_LNK_UP)?"LNK_UP": + (evntType == IN_INDCHAN)?"b-channel": + (evntType == IN_LNK_DWN_DM_RLS)?"NFAS service procedures": + (evntType == IN_SWCHD_BU_DCHAN)?"NFAS switchover to backup":"Unknown", evntType); + if (rstEvnt->rstInd.eh.pres == PRSNT_NODEF && rstEvnt->rstInd.rstClass.pres == PRSNT_NODEF) { switch(rstEvnt->rstInd.rstClass.val) { case IN_CL_INDCHAN: /* Indicated b-channel */ @@ -1212,19 +1221,29 @@ void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) } if (chan_no) { /* For a single channel */ - if (chan_no > ftdm_span_get_chan_count(signal_data->ftdm_span)) { - ftdm_log(FTDM_LOG_CRIT, "Received RESTART on invalid channel:%d\n", chan_no); - } else { - ftdm_channel_t *ftdmchan = ftdm_span_get_channel(signal_data->ftdm_span, chan_no); - sngisdn_bring_down(ftdmchan); + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; + + chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + if (sngisdn_info->ces == ces && ftdmchan->physical_chan_id == chan_no) { + sngisdn_bring_down(ftdmchan); + } } + ftdm_iterator_free(chaniter); } else { /* for all channels */ ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - sngisdn_bring_down((ftdm_channel_t*)ftdm_iterator_current(curr)); + ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + if (sngisdn_info->ces == ces) { + sngisdn_bring_down(ftdmchan); + } } ftdm_iterator_free(chaniter); } @@ -1305,28 +1324,29 @@ void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event) } if (chan_no) { /* For a single channel */ - if (chan_no > ftdm_span_get_chan_count(signal_data->ftdm_span)) { - ftdm_log(FTDM_LOG_CRIT, "Received RESTART IND on invalid channel:%d\n", chan_no); - } else { - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - - chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - if (ftdmchan->physical_chan_id == chan_no) { - sngisdn_bring_down(ftdmchan); - } + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; + + chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + if (sngisdn_info->ces == ces && ftdmchan->physical_chan_id == chan_no) { + sngisdn_bring_down(ftdmchan); } - ftdm_iterator_free(chaniter); } + ftdm_iterator_free(chaniter); } else { /* for all channels */ ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - sngisdn_bring_down((ftdm_channel_t*)ftdm_iterator_current(curr)); + ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + if (sngisdn_info->ces == ces) { + sngisdn_bring_down(ftdmchan); + } } ftdm_iterator_free(chaniter); } 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 3788a9c25b..8ae33cee0a 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 @@ -990,27 +990,27 @@ void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...) switch (level) { case SNG_LOGLEVEL_DEBUG: - ftdm_log(FTDM_LOG_DEBUG, "sng_isdn->%s", data); + ftdm_log(FTDM_LOG_DEBUG, "sng_isdn->%s\n", data); break; case SNG_LOGLEVEL_WARN: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s\n", data); break; case SNG_LOGLEVEL_INFO: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s\n", data); break; case SNG_LOGLEVEL_STATS: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s\n", data); break; case SNG_LOGLEVEL_ERROR: - ftdm_log(FTDM_LOG_ERROR, "sng_isdn->%s", data); + ftdm_log(FTDM_LOG_ERROR, "sng_isdn->%s\n", data); /*ftdm_assert(0, "Got an error from stack");*/ break; case SNG_LOGLEVEL_CRIT: - ftdm_log(FTDM_LOG_CRIT, "sng_isdn->%s", data); + ftdm_log(FTDM_LOG_CRIT, "sng_isdn->%s\n", data); /* ftdm_assert(0, "Got an error from stack"); */ break; default: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s\n", data); break; } ftdm_safe_free(data); From ba2b3fcabbedb548daa06005f451130e626cc6eb Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 5 Oct 2011 11:50:40 -0400 Subject: [PATCH 0015/1057] Added cid-name-in-display-ie option --- .../freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 1 + .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c | 4 ++-- 2 files changed, 3 insertions(+), 2 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 e1de27a889..fee68ec41a 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 @@ -265,6 +265,7 @@ typedef struct sngisdn_span_data { uint8_t dynamic_tei; uint8_t restart_timeout; uint8_t force_sending_complete; + uint8_t cid_name_in_display_ie; /* In BRI, send the CID-name inside Display IE instead of Usr-usr */ char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_timer_id_t timers[SNGISDN_NUM_SPAN_TIMERS]; ftdm_sched_t *sched; 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 d744ad2942..af2c2e95d1 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 @@ -705,8 +705,8 @@ ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) return FTDM_SUCCESS; } - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || - ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + if (FTDM_SPAN_IS_BRI(ftdmchan->span) && + signal_data->cid_name_in_display_ie != SNGISDN_OPT_TRUE) { conEvnt->usrUsr.eh.pres = PRSNT_NODEF; conEvnt->usrUsr.protocolDisc.pres = PRSNT_NODEF; From 2cf9b21e067033322ec643a6b05c88a35b21a519 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 5 Oct 2011 11:51:10 -0400 Subject: [PATCH 0016/1057] Added cid-name-in-display-ie option --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c | 2 ++ 1 file changed, 2 insertions(+) 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 363ecd2769..e5928720a0 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 @@ -404,6 +404,8 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ #else ftdm_log(FTDM_LOG_WARNING, "chan-id-invert-extend-bit is not supported in your version of libsng_isdn\n"); #endif + } else if (!strcasecmp(var, "cid-name-in-display-ie")) { + parse_yesno(var, val, &signal_data->cid_name_in_display_ie); } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } From 3d456185e4860bd64fce74299ecdfb4c719707b6 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 6 Oct 2011 12:45:00 -0400 Subject: [PATCH 0017/1057] freetdm: Added SS7 variables for location number (pending SIP-X header integration) --- .../ftmod_sangoma_ss7_handle.c | 30 ++++++++++++++++++- 1 file changed, 29 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 213c4c8d4d..cacb854372 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 @@ -93,7 +93,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - char var[10]; + char var[FTDM_DIGITS_LIMIT]; memset(var, '\0', sizeof(var)); @@ -216,6 +216,34 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ sprintf(var, "%d", siConEvnt->cdPtyNum.natAddrInd.val); sngss7_add_var(sngss7_info, "ss7_cld_nadi", var); + /* Retrieve the Location Number if present (see ITU Q.763, 3.30) */ + if (siConEvnt->cgPtyNum1.eh.pres) { + if (siConEvnt->cgPtyNum1.addrSig.pres) { + /* fill in the ss7 location address number */ + copy_tknStr_from_sngss7(siConEvnt->cgPtyNum1.addrSig, var, siConEvnt->cgPtyNum1.oddEven); + sngss7_add_var(sngss7_info, "ss7_loc_digits", var); + } + + if (siConEvnt->cgPtyNum1.scrnInd.pres) { + /* fill in the screening indication value */ + sprintf(var, "%d", siConEvnt->cgPtyNum1.scrnInd.val); + sngss7_add_var(sngss7_info, "ss7_loc_screen_ind", var); + } + + if (siConEvnt->cgPtyNum1.presRest.pres) { + /* fill in the presentation value */ + sprintf(var, "%d", siConEvnt->cgPtyNum1.presRest.val); + sngss7_add_var(sngss7_info, "ss7_loc_pres_ind", var); + } + + if (siConEvnt->cgPtyNum1.natAddrInd.pres) { + sprintf(var, "%d", siConEvnt->cgPtyNum1.natAddrInd.val); + sngss7_add_var(sngss7_info, "ss7_loc_nadi", var); + } + } else { + SS7_DEBUG_CHAN(ftdmchan, "No Location Number information in IAM%s\n", " "); + } + sprintf(var, "%d", sngss7_info->circuit->cic); sngss7_add_var(sngss7_info, "ss7_cic", var); From 081e73d9f3f90f74ce83f89966f513c130f6b20a Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 6 Oct 2011 17:54:46 -0400 Subject: [PATCH 0018/1057] freetdm: ftmod_wanpipe - remove debug idle messages for good, not worth the noise --- libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index d0d66205a5..696a41f0cf 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -884,12 +884,6 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t } if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_tx_idle_packets) { - /* HDLC channels do not always transmit, so its ok for drivers to fill with idle - * also do not report idle warning when we just started transmitting */ - if (ftdmchan->iostats.tx.packets && FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Tx idle changed from %d to %d\n", - ftdmchan->iostats.tx.idle_packets, tx_stats->wp_api_tx_hdr_tx_idle_packets); - } ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; } From bca480e667c714332c638100428962739dc782e4 Mon Sep 17 00:00:00 2001 From: yannick Date: Thu, 6 Oct 2011 17:36:50 -0400 Subject: [PATCH 0019/1057] ftdm: fixing reset on in-use channel causing infinite state loop. --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 8 +++++-- .../ftmod_sangoma_ss7_main.c | 24 ++++++++++++++----- 2 files changed, 24 insertions(+), 8 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 9ff19bac02..ee97e9f356 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 @@ -29,6 +29,10 @@ * 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. + * + * Contributors: + * James Zhang + * */ #if 0 @@ -1198,7 +1202,7 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span, } #ifdef SMG_RELAY_DBG - stream->write_function(stream, " blk_flag= %x ckt_flag = %d", ss7_info->blk_flags, ss7_info->ckt_flags ); + stream->write_function(stream," blk_flag=%x | ckt_flag=%x | chan_flag=%x", ss7_info->blk_flags, ss7_info->ckt_flags, ftdmchan->flags); #endif stream->write_function(stream, "\n"); } /* if ( span and chan) */ @@ -1312,7 +1316,7 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, } #ifdef SMG_RELAY_DBG - stream->write_function(stream," blk_flag= %x ckt_flag = %d", ss7_info->blk_flags, ss7_info->ckt_flags ); + stream->write_function(stream," blk_flag=%x | ckt_flag=%x | chan_flag=%x", ss7_info->blk_flags, ss7_info->ckt_flags, ftdmchan->flags); #endif stream->write_function(stream, "\n"); } /* if ( hole, sig, voice) */ 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 5341983e46..44870a69a9 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 @@ -842,9 +842,18 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) { /* check if this hangup is from a tx RSC */ if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) { - /* go to RESTART State until RSCa is received */ - state_flag = 0; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + if (!sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT)) { + ft_to_sngss7_rsc (ftdmchan); + sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + } else if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP)) { + state_flag = 0; + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } else { + /* go to RESTART State until RSCa is received */ + state_flag = 0; + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + } } else { /* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */ if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) && @@ -1040,9 +1049,12 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) 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); + /* don't send out reset before finished hanging up if I'm in-use. */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { + /* 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)) */ From fb77b6c8009d1b670b0617e40c2f4958865a951b Mon Sep 17 00:00:00 2001 From: James Zhang Date: Thu, 6 Oct 2011 18:53:38 -0400 Subject: [PATCH 0020/1057] freetdm: ss7 - fixing reset on in-use channel causing signaling down in the receiving side --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 44870a69a9..049aa1546d 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 @@ -944,7 +944,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* check if we came from reset (aka we just processed a reset) */ if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) || - (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED)) { + (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) || + (ftdmchan->last_state == FTDM_CHANNEL_STATE_HANGUP_COMPLETE)) { + /* check if reset flags are up indicating there is more processing to do yet */ if (!(sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) && From e7ecb4d63aea56b9f17cf53a67e3c5a920077fee Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 6 Oct 2011 12:45:00 -0400 Subject: [PATCH 0021/1057] freetdm: Added SS7 variables for location number (pending SIP-X header integration) --- .../ftmod_sangoma_ss7_handle.c | 22 +++++++++++++++++++ 1 file changed, 22 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 cacb854372..bb6f19181b 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 @@ -223,6 +223,28 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ copy_tknStr_from_sngss7(siConEvnt->cgPtyNum1.addrSig, var, siConEvnt->cgPtyNum1.oddEven); sngss7_add_var(sngss7_info, "ss7_loc_digits", var); } + if (siConEvnt->cgPtyNum1.scrnInd.pres) { + /* fill in the screening indication value */ + sprintf(var, "%d", siConEvnt->cgPtyNum1.scrnInd.val); + sngss7_add_var(sngss7_info, "ss7_loc_screen_ind", var); + } + + if (siConEvnt->cgPtyNum1.presRest.pres) { + /* fill in the presentation value */ + sprintf(var, "%d", siConEvnt->cgPtyNum1.presRest.val); + sngss7_add_var(sngss7_info, "ss7_loc_pres_ind", var); + } + + if (siConEvnt->cgPtyNum1.natAddrInd.pres) { + sprintf(var, "%d", siConEvnt->cgPtyNum1.natAddrInd.val); + sngss7_add_var(sngss7_info, "ss7_loc_nadi", var); + } + } else { + SS7_DEBUG_CHAN(ftdmchan, "No Location Number information in IAM%s\n", " "); + } + + sprintf(var, "%d", sngss7_info->circuit->cic); + sngss7_add_var(sngss7_info, "ss7_cic", var); if (siConEvnt->cgPtyNum1.scrnInd.pres) { /* fill in the screening indication value */ From edad46647b6b50b1fa67bb3b192147ef6c619710 Mon Sep 17 00:00:00 2001 From: James Zhang Date: Fri, 30 Sep 2011 16:03:08 -0400 Subject: [PATCH 0022/1057] ftdm: change max_path length from 255 to 4096 --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h | 2 +- 1 file changed, 1 insertion(+), 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 d58d2a5331..caef19af12 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 @@ -51,7 +51,7 @@ /* DEFINES ********************************************************************/ #define MAX_NAME_LEN 25 -#define MAX_PATH 255 +#define MAX_PATH 4096 #define MAX_CIC_LENGTH 5 #define MAX_CIC_MAP_LENGTH 1000 From 20abac27940f98368defe6d791f09497904fd40c Mon Sep 17 00:00:00 2001 From: James Zhang Date: Fri, 30 Sep 2011 10:25:21 -0400 Subject: [PATCH 0023/1057] ftdm_ss7: Adding OPC and Call Reference Number to SIP x-headers --- libs/freetdm/mod_freetdm/mod_freetdm.c | 15 +++++++++++++++ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 043f353aa3..d18a647329 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1830,6 +1830,21 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session 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); + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_opc"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-OPC", "%s", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_lac"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-LAC", "%s", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_crn"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CRN", "%s", var_value); + } } /* Add any call variable to the dial plan */ 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 bb6f19181b..c625ff443c 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 @@ -269,6 +269,14 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ sprintf(var, "%d", sngss7_info->circuit->cic); sngss7_add_var(sngss7_info, "ss7_cic", var); + sprintf(var, "%d", g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].spc ); + sngss7_add_var(sngss7_info, "ss7_opc", var); + + if (siConEvnt->callRef.callId.pres) { + sprintf(var, "%u", (unsigned int)siConEvnt->callRef.callId.val); + sngss7_add_var(sngss7_info, "ss7_crn", var); + } + if (sngss7_info->circuit->transparent_iam) { sngss7_save_iam(ftdmchan, siConEvnt); } From 591cbe78573051d9729911efb30e5f5d088720c4 Mon Sep 17 00:00:00 2001 From: James Zhang Date: Fri, 30 Sep 2011 11:52:33 -0400 Subject: [PATCH 0024/1057] fixing bug 1625 - relay status not reported properly in the cli --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ee97e9f356..9eb737a7f3 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 @@ -1308,7 +1308,9 @@ 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_blk_flag(ss7_info, FLAG_RELAY_DOWN)) { + + if (g_ftdm_sngss7_data.cfg.procId != 1) { + /* if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_RELAY_DOWN)) { */ stream->write_function(stream, "relay=Y|"); }else { stream->write_function(stream, "relay=N"); From c0f988b292924f3e25aff5b5b1e6d243c61b9a06 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 30 Sep 2011 13:09:13 -0400 Subject: [PATCH 0025/1057] freetdm: changing call reference to generic header; removing location area code --- libs/freetdm/mod_freetdm/mod_freetdm.c | 13 ++----------- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 5 +++-- libs/freetdm/src/include/freetdm.h | 1 + 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index d18a647329..cd5dc07d01 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1830,21 +1830,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-Screen", "%d", channel_caller_data->screen); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres); - + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CallReference", "%d", channel_caller_data->call_reference); + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_opc"); if (!ftdm_strlen_zero(var_value)) { switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-OPC", "%s", var_value); } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_lac"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-LAC", "%s", var_value); - } - - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_crn"); - if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CRN", "%s", var_value); - } } /* Add any call variable to the dial plan */ 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 c625ff443c..5acc8d1214 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 @@ -273,8 +273,9 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_add_var(sngss7_info, "ss7_opc", var); if (siConEvnt->callRef.callId.pres) { - sprintf(var, "%u", (unsigned int)siConEvnt->callRef.callId.val); - sngss7_add_var(sngss7_info, "ss7_crn", var); + ftdmchan->caller_data.call_reference = (unsigned int)siConEvnt->callRef.callId.val; + } else { + ftdmchan->caller_data.call_reference = 0; } if (sngss7_info->circuit->transparent_iam) { diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 238314c560..585a5d72ae 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -362,6 +362,7 @@ typedef struct ftdm_caller_data { /* user information layer 1 protocol */ ftdm_user_layer1_prot_t bearer_layer1; ftdm_calling_party_category_t cpc; /*!< Calling party category */ + uint32_t call_reference; ftdm_channel_t *fchan; /*!< FreeTDM channel associated (can be NULL) */ From 3a44e4c1868435039a47c42e4cacaf77a4033960 Mon Sep 17 00:00:00 2001 From: James Zhang Date: Thu, 6 Oct 2011 19:16:03 -0400 Subject: [PATCH 0026/1057] freetdm: ss7 - fix cherry-pick conflict properly --- .../ftmod_sangoma_ss7_handle.c | 22 ------------------- 1 file changed, 22 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 5acc8d1214..dab2035450 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 @@ -223,28 +223,6 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ copy_tknStr_from_sngss7(siConEvnt->cgPtyNum1.addrSig, var, siConEvnt->cgPtyNum1.oddEven); sngss7_add_var(sngss7_info, "ss7_loc_digits", var); } - if (siConEvnt->cgPtyNum1.scrnInd.pres) { - /* fill in the screening indication value */ - sprintf(var, "%d", siConEvnt->cgPtyNum1.scrnInd.val); - sngss7_add_var(sngss7_info, "ss7_loc_screen_ind", var); - } - - if (siConEvnt->cgPtyNum1.presRest.pres) { - /* fill in the presentation value */ - sprintf(var, "%d", siConEvnt->cgPtyNum1.presRest.val); - sngss7_add_var(sngss7_info, "ss7_loc_pres_ind", var); - } - - if (siConEvnt->cgPtyNum1.natAddrInd.pres) { - sprintf(var, "%d", siConEvnt->cgPtyNum1.natAddrInd.val); - sngss7_add_var(sngss7_info, "ss7_loc_nadi", var); - } - } else { - SS7_DEBUG_CHAN(ftdmchan, "No Location Number information in IAM%s\n", " "); - } - - sprintf(var, "%d", sngss7_info->circuit->cic); - sngss7_add_var(sngss7_info, "ss7_cic", var); if (siConEvnt->cgPtyNum1.scrnInd.pres) { /* fill in the screening indication value */ From 946f8af5a9543978e561676018c45c55da34b5e7 Mon Sep 17 00:00:00 2001 From: yannick Date: Tue, 27 Sep 2011 15:44:20 -0400 Subject: [PATCH 0027/1057] freetdm: resolve mtp2 on relay always down problem --- .../ftmod_sangoma_ss7_relay.c | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) 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 bfb6971297..c99a14a7e7 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 @@ -49,7 +49,7 @@ ftdm_status_t handle_relay_disconnect(RyMngmt *sta); 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 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); /******************************************************************************/ @@ -59,43 +59,26 @@ ftdm_status_t handle_relay_connect(RyMngmt *sta) { sng_relay_t *sng_relay = &g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id]; - - /* test if this is the first time the channel comes up */ if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) { - SS7_INFO("Relay Channel %d initial connection UP\n", sng_relay->id); - - /* mark the channel as being up */ + /* SS7_INFO("Relay Channel %d initial connection UP\n", sng_relay->id); */ sngss7_set_flag(sng_relay, SNGSS7_RELAY_INIT); - } else { - 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): - /* reconfigure all ISUP ckts, since the main system would have lost all configs */ + } + + SS7_INFO("Relay Channel %d connection UP\n", sng_relay->id); + if (sng_relay->type == LRY_CT_TCP_CLIENT) { + if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) { if (reconfig_all_ckts_for_relay()) { SS7_ERROR("Failed to reconfigure ISUP Ckts!\n"); /* we're done....this is very bad! */ } - break; - /******************************************************************/ - case (LRY_CT_TCP_SERVER): - /* 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: - break; - /******************************************************************/ - } /* switch (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id].type) */ - } /* intial up? */ - - return FTDM_SUCCESS; + } + return FTDM_SUCCESS; + } else if (sng_relay->type == LRY_CT_TCP_SERVER) { + ftmod_ss7_enable_grp_mtp3Link(sta->t.usta.s.ryUpUsta.id); + /* unbloock the ckts on the client system */ + return FTDM_SUCCESS; + } + return FTDM_FAIL; } /******************************************************************************/ @@ -310,6 +293,7 @@ ftdm_status_t disble_all_mtp2_sigs_for_relay(void) } +#if 0 /******************************************************************************/ static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId) { @@ -345,6 +329,7 @@ static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId) return FTDM_SUCCESS; } +#endif /******************************************************************************/ /* For Emacs: From 3b74246b1695f319dcb2022caff67f0b50aba9dd Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 24 Oct 2011 12:43:54 -0400 Subject: [PATCH 0028/1057] freetdm: * Avoid acquiring the span mutex if the pendingchans queue is available for use * * FreeTDM modules using the old FTDM_SPAN_STATE_CHANGE flag should be updated * * until then, they are still vulnerable to deadlock situations * * Modules pending update: (ftmod_analog, ftmod_libpri, ftmod_isdn) * * Fixes Sangoma redmine ticket #1791 0 FTDM span stop deadlock * --- libs/freetdm/src/ftdm_state.c | 13 ++++++++++--- libs/freetdm/src/include/private/ftdm_types.h | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 54ecde530d..d3f99f6074 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -370,12 +370,19 @@ end: } ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_mutex_lock(ftdmchan->span->mutex); - ftdm_set_flag(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); if (ftdmchan->span->pendingchans) { ftdm_queue_enqueue(ftdmchan->span->pendingchans, ftdmchan); + } else { + /* there is a potential deadlock here, if a signaling module is processing + * state changes while the ftdm_span_stop() function is called, the signaling + * thread will block until it can acquire the span lock, but the thread calling + * ftdm_span_stop() which holds the span lock is waiting on the signaling thread + * to finish ... The only reason to acquire the span lock is this flag, new + * signaling modules should use the pendingchans queue instead of this flag, + * as of today a few modules need still to be updated before we can get rid of + * this flag (ie, ftmod_libpri, ftmod_isdn, ftmod_analog) */ + ftdm_set_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); } - ftdm_mutex_unlock(ftdmchan->span->mutex); if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { /* the channel should not block waiting for state processing */ diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 2ed9fd04c5..6df25fe4d2 100755 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -173,6 +173,12 @@ typedef enum { FTDM_SPAN_SUSPENDED = (1 << 3), FTDM_SPAN_IN_THREAD = (1 << 4), FTDM_SPAN_STOP_THREAD = (1 << 5), + /*! Signaling modules set this flag to use fchan->pendingchans queue instead + * of the FTDM_SPAN_STATE_CHANGE flag to detect when there is channels with + * a state change pending in the span. If you set this member you can't rely + * on FTDM_SPAN_STATE_CHANGE anymore and must use the queue only instead. This + * is the new way of detecting state changes, new modules should always set this + * flag, the old modules still relying on FTDM_SPAN_STATE_CHANGE should be updated */ FTDM_SPAN_USE_CHAN_QUEUE = (1 << 6), FTDM_SPAN_SUGGEST_CHAN_ID = (1 << 7), FTDM_SPAN_USE_AV_RATE = (1 << 8), From 680d92967f41de660a64a5981e88b1a12e1a1089 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 24 Oct 2011 13:21:15 -0400 Subject: [PATCH 0029/1057] freetdm: mod_freetdm - add SIP x header for FreeTDM-NADI value --- libs/freetdm/mod_freetdm/mod_freetdm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index cd5dc07d01..055040858f 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1773,6 +1773,11 @@ 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-Plan", "%d", channel_caller_data->rdnis.plan); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", ftdm_calling_party_category2str(channel_caller_data->cpc)); + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_clg_nadi"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-NADI", "%d", var_value); + } + 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); From 71f0c6fde5f64a61a9c09996631af052194371fe Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 25 Oct 2011 17:13:07 -0400 Subject: [PATCH 0030/1057] freetdm: added debug ftdm_print_stack macro --- libs/freetdm/src/include/private/ftdm_core.h | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 9c5c9ad468..65ffad677c 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -104,6 +104,10 @@ #include #endif +#ifdef __linux__ +#include +#endif + #include #include #include @@ -220,6 +224,27 @@ extern "C" { #define ftdm_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119) +#ifdef __linux__ +#define ftdm_print_stack(level) \ + do { \ + void *__stacktrace[100] = { 0 }; \ + char **__symbols = NULL; \ + int __size = 0; \ + int __i = 0; \ + __size = backtrace(__stacktrace, ftdm_array_len(__stacktrace)); \ + __symbols = backtrace_symbols(__stacktrace, __size); \ + if (__symbols) { \ + for (__i = 0; __i < __size; __i++) { \ + ftdm_log(__level, "%s\n", __symbols[i]); \ + } \ + free(__symbols); \ + } \ + } while (0); +#else +#define ftdm_print_stack(level) ftdm_log(level, "FTDM_PRINT_STACK is not implemented in this operating system!\n"); +#endif + + #define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) /*! \brief Copy flags from one arbitrary object to another From fe1294ba91bc66d58fa6bfad58f9efa53b8b1e7b Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 28 Oct 2011 09:35:49 -0400 Subject: [PATCH 0031/1057] freetdm: ss7 - add china switchtype to the configuration options --- libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 1 + 1 file changed, 1 insertion(+) 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 acb29ba385..4333f02887 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 @@ -62,6 +62,7 @@ sng_switch_type_t sng_switch_type_map[] = { 1, "india" , LSI_SW_INDIA , LSI_SW_INDIA }, { 1, "uk" , LSI_SW_UK , LSI_SW_UK }, { 1, "russia" , LSI_SW_RUSSIA , LSI_SW_RUSSIA }, + { 1, "china" , LSI_SW_CHINA , LSI_SW_CHINA }, { 0, "", 0, 0 }, }; From 6f2e3f91ec2f0ae94c47f1046d9842aed2d7f340 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Thu, 3 Nov 2011 19:23:00 -0400 Subject: [PATCH 0032/1057] Support for sending Caller ID Name on 4ESS/5ESS --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 71 +++++++++++++++ .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 11 ++- .../ftmod_sangoma_isdn_cfg.c | 32 +++++-- .../ftmod_sangoma_isdn_stack_cfg.c | 6 -- .../ftmod_sangoma_isdn_support.c | 89 +++++++++---------- 5 files changed, 147 insertions(+), 62 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 c3aa964d4d..262cd9d03d 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 @@ -1155,6 +1155,77 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) return FTDM_FAIL; } + if (span_data->cid_name_method == SNGISDN_CID_NAME_AUTO) { + switch (span_data->switchtype) { + case SNGISDN_SWITCH_EUROISDN: + if (FTDM_SPAN_IS_BRI(span)) { + span_data->cid_name_method = SNGISDN_CID_NAME_USR_USR_IE; + } else { + span_data->cid_name_method = SNGISDN_CID_NAME_DISPLAY_IE; + } + break; + case SNGISDN_SWITCH_DMS100: + span_data->cid_name_method = SNGISDN_CID_NAME_DISPLAY_IE; + break; + case SNGISDN_SWITCH_NI2: + case SNGISDN_SWITCH_5ESS: + case SNGISDN_SWITCH_4ESS: + span_data->cid_name_method = SNGISDN_CID_NAME_FACILITY_IE; + break; + default: + break; + } + } + + if (span_data->send_cid_name == SNGISDN_OPT_DEFAULT) { + switch (span_data->switchtype) { + case SNGISDN_SWITCH_EUROISDN: +#ifdef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY + case SNGISDN_SWITCH_NI2: + case SNGISDN_SWITCH_5ESS: + case SNGISDN_SWITCH_4ESS: +#endif + if (span_data->signalling == SNGISDN_SIGNALING_NET) { + span_data->send_cid_name = SNGISDN_OPT_TRUE; + } else { + span_data->send_cid_name = SNGISDN_OPT_FALSE; + } + break; + case SNGISDN_SWITCH_DMS100: + span_data->send_cid_name = SNGISDN_OPT_TRUE; + break; +#ifndef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY + case SNGISDN_SWITCH_NI2: + case SNGISDN_SWITCH_5ESS: + case SNGISDN_SWITCH_4ESS: + span_data->send_cid_name = SNGISDN_OPT_FALSE; + break; +#endif + default: + span_data->send_cid_name = SNGISDN_OPT_FALSE; + break; + } + } else if (span_data->send_cid_name == SNGISDN_OPT_TRUE) { + switch (span_data->switchtype) { + case SNGISDN_SWITCH_NI2: + case SNGISDN_SWITCH_5ESS: + case SNGISDN_SWITCH_4ESS: +#ifndef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY + ftdm_log(FTDM_LOG_WARNING, "Sending Calling Name in Facility IE not supported, please update your libsng_isdn library\n"); + span_data->send_cid_name = SNGISDN_OPT_FALSE; +#endif + break; + case SNGISDN_SWITCH_INSNET: /* Don't know how to transmit caller ID name on INSNET */ + case SNGISDN_SWITCH_QSIG: /* It seems like QSIG does not support Caller ID */ + span_data->send_cid_name = SNGISDN_OPT_FALSE; + break; + case SNGISDN_SWITCH_EUROISDN: + break; + default: + span_data->send_cid_name = SNGISDN_OPT_FALSE; + break; + } + } span->start = ftdm_sangoma_isdn_start; span->stop = ftdm_sangoma_isdn_stop; 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 fee68ec41a..a095b0d57e 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 @@ -132,6 +132,13 @@ typedef enum { SNGISDN_AVAIL_UP = 10, } sngisdn_avail_t; +typedef enum { + SNGISDN_CID_NAME_AUTO, + SNGISDN_CID_NAME_DISPLAY_IE, + SNGISDN_CID_NAME_USR_USR_IE, + SNGISDN_CID_NAME_FACILITY_IE, +} sngisdn_cid_name_t; + typedef enum { SNGISDN_EVENT_CON_IND = 1, SNGISDN_EVENT_CON_CFM, @@ -262,10 +269,10 @@ typedef struct sngisdn_span_data { uint8_t raw_trace_q921; /* TODO: combine with trace_flags */ uint8_t timer_t3; uint8_t restart_opt; - uint8_t dynamic_tei; uint8_t restart_timeout; uint8_t force_sending_complete; - uint8_t cid_name_in_display_ie; /* In BRI, send the CID-name inside Display IE instead of Usr-usr */ + uint8_t cid_name_method; + uint8_t send_cid_name; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_timer_id_t timers[SNGISDN_NUM_SPAN_TIMERS]; ftdm_sched_t *sched; 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 e5928720a0..ba9226b9bc 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 @@ -284,12 +284,14 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT; signal_data->timer_t3 = 8; signal_data->restart_opt = SNGISDN_OPT_DEFAULT; - signal_data->dynamic_tei = SNGISDN_OPT_DEFAULT; signal_data->link_id = span->span_id; signal_data->transfer_timeout = 20000; signal_data->att_remove_dtmf = SNGISDN_OPT_DEFAULT; signal_data->force_sending_complete = SNGISDN_OPT_DEFAULT; + signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO; + signal_data->send_cid_name = SNGISDN_OPT_DEFAULT; + span->default_caller_data.dnis.plan = FTDM_NPI_INVALID; span->default_caller_data.dnis.type = FTDM_TON_INVALID; span->default_caller_data.cid_num.plan = FTDM_NPI_INVALID; @@ -362,8 +364,6 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ parse_yesno(var, val, &signal_data->restart_opt); } else if (!strcasecmp(var, "channel-restart-timeout")) { signal_data->restart_timeout = atoi(val); - } else if (!strcasecmp(var, "dynamic-tei")) { - parse_yesno(var, val, &signal_data->dynamic_tei); } else if (!strcasecmp(var, "local-number")) { if (add_local_number(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; @@ -404,8 +404,30 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ #else ftdm_log(FTDM_LOG_WARNING, "chan-id-invert-extend-bit is not supported in your version of libsng_isdn\n"); #endif - } else if (!strcasecmp(var, "cid-name-in-display-ie")) { - parse_yesno(var, val, &signal_data->cid_name_in_display_ie); + } else if (!strcasecmp(var, "cid-name-transmit-method")) { + if (!strcasecmp(val, "display-ie")) { + signal_data->cid_name_method = SNGISDN_CID_NAME_DISPLAY_IE; + } else if (!strcasecmp(val, "user-user-ie")) { + signal_data->cid_name_method = SNGISDN_CID_NAME_USR_USR_IE; + } else if (!strcasecmp(val, "facility-ie")) { + signal_data->cid_name_method = SNGISDN_CID_NAME_FACILITY_IE; + } else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic") || !strcasecmp(val, "default")) { + signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO; + } else { + ftdm_log(FTDM_LOG_WARNING, "Invalid option %s for parameter %s\n", val, var); + signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO; + } + } else if (!strcasecmp(var, "send-cid-name")) { + if (!strcasecmp(val, "yes")) { + signal_data->send_cid_name = SNGISDN_OPT_TRUE; + } else if (!strcasecmp(val, "no")) { + signal_data->send_cid_name = SNGISDN_OPT_FALSE; + } else if (!strcasecmp(val, "auto") || !strcasecmp(val, "automatic") || !strcasecmp(val, "default")) { + signal_data->send_cid_name = SNGISDN_OPT_DEFAULT; + } else { + ftdm_log(FTDM_LOG_WARNING, "Invalid option %s for parameter %s\n", val, var); + signal_data->send_cid_name = SNGISDN_OPT_DEFAULT; + } } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } 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 2b9bceea25..b121fee6cf 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 @@ -865,12 +865,6 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) return FTDM_FAIL; } - /* Override TEI teiAlloc Option if user specified it */ - if (signal_data->dynamic_tei != SNGISDN_OPT_DEFAULT ) { - ftdm_log(FTDM_LOG_DEBUG, "%s: TEI allocation set to %s\n", span->name, (signal_data->dynamic_tei == SNGISDN_OPT_TRUE)? "dynamic": "static"); - cfg.t.cfg.s.inDLSAP.teiAlloc = (signal_data->dynamic_tei==SNGISDN_OPT_TRUE)?IN_DYNAMIC:IN_STATIC; - } - if (sng_isdn_q931_config(&pst, &cfg)) { return FTDM_FAIL; } 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 af2c2e95d1..095221dcfa 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 @@ -696,70 +696,61 @@ ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) { uint8_t len; - ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - /* sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; */ + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + len = strlen(caller_data->cid_name); if (!len) { return FTDM_SUCCESS; } - if (FTDM_SPAN_IS_BRI(ftdmchan->span) && - signal_data->cid_name_in_display_ie != SNGISDN_OPT_TRUE) { + if (signal_data->send_cid_name == SNGISDN_OPT_FALSE) { + return FTDM_SUCCESS; + } - conEvnt->usrUsr.eh.pres = PRSNT_NODEF; - conEvnt->usrUsr.protocolDisc.pres = PRSNT_NODEF; - conEvnt->usrUsr.protocolDisc.val = PD_IA5; /* IA5 chars */ - conEvnt->usrUsr.usrInfo.pres = PRSNT_NODEF; - conEvnt->usrUsr.usrInfo.len = len; - /* in sangoma_brid we used to send usr-usr info as !, - change to previous style if current one does not work */ - memcpy(conEvnt->usrUsr.usrInfo.val, caller_data->cid_name, len); - } else { - switch (signal_data->switchtype) { - case SNGISDN_SWITCH_NI2: + switch(signal_data->cid_name_method) { + case SNGISDN_CID_NAME_FACILITY_IE: #ifdef SNGISDN_SUPPORT_CALLING_NAME_IN_FACILITY - { - if (signal_data->signalling == SNGISDN_SIGNALING_NET) { - sng_isdn_encode_facility_caller_name(caller_data->cid_name, conEvnt->facilityStr.facilityStr.val, &conEvnt->facilityStr.facilityStr.len); - conEvnt->facilityStr.eh.pres = PRSNT_NODEF; - conEvnt->facilityStr.facilityStr.pres = PRSNT_NODEF; - } - } + /* Note: The Facility IE will be overwritten if user chose to transmit a Raw Facility IE */ + sng_isdn_encode_facility_caller_name(caller_data->cid_name, conEvnt->facilityStr.facilityStr.val, &conEvnt->facilityStr.facilityStr.len); + conEvnt->facilityStr.eh.pres = PRSNT_NODEF; + conEvnt->facilityStr.facilityStr.pres = PRSNT_NODEF; #endif break; - case SNGISDN_SWITCH_EUROISDN: - if (signal_data->signalling != SNGISDN_SIGNALING_NET) { - break; + case SNGISDN_CID_NAME_USR_USR_IE: + conEvnt->usrUsr.eh.pres = PRSNT_NODEF; + conEvnt->usrUsr.protocolDisc.pres = PRSNT_NODEF; + conEvnt->usrUsr.protocolDisc.val = PD_IA5; /* IA5 chars */ + conEvnt->usrUsr.usrInfo.pres = PRSNT_NODEF; + conEvnt->usrUsr.usrInfo.len = len; + /* in sangoma_brid we used to send usr-usr info as !, + change to previous style if current one does not work */ + memcpy(conEvnt->usrUsr.usrInfo.val, caller_data->cid_name, len); + break; + case SNGISDN_CID_NAME_DISPLAY_IE: + if (signal_data->switchtype == SNGISDN_SWITCH_DMS100) { + conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; + conEvnt->ntDisplay[0].dispTypeNt.pres = PRSNT_NODEF; + conEvnt->ntDisplay[0].dispTypeNt.val = 0x01; /* Calling Party Name */ + conEvnt->ntDisplay[0].assocInfo.pres = PRSNT_NODEF; + conEvnt->ntDisplay[0].assocInfo.val = 0x03; /* Included */ + conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; + conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; + conEvnt->ntDisplay[0].dispInfo.pres = PRSNT_NODEF; + conEvnt->ntDisplay[0].dispInfo.len = len; + memcpy(conEvnt->ntDisplay[0].dispInfo.val, caller_data->cid_name, len); + } else { + conEvnt->display.eh.pres = PRSNT_NODEF; + conEvnt->display.dispInfo.pres = PRSNT_NODEF; + conEvnt->display.dispInfo.len = len; + memcpy(conEvnt->display.dispInfo.val, caller_data->cid_name, len); } - /* follow through */ - case SNGISDN_SWITCH_5ESS: - case SNGISDN_SWITCH_4ESS: - conEvnt->display.dispInfo.pres = PRSNT_NODEF; - conEvnt->display.dispInfo.len = len; - memcpy(conEvnt->display.dispInfo.val, caller_data->cid_name, len); break; - case SNGISDN_SWITCH_DMS100: - conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispTypeNt.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispTypeNt.val = 0x01; /* Calling Party Name */ - conEvnt->ntDisplay[0].assocInfo.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].assocInfo.val = 0x03; /* Included */ - conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].eh.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispInfo.pres = PRSNT_NODEF; - conEvnt->ntDisplay[0].dispInfo.len = len; - memcpy(conEvnt->ntDisplay[0].dispInfo.val, caller_data->cid_name, len); + default: break; - case SNGISDN_SWITCH_QSIG: - /* It seems like QSIG does not support Caller ID Name */ - break; - case SNGISDN_SWITCH_INSNET: - /* Don't know how to transmit caller ID name on INSNET */ - break; - } } + return FTDM_SUCCESS; } From 5e5a2ff84b94b1b86eff6c7063c7877b0bc6a581 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Apr 2012 07:50:57 -0500 Subject: [PATCH 0033/1057] FS-4141 --resolve --- src/mod/applications/mod_hash/mod_hash.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index 3a93062ada..5905116883 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -451,8 +451,6 @@ SWITCH_STANDARD_APP(hash_function) value = strdup(argv[3]); switch_assert(value); switch_core_hash_insert(globals.db_hash, hash_key, value); - } else { - switch_safe_free(value); } } else if (!strcasecmp(argv[0], "delete")) { @@ -466,9 +464,9 @@ SWITCH_STANDARD_APP(hash_function) } if ((value = switch_core_hash_find(globals.db_hash, hash_key))) { if(!strcmp(argv[3], value)) { + switch_safe_free(value); switch_core_hash_delete(globals.db_hash, hash_key); } - switch_safe_free(value); } } else { goto usage; @@ -527,7 +525,6 @@ SWITCH_STANDARD_API(hash_api_function) switch_thread_rwlock_wrlock(globals.db_hash_rwlock); if ((value = switch_core_hash_find(globals.db_hash, hash_key))) { stream->write_function(stream, "-ERR key already exists\n"); - switch_safe_free(value); } else { value = strdup(argv[3]); switch_assert(value); @@ -552,12 +549,12 @@ SWITCH_STANDARD_API(hash_api_function) switch_thread_rwlock_wrlock(globals.db_hash_rwlock); if ((value = switch_core_hash_find(globals.db_hash, hash_key))) { if(!strcmp(argv[3],value)) { + switch_safe_free(value); switch_core_hash_delete(globals.db_hash, hash_key); stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR Doesn't match\n"); } - switch_safe_free(value); } else { stream->write_function(stream, "-ERR Not found\n"); } From ffc8e81b763c4e11e02309b99e2a4b4aa666e845 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 23 Apr 2012 17:00:30 +0000 Subject: [PATCH 0034/1057] check for missing unixodbc-dev during configure Previously if --enable-core-odbc-support was set but unixodbc-dev was not available, we would fail during make rather during configure. --- configure.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.in b/configure.in index 4228883fd3..f6d2e091ef 100644 --- a/configure.in +++ b/configure.in @@ -391,6 +391,10 @@ AX_LIB_ODBC if test "$ac_cv_found_odbc" = "yes" ; then enable_core_odbc_support="yes" fi +if test "x$enable_core_odbc_support" != "xno"; then + AC_CHECK_LIB([odbc], [SQLDisconnect],, AC_MSG_ERROR([no usable libodbc; please install unixodbc devel package or equivalent])) +fi + AC_ARG_ENABLE(timerfd-wrapper, From f73804ac6a879c7523f0b988fa5700211cb99635 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 23 Apr 2012 18:40:28 +0000 Subject: [PATCH 0035/1057] mod_gsmopen: remove binaries from tree --- src/mod/endpoints/mod_gsmopen/.gitignore | 1 - src/mod/endpoints/mod_gsmopen/gsmlib/README | 4 +- .../mod_gsmopen/gsmlib/gsmlib_1.10-13.diff | 64915 ---------------- .../gsmlib/gsmlib_1.10.orig.tar.gz | Bin 474591 -> 0 bytes 4 files changed, 2 insertions(+), 64918 deletions(-) delete mode 100644 src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib_1.10-13.diff delete mode 100644 src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib_1.10.orig.tar.gz diff --git a/src/mod/endpoints/mod_gsmopen/.gitignore b/src/mod/endpoints/mod_gsmopen/.gitignore index e2769c8969..9fdeeb1412 100644 --- a/src/mod/endpoints/mod_gsmopen/.gitignore +++ b/src/mod/endpoints/mod_gsmopen/.gitignore @@ -1,3 +1,2 @@ !/gsmlib/gsmlib-*/aclocal.m4 !/gsmlib/gsmlib-*/configure -!/gsmlib/gsmlib_1.10.orig.tar.gz diff --git a/src/mod/endpoints/mod_gsmopen/gsmlib/README b/src/mod/endpoints/mod_gsmopen/gsmlib/README index 709f78f2ca..9dbb65daa8 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmlib/README +++ b/src/mod/endpoints/mod_gsmopen/gsmlib/README @@ -1,8 +1,8 @@ For Linux distros without gsmlib (eg: CentOS): -Here are the original (ancient) sources for gsmlib, and the patch made by Ubuntu for modern compilers. +In the directory gsmlib-1.10-patched-13ubuntu is the source for gsmlib +as patched by Ubuntu for modern compilers: -In the directory gsmlib-1.10-patched-13ubuntu are the patched sources, ready for (no need to patch them again): ./configure make make install diff --git a/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib_1.10-13.diff b/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib_1.10-13.diff deleted file mode 100644 index ddea9c6d8f..0000000000 --- a/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib_1.10-13.diff +++ /dev/null @@ -1,64915 +0,0 @@ ---- gsmlib-1.10.orig/g41.patch -+++ gsmlib-1.10/g41.patch -@@ -0,0 +1,29 @@ -+--- ./gsmlib/gsm_me_ta.h~ 2006-03-09 19:15:59.000000000 +0000 -++++ ./gsmlib/gsm_me_ta.h 2006-03-09 19:16:31.000000000 +0000 -+@@ -291,8 +291,8 @@ -+ // 3 disable phone receive RF circuits only -+ // 4 disable phone both transmit and receive RF circuits -+ // 5...127 implementation-defined -+- int MeTa::getFunctionalityLevel() throw(GsmException); -+- void MeTa::setFunctionalityLevel(int level) throw(GsmException); -++ int getFunctionalityLevel() throw(GsmException); -++ void setFunctionalityLevel(int level) throw(GsmException); -+ -+ // return battery charge status (+CBC): -+ // 0 ME is powered by the battery -+@@ -386,13 +386,13 @@ -+ void setCallWaitingLockStatus(FacilityClass cl, -+ bool lock)throw(GsmException); -+ -+- void MeTa::setCLIRPresentation(bool enable) throw(GsmException); -++ void setCLIRPresentation(bool enable) throw(GsmException); -+ //(+CLIR) -+ -+ // 0:according to the subscription of the CLIR service -+ // 1:CLIR invocation -+ // 2:CLIR suppression -+- int MeTa::getCLIRPresentation() throw(GsmException); -++ int getCLIRPresentation() throw(GsmException); -+ -+ friend class Phonebook; -+ friend class SMSStore; ---- gsmlib-1.10.orig/Makefile.in -+++ gsmlib-1.10/Makefile.in -@@ -1,8 +1,6 @@ --# Makefile.in generated by automake 1.6.3 from Makefile.am. --# @configure_input@ -+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am - --# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 --# Free Software Foundation, Inc. -+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. - # This Makefile.in is free software; the Free Software Foundation - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. -@@ -12,8 +10,6 @@ - # even the implied warranty of MERCHANTABILITY or FITNESS FOR A - # PARTICULAR PURPOSE. - --@SET_MAKE@ -- - # ************************************************************************* - # * GSM TA/ME library - # * -@@ -25,6 +21,8 @@ - # * - # * Created: 21.5.1999 - # ************************************************************************* -+ -+ - SHELL = @SHELL@ - - srcdir = @srcdir@ -@@ -45,9 +43,13 @@ - mandir = @mandir@ - includedir = @includedir@ - oldincludedir = /usr/include -+ -+DESTDIR = -+ - pkgdatadir = $(datadir)/@PACKAGE@ - pkglibdir = $(libdir)/@PACKAGE@ - pkgincludedir = $(includedir)/@PACKAGE@ -+ - top_builddir = . - - ACLOCAL = @ACLOCAL@ -@@ -55,16 +57,12 @@ - AUTOMAKE = @AUTOMAKE@ - AUTOHEADER = @AUTOHEADER@ - --am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd - INSTALL = @INSTALL@ --INSTALL_PROGRAM = @INSTALL_PROGRAM@ -+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) - INSTALL_DATA = @INSTALL_DATA@ --install_sh_DATA = $(install_sh) -c -m 644 --install_sh_PROGRAM = $(install_sh) -c --install_sh_SCRIPT = $(install_sh) -c - INSTALL_SCRIPT = @INSTALL_SCRIPT@ --INSTALL_HEADER = $(INSTALL_DATA) - transform = @program_transform_name@ -+ - NORMAL_INSTALL = : - PRE_INSTALL = : - POST_INSTALL = : -@@ -73,33 +71,38 @@ - POST_UNINSTALL = : - host_alias = @host_alias@ - host_triplet = @host@ -- --EXEEXT = @EXEEXT@ --OBJEXT = @OBJEXT@ --PATH_SEPARATOR = @PATH_SEPARATOR@ --AMTAR = @AMTAR@ -+AR = @AR@ - AS = @AS@ --AWK = @AWK@ - BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ - CATOBJEXT = @CATOBJEXT@ - CC = @CC@ - CPP = @CPP@ - CXX = @CXX@ -+CXXCPP = @CXXCPP@ - DATADIRNAME = @DATADIRNAME@ --DEPDIR = @DEPDIR@ - DLLTOOL = @DLLTOOL@ - ECHO = @ECHO@ -+EGREP = @EGREP@ -+EXEEXT = @EXEEXT@ -+F77 = @F77@ -+GCJ = @GCJ@ -+GCJFLAGS = @GCJFLAGS@ - GENCAT = @GENCAT@ -+GLIBC2 = @GLIBC2@ - GLIBC21 = @GLIBC21@ - GMSGFMT = @GMSGFMT@ - GSM_VERSION = @GSM_VERSION@ -+HAVE_ASPRINTF = @HAVE_ASPRINTF@ - HAVE_LIB = @HAVE_LIB@ --INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -+HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ -+HAVE_SNPRINTF = @HAVE_SNPRINTF@ -+HAVE_WPRINTF = @HAVE_WPRINTF@ - INSTOBJEXT = @INSTOBJEXT@ - INTLBISON = @INTLBISON@ - INTLLIBS = @INTLLIBS@ - INTLOBJS = @INTLOBJS@ - INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ - LIB = @LIB@ - LIBICONV = @LIBICONV@ - LIBINTL = @LIBINTL@ -@@ -108,89 +111,83 @@ - LTLIB = @LTLIB@ - LTLIBICONV = @LTLIBICONV@ - LTLIBINTL = @LTLIBINTL@ -+MAKEINFO = @MAKEINFO@ - MKINSTALLDIRS = @MKINSTALLDIRS@ - OBJDUMP = @OBJDUMP@ -+OBJEXT = @OBJEXT@ - PACKAGE = @PACKAGE@ - POSUB = @POSUB@ - RANLIB = @RANLIB@ -+RC = @RC@ - STRIP = @STRIP@ - USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ - USE_NLS = @USE_NLS@ - VERSION = @VERSION@ --am__include = @am__include@ --am__quote = @am__quote@ --install_sh = @install_sh@ - - SUBDIRS_ = po gsmlib apps tests doc scripts win32 ext - - EXTRA_DIST = gsmlib.spec -- - @COMPILE_INTL_TRUE@SUBDIRS = intl $(SUBDIRS_) # po - make automake happy - @COMPILE_INTL_FALSE@SUBDIRS = $(SUBDIRS_) # po intl - make automake happy --subdir = . - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs - CONFIG_HEADER = gsm_config.h --CONFIG_CLEAN_FILES = intl/Makefile --DIST_SOURCES = -+CONFIG_CLEAN_FILES = -+DIST_COMMON = README ./stamp-h.in ABOUT-NLS AUTHORS COPYING ChangeLog \ -+INSTALL Makefile.am Makefile.in NEWS TODO acconfig.h acinclude.m4 \ -+aclocal.m4 configure configure.in gsm_config.h.in - --RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ -- uninstall-info-recursive all-recursive install-data-recursive \ -- install-exec-recursive installdirs-recursive install-recursive \ -- uninstall-recursive check-recursive installcheck-recursive --DIST_COMMON = README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL \ -- Makefile.am Makefile.in NEWS TODO acconfig.h acinclude.m4 \ -- aclocal.m4 configure configure.in gsm_config.h.in --DIST_SUBDIRS = po gsmlib apps tests doc scripts win32 ext intl --all: gsm_config.h -- $(MAKE) $(AM_MAKEFLAGS) all-recursive - -+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -+ -+TAR = tar -+GZIP_ENV = --best -+DIST_SUBDIRS = intl po gsmlib apps tests doc scripts win32 ext po \ -+gsmlib apps tests doc scripts win32 ext -+all: all-redirect - .SUFFIXES: -+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) -+ cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile - --am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ -- configure.lineno --$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) -- cd $(top_srcdir) && \ -- $(AUTOMAKE) --gnu Makefile --Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -- cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) -+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) -+ cd $(top_builddir) \ -+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status - --$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) -+$(ACLOCAL_M4): configure.in acinclude.m4 -+ cd $(srcdir) && $(ACLOCAL) -+ -+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck --$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) -+$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - --$(ACLOCAL_M4): configure.in acinclude.m4 -- cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -- --gsm_config.h: stamp-h1 -+gsm_config.h: stamp-h - @if test ! -f $@; then \ -- rm -f stamp-h1; \ -- $(MAKE) stamp-h1; \ -+ rm -f stamp-h; \ -+ $(MAKE) stamp-h; \ - else :; fi -- --stamp-h1: $(srcdir)/gsm_config.h.in $(top_builddir)/config.status -- @rm -f stamp-h1 -- cd $(top_builddir) && $(SHELL) ./config.status gsm_config.h -- --$(srcdir)/gsm_config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h -+stamp-h: $(srcdir)/gsm_config.h.in $(top_builddir)/config.status -+ cd $(top_builddir) \ -+ && CONFIG_FILES= CONFIG_HEADERS=gsm_config.h \ -+ $(SHELL) ./config.status -+ @echo timestamp > stamp-h 2> /dev/null -+$(srcdir)/gsm_config.h.in: $(srcdir)/stamp-h.in -+ @if test ! -f $@; then \ -+ rm -f $(srcdir)/stamp-h.in; \ -+ $(MAKE) $(srcdir)/stamp-h.in; \ -+ else :; fi -+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h - cd $(top_srcdir) && $(AUTOHEADER) -- touch $(srcdir)/gsm_config.h.in -+ @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null - --distclean-hdr: -- -rm -f gsm_config.h stamp-h1 --intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in -- cd $(top_builddir) && $(SHELL) ./config.status $@ -+mostlyclean-hdr: - --mostlyclean-libtool: -- -rm -f *.lo -+clean-hdr: - --clean-libtool: -- -rm -rf .libs _libs -+distclean-hdr: -+ -rm -f gsm_config.h - --distclean-libtool: -- -rm -f libtool --uninstall-info-am: -+maintainer-clean-hdr: - - # This directory's subdirectories are mostly independent; you can cd - # into them and run `make' without going through this Makefile. -@@ -198,8 +195,13 @@ - # (1) if the variable is set in `config.status', edit `config.status' - # (which will cause the Makefiles to be regenerated when you run `make'); - # (2) otherwise, pass the desired values on the `make' command line. --$(RECURSIVE_TARGETS): -- @set fnord $$MAKEFLAGS; amf=$$2; \ -+ -+@SET_MAKE@ -+ -+all-recursive install-data-recursive install-exec-recursive \ -+installdirs-recursive install-recursive uninstall-recursive \ -+check-recursive installcheck-recursive info-recursive dvi-recursive: -+ @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ -@@ -219,18 +221,13 @@ - - mostlyclean-recursive clean-recursive distclean-recursive \ - maintainer-clean-recursive: -- @set fnord $$MAKEFLAGS; amf=$$2; \ -+ @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ -- case "$@" in \ -- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ -- *) list='$(SUBDIRS)' ;; \ -- esac; \ -- rev=''; for subdir in $$list; do \ -- if test "$$subdir" = "."; then :; else \ -- rev="$$subdir $$rev"; \ -- fi; \ -+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ -+ rev="$$subdir $$rev"; \ -+ test "$$subdir" != "." || dot_seen=yes; \ - done; \ -- rev="$$rev ."; \ -+ test "$$dot_seen" = "no" && rev=". $$rev"; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ -@@ -247,237 +244,180 @@ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done - --ETAGS = etags --ETAGSFLAGS = -- - tags: TAGS - --ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) -- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ -- unique=`for i in $$list; do \ -- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -- done | \ -- $(AWK) ' { files[$$0] = 1; } \ -+ID: $(HEADERS) $(SOURCES) $(LISP) -+ list='$(SOURCES) $(HEADERS)'; \ -+ unique=`for i in $$list; do echo $$i; done | \ -+ awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ -- mkid -fID $$unique -+ here=`pwd` && cd $(srcdir) \ -+ && mkid -f$$here/ID $$unique $(LISP) - --TAGS: tags-recursive $(HEADERS) $(SOURCES) gsm_config.h.in $(TAGS_DEPENDENCIES) \ -- $(TAGS_FILES) $(LISP) -+TAGS: tags-recursive $(HEADERS) $(SOURCES) gsm_config.h.in $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ -- if test "$$subdir" = .; then :; else \ -+ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ -- fi; \ -+ fi; \ - done; \ -- list='$(SOURCES) $(HEADERS) gsm_config.h.in $(LISP) $(TAGS_FILES)'; \ -- unique=`for i in $$list; do \ -- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ -- done | \ -- $(AWK) ' { files[$$0] = 1; } \ -+ list='$(SOURCES) $(HEADERS)'; \ -+ unique=`for i in $$list; do echo $$i; done | \ -+ awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ -- test -z "$(ETAGS_ARGS)$$tags$$unique" \ -- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ -- $$tags $$unique -- --GTAGS: -- here=`$(am__cd) $(top_builddir) && pwd` \ -- && cd $(top_srcdir) \ -- && gtags -i $(GTAGS_ARGS) $$here -+ test -z "$(ETAGS_ARGS)gsm_config.h.in$$unique$(LISP)$$tags" \ -+ || (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags gsm_config.h.in $$unique $(LISP)) - --distclean-tags: -- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH --DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -+mostlyclean-tags: - --top_distdir = . --distdir = $(PACKAGE)-$(VERSION) -+clean-tags: - --am__remove_distdir = \ -- { test ! -d $(distdir) \ -- || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ -- && rm -fr $(distdir); }; } -+distclean-tags: -+ -rm -f TAGS ID - --GZIP_ENV = --best --distcleancheck_listfiles = find . -type f -print -+maintainer-clean-tags: - -+distdir = $(PACKAGE)-$(VERSION) -+top_distdir = $(distdir) -+ -+# This target untars the dist file and tries a VPATH configuration. Then -+# it guarantees that the distribution is self-contained by making another -+# tarfile. -+distcheck: dist -+ -rm -rf $(distdir) -+ GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz -+ mkdir $(distdir)/=build -+ mkdir $(distdir)/=inst -+ dc_install_base=`cd $(distdir)/=inst && pwd`; \ -+ cd $(distdir)/=build \ -+ && ../configure --with-included-gettext --srcdir=.. --prefix=$$dc_install_base \ -+ && $(MAKE) $(AM_MAKEFLAGS) \ -+ && $(MAKE) $(AM_MAKEFLAGS) dvi \ -+ && $(MAKE) $(AM_MAKEFLAGS) check \ -+ && $(MAKE) $(AM_MAKEFLAGS) install \ -+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ -+ && $(MAKE) $(AM_MAKEFLAGS) dist -+ -rm -rf $(distdir) -+ @banner="$(distdir).tar.gz is ready for distribution"; \ -+ dashes=`echo "$$banner" | sed s/./=/g`; \ -+ echo "$$dashes"; \ -+ echo "$$banner"; \ -+ echo "$$dashes" -+dist: distdir -+ -chmod -R a+r $(distdir) -+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -+ -rm -rf $(distdir) -+dist-all: distdir -+ -chmod -R a+r $(distdir) -+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -+ -rm -rf $(distdir) - distdir: $(DISTFILES) -- $(am__remove_distdir) -+ -rm -rf $(distdir) - mkdir $(distdir) -- $(mkinstalldirs) $(distdir)/intl $(distdir)/po -- @list='$(DISTFILES)'; for file in $$list; do \ -- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ -- dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ -- if test "$$dir" != "$$file" && test "$$dir" != "."; then \ -- dir="/$$dir"; \ -- $(mkinstalldirs) "$(distdir)$$dir"; \ -- else \ -- dir=''; \ -- fi; \ -+ -chmod 777 $(distdir) -+ here=`cd $(top_builddir) && pwd`; \ -+ top_distdir=`cd $(distdir) && pwd`; \ -+ distdir=`cd $(distdir) && pwd`; \ -+ cd $(top_srcdir) \ -+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile -+ @for file in $(DISTFILES); do \ -+ d=$(srcdir); \ - if test -d $$d/$$file; then \ -- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ -- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ -- fi; \ -- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ -+ cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ -- || cp -p $$d/$$file $(distdir)/$$file \ -- || exit 1; \ -+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ -+ || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ -+ for subdir in $(DIST_SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ -- (cd $$subdir && \ -- $(MAKE) $(AM_MAKEFLAGS) \ -- top_distdir="$(top_distdir)" \ -- distdir=../$(distdir)/$$subdir \ -- distdir) \ -+ chmod 777 $(distdir)/$$subdir; \ -+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done -- -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ -- ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ -- ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ -- ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ -- || chmod -R a+r $(distdir) --dist-gzip: distdir -- $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -- $(am__remove_distdir) -- --dist dist-all: distdir -- $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -- $(am__remove_distdir) -- --# This target untars the dist file and tries a VPATH configuration. Then --# it guarantees that the distribution is self-contained by making another --# tarfile. --distcheck: dist -- $(am__remove_distdir) -- GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - -- chmod -R a-w $(distdir); chmod a+w $(distdir) -- mkdir $(distdir)/=build -- mkdir $(distdir)/=inst -- chmod a-w $(distdir) -- dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ -- && cd $(distdir)/=build \ -- && ../configure --srcdir=.. --prefix=$$dc_install_base \ -- --with-included-gettext \ -- $(DISTCHECK_CONFIGURE_FLAGS) \ -- && $(MAKE) $(AM_MAKEFLAGS) \ -- && $(MAKE) $(AM_MAKEFLAGS) dvi \ -- && $(MAKE) $(AM_MAKEFLAGS) check \ -- && $(MAKE) $(AM_MAKEFLAGS) install \ -- && $(MAKE) $(AM_MAKEFLAGS) installcheck \ -- && $(MAKE) $(AM_MAKEFLAGS) uninstall \ -- && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ -- || { echo "ERROR: files left after uninstall:" ; \ -- find $$dc_install_base -type f -print ; \ -- exit 1; } >&2 ) \ -- && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ -- && rm -f $(distdir).tar.gz \ -- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck -- $(am__remove_distdir) -- @echo "$(distdir).tar.gz is ready for distribution" | \ -- sed 'h;s/./=/g;p;x;p;x' --distcleancheck: distclean -- if test '$(srcdir)' = . ; then \ -- echo "ERROR: distcleancheck can only run from a VPATH build" ; \ -- exit 1 ; \ -- fi -- test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ -- || { echo "ERROR: files left after distclean:" ; \ -- $(distcleancheck_listfiles) ; \ -- exit 1; } >&2 -+info-am: -+info: info-recursive -+dvi-am: -+dvi: dvi-recursive - check-am: all-am - check: check-recursive --all-am: Makefile gsm_config.h --installdirs: installdirs-recursive --installdirs-am: -+installcheck-am: -+installcheck: installcheck-recursive -+all-recursive-am: gsm_config.h -+ $(MAKE) $(AM_MAKEFLAGS) all-recursive - --install: install-recursive -+install-exec-am: - install-exec: install-exec-recursive -+ -+install-data-am: - install-data: install-data-recursive --uninstall: uninstall-recursive - - install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -- --installcheck: installcheck-recursive -+install: install-recursive -+uninstall-am: -+uninstall: uninstall-recursive -+all-am: Makefile gsm_config.h -+all-redirect: all-recursive-am - install-strip: -- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ -- INSTALL_STRIP_FLAG=-s \ -- `test -z '$(STRIP)' || \ -- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -+installdirs: installdirs-recursive -+installdirs-am: -+ -+ - mostlyclean-generic: - - clean-generic: - - distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) -+ -rm -f config.cache config.log stamp-h stamp-h[0-9]* - - maintainer-clean-generic: -- @echo "This command is intended for maintainers to use" -- @echo "it deletes files that may require special tools to rebuild." --clean: clean-recursive -- --clean-am: clean-generic clean-libtool mostlyclean-am -- --distclean: distclean-recursive -- -rm -f $(am__CONFIG_DISTCLEAN_FILES) --distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ -- distclean-tags -+mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic - --dvi: dvi-recursive -- --dvi-am: -- --info: info-recursive -- --info-am: -+mostlyclean: mostlyclean-recursive - --install-data-am: -+clean-am: clean-hdr clean-tags clean-generic mostlyclean-am - --install-exec-am: -+clean: clean-recursive - --install-info: install-info-recursive -+distclean-am: distclean-hdr distclean-tags distclean-generic clean-am -+ -rm -f libtool - --install-man: -+distclean: distclean-recursive -+ -rm -f config.status - --installcheck-am: -+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ -+ maintainer-clean-generic distclean-am -+ @echo "This command is intended for maintainers to use;" -+ @echo "it deletes files that may require special tools to rebuild." - - maintainer-clean: maintainer-clean-recursive -- -rm -f $(am__CONFIG_DISTCLEAN_FILES) -- -rm -rf autom4te.cache --maintainer-clean-am: distclean-am maintainer-clean-generic -- --mostlyclean: mostlyclean-recursive -- --mostlyclean-am: mostlyclean-generic mostlyclean-libtool -+ -rm -f config.status - --uninstall-am: uninstall-info-am -- --uninstall-info: uninstall-info-recursive -- --.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ -- clean-generic clean-libtool clean-recursive dist dist-all \ -- dist-gzip distcheck distclean distclean-generic distclean-hdr \ -- distclean-libtool distclean-recursive distclean-tags \ -- distcleancheck distdir dvi dvi-am dvi-recursive info info-am \ -- info-recursive install install-am install-data install-data-am \ -- install-data-recursive install-exec install-exec-am \ -- install-exec-recursive install-info install-info-am \ -- install-info-recursive install-man install-recursive \ -- install-strip installcheck installcheck-am installdirs \ -- installdirs-am installdirs-recursive maintainer-clean \ -- maintainer-clean-generic maintainer-clean-recursive mostlyclean \ -- mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ -- tags tags-recursive uninstall uninstall-am uninstall-info-am \ -- uninstall-info-recursive uninstall-recursive -+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ -+install-data-recursive uninstall-data-recursive install-exec-recursive \ -+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -+all-recursive check-recursive installcheck-recursive info-recursive \ -+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -+dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ -+install-exec-am install-exec install-data-am install-data install-am \ -+install uninstall-am uninstall all-redirect all-am all installdirs-am \ -+installdirs mostlyclean-generic distclean-generic clean-generic \ -+maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - - all: -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: ---- gsmlib-1.10.orig/gsm_config.h.in -+++ gsmlib-1.10/gsm_config.h.in -@@ -55,25 +55,50 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_ARGZ_H - -+/* Define to 1 if you have the `asprintf' function. */ -+#undef HAVE_ASPRINTF -+ -+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the -+ CoreFoundation framework. */ -+#undef HAVE_CFLOCALECOPYCURRENT -+ -+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in -+ the CoreFoundation framework. */ -+#undef HAVE_CFPREFERENCESCOPYAPPVALUE -+ - /* Define if the GNU dcgettext() function is already present or preinstalled. - */ - #undef HAVE_DCGETTEXT - -+/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you -+ don't. */ -+#undef HAVE_DECL_FEOF_UNLOCKED -+ -+/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if -+ you don't. */ -+#undef HAVE_DECL_FGETS_UNLOCKED -+ -+/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you -+ don't. */ -+#undef HAVE_DECL_GETC_UNLOCKED -+ -+/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you -+ don't. */ -+#undef HAVE_DECL__SNPRINTF -+ -+/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you -+ don't. */ -+#undef HAVE_DECL__SNWPRINTF -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_DLFCN_H - --/* Define to 1 if you have the `feof_unlocked' function. */ --#undef HAVE_FEOF_UNLOCKED -- --/* Define to 1 if you have the `fgets_unlocked' function. */ --#undef HAVE_FGETS_UNLOCKED -+/* Define to 1 if you have the `fwprintf' function. */ -+#undef HAVE_FWPRINTF - - /* Define to 1 if you have the `getcwd' function. */ - #undef HAVE_GETCWD - --/* Define to 1 if you have the `getc_unlocked' function. */ --#undef HAVE_GETC_UNLOCKED -- - /* Define to 1 if you have the `getegid' function. */ - #undef HAVE_GETEGID - -@@ -95,6 +120,9 @@ - /* Define if you have the iconv() function. */ - #undef HAVE_ICONV - -+/* Define if you have the 'intmax_t' type in or . */ -+#undef HAVE_INTMAX_T -+ - /* Define if exists and doesn't clash with . */ - #undef HAVE_INTTYPES_H - -@@ -120,6 +148,12 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_LOCALE_H - -+/* Define if you have the 'long double' type. */ -+#undef HAVE_LONG_DOUBLE -+ -+/* Define if you have the 'long long' type. */ -+#undef HAVE_LONG_LONG -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_MALLOC_H - -@@ -141,6 +175,9 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_NL_TYPES_H - -+/* Define if your printf() function supports format strings with positions. */ -+#undef HAVE_POSIX_PRINTF -+ - /* Define to 1 if you have the `putenv' function. */ - #undef HAVE_PUTENV - -@@ -150,6 +187,9 @@ - /* Define to 1 if you have the `setlocale' function. */ - #undef HAVE_SETLOCALE - -+/* Define to 1 if you have the `snprintf' function. */ -+#undef HAVE_SNPRINTF -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_STDDEF_H - -@@ -193,12 +233,24 @@ - /* Define to 1 if you have the `tsearch' function. */ - #undef HAVE_TSEARCH - -+/* Define if you have the 'uintmax_t' type in or . */ -+#undef HAVE_UINTMAX_T -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_UNISTD_H - --/* Define if you have the unsigned long long type. */ -+/* Define if you have the 'unsigned long long' type. */ - #undef HAVE_UNSIGNED_LONG_LONG - -+/* Define if you have the 'wchar_t' type. */ -+#undef HAVE_WCHAR_T -+ -+/* Define to 1 if you have the `wcslen' function. */ -+#undef HAVE_WCSLEN -+ -+/* Define if you have the 'wint_t' type. */ -+#undef HAVE_WINT_T -+ - /* Define to 1 if you have the `__argz_count' function. */ - #undef HAVE___ARGZ_COUNT - -@@ -208,6 +260,9 @@ - /* Define to 1 if you have the `__argz_stringify' function. */ - #undef HAVE___ARGZ_STRINGIFY - -+/* Define to 1 if you have the `__fsetlocking' function. */ -+#undef HAVE___FSETLOCKING -+ - /* Define as const if the declaration of iconv() needs const. */ - #undef ICONV_CONST - -@@ -244,12 +299,16 @@ - /* The size of a `unsigned short int', as computed by sizeof. */ - #undef SIZEOF_UNSIGNED_SHORT_INT - -+/* Define as the maximum value of type 'size_t', if the system doesn't define -+ it. */ -+#undef SIZE_MAX -+ - /* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. -- STACK_DIRECTION > 0 => grows toward higher addresses -- STACK_DIRECTION < 0 => grows toward lower addresses -- STACK_DIRECTION = 0 => direction of growth unknown */ -+ STACK_DIRECTION > 0 => grows toward higher addresses -+ STACK_DIRECTION < 0 => grows toward lower addresses -+ STACK_DIRECTION = 0 => direction of growth unknown */ - #undef STACK_DIRECTION - - /* Define to 1 if you have the ANSI C header files. */ -@@ -261,16 +320,25 @@ - /* Define to empty if `const' does not conform to ANSI C. */ - #undef const - --/* Define as `__inline' if that's what the C compiler calls it, or to nothing -- if it is not supported. */ -+/* 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 `long' if does not define. */ - #undef off_t - -+/* Define as the type of the result of subtracting two pointers, if the system -+ doesn't define it. */ -+#undef ptrdiff_t -+ -+/* Define to empty if the C compiler doesn't support this keyword. */ -+#undef signed -+ - /* Define to `unsigned' if does not define. */ - #undef size_t - --/* Define to unsigned long or unsigned long long if and -- don't define. */ -+/* Define to unsigned long or unsigned long long if and -+ don't define. */ - #undef uintmax_t ---- gsmlib-1.10.orig/aclocal.m4 -+++ gsmlib-1.10/aclocal.m4 -@@ -1,7 +1,7 @@ --# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- -+# generated automatically by aclocal 1.9.6 -*- Autoconf -*- - --# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 --# Free Software Foundation, Inc. -+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -+# 2005 Free Software Foundation, Inc. - # This file is free software; the Free Software Foundation - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. -@@ -11,5211 +11,1221 @@ - # even the implied warranty of MERCHANTABILITY or FITNESS FOR A - # PARTICULAR PURPOSE. - -+# codeset.m4 serial AM1 (gettext-0.10.40) -+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- -- --# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. -+dnl From Bruno Haible. - --# 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, or (at your option) --# any later version. -+AC_DEFUN([AM_LANGINFO_CODESET], -+[ -+ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, -+ [AC_TRY_LINK([#include ], -+ [char* cs = nl_langinfo(CODESET);], -+ am_cv_langinfo_codeset=yes, -+ am_cv_langinfo_codeset=no) -+ ]) -+ if test $am_cv_langinfo_codeset = yes; then -+ AC_DEFINE(HAVE_LANGINFO_CODESET, 1, -+ [Define if you have and nl_langinfo(CODESET).]) -+ fi -+]) - --# 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. -+# gettext.m4 serial 37 (gettext-0.14.4) -+dnl Copyright (C) 1995-2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+dnl -+dnl This file can can be used in projects which are not available under -+dnl the GNU General Public License or the GNU Library General Public -+dnl License but which still want to provide support for the GNU gettext -+dnl functionality. -+dnl Please note that the actual code of the GNU gettext library is covered -+dnl by the GNU Library General Public License, and the rest of the GNU -+dnl gettext package package is covered by the GNU General Public License. -+dnl They are *not* in the public domain. - --# 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. -+dnl Authors: -+dnl Ulrich Drepper , 1995-2000. -+dnl Bruno Haible , 2000-2003. - --AC_PREREQ([2.52]) -+dnl Macro to add for using GNU gettext. - --# serial 6 -+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). -+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The -+dnl default (if it is not specified or empty) is 'no-libtool'. -+dnl INTLSYMBOL should be 'external' for packages with no intl directory, -+dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. -+dnl If INTLSYMBOL is 'use-libtool', then a libtool library -+dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, -+dnl depending on --{enable,disable}-{shared,static} and on the presence of -+dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library -+dnl $(top_builddir)/intl/libintl.a will be created. -+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext -+dnl implementations (in libc or libintl) without the ngettext() function -+dnl will be ignored. If NEEDSYMBOL is specified and is -+dnl 'need-formatstring-macros', then GNU gettext implementations that don't -+dnl support the ISO C 99 formatstring macros will be ignored. -+dnl INTLDIR is used to find the intl libraries. If empty, -+dnl the value `$(top_builddir)/intl/' is used. -+dnl -+dnl The result of the configuration is one of three cases: -+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled -+dnl and used. -+dnl Catalog format: GNU --> install in $(datadir) -+dnl Catalog extension: .mo after installation, .gmo in source tree -+dnl 2) GNU gettext has been found in the system's C library. -+dnl Catalog format: GNU --> install in $(datadir) -+dnl Catalog extension: .mo after installation, .gmo in source tree -+dnl 3) No internationalization, always use English msgid. -+dnl Catalog format: none -+dnl Catalog extension: none -+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. -+dnl The use of .gmo is historical (it was needed to avoid overwriting the -+dnl GNU format catalogs when building on a platform with an X/Open gettext), -+dnl but we keep it in order not to force irrelevant filename changes on the -+dnl maintainers. -+dnl -+AC_DEFUN([AM_GNU_GETTEXT], -+[ -+ dnl Argument checking. -+ ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , -+ [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT -+])])])])]) -+ ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , -+ [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT -+])])])]) -+ define([gt_included_intl], ifelse([$1], [external], [no], [yes])) -+ define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) - --# When config.status generates a header, we must update the stamp-h file. --# This file resides in the same directory as the config header --# that is generated. We must strip everything past the first ":", --# and everything past the last "/". -+ AC_REQUIRE([AM_PO_SUBDIRS])dnl -+ ifelse(gt_included_intl, yes, [ -+ AC_REQUIRE([AM_INTL_SUBDIR])dnl -+ ]) - --# _AM_DIRNAME(PATH) --# ----------------- --# Like AS_DIRNAME, only do it during macro expansion --AC_DEFUN([_AM_DIRNAME], -- [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, -- m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, -- m4_if(regexp([$1], [^/.*]), -1, -- [.], -- patsubst([$1], [^\(/\).*], [\1])), -- patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), -- patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl --])# _AM_DIRNAME -- -- --# The stamp files are numbered to have different names. --# We could number them on a directory basis, but that's additional --# complications, let's have a unique counter. --m4_define([_AM_STAMP_Count], [0]) -+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. -+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -+ AC_REQUIRE([AC_LIB_RPATH]) - -+ dnl Sometimes libintl requires libiconv, so first search for libiconv. -+ dnl Ideally we would do this search only after the -+ dnl if test "$USE_NLS" = "yes"; then -+ dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then -+ dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT -+ dnl the configure script would need to contain the same shell code -+ dnl again, outside any 'if'. There are two solutions: -+ dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. -+ dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. -+ dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not -+ dnl documented, we avoid it. -+ ifelse(gt_included_intl, yes, , [ -+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) -+ ]) - --# _AM_STAMP(HEADER) --# ----------------- --# The name of the stamp file for HEADER. --AC_DEFUN([_AM_STAMP], --[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl --AS_ESCAPE(_AM_DIRNAME(patsubst([$1], -- [:.*])))/stamp-h[]_AM_STAMP_Count]) -+ dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. -+ gt_INTL_MACOSX - -+ dnl Set USE_NLS. -+ AM_NLS - --# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) --# ------------------------------------------------------------ --# We used to try to get a real timestamp in stamp-h. But the fear is that --# that will cause unnecessary cvs conflicts. --AC_DEFUN([_AM_CONFIG_HEADER], --[# Add the stamp file to the list of files AC keeps track of, --# along with our hook. --AC_CONFIG_HEADERS([$1], -- [# update the timestamp --echo 'timestamp for $1' >"_AM_STAMP([$1])" --$2], -- [$3]) --])# _AM_CONFIG_HEADER -- -- --# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) --# -------------------------------------------------------------- --AC_DEFUN([AM_CONFIG_HEADER], --[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) --])# AM_CONFIG_HEADER -+ ifelse(gt_included_intl, yes, [ -+ BUILD_INCLUDED_LIBINTL=no -+ USE_INCLUDED_LIBINTL=no -+ ]) -+ LIBINTL= -+ LTLIBINTL= -+ POSUB= - --# Do all the work for Automake. -*- Autoconf -*- -+ dnl If we use NLS figure out what method -+ if test "$USE_NLS" = "yes"; then -+ gt_use_preinstalled_gnugettext=no -+ ifelse(gt_included_intl, yes, [ -+ AC_MSG_CHECKING([whether included gettext is requested]) -+ AC_ARG_WITH(included-gettext, -+ [ --with-included-gettext use the GNU gettext library included here], -+ nls_cv_force_use_gnu_gettext=$withval, -+ nls_cv_force_use_gnu_gettext=no) -+ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - --# This macro actually does too much some checks are only needed if --# your package does certain things. But this isn't really a big deal. -+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" -+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then -+ ]) -+ dnl User does not insist on using GNU NLS library. Figure out what -+ dnl to use. If GNU gettext is available we use this. Else we have -+ dnl to fall back to GNU NLS library. - --# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 --# Free Software Foundation, Inc. -+ dnl Add a version number to the cache macros. -+ define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) -+ define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) -+ define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) - --# 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, or (at your option) --# any later version. -+ AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, -+ [AC_TRY_LINK([#include -+]ifelse([$2], [need-formatstring-macros], -+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -+#endif -+changequote(,)dnl -+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -+changequote([,])dnl -+], [])[extern int _nl_msg_cat_cntr; -+extern int *_nl_domain_bindings;], -+ [bindtextdomain ("", ""); -+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], -+ gt_cv_func_gnugettext_libc=yes, -+ gt_cv_func_gnugettext_libc=no)]) - --# 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. -+ if test "$gt_cv_func_gnugettext_libc" != "yes"; then -+ dnl Sometimes libintl requires libiconv, so first search for libiconv. -+ ifelse(gt_included_intl, yes, , [ -+ AM_ICONV_LINK -+ ]) -+ dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL -+ dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) -+ dnl because that would add "-liconv" to LIBINTL and LTLIBINTL -+ dnl even if libiconv doesn't exist. -+ AC_LIB_LINKFLAGS_BODY([intl]) -+ AC_CACHE_CHECK([for GNU gettext in libintl], -+ gt_cv_func_gnugettext_libintl, -+ [gt_save_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS $INCINTL" -+ gt_save_LIBS="$LIBS" -+ LIBS="$LIBS $LIBINTL" -+ dnl Now see whether libintl exists and does not depend on libiconv. -+ AC_TRY_LINK([#include -+]ifelse([$2], [need-formatstring-macros], -+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -+#endif -+changequote(,)dnl -+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -+changequote([,])dnl -+], [])[extern int _nl_msg_cat_cntr; -+extern -+#ifdef __cplusplus -+"C" -+#endif -+const char *_nl_expand_alias (const char *);], -+ [bindtextdomain ("", ""); -+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], -+ gt_cv_func_gnugettext_libintl=yes, -+ gt_cv_func_gnugettext_libintl=no) -+ dnl Now see whether libintl exists and depends on libiconv. -+ if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then -+ LIBS="$LIBS $LIBICONV" -+ AC_TRY_LINK([#include -+]ifelse([$2], [need-formatstring-macros], -+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -+#endif -+changequote(,)dnl -+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -+changequote([,])dnl -+], [])[extern int _nl_msg_cat_cntr; -+extern -+#ifdef __cplusplus -+"C" -+#endif -+const char *_nl_expand_alias (const char *);], -+ [bindtextdomain ("", ""); -+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], -+ [LIBINTL="$LIBINTL $LIBICONV" -+ LTLIBINTL="$LTLIBINTL $LTLIBICONV" -+ gt_cv_func_gnugettext_libintl=yes -+ ]) -+ fi -+ CPPFLAGS="$gt_save_CPPFLAGS" -+ LIBS="$gt_save_LIBS"]) -+ fi - --# 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. -+ dnl If an already present or preinstalled GNU gettext() is found, -+ dnl use it. But if this macro is used in GNU gettext, and GNU -+ dnl gettext is already preinstalled in libintl, we update this -+ dnl libintl. (Cf. the install rule in intl/Makefile.in.) -+ if test "$gt_cv_func_gnugettext_libc" = "yes" \ -+ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ -+ && test "$PACKAGE" != gettext-runtime \ -+ && test "$PACKAGE" != gettext-tools; }; then -+ gt_use_preinstalled_gnugettext=yes -+ else -+ dnl Reset the values set by searching for libintl. -+ LIBINTL= -+ LTLIBINTL= -+ INCINTL= -+ fi - --# serial 8 -+ ifelse(gt_included_intl, yes, [ -+ if test "$gt_use_preinstalled_gnugettext" != "yes"; then -+ dnl GNU gettext is not found in the C library. -+ dnl Fall back on included GNU gettext library. -+ nls_cv_use_gnu_gettext=yes -+ fi -+ fi - --# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be --# written in clear, in which case automake, when reading aclocal.m4, --# will think it sees a *use*, and therefore will trigger all it's --# C support machinery. Also note that it means that autoscan, seeing --# CC etc. in the Makefile, will ask for an AC_PROG_CC use... -+ if test "$nls_cv_use_gnu_gettext" = "yes"; then -+ dnl Mark actions used to generate GNU NLS library. -+ BUILD_INCLUDED_LIBINTL=yes -+ USE_INCLUDED_LIBINTL=yes -+ LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" -+ LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" -+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` -+ fi - -+ CATOBJEXT= -+ if test "$gt_use_preinstalled_gnugettext" = "yes" \ -+ || test "$nls_cv_use_gnu_gettext" = "yes"; then -+ dnl Mark actions to use GNU gettext tools. -+ CATOBJEXT=.gmo -+ fi -+ ]) - --AC_PREREQ([2.52]) -+ if test -n "$INTL_MACOSX_LIBS"; then -+ if test "$gt_use_preinstalled_gnugettext" = "yes" \ -+ || test "$nls_cv_use_gnu_gettext" = "yes"; then -+ dnl Some extra flags are needed during linking. -+ LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" -+ LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" -+ fi -+ fi - --# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow --# the ones we care about. --m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -+ if test "$gt_use_preinstalled_gnugettext" = "yes" \ -+ || test "$nls_cv_use_gnu_gettext" = "yes"; then -+ AC_DEFINE(ENABLE_NLS, 1, -+ [Define to 1 if translation of program messages to the user's native language -+ is requested.]) -+ else -+ USE_NLS=no -+ fi -+ fi - --# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) --# AM_INIT_AUTOMAKE([OPTIONS]) --# ----------------------------------------------- --# The call with PACKAGE and VERSION arguments is the old style --# call (pre autoconf-2.50), which is being phased out. PACKAGE --# and VERSION should now be passed to AC_INIT and removed from --# the call to AM_INIT_AUTOMAKE. --# We support both call styles for the transition. After --# the next Automake release, Autoconf can make the AC_INIT --# arguments mandatory, and then we can depend on a new Autoconf --# release and drop the old call support. --AC_DEFUN([AM_INIT_AUTOMAKE], --[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -- AC_REQUIRE([AC_PROG_INSTALL])dnl --# test to see if srcdir already configured --if test "`cd $srcdir && pwd`" != "`pwd`" && -- test -f $srcdir/config.status; then -- AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) --fi -+ AC_MSG_CHECKING([whether to use NLS]) -+ AC_MSG_RESULT([$USE_NLS]) -+ if test "$USE_NLS" = "yes"; then -+ AC_MSG_CHECKING([where the gettext function comes from]) -+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then -+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then -+ gt_source="external libintl" -+ else -+ gt_source="libc" -+ fi -+ else -+ gt_source="included intl directory" -+ fi -+ AC_MSG_RESULT([$gt_source]) -+ fi - --# Define the identity of the package. --dnl Distinguish between old-style and new-style calls. --m4_ifval([$2], --[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl -- AC_SUBST([PACKAGE], [$1])dnl -- AC_SUBST([VERSION], [$2])], --[_AM_SET_OPTIONS([$1])dnl -- AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl -- AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl -+ if test "$USE_NLS" = "yes"; then - --_AM_IF_OPTION([no-define],, --[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl -+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then -+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then -+ AC_MSG_CHECKING([how to link with libintl]) -+ AC_MSG_RESULT([$LIBINTL]) -+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) -+ fi - --# Some tools Automake needs. --AC_REQUIRE([AM_SANITY_CHECK])dnl --AC_REQUIRE([AC_ARG_PROGRAM])dnl --AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) --AM_MISSING_PROG(AUTOCONF, autoconf) --AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) --AM_MISSING_PROG(AUTOHEADER, autoheader) --AM_MISSING_PROG(MAKEINFO, makeinfo) --AM_MISSING_PROG(AMTAR, tar) --AM_PROG_INSTALL_SH --AM_PROG_INSTALL_STRIP --# We need awk for the "check" target. The system "awk" is bad on --# some platforms. --AC_REQUIRE([AC_PROG_AWK])dnl --AC_REQUIRE([AC_PROG_MAKE_SET])dnl -+ dnl For backward compatibility. Some packages may be using this. -+ AC_DEFINE(HAVE_GETTEXT, 1, -+ [Define if the GNU gettext() function is already present or preinstalled.]) -+ AC_DEFINE(HAVE_DCGETTEXT, 1, -+ [Define if the GNU dcgettext() function is already present or preinstalled.]) -+ fi - --_AM_IF_OPTION([no-dependencies],, --[AC_PROVIDE_IFELSE([AC_PROG_][CC], -- [_AM_DEPENDENCIES(CC)], -- [define([AC_PROG_][CC], -- defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl --AC_PROVIDE_IFELSE([AC_PROG_][CXX], -- [_AM_DEPENDENCIES(CXX)], -- [define([AC_PROG_][CXX], -- defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl --]) --]) -+ dnl We need to process the po/ directory. -+ POSUB=po -+ fi - --# Copyright 2002 Free Software Foundation, Inc. -+ ifelse(gt_included_intl, yes, [ -+ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL -+ dnl to 'yes' because some of the testsuite requires it. -+ if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then -+ BUILD_INCLUDED_LIBINTL=yes -+ fi - --# 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, or (at your option) --# any later version. -+ dnl Make all variables we use known to autoconf. -+ AC_SUBST(BUILD_INCLUDED_LIBINTL) -+ AC_SUBST(USE_INCLUDED_LIBINTL) -+ AC_SUBST(CATOBJEXT) - --# 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. -+ dnl For backward compatibility. Some configure.ins may be using this. -+ nls_cv_header_intl= -+ nls_cv_header_libgt= - --# 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 -+ dnl For backward compatibility. Some Makefiles may be using this. -+ DATADIRNAME=share -+ AC_SUBST(DATADIRNAME) - --# AM_AUTOMAKE_VERSION(VERSION) --# ---------------------------- --# Automake X.Y traces this macro to ensure aclocal.m4 has been --# generated from the m4 files accompanying Automake X.Y. --AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) -+ dnl For backward compatibility. Some Makefiles may be using this. -+ INSTOBJEXT=.mo -+ AC_SUBST(INSTOBJEXT) - --# AM_SET_CURRENT_AUTOMAKE_VERSION --# ------------------------------- --# Call AM_AUTOMAKE_VERSION so it can be traced. --# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. --AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -- [AM_AUTOMAKE_VERSION([1.6.3])]) -+ dnl For backward compatibility. Some Makefiles may be using this. -+ GENCAT=gencat -+ AC_SUBST(GENCAT) - --# Helper functions for option handling. -*- Autoconf -*- -+ dnl For backward compatibility. Some Makefiles may be using this. -+ INTLOBJS= -+ if test "$USE_INCLUDED_LIBINTL" = yes; then -+ INTLOBJS="\$(GETTOBJS)" -+ fi -+ AC_SUBST(INTLOBJS) - --# Copyright 2001, 2002 Free Software Foundation, Inc. -+ dnl Enable libtool support if the surrounding package wishes it. -+ INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix -+ AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) -+ ]) - --# 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, or (at your option) --# any later version. -+ dnl For backward compatibility. Some Makefiles may be using this. -+ INTLLIBS="$LIBINTL" -+ AC_SUBST(INTLLIBS) - --# 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. -+ dnl Make all documented variables known to autoconf. -+ AC_SUBST(LIBINTL) -+ AC_SUBST(LTLIBINTL) -+ AC_SUBST(POSUB) -+]) - --# 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. - --# serial 2 -+dnl Checks for all prerequisites of the intl subdirectory, -+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, -+dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. -+AC_DEFUN([AM_INTL_SUBDIR], -+[ -+ AC_REQUIRE([AC_PROG_INSTALL])dnl -+ AC_REQUIRE([AM_MKINSTALLDIRS])dnl -+ AC_REQUIRE([AC_PROG_CC])dnl -+ AC_REQUIRE([AC_CANONICAL_HOST])dnl -+ AC_REQUIRE([gt_GLIBC2])dnl -+ AC_REQUIRE([AC_PROG_RANLIB])dnl -+ AC_REQUIRE([AC_ISC_POSIX])dnl -+ AC_REQUIRE([AC_HEADER_STDC])dnl -+ AC_REQUIRE([AC_C_CONST])dnl -+ AC_REQUIRE([bh_C_SIGNED])dnl -+ AC_REQUIRE([AC_C_INLINE])dnl -+ AC_REQUIRE([AC_TYPE_OFF_T])dnl -+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl -+ AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl -+ AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl -+ AC_REQUIRE([gt_TYPE_WCHAR_T])dnl -+ AC_REQUIRE([gt_TYPE_WINT_T])dnl -+ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) -+ AC_REQUIRE([gl_AC_HEADER_STDINT_H]) -+ AC_REQUIRE([gt_TYPE_INTMAX_T]) -+ AC_REQUIRE([gt_PRINTF_POSIX]) -+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl -+ AC_REQUIRE([AC_FUNC_MMAP])dnl -+ AC_REQUIRE([gl_GLIBC21])dnl -+ AC_REQUIRE([gt_INTDIV0])dnl -+ AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl -+ AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl -+ AC_REQUIRE([gt_INTTYPES_PRI])dnl -+ AC_REQUIRE([gl_XSIZE])dnl -+ AC_REQUIRE([gt_INTL_MACOSX])dnl - --# _AM_MANGLE_OPTION(NAME) --# ----------------------- --AC_DEFUN([_AM_MANGLE_OPTION], --[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) -+ AC_CHECK_TYPE([ptrdiff_t], , -+ [AC_DEFINE([ptrdiff_t], [long], -+ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) -+ ]) -+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -+stdlib.h string.h unistd.h sys/param.h]) -+ AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ -+mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ -+strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ -+__fsetlocking]) -+ -+ dnl Use the _snprintf function only if it is declared (because on NetBSD it -+ dnl is defined as a weak alias of snprintf; we prefer to use the latter). -+ gt_CHECK_DECL(_snprintf, [#include ]) -+ gt_CHECK_DECL(_snwprintf, [#include ]) -+ -+ dnl Use the *_unlocked functions only if they are declared. -+ dnl (because some of them were defined without being declared in Solaris -+ dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built -+ dnl on Solaris 2.5.1 to run on Solaris 2.6). -+ dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. -+ gt_CHECK_DECL(feof_unlocked, [#include ]) -+ gt_CHECK_DECL(fgets_unlocked, [#include ]) -+ gt_CHECK_DECL(getc_unlocked, [#include ]) -+ -+ case $gt_cv_func_printf_posix in -+ *yes) HAVE_POSIX_PRINTF=1 ;; -+ *) HAVE_POSIX_PRINTF=0 ;; -+ esac -+ AC_SUBST([HAVE_POSIX_PRINTF]) -+ if test "$ac_cv_func_asprintf" = yes; then -+ HAVE_ASPRINTF=1 -+ else -+ HAVE_ASPRINTF=0 -+ fi -+ AC_SUBST([HAVE_ASPRINTF]) -+ if test "$ac_cv_func_snprintf" = yes; then -+ HAVE_SNPRINTF=1 -+ else -+ HAVE_SNPRINTF=0 -+ fi -+ AC_SUBST([HAVE_SNPRINTF]) -+ if test "$ac_cv_func_wprintf" = yes; then -+ HAVE_WPRINTF=1 -+ else -+ HAVE_WPRINTF=0 -+ fi -+ AC_SUBST([HAVE_WPRINTF]) - --# _AM_SET_OPTION(NAME) --# ------------------------------ --# Set option NAME. Presently that only means defining a flag for this option. --AC_DEFUN([_AM_SET_OPTION], --[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) -+ AM_ICONV -+ AM_LANGINFO_CODESET -+ if test $ac_cv_header_locale_h = yes; then -+ gt_LC_MESSAGES -+ fi - --# _AM_SET_OPTIONS(OPTIONS) --# ---------------------------------- --# OPTIONS is a space-separated list of Automake options. --AC_DEFUN([_AM_SET_OPTIONS], --[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) -+ if test -n "$INTL_MACOSX_LIBS"; then -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ fi - --# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) --# ------------------------------------------- --# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. --AC_DEFUN([_AM_IF_OPTION], --[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -+ dnl intl/plural.c is generated from intl/plural.y. It requires bison, -+ dnl because plural.y uses bison specific features. It requires at least -+ dnl bison-1.26 because earlier versions generate a plural.c that doesn't -+ dnl compile. -+ dnl bison is only needed for the maintainer (who touches plural.y). But in -+ dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put -+ dnl the rule in general Makefile. Now, some people carelessly touch the -+ dnl files or have a broken "make" program, hence the plural.c rule will -+ dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not -+ dnl present or too old. -+ AC_CHECK_PROGS([INTLBISON], [bison]) -+ if test -z "$INTLBISON"; then -+ ac_verc_fail=yes -+ else -+ dnl Found it, now check the version. -+ AC_MSG_CHECKING([version of bison]) -+changequote(<<,>>)dnl -+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -+ case $ac_prog_version in -+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; -+ 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -+changequote([,])dnl -+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; -+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; -+ esac -+ AC_MSG_RESULT([$ac_prog_version]) -+ fi -+ if test $ac_verc_fail = yes; then -+ INTLBISON=: -+ fi -+]) - --# --# Check to make sure that the build environment is sane. --# - --# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. -+dnl Checks for special options needed on MacOS X. -+dnl Defines INTL_MACOSX_LIBS. -+AC_DEFUN([gt_INTL_MACOSX], -+[ -+ dnl Check for API introduced in MacOS X 10.2. -+ AC_CACHE_CHECK([for CFPreferencesCopyAppValue], -+ gt_cv_func_CFPreferencesCopyAppValue, -+ [gt_save_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ gt_save_LIBS="$LIBS" -+ LIBS="$LIBS -framework CoreFoundation" -+ AC_TRY_LINK([#include ], -+ [CFPreferencesCopyAppValue(NULL, NULL)], -+ [gt_cv_func_CFPreferencesCopyAppValue=yes], -+ [gt_cv_func_CFPreferencesCopyAppValue=no]) -+ CPPFLAGS="$gt_save_CPPFLAGS" -+ LIBS="$gt_save_LIBS"]) -+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then -+ AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, -+ [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) -+ fi -+ dnl Check for API introduced in MacOS X 10.3. -+ AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, -+ [gt_save_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ gt_save_LIBS="$LIBS" -+ LIBS="$LIBS -framework CoreFoundation" -+ AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], -+ [gt_cv_func_CFLocaleCopyCurrent=yes], -+ [gt_cv_func_CFLocaleCopyCurrent=no]) -+ CPPFLAGS="$gt_save_CPPFLAGS" -+ LIBS="$gt_save_LIBS"]) -+ if test $gt_cv_func_CFLocaleCopyCurrent = yes; then -+ AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, -+ [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) -+ fi -+ INTL_MACOSX_LIBS= -+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then -+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" -+ fi -+ AC_SUBST([INTL_MACOSX_LIBS]) -+]) - --# 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, 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. -+dnl gt_CHECK_DECL(FUNC, INCLUDES) -+dnl Check whether a function is declared. -+AC_DEFUN([gt_CHECK_DECL], -+[ -+ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, -+ [AC_TRY_COMPILE([$2], [ -+#ifndef $1 -+ char *p = (char *) $1; -+#endif -+], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) -+ if test $ac_cv_have_decl_$1 = yes; then -+ gt_value=1 -+ else -+ gt_value=0 -+ fi -+ AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], -+ [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) -+]) - --# 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. - --# serial 3 -+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) -+AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) - --# AM_SANITY_CHECK --# --------------- --AC_DEFUN([AM_SANITY_CHECK], --[AC_MSG_CHECKING([whether build environment is sane]) --# Just in case --sleep 1 --echo timestamp > conftest.file --# Do `set' in a subshell so we don't clobber the current shell's --# arguments. Must try -L first in case configure is actually a --# symlink; some systems play weird games with the mod time of symlinks --# (eg FreeBSD returns the mod time of the symlink's containing --# directory). --if ( -- set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` -- if test "$[*]" = "X"; then -- # -L didn't work. -- set X `ls -t $srcdir/configure conftest.file` -- fi -- rm -f conftest.file -- if test "$[*]" != "X $srcdir/configure conftest.file" \ -- && test "$[*]" != "X conftest.file $srcdir/configure"; then -- -- # If neither matched, then we have a broken ls. This can happen -- # if, for instance, CONFIG_SHELL is bash and it inherits a -- # broken ls alias from the environment. This has actually -- # happened. Such a system could not be considered "sane". -- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken --alias in your environment]) -- fi -- -- test "$[2]" = conftest.file -- ) --then -- # Ok. -- : --else -- AC_MSG_ERROR([newly created file is older than distributed files! --Check your system clock]) --fi --AC_MSG_RESULT(yes)]) -- --# -*- Autoconf -*- -+# glibc2.m4 serial 1 -+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - -+# Test for the GNU C Library, version 2.0 or newer. -+# From Bruno Haible. - --# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. -+AC_DEFUN([gt_GLIBC2], -+ [ -+ AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer, -+ ac_cv_gnu_library_2, -+ [AC_EGREP_CPP([Lucky GNU user], -+ [ -+#include -+#ifdef __GNU_LIBRARY__ -+ #if (__GLIBC__ >= 2) -+ Lucky GNU user -+ #endif -+#endif -+ ], -+ ac_cv_gnu_library_2=yes, -+ ac_cv_gnu_library_2=no) -+ ] -+ ) -+ AC_SUBST(GLIBC2) -+ GLIBC2="$ac_cv_gnu_library_2" -+ ] -+) - --# 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, or (at your option) --# any later version. -+# glibc21.m4 serial 3 -+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# 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. -+# Test for the GNU C Library, version 2.1 or newer. -+# From Bruno Haible. - --# 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. -+AC_DEFUN([gl_GLIBC21], -+ [ -+ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, -+ ac_cv_gnu_library_2_1, -+ [AC_EGREP_CPP([Lucky GNU user], -+ [ -+#include -+#ifdef __GNU_LIBRARY__ -+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) -+ Lucky GNU user -+ #endif -+#endif -+ ], -+ ac_cv_gnu_library_2_1=yes, -+ ac_cv_gnu_library_2_1=no) -+ ] -+ ) -+ AC_SUBST(GLIBC21) -+ GLIBC21="$ac_cv_gnu_library_2_1" -+ ] -+) - --# serial 3 -+# iconv.m4 serial AM4 (gettext-0.11.3) -+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# AM_MISSING_PROG(NAME, PROGRAM) --# ------------------------------ --AC_DEFUN([AM_MISSING_PROG], --[AC_REQUIRE([AM_MISSING_HAS_RUN]) --$1=${$1-"${am_missing_run}$2"} --AC_SUBST($1)]) -+dnl From Bruno Haible. - -+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], -+[ -+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. -+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -+ AC_REQUIRE([AC_LIB_RPATH]) - --# AM_MISSING_HAS_RUN --# ------------------ --# Define MISSING if not defined so far and test if it supports --run. --# If it does, set am_missing_run to use it, otherwise, to nothing. --AC_DEFUN([AM_MISSING_HAS_RUN], --[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl --test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" --# Use eval to expand $SHELL --if eval "$MISSING --run true"; then -- am_missing_run="$MISSING --run " --else -- am_missing_run= -- AC_MSG_WARN([`missing' script is too old or missing]) --fi -+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV -+ dnl accordingly. -+ AC_LIB_LINKFLAGS_BODY([iconv]) - ]) - --# AM_AUX_DIR_EXPAND -- --# Copyright 2001 Free Software Foundation, Inc. -- --# 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, 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. -+AC_DEFUN([AM_ICONV_LINK], -+[ -+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and -+ dnl those with the standalone portable GNU libiconv installed). - --# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets --# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to --# `$srcdir', `$srcdir/..', or `$srcdir/../..'. --# --# Of course, Automake must honor this variable whenever it calls a --# tool from the auxiliary directory. The problem is that $srcdir (and --# therefore $ac_aux_dir as well) can be either absolute or relative, --# depending on how configure is run. This is pretty annoying, since --# it makes $ac_aux_dir quite unusable in subdirectories: in the top --# source directory, any form will work fine, but in subdirectories a --# relative path needs to be adjusted first. --# --# $ac_aux_dir/missing --# fails when called from a subdirectory if $ac_aux_dir is relative --# $top_srcdir/$ac_aux_dir/missing --# fails if $ac_aux_dir is absolute, --# fails when called from a subdirectory in a VPATH build with --# a relative $ac_aux_dir --# --# The reason of the latter failure is that $top_srcdir and $ac_aux_dir --# are both prefixed by $srcdir. In an in-source build this is usually --# harmless because $srcdir is `.', but things will broke when you --# start a VPATH build or use an absolute $srcdir. --# --# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, --# iff we strip the leading $srcdir from $ac_aux_dir. That would be: --# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` --# and then we would define $MISSING as --# MISSING="\${SHELL} $am_aux_dir/missing" --# This will work as long as MISSING is not called from configure, because --# unfortunately $(top_srcdir) has no meaning in configure. --# However there are other variables, like CC, which are often used in --# configure, and could therefore not use this "fixed" $ac_aux_dir. --# --# Another solution, used here, is to always expand $ac_aux_dir to an --# absolute PATH. The drawback is that using absolute paths prevent a --# configured tree to be moved without reconfiguration. -+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV -+ dnl accordingly. -+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - --# Rely on autoconf to set up CDPATH properly. --AC_PREREQ([2.50]) -+ dnl Add $INCICONV to CPPFLAGS before performing the following checks, -+ dnl because if the user has installed libiconv and not disabled its use -+ dnl via --without-libiconv-prefix, he wants to use it. The first -+ dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. -+ am_save_CPPFLAGS="$CPPFLAGS" -+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - --AC_DEFUN([AM_AUX_DIR_EXPAND], [ --# expand $ac_aux_dir to an absolute path --am_aux_dir=`cd $ac_aux_dir && pwd` -+ AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ -+ am_cv_func_iconv="no, consider installing GNU libiconv" -+ am_cv_lib_iconv=no -+ AC_TRY_LINK([#include -+#include ], -+ [iconv_t cd = iconv_open("",""); -+ iconv(cd,NULL,NULL,NULL,NULL); -+ iconv_close(cd);], -+ am_cv_func_iconv=yes) -+ if test "$am_cv_func_iconv" != yes; then -+ am_save_LIBS="$LIBS" -+ LIBS="$LIBS $LIBICONV" -+ AC_TRY_LINK([#include -+#include ], -+ [iconv_t cd = iconv_open("",""); -+ iconv(cd,NULL,NULL,NULL,NULL); -+ iconv_close(cd);], -+ am_cv_lib_iconv=yes -+ am_cv_func_iconv=yes) -+ LIBS="$am_save_LIBS" -+ fi -+ ]) -+ if test "$am_cv_func_iconv" = yes; then -+ AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) -+ fi -+ if test "$am_cv_lib_iconv" = yes; then -+ AC_MSG_CHECKING([how to link with libiconv]) -+ AC_MSG_RESULT([$LIBICONV]) -+ else -+ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV -+ dnl either. -+ CPPFLAGS="$am_save_CPPFLAGS" -+ LIBICONV= -+ LTLIBICONV= -+ fi -+ AC_SUBST(LIBICONV) -+ AC_SUBST(LTLIBICONV) - ]) - --# AM_PROG_INSTALL_SH --# ------------------ --# Define $install_sh. -+AC_DEFUN([AM_ICONV], -+[ -+ AM_ICONV_LINK -+ if test "$am_cv_func_iconv" = yes; then -+ AC_MSG_CHECKING([for iconv declaration]) -+ AC_CACHE_VAL(am_cv_proto_iconv, [ -+ AC_TRY_COMPILE([ -+#include -+#include -+extern -+#ifdef __cplusplus -+"C" -+#endif -+#if defined(__STDC__) || defined(__cplusplus) -+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -+#else -+size_t iconv(); -+#endif -+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") -+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) -+ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` -+ AC_MSG_RESULT([$]{ac_t:- -+ }[$]am_cv_proto_iconv) -+ AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, -+ [Define as const if the declaration of iconv() needs const.]) -+ fi -+]) - --# Copyright 2001 Free Software Foundation, Inc. -+# intdiv0.m4 serial 1 (gettext-0.11.3) -+dnl Copyright (C) 2002 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# 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, or (at your option) --# any later version. -+dnl From Bruno Haible. - --# 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. -+AC_DEFUN([gt_INTDIV0], -+[ -+ AC_REQUIRE([AC_PROG_CC])dnl -+ AC_REQUIRE([AC_CANONICAL_HOST])dnl - --# 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. -+ AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], -+ gt_cv_int_divbyzero_sigfpe, -+ [ -+ AC_TRY_RUN([ -+#include -+#include - --AC_DEFUN([AM_PROG_INSTALL_SH], --[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl --install_sh=${install_sh-"$am_aux_dir/install-sh"} --AC_SUBST(install_sh)]) -+static void -+#ifdef __cplusplus -+sigfpe_handler (int sig) -+#else -+sigfpe_handler (sig) int sig; -+#endif -+{ -+ /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ -+ exit (sig != SIGFPE); -+} - --# AM_PROG_INSTALL_STRIP -- --# Copyright 2001 Free Software Foundation, Inc. -+int x = 1; -+int y = 0; -+int z; -+int nan; - --# 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, or (at your option) --# any later version. -+int main () -+{ -+ signal (SIGFPE, sigfpe_handler); -+/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -+#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) -+ signal (SIGTRAP, sigfpe_handler); -+#endif -+/* Linux/SPARC yields signal SIGILL. */ -+#if defined (__sparc__) && defined (__linux__) -+ signal (SIGILL, sigfpe_handler); -+#endif - --# 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. -+ z = x / y; -+ nan = y / y; -+ exit (1); -+} -+], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, -+ [ -+ # Guess based on the CPU. -+ case "$host_cpu" in -+ alpha* | i[34567]86 | m68k | s390*) -+ gt_cv_int_divbyzero_sigfpe="guessing yes";; -+ *) -+ gt_cv_int_divbyzero_sigfpe="guessing no";; -+ esac -+ ]) -+ ]) -+ case "$gt_cv_int_divbyzero_sigfpe" in -+ *yes) value=1;; -+ *) value=0;; -+ esac -+ AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, -+ [Define if integer division by zero raises signal SIGFPE.]) -+]) - --# 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. -+# intmax.m4 serial 2 (gettext-0.14.2) -+dnl Copyright (C) 2002-2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# One issue with vendor `install' (even GNU) is that you can't --# specify the program used to strip binaries. This is especially --# annoying in cross-compiling environments, where the build's strip --# is unlikely to handle the host's binaries. --# Fortunately install-sh will honor a STRIPPROG variable, so we --# always use install-sh in `make install-strip', and initialize --# STRIPPROG with the value of the STRIP variable (set by the user). --AC_DEFUN([AM_PROG_INSTALL_STRIP], --[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl --# Installed binaries are usually stripped using `strip' when the user --# run `make install-strip'. However `strip' might not be the right --# tool to use in cross-compilation environments, therefore Automake --# will honor the `STRIP' environment variable to overrule this program. --dnl Don't test for $cross_compiling = yes, because it might be `maybe'. --if test "$cross_compiling" != no; then -- AC_CHECK_TOOL([STRIP], [strip], :) --fi --INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" --AC_SUBST([INSTALL_STRIP_PROGRAM])]) -+dnl From Bruno Haible. -+dnl Test whether the system has the 'intmax_t' type, but don't attempt to -+dnl find a replacement if it is lacking. - --# serial 4 -*- Autoconf -*- -+AC_DEFUN([gt_TYPE_INTMAX_T], -+[ -+ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) -+ AC_REQUIRE([gl_AC_HEADER_STDINT_H]) -+ AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, -+ [AC_TRY_COMPILE([ -+#include -+#include -+#if HAVE_STDINT_H_WITH_UINTMAX -+#include -+#endif -+#if HAVE_INTTYPES_H_WITH_UINTMAX -+#include -+#endif -+], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) -+ if test $gt_cv_c_intmax_t = yes; then -+ AC_DEFINE(HAVE_INTMAX_T, 1, -+ [Define if you have the 'intmax_t' type in or .]) -+ fi -+]) - --# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. -+# inttypes-pri.m4 serial 1 (gettext-0.11.4) -+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# 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, or (at your option) --# any later version. -+dnl From Bruno Haible. - --# 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. -+# Define PRI_MACROS_BROKEN if exists and defines the PRI* -+# macros to non-string values. This is the case on AIX 4.3.3. - --# 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. -+AC_DEFUN([gt_INTTYPES_PRI], -+[ -+ AC_REQUIRE([gt_HEADER_INTTYPES_H]) -+ if test $gt_cv_header_inttypes_h = yes; then -+ AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], -+ gt_cv_inttypes_pri_broken, -+ [ -+ AC_TRY_COMPILE([#include -+#ifdef PRId32 -+char *p = PRId32; -+#endif -+], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) -+ ]) -+ fi -+ if test "$gt_cv_inttypes_pri_broken" = yes; then -+ AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, -+ [Define if exists and defines unusable PRI* macros.]) -+ fi -+]) - -+# inttypes.m4 serial 1 (gettext-0.11.4) -+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be --# written in clear, in which case automake, when reading aclocal.m4, --# will think it sees a *use*, and therefore will trigger all it's --# C support machinery. Also note that it means that autoscan, seeing --# CC etc. in the Makefile, will ask for an AC_PROG_CC use... -+dnl From Paul Eggert. - -+# Define HAVE_INTTYPES_H if exists and doesn't clash with -+# . - -+AC_DEFUN([gt_HEADER_INTTYPES_H], -+[ -+ AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, -+ [ -+ AC_TRY_COMPILE( -+ [#include -+#include ], -+ [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) -+ ]) -+ if test $gt_cv_header_inttypes_h = yes; then -+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, -+ [Define if exists and doesn't clash with .]) -+ fi -+]) - --# _AM_DEPENDENCIES(NAME) --# ---------------------- --# See how the compiler implements dependency checking. --# NAME is "CC", "CXX", "GCJ", or "OBJC". --# We try a few techniques and use that to set a single cache variable. --# --# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was --# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular --# dependency, and given that the user is not expected to run this macro, --# just rely on AC_PROG_CC. --AC_DEFUN([_AM_DEPENDENCIES], --[AC_REQUIRE([AM_SET_DEPDIR])dnl --AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl --AC_REQUIRE([AM_MAKE_INCLUDE])dnl --AC_REQUIRE([AM_DEP_TRACK])dnl -+# inttypes_h.m4 serial 6 -+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --ifelse([$1], CC, [depcc="$CC" am_compiler_list=], -- [$1], CXX, [depcc="$CXX" am_compiler_list=], -- [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], -- [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], -- [depcc="$$1" am_compiler_list=]) -+dnl From Paul Eggert. - --AC_CACHE_CHECK([dependency style of $depcc], -- [am_cv_$1_dependencies_compiler_type], --[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then -- # We make a subdir and do the tests there. Otherwise we can end up -- # making bogus files that we don't know about and never remove. For -- # instance it was reported that on HP-UX the gcc test will end up -- # making a dummy file named `D' -- because `-MD' means `put the output -- # in D'. -- mkdir conftest.dir -- # Copy depcomp to subdir because otherwise we won't find it if we're -- # using a relative directory. -- cp "$am_depcomp" conftest.dir -- cd conftest.dir -+# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, -+# doesn't clash with , and declares uintmax_t. - -- am_cv_$1_dependencies_compiler_type=none -- if test "$am_compiler_list" = ""; then -- am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` -+AC_DEFUN([gl_AC_HEADER_INTTYPES_H], -+[ -+ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, -+ [AC_TRY_COMPILE( -+ [#include -+#include ], -+ [uintmax_t i = (uintmax_t) -1;], -+ gl_cv_header_inttypes_h=yes, -+ gl_cv_header_inttypes_h=no)]) -+ if test $gl_cv_header_inttypes_h = yes; then -+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, -+ [Define if exists, doesn't clash with , -+ and declares uintmax_t. ]) - fi -- for depmode in $am_compiler_list; do -- # We need to recreate these files for each test, as the compiler may -- # overwrite some of them when testing with obscure command lines. -- # This happens at least with the AIX C compiler. -- echo '#include "conftest.h"' > conftest.c -- echo 'int i;' > conftest.h -- echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf -- -- case $depmode in -- nosideeffect) -- # after this tag, mechanisms are not by side-effect, so they'll -- # only be used when explicitly requested -- if test "x$enable_dependency_tracking" = xyes; then -- continue -- else -- break -- fi -- ;; -- none) break ;; -- esac -- # We check with `-c' and `-o' for the sake of the "dashmstdout" -- # mode. It turns out that the SunPro C++ compiler does not properly -- # handle `-M -o', and we need to detect this. -- if depmode=$depmode \ -- source=conftest.c object=conftest.o \ -- depfile=conftest.Po tmpdepfile=conftest.TPo \ -- $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && -- grep conftest.h conftest.Po > /dev/null 2>&1 && -- ${MAKE-make} -s -f confmf > /dev/null 2>&1; then -- am_cv_$1_dependencies_compiler_type=$depmode -- break -- fi -- done -- -- cd .. -- rm -rf conftest.dir --else -- am_cv_$1_dependencies_compiler_type=none --fi --]) --AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) - ]) - -+# lcmessage.m4 serial 4 (gettext-0.14.2) -+dnl Copyright (C) 1995-2002, 2004-2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+dnl -+dnl This file can can be used in projects which are not available under -+dnl the GNU General Public License or the GNU Library General Public -+dnl License but which still want to provide support for the GNU gettext -+dnl functionality. -+dnl Please note that the actual code of the GNU gettext library is covered -+dnl by the GNU Library General Public License, and the rest of the GNU -+dnl gettext package package is covered by the GNU General Public License. -+dnl They are *not* in the public domain. - --# AM_SET_DEPDIR --# ------------- --# Choose a directory name for dependency files. --# This macro is AC_REQUIREd in _AM_DEPENDENCIES --AC_DEFUN([AM_SET_DEPDIR], --[rm -f .deps 2>/dev/null --mkdir .deps 2>/dev/null --if test -d .deps; then -- DEPDIR=.deps --else -- # MS-DOS does not allow filenames that begin with a dot. -- DEPDIR=_deps --fi --rmdir .deps 2>/dev/null --AC_SUBST([DEPDIR]) --]) -+dnl Authors: -+dnl Ulrich Drepper , 1995. - -+# Check whether LC_MESSAGES is available in . - --# AM_DEP_TRACK --# ------------ --AC_DEFUN([AM_DEP_TRACK], --[AC_ARG_ENABLE(dependency-tracking, --[ --disable-dependency-tracking Speeds up one-time builds -- --enable-dependency-tracking Do not reject slow dependency extractors]) --if test "x$enable_dependency_tracking" != xno; then -- am_depcomp="$ac_aux_dir/depcomp" -- AMDEPBACKSLASH='\' --fi --AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) --AC_SUBST([AMDEPBACKSLASH]) -+AC_DEFUN([gt_LC_MESSAGES], -+[ -+ AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES, -+ [AC_TRY_LINK([#include ], [return LC_MESSAGES], -+ gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)]) -+ if test $gt_cv_val_LC_MESSAGES = yes; then -+ AC_DEFINE(HAVE_LC_MESSAGES, 1, -+ [Define if your file defines LC_MESSAGES.]) -+ fi - ]) - --# Generate code to set up dependency tracking. -*- Autoconf -*- -- --# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -- --# 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, 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. -+# lib-ld.m4 serial 3 (gettext-0.13) -+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# 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. -+dnl Subroutines of libtool.m4, -+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -+dnl with libtool.m4. - --#serial 2 -+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -+AC_DEFUN([AC_LIB_PROG_LD_GNU], -+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -+[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -+case `$LD -v 2>&1 /dev/null 2>&1; then -- dirpart=`AS_DIRNAME("$mf")` -+dnl From libtool-1.4. Sets the variable LD. -+AC_DEFUN([AC_LIB_PROG_LD], -+[AC_ARG_WITH(gnu-ld, -+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -+AC_REQUIRE([AC_PROG_CC])dnl -+AC_REQUIRE([AC_CANONICAL_HOST])dnl -+# Prepare PATH_SEPARATOR. -+# The user is always right. -+if test "${PATH_SEPARATOR+set}" != set; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then -+ PATH_SEPARATOR=';' - else -- continue -+ PATH_SEPARATOR=: - fi -- grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue -- # Extract the definition of DEP_FILES from the Makefile without -- # running `make'. -- DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` -- test -z "$DEPDIR" && continue -- # When using ansi2knr, U may be empty or an underscore; expand it -- U=`sed -n -e '/^U = / s///p' < "$mf"` -- test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" -- # We invoke sed twice because it is the simplest approach to -- # changing $(DEPDIR) to its actual value in the expansion. -- for file in `sed -n -e ' -- /^DEP_FILES = .*\\\\$/ { -- s/^DEP_FILES = // -- :loop -- s/\\\\$// -- p -- n -- /\\\\$/ b loop -- p -- } -- /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ -- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do -- # Make sure the directory exists. -- test -f "$dirpart/$file" && continue -- fdir=`AS_DIRNAME(["$file"])` -- AS_MKDIR_P([$dirpart/$fdir]) -- # echo "creating $dirpart/$file" -- echo '# dummy' > "$dirpart/$file" -- done --done --])# _AM_OUTPUT_DEPENDENCY_COMMANDS -- -- --# AM_OUTPUT_DEPENDENCY_COMMANDS --# ----------------------------- --# This macro should only be invoked once -- use via AC_REQUIRE. --# --# This code is only required when automatic dependency tracking --# is enabled. FIXME. This creates each `.P' file that we will --# need in order to bootstrap the dependency handling code. --AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], --[AC_CONFIG_COMMANDS([depfiles], -- [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], -- [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) --]) -- --# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- -- --# 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, 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. -- --# serial 2 -- --# AM_MAKE_INCLUDE() --# ----------------- --# Check to see how make treats includes. --AC_DEFUN([AM_MAKE_INCLUDE], --[am_make=${MAKE-make} --cat > confinc << 'END' --doit: -- @echo done --END --# If we don't find an include directive, just comment out the code. --AC_MSG_CHECKING([for style of include used by $am_make]) --am__include="#" --am__quote= --_am_result=none --# First try GNU make style include. --echo "include confinc" > confmf --# We grep out `Entering directory' and `Leaving directory' --# messages which can occur if `w' ends up in MAKEFLAGS. --# In particular we don't look at `^make:' because GNU make might --# be invoked under some other name (usually "gmake"), in which --# case it prints its new name instead of `make'. --if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then -- am__include=include -- am__quote= -- _am_result=GNU -+ rm -f conf$$.sh - fi --# Now try BSD make style include. --if test "$am__include" = "#"; then -- echo '.include "confinc"' > confmf -- if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then -- am__include=.include -- am__quote="\"" -- _am_result=BSD -- fi -+ac_prog=ld -+if test "$GCC" = yes; then -+ # Check if gcc -print-prog-name=ld gives a path. -+ AC_MSG_CHECKING([for ld used by GCC]) -+ 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. -+ [[\\/]* | [A-Za-z]:[\\/]*)] -+ [re_direlt='/[^/][^/]*/\.\./'] -+ # Canonicalize the path of ld -+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` -+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do -+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` -+ done -+ test -z "$LD" && LD="$ac_prog" -+ ;; -+ "") -+ # If it fails, then pretend we aren't using GCC. -+ ac_prog=ld -+ ;; -+ *) -+ # If it is relative, then search for the first ld in PATH. -+ with_gnu_ld=unknown -+ ;; -+ esac -+elif test "$with_gnu_ld" = yes; then -+ AC_MSG_CHECKING([for GNU ld]) -+else -+ AC_MSG_CHECKING([for non-GNU ld]) - fi --AC_SUBST(am__include) --AC_SUBST(am__quote) --AC_MSG_RESULT($_am_result) --rm -f confinc confmf -+AC_CACHE_VAL(acl_cv_path_LD, -+[if test -z "$LD"; then -+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" -+ for ac_dir in $PATH; do -+ test -z "$ac_dir" && ac_dir=. -+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then -+ acl_cv_path_LD="$ac_dir/$ac_prog" -+ # Check to see if the program is GNU ld. I'd rather use --version, -+ # but apparently some GNU ld's only accept -v. -+ # Break only if it was the GNU/non-GNU ld that we prefer. -+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in -+ *GNU* | *'with BFD'*) -+ test "$with_gnu_ld" != no && break ;; -+ *) -+ test "$with_gnu_ld" != yes && break ;; -+ esac -+ fi -+ done -+ IFS="$ac_save_ifs" -+else -+ acl_cv_path_LD="$LD" # Let the user override the test with a path. -+fi]) -+LD="$acl_cv_path_LD" -+if test -n "$LD"; then -+ AC_MSG_RESULT($LD) -+else -+ AC_MSG_RESULT(no) -+fi -+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -+AC_LIB_PROG_LD_GNU - ]) - --# AM_CONDITIONAL -*- Autoconf -*- -- --# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. -- --# 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, or (at your option) --# any later version. -+# lib-link.m4 serial 6 (gettext-0.14.3) -+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --# 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. -+dnl From Bruno Haible. - --# 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. -+AC_PREREQ(2.50) - --# serial 5 -+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -+dnl the libraries corresponding to explicit and implicit dependencies. -+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -+dnl augments the CPPFLAGS variable. -+AC_DEFUN([AC_LIB_LINKFLAGS], -+[ -+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -+ AC_REQUIRE([AC_LIB_RPATH]) -+ define([Name],[translit([$1],[./-], [___])]) -+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], -+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) -+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ -+ AC_LIB_LINKFLAGS_BODY([$1], [$2]) -+ ac_cv_lib[]Name[]_libs="$LIB[]NAME" -+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" -+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME" -+ ]) -+ LIB[]NAME="$ac_cv_lib[]Name[]_libs" -+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" -+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags" -+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) -+ AC_SUBST([LIB]NAME) -+ AC_SUBST([LTLIB]NAME) -+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the -+ dnl results of this search when this library appears as a dependency. -+ HAVE_LIB[]NAME=yes -+ undefine([Name]) -+ undefine([NAME]) -+]) - --AC_PREREQ(2.52) -+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -+dnl searches for libname and the libraries corresponding to explicit and -+dnl implicit dependencies, together with the specified include files and -+dnl the ability to compile and link the specified testcode. If found, it -+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -+[ -+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -+ AC_REQUIRE([AC_LIB_RPATH]) -+ define([Name],[translit([$1],[./-], [___])]) -+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], -+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - --# AM_CONDITIONAL(NAME, SHELL-CONDITION) --# ------------------------------------- --# Define a conditional. --AC_DEFUN([AM_CONDITIONAL], --[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], -- [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl --AC_SUBST([$1_TRUE]) --AC_SUBST([$1_FALSE]) --if $2; then -- $1_TRUE= -- $1_FALSE='#' --else -- $1_TRUE='#' -- $1_FALSE= --fi --AC_CONFIG_COMMANDS_PRE( --[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then -- AC_MSG_ERROR([conditional \"$1\" was never defined. --Usually this means the macro was only invoked conditionally.]) --fi])]) -+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME -+ dnl accordingly. -+ AC_LIB_LINKFLAGS_BODY([$1], [$2]) - --# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- -+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, -+ dnl because if the user has installed lib[]Name and not disabled its use -+ dnl via --without-lib[]Name-prefix, he wants to use it. -+ ac_save_CPPFLAGS="$CPPFLAGS" -+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - --# serial 46 AC_PROG_LIBTOOL -+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ -+ ac_save_LIBS="$LIBS" -+ LIBS="$LIBS $LIB[]NAME" -+ AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) -+ LIBS="$ac_save_LIBS" -+ ]) -+ if test "$ac_cv_lib[]Name" = yes; then -+ HAVE_LIB[]NAME=yes -+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) -+ AC_MSG_CHECKING([how to link with lib[]$1]) -+ AC_MSG_RESULT([$LIB[]NAME]) -+ else -+ HAVE_LIB[]NAME=no -+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need -+ dnl $INC[]NAME either. -+ CPPFLAGS="$ac_save_CPPFLAGS" -+ LIB[]NAME= -+ LTLIB[]NAME= -+ fi -+ AC_SUBST([HAVE_LIB]NAME) -+ AC_SUBST([LIB]NAME) -+ AC_SUBST([LTLIB]NAME) -+ undefine([Name]) -+ undefine([NAME]) -+]) - --AC_DEFUN([AC_PROG_LIBTOOL], --[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -- --# This can be used to rebuild libtool when needed --LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" -- --# Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' --AC_SUBST(LIBTOOL)dnl -- --# Prevent multiple expansion --define([AC_PROG_LIBTOOL], []) --]) -- --AC_DEFUN([AC_LIBTOOL_SETUP], --[AC_PREREQ(2.13)dnl --AC_REQUIRE([AC_ENABLE_SHARED])dnl --AC_REQUIRE([AC_ENABLE_STATIC])dnl --AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl --AC_REQUIRE([AC_CANONICAL_HOST])dnl --AC_REQUIRE([AC_CANONICAL_BUILD])dnl --AC_REQUIRE([AC_PROG_CC])dnl --AC_REQUIRE([AC_PROG_LD])dnl --AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl --AC_REQUIRE([AC_PROG_NM])dnl --AC_REQUIRE([AC_PROG_LN_S])dnl --AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl --AC_REQUIRE([AC_OBJEXT])dnl --AC_REQUIRE([AC_EXEEXT])dnl --dnl -- --_LT_AC_PROG_ECHO_BACKSLASH --# Only perform the check for file, if the check method requires it --case $deplibs_check_method in --file_magic*) -- if test "$file_magic_cmd" = '$MAGIC_CMD'; then -- AC_PATH_MAGIC -- fi -- ;; --esac -- --AC_CHECK_TOOL(RANLIB, ranlib, :) --AC_CHECK_TOOL(STRIP, strip, :) -- --ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) --ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], --enable_win32_dll=yes, enable_win32_dll=no) -- --AC_ARG_ENABLE(libtool-lock, -- [ --disable-libtool-lock avoid locking (might break parallel builds)]) --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 --*-*-irix6*) -- # Find out which ABI we are using. -- echo '[#]line __oline__ "configure"' > conftest.$ac_ext -- if AC_TRY_EVAL(ac_compile); then -- case `/usr/bin/file conftest.$ac_objext` in -- *32-bit*) -- LD="${LD-ld} -32" -- ;; -- *N32*) -- LD="${LD-ld} -n32" -- ;; -- *64-bit*) -- LD="${LD-ld} -64" -- ;; -- esac -- fi -- rm -rf conftest* -- ;; -- --*-*-sco3.2v5*) -- # On SCO OpenServer 5, we need -belf to get full-featured binaries. -- SAVE_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -belf" -- AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, -- [AC_LANG_SAVE -- AC_LANG_C -- AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) -- AC_LANG_RESTORE]) -- if test x"$lt_cv_cc_needs_belf" != x"yes"; then -- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf -- CFLAGS="$SAVE_CFLAGS" -- fi -- ;; -- --ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], --[*-*-cygwin* | *-*-mingw* | *-*-pw32*) -- AC_CHECK_TOOL(DLLTOOL, dlltool, false) -- AC_CHECK_TOOL(AS, as, false) -- AC_CHECK_TOOL(OBJDUMP, objdump, false) -- -- # recent cygwin and mingw systems supply a stub DllMain which the user -- # can override, but on older systems we have to supply one -- AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, -- [AC_TRY_LINK([], -- [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); -- DllMain (0, 0, 0);], -- [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) -- -- case $host/$CC in -- *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) -- # old mingw systems require "-dll" to link a DLL, while more recent ones -- # require "-mdll" -- SAVE_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -mdll" -- AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, -- [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) -- CFLAGS="$SAVE_CFLAGS" ;; -- *-*-cygwin* | *-*-pw32*) -- # cygwin systems need to pass --dll to the linker, and not link -- # crt.o which will require a WinMain@16 definition. -- lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; -- esac -- ;; -+dnl Determine the platform dependent parameters needed to use rpath: -+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -+dnl hardcode_direct, hardcode_minus_L. -+AC_DEFUN([AC_LIB_RPATH], -+[ -+ dnl Tell automake >= 1.10 to complain if config.rpath is missing. -+ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) -+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS -+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld -+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host -+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir -+ AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ -+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ -+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh -+ . ./conftest.sh -+ rm -f ./conftest.sh -+ acl_cv_rpath=done - ]) --esac -- --_LT_AC_LTCONFIG_HACK -- -+ wl="$acl_cv_wl" -+ libext="$acl_cv_libext" -+ shlibext="$acl_cv_shlibext" -+ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" -+ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" -+ hardcode_direct="$acl_cv_hardcode_direct" -+ hardcode_minus_L="$acl_cv_hardcode_minus_L" -+ dnl Determine whether the user wants rpath handling at all. -+ AC_ARG_ENABLE(rpath, -+ [ --disable-rpath do not hardcode runtime library paths], -+ :, enable_rpath=yes) - ]) - --# AC_LIBTOOL_HEADER_ASSERT --# ------------------------ --AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], --[AC_CACHE_CHECK([whether $CC supports assert without backlinking], -- [lt_cv_func_assert_works], -- [case $host in -- *-*-solaris*) -- if test "$GCC" = yes && test "$with_gnu_ld" != yes; then -- case `$CC --version 2>/dev/null` in -- [[12]].*) lt_cv_func_assert_works=no ;; -- *) lt_cv_func_assert_works=yes ;; -- esac -- fi -- ;; -- esac]) -- --if test "x$lt_cv_func_assert_works" = xyes; then -- AC_CHECK_HEADERS(assert.h) --fi --])# AC_LIBTOOL_HEADER_ASSERT -- --# _LT_AC_CHECK_DLFCN --# -------------------- --AC_DEFUN([_LT_AC_CHECK_DLFCN], --[AC_CHECK_HEADERS(dlfcn.h) --])# _LT_AC_CHECK_DLFCN -- --# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE --# --------------------------------- --AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], --[AC_REQUIRE([AC_CANONICAL_HOST]) --AC_REQUIRE([AC_PROG_NM]) --AC_REQUIRE([AC_OBJEXT]) --# Check for command to grab the raw symbol name followed by C symbol from nm. --AC_MSG_CHECKING([command to parse $NM output]) --AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl -- --# These are sane defaults that work on at least a few old systems. --# [They come from Ultrix. What could be older than Ultrix?!! ;)] -- --# Character class describing NM global symbol codes. --symcode='[[BCDEGRST]]' -- --# Regexp to match symbols that can be accessed directly from C. --sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' -- --# Transform the above into a raw symbol and a C symbol. --symxfrm='\1 \2\3 \3' -- --# Transform an extracted symbol line into a proper C declaration --lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" -- --# Transform an extracted symbol line into symbol name and symbol address --lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -- --# Define system-specific variables. --case $host_os in --aix*) -- symcode='[[BCDT]]' -- ;; --cygwin* | mingw* | pw32*) -- symcode='[[ABCDGISTW]]' -- ;; --hpux*) # Its linker distinguishes data from code symbols -- lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" -- lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -- ;; --irix*) -- symcode='[[BCDEGRST]]' -- ;; --solaris* | sysv5*) -- symcode='[[BDT]]' -- ;; --sysv4) -- symcode='[[DFNSTU]]' -- ;; --esac -- --# Handle CRLF in mingw tool chain --opt_cr= --case $host_os in --mingw*) -- opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp -- ;; --esac -- --# If we're using GNU nm, then use its standard symbol codes. --if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then -- symcode='[[ABCDGISTW]]' --fi -- --# Try without a prefix undercore, then with it. --for ac_symprfx in "" "_"; do -- -- # Write the raw and C identifiers. --lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" -- -- # Check to see that the pipe works correctly. -- pipe_works=no -- rm -f conftest* -- cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then -- # Try sorting and uniquifying the output. -- if sort "$nlist" | uniq > "$nlist"T; then -- mv -f "$nlist"T "$nlist" -+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -+dnl the libraries corresponding to explicit and implicit dependencies. -+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -+AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -+[ -+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], -+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) -+ dnl By default, look in $includedir and $libdir. -+ use_additional=yes -+ AC_LIB_WITH_FINAL_PREFIX([ -+ eval additional_includedir=\"$includedir\" -+ eval additional_libdir=\"$libdir\" -+ ]) -+ AC_LIB_ARG_WITH([lib$1-prefix], -+[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib -+ --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -+[ -+ if test "X$withval" = "Xno"; then -+ use_additional=no -+ else -+ if test "X$withval" = "X"; then -+ AC_LIB_WITH_FINAL_PREFIX([ -+ eval additional_includedir=\"$includedir\" -+ eval additional_libdir=\"$libdir\" -+ ]) - else -- rm -f "$nlist"T -- fi -- -- # Make sure that we snagged all the symbols we need. -- if egrep ' nm_test_var$' "$nlist" >/dev/null; then -- if egrep ' nm_test_func$' "$nlist" >/dev/null; then -- cat < conftest.$ac_ext --#ifdef __cplusplus --extern "C" { --#endif -- --EOF -- # Now generate the symbol file. -- eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' -- -- cat <> conftest.$ac_ext --#if defined (__STDC__) && __STDC__ --# define lt_ptr void * --#else --# define lt_ptr char * --# define const --#endif -- --/* The mapping between symbol names and symbols. */ --const struct { -- const char *name; -- lt_ptr address; --} --lt_preloaded_symbols[[]] = --{ --EOF -- sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext -- cat <<\EOF >> conftest.$ac_ext -- {0, (lt_ptr) 0} --}; -- --#ifdef __cplusplus --} --#endif --EOF -- # Now try linking the two files. -- mv conftest.$ac_objext conftstm.$ac_objext -- save_LIBS="$LIBS" -- save_CFLAGS="$CFLAGS" -- LIBS="conftstm.$ac_objext" -- CFLAGS="$CFLAGS$no_builtin_flag" -- if AC_TRY_EVAL(ac_link) && test -s conftest; then -- pipe_works=yes -- fi -- LIBS="$save_LIBS" -- CFLAGS="$save_CFLAGS" -- else -- echo "cannot find nm_test_func in $nlist" >&AC_FD_CC -- fi -- else -- echo "cannot find nm_test_var in $nlist" >&AC_FD_CC -- fi -- else -- echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC -- fi -- else -- echo "$progname: failed program was:" >&AC_FD_CC -- cat conftest.$ac_ext >&5 -- fi -- rm -f 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 --]) --global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" --if test -z "$lt_cv_sys_global_symbol_pipe"; then -- global_symbol_to_cdecl= -- global_symbol_to_c_name_address= --else -- global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" -- global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" --fi --if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; --then -- AC_MSG_RESULT(failed) --else -- AC_MSG_RESULT(ok) --fi --]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -- --# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR --# --------------------------------- --AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], --[# Find the correct PATH separator. Usually this is `:', but --# DJGPP uses `;' like DOS. --if test "X${PATH_SEPARATOR+set}" != Xset; then -- UNAME=${UNAME-`uname 2>/dev/null`} -- case X$UNAME in -- *-DOS) lt_cv_sys_path_separator=';' ;; -- *) lt_cv_sys_path_separator=':' ;; -- esac -- PATH_SEPARATOR=$lt_cv_sys_path_separator --fi --])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -- --# _LT_AC_PROG_ECHO_BACKSLASH --# -------------------------- --# Add some code to the start of the generated configure script which --# will find an echo command which doesn't interpret backslashes. --AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], --[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], -- [AC_DIVERT_PUSH(NOTICE)]) --_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -- --# Check that we are running under the correct shell. --SHELL=${CONFIG_SHELL-/bin/sh} -- --case X$ECHO in --X*--fallback-echo) -- # Remove one level of quotation (which was required for Make). -- ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` -- ;; --esac -- --echo=${ECHO-echo} --if test "X[$]1" = X--no-reexec; then -- # Discard the --no-reexec flag, and continue. -- shift --elif test "X[$]1" = X--fallback-echo; then -- # Avoid inline document here, it may be left over -- : --elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then -- # Yippee, $echo works! -- : --else -- # Restart under the correct shell. -- exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} --fi -- --if test "X[$]1" = X--fallback-echo; then -- # used as fallback echo -- shift -- cat </dev/null && -- echo_test_string="`eval $cmd`" && -- (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null -- then -- break -- fi -- done --fi -- --if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- : --else -- # The Solaris, AIX, and Digital Unix default echo programs unquote -- # backslashes. This makes it impossible to quote backslashes using -- # echo "$something" | sed 's/\\/\\\\/g' -- # -- # So, first we look for a working echo in the user's PATH. -- -- IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR -- for dir in $PATH /usr/ucb; do -- if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && -- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- echo="$dir/echo" -- break -- fi -- done -- IFS="$save_ifs" -- -- if test "X$echo" = Xecho; then -- # We didn't find a better echo, so look for alternatives. -- if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- # This shell has a builtin print -r that does the trick. -- echo='print -r' -- elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && -- test "X$CONFIG_SHELL" != X/bin/ksh; then -- # If we have ksh, try running configure again with it. -- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -- export ORIGINAL_CONFIG_SHELL -- CONFIG_SHELL=/bin/ksh -- export CONFIG_SHELL -- exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} -- else -- # Try using printf. -- echo='printf %s\n' -- if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- # Cool, printf works -- : -- elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && -- test "X$echo_testing_string" = 'X\t' && -- echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL -- export CONFIG_SHELL -- SHELL="$CONFIG_SHELL" -- export SHELL -- echo="$CONFIG_SHELL [$]0 --fallback-echo" -- elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && -- test "X$echo_testing_string" = 'X\t' && -- echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- echo="$CONFIG_SHELL [$]0 --fallback-echo" -- else -- # maybe with a smaller string... -- prev=: -- -- for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do -- if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null -- then -- break -- fi -- prev="$cmd" -- done -- -- if test "$prev" != 'sed 50q "[$]0"'; then -- echo_test_string=`eval $prev` -- export echo_test_string -- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} -- else -- # Oops. We lost completely, so just stick with echo. -- echo=echo -- fi -- fi -- fi -- fi --fi --fi -- --# Copy echo and quote the copy suitably for passing to libtool from --# the Makefile, instead of quoting the original, which is used later. --ECHO=$echo --if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then -- ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" --fi -- --AC_SUBST(ECHO) --AC_DIVERT_POP --])# _LT_AC_PROG_ECHO_BACKSLASH -- --# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, --# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) --# ------------------------------------------------------------------ --AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], --[if test "$cross_compiling" = yes; then : -- [$4] --else -- AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 -- lt_status=$lt_dlunknown -- cat > conftest.$ac_ext < --#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 -- --#ifdef __cplusplus --extern "C" void exit (int); --#endif -- --void fnord() { int i=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; -- /* dlclose (self); */ -- } -- -- exit (status); --}] --EOF -- if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then -- (./conftest; exit; ) 2>/dev/null -- lt_status=$? -- case x$lt_status in -- x$lt_dlno_uscore) $1 ;; -- x$lt_dlneed_uscore) $2 ;; -- x$lt_unknown|x*) $3 ;; -- esac -- else : -- # compilation failed -- $3 -- fi --fi --rm -fr conftest* --])# _LT_AC_TRY_DLOPEN_SELF -- --# AC_LIBTOOL_DLOPEN_SELF --# ------------------- --AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], --[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 -- ;; -- -- cygwin* | mingw* | pw32*) -- lt_cv_dlopen="LoadLibrary" -- lt_cv_dlopen_libs= -- ;; -- -- *) -- AC_CHECK_FUNC([shl_load], -- [lt_cv_dlopen="shl_load"], -- [AC_CHECK_LIB([dld], [shl_load], -- [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], -- [AC_CHECK_FUNC([dlopen], -- [lt_cv_dlopen="dlopen"], -- [AC_CHECK_LIB([dl], [dlopen], -- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], -- [AC_CHECK_LIB([svld], [dlopen], -- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], -- [AC_CHECK_LIB([dld], [dld_link], -- [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) -- ]) -- ]) -- ]) -- ]) -- ]) -- ;; -- 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" -- AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -- test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" -- -- save_LDFLAGS="$LDFLAGS" -- eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -- -- save_LIBS="$LIBS" -- LIBS="$lt_cv_dlopen_libs $LIBS" -- -- AC_CACHE_CHECK([whether a program can dlopen itself], -- lt_cv_dlopen_self, [dnl -- _LT_AC_TRY_DLOPEN_SELF( -- lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, -- lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) -- ]) -- -- if test "x$lt_cv_dlopen_self" = xyes; then -- LDFLAGS="$LDFLAGS $link_static_flag" -- AC_CACHE_CHECK([whether a statically linked program can dlopen itself], -- lt_cv_dlopen_self_static, [dnl -- _LT_AC_TRY_DLOPEN_SELF( -- lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, -- lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) -- ]) -- 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 --])# AC_LIBTOOL_DLOPEN_SELF -- --AC_DEFUN([_LT_AC_LTCONFIG_HACK], --[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl --# Sed substitution that helps us do robust quoting. It backslashifies --# metacharacters that are still active within double-quoted strings. --Xsed='sed -e s/^X//' --sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' -- --# Same as above, but do not quote variable references. --double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' -- --# Sed substitution to delay expansion of an escaped shell variable in a --# double_quote_subst'ed string. --delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' -- --# Constants: --rm="rm -f" -- --# Global variables: --default_ofile=libtool --can_build_shared=yes -- --# All known linkers require a `.a' archive for static linking (except M$VC, --# which needs '.lib'). --libext=a --ltmain="$ac_aux_dir/ltmain.sh" --ofile="$default_ofile" --with_gnu_ld="$lt_cv_prog_gnu_ld" --need_locks="$enable_libtool_lock" -- --old_CC="$CC" --old_CFLAGS="$CFLAGS" -- --# Set sane defaults for various variables --test -z "$AR" && AR=ar --test -z "$AR_FLAGS" && AR_FLAGS=cru --test -z "$AS" && AS=as --test -z "$CC" && CC=cc --test -z "$DLLTOOL" && DLLTOOL=dlltool --test -z "$LD" && LD=ld --test -z "$LN_S" && LN_S="ln -s" --test -z "$MAGIC_CMD" && MAGIC_CMD=file --test -z "$NM" && NM=nm --test -z "$OBJDUMP" && OBJDUMP=objdump --test -z "$RANLIB" && RANLIB=: --test -z "$STRIP" && STRIP=: --test -z "$ac_objext" && ac_objext=o -- --if test x"$host" != x"$build"; then -- ac_tool_prefix=${host_alias}- --else -- ac_tool_prefix= --fi -- --# Transform linux* to *-*-linux-gnu*, to support old configure scripts. --case $host_os in --linux-gnu*) ;; --linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` --esac -- --case $host_os in --aix3*) -- # AIX sometimes has problems with the GCC collect2 program. For some -- # reason, if we set the COLLECT_NAMES environment variable, the problems -- # vanish in a puff of smoke. -- if test "X${COLLECT_NAMES+set}" != Xset; then -- COLLECT_NAMES= -- export COLLECT_NAMES -- fi -- ;; --esac -- --# Determine commands to create old-style static archives. --old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' --old_postinstall_cmds='chmod 644 $oldlib' --old_postuninstall_cmds= -- --if test -n "$RANLIB"; then -- case $host_os in -- openbsd*) -- old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" -- ;; -- *) -- old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" -- ;; -- esac -- old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" --fi -- --# Allow CC to be a program name with arguments. --set dummy $CC --compiler="[$]2" -- --AC_MSG_CHECKING([for objdir]) --rm -f .libs 2>/dev/null --mkdir .libs 2>/dev/null --if test -d .libs; then -- objdir=.libs --else -- # MS-DOS does not allow filenames that begin with a dot. -- objdir=_libs --fi --rmdir .libs 2>/dev/null --AC_MSG_RESULT($objdir) -- -- --AC_ARG_WITH(pic, --[ --with-pic try to use only PIC/non-PIC objects [default=use both]], --pic_mode="$withval", pic_mode=default) --test -z "$pic_mode" && pic_mode=default -- --# We assume here that the value for lt_cv_prog_cc_pic will not be cached --# in isolation, and that seeing it set (from the cache) indicates that --# the associated values are set (in the cache) correctly too. --AC_MSG_CHECKING([for $compiler option to produce PIC]) --AC_CACHE_VAL(lt_cv_prog_cc_pic, --[ lt_cv_prog_cc_pic= -- lt_cv_prog_cc_shlib= -- lt_cv_prog_cc_wl= -- lt_cv_prog_cc_static= -- lt_cv_prog_cc_no_builtin= -- lt_cv_prog_cc_can_build_shared=$can_build_shared -- -- if test "$GCC" = yes; then -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static='-static' -- -- case $host_os in -- aix*) -- # Below there is a dirty hack to force normal static linking with -ldl -- # The problem is because libdl dynamically linked with both libc and -- # libC (AIX C++ library), which obviously doesn't included in libraries -- # list by gcc. This cause undefined symbols with -static flags. -- # This hack allows C programs to be linked with "-static -ldl", but -- # not sure about C++ programs. -- lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" -- ;; -- amigaos*) -- # FIXME: we need at least 68020 code to build shared libraries, but -- # adding the `-m68020' flag to GCC prevents building anything better, -- # like `-m68040'. -- lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' -- ;; -- beos* | irix5* | irix6* | osf3* | osf4* | osf5*) -- # PIC is the default for these OSes. -- ;; -- darwin* | rhapsody*) -- # PIC is the default on this platform -- # Common symbols not allowed in MH_DYLIB files -- lt_cv_prog_cc_pic='-fno-common' -- ;; -- cygwin* | mingw* | pw32* | os2*) -- # 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_cv_prog_cc_pic='-DDLL_EXPORT' -- ;; -- sysv4*MP*) -- if test -d /usr/nec; then -- lt_cv_prog_cc_pic=-Kconform_pic -- fi -- ;; -- *) -- lt_cv_prog_cc_pic='-fPIC' -- ;; -- esac -- else -- # PORTME Check for PIC flags for the system compiler. -- case $host_os in -- aix3* | aix4* | aix5*) -- lt_cv_prog_cc_wl='-Wl,' -- # All AIX code is PIC. -- if test "$host_cpu" = ia64; then -- # AIX 5 now supports IA64 processor -- lt_cv_prog_cc_static='-Bstatic' -- else -- lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' -- fi -- ;; -- -- hpux9* | hpux10* | hpux11*) -- # Is there a better lt_cv_prog_cc_static that works with the bundled CC? -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" -- lt_cv_prog_cc_pic='+Z' -- ;; -- -- irix5* | irix6*) -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static='-non_shared' -- # PIC (with -KPIC) is the default. -- ;; -- -- cygwin* | mingw* | pw32* | os2*) -- # 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_cv_prog_cc_pic='-DDLL_EXPORT' -- ;; -- -- newsos6) -- lt_cv_prog_cc_pic='-KPIC' -- lt_cv_prog_cc_static='-Bstatic' -- ;; -- -- osf3* | osf4* | osf5*) -- # All OSF/1 code is PIC. -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static='-non_shared' -- ;; -- -- sco3.2v5*) -- lt_cv_prog_cc_pic='-Kpic' -- lt_cv_prog_cc_static='-dn' -- lt_cv_prog_cc_shlib='-belf' -- ;; -- -- solaris*) -- lt_cv_prog_cc_pic='-KPIC' -- lt_cv_prog_cc_static='-Bstatic' -- lt_cv_prog_cc_wl='-Wl,' -- ;; -- -- sunos4*) -- lt_cv_prog_cc_pic='-PIC' -- lt_cv_prog_cc_static='-Bstatic' -- lt_cv_prog_cc_wl='-Qoption ld ' -- ;; -- -- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -- lt_cv_prog_cc_pic='-KPIC' -- lt_cv_prog_cc_static='-Bstatic' -- if test "x$host_vendor" = xsni; then -- lt_cv_prog_cc_wl='-LD' -- else -- lt_cv_prog_cc_wl='-Wl,' -- fi -- ;; -- -- uts4*) -- lt_cv_prog_cc_pic='-pic' -- lt_cv_prog_cc_static='-Bstatic' -- ;; -- -- sysv4*MP*) -- if test -d /usr/nec ;then -- lt_cv_prog_cc_pic='-Kconform_pic' -- lt_cv_prog_cc_static='-Bstatic' -- fi -- ;; -- -- *) -- lt_cv_prog_cc_can_build_shared=no -- ;; -- esac -- fi --]) --if test -z "$lt_cv_prog_cc_pic"; then -- AC_MSG_RESULT([none]) --else -- AC_MSG_RESULT([$lt_cv_prog_cc_pic]) -- -- # Check to make sure the pic_flag actually works. -- AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) -- AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl -- save_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" -- AC_TRY_COMPILE([], [], [dnl -- case $host_os in -- hpux9* | hpux10* | hpux11*) -- # On HP-UX, both CC and GCC only warn that PIC is supported... then -- # they create non-PIC objects. So, if there were any warnings, we -- # assume that PIC is not supported. -- if test -s conftest.err; then -- lt_cv_prog_cc_pic_works=no -- else -- lt_cv_prog_cc_pic_works=yes -- fi -- ;; -- *) -- lt_cv_prog_cc_pic_works=yes -- ;; -- esac -- ], [dnl -- lt_cv_prog_cc_pic_works=no -- ]) -- CFLAGS="$save_CFLAGS" -- ]) -- -- if test "X$lt_cv_prog_cc_pic_works" = Xno; then -- lt_cv_prog_cc_pic= -- lt_cv_prog_cc_can_build_shared=no -- else -- lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" -- fi -- -- AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) --fi -- --# Check for any special shared library compilation flags. --if test -n "$lt_cv_prog_cc_shlib"; then -- AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) -- if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : -- else -- AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) -- lt_cv_prog_cc_can_build_shared=no -- fi --fi -- --AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) --AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl -- lt_cv_prog_cc_static_works=no -- save_LDFLAGS="$LDFLAGS" -- LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" -- AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) -- LDFLAGS="$save_LDFLAGS" --]) -- --# Belt *and* braces to stop my trousers falling down: --test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= --AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) -- --pic_flag="$lt_cv_prog_cc_pic" --special_shlib_compile_flags="$lt_cv_prog_cc_shlib" --wl="$lt_cv_prog_cc_wl" --link_static_flag="$lt_cv_prog_cc_static" --no_builtin_flag="$lt_cv_prog_cc_no_builtin" --can_build_shared="$lt_cv_prog_cc_can_build_shared" -- -- --# Check to see if options -o and -c are simultaneously supported by compiler --AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) --AC_CACHE_VAL([lt_cv_compiler_c_o], [ --$rm -r conftest 2>/dev/null --mkdir conftest --cd conftest --echo "int some_variable = 0;" > conftest.$ac_ext --mkdir out --# According to Tom Tromey, Ian Lance Taylor reported there are C compilers --# that will create temporary files in the current directory regardless of --# the output directory. Thus, making CWD read-only will cause this test --# to fail, enabling locking or at least warning the user not to do parallel --# builds. --chmod -w . --save_CFLAGS="$CFLAGS" --CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" --compiler_c_o=no --if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && 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 -- if test -s out/conftest.err; then -- lt_cv_compiler_c_o=no -- else -- lt_cv_compiler_c_o=yes -- fi --else -- # Append any errors to the config.log. -- cat out/conftest.err 1>&AC_FD_CC -- lt_cv_compiler_c_o=no --fi --CFLAGS="$save_CFLAGS" --chmod u+w . --$rm conftest* out/* --rmdir out --cd .. --rmdir conftest --$rm -r conftest 2>/dev/null --]) --compiler_c_o=$lt_cv_compiler_c_o --AC_MSG_RESULT([$compiler_c_o]) -- --if test x"$compiler_c_o" = x"yes"; then -- # Check to see if we can write to a .lo -- AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) -- AC_CACHE_VAL([lt_cv_compiler_o_lo], [ -- lt_cv_compiler_o_lo=no -- save_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -c -o conftest.lo" -- save_objext="$ac_objext" -- ac_objext=lo -- AC_TRY_COMPILE([], [int some_variable = 0;], [dnl -- # The compiler can only warn and ignore the option if not recognized -- # So say no if there are warnings -- if test -s conftest.err; then -- lt_cv_compiler_o_lo=no -- else -- lt_cv_compiler_o_lo=yes -- fi -- ]) -- ac_objext="$save_objext" -- CFLAGS="$save_CFLAGS" -- ]) -- compiler_o_lo=$lt_cv_compiler_o_lo -- AC_MSG_RESULT([$compiler_o_lo]) --else -- compiler_o_lo=no --fi -- --# Check to see if we can do hard links to lock some files if needed --hard_links="nottested" --if test "$compiler_c_o" = no && test "$need_locks" != no; then -- # do not overwrite the value of need_locks provided by the user -- AC_MSG_CHECKING([if we can lock with hard links]) -- 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 -- AC_MSG_RESULT([$hard_links]) -- if test "$hard_links" = no; then -- AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) -- need_locks=warn -- fi --else -- need_locks=no --fi -- --if test "$GCC" = yes; then -- # Check to see if options -fno-rtti -fno-exceptions are supported by compiler -- AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) -- echo "int some_variable = 0;" > conftest.$ac_ext -- save_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" -- compiler_rtti_exceptions=no -- AC_TRY_COMPILE([], [int some_variable = 0;], [dnl -- # The compiler can only warn and ignore the option if not recognized -- # So say no if there are warnings -- if test -s conftest.err; then -- compiler_rtti_exceptions=no -- else -- compiler_rtti_exceptions=yes -- fi -- ]) -- CFLAGS="$save_CFLAGS" -- AC_MSG_RESULT([$compiler_rtti_exceptions]) -- -- if test "$compiler_rtti_exceptions" = "yes"; then -- no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' -- else -- no_builtin_flag=' -fno-builtin' -- fi --fi -- --# See if the linker supports building shared libraries. --AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) -- --allow_undefined_flag= --no_undefined_flag= --need_lib_prefix=unknown --need_version=unknown --# when you set need_version to no, make sure it does not cause -set_version --# flags to be left without arguments --archive_cmds= --archive_expsym_cmds= --old_archive_from_new_cmds= --old_archive_from_expsyms_cmds= --export_dynamic_flag_spec= --whole_archive_flag_spec= --thread_safe_flag_spec= --hardcode_into_libs=no --hardcode_libdir_flag_spec= --hardcode_libdir_separator= --hardcode_direct=no --hardcode_minus_L=no --hardcode_shlibpath_var=unsupported --runpath_var= --link_all_deplibs=unknown --always_export_symbols=no --export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' --# include_expsyms should be a list of space-separated symbols to be *always* --# included in the symbol list --include_expsyms= --# exclude_expsyms can be an egrep regular expression of symbols to exclude --# it will be wrapped by ` (' and `)$', so one must not match beginning or --# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', --# as well as any symbol that contains `d'. --exclude_expsyms="_GLOBAL_OFFSET_TABLE_" --# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out --# platforms (ab)use it in PIC code, but their linkers get confused if --# the symbol is explicitly referenced. Since portable code cannot --# rely on this symbol name, it's probably fine to never include it in --# preloaded symbol tables. --extract_expsyms_cmds= -- --case $host_os in --cygwin* | mingw* | pw32*) -- # 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 -- ;; --openbsd*) -- with_gnu_ld=no -- ;; --esac -- --ld_shlibs=yes --if test "$with_gnu_ld" = yes; then -- # If archive_cmds runs LD, not CC, wlarc should be empty -- wlarc='${wl}' -- -- # See if GNU ld supports shared libraries. -- case $host_os in -- aix3* | aix4* | aix5*) -- # On AIX, the GNU linker is very broken -- # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. -- ld_shlibs=no -- cat <&2 -- --*** Warning: the GNU linker, at least up to release 2.9.1, is reported --*** to be unable to reliably create shared libraries on AIX. --*** Therefore, libtool is disabling shared libraries support. If you --*** really care for shared libraries, you may want to modify your PATH --*** so that a non-GNU linker is found, and then restart. -- --EOF -- ;; -- -- amigaos*) -- archive_cmds='$rm $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 -- -- # Samuel A. Falvo II reports -- # that the semantics of dynamic libraries on AmigaOS, at least up -- # to version 4, is to share data among multiple programs linked -- # with the same dynamic library. Since this doesn't match the -- # behavior of shared libraries on other platforms, we can use -- # them. -- ld_shlibs=no -- ;; -- -- beos*) -- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then -- allow_undefined_flag=unsupported -- # Joseph Beckenbach 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*) -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec='-L$libdir' -- allow_undefined_flag=unsupported -- always_export_symbols=yes -- -- extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ -- sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ -- test -f $output_objdir/impgen.exe || (cd $output_objdir && \ -- if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ -- else $CC -o impgen impgen.c ; fi)~ -- $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' -- -- old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' -- -- # cygwin and mingw dlls have different entry points and sets of symbols -- # to exclude. -- # FIXME: what about values for MSVC? -- dll_entry=__cygwin_dll_entry@12 -- dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ -- case $host_os in -- mingw*) -- # mingw values -- dll_entry=_DllMainCRTStartup@12 -- dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ -- ;; -- esac -- -- # mingw and cygwin differ, and it's simplest to just exclude the union -- # of the two symbol sets. -- dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 -- -- # recent cygwin and mingw systems supply a stub DllMain which the user -- # can override, but on older systems we have to supply one (in ltdll.c) -- if test "x$lt_cv_need_dllmain" = "xyes"; then -- ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " -- ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ -- test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' -- else -- ltdll_obj= -- ltdll_cmds= -- fi -- -- # Extract the symbol export list from an `--export-all' def file, -- # then regenerate the def file from the symbol export list, so that -- # the compiled dll only exports the symbol export list. -- # Be careful not to strip the DATA tag left be newer dlltools. -- export_symbols_cmds="$ltdll_cmds"' -- $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ -- sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' -- -- # If the export-symbols file already is a .def file (1st line -- # is EXPORTS), use it as is. -- # If DATA tags from a recent dlltool are present, honour them! -- archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then -- cp $export_symbols $output_objdir/$soname-def; -- else -- echo EXPORTS > $output_objdir/$soname-def; -- _lt_hint=1; -- cat $export_symbols | while read symbol; do -- set dummy \$symbol; -- case \[$]# in -- 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; -- *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; -- esac; -- _lt_hint=`expr 1 + \$_lt_hint`; -- done; -- fi~ -- '"$ltdll_cmds"' -- $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ -- $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ -- $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' -- ;; -- -- 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 -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -- archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -- fi -- ;; -- -- solaris* | sysv5*) -- if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then -- ld_shlibs=no -- cat <&2 -- --*** Warning: The releases 2.8.* of the GNU linker cannot reliably --*** create shared libraries on Solaris systems. Therefore, libtool --*** is disabling shared libraries support. We urge you to upgrade GNU --*** binutils to release 2.9.1 or newer. Another option is to modify --*** your PATH or compiler configuration so that the native linker is --*** used, and then restart. -- --EOF -- elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then -- archive_cmds='$CC -shared $libobjs $deplibs $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 -- ;; -- -- 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 | egrep ': supported targets:.* elf' > /dev/null; then -- 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 -- -- if test "$ld_shlibs" = yes; then -- runpath_var=LD_RUN_PATH -- hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' -- export_dynamic_flag_spec='${wl}--export-dynamic' -- case $host_os in -- cygwin* | mingw* | pw32*) -- # dlltool doesn't understand --whole-archive et. al. -- whole_archive_flag_spec= -- ;; -- *) -- # ancient GNU ld didn't support --whole-archive et. al. -- if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then -- whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -- else -- whole_archive_flag_spec= -- fi -- ;; -- esac -- fi --else -- # PORTME fill in a description of your system's linker (not GNU ld) -- case $host_os in -- aix3*) -- allow_undefined_flag=unsupported -- always_export_symbols=yes -- archive_expsym_cmds='$LD -o $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 "$link_static_flag"; then -- # Neither direct hardcoding nor static linking is supported with a -- # broken collect2. -- hardcode_direct=unsupported -- fi -- ;; -- -- aix4* | aix5*) -- 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 -- 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]].*|aix5*) -- 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. -- -- hardcode_direct=yes -- archive_cmds='' -- hardcode_libdir_separator=':' -- if test "$GCC" = yes; then -- case $host_os in aix4.[[012]]|aix4.[[012]].*) -- collect2name=`${CC} -print-prog-name=collect2` -- if test -f "$collect2name" && \ -- strings "$collect2name" | grep resolve_lib_name >/dev/null -- then -- # We have reworked collect2 -- hardcode_direct=yes -- else -- # We have old collect2 -- hardcode_direct=unsupported -- # It fails to find uninstalled libraries when the uninstalled -- # path is not listed in the libpath. Setting hardcode_minus_L -- # to unsupported forces relinking -- hardcode_minus_L=yes -- hardcode_libdir_flag_spec='-L$libdir' -- hardcode_libdir_separator= -- fi -- esac -- -- shared_flag='-shared' -- else -- # not using gcc -- if test "$host_cpu" = ia64; then -- shared_flag='${wl}-G' -- else -- if test "$aix_use_runtimelinking" = yes; then -- shared_flag='${wl}-G' -- else -- shared_flag='${wl}-bM:SRE' -- fi -- fi -- fi -- -- # It seems that -bexpall can do strange things, 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' -- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' -- archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${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 ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -- else -- hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' -- # Warning - without using the other run time loading flags, -- # -berok will link without error, but may produce a broken library. -- allow_undefined_flag='${wl}-berok' -- # This is a bit strange, but is similar to how AIX traditionally builds -- # it's shared libraries. -- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' -- fi -- fi -- ;; -- -- amigaos*) -- 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 -- # see comment about different semantics on the GNU ld section -- ld_shlibs=no -- ;; -- -- cygwin* | mingw* | pw32*) -- # When not using gcc, we currently assume that we are using -- # Microsoft Visual C++. -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec=' ' -- allow_undefined_flag=unsupported -- # Tell ltmain to make .lib files, not .a files. -- libext=lib -- # FIXME: Setting linknames here is a bad hack. -- archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' -- # The linker will automatically build a .lib file if we build a DLL. -- old_archive_from_new_cmds='true' -- # FIXME: Should let the user specify the lib program. -- old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' -- fix_srcfile_path='`cygpath -w "$srcfile"`' -- ;; -- -- darwin* | rhapsody*) -- case "$host_os" in -- rhapsody* | darwin1.[[012]]) -- allow_undefined_flag='-undefined suppress' -- ;; -- *) # Darwin 1.3 on -- allow_undefined_flag='-flat_namespace -undefined suppress' -- ;; -- esac -- # FIXME: Relying on posixy $() will cause problems for -- # cross-compilation, but unfortunately the echo tests do not -- # yet detect zsh echo's removal of \ escapes. -- archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' -- # We need to add '_' to the symbols in $export_symbols first -- #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' -- hardcode_direct=yes -- hardcode_shlibpath_var=no -- whole_archive_flag_spec='-all_load $convenience' -- ;; -- -- 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*) -- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' -- hardcode_libdir_flag_spec='-R$libdir' -- hardcode_direct=yes -- hardcode_shlibpath_var=no -- ;; -- -- hpux9* | hpux10* | hpux11*) -- case $host_os in -- hpux9*) 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' ;; -- *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; -- esac -- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' -- hardcode_libdir_separator=: -- hardcode_direct=yes -- hardcode_minus_L=yes # Not in the search PATH, but as the default -- # location of the library. -- export_dynamic_flag_spec='${wl}-E' -- ;; -- -- irix5* | irix6*) -- if test "$GCC" = yes; then -- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -- else -- archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -- fi -- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -- hardcode_libdir_separator=: -- 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 -- ;; -- -- openbsd*) -- hardcode_direct=yes -- hardcode_shlibpath_var=no -- 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 $linker_flags' -- 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 $linker_flags' -- hardcode_libdir_flag_spec='${wl}-rpath,$libdir' -- ;; -- esac -- 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" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -- else -- allow_undefined_flag=' -expect_unresolved \*' -- archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -- fi -- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -- hardcode_libdir_separator=: -- ;; -- -- osf4* | osf5*) # as osf3* with the addition of -msym flag -- if test "$GCC" = yes; then -- allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' -- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${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='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -- archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ -- $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' -- -- #Both c and cxx compiler support -rpath directly -- hardcode_libdir_flag_spec='-rpath $libdir' -- fi -- hardcode_libdir_separator=: -- ;; -- -- sco3.2v5*) -- 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 -- export_dynamic_flag_spec='${wl}-Bexport' -- ;; -- -- solaris*) -- # gcc --version < 3.0 without binutils cannot create self contained -- # shared libraries reliably, requiring libgcc.a to resolve some of -- # the object symbols generated in some cases. Libraries that use -- # assert need libgcc.a to resolve __eprintf, for example. Linking -- # a copy of libgcc.a into every shared library to guarantee resolving -- # such symbols causes other problems: According to Tim Van Holder -- # , C++ libraries end up with a separate -- # (to the application) exception stack for one thing. -- no_undefined_flag=' -z defs' -- if test "$GCC" = yes; then -- case `$CC --version 2>/dev/null` in -- [[12]].*) -- cat <&2 -- --*** Warning: Releases of GCC earlier than version 3.0 cannot reliably --*** create self contained shared libraries on Solaris systems, without --*** introducing a dependency on libgcc.a. Therefore, libtool is disabling --*** -no-undefined support, which will at least allow you to build shared --*** libraries. However, you may find that when you link such libraries --*** into an application without using GCC, you have to manually add --*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to --*** upgrade to a newer version of GCC. Another option is to rebuild your --*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. -- --EOF -- no_undefined_flag= -- ;; -- esac -- fi -- # $CC -shared without GNU ld will not create a library from C++ -- # object files and a static libstdc++, better avoid it by now -- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $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' -- hardcode_libdir_flag_spec='-R$libdir' -- hardcode_shlibpath_var=no -- case $host_os in -- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; -- *) # Supported since Solaris 2.6 (maybe 2.5.1?) -- whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; -- esac -- 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) -- if test "x$host_vendor" = xsno; then -- archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' -- hardcode_direct=yes # is this really true??? -- else -- 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 -- fi -- 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' -- ;; -- -- sysv5*) -- no_undefined_flag=' -z text' -- # $CC -shared without GNU ld will not create a library from C++ -- # object files and a static libstdc++, better avoid it by now -- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $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' -- hardcode_libdir_flag_spec= -- hardcode_shlibpath_var=no -- runpath_var='LD_RUN_PATH' -- ;; -- -- uts4*) -- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -- hardcode_libdir_flag_spec='-L$libdir' -- hardcode_shlibpath_var=no -- ;; -- -- dgux*) -- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -- hardcode_libdir_flag_spec='-L$libdir' -- hardcode_shlibpath_var=no -- ;; -- -- sysv4*MP*) -- if test -d /usr/nec; then -- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -- hardcode_shlibpath_var=no -- runpath_var=LD_RUN_PATH -- hardcode_runpath_var=yes -- ld_shlibs=yes -- fi -- ;; -- -- sysv4.2uw2*) -- archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' -- hardcode_direct=yes -- hardcode_minus_L=no -- hardcode_shlibpath_var=no -- hardcode_runpath_var=yes -- runpath_var=LD_RUN_PATH -- ;; -- -- sysv5uw7* | unixware7*) -- no_undefined_flag='${wl}-z ${wl}text' -- if test "$GCC" = yes; then -- archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -- else -- archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -- fi -- runpath_var='LD_RUN_PATH' -- hardcode_shlibpath_var=no -- ;; -- -- *) -- ld_shlibs=no -- ;; -- esac --fi --AC_MSG_RESULT([$ld_shlibs]) --test "$ld_shlibs" = no && can_build_shared=no -- --# Check hardcoding attributes. --AC_MSG_CHECKING([how to hardcode library paths into programs]) --hardcode_action= --if test -n "$hardcode_libdir_flag_spec" || \ -- test -n "$runpath_var"; then -- -- # We can hardcode non-existant directories. -- if test "$hardcode_direct" != no && -- # If the only mechanism to avoid hardcoding is shlibpath_var, we -- # have to relink, otherwise we might link with an installed library -- # when we should be linking with a yet-to-be-installed one -- ## test "$hardcode_shlibpath_var" != no && -- test "$hardcode_minus_L" != no; then -- # Linking always hardcodes the temporary library directory. -- hardcode_action=relink -- else -- # We can link without hardcoding, and we can hardcode nonexisting dirs. -- hardcode_action=immediate -- fi --else -- # We cannot hardcode anything, or else we can only hardcode existing -- # directories. -- hardcode_action=unsupported --fi --AC_MSG_RESULT([$hardcode_action]) -- --striplib= --old_striplib= --AC_MSG_CHECKING([whether stripping libraries is possible]) --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" -- AC_MSG_RESULT([yes]) --else -- AC_MSG_RESULT([no]) --fi -- --reload_cmds='$LD$reload_flag -o $output$reload_objs' --test -z "$deplibs_check_method" && deplibs_check_method=unknown -- --# PORTME Fill in your ld.so characteristics --AC_MSG_CHECKING([dynamic linker characteristics]) --library_names_spec= --libname_spec='lib$name' --soname_spec= --postinstall_cmds= --postuninstall_cmds= --finish_cmds= --finish_eval= --shlibpath_var= --shlibpath_overrides_runpath=unknown --version_type=none --dynamic_linker="$host_os ld.so" --sys_lib_dlsearch_path_spec="/lib /usr/lib" --sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -- --case $host_os in --aix3*) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix $libname.a' -- shlibpath_var=LIBPATH -- -- # AIX has no versioning support, so we append a major version to the name. -- soname_spec='${libname}${release}.so$major' -- ;; -- --aix4* | aix5*) -- version_type=linux -- if test "$host_cpu" = ia64; then -- # AIX 5 supports IA64 -- library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' -- 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}.so$versuffix ${libname}${release}.so$major $libname.so' -- 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}.so$major' -- fi -- shlibpath_var=LIBPATH -- fi -- ;; -- --amigaos*) -- library_names_spec='$libname.ixlibrary $libname.a' -- # Create ${libname}_ixlibrary.a entries in /sys/libs. -- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' -- ;; -- --beos*) -- library_names_spec='${libname}.so' -- dynamic_linker="$host_os ld.so" -- shlibpath_var=LIBRARY_PATH -- ;; -- --bsdi4*) -- version_type=linux -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" -- sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" -- export_dynamic_flag_spec=-rdynamic -- # the default ld.so.conf also contains /usr/contrib/lib and -- # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow -- # libtool to hard-code these into programs -- ;; -- --cygwin* | mingw* | pw32*) -- version_type=windows -- need_version=no -- need_lib_prefix=no -- case $GCC,$host_os in -- yes,cygwin*) -- library_names_spec='$libname.dll.a' -- soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' -- postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ -- dldir=$destdir/`dirname \$dlpath`~ -- test -d \$dldir || mkdir -p \$dldir~ -- $install_prog .libs/$dlname \$dldir/$dlname' -- postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ -- dlpath=$dir/\$dldll~ -- $rm \$dlpath' -- ;; -- yes,mingw*) -- library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' -- sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` -- ;; -- yes,pw32*) -- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' -- ;; -- *) -- library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' -- ;; -- esac -- dynamic_linker='Win32 ld.exe' -- # 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 -- # FIXME: Relying on posixy $() will cause problems for -- # cross-compilation, but unfortunately the echo tests do not -- # yet detect zsh echo's removal of \ escapes. -- library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' -- soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' -- shlibpath_overrides_runpath=yes -- shlibpath_var=DYLD_LIBRARY_PATH -- ;; -- --freebsd1*) -- dynamic_linker=no -- ;; -- --freebsd*) -- objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` -- version_type=freebsd-$objformat -- case $version_type in -- freebsd-elf*) -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' -- need_version=no -- need_lib_prefix=no -- ;; -- freebsd-*) -- library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' -- need_version=yes -- ;; -- esac -- shlibpath_var=LD_LIBRARY_PATH -- case $host_os in -- freebsd2*) -- shlibpath_overrides_runpath=yes -- ;; -- *) -- shlibpath_overrides_runpath=no -- hardcode_into_libs=yes -- ;; -- esac -- ;; -- --gnu*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- 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. -- dynamic_linker="$host_os dld.sl" -- version_type=sunos -- need_lib_prefix=no -- need_version=no -- shlibpath_var=SHLIB_PATH -- shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH -- library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' -- soname_spec='${libname}${release}.sl$major' -- # HP-UX runs *really* slowly unless shared libraries are mode 555. -- postinstall_cmds='chmod 555 $lib' -- ;; -- --irix5* | irix6*) -- version_type=irix -- need_lib_prefix=no -- need_version=no -- soname_spec='${libname}${release}.so$major' -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' -- case $host_os in -- irix5*) -- libsuff= shlibsuff= -- ;; -- *) -- case $LD in # libtool.m4 will add one of these switches to LD -- *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; -- *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; -- *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; -- *) libsuff= shlibsuff= libmagic=never-match;; -- esac -- ;; -- esac -- shlibpath_var=LD_LIBRARY${shlibsuff}_PATH -- shlibpath_overrides_runpath=no -- sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" -- sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" -- ;; -- --# No shared lib support for Linux oldld, aout, or coff. --linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) -- dynamic_linker=no -- ;; -- --# This must be Linux ELF. --linux-gnu*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=no -- # 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 -- -- # 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}.so$versuffix ${libname}.so$versuffix' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' -- dynamic_linker='NetBSD (a.out) ld.so' -- else -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' -- soname_spec='${libname}${release}.so$major' -- dynamic_linker='NetBSD ld.elf_so' -- fi -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- hardcode_into_libs=yes -- ;; -- --newsos6) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- ;; -- --openbsd*) -- version_type=sunos -- need_lib_prefix=no -- need_version=no -- 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 -- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- ;; -- --os2*) -- libname_spec='$name' -- need_lib_prefix=no -- library_names_spec='$libname.dll $libname.a' -- dynamic_linker='OS/2 ld.exe' -- shlibpath_var=LIBPATH -- ;; -- --osf3* | osf4* | osf5*) -- version_type=osf -- need_version=no -- soname_spec='${libname}${release}.so' -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' -- shlibpath_var=LD_LIBRARY_PATH -- 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" -- ;; -- --sco3.2v5*) -- version_type=osf -- soname_spec='${libname}${release}.so$major' -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- shlibpath_var=LD_LIBRARY_PATH -- ;; -- --solaris*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- hardcode_into_libs=yes -- # ldd complains unless libraries are executable -- postinstall_cmds='chmod +x $lib' -- ;; -- --sunos4*) -- version_type=sunos -- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' -- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- if test "$with_gnu_ld" = yes; then -- need_lib_prefix=no -- fi -- need_version=yes -- ;; -- --sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- case $host_vendor in -- sni) -- shlibpath_overrides_runpath=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 -- ;; -- --uts4*) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- ;; -- --dgux*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- ;; -- --sysv4*MP*) -- if test -d /usr/nec ;then -- version_type=linux -- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' -- soname_spec='$libname.so.$major' -- shlibpath_var=LD_LIBRARY_PATH -- fi -- ;; -- --*) -- dynamic_linker=no -- ;; --esac --AC_MSG_RESULT([$dynamic_linker]) --test "$dynamic_linker" = no && can_build_shared=no -- --# Report the final consequences. --AC_MSG_CHECKING([if libtool supports shared libraries]) --AC_MSG_RESULT([$can_build_shared]) -- --AC_MSG_CHECKING([whether to build shared libraries]) --test "$can_build_shared" = "no" && enable_shared=no -- --# On AIX, shared libraries and static libraries use the same namespace, and --# are all built from PIC. --case "$host_os" in --aix3*) -- test "$enable_shared" = yes && enable_static=no -- if test -n "$RANLIB"; then -- archive_cmds="$archive_cmds~\$RANLIB \$lib" -- postinstall_cmds='$RANLIB $lib' -- fi -- ;; -- --aix4*) -- if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then -- test "$enable_shared" = yes && enable_static=no -- fi -- ;; --esac --AC_MSG_RESULT([$enable_shared]) -- --AC_MSG_CHECKING([whether to build static libraries]) --# Make sure either enable_shared or enable_static is yes. --test "$enable_shared" = yes || enable_static=yes --AC_MSG_RESULT([$enable_static]) -- --if test "$hardcode_action" = relink; then -- # Fast installation is not supported -- enable_fast_install=no --elif test "$shlibpath_overrides_runpath" = yes || -- test "$enable_shared" = no; then -- # Fast installation is not necessary -- enable_fast_install=needless --fi -- --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 -- --AC_LIBTOOL_DLOPEN_SELF -- --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. -- AC_MSG_CHECKING([whether -lc should be explicitly linked in]) -- AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], -- [$rm conftest* -- echo 'static int dummy;' > conftest.$ac_ext -- -- if AC_TRY_EVAL(ac_compile); then -- soname=conftest -- lib=conftest -- libobjs=conftest.$ac_objext -- deplibs= -- wl=$lt_cv_prog_cc_wl -- compiler_flags=-v -- linker_flags=-v -- verstring= -- output_objdir=. -- libname=conftest -- save_allow_undefined_flag=$allow_undefined_flag -- allow_undefined_flag= -- if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) -- then -- lt_cv_archive_cmds_need_lc=no -- else -- lt_cv_archive_cmds_need_lc=yes -- fi -- allow_undefined_flag=$save_allow_undefined_flag -- else -- cat conftest.err 1>&5 -- fi]) -- AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) -- ;; -- esac --fi --need_lc=${lt_cv_archive_cmds_need_lc-yes} -- --# The second clause should only fire when bootstrapping the --# libtool distribution, otherwise you forgot to ship ltmain.sh --# with your package, and you will get complaints that there are --# no rules to generate ltmain.sh. --if test -f "$ltmain"; then -- : --else -- # If there is no Makefile yet, we rely on a make rule to execute -- # `config.status --recheck' to rerun these tests and create the -- # libtool script then. -- test -f Makefile && make "$ltmain" --fi -- --if test -f "$ltmain"; then -- trap "$rm \"${ofile}T\"; exit 1" 1 2 15 -- $rm -f "${ofile}T" -- -- echo creating $ofile -- -- # Now quote all the things that may contain metacharacters while being -- # careful not to overquote the AC_SUBSTed values. We take copies of the -- # variables and quote the copies for generation of the libtool script. -- for var in echo old_CC old_CFLAGS \ -- AR AR_FLAGS CC LD LN_S NM SHELL \ -- reload_flag reload_cmds wl \ -- pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ -- thread_safe_flag_spec whole_archive_flag_spec libname_spec \ -- library_names_spec soname_spec \ -- RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ -- old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ -- postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ -- old_striplib striplib file_magic_cmd export_symbols_cmds \ -- deplibs_check_method allow_undefined_flag no_undefined_flag \ -- finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ -- global_symbol_to_c_name_address \ -- hardcode_libdir_flag_spec hardcode_libdir_separator \ -- sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -- compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do -- -- case $var in -- reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ -- old_postinstall_cmds | old_postuninstall_cmds | \ -- export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ -- extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ -- postinstall_cmds | postuninstall_cmds | \ -- finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) -- # Double-quote double-evaled strings. -- eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" -- ;; -- *) -- eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -- ;; -- esac -- done -- -- cat <<__EOF__ > "${ofile}T" --#! $SHELL -- --# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. --# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) --# NOTE: Changes made to this file will be lost: look at ltmain.sh. --# --# Copyright (C) 1996-2000 Free Software Foundation, Inc. --# Originally by Gordon Matzigkeit , 1996 --# --# This program is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or --# (at your option) any later version. --# --# This program is distributed in the hope that it will be useful, but --# WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --# General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --# --# As a special exception to the GNU General Public License, if you --# distribute this file as part of a program that contains a --# configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. -- --# Sed that helps us avoid accidentally triggering echo(1) options like -n. --Xsed="sed -e s/^X//" -- --# The HP-UX ksh and POSIX shell print the target directory to stdout --# if CDPATH is set. --if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -- --# ### BEGIN LIBTOOL CONFIG -- --# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -- --# Shell to use when invoking shell scripts. --SHELL=$lt_SHELL -- --# Whether or not to build shared libraries. --build_libtool_libs=$enable_shared -- --# Whether or not to build static libraries. --build_old_libs=$enable_static -- --# Whether or not to add -lc for building shared libraries. --build_libtool_need_lc=$need_lc -- --# Whether or not to optimize for fast installation. --fast_install=$enable_fast_install -- --# The host system. --host_alias=$host_alias --host=$host -- --# An echo program that does not interpret backslashes. --echo=$lt_echo -- --# The archiver. --AR=$lt_AR --AR_FLAGS=$lt_AR_FLAGS -- --# The default C compiler. --CC=$lt_CC -- --# Is the compiler the GNU C compiler? --with_gcc=$GCC -- --# The linker used to build libraries. --LD=$lt_LD -- --# Whether we need hard or soft links. --LN_S=$lt_LN_S -- --# A BSD-compatible nm program. --NM=$lt_NM -- --# A symbol stripping program --STRIP=$STRIP -- --# Used to examine libraries when file_magic_cmd begins "file" --MAGIC_CMD=$MAGIC_CMD -- --# Used on cygwin: DLL creation program. --DLLTOOL="$DLLTOOL" -- --# Used on cygwin: object dumper. --OBJDUMP="$OBJDUMP" -- --# Used on cygwin: assembler. --AS="$AS" -- --# The name of the directory that contains temporary libtool files. --objdir=$objdir -- --# How to create reloadable object files. --reload_flag=$lt_reload_flag --reload_cmds=$lt_reload_cmds -- --# How to pass a linker flag through the compiler. --wl=$lt_wl -- --# Object file suffix (normally "o"). --objext="$ac_objext" -- --# Old archive suffix (normally "a"). --libext="$libext" -- --# Executable file suffix (normally ""). --exeext="$exeext" -- --# Additional compiler flags for building library objects. --pic_flag=$lt_pic_flag --pic_mode=$pic_mode -- --# Does compiler simultaneously support -c and -o options? --compiler_c_o=$lt_compiler_c_o -- --# Can we write directly to a .lo ? --compiler_o_lo=$lt_compiler_o_lo -- --# Must we lock files when doing compilation ? --need_locks=$lt_need_locks -- --# Do we need the lib prefix for modules? --need_lib_prefix=$need_lib_prefix -- --# Do we need a version for libraries? --need_version=$need_version -- --# Whether dlopen is supported. --dlopen_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 -- --# Compiler flag to prevent dynamic linking. --link_static_flag=$lt_link_static_flag -- --# Compiler flag to turn off builtin functions. --no_builtin_flag=$lt_no_builtin_flag -- --# 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 -- --# Compiler flag to generate thread-safe objects. --thread_safe_flag_spec=$lt_thread_safe_flag_spec -- --# Library versioning type. --version_type=$version_type -- --# 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 -- --# Commands used to build and install an old-style archive. --RANLIB=$lt_RANLIB --old_archive_cmds=$lt_old_archive_cmds --old_postinstall_cmds=$lt_old_postinstall_cmds --old_postuninstall_cmds=$lt_old_postuninstall_cmds -- --# 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 and install a shared archive. --archive_cmds=$lt_archive_cmds --archive_expsym_cmds=$lt_archive_expsym_cmds --postinstall_cmds=$lt_postinstall_cmds --postuninstall_cmds=$lt_postuninstall_cmds -- --# Commands to strip libraries. --old_striplib=$lt_old_striplib --striplib=$lt_striplib -- --# 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 -- --# Flag that allows shared libraries with undefined symbols to be built. --allow_undefined_flag=$lt_allow_undefined_flag -- --# Flag that forces no undefined symbols. --no_undefined_flag=$lt_no_undefined_flag -- --# Commands used to finish a libtool library installation in a directory. --finish_cmds=$lt_finish_cmds -- --# Same as above, but a single script fragment to be evaled but not shown. --finish_eval=$lt_finish_eval -- --# Take the output of nm and produce a listing of raw symbols and C names. --global_symbol_pipe=$lt_global_symbol_pipe -- --# Transform the output of nm in a proper C declaration --global_symbol_to_cdecl=$lt_global_symbol_to_cdecl -- --# Transform the output of nm in a C name address pair --global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address -- --# This is the shared library runtime path variable. --runpath_var=$runpath_var -- --# This is the shared library path variable. --shlibpath_var=$shlibpath_var -- --# Is shlibpath searched before the hard-coded library search path? --shlibpath_overrides_runpath=$shlibpath_overrides_runpath -- --# How to hardcode a shared library path into an executable. --hardcode_action=$hardcode_action -- --# Whether we should hardcode library paths into libraries. --hardcode_into_libs=$hardcode_into_libs -- --# 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 -- --# 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.so during linking hardcodes DIR into the --# resulting binary. --hardcode_direct=$hardcode_direct -- --# Set to yes if using the -LDIR flag during linking hardcodes DIR into the --# resulting binary. --hardcode_minus_L=$hardcode_minus_L -- --# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into --# the resulting binary. --hardcode_shlibpath_var=$hardcode_shlibpath_var -- --# Variables whose values should be saved in libtool wrapper scripts and --# restored at relink time. --variables_saved_for_relink="$variables_saved_for_relink" -- --# Whether libtool must link a program against all its dependency libraries. --link_all_deplibs=$link_all_deplibs -- --# 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 -- --# Fix the shell variable \$srcfile for the compiler. --fix_srcfile_path="$fix_srcfile_path" -- --# Set to yes if exported symbols are required. --always_export_symbols=$always_export_symbols -- --# The commands to list exported symbols. --export_symbols_cmds=$lt_export_symbols_cmds -- --# The commands to extract the exported symbol list from a shared archive. --extract_expsyms_cmds=$lt_extract_expsyms_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 -- --# ### END LIBTOOL CONFIG -- --__EOF__ -- -- case $host_os in -- aix3*) -- cat <<\EOF >> "${ofile}T" -- --# AIX sometimes has problems with the GCC collect2 program. For some --# reason, if we set the COLLECT_NAMES environment variable, the problems --# vanish in a puff of smoke. --if test "X${COLLECT_NAMES+set}" != Xset; then -- COLLECT_NAMES= -- export COLLECT_NAMES --fi --EOF -- ;; -- esac -- -- case $host_os in -- cygwin* | mingw* | pw32* | os2*) -- cat <<'EOF' >> "${ofile}T" -- # This is a source program that is used to create dlls on Windows -- # Don't remove nor modify the starting and closing comments --# /* ltdll.c starts here */ --# #define WIN32_LEAN_AND_MEAN --# #include --# #undef WIN32_LEAN_AND_MEAN --# #include --# --# #ifndef __CYGWIN__ --# # ifdef __CYGWIN32__ --# # define __CYGWIN__ __CYGWIN32__ --# # endif --# #endif --# --# #ifdef __cplusplus --# extern "C" { --# #endif --# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); --# #ifdef __cplusplus --# } --# #endif --# --# #ifdef __CYGWIN__ --# #include --# DECLARE_CYGWIN_DLL( DllMain ); --# #endif --# HINSTANCE __hDllInstance_base; --# --# BOOL APIENTRY --# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) --# { --# __hDllInstance_base = hInst; --# return TRUE; --# } --# /* ltdll.c ends here */ -- # This is a source program that is used to create import libraries -- # on Windows for dlls which lack them. Don't remove nor modify the -- # starting and closing comments --# /* impgen.c starts here */ --# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. --# --# This file is part of GNU libtool. --# --# This program is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or --# (at your option) any later version. --# --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --# */ --# --# #include /* for printf() */ --# #include /* for open(), lseek(), read() */ --# #include /* for O_RDONLY, O_BINARY */ --# #include /* for strdup() */ --# --# /* O_BINARY isn't required (or even defined sometimes) under Unix */ --# #ifndef O_BINARY --# #define O_BINARY 0 --# #endif --# --# static unsigned int --# pe_get16 (fd, offset) --# int fd; --# int offset; --# { --# unsigned char b[2]; --# lseek (fd, offset, SEEK_SET); --# read (fd, b, 2); --# return b[0] + (b[1]<<8); --# } --# --# static unsigned int --# pe_get32 (fd, offset) --# int fd; --# int offset; --# { --# unsigned char b[4]; --# lseek (fd, offset, SEEK_SET); --# read (fd, b, 4); --# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); --# } --# --# static unsigned int --# pe_as32 (ptr) --# void *ptr; --# { --# unsigned char *b = ptr; --# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); --# } --# --# int --# main (argc, argv) --# int argc; --# char *argv[]; --# { --# int dll; --# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; --# unsigned long export_rva, export_size, nsections, secptr, expptr; --# unsigned long name_rvas, nexp; --# unsigned char *expdata, *erva; --# char *filename, *dll_name; --# --# filename = argv[1]; --# --# dll = open(filename, O_RDONLY|O_BINARY); --# if (dll < 1) --# return 1; --# --# dll_name = filename; --# --# for (i=0; filename[i]; i++) --# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') --# dll_name = filename + i +1; --# --# pe_header_offset = pe_get32 (dll, 0x3c); --# opthdr_ofs = pe_header_offset + 4 + 20; --# num_entries = pe_get32 (dll, opthdr_ofs + 92); --# --# if (num_entries < 1) /* no exports */ --# return 1; --# --# export_rva = pe_get32 (dll, opthdr_ofs + 96); --# export_size = pe_get32 (dll, opthdr_ofs + 100); --# nsections = pe_get16 (dll, pe_header_offset + 4 +2); --# secptr = (pe_header_offset + 4 + 20 + --# pe_get16 (dll, pe_header_offset + 4 + 16)); --# --# expptr = 0; --# for (i = 0; i < nsections; i++) --# { --# char sname[8]; --# unsigned long secptr1 = secptr + 40 * i; --# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); --# unsigned long vsize = pe_get32 (dll, secptr1 + 16); --# unsigned long fptr = pe_get32 (dll, secptr1 + 20); --# lseek(dll, secptr1, SEEK_SET); --# read(dll, sname, 8); --# if (vaddr <= export_rva && vaddr+vsize > export_rva) --# { --# expptr = fptr + (export_rva - vaddr); --# if (export_rva + export_size > vaddr + vsize) --# export_size = vsize - (export_rva - vaddr); --# break; --# } --# } --# --# expdata = (unsigned char*)malloc(export_size); --# lseek (dll, expptr, SEEK_SET); --# read (dll, expdata, export_size); --# erva = expdata - export_rva; --# --# nexp = pe_as32 (expdata+24); --# name_rvas = pe_as32 (expdata+32); --# --# printf ("EXPORTS\n"); --# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) -- -- mv -f "${ofile}T" "$ofile" || \ -- (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") -- chmod +x "$ofile" --fi -- --])# _LT_AC_LTCONFIG_HACK -- --# AC_LIBTOOL_DLOPEN - enable checks for dlopen support --AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) -- --# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's --AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) -- --# AC_ENABLE_SHARED - implement the --enable-shared flag --# Usage: AC_ENABLE_SHARED[(DEFAULT)] --# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to --# `yes'. --AC_DEFUN([AC_ENABLE_SHARED], --[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl --AC_ARG_ENABLE(shared, --changequote(<<, >>)dnl --<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], --changequote([, ])dnl --[p=${PACKAGE-default} --case $enableval in --yes) enable_shared=yes ;; --no) enable_shared=no ;; --*) -- enable_shared=no -- # Look at the argument we got. We use all the common list separators. -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," -- for pkg in $enableval; do -- if test "X$pkg" = "X$p"; then -- enable_shared=yes -- fi -- done -- IFS="$ac_save_ifs" -- ;; --esac], --enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl --]) -- --# AC_DISABLE_SHARED - set the default shared flag to --disable-shared --AC_DEFUN([AC_DISABLE_SHARED], --[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl --AC_ENABLE_SHARED(no)]) -- --# AC_ENABLE_STATIC - implement the --enable-static flag --# Usage: AC_ENABLE_STATIC[(DEFAULT)] --# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to --# `yes'. --AC_DEFUN([AC_ENABLE_STATIC], --[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl --AC_ARG_ENABLE(static, --changequote(<<, >>)dnl --<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], --changequote([, ])dnl --[p=${PACKAGE-default} --case $enableval in --yes) enable_static=yes ;; --no) enable_static=no ;; --*) -- enable_static=no -- # Look at the argument we got. We use all the common list separators. -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," -- for pkg in $enableval; do -- if test "X$pkg" = "X$p"; then -- enable_static=yes -- fi -- done -- IFS="$ac_save_ifs" -- ;; --esac], --enable_static=AC_ENABLE_STATIC_DEFAULT)dnl --]) -- --# AC_DISABLE_STATIC - set the default static flag to --disable-static --AC_DEFUN([AC_DISABLE_STATIC], --[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl --AC_ENABLE_STATIC(no)]) -- -- --# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag --# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] --# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to --# `yes'. --AC_DEFUN([AC_ENABLE_FAST_INSTALL], --[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl --AC_ARG_ENABLE(fast-install, --changequote(<<, >>)dnl --<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], --changequote([, ])dnl --[p=${PACKAGE-default} --case $enableval in --yes) enable_fast_install=yes ;; --no) enable_fast_install=no ;; --*) -- enable_fast_install=no -- # Look at the argument we got. We use all the common list separators. -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," -- for pkg in $enableval; do -- if test "X$pkg" = "X$p"; then -- enable_fast_install=yes -- fi -- done -- IFS="$ac_save_ifs" -- ;; --esac], --enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl --]) -- --# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install --AC_DEFUN([AC_DISABLE_FAST_INSTALL], --[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl --AC_ENABLE_FAST_INSTALL(no)]) -- --# AC_LIBTOOL_PICMODE - implement the --with-pic flag --# Usage: AC_LIBTOOL_PICMODE[(MODE)] --# Where MODE is either `yes' or `no'. If omitted, it defaults to --# `both'. --AC_DEFUN([AC_LIBTOOL_PICMODE], --[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl --pic_mode=ifelse($#,1,$1,default)]) -- -- --# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library --AC_DEFUN([AC_PATH_TOOL_PREFIX], --[AC_MSG_CHECKING([for $1]) --AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, --[case $MAGIC_CMD in -- /*) -- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. -- ;; -- ?:/*) -- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. -- ;; -- *) -- ac_save_MAGIC_CMD="$MAGIC_CMD" -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" --dnl $ac_dummy forces splitting on constant user-supplied paths. --dnl POSIX.2 word splitting is done only on the output of word expansions, --dnl not every word. This closes a longstanding sh security hole. -- ac_dummy="ifelse([$2], , $PATH, [$2])" -- for ac_dir in $ac_dummy; do -- test -z "$ac_dir" && ac_dir=. -- if test -f $ac_dir/$1; then -- lt_cv_path_MAGIC_CMD="$ac_dir/$1" -- 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 <&2 -- --*** Warning: the command libtool uses to detect shared libraries, --*** $file_magic_cmd, produces output that libtool cannot recognize. --*** The result is that libtool may fail to recognize shared libraries --*** as such. This will affect the creation of libtool libraries that --*** depend on shared libraries, but programs linked with such libtool --*** libraries will work regardless of this problem. Nevertheless, you --*** may want to report the problem to your system manager and/or to --*** bug-libtool@gnu.org -- --EOF -- fi ;; -- esac -- fi -- break -- fi -- done -- IFS="$ac_save_ifs" -- MAGIC_CMD="$ac_save_MAGIC_CMD" -- ;; --esac]) --MAGIC_CMD="$lt_cv_path_MAGIC_CMD" --if test -n "$MAGIC_CMD"; then -- AC_MSG_RESULT($MAGIC_CMD) --else -- AC_MSG_RESULT(no) --fi --]) -- -- --# AC_PATH_MAGIC - find a file program which can recognise a shared library --AC_DEFUN([AC_PATH_MAGIC], --[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl --AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) --if test -z "$lt_cv_path_MAGIC_CMD"; then -- if test -n "$ac_tool_prefix"; then -- AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) -- else -- MAGIC_CMD=: -- fi --fi --]) -- -- --# AC_PROG_LD - find the path to the GNU or non-GNU linker --AC_DEFUN([AC_PROG_LD], --[AC_ARG_WITH(gnu-ld, --[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], --test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) --AC_REQUIRE([AC_PROG_CC])dnl --AC_REQUIRE([AC_CANONICAL_HOST])dnl --AC_REQUIRE([AC_CANONICAL_BUILD])dnl --AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl --ac_prog=ld --if test "$GCC" = yes; then -- # Check if gcc -print-prog-name=ld gives a path. -- AC_MSG_CHECKING([for ld used by GCC]) -- 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. -- [[\\/]]* | [[A-Za-z]]:[[\\/]]*) -- re_direlt='/[[^/]][[^/]]*/\.\./' -- # Canonicalize the path of ld -- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` -- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do -- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` -- done -- test -z "$LD" && LD="$ac_prog" -- ;; -- "") -- # If it fails, then pretend we aren't using GCC. -- ac_prog=ld -- ;; -- *) -- # If it is relative, then search for the first ld in PATH. -- with_gnu_ld=unknown -- ;; -- esac --elif test "$with_gnu_ld" = yes; then -- AC_MSG_CHECKING([for GNU ld]) --else -- AC_MSG_CHECKING([for non-GNU ld]) --fi --AC_CACHE_VAL(lt_cv_path_LD, --[if test -z "$LD"; then -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -- for ac_dir in $PATH; do -- test -z "$ac_dir" && ac_dir=. -- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then -- 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 GNU ld's only accept -v. -- # Break only if it was the GNU/non-GNU ld that we prefer. -- if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then -- test "$with_gnu_ld" != no && break -- else -- test "$with_gnu_ld" != yes && break -- fi -- fi -- done -- IFS="$ac_save_ifs" --else -- lt_cv_path_LD="$LD" # Let the user override the test with a path. --fi]) --LD="$lt_cv_path_LD" --if test -n "$LD"; then -- AC_MSG_RESULT($LD) --else -- AC_MSG_RESULT(no) --fi --test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) --AC_PROG_LD_GNU --]) -- --# AC_PROG_LD_GNU - --AC_DEFUN([AC_PROG_LD_GNU], --[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, --[# I'd rather use --version here, but apparently some GNU ld's only accept -v. --if $LD -v 2>&1 &5; then -- lt_cv_prog_gnu_ld=yes --else -- lt_cv_prog_gnu_ld=no --fi]) --with_gnu_ld=$lt_cv_prog_gnu_ld --]) -- --# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker --# -- PORTME Some linkers may need a different reload flag. --AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], --[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, --[lt_cv_ld_reload_flag='-r']) --reload_flag=$lt_cv_ld_reload_flag --test -n "$reload_flag" && reload_flag=" $reload_flag" --]) -- --# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies --# -- PORTME fill in with the dynamic library characteristics --AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], --[AC_CACHE_CHECK([how to recognise dependant libraries], --lt_cv_deplibs_check_method, --[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 egrep regex. --# If you have `file' or equivalent on your system and you're not sure --# whether `pass_all' will *always* work, you probably want this one. -- --case $host_os in --aix4* | aix5*) -- lt_cv_deplibs_check_method=pass_all -- ;; -- --beos*) -- lt_cv_deplibs_check_method=pass_all -- ;; -- --bsdi4*) -- 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* | mingw* | pw32*) -- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' -- lt_cv_file_magic_cmd='$OBJDUMP -f' -- ;; -- --darwin* | rhapsody*) -- lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' -- lt_cv_file_magic_cmd='/usr/bin/file -L' -- case "$host_os" in -- rhapsody* | darwin1.[[012]]) -- lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` -- ;; -- *) # Darwin 1.3 on -- lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' -- ;; -- esac -- ;; -- --freebsd*) -- 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)/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 -- ;; -- --hpux10.20*|hpux11*) -- 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_cmd=/usr/bin/file -- lt_cv_file_magic_test_file=/usr/lib/libc.sl -- ;; -- --irix5* | irix6*) -- case $host_os in -- irix5*) -- # this will be overridden with pass_all, but let us keep it just in case -- lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" -- ;; -- *) -- case $LD in -- *-32|*"-32 ") libmagic=32-bit;; -- *-n32|*"-n32 ") libmagic=N32;; -- *-64|*"-64 ") libmagic=64-bit;; -- *) libmagic=never-match;; -- esac -- # this will be overridden with pass_all, but let us keep it just in case -- lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" -- ;; -- esac -- lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` -- lt_cv_deplibs_check_method=pass_all -- ;; -- --# This must be Linux ELF. --linux-gnu*) -- case $host_cpu in -- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) -- lt_cv_deplibs_check_method=pass_all ;; -- *) -- # glibc up to 2.1.1 does not perform some relocations on ARM -- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; -- esac -- lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` -- ;; -- --netbsd*) -- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then -- lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' -- else -- lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' -- 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 -- ;; -- --openbsd*) -- lt_cv_file_magic_cmd=/usr/bin/file -- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` -- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then -- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' -- else -- lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' -- fi -- ;; -- --osf3* | osf4* | osf5*) -- # this will be overridden with pass_all, but let us keep it just in case -- lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' -- lt_cv_file_magic_test_file=/shlib/libc.so -- lt_cv_deplibs_check_method=pass_all -- ;; -- --sco3.2v5*) -- lt_cv_deplibs_check_method=pass_all -- ;; -- --solaris*) -- lt_cv_deplibs_check_method=pass_all -- lt_cv_file_magic_test_file=/lib/libc.so -- ;; -- --sysv5uw[[78]]* | sysv4*uw2*) -- lt_cv_deplibs_check_method=pass_all -- ;; -- --sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -- 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 -- ;; -- esac -- ;; --esac --]) --file_magic_cmd=$lt_cv_file_magic_cmd --deplibs_check_method=$lt_cv_deplibs_check_method --]) -- -- --# AC_PROG_NM - find the path to a BSD-compatible name lister --AC_DEFUN([AC_PROG_NM], --[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl --AC_MSG_CHECKING([for BSD-compatible nm]) --AC_CACHE_VAL(lt_cv_path_NM, --[if test -n "$NM"; then -- # Let the user override the test. -- lt_cv_path_NM="$NM" --else -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -- for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do -- test -z "$ac_dir" && ac_dir=. -- tmp_nm=$ac_dir/${ac_tool_prefix}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 -- if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then -- lt_cv_path_NM="$tmp_nm -B" -- break -- elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then -- lt_cv_path_NM="$tmp_nm -p" -- break -- else -- 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 -- fi -- fi -- done -- IFS="$ac_save_ifs" -- test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm --fi]) --NM="$lt_cv_path_NM" --AC_MSG_RESULT([$NM]) --]) -- --# AC_CHECK_LIBM - check for math library --AC_DEFUN([AC_CHECK_LIBM], --[AC_REQUIRE([AC_CANONICAL_HOST])dnl --LIBM= --case $host in --*-*-beos* | *-*-cygwin* | *-*-pw32*) -- # These system don't have libm -- ;; --*-ncr-sysv4.3*) -- AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") -- AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") -- ;; --*) -- AC_CHECK_LIB(m, main, LIBM="-lm") -- ;; --esac --]) -- --# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for --# the libltdl convenience library and INCLTDL to the include flags for --# the libltdl header and adds --enable-ltdl-convenience to the --# configure arguments. Note that LIBLTDL and INCLTDL are not --# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not --# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed --# with '${top_builddir}/' and INCLTDL will be prefixed with --# '${top_srcdir}/' (note the single quotes!). If your package is not --# flat and you're not using automake, define top_builddir and --# top_srcdir appropriately in the Makefiles. --AC_DEFUN([AC_LIBLTDL_CONVENIENCE], --[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -- case $enable_ltdl_convenience in -- no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; -- "") enable_ltdl_convenience=yes -- ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; -- esac -- LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la -- INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) --]) -- --# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for --# the libltdl installable library and INCLTDL to the include flags for --# the libltdl header and adds --enable-ltdl-install to the configure --# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is --# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed --# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will --# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed --# with '${top_srcdir}/' (note the single quotes!). If your package is --# not flat and you're not using automake, define top_builddir and --# top_srcdir appropriately in the Makefiles. --# In the future, this macro may have to be called after AC_PROG_LIBTOOL. --AC_DEFUN([AC_LIBLTDL_INSTALLABLE], --[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -- AC_CHECK_LIB(ltdl, main, -- [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], -- [if test x"$enable_ltdl_install" = xno; then -- AC_MSG_WARN([libltdl not installed, but installation disabled]) -- else -- enable_ltdl_install=yes -- fi -- ]) -- if test x"$enable_ltdl_install" = x"yes"; then -- ac_configure_args="$ac_configure_args --enable-ltdl-install" -- LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la -- INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -- else -- ac_configure_args="$ac_configure_args --enable-ltdl-install=no" -- LIBLTDL="-lltdl" -- INCLTDL= -- fi --]) -- --# old names --AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) --AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) --AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) --AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) --AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) --AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) --AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) -- --# This is just to silence aclocal about the macro not being used --ifelse([AC_DISABLE_FAST_INSTALL]) -- --# gettext.m4 serial 16 (gettext-0.11.4) --dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. --dnl --dnl This file can can be used in projects which are not available under --dnl the GNU General Public License or the GNU Library General Public --dnl License but which still want to provide support for the GNU gettext --dnl functionality. --dnl Please note that the actual code of the GNU gettext library is covered --dnl by the GNU Library General Public License, and the rest of the GNU --dnl gettext package package is covered by the GNU General Public License. --dnl They are *not* in the public domain. -- --dnl Authors: --dnl Ulrich Drepper , 1995-2000. --dnl Bruno Haible , 2000-2002. -- --dnl Macro to add for using GNU gettext. -- --dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). --dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The --dnl default (if it is not specified or empty) is 'no-libtool'. --dnl INTLSYMBOL should be 'external' for packages with no intl directory, --dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. --dnl If INTLSYMBOL is 'use-libtool', then a libtool library --dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, --dnl depending on --{enable,disable}-{shared,static} and on the presence of --dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library --dnl $(top_builddir)/intl/libintl.a will be created. --dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext --dnl implementations (in libc or libintl) without the ngettext() function --dnl will be ignored. If NEEDSYMBOL is specified and is --dnl 'need-formatstring-macros', then GNU gettext implementations that don't --dnl support the ISO C 99 formatstring macros will be ignored. --dnl INTLDIR is used to find the intl libraries. If empty, --dnl the value `$(top_builddir)/intl/' is used. --dnl --dnl The result of the configuration is one of three cases: --dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled --dnl and used. --dnl Catalog format: GNU --> install in $(datadir) --dnl Catalog extension: .mo after installation, .gmo in source tree --dnl 2) GNU gettext has been found in the system's C library. --dnl Catalog format: GNU --> install in $(datadir) --dnl Catalog extension: .mo after installation, .gmo in source tree --dnl 3) No internationalization, always use English msgid. --dnl Catalog format: none --dnl Catalog extension: none --dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. --dnl The use of .gmo is historical (it was needed to avoid overwriting the --dnl GNU format catalogs when building on a platform with an X/Open gettext), --dnl but we keep it in order not to force irrelevant filename changes on the --dnl maintainers. --dnl --AC_DEFUN([AM_GNU_GETTEXT], --[ -- dnl Argument checking. -- ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , -- [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT --])])])])]) -- ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , -- [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT --])])])]) -- define(gt_included_intl, ifelse([$1], [external], [no], [yes])) -- define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) -- -- AC_REQUIRE([AM_PO_SUBDIRS])dnl -- ifelse(gt_included_intl, yes, [ -- AC_REQUIRE([AM_INTL_SUBDIR])dnl -- ]) -- -- dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. -- AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -- AC_REQUIRE([AC_LIB_RPATH]) -- -- dnl Sometimes libintl requires libiconv, so first search for libiconv. -- dnl Ideally we would do this search only after the -- dnl if test "$USE_NLS" = "yes"; then -- dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then -- dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT -- dnl the configure script would need to contain the same shell code -- dnl again, outside any 'if'. There are two solutions: -- dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. -- dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. -- dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not -- dnl documented, we avoid it. -- ifelse(gt_included_intl, yes, , [ -- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) -- ]) -- -- AC_MSG_CHECKING([whether NLS is requested]) -- dnl Default is enabled NLS -- AC_ARG_ENABLE(nls, -- [ --disable-nls do not use Native Language Support], -- USE_NLS=$enableval, USE_NLS=yes) -- AC_MSG_RESULT($USE_NLS) -- AC_SUBST(USE_NLS) -- -- ifelse(gt_included_intl, yes, [ -- BUILD_INCLUDED_LIBINTL=no -- USE_INCLUDED_LIBINTL=no -- ]) -- LIBINTL= -- LTLIBINTL= -- POSUB= -- -- dnl If we use NLS figure out what method -- if test "$USE_NLS" = "yes"; then -- gt_use_preinstalled_gnugettext=no -- ifelse(gt_included_intl, yes, [ -- AC_MSG_CHECKING([whether included gettext is requested]) -- AC_ARG_WITH(included-gettext, -- [ --with-included-gettext use the GNU gettext library included here], -- nls_cv_force_use_gnu_gettext=$withval, -- nls_cv_force_use_gnu_gettext=no) -- AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) -- -- nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" -- if test "$nls_cv_force_use_gnu_gettext" != "yes"; then -- ]) -- dnl User does not insist on using GNU NLS library. Figure out what -- dnl to use. If GNU gettext is available we use this. Else we have -- dnl to fall back to GNU NLS library. -- -- dnl Add a version number to the cache macros. -- define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) -- define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) -- define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) -- -- AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, -- [AC_TRY_LINK([#include --]ifelse([$2], [need-formatstring-macros], --[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION --#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) --#endif --changequote(,)dnl --typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; --changequote([,])dnl --], [])[extern int _nl_msg_cat_cntr; --extern int *_nl_domain_bindings;], -- [bindtextdomain ("", ""); --return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], -- gt_cv_func_gnugettext_libc=yes, -- gt_cv_func_gnugettext_libc=no)]) -- -- if test "$gt_cv_func_gnugettext_libc" != "yes"; then -- dnl Sometimes libintl requires libiconv, so first search for libiconv. -- ifelse(gt_included_intl, yes, , [ -- AM_ICONV_LINK -- ]) -- dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL -- dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) -- dnl because that would add "-liconv" to LIBINTL and LTLIBINTL -- dnl even if libiconv doesn't exist. -- AC_LIB_LINKFLAGS_BODY([intl]) -- AC_CACHE_CHECK([for GNU gettext in libintl], -- gt_cv_func_gnugettext_libintl, -- [gt_save_CPPFLAGS="$CPPFLAGS" -- CPPFLAGS="$CPPFLAGS $INCINTL" -- gt_save_LIBS="$LIBS" -- LIBS="$LIBS $LIBINTL" -- dnl Now see whether libintl exists and does not depend on libiconv. -- AC_TRY_LINK([#include --]ifelse([$2], [need-formatstring-macros], --[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION --#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) --#endif --changequote(,)dnl --typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; --changequote([,])dnl --], [])[extern int _nl_msg_cat_cntr; --extern --#ifdef __cplusplus --"C" --#endif --const char *_nl_expand_alias ();], -- [bindtextdomain ("", ""); --return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], -- gt_cv_func_gnugettext_libintl=yes, -- gt_cv_func_gnugettext_libintl=no) -- dnl Now see whether libintl exists and depends on libiconv. -- if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then -- LIBS="$LIBS $LIBICONV" -- AC_TRY_LINK([#include --]ifelse([$2], [need-formatstring-macros], --[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION --#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) --#endif --changequote(,)dnl --typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; --changequote([,])dnl --], [])[extern int _nl_msg_cat_cntr; --extern --#ifdef __cplusplus --"C" --#endif --const char *_nl_expand_alias ();], -- [bindtextdomain ("", ""); --return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], -- [LIBINTL="$LIBINTL $LIBICONV" -- LTLIBINTL="$LTLIBINTL $LTLIBICONV" -- gt_cv_func_gnugettext_libintl=yes -- ]) -- fi -- CPPFLAGS="$gt_save_CPPFLAGS" -- LIBS="$gt_save_LIBS"]) -- fi -- -- dnl If an already present or preinstalled GNU gettext() is found, -- dnl use it. But if this macro is used in GNU gettext, and GNU -- dnl gettext is already preinstalled in libintl, we update this -- dnl libintl. (Cf. the install rule in intl/Makefile.in.) -- if test "$gt_cv_func_gnugettext_libc" = "yes" \ -- || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ -- && test "$PACKAGE" != gettext; }; then -- gt_use_preinstalled_gnugettext=yes -- else -- dnl Reset the values set by searching for libintl. -- LIBINTL= -- LTLIBINTL= -- INCINTL= -- fi -- -- ifelse(gt_included_intl, yes, [ -- if test "$gt_use_preinstalled_gnugettext" != "yes"; then -- dnl GNU gettext is not found in the C library. -- dnl Fall back on included GNU gettext library. -- nls_cv_use_gnu_gettext=yes -- fi -- fi -- -- if test "$nls_cv_use_gnu_gettext" = "yes"; then -- dnl Mark actions used to generate GNU NLS library. -- INTLOBJS="\$(GETTOBJS)" -- BUILD_INCLUDED_LIBINTL=yes -- USE_INCLUDED_LIBINTL=yes -- LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" -- LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" -- LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` -- fi -- -- if test "$gt_use_preinstalled_gnugettext" = "yes" \ -- || test "$nls_cv_use_gnu_gettext" = "yes"; then -- dnl Mark actions to use GNU gettext tools. -- CATOBJEXT=.gmo -- fi -- ]) -- -- if test "$gt_use_preinstalled_gnugettext" = "yes" \ -- || test "$nls_cv_use_gnu_gettext" = "yes"; then -- AC_DEFINE(ENABLE_NLS, 1, -- [Define to 1 if translation of program messages to the user's native language -- is requested.]) -- else -- USE_NLS=no -- fi -- fi -- -- if test "$USE_NLS" = "yes"; then -- -- if test "$gt_use_preinstalled_gnugettext" = "yes"; then -- if test "$gt_cv_func_gnugettext_libintl" = "yes"; then -- AC_MSG_CHECKING([how to link with libintl]) -- AC_MSG_RESULT([$LIBINTL]) -- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) -- fi -- -- dnl For backward compatibility. Some packages may be using this. -- AC_DEFINE(HAVE_GETTEXT, 1, -- [Define if the GNU gettext() function is already present or preinstalled.]) -- AC_DEFINE(HAVE_DCGETTEXT, 1, -- [Define if the GNU dcgettext() function is already present or preinstalled.]) -- fi -- -- dnl We need to process the po/ directory. -- POSUB=po -- fi -- -- ifelse(gt_included_intl, yes, [ -- dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL -- dnl to 'yes' because some of the testsuite requires it. -- if test "$PACKAGE" = gettext; then -- BUILD_INCLUDED_LIBINTL=yes -- fi -- -- dnl Make all variables we use known to autoconf. -- AC_SUBST(BUILD_INCLUDED_LIBINTL) -- AC_SUBST(USE_INCLUDED_LIBINTL) -- AC_SUBST(CATOBJEXT) -- AC_SUBST(INTLOBJS) -- -- dnl For backward compatibility. Some configure.ins may be using this. -- nls_cv_header_intl= -- nls_cv_header_libgt= -- -- dnl For backward compatibility. Some Makefiles may be using this. -- DATADIRNAME=share -- AC_SUBST(DATADIRNAME) -- -- dnl For backward compatibility. Some Makefiles may be using this. -- INSTOBJEXT=.mo -- AC_SUBST(INSTOBJEXT) -- -- dnl For backward compatibility. Some Makefiles may be using this. -- GENCAT=gencat -- AC_SUBST(GENCAT) -- -- dnl Enable libtool support if the surrounding package wishes it. -- INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix -- AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) -- ]) -- -- dnl For backward compatibility. Some Makefiles may be using this. -- INTLLIBS="$LIBINTL" -- AC_SUBST(INTLLIBS) -- -- dnl Make all documented variables known to autoconf. -- AC_SUBST(LIBINTL) -- AC_SUBST(LTLIBINTL) -- AC_SUBST(POSUB) --]) -- -- --dnl Checks for all prerequisites of the po subdirectory, --dnl except for USE_NLS. --AC_DEFUN([AM_PO_SUBDIRS], --[ -- AC_REQUIRE([AC_PROG_MAKE_SET])dnl -- AC_REQUIRE([AC_PROG_INSTALL])dnl -- AC_REQUIRE([AM_MKINSTALLDIRS])dnl -- -- dnl Perform the following tests also if --disable-nls has been given, -- dnl because they are needed for "make dist" to work. -- -- dnl Search for GNU msgfmt in the PATH. -- dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. -- dnl The second test excludes FreeBSD msgfmt. -- AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, -- [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && -- (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], -- :) -- AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) -- -- dnl Search for GNU xgettext 0.11 or newer in the PATH. -- dnl The first test excludes Solaris xgettext and early GNU xgettext versions. -- dnl The second test excludes FreeBSD xgettext. -- AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, -- [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && -- (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], -- :) -- dnl Remove leftover from FreeBSD xgettext call. -- rm -f messages.po -- -- dnl Search for GNU msgmerge 0.11 or newer in the PATH. -- AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, -- [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) -- -- dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. -- dnl Test whether we really found GNU msgfmt. -- if test "$GMSGFMT" != ":"; then -- dnl If it is no GNU msgfmt we define it as : so that the -- dnl Makefiles still can work. -- if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && -- (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -- : ; -- else -- GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` -- AC_MSG_RESULT( -- [found $GMSGFMT program is not GNU msgfmt; ignore it]) -- GMSGFMT=":" -- fi -- fi -- -- dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. -- dnl Test whether we really found GNU xgettext. -- if test "$XGETTEXT" != ":"; then -- dnl If it is no GNU xgettext we define it as : so that the -- dnl Makefiles still can work. -- if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && -- (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -- : ; -- else -- AC_MSG_RESULT( -- [found xgettext program is not GNU xgettext; ignore it]) -- XGETTEXT=":" -- fi -- dnl Remove leftover from FreeBSD xgettext call. -- rm -f messages.po -- fi -- -- AC_OUTPUT_COMMANDS([ -- for ac_file in $CONFIG_FILES; do -- # Support "outfile[:infile[:infile...]]" -- case "$ac_file" in -- *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; -- esac -- # PO directories have a Makefile.in generated from Makefile.in.in. -- case "$ac_file" in */Makefile.in) -- # Adjust a relative srcdir. -- ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` -- ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" -- ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` -- # In autoconf-2.13 it is called $ac_given_srcdir. -- # In autoconf-2.50 it is called $srcdir. -- test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" -- case "$ac_given_srcdir" in -- .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; -- /*) top_srcdir="$ac_given_srcdir" ;; -- *) top_srcdir="$ac_dots$ac_given_srcdir" ;; -- esac -- if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then -- rm -f "$ac_dir/POTFILES" -- test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" -- cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" -- # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend -- # on $ac_dir but don't depend on user-specified configuration -- # parameters. -- if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then -- # The LINGUAS file contains the set of available languages. -- if test -n "$ALL_LINGUAS"; then -- test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" -- fi -- ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` -- # Hide the ALL_LINGUAS assigment from automake. -- eval 'ALL_LINGUAS''=$ALL_LINGUAS_' -- fi -- case "$ac_given_srcdir" in -- .) srcdirpre= ;; -- *) srcdirpre='$(srcdir)/' ;; -- esac -- POFILES= -- GMOFILES= -- UPDATEPOFILES= -- DUMMYPOFILES= -- for lang in $ALL_LINGUAS; do -- POFILES="$POFILES $srcdirpre$lang.po" -- GMOFILES="$GMOFILES $srcdirpre$lang.gmo" -- UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" -- DUMMYPOFILES="$DUMMYPOFILES $lang.nop" -- done -- # CATALOGS depends on both $ac_dir and the user's LINGUAS -- # environment variable. -- INST_LINGUAS= -- if test -n "$ALL_LINGUAS"; then -- for presentlang in $ALL_LINGUAS; do -- useit=no -- if test "%UNSET%" != "$LINGUAS"; then -- desiredlanguages="$LINGUAS" -- else -- desiredlanguages="$ALL_LINGUAS" -- fi -- for desiredlang in $desiredlanguages; do -- # Use the presentlang catalog if desiredlang is -- # a. equal to presentlang, or -- # b. a variant of presentlang (because in this case, -- # presentlang can be used as a fallback for messages -- # which are not translated in the desiredlang catalog). -- case "$desiredlang" in -- "$presentlang"*) useit=yes;; -- esac -- done -- if test $useit = yes; then -- INST_LINGUAS="$INST_LINGUAS $presentlang" -- fi -- done -- fi -- CATALOGS= -- if test -n "$INST_LINGUAS"; then -- for lang in $INST_LINGUAS; do -- CATALOGS="$CATALOGS $lang.gmo" -- done -- fi -- test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" -- sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" -- for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do -- if test -f "$f"; then -- case "$f" in -- *.orig | *.bak | *~) ;; -- *) cat "$f" >> "$ac_dir/Makefile" ;; -- esac -- fi -- done -- fi -- ;; -- esac -- done], -- [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute -- # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it -- # from automake. -- eval 'ALL_LINGUAS''="$ALL_LINGUAS"' -- # Capture the value of LINGUAS because we need it to compute CATALOGS. -- LINGUAS="${LINGUAS-%UNSET%}" -- ]) --]) -- -- --dnl Checks for all prerequisites of the intl subdirectory, --dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, --dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. --AC_DEFUN([AM_INTL_SUBDIR], --[ -- AC_REQUIRE([AC_PROG_INSTALL])dnl -- AC_REQUIRE([AM_MKINSTALLDIRS])dnl -- AC_REQUIRE([AC_PROG_CC])dnl -- AC_REQUIRE([AC_CANONICAL_HOST])dnl -- AC_REQUIRE([AC_PROG_RANLIB])dnl -- AC_REQUIRE([AC_ISC_POSIX])dnl -- AC_REQUIRE([AC_HEADER_STDC])dnl -- AC_REQUIRE([AC_C_CONST])dnl -- AC_REQUIRE([AC_C_INLINE])dnl -- AC_REQUIRE([AC_TYPE_OFF_T])dnl -- AC_REQUIRE([AC_TYPE_SIZE_T])dnl -- AC_REQUIRE([AC_FUNC_ALLOCA])dnl -- AC_REQUIRE([AC_FUNC_MMAP])dnl -- AC_REQUIRE([jm_GLIBC21])dnl -- AC_REQUIRE([gt_INTDIV0])dnl -- AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl -- AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl -- AC_REQUIRE([gt_INTTYPES_PRI])dnl -- -- AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ --stdlib.h string.h unistd.h sys/param.h]) -- AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ --geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ --strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) -- -- AM_ICONV -- AM_LANGINFO_CODESET -- if test $ac_cv_header_locale_h = yes; then -- AM_LC_MESSAGES -- fi -- -- dnl intl/plural.c is generated from intl/plural.y. It requires bison, -- dnl because plural.y uses bison specific features. It requires at least -- dnl bison-1.26 because earlier versions generate a plural.c that doesn't -- dnl compile. -- dnl bison is only needed for the maintainer (who touches plural.y). But in -- dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put -- dnl the rule in general Makefile. Now, some people carelessly touch the -- dnl files or have a broken "make" program, hence the plural.c rule will -- dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not -- dnl present or too old. -- AC_CHECK_PROGS([INTLBISON], [bison]) -- if test -z "$INTLBISON"; then -- ac_verc_fail=yes -- else -- dnl Found it, now check the version. -- AC_MSG_CHECKING([version of bison]) --changequote(<<,>>)dnl -- ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -- case $ac_prog_version in -- '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; -- 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) --changequote([,])dnl -- ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; -- *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; -- esac -- AC_MSG_RESULT([$ac_prog_version]) -- fi -- if test $ac_verc_fail = yes; then -- INTLBISON=: -- fi --]) -- -- --AC_DEFUN([AM_MKINSTALLDIRS], --[ -- dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly -- dnl find the mkinstalldirs script in another subdir but $(top_srcdir). -- dnl Try to locate is. -- MKINSTALLDIRS= -- if test -n "$ac_aux_dir"; then -- MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" -- fi -- if test -z "$MKINSTALLDIRS"; then -- MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" -- fi -- AC_SUBST(MKINSTALLDIRS) --]) -- -- --dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) --AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) -- --# lib-prefix.m4 serial 1 (gettext-0.11) --dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -- --dnl From Bruno Haible. -- --dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed --dnl to access previously installed libraries. The basic assumption is that --dnl a user will want packages to use other packages he previously installed --dnl with the same --prefix option. --dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate --dnl libraries, but is otherwise very convenient. --AC_DEFUN([AC_LIB_PREFIX], --[ -- AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) -- AC_REQUIRE([AC_PROG_CC]) -- AC_REQUIRE([AC_CANONICAL_HOST]) -- AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -- dnl By default, look in $includedir and $libdir. -- use_additional=yes -- AC_LIB_WITH_FINAL_PREFIX([ -- eval additional_includedir=\"$includedir\" -- eval additional_libdir=\"$libdir\" -- ]) -- AC_ARG_WITH([lib-prefix], --[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib -- --without-lib-prefix don't search for libraries in includedir and libdir], --[ -- if test "X$withval" = "Xno"; then -- use_additional=no -- else -- if test "X$withval" = "X"; then -- AC_LIB_WITH_FINAL_PREFIX([ -- eval additional_includedir=\"$includedir\" -- eval additional_libdir=\"$libdir\" -- ]) -- else -- additional_includedir="$withval/include" -- additional_libdir="$withval/lib" -- fi -- fi --]) -- if test $use_additional = yes; then -- dnl Potentially add $additional_includedir to $CPPFLAGS. -- dnl But don't add it -- dnl 1. if it's the standard /usr/include, -- dnl 2. if it's already present in $CPPFLAGS, -- dnl 3. if it's /usr/local/include and we are using GCC on Linux, -- dnl 4. if it doesn't exist as a directory. -- if test "X$additional_includedir" != "X/usr/include"; then -- haveit= -- for x in $CPPFLAGS; do -- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) -- if test "X$x" = "X-I$additional_includedir"; then -- haveit=yes -- break -- fi -- done -- if test -z "$haveit"; then -- if test "X$additional_includedir" = "X/usr/local/include"; then -- if test -n "$GCC"; then -- case $host_os in -- linux*) haveit=yes;; -- esac -- fi -- fi -- if test -z "$haveit"; then -- if test -d "$additional_includedir"; then -- dnl Really add $additional_includedir to $CPPFLAGS. -- CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" -- fi -- fi -- fi -- fi -- dnl Potentially add $additional_libdir to $LDFLAGS. -- dnl But don't add it -- dnl 1. if it's the standard /usr/lib, -- dnl 2. if it's already present in $LDFLAGS, -- dnl 3. if it's /usr/local/lib and we are using GCC on Linux, -- dnl 4. if it doesn't exist as a directory. -- if test "X$additional_libdir" != "X/usr/lib"; then -- haveit= -- for x in $LDFLAGS; do -- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) -- if test "X$x" = "X-L$additional_libdir"; then -- haveit=yes -- break -- fi -- done -- if test -z "$haveit"; then -- if test "X$additional_libdir" = "X/usr/local/lib"; then -- if test -n "$GCC"; then -- case $host_os in -- linux*) haveit=yes;; -- esac -- fi -- fi -- if test -z "$haveit"; then -- if test -d "$additional_libdir"; then -- dnl Really add $additional_libdir to $LDFLAGS. -- LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" -- fi -- fi -- fi -- fi -- fi --]) -- --dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, --dnl acl_final_exec_prefix, containing the values to which $prefix and --dnl $exec_prefix will expand at the end of the configure script. --AC_DEFUN([AC_LIB_PREPARE_PREFIX], --[ -- dnl Unfortunately, prefix and exec_prefix get only finally determined -- dnl at the end of configure. -- if test "X$prefix" = "XNONE"; then -- acl_final_prefix="$ac_default_prefix" -- else -- acl_final_prefix="$prefix" -- fi -- if test "X$exec_prefix" = "XNONE"; then -- acl_final_exec_prefix='${prefix}' -- else -- acl_final_exec_prefix="$exec_prefix" -- fi -- acl_save_prefix="$prefix" -- prefix="$acl_final_prefix" -- eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" -- prefix="$acl_save_prefix" --]) -- --dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the --dnl variables prefix and exec_prefix bound to the values they will have --dnl at the end of the configure script. --AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], --[ -- acl_save_prefix="$prefix" -- prefix="$acl_final_prefix" -- acl_save_exec_prefix="$exec_prefix" -- exec_prefix="$acl_final_exec_prefix" -- $1 -- exec_prefix="$acl_save_exec_prefix" -- prefix="$acl_save_prefix" --]) -- --# lib-link.m4 serial 3 (gettext-0.11.3) --dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -- --dnl From Bruno Haible. -- --dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and --dnl the libraries corresponding to explicit and implicit dependencies. --dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and --dnl augments the CPPFLAGS variable. --AC_DEFUN([AC_LIB_LINKFLAGS], --[ -- AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -- AC_REQUIRE([AC_LIB_RPATH]) -- define([Name],[translit([$1],[./-], [___])]) -- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], -- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) -- AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ -- AC_LIB_LINKFLAGS_BODY([$1], [$2]) -- ac_cv_lib[]Name[]_libs="$LIB[]NAME" -- ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" -- ac_cv_lib[]Name[]_cppflags="$INC[]NAME" -- ]) -- LIB[]NAME="$ac_cv_lib[]Name[]_libs" -- LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" -- INC[]NAME="$ac_cv_lib[]Name[]_cppflags" -- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) -- AC_SUBST([LIB]NAME) -- AC_SUBST([LTLIB]NAME) -- dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the -- dnl results of this search when this library appears as a dependency. -- HAVE_LIB[]NAME=yes -- undefine([Name]) -- undefine([NAME]) --]) -- --dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) --dnl searches for libname and the libraries corresponding to explicit and --dnl implicit dependencies, together with the specified include files and --dnl the ability to compile and link the specified testcode. If found, it --dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and --dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and --dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs --dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. --AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], --[ -- AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -- AC_REQUIRE([AC_LIB_RPATH]) -- define([Name],[translit([$1],[./-], [___])]) -- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], -- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) -- -- dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME -- dnl accordingly. -- AC_LIB_LINKFLAGS_BODY([$1], [$2]) -- -- dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, -- dnl because if the user has installed lib[]Name and not disabled its use -- dnl via --without-lib[]Name-prefix, he wants to use it. -- ac_save_CPPFLAGS="$CPPFLAGS" -- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) -- -- AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ -- ac_save_LIBS="$LIBS" -- LIBS="$LIBS $LIB[]NAME" -- AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) -- LIBS="$ac_save_LIBS" -- ]) -- if test "$ac_cv_lib[]Name" = yes; then -- HAVE_LIB[]NAME=yes -- AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) -- AC_MSG_CHECKING([how to link with lib[]$1]) -- AC_MSG_RESULT([$LIB[]NAME]) -- else -- HAVE_LIB[]NAME=no -- dnl If $LIB[]NAME didn't lead to a usable library, we don't need -- dnl $INC[]NAME either. -- CPPFLAGS="$ac_save_CPPFLAGS" -- LIB[]NAME= -- LTLIB[]NAME= -- fi -- AC_SUBST([HAVE_LIB]NAME) -- AC_SUBST([LIB]NAME) -- AC_SUBST([LTLIB]NAME) -- undefine([Name]) -- undefine([NAME]) --]) -- --dnl Determine the platform dependent parameters needed to use rpath: --dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, --dnl hardcode_direct, hardcode_minus_L, --dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec. --AC_DEFUN([AC_LIB_RPATH], --[ -- AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS -- AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld -- AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host -- AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir -- AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ -- CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ -- ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh -- . ./conftest.sh -- rm -f ./conftest.sh -- acl_cv_rpath=done -- ]) -- wl="$acl_cv_wl" -- libext="$acl_cv_libext" -- shlibext="$acl_cv_shlibext" -- hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" -- hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" -- hardcode_direct="$acl_cv_hardcode_direct" -- hardcode_minus_L="$acl_cv_hardcode_minus_L" -- sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" -- sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" -- dnl Determine whether the user wants rpath handling at all. -- AC_ARG_ENABLE(rpath, -- [ --disable-rpath do not hardcode runtime library paths], -- :, enable_rpath=yes) --]) -- --dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and --dnl the libraries corresponding to explicit and implicit dependencies. --dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. --AC_DEFUN([AC_LIB_LINKFLAGS_BODY], --[ -- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], -- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) -- dnl By default, look in $includedir and $libdir. -- use_additional=yes -- AC_LIB_WITH_FINAL_PREFIX([ -- eval additional_includedir=\"$includedir\" -- eval additional_libdir=\"$libdir\" -- ]) -- AC_ARG_WITH([lib$1-prefix], --[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib -- --without-lib$1-prefix don't search for lib$1 in includedir and libdir], --[ -- if test "X$withval" = "Xno"; then -- use_additional=no -- else -- if test "X$withval" = "X"; then -- AC_LIB_WITH_FINAL_PREFIX([ -- eval additional_includedir=\"$includedir\" -- eval additional_libdir=\"$libdir\" -- ]) -- else -- additional_includedir="$withval/include" -- additional_libdir="$withval/lib" -+ additional_includedir="$withval/include" -+ additional_libdir="$withval/lib" - fi - fi - ]) -@@ -5419,7 +1429,7 @@ - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in -- linux*) haveit=yes;; -+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi -@@ -5468,7 +1478,7 @@ - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in -- linux*) haveit=yes;; -+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi -@@ -5552,695 +1562,8143 @@ - done - fi - else -- dnl Didn't find the library; assume it is in the system directories -- dnl known to the linker and runtime loader. (All the system -- dnl directories known to the linker should also be known to the -- dnl runtime loader, otherwise the system is severely misconfigured.) -- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" -- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" -+ dnl Didn't find the library; assume it is in the system directories -+ dnl known to the linker and runtime loader. (All the system -+ dnl directories known to the linker should also be known to the -+ dnl runtime loader, otherwise the system is severely misconfigured.) -+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" -+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" -+ fi -+ fi -+ fi -+ done -+ done -+ if test "X$rpathdirs" != "X"; then -+ if test -n "$hardcode_libdir_separator"; then -+ dnl Weird platform: only the last -rpath option counts, the user must -+ dnl pass all path elements in one option. We can arrange that for a -+ dnl single library, but not when more than one $LIBNAMEs are used. -+ alldirs= -+ for found_dir in $rpathdirs; do -+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" -+ done -+ dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. -+ acl_save_libdir="$libdir" -+ libdir="$alldirs" -+ eval flag=\"$hardcode_libdir_flag_spec\" -+ libdir="$acl_save_libdir" -+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" -+ else -+ dnl The -rpath options are cumulative. -+ for found_dir in $rpathdirs; do -+ acl_save_libdir="$libdir" -+ libdir="$found_dir" -+ eval flag=\"$hardcode_libdir_flag_spec\" -+ libdir="$acl_save_libdir" -+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" -+ done -+ fi -+ fi -+ if test "X$ltrpathdirs" != "X"; then -+ dnl When using libtool, the option that works for both libraries and -+ dnl executables is -R. The -R options are cumulative. -+ for found_dir in $ltrpathdirs; do -+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" -+ done -+ fi -+]) -+ -+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -+dnl unless already present in VAR. -+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -+dnl contains two or three consecutive elements that belong together. -+AC_DEFUN([AC_LIB_APPENDTOVAR], -+[ -+ for element in [$2]; do -+ haveit= -+ for x in $[$1]; do -+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) -+ if test "X$x" = "X$element"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ [$1]="${[$1]}${[$1]:+ }$element" -+ fi -+ done -+]) -+ -+# lib-prefix.m4 serial 4 (gettext-0.14.2) -+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Bruno Haible. -+ -+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -+dnl require excessive bracketing. -+ifdef([AC_HELP_STRING], -+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) -+ -+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -+dnl to access previously installed libraries. The basic assumption is that -+dnl a user will want packages to use other packages he previously installed -+dnl with the same --prefix option. -+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -+dnl libraries, but is otherwise very convenient. -+AC_DEFUN([AC_LIB_PREFIX], -+[ -+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) -+ AC_REQUIRE([AC_PROG_CC]) -+ AC_REQUIRE([AC_CANONICAL_HOST]) -+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -+ dnl By default, look in $includedir and $libdir. -+ use_additional=yes -+ AC_LIB_WITH_FINAL_PREFIX([ -+ eval additional_includedir=\"$includedir\" -+ eval additional_libdir=\"$libdir\" -+ ]) -+ AC_LIB_ARG_WITH([lib-prefix], -+[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib -+ --without-lib-prefix don't search for libraries in includedir and libdir], -+[ -+ if test "X$withval" = "Xno"; then -+ use_additional=no -+ else -+ if test "X$withval" = "X"; then -+ AC_LIB_WITH_FINAL_PREFIX([ -+ eval additional_includedir=\"$includedir\" -+ eval additional_libdir=\"$libdir\" -+ ]) -+ else -+ additional_includedir="$withval/include" -+ additional_libdir="$withval/lib" -+ fi -+ fi -+]) -+ if test $use_additional = yes; then -+ dnl Potentially add $additional_includedir to $CPPFLAGS. -+ dnl But don't add it -+ dnl 1. if it's the standard /usr/include, -+ dnl 2. if it's already present in $CPPFLAGS, -+ dnl 3. if it's /usr/local/include and we are using GCC on Linux, -+ dnl 4. if it doesn't exist as a directory. -+ if test "X$additional_includedir" != "X/usr/include"; then -+ haveit= -+ for x in $CPPFLAGS; do -+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) -+ if test "X$x" = "X-I$additional_includedir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ if test "X$additional_includedir" = "X/usr/local/include"; then -+ if test -n "$GCC"; then -+ case $host_os in -+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; -+ esac -+ fi -+ fi -+ if test -z "$haveit"; then -+ if test -d "$additional_includedir"; then -+ dnl Really add $additional_includedir to $CPPFLAGS. -+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" -+ fi -+ fi -+ fi -+ fi -+ dnl Potentially add $additional_libdir to $LDFLAGS. -+ dnl But don't add it -+ dnl 1. if it's the standard /usr/lib, -+ dnl 2. if it's already present in $LDFLAGS, -+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux, -+ dnl 4. if it doesn't exist as a directory. -+ if test "X$additional_libdir" != "X/usr/lib"; then -+ haveit= -+ for x in $LDFLAGS; do -+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) -+ if test "X$x" = "X-L$additional_libdir"; then -+ haveit=yes -+ break -+ fi -+ done -+ if test -z "$haveit"; then -+ if test "X$additional_libdir" = "X/usr/local/lib"; then -+ if test -n "$GCC"; then -+ case $host_os in -+ linux*) haveit=yes;; -+ esac -+ fi -+ fi -+ if test -z "$haveit"; then -+ if test -d "$additional_libdir"; then -+ dnl Really add $additional_libdir to $LDFLAGS. -+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" -+ fi -+ fi -+ fi -+ fi -+ fi -+]) -+ -+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -+dnl acl_final_exec_prefix, containing the values to which $prefix and -+dnl $exec_prefix will expand at the end of the configure script. -+AC_DEFUN([AC_LIB_PREPARE_PREFIX], -+[ -+ dnl Unfortunately, prefix and exec_prefix get only finally determined -+ dnl at the end of configure. -+ if test "X$prefix" = "XNONE"; then -+ acl_final_prefix="$ac_default_prefix" -+ else -+ acl_final_prefix="$prefix" -+ fi -+ if test "X$exec_prefix" = "XNONE"; then -+ acl_final_exec_prefix='${prefix}' -+ else -+ acl_final_exec_prefix="$exec_prefix" -+ fi -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" -+ prefix="$acl_save_prefix" -+]) -+ -+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -+dnl variables prefix and exec_prefix bound to the values they will have -+dnl at the end of the configure script. -+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -+[ -+ acl_save_prefix="$prefix" -+ prefix="$acl_final_prefix" -+ acl_save_exec_prefix="$exec_prefix" -+ exec_prefix="$acl_final_exec_prefix" -+ $1 -+ exec_prefix="$acl_save_exec_prefix" -+ prefix="$acl_save_prefix" -+]) -+ -+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -+ -+# serial 47 Debian 1.5.20-2 AC_PROG_LIBTOOL -+ -+ -+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -+# ----------------------------------------------------------- -+# If this macro is not defined by Autoconf, define it here. -+m4_ifdef([AC_PROVIDE_IFELSE], -+ [], -+ [m4_define([AC_PROVIDE_IFELSE], -+ [m4_ifdef([AC_PROVIDE_$1], -+ [$2], [$3])])]) -+ -+ -+# AC_PROG_LIBTOOL -+# --------------- -+AC_DEFUN([AC_PROG_LIBTOOL], -+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. -+ AC_PROVIDE_IFELSE([AC_PROG_CXX], -+ [AC_LIBTOOL_CXX], -+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX -+ ])]) -+dnl And a similar setup for Fortran 77 support -+ AC_PROVIDE_IFELSE([AC_PROG_F77], -+ [AC_LIBTOOL_F77], -+ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -+])]) -+ -+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. -+ AC_PROVIDE_IFELSE([AC_PROG_GCJ], -+ [AC_LIBTOOL_GCJ], -+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], -+ [AC_LIBTOOL_GCJ], -+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], -+ [AC_LIBTOOL_GCJ], -+ [ifdef([AC_PROG_GCJ], -+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) -+ ifdef([A][M_PROG_GCJ], -+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) -+ ifdef([LT_AC_PROG_GCJ], -+ [define([LT_AC_PROG_GCJ], -+ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -+])])# AC_PROG_LIBTOOL -+ -+ -+# _AC_PROG_LIBTOOL -+# ---------------- -+AC_DEFUN([_AC_PROG_LIBTOOL], -+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl -+ -+# This can be used to rebuild libtool when needed -+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" -+ -+# Always use our own libtool. -+LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+AC_SUBST(LIBTOOL)dnl -+ -+# Prevent multiple expansion -+define([AC_PROG_LIBTOOL], []) -+])# _AC_PROG_LIBTOOL -+ -+ -+# AC_LIBTOOL_SETUP -+# ---------------- -+AC_DEFUN([AC_LIBTOOL_SETUP], -+[AC_PREREQ(2.50)dnl -+AC_REQUIRE([AC_ENABLE_SHARED])dnl -+AC_REQUIRE([AC_ENABLE_STATIC])dnl -+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -+AC_REQUIRE([AC_CANONICAL_HOST])dnl -+AC_REQUIRE([AC_CANONICAL_BUILD])dnl -+AC_REQUIRE([AC_PROG_CC])dnl -+AC_REQUIRE([AC_PROG_LD])dnl -+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -+AC_REQUIRE([AC_PROG_NM])dnl -+ -+AC_REQUIRE([AC_PROG_LN_S])dnl -+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -+AC_REQUIRE([AC_OBJEXT])dnl -+AC_REQUIRE([AC_EXEEXT])dnl -+dnl -+ -+AC_LIBTOOL_SYS_MAX_CMD_LEN -+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -+AC_LIBTOOL_OBJDIR -+ -+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -+_LT_AC_PROG_ECHO_BACKSLASH -+ -+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 -+ -+# 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 to delay expansion of an escaped shell variable in a -+# double_quote_subst'ed string. -+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' -+ -+# Sed substitution to avoid accidental globbing in evaled expressions -+no_glob_subst='s/\*/\\\*/g' -+ -+# Constants: -+rm="rm -f" -+ -+# Global variables: -+default_ofile=libtool -+can_build_shared=yes -+ -+# All known linkers require a `.a' archive for static linking (except MSVC, -+# which needs '.lib'). -+libext=a -+ltmain="$ac_aux_dir/ltmain.sh" -+ofile="$default_ofile" -+with_gnu_ld="$lt_cv_prog_gnu_ld" -+ -+AC_CHECK_TOOL(AR, ar, false) -+AC_CHECK_TOOL(RANLIB, ranlib, :) -+AC_CHECK_TOOL(STRIP, strip, :) -+ -+old_CC="$CC" -+old_CFLAGS="$CFLAGS" -+ -+# Set sane defaults for various variables -+test -z "$AR" && AR=ar -+test -z "$AR_FLAGS" && AR_FLAGS=cru -+test -z "$AS" && AS=as -+test -z "$CC" && CC=cc -+test -z "$LTCC" && LTCC=$CC -+test -z "$DLLTOOL" && DLLTOOL=dlltool -+test -z "$LD" && LD=ld -+test -z "$LN_S" && LN_S="ln -s" -+test -z "$MAGIC_CMD" && MAGIC_CMD=file -+test -z "$NM" && NM=nm -+test -z "$SED" && SED=sed -+test -z "$OBJDUMP" && OBJDUMP=objdump -+test -z "$RANLIB" && RANLIB=: -+test -z "$STRIP" && STRIP=: -+test -z "$ac_objext" && ac_objext=o -+ -+# Determine commands to create old-style static archives. -+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -+old_postinstall_cmds='chmod 644 $oldlib' -+old_postuninstall_cmds= -+ -+if test -n "$RANLIB"; then -+ case $host_os in -+ openbsd*) -+ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" -+ ;; -+ *) -+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" -+ ;; -+ esac -+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -+fi -+ -+_LT_CC_BASENAME([$compiler]) -+ -+# Only perform the check for file, if the check method requires it -+case $deplibs_check_method in -+file_magic*) -+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then -+ AC_PATH_MAGIC -+ fi -+ ;; -+esac -+ -+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -+enable_win32_dll=yes, enable_win32_dll=no) -+ -+AC_ARG_ENABLE([libtool-lock], -+ [AC_HELP_STRING([--disable-libtool-lock], -+ [avoid locking (might break parallel builds)])]) -+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -+ -+AC_ARG_WITH([pic], -+ [AC_HELP_STRING([--with-pic], -+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], -+ [pic_mode="$withval"], -+ [pic_mode=default]) -+test -z "$pic_mode" && pic_mode=default -+ -+# Use C for the default configuration in the libtool script -+tagname= -+AC_LIBTOOL_LANG_C_CONFIG -+_LT_AC_TAGCONFIG -+])# AC_LIBTOOL_SETUP -+ -+ -+# _LT_AC_SYS_COMPILER -+# ------------------- -+AC_DEFUN([_LT_AC_SYS_COMPILER], -+[AC_REQUIRE([AC_PROG_CC])dnl -+ -+# If no C compiler was specified, use CC. -+LTCC=${LTCC-"$CC"} -+ -+# Allow CC to be a program name with arguments. -+compiler=$CC -+])# _LT_AC_SYS_COMPILER -+ -+ -+# _LT_CC_BASENAME(CC) -+# ------------------- -+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -+AC_DEFUN([_LT_CC_BASENAME], -+[for cc_temp in $1""; do -+ case $cc_temp in -+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; -+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+]) -+ -+ -+# _LT_COMPILER_BOILERPLATE -+# ------------------------ -+# Check for compiler boilerplate output or warnings with -+# the simple compiler test code. -+AC_DEFUN([_LT_COMPILER_BOILERPLATE], -+[ac_outfile=conftest.$ac_objext -+printf "$lt_simple_compile_test_code" >conftest.$ac_ext -+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_compiler_boilerplate=`cat conftest.err` -+$rm conftest* -+])# _LT_COMPILER_BOILERPLATE -+ -+ -+# _LT_LINKER_BOILERPLATE -+# ---------------------- -+# Check for linker boilerplate output or warnings with -+# the simple link test code. -+AC_DEFUN([_LT_LINKER_BOILERPLATE], -+[ac_outfile=conftest.$ac_objext -+printf "$lt_simple_link_test_code" >conftest.$ac_ext -+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_linker_boilerplate=`cat conftest.err` -+$rm conftest* -+])# _LT_LINKER_BOILERPLATE -+ -+ -+# _LT_AC_SYS_LIBPATH_AIX -+# ---------------------- -+# Links a minimal program and checks the executable -+# for the system default hardcoded library path. In most cases, -+# this is /usr/lib:/lib, but when the MPI compilers are used -+# the location of the communication and MPI libs are included too. -+# If we don't find anything, use the default library path according -+# to the aix ld manual. -+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi],[]) -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+])# _LT_AC_SYS_LIBPATH_AIX -+ -+ -+# _LT_AC_SHELL_INIT(ARG) -+# ---------------------- -+AC_DEFUN([_LT_AC_SHELL_INIT], -+[ifdef([AC_DIVERSION_NOTICE], -+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], -+ [AC_DIVERT_PUSH(NOTICE)]) -+$1 -+AC_DIVERT_POP -+])# _LT_AC_SHELL_INIT -+ -+ -+# _LT_AC_PROG_ECHO_BACKSLASH -+# -------------------------- -+# Add some code to the start of the generated configure script which -+# will find an echo command which doesn't interpret backslashes. -+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -+[_LT_AC_SHELL_INIT([ -+# Check that we are running under the correct shell. -+SHELL=${CONFIG_SHELL-/bin/sh} -+ -+case X$ECHO in -+X*--fallback-echo) -+ # Remove one level of quotation (which was required for Make). -+ ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` -+ ;; -+esac -+ -+echo=${ECHO-echo} -+if test "X[$]1" = X--no-reexec; then -+ # Discard the --no-reexec flag, and continue. -+ shift -+elif test "X[$]1" = X--fallback-echo; then -+ # Avoid inline document here, it may be left over -+ : -+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then -+ # Yippee, $echo works! -+ : -+else -+ # Restart under the correct shell. -+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -+fi -+ -+if test "X[$]1" = X--fallback-echo; then -+ # used as fallback echo -+ shift -+ cat </dev/null 2>&1 && unset CDPATH -+ -+if test -z "$ECHO"; then -+if test "X${echo_test_string+set}" != Xset; then -+# find a string as large as possible, as long as the shell can cope with it -+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do -+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... -+ if (echo_test_string=`eval $cmd`) 2>/dev/null && -+ echo_test_string=`eval $cmd` && -+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null -+ then -+ break -+ fi -+ done -+fi -+ -+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ : -+else -+ # The Solaris, AIX, and Digital Unix default echo programs unquote -+ # backslashes. This makes it impossible to quote backslashes using -+ # echo "$something" | sed 's/\\/\\\\/g' -+ # -+ # So, first we look for a working echo in the user's PATH. -+ -+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -+ for dir in $PATH /usr/ucb; do -+ IFS="$lt_save_ifs" -+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && -+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ echo="$dir/echo" -+ break -+ fi -+ done -+ IFS="$lt_save_ifs" -+ -+ if test "X$echo" = Xecho; then -+ # We didn't find a better echo, so look for alternatives. -+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ # This shell has a builtin print -r that does the trick. -+ echo='print -r' -+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && -+ test "X$CONFIG_SHELL" != X/bin/ksh; then -+ # If we have ksh, try running configure again with it. -+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -+ export ORIGINAL_CONFIG_SHELL -+ CONFIG_SHELL=/bin/ksh -+ export CONFIG_SHELL -+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} -+ else -+ # Try using printf. -+ echo='printf %s\n' -+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ # Cool, printf works -+ : -+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && -+ test "X$echo_testing_string" = 'X\t' && -+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL -+ export CONFIG_SHELL -+ SHELL="$CONFIG_SHELL" -+ export SHELL -+ echo="$CONFIG_SHELL [$]0 --fallback-echo" -+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && -+ test "X$echo_testing_string" = 'X\t' && -+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ echo="$CONFIG_SHELL [$]0 --fallback-echo" -+ else -+ # maybe with a smaller string... -+ prev=: -+ -+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do -+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null -+ then -+ break -+ fi -+ prev="$cmd" -+ done -+ -+ if test "$prev" != 'sed 50q "[$]0"'; then -+ echo_test_string=`eval $prev` -+ export echo_test_string -+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} -+ else -+ # Oops. We lost completely, so just stick with echo. -+ echo=echo -+ fi -+ fi -+ fi -+ fi -+fi -+fi -+ -+# Copy echo and quote the copy suitably for passing to libtool from -+# the Makefile, instead of quoting the original, which is used later. -+ECHO=$echo -+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then -+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -+fi -+ -+AC_SUBST(ECHO) -+])])# _LT_AC_PROG_ECHO_BACKSLASH -+ -+ -+# _LT_AC_LOCK -+# ----------- -+AC_DEFUN([_LT_AC_LOCK], -+[AC_ARG_ENABLE([libtool-lock], -+ [AC_HELP_STRING([--disable-libtool-lock], -+ [avoid locking (might break parallel builds)])]) -+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 AC_TRY_EVAL(ac_compile); 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 __oline__ "configure"' > conftest.$ac_ext -+ if AC_TRY_EVAL(ac_compile); 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-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) -+ # Find out which ABI we are using. -+ echo 'int i;' > conftest.$ac_ext -+ if AC_TRY_EVAL(ac_compile); then -+ case `/usr/bin/file conftest.o` in -+ *32-bit*) -+ case $host in -+ 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-*linux*) -+ LD="${LD-ld} -m elf_x86_64" -+ ;; -+ ppc*-*linux*|powerpc*-*linux*) -+ LD="${LD-ld} -m elf64ppc" -+ ;; -+ s390*-*linux*) -+ 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" -+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, -+ [AC_LANG_PUSH(C) -+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) -+ AC_LANG_POP]) -+ 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 -+ ;; -+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -+[*-*-cygwin* | *-*-mingw* | *-*-pw32*) -+ AC_CHECK_TOOL(DLLTOOL, dlltool, false) -+ AC_CHECK_TOOL(AS, as, false) -+ AC_CHECK_TOOL(OBJDUMP, objdump, false) -+ ;; -+ ]) -+esac -+ -+need_locks="$enable_libtool_lock" -+ -+])# _LT_AC_LOCK -+ -+ -+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -+# ---------------------------------------------------------------- -+# Check whether the given compiler option works -+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -+[AC_REQUIRE([LT_AC_PROG_SED]) -+AC_CACHE_CHECK([$1], [$2], -+ [$2=no -+ ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ lt_compiler_flag="$3" -+ # 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:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) -+ (eval "$lt_compile" 2>conftest.err) -+ ac_status=$? -+ cat conftest.err >&AS_MESSAGE_LOG_FD -+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD -+ 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 "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then -+ $2=yes -+ fi -+ fi -+ $rm conftest* -+]) -+ -+if test x"[$]$2" = xyes; then -+ ifelse([$5], , :, [$5]) -+else -+ ifelse([$6], , :, [$6]) -+fi -+])# AC_LIBTOOL_COMPILER_OPTION -+ -+ -+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -+# [ACTION-SUCCESS], [ACTION-FAILURE]) -+# ------------------------------------------------------------ -+# Check whether the given compiler option works -+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -+[AC_CACHE_CHECK([$1], [$2], -+ [$2=no -+ save_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS $3" -+ printf "$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>&AS_MESSAGE_LOG_FD -+ $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if diff conftest.exp conftest.er2 >/dev/null; then -+ $2=yes -+ fi -+ else -+ $2=yes -+ fi -+ fi -+ $rm conftest* -+ LDFLAGS="$save_LDFLAGS" -+]) -+ -+if test x"[$]$2" = xyes; then -+ ifelse([$4], , :, [$4]) -+else -+ ifelse([$5], , :, [$5]) -+fi -+])# AC_LIBTOOL_LINKER_OPTION -+ -+ -+# AC_LIBTOOL_SYS_MAX_CMD_LEN -+# -------------------------- -+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -+[# find the maximum length of command line arguments -+AC_MSG_CHECKING([the maximum length of command line arguments]) -+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl -+ 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*) -+ # 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; -+ ;; -+ -+ 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` -+ ;; -+ 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 -+ ;; -+ *) -+ # 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. -+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} -+ while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ -+ = "XX$teststring") >/dev/null 2>&1 && -+ new_result=`expr "X$teststring" : ".*" 2>&1` && -+ lt_cv_sys_max_cmd_len=$new_result && -+ test $i != 17 # 1/2 MB should be enough -+ do -+ i=`expr $i + 1` -+ teststring=$teststring$teststring -+ done -+ 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` -+ ;; -+ esac -+]) -+if test -n $lt_cv_sys_max_cmd_len ; then -+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -+else -+ AC_MSG_RESULT(none) -+fi -+])# AC_LIBTOOL_SYS_MAX_CMD_LEN -+ -+ -+# _LT_AC_CHECK_DLFCN -+# -------------------- -+AC_DEFUN([_LT_AC_CHECK_DLFCN], -+[AC_CHECK_HEADERS(dlfcn.h)dnl -+])# _LT_AC_CHECK_DLFCN -+ -+ -+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -+# ------------------------------------------------------------------ -+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -+if test "$cross_compiling" = yes; then : -+ [$4] -+else -+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 -+ lt_status=$lt_dlunknown -+ cat > conftest.$ac_ext < -+#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 -+ -+#ifdef __cplusplus -+extern "C" void exit (int); -+#endif -+ -+void fnord() { int i=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; -+ /* dlclose (self); */ -+ } -+ -+ exit (status); -+}] -+EOF -+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then -+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null -+ lt_status=$? -+ case x$lt_status in -+ x$lt_dlno_uscore) $1 ;; -+ x$lt_dlneed_uscore) $2 ;; -+ x$lt_unknown|x*) $3 ;; -+ esac -+ else : -+ # compilation failed -+ $3 -+ fi -+fi -+rm -fr conftest* -+])# _LT_AC_TRY_DLOPEN_SELF -+ -+ -+# AC_LIBTOOL_DLOPEN_SELF -+# ------------------- -+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -+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*) -+ 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 -+ AC_CHECK_LIB([dl], [dlopen], -+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ -+ lt_cv_dlopen="dyld" -+ lt_cv_dlopen_libs= -+ lt_cv_dlopen_self=yes -+ ]) -+ ;; -+ -+ *) -+ AC_CHECK_FUNC([shl_load], -+ [lt_cv_dlopen="shl_load"], -+ [AC_CHECK_LIB([dld], [shl_load], -+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], -+ [AC_CHECK_FUNC([dlopen], -+ [lt_cv_dlopen="dlopen"], -+ [AC_CHECK_LIB([dl], [dlopen], -+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], -+ [AC_CHECK_LIB([svld], [dlopen], -+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], -+ [AC_CHECK_LIB([dld], [dld_link], -+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) -+ ]) -+ ]) -+ ]) -+ ]) -+ ]) -+ ;; -+ 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" -+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -+ -+ save_LIBS="$LIBS" -+ LIBS="$lt_cv_dlopen_libs $LIBS" -+ -+ AC_CACHE_CHECK([whether a program can dlopen itself], -+ lt_cv_dlopen_self, [dnl -+ _LT_AC_TRY_DLOPEN_SELF( -+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, -+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) -+ ]) -+ -+ if test "x$lt_cv_dlopen_self" = xyes; then -+ LDFLAGS="$LDFLAGS $link_static_flag" -+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself], -+ lt_cv_dlopen_self_static, [dnl -+ _LT_AC_TRY_DLOPEN_SELF( -+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, -+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) -+ ]) -+ 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 -+])# AC_LIBTOOL_DLOPEN_SELF -+ -+ -+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -+# --------------------------------- -+# Check to see if options -c and -o are simultaneously supported by compiler -+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], -+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], -+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no -+ $rm -r conftest 2>/dev/null -+ mkdir conftest -+ cd conftest -+ mkdir out -+ printf "$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:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) -+ (eval "$lt_compile" 2>out/conftest.err) -+ ac_status=$? -+ cat out/conftest.err >&AS_MESSAGE_LOG_FD -+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD -+ 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 "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp -+ $SED '/^$/d' out/conftest.err >out/conftest.er2 -+ if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then -+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes -+ fi -+ fi -+ chmod u+w . 2>&AS_MESSAGE_LOG_FD -+ $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 .. -+ rmdir conftest -+ $rm conftest* -+]) -+])# AC_LIBTOOL_PROG_CC_C_O -+ -+ -+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -+# ----------------------------------------- -+# Check to see if we can do hard links to lock some files if needed -+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -+[AC_REQUIRE([_LT_AC_LOCK])dnl -+ -+hard_links="nottested" -+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then -+ # do not overwrite the value of need_locks provided by the user -+ AC_MSG_CHECKING([if we can lock with hard links]) -+ 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 -+ AC_MSG_RESULT([$hard_links]) -+ if test "$hard_links" = no; then -+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) -+ need_locks=warn -+ fi -+else -+ need_locks=no -+fi -+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS -+ -+ -+# AC_LIBTOOL_OBJDIR -+# ----------------- -+AC_DEFUN([AC_LIBTOOL_OBJDIR], -+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -+[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]) -+objdir=$lt_cv_objdir -+])# AC_LIBTOOL_OBJDIR -+ -+ -+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -+# ---------------------------------------------- -+# Check hardcoding attributes. -+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -+[AC_MSG_CHECKING([how to hardcode library paths into programs]) -+_LT_AC_TAGVAR(hardcode_action, $1)= -+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ -+ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ -+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then -+ -+ # We can hardcode non-existant directories. -+ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != 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_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && -+ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then -+ # Linking always hardcodes the temporary library directory. -+ _LT_AC_TAGVAR(hardcode_action, $1)=relink -+ else -+ # We can link without hardcoding, and we can hardcode nonexisting dirs. -+ _LT_AC_TAGVAR(hardcode_action, $1)=immediate -+ fi -+else -+ # We cannot hardcode anything, or else we can only hardcode existing -+ # directories. -+ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -+fi -+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) -+ -+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then -+ # Fast installation is not supported -+ enable_fast_install=no -+elif test "$shlibpath_overrides_runpath" = yes || -+ test "$enable_shared" = no; then -+ # Fast installation is not necessary -+ enable_fast_install=needless -+fi -+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH -+ -+ -+# AC_LIBTOOL_SYS_LIB_STRIP -+# ------------------------ -+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -+[striplib= -+old_striplib= -+AC_MSG_CHECKING([whether stripping libraries is possible]) -+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" -+ AC_MSG_RESULT([yes]) -+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" -+ AC_MSG_RESULT([yes]) -+ else -+ AC_MSG_RESULT([no]) -+fi -+ ;; -+ *) -+ AC_MSG_RESULT([no]) -+ ;; -+ esac -+fi -+])# AC_LIBTOOL_SYS_LIB_STRIP -+ -+ -+# AC_LIBTOOL_SYS_DYNAMIC_LINKER -+# ----------------------------- -+# PORTME Fill in your ld.so characteristics -+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -+[AC_MSG_CHECKING([dynamic linker characteristics]) -+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" -+if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then -+ # 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. -+ 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 -+else -+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -+fi -+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' -+ ;; -+ -+aix4* | aix5*) -+ 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*) -+ library_names_spec='$libname.ixlibrary $libname.a' -+ # Create ${libname}_ixlibrary.a entries in /sys/libs. -+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' -+ ;; -+ -+beos*) -+ library_names_spec='${libname}${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*) -+ version_type=windows -+ shrext_cmds=".dll" -+ need_version=no -+ need_lib_prefix=no -+ -+ case $GCC,$host_os in -+ yes,cygwin* | yes,mingw* | yes,pw32*) -+ 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' -+ 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="/usr/lib /lib/w32api /lib /usr/local/lib" -+ ;; -+ mingw*) -+ # MinGW DLLs use traditional 'lib' prefix -+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then -+ # It is most probably a Windows format PATH printed by -+ # mingw gcc, but we are running on Cygwin. Gcc prints its search -+ # path with ; separators, and with drive letters. We can handle the -+ # drive letters (cygwin fileutils understands them), so leave them, -+ # especially as we might pass files found there to a mingw objdump, -+ # which wouldn't understand a cygwinified path. Ahh. -+ 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 -+ ;; -+ 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 -+ ;; -+ -+ *) -+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' -+ ;; -+ esac -+ dynamic_linker='Win32 ld.exe' -+ # 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}${versuffix}$shared_ext ${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`' -+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. -+ if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` -+ else -+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' -+ fi -+ 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 -+ ;; -+ -+kfreebsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU ld.so' -+ ;; -+ -+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 -+ ;; -+ *) # from 3.2 on -+ shlibpath_overrides_runpath=no -+ 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 -+ ;; -+ -+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' -+ ;; -+ -+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*) -+ 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 -+ # 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)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' -+ ;; -+ -+netbsdelf*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='NetBSD ld.elf_so' -+ ;; -+ -+knetbsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU 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=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 -+ ;; -+ -+openbsd*) -+ version_type=sunos -+ 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" -+ ;; -+ -+sco3.2v5*) -+ version_type=osf -+ 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 -+ ;; -+ -+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.2uw2* | sysv4.3* | sysv5*) -+ 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 -+ export_dynamic_flag_spec='${wl}-Blargedynsym' -+ 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 -+ ;; -+ -+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 -+AC_MSG_RESULT([$dynamic_linker]) -+test "$dynamic_linker" = no && can_build_shared=no -+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER -+ -+ -+# _LT_AC_TAGCONFIG -+# ---------------- -+AC_DEFUN([_LT_AC_TAGCONFIG], -+[AC_ARG_WITH([tags], -+ [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], -+ [include additional configurations @<:@automatic@:>@])], -+ [tagnames="$withval"]) -+ -+if test -f "$ltmain" && test -n "$tagnames"; then -+ if test ! -f "${ofile}"; then -+ AC_MSG_WARN([output file `$ofile' does not exist]) -+ fi -+ -+ if test -z "$LTCC"; then -+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`" -+ if test -z "$LTCC"; then -+ AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) -+ else -+ AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) -+ fi -+ fi -+ -+ # Extract list of available tagged configurations in $ofile. -+ # Note that this assumes the entire list is on one line. -+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` -+ -+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," -+ for tagname in $tagnames; do -+ IFS="$lt_save_ifs" -+ # Check whether tagname contains only valid characters -+ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in -+ "") ;; -+ *) AC_MSG_ERROR([invalid tag name: $tagname]) -+ ;; -+ esac -+ -+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null -+ then -+ AC_MSG_ERROR([tag name \"$tagname\" already exists]) -+ fi -+ -+ # Update the list of available tags. -+ if test -n "$tagname"; then -+ echo appending configuration tag \"$tagname\" to $ofile -+ -+ case $tagname in -+ CXX) -+ if test -n "$CXX" && ( test "X$CXX" != "Xno" && -+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || -+ (test "X$CXX" != "Xg++"))) ; then -+ AC_LIBTOOL_LANG_CXX_CONFIG -+ else -+ tagname="" -+ fi -+ ;; -+ -+ F77) -+ if test -n "$F77" && test "X$F77" != "Xno"; then -+ AC_LIBTOOL_LANG_F77_CONFIG -+ else -+ tagname="" -+ fi -+ ;; -+ -+ GCJ) -+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then -+ AC_LIBTOOL_LANG_GCJ_CONFIG -+ else -+ tagname="" -+ fi -+ ;; -+ -+ RC) -+ AC_LIBTOOL_LANG_RC_CONFIG -+ ;; -+ -+ *) -+ AC_MSG_ERROR([Unsupported tag name: $tagname]) -+ ;; -+ esac -+ -+ # Append the new tag name to the list of available tags. -+ if test -n "$tagname" ; then -+ available_tags="$available_tags $tagname" -+ fi -+ fi -+ done -+ IFS="$lt_save_ifs" -+ -+ # Now substitute the updated list of available tags. -+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then -+ mv "${ofile}T" "$ofile" -+ chmod +x "$ofile" -+ else -+ rm -f "${ofile}T" -+ AC_MSG_ERROR([unable to update list of available tagged configurations.]) -+ fi -+fi -+])# _LT_AC_TAGCONFIG -+ -+ -+# AC_LIBTOOL_DLOPEN -+# ----------------- -+# enable checks for dlopen support -+AC_DEFUN([AC_LIBTOOL_DLOPEN], -+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -+])# AC_LIBTOOL_DLOPEN -+ -+ -+# AC_LIBTOOL_WIN32_DLL -+# -------------------- -+# declare package support for building win32 DLLs -+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -+])# AC_LIBTOOL_WIN32_DLL -+ -+ -+# AC_ENABLE_SHARED([DEFAULT]) -+# --------------------------- -+# implement the --enable-shared flag -+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -+AC_DEFUN([AC_ENABLE_SHARED], -+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -+AC_ARG_ENABLE([shared], -+ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], -+ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], -+ [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], -+ [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -+])# AC_ENABLE_SHARED -+ -+ -+# AC_DISABLE_SHARED -+# ----------------- -+#- set the default shared flag to --disable-shared -+AC_DEFUN([AC_DISABLE_SHARED], -+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -+AC_ENABLE_SHARED(no) -+])# AC_DISABLE_SHARED -+ -+ -+# AC_ENABLE_STATIC([DEFAULT]) -+# --------------------------- -+# implement the --enable-static flag -+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -+AC_DEFUN([AC_ENABLE_STATIC], -+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -+AC_ARG_ENABLE([static], -+ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], -+ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], -+ [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], -+ [enable_static=]AC_ENABLE_STATIC_DEFAULT) -+])# AC_ENABLE_STATIC -+ -+ -+# AC_DISABLE_STATIC -+# ----------------- -+# set the default static flag to --disable-static -+AC_DEFUN([AC_DISABLE_STATIC], -+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -+AC_ENABLE_STATIC(no) -+])# AC_DISABLE_STATIC -+ -+ -+# AC_ENABLE_FAST_INSTALL([DEFAULT]) -+# --------------------------------- -+# implement the --enable-fast-install flag -+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -+AC_DEFUN([AC_ENABLE_FAST_INSTALL], -+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -+AC_ARG_ENABLE([fast-install], -+ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], -+ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], -+ [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], -+ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -+])# AC_ENABLE_FAST_INSTALL -+ -+ -+# AC_DISABLE_FAST_INSTALL -+# ----------------------- -+# set the default to --disable-fast-install -+AC_DEFUN([AC_DISABLE_FAST_INSTALL], -+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -+AC_ENABLE_FAST_INSTALL(no) -+])# AC_DISABLE_FAST_INSTALL -+ -+ -+# AC_LIBTOOL_PICMODE([MODE]) -+# -------------------------- -+# implement the --with-pic flag -+# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -+AC_DEFUN([AC_LIBTOOL_PICMODE], -+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -+pic_mode=ifelse($#,1,$1,default) -+])# AC_LIBTOOL_PICMODE -+ -+ -+# AC_PROG_EGREP -+# ------------- -+# This is predefined starting with Autoconf 2.54, so this conditional -+# definition can be removed once we require Autoconf 2.54 or later. -+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], -+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 -+ then ac_cv_prog_egrep='grep -E' -+ else ac_cv_prog_egrep='egrep' -+ fi]) -+ EGREP=$ac_cv_prog_egrep -+ AC_SUBST([EGREP]) -+])]) -+ -+ -+# AC_PATH_TOOL_PREFIX -+# ------------------- -+# find a file program which can recognise shared library -+AC_DEFUN([AC_PATH_TOOL_PREFIX], -+[AC_REQUIRE([AC_PROG_EGREP])dnl -+AC_MSG_CHECKING([for $1]) -+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -+[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 -+dnl $ac_dummy forces splitting on constant user-supplied paths. -+dnl POSIX.2 word splitting is done only on the output of word expansions, -+dnl not every word. This closes a longstanding sh security hole. -+ ac_dummy="ifelse([$2], , $PATH, [$2])" -+ for ac_dir in $ac_dummy; do -+ IFS="$lt_save_ifs" -+ test -z "$ac_dir" && ac_dir=. -+ if test -f $ac_dir/$1; then -+ lt_cv_path_MAGIC_CMD="$ac_dir/$1" -+ 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 <&2 -+ -+*** Warning: the command libtool uses to detect shared libraries, -+*** $file_magic_cmd, produces output that libtool cannot recognize. -+*** The result is that libtool may fail to recognize shared libraries -+*** as such. This will affect the creation of libtool libraries that -+*** depend on shared libraries, but programs linked with such libtool -+*** libraries will work regardless of this problem. Nevertheless, you -+*** may want to report the problem to your system manager and/or to -+*** bug-libtool@gnu.org -+ -+EOF -+ fi ;; -+ esac -+ fi -+ break -+ fi -+ done -+ IFS="$lt_save_ifs" -+ MAGIC_CMD="$lt_save_MAGIC_CMD" -+ ;; -+esac]) -+MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -+if test -n "$MAGIC_CMD"; then -+ AC_MSG_RESULT($MAGIC_CMD) -+else -+ AC_MSG_RESULT(no) -+fi -+])# AC_PATH_TOOL_PREFIX -+ -+ -+# AC_PATH_MAGIC -+# ------------- -+# find a file program which can recognise a shared library -+AC_DEFUN([AC_PATH_MAGIC], -+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -+if test -z "$lt_cv_path_MAGIC_CMD"; then -+ if test -n "$ac_tool_prefix"; then -+ AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) -+ else -+ MAGIC_CMD=: -+ fi -+fi -+])# AC_PATH_MAGIC -+ -+ -+# AC_PROG_LD -+# ---------- -+# find the pathname to the GNU or non-GNU linker -+AC_DEFUN([AC_PROG_LD], -+[AC_ARG_WITH([gnu-ld], -+ [AC_HELP_STRING([--with-gnu-ld], -+ [assume the C compiler uses GNU ld @<:@default=no@:>@])], -+ [test "$withval" = no || with_gnu_ld=yes], -+ [with_gnu_ld=no]) -+AC_REQUIRE([LT_AC_PROG_SED])dnl -+AC_REQUIRE([AC_PROG_CC])dnl -+AC_REQUIRE([AC_CANONICAL_HOST])dnl -+AC_REQUIRE([AC_CANONICAL_BUILD])dnl -+ac_prog=ld -+if test "$GCC" = yes; then -+ # Check if gcc -print-prog-name=ld gives a path. -+ AC_MSG_CHECKING([for ld used by $CC]) -+ 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 -+ AC_MSG_CHECKING([for GNU ld]) -+else -+ AC_MSG_CHECKING([for non-GNU ld]) -+fi -+AC_CACHE_VAL(lt_cv_path_LD, -+[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 &1 /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 -+ ;; -+ -+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]) 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 -+ ;; -+ -+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*) -+ lt_cv_deplibs_check_method=pass_all -+ ;; -+ -+netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ 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=unknown -+ ;; -+ -+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 -+ ;; -+ -+sco3.2v5*) -+ lt_cv_deplibs_check_method=pass_all -+ ;; -+ -+solaris*) -+ lt_cv_deplibs_check_method=pass_all -+ ;; -+ -+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -+ 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 -+ ;; -+ esac -+ ;; -+ -+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) -+ lt_cv_deplibs_check_method=pass_all -+ ;; -+esac -+]) -+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 -+])# AC_DEPLIBS_CHECK_METHOD -+ -+ -+# AC_PROG_NM -+# ---------- -+# find the pathname to a BSD-compatible name lister -+AC_DEFUN([AC_PROG_NM], -+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -+[if test -n "$NM"; then -+ # Let the user override the test. -+ lt_cv_path_NM="$NM" -+else -+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do -+ IFS="$lt_save_ifs" -+ test -z "$ac_dir" && ac_dir=. -+ tmp_nm="$ac_dir/${ac_tool_prefix}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" -+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -+fi]) -+NM="$lt_cv_path_NM" -+])# AC_PROG_NM -+ -+ -+# AC_CHECK_LIBM -+# ------------- -+# check for math library -+AC_DEFUN([AC_CHECK_LIBM], -+[AC_REQUIRE([AC_CANONICAL_HOST])dnl -+LIBM= -+case $host in -+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) -+ # These system don't have libm, or don't need it -+ ;; -+*-ncr-sysv4.3*) -+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") -+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") -+ ;; -+*) -+ AC_CHECK_LIB(m, cos, LIBM="-lm") -+ ;; -+esac -+])# AC_CHECK_LIBM -+ -+ -+# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -+# ----------------------------------- -+# sets LIBLTDL to the link flags for the libltdl convenience library and -+# LTDLINCL to the include flags for the libltdl header and adds -+# --enable-ltdl-convenience to the configure arguments. Note that -+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, -+# it is assumed to be `libltdl'. LIBLTDL will be prefixed with -+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' -+# (note the single quotes!). If your package is not flat and you're not -+# using automake, define top_builddir and top_srcdir appropriately in -+# the Makefiles. -+AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -+ case $enable_ltdl_convenience in -+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; -+ "") enable_ltdl_convenience=yes -+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; -+ esac -+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la -+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -+ # For backwards non-gettext consistent compatibility... -+ INCLTDL="$LTDLINCL" -+])# AC_LIBLTDL_CONVENIENCE -+ -+ -+# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -+# ----------------------------------- -+# sets LIBLTDL to the link flags for the libltdl installable library and -+# LTDLINCL to the include flags for the libltdl header and adds -+# --enable-ltdl-install to the configure arguments. Note that -+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, -+# and an installed libltdl is not found, it is assumed to be `libltdl'. -+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with -+# '${top_srcdir}/' (note the single quotes!). If your package is not -+# flat and you're not using automake, define top_builddir and top_srcdir -+# appropriately in the Makefiles. -+# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -+AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -+ AC_CHECK_LIB(ltdl, lt_dlinit, -+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], -+ [if test x"$enable_ltdl_install" = xno; then -+ AC_MSG_WARN([libltdl not installed, but installation disabled]) -+ else -+ enable_ltdl_install=yes -+ fi -+ ]) -+ if test x"$enable_ltdl_install" = x"yes"; then -+ ac_configure_args="$ac_configure_args --enable-ltdl-install" -+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la -+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -+ else -+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no" -+ LIBLTDL="-lltdl" -+ LTDLINCL= -+ fi -+ # For backwards non-gettext consistent compatibility... -+ INCLTDL="$LTDLINCL" -+])# AC_LIBLTDL_INSTALLABLE -+ -+ -+# AC_LIBTOOL_CXX -+# -------------- -+# enable support for C++ libraries -+AC_DEFUN([AC_LIBTOOL_CXX], -+[AC_REQUIRE([_LT_AC_LANG_CXX]) -+])# AC_LIBTOOL_CXX -+ -+ -+# _LT_AC_LANG_CXX -+# --------------- -+AC_DEFUN([_LT_AC_LANG_CXX], -+[AC_REQUIRE([AC_PROG_CXX]) -+AC_REQUIRE([_LT_AC_PROG_CXXCPP]) -+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -+])# _LT_AC_LANG_CXX -+ -+# _LT_AC_PROG_CXXCPP -+# --------------- -+AC_DEFUN([_LT_AC_PROG_CXXCPP], -+[ -+AC_REQUIRE([AC_PROG_CXX]) -+if test -n "$CXX" && ( test "X$CXX" != "Xno" && -+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || -+ (test "X$CXX" != "Xg++"))) ; then -+ AC_PROG_CXXCPP -+fi -+])# _LT_AC_PROG_CXXCPP -+ -+# AC_LIBTOOL_F77 -+# -------------- -+# enable support for Fortran 77 libraries -+AC_DEFUN([AC_LIBTOOL_F77], -+[AC_REQUIRE([_LT_AC_LANG_F77]) -+])# AC_LIBTOOL_F77 -+ -+ -+# _LT_AC_LANG_F77 -+# --------------- -+AC_DEFUN([_LT_AC_LANG_F77], -+[AC_REQUIRE([AC_PROG_F77]) -+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -+])# _LT_AC_LANG_F77 -+ -+ -+# AC_LIBTOOL_GCJ -+# -------------- -+# enable support for GCJ libraries -+AC_DEFUN([AC_LIBTOOL_GCJ], -+[AC_REQUIRE([_LT_AC_LANG_GCJ]) -+])# AC_LIBTOOL_GCJ -+ -+ -+# _LT_AC_LANG_GCJ -+# --------------- -+AC_DEFUN([_LT_AC_LANG_GCJ], -+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], -+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], -+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], -+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], -+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], -+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -+])# _LT_AC_LANG_GCJ -+ -+ -+# AC_LIBTOOL_RC -+# -------------- -+# enable support for Windows resource files -+AC_DEFUN([AC_LIBTOOL_RC], -+[AC_REQUIRE([LT_AC_PROG_RC]) -+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -+])# AC_LIBTOOL_RC -+ -+ -+# AC_LIBTOOL_LANG_C_CONFIG -+# ------------------------ -+# Ensure that the configuration vars for the C compiler are -+# suitably defined. Those variables are subsequently used by -+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -+AC_DEFUN([_LT_AC_LANG_C_CONFIG], -+[lt_save_CC="$CC" -+AC_LANG_PUSH(C) -+ -+# Source file extension for C test sources. -+ac_ext=c -+ -+# Object file extension for compiled C test sources. -+objext=o -+_LT_AC_TAGVAR(objext, $1)=$objext -+ -+# Code to be used in simple compile tests -+lt_simple_compile_test_code="int some_variable = 0;\n" -+ -+# Code to be used in simple link tests -+lt_simple_link_test_code='int main(){return(0);}\n' -+ -+_LT_AC_SYS_COMPILER -+ -+# save warnings/boilerplate of simple test code -+_LT_COMPILER_BOILERPLATE -+_LT_LINKER_BOILERPLATE -+ -+# -+# Check for any special shared library compilation flags. -+# -+_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -+if test "$GCC" = no; then -+ case $host_os in -+ sco3.2v5*) -+ _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' -+ ;; -+ esac -+fi -+if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then -+ AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) -+ if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : -+ else -+ AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) -+ _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no -+ fi -+fi -+ -+ -+# -+# Check to make sure the static flag actually works. -+# -+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], -+ _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), -+ $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), -+ [], -+ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) -+ -+ -+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -+AC_LIBTOOL_PROG_COMPILER_PIC($1) -+AC_LIBTOOL_PROG_CC_C_O($1) -+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -+AC_LIBTOOL_PROG_LD_SHLIBS($1) -+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -+AC_LIBTOOL_SYS_LIB_STRIP -+AC_LIBTOOL_DLOPEN_SELF($1) -+ -+# Report which librarie types wil actually be built -+AC_MSG_CHECKING([if libtool supports shared libraries]) -+AC_MSG_RESULT([$can_build_shared]) -+ -+AC_MSG_CHECKING([whether to build shared libraries]) -+test "$can_build_shared" = "no" && enable_shared=no -+ -+# On AIX, shared libraries and static libraries use the same namespace, and -+# are all built from PIC. -+case $host_os in -+aix3*) -+ test "$enable_shared" = yes && enable_static=no -+ if test -n "$RANLIB"; then -+ archive_cmds="$archive_cmds~\$RANLIB \$lib" -+ postinstall_cmds='$RANLIB $lib' -+ fi -+ ;; -+ -+aix4* | aix5*) -+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then -+ test "$enable_shared" = yes && enable_static=no -+ fi -+ ;; -+esac -+AC_MSG_RESULT([$enable_shared]) -+ -+AC_MSG_CHECKING([whether to build static libraries]) -+# Make sure either enable_shared or enable_static is yes. -+test "$enable_shared" = yes || enable_static=yes -+AC_MSG_RESULT([$enable_static]) -+ -+AC_LIBTOOL_CONFIG($1) -+ -+AC_LANG_POP -+CC="$lt_save_CC" -+])# AC_LIBTOOL_LANG_C_CONFIG -+ -+ -+# AC_LIBTOOL_LANG_CXX_CONFIG -+# -------------------------- -+# Ensure that the configuration vars for the C compiler are -+# suitably defined. Those variables are subsequently used by -+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -+[AC_LANG_PUSH(C++) -+AC_REQUIRE([AC_PROG_CXX]) -+AC_REQUIRE([_LT_AC_PROG_CXXCPP]) -+ -+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+_LT_AC_TAGVAR(allow_undefined_flag, $1)= -+_LT_AC_TAGVAR(always_export_symbols, $1)=no -+_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -+_LT_AC_TAGVAR(hardcode_direct, $1)=no -+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -+_LT_AC_TAGVAR(hardcode_automatic, $1)=no -+_LT_AC_TAGVAR(module_cmds, $1)= -+_LT_AC_TAGVAR(module_expsym_cmds, $1)= -+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -+_LT_AC_TAGVAR(no_undefined_flag, $1)= -+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no -+ -+# Dependencies to place before and after the object being linked: -+_LT_AC_TAGVAR(predep_objects, $1)= -+_LT_AC_TAGVAR(postdep_objects, $1)= -+_LT_AC_TAGVAR(predeps, $1)= -+_LT_AC_TAGVAR(postdeps, $1)= -+_LT_AC_TAGVAR(compiler_lib_search_path, $1)= -+ -+# Source file extension for C++ test sources. -+ac_ext=cpp -+ -+# Object file extension for compiled C++ test sources. -+objext=o -+_LT_AC_TAGVAR(objext, $1)=$objext -+ -+# Code to be used in simple compile tests -+lt_simple_compile_test_code="int some_variable = 0;\n" -+ -+# Code to be used in simple link tests -+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' -+ -+# ltmain only uses $CC for tagged configurations so make sure $CC is set. -+_LT_AC_SYS_COMPILER -+ -+# save warnings/boilerplate of simple test code -+_LT_COMPILER_BOILERPLATE -+_LT_LINKER_BOILERPLATE -+ -+# Allow CC to be a program name with arguments. -+lt_save_CC=$CC -+lt_save_LD=$LD -+lt_save_GCC=$GCC -+GCC=$GXX -+lt_save_with_gnu_ld=$with_gnu_ld -+lt_save_path_LD=$lt_cv_path_LD -+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then -+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -+else -+ unset lt_cv_prog_gnu_ld -+fi -+if test -n "${lt_cv_path_LDCXX+set}"; then -+ lt_cv_path_LD=$lt_cv_path_LDCXX -+else -+ unset lt_cv_path_LD -+fi -+test -z "${LDCXX+set}" || LD=$LDCXX -+CC=${CXX-"c++"} -+compiler=$CC -+_LT_AC_TAGVAR(compiler, $1)=$CC -+_LT_CC_BASENAME([$compiler]) -+ -+# We don't want -fno-exception wen compiling C++ code, so set the -+# no_builtin_flag separately -+if test "$GXX" = yes; then -+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -+else -+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -+fi -+ -+if test "$GXX" = yes; then -+ # Set up default GNU C++ configuration -+ -+ AC_PROG_LD -+ -+ # Check if GNU C++ uses GNU ld as the underlying linker, since the -+ # archiving commands below assume that GNU ld is being used. -+ if test "$with_gnu_ld" = yes; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' -+ -+ # If archive_cmds runs LD, not CC, wlarc should be empty -+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to -+ # investigate it a little bit more. (MM) -+ wlarc='${wl}' -+ -+ # ancient GNU ld didn't support --whole-archive et. al. -+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ -+ grep 'no-whole-archive' > /dev/null; then -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ else -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -+ fi -+ else -+ with_gnu_ld=no -+ wlarc= -+ -+ # A generic and very simple default shared library creation -+ # command for GNU C++ for the case where it uses the native -+ # linker, instead of GNU ld. If possible, this setting should -+ # overridden to take advantage of the native linker features on -+ # the platform it is being used on. -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' -+ fi -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' -+ -+else -+ GXX=no -+ with_gnu_ld=no -+ wlarc= -+fi -+ -+# PORTME: fill in a description of your system's C++ link characteristics -+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -+_LT_AC_TAGVAR(ld_shlibs, $1)=yes -+case $host_os in -+ aix3*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ aix4* | aix5*) -+ 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 -+ 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]].*|aix5*) -+ for ld_flag in $LDFLAGS; do -+ case $ld_flag in -+ *-brtl*) -+ aix_use_runtimelinking=yes -+ break -+ ;; -+ esac -+ 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. -+ -+ _LT_AC_TAGVAR(archive_cmds, $1)='' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes -+ -+ if test "$GXX" = 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 -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ else -+ # We have old collect2 -+ _LT_AC_TAGVAR(hardcode_direct, $1)=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 -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -+ 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 -+ -+ # It seems that -bexpall does not export symbols beginning with -+ # underscore (_), so it is better to generate a list of symbols to export. -+ _LT_AC_TAGVAR(always_export_symbols, $1)=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. -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' -+ # Determine the default libpath from the value encoded in an empty executable. -+ _LT_AC_SYS_LIBPATH_AIX -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" -+ -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" -+ else -+ if test "$host_cpu" = ia64; then -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ else -+ # Determine the default libpath from the value encoded in an empty executable. -+ _LT_AC_SYS_LIBPATH_AIX -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${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. -+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' -+ # -bexpall does not export symbols beginning with underscore (_) -+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes -+ # Exported symbols can be pulled into shared objects from archives -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes -+ # This is similar to how AIX traditionally builds its shared libraries. -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' -+ fi -+ fi -+ ;; -+ chorus*) -+ case $cc_basename in -+ *) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ ;; -+ -+ -+ cygwin* | mingw* | pw32*) -+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, -+ # as there is no search path for DLLs. -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported -+ _LT_AC_TAGVAR(always_export_symbols, $1)=no -+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes -+ -+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ # If the export-symbols file already is a .def file (1st line -+ # is EXPORTS), use it as is; otherwise, prepend... -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ else -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ darwin* | rhapsody*) -+ case $host_os in -+ rhapsody* | darwin1.[[012]]) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' -+ ;; -+ *) # Darwin 1.3 on -+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ else -+ case ${MACOSX_DEPLOYMENT_TARGET} in -+ 10.[[012]]) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ ;; -+ 10.*) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' -+ ;; -+ esac -+ fi -+ ;; -+ esac -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes -+ -+ if test "$GXX" = yes ; then -+ lt_int_apple_cc_single_mod=no -+ output_verbose_link_cmd='echo' -+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then -+ lt_int_apple_cc_single_mod=yes -+ fi -+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ fi -+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ fi -+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ case $cc_basename in -+ xlc*) -+ output_verbose_link_cmd='echo' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' -+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ ;; -+ *) -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ fi -+ ;; -+ -+ dgux*) -+ case $cc_basename in -+ ec++*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ ghcx*) -+ # Green Hills C++ Compiler -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ ;; -+ freebsd[[12]]*) -+ # C++ shared libraries reported to be fairly broken before switch to ELF -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ freebsd-elf*) -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+ ;; -+ freebsd* | kfreebsd*-gnu | dragonfly*) -+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF -+ # conventions -+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes -+ ;; -+ gnu*) -+ ;; -+ hpux9*) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, -+ # but as the default -+ # location of the library. -+ -+ case $cc_basename in -+ CC*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ aCC*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' -+ else -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ esac -+ ;; -+ hpux10*|hpux11*) -+ if test $with_gnu_ld = no; then -+ case $host_cpu in -+ hppa*64*) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ ;; -+ ia64*) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ ;; -+ *) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' -+ ;; -+ esac -+ fi -+ case $host_cpu in -+ hppa*64*) -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ ia64*) -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, -+ # but as the default -+ # location of the library. -+ ;; -+ *) -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, -+ # but as the default -+ # location of the library. -+ ;; -+ esac -+ -+ case $cc_basename in -+ CC*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ aCC*) -+ case $host_cpu in -+ hppa*64*|ia64*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' -+ ;; -+ *) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' -+ ;; -+ esac -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes; then -+ if test $with_gnu_ld = no; then -+ case $host_cpu in -+ ia64*|hppa*64*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' -+ ;; -+ *) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' -+ ;; -+ esac -+ fi -+ else -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ esac -+ ;; -+ irix5* | irix6*) -+ case $cc_basename in -+ CC*) -+ # SGI C++ -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ -+ # Archives containing C++ object files must be created using -+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is -+ # necessary to make sure instantiated templates are included -+ # in the archive. -+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' -+ ;; -+ *) -+ if test "$GXX" = yes; then -+ if test "$with_gnu_ld" = no; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' -+ fi -+ fi -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes -+ ;; -+ esac -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ ;; -+ linux*) -+ case $cc_basename in -+ KCC*) -+ # Kuck and Associates, Inc. (KAI) C++ Compiler -+ -+ # KCC will only create a shared library if the output file -+ # ends with ".so" (or ".sl" for HP-UX), so rename the library -+ # to its proper name (with version) after linking. -+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' -+ -+ # Archives containing C++ object files must be created using -+ # "CC -Bstatic", where "CC" is the KAI C++ compiler. -+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' -+ ;; -+ icpc*) -+ # Intel C++ -+ with_gnu_ld=yes -+ # version 8.0 and above of icpc choke on multiply defined symbols -+ # if we add $predep_objects and $postdep_objects, however 7.1 and -+ # earlier do not add the objects themselves. -+ case `$CC -V 2>&1` in -+ *"Version 7."*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ ;; -+ *) # Version 8.0 or newer -+ tmp_idyn= -+ case $host_cpu in -+ ia64*) tmp_idyn=' -i_dynamic';; -+ esac -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ ;; -+ esac -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' -+ ;; -+ pgCC*) -+ # Portland Group C++ compiler -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' -+ ;; -+ cxx*) -+ # Compaq C++ -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' -+ -+ runpath_var=LD_RUN_PATH -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ esac -+ ;; -+ lynxos*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ m88k*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ mvs*) -+ case $cc_basename in -+ cxx*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ ;; -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' -+ wlarc= -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ fi -+ # Workaround some broken pre-1.5 toolchains -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' -+ ;; -+ openbsd2*) -+ # C++ shared libraries are fairly broken -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ openbsd*) -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' -+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ fi -+ output_verbose_link_cmd='echo' -+ ;; -+ osf3*) -+ case $cc_basename in -+ KCC*) -+ # Kuck and Associates, Inc. (KAI) C++ Compiler -+ -+ # KCC will only create a shared library if the output file -+ # ends with ".so" (or ".sl" for HP-UX), so rename the library -+ # to its proper name (with version) after linking. -+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ -+ # Archives containing C++ object files must be created using -+ # "CC -Bstatic", where "CC" is the KAI C++ compiler. -+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' -+ -+ ;; -+ RCC*) -+ # Rational C++ 2.4.1 -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ cxx*) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' -+ -+ else -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ esac -+ ;; -+ osf4* | osf5*) -+ case $cc_basename in -+ KCC*) -+ # Kuck and Associates, Inc. (KAI) C++ Compiler -+ -+ # KCC will only create a shared library if the output file -+ # ends with ".so" (or ".sl" for HP-UX), so rename the library -+ # to its proper name (with version) after linking. -+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ -+ # Archives containing C++ object files must be created using -+ # the KAI C++ compiler. -+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' -+ ;; -+ RCC*) -+ # Rational C++ 2.4.1 -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ cxx*) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ -+ echo "-hidden">> $lib.exp~ -+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ -+ $rm $lib.exp' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' -+ -+ else -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ esac -+ ;; -+ psos*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ sco*) -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+ case $cc_basename in -+ CC*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ ;; -+ sunos4*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.x -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ lcc*) -+ # Lucid -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ ;; -+ solaris*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.2, 5.x and Centerline C++ -+ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes -+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ case $host_os in -+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; -+ *) -+ # The C++ compiler is used as linker so we must use $wl -+ # flag to pass the commands to the underlying system -+ # linker. We must also pass each convience library through -+ # to the system linker between allextract/defaultextract. -+ # The C++ compiler will combine linker options so we -+ # cannot just pass the convience library names through -+ # without $wl. -+ # Supported since Solaris 2.6 (maybe 2.5.1?) -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' -+ ;; -+ esac -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes -+ -+ output_verbose_link_cmd='echo' -+ -+ # Archives containing C++ object files must be created using -+ # "CC -xar", where "CC" is the Sun C++ compiler. This is -+ # necessary to make sure instantiated templates are included -+ # in the archive. -+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' -+ ;; -+ gcx*) -+ # Green Hills C++ Compiler -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' -+ -+ # The C++ compiler must be used to create the archive. -+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' -+ ;; -+ *) -+ # GNU C++ compiler with Solaris linker -+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then -+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' -+ if $CC --version | grep -v '^2\.7' > /dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" -+ else -+ # g++ 2.7 appears to require `-G' NOT `-shared' on this -+ # platform. -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" -+ fi -+ -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' -+ fi -+ ;; -+ esac -+ ;; -+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+ ;; -+ tandem*) -+ case $cc_basename in -+ NCC*) -+ # NonStop-UX NCC 3.20 -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ ;; -+ vxworks*) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+esac -+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no -+ -+_LT_AC_TAGVAR(GCC, $1)="$GXX" -+_LT_AC_TAGVAR(LD, $1)="$LD" -+ -+AC_LIBTOOL_POSTDEP_PREDEP($1) -+AC_LIBTOOL_PROG_COMPILER_PIC($1) -+AC_LIBTOOL_PROG_CC_C_O($1) -+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -+AC_LIBTOOL_PROG_LD_SHLIBS($1) -+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -+AC_LIBTOOL_SYS_LIB_STRIP -+AC_LIBTOOL_DLOPEN_SELF($1) -+ -+AC_LIBTOOL_CONFIG($1) -+ -+AC_LANG_POP -+CC=$lt_save_CC -+LDCXX=$LD -+LD=$lt_save_LD -+GCC=$lt_save_GCC -+with_gnu_ldcxx=$with_gnu_ld -+with_gnu_ld=$lt_save_with_gnu_ld -+lt_cv_path_LDCXX=$lt_cv_path_LD -+lt_cv_path_LD=$lt_save_path_LD -+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -+])# AC_LIBTOOL_LANG_CXX_CONFIG -+ -+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -+# ------------------------ -+# Figure out "hidden" library dependencies from verbose -+# compiler output when linking a shared library. -+# Parse the compiler output and extract the necessary -+# objects, libraries and library flags. -+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -+dnl we can't use the lt_simple_compile_test_code here, -+dnl because it contains code intended for an executable, -+dnl not a library. It's possible we should let each -+dnl tag define a new lt_????_link_test_code variable, -+dnl but it's only used here... -+ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -+ifelse([$1], [], -+[#! $SHELL -+ -+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -+# NOTE: Changes made to this file will be lost: look at ltmain.sh. -+# -+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -+# Free Software Foundation, Inc. -+# -+# This file is part of GNU Libtool: -+# Originally by Gordon Matzigkeit , 1996 -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -+# -+# As a special exception to the GNU General Public License, if you -+# distribute this file as part of a program that contains a -+# configuration script generated by Autoconf, you may include it under -+# the same distribution terms that you use for the rest of that program. -+ -+# A 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//" -+ -+# 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 -+ -+# The names of the tagged configurations supported by this script. -+available_tags= -+ -+# ### BEGIN LIBTOOL CONFIG], -+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) -+ -+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -+ -+# Shell to use when invoking shell scripts. -+SHELL=$lt_SHELL -+ -+# Whether or not to build shared libraries. -+build_libtool_libs=$enable_shared -+ -+# Whether or not to build static libraries. -+build_old_libs=$enable_static -+ -+# Whether or not to add -lc for building shared libraries. -+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) -+ -+# Whether or not to disallow shared libs when runtime libs are static -+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) -+ -+# Whether or not to optimize for fast installation. -+fast_install=$enable_fast_install -+ -+# 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 -+ -+# An echo program that does not interpret backslashes. -+echo=$lt_echo -+ -+# The archiver. -+AR=$lt_AR -+AR_FLAGS=$lt_AR_FLAGS -+ -+# A C compiler. -+LTCC=$lt_LTCC -+ -+# A language-specific compiler. -+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) -+ -+# Is the compiler the GNU C compiler? -+with_gcc=$_LT_AC_TAGVAR(GCC, $1) -+ -+# An ERE matcher. -+EGREP=$lt_EGREP -+ -+# The linker used to build libraries. -+LD=$lt_[]_LT_AC_TAGVAR(LD, $1) -+ -+# Whether we need hard or soft links. -+LN_S=$lt_LN_S -+ -+# A BSD-compatible nm program. -+NM=$lt_NM -+ -+# A symbol stripping program -+STRIP=$lt_STRIP -+ -+# Used to examine libraries when file_magic_cmd begins "file" -+MAGIC_CMD=$MAGIC_CMD -+ -+# Used on cygwin: DLL creation program. -+DLLTOOL="$DLLTOOL" -+ -+# Used on cygwin: object dumper. -+OBJDUMP="$OBJDUMP" -+ -+# Used on cygwin: assembler. -+AS="$AS" -+ -+# The name of the directory that contains temporary libtool files. -+objdir=$objdir -+ -+# How to create reloadable object files. -+reload_flag=$lt_reload_flag -+reload_cmds=$lt_reload_cmds -+ -+# How to pass a linker flag through the compiler. -+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) -+ -+# Object file suffix (normally "o"). -+objext="$ac_objext" -+ -+# Old archive suffix (normally "a"). -+libext="$libext" -+ -+# Shared library suffix (normally ".so"). -+shrext_cmds='$shrext_cmds' -+ -+# Executable file suffix (normally ""). -+exeext="$exeext" -+ -+# Additional compiler flags for building library objects. -+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -+pic_mode=$pic_mode -+ -+# What is the maximum length of a command? -+max_cmd_len=$lt_cv_sys_max_cmd_len -+ -+# Does compiler simultaneously support -c and -o options? -+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -+ -+# Must we lock files when doing compilation? -+need_locks=$lt_need_locks -+ -+# Do we need the lib prefix for modules? -+need_lib_prefix=$need_lib_prefix -+ -+# Do we need a version for libraries? -+need_version=$need_version -+ -+# Whether dlopen is supported. -+dlopen_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 -+ -+# Compiler flag to prevent dynamic linking. -+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) -+ -+# Compiler flag to turn off builtin functions. -+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -+ -+# Compiler flag to allow reflexive dlopens. -+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) -+ -+# Compiler flag to generate shared objects directly from archives. -+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) -+ -+# Compiler flag to generate thread-safe objects. -+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) -+ -+# Library versioning type. -+version_type=$version_type -+ -+# 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 -+ -+# Commands used to build and install an old-style archive. -+RANLIB=$lt_RANLIB -+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -+old_postinstall_cmds=$lt_old_postinstall_cmds -+old_postuninstall_cmds=$lt_old_postuninstall_cmds -+ -+# Create an old-style archive from a shared archive. -+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) -+ -+# Create a temporary old-style archive to link instead of a shared archive. -+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) -+ -+# Commands used to build and install a shared archive. -+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -+postinstall_cmds=$lt_postinstall_cmds -+postuninstall_cmds=$lt_postuninstall_cmds -+ -+# Commands used to build a loadable module (assumed same as above if empty) -+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) -+ -+# Commands to strip libraries. -+old_striplib=$lt_old_striplib -+striplib=$lt_striplib -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) -+ -+# The library search path used internally by the compiler when linking -+# a shared library. -+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) -+ -+# 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 -+ -+# Flag that allows shared libraries with undefined symbols to be built. -+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) -+ -+# Flag that forces no undefined symbols. -+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) -+ -+# Commands used to finish a libtool library installation in a directory. -+finish_cmds=$lt_finish_cmds -+ -+# Same as above, but a single script fragment to be evaled but not shown. -+finish_eval=$lt_finish_eval -+ -+# 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 -+ -+# This is the shared library runtime path variable. -+runpath_var=$runpath_var -+ -+# This is the shared library path variable. -+shlibpath_var=$shlibpath_var -+ -+# Is shlibpath searched before the hard-coded library search path? -+shlibpath_overrides_runpath=$shlibpath_overrides_runpath -+ -+# How to hardcode a shared library path into an executable. -+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) -+ -+# Whether we should hardcode library paths into libraries. -+hardcode_into_libs=$hardcode_into_libs -+ -+# Flag to hardcode \$libdir into a binary during linking. -+# This must work even if \$libdir does not exist. -+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) -+ -+# 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_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) -+ -+# Whether we need a single -rpath flag with a separated argument. -+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) -+ -+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -+# resulting binary. -+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) -+ -+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -+# resulting binary. -+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) -+ -+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -+# the resulting binary. -+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) -+ -+# 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=$_LT_AC_TAGVAR(hardcode_automatic, $1) -+ -+# Variables whose values should be saved in libtool wrapper scripts and -+# restored at relink time. -+variables_saved_for_relink="$variables_saved_for_relink" -+ -+# Whether libtool must link a program against all its dependency libraries. -+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) -+ -+# 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 -+ -+# Fix the shell variable \$srcfile for the compiler. -+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" -+ -+# Set to yes if exported symbols are required. -+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) -+ -+# The commands to list exported symbols. -+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) -+ -+# The commands to extract the exported symbol list from a shared archive. -+extract_expsyms_cmds=$lt_extract_expsyms_cmds -+ -+# Symbols that should not be listed in the preloaded symbols. -+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) -+ -+# Symbols that must always be exported. -+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) -+ -+ifelse([$1],[], -+[# ### END LIBTOOL CONFIG], -+[# ### END LIBTOOL TAG CONFIG: $tagname]) -+ -+__EOF__ -+ -+ifelse([$1],[], [ -+ case $host_os in -+ aix3*) -+ cat <<\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 -+EOF -+ ;; -+ esac -+ -+ # 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) -+ -+ mv -f "$cfgfile" "$ofile" || \ -+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") -+ chmod +x "$ofile" -+]) -+else -+ # If there is no Makefile yet, we rely on a make rule to execute -+ # `config.status --recheck' to rerun these tests and create the -+ # libtool script then. -+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` -+ if test -f "$ltmain_in"; then -+ test -f Makefile && make "$ltmain" -+ fi -+fi -+])# AC_LIBTOOL_CONFIG -+ -+ -+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -+# ------------------------------------------- -+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -+ -+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -+ -+if test "$GCC" = yes; then -+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -+ -+ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], -+ lt_cv_prog_compiler_rtti_exceptions, -+ [-fno-rtti -fno-exceptions], [], -+ [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -+fi -+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI -+ -+ -+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -+# --------------------------------- -+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -+[AC_REQUIRE([AC_CANONICAL_HOST]) -+AC_REQUIRE([AC_PROG_NM]) -+AC_REQUIRE([AC_OBJEXT]) -+# Check for command to grab the raw symbol name followed by C symbol from nm. -+AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -+[ -+# These are sane defaults that work on at least a few old systems. -+# [They come from Ultrix. What could be older than Ultrix?!! ;)] -+ -+# Character class describing NM global symbol codes. -+symcode='[[BCDEGRST]]' -+ -+# Regexp to match symbols that can be accessed directly from C. -+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' -+ -+# Transform an extracted symbol line into a proper C declaration -+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \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\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -+ -+# Define system-specific variables. -+case $host_os in -+aix*) -+ symcode='[[BCDT]]' -+ ;; -+cygwin* | mingw* | pw32*) -+ symcode='[[ABCDGISTW]]' -+ ;; -+hpux*) # Its linker distinguishes data from code symbols -+ if test "$host_cpu" = ia64; then -+ symcode='[[ABCDEGRST]]' -+ fi -+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" -+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -+ ;; -+linux*) -+ if test "$host_cpu" = ia64; then -+ symcode='[[ABCDGIRSTW]]' -+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" -+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -+ fi -+ ;; -+irix* | nonstopux*) -+ symcode='[[BCDEGRST]]' -+ ;; -+osf*) -+ symcode='[[BCDEGQRST]]' -+ ;; -+solaris* | sysv5*) -+ symcode='[[BDRT]]' -+ ;; -+sysv4) -+ symcode='[[DFNSTU]]' -+ ;; -+esac -+ -+# 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 -+ -+# If we're using GNU nm, then use its standard symbol codes. -+case `$NM -V 2>&1` in -+*GNU* | *'with BFD'*) -+ symcode='[[ABCDGIRSTW]]' ;; -+esac -+ -+# Try without a prefix undercore, 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. -+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" -+ -+ # Check to see that the pipe works correctly. -+ pipe_works=no -+ -+ rm -f conftest* -+ cat > conftest.$ac_ext < $nlist) && 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 < conftest.$ac_ext -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+EOF -+ # Now generate the symbol file. -+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' -+ -+ cat <> conftest.$ac_ext -+#if defined (__STDC__) && __STDC__ -+# define lt_ptr_t void * -+#else -+# define lt_ptr_t char * -+# define const -+#endif -+ -+/* The mapping between symbol names and symbols. */ -+const struct { -+ const char *name; -+ lt_ptr_t address; -+} -+lt_preloaded_symbols[[]] = -+{ -+EOF -+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext -+ cat <<\EOF >> conftest.$ac_ext -+ {0, (lt_ptr_t) 0} -+}; -+ -+#ifdef __cplusplus -+} -+#endif -+EOF -+ # Now try linking the two files. -+ mv conftest.$ac_objext conftstm.$ac_objext -+ lt_save_LIBS="$LIBS" -+ lt_save_CFLAGS="$CFLAGS" -+ LIBS="conftstm.$ac_objext" -+ CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" -+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then -+ pipe_works=yes -+ fi -+ LIBS="$lt_save_LIBS" -+ CFLAGS="$lt_save_CFLAGS" -+ else -+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD -+ fi -+ else -+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD -+ fi -+ else -+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD -+ fi -+ else -+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD -+ cat conftest.$ac_ext >&5 -+ fi -+ rm -f 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 -+]) -+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 -+ AC_MSG_RESULT(failed) -+else -+ AC_MSG_RESULT(ok) -+fi -+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -+ -+ -+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -+# --------------------------------------- -+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= -+ -+AC_MSG_CHECKING([for $compiler option to produce PIC]) -+ ifelse([$1],[CXX],[ -+ # C++ specific cases for pic, static, wl, etc. -+ if test "$GXX" = yes; then -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' -+ -+ case $host_os in -+ aix*) -+ # All AIX code is PIC. -+ if test "$host_cpu" = ia64; then -+ # AIX 5 now supports IA64 processor -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ fi -+ ;; -+ amigaos*) -+ # FIXME: we need at least 68020 code to build shared libraries, but -+ # adding the `-m68020' flag to GCC prevents building anything better, -+ # like `-m68040'. -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' -+ ;; -+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) -+ # PIC is the default for these OSes. -+ ;; -+ mingw* | os2* | pw32*) -+ # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' -+ ;; -+ darwin* | rhapsody*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' -+ ;; -+ *djgpp*) -+ # DJGPP does not support shared libraries at all -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -+ ;; -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic -+ fi -+ ;; -+ hpux*) -+ # 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*) -+ ;; -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' -+ ;; -+ esac -+ ;; -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' -+ ;; -+ esac -+ else -+ case $host_os in -+ aix4* | aix5*) -+ # All AIX code is PIC. -+ if test "$host_cpu" = ia64; then -+ # AIX 5 now supports IA64 processor -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ else -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' -+ fi -+ ;; -+ chorus*) -+ case $cc_basename in -+ cxch68*) -+ # Green Hills C++ Compiler -+ # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" -+ ;; -+ esac -+ ;; -+ darwin*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ case $cc_basename in -+ xlc*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ ;; -+ esac -+ ;; -+ dgux*) -+ case $cc_basename in -+ ec++*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ ;; -+ ghcx*) -+ # Green Hills C++ Compiler -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ freebsd* | kfreebsd*-gnu | dragonfly*) -+ # FreeBSD uses GNU C++ -+ ;; -+ hpux9* | hpux10* | hpux11*) -+ case $cc_basename in -+ CC*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" -+ if test "$host_cpu" != ia64; then -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' -+ fi -+ ;; -+ aCC*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" -+ case $host_cpu in -+ hppa*64*|ia64*) -+ # +Z the default -+ ;; -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' -+ ;; -+ esac -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ irix5* | irix6* | nonstopux*) -+ case $cc_basename in -+ CC*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' -+ # CC pic flag -KPIC is the default. -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ linux*) -+ case $cc_basename in -+ KCC*) -+ # KAI C++ Compiler -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' -+ ;; -+ icpc* | ecpc*) -+ # Intel C++ -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' -+ ;; -+ pgCC*) -+ # Portland Group C++ compiler. -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ ;; -+ cxx*) -+ # Compaq C++ -+ # Make sure the PIC flag is empty. It appears that all Alpha -+ # Linux and Compaq Tru64 Unix objects are PIC. -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ lynxos*) -+ ;; -+ m88k*) -+ ;; -+ mvs*) -+ case $cc_basename in -+ cxx*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ ;; -+ osf3* | osf4* | osf5*) -+ case $cc_basename in -+ KCC*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' -+ ;; -+ RCC*) -+ # Rational C++ 2.4.1 -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' -+ ;; -+ cxx*) -+ # Digital/Compaq C++ -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ # Make sure the PIC flag is empty. It appears that all Alpha -+ # Linux and Compaq Tru64 Unix objects are PIC. -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ psos*) -+ ;; -+ sco*) -+ case $cc_basename in -+ CC*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ solaris*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.2, 5.x and Centerline C++ -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' -+ ;; -+ gcx*) -+ # Green Hills C++ Compiler -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ sunos4*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.x -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ ;; -+ lcc*) -+ # Lucid -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ tandem*) -+ case $cc_basename in -+ NCC*) -+ # NonStop-UX NCC 3.20 -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ unixware*) -+ ;; -+ vxworks*) -+ ;; -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no -+ ;; -+ esac -+ fi -+], -+[ -+ if test "$GCC" = yes; then -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' -+ -+ case $host_os in -+ aix*) -+ # All AIX code is PIC. -+ if test "$host_cpu" = ia64; then -+ # AIX 5 now supports IA64 processor -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ fi -+ ;; -+ -+ amigaos*) -+ # FIXME: we need at least 68020 code to build shared libraries, but -+ # adding the `-m68020' flag to GCC prevents building anything better, -+ # like `-m68040'. -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' -+ ;; -+ -+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) -+ # PIC is the default for these OSes. -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' -+ ;; -+ -+ darwin* | rhapsody*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' -+ ;; -+ -+ msdosdjgpp*) -+ # Just because we use GCC doesn't mean we suddenly get shared libraries -+ # on systems that don't support them. -+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no -+ enable_shared=no -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic -+ fi -+ ;; -+ -+ hpux*) -+ # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' -+ ;; -+ esac -+ ;; -+ -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' -+ ;; -+ esac -+ else -+ # PORTME Check for flag to pass linker flags through the system compiler. -+ case $host_os in -+ aix*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ if test "$host_cpu" = ia64; then -+ # AIX 5 now supports IA64 processor -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ else -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' -+ fi -+ ;; -+ darwin*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ case $cc_basename in -+ xlc*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ ;; -+ esac -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' -+ ;; -+ -+ hpux9* | hpux10* | hpux11*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-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_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' -+ ;; -+ esac -+ # Is there a better lt_prog_compiler_static that works with the bundled CC? -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' -+ ;; -+ -+ irix5* | irix6* | nonstopux*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ # PIC (with -KPIC) is the default. -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' -+ ;; -+ -+ newsos6) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ ;; -+ -+ linux*) -+ case $cc_basename in -+ icc* | ecc*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' -+ ;; -+ pgcc* | pgf77* | pgf90* | pgf95*) -+ # Portland Group compilers (*not* the Pentium gcc compiler, -+ # which looks to be a dead project) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ ;; -+ ccc*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ # All Alpha code is PIC. -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' -+ ;; -+ esac -+ ;; -+ -+ osf3* | osf4* | osf5*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ # All OSF/1 code is PIC. -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' -+ ;; -+ -+ sco3.2v5*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' -+ ;; -+ -+ solaris*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ case $cc_basename in -+ f77* | f90* | f95*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; -+ esac -+ ;; -+ -+ sunos4*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ ;; -+ -+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec ;then -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ fi -+ ;; -+ -+ unicos*) -+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' -+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no -+ ;; -+ -+ uts4*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' -+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' -+ ;; -+ -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no -+ ;; -+ esac -+ fi -+]) -+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) -+ -+# -+# Check to make sure the PIC flag actually works. -+# -+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then -+ AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], -+ _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), -+ [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], -+ [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in -+ "" | " "*) ;; -+ *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; -+ esac], -+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -+fi -+case $host_os in -+ # For platforms which do not support PIC, -DPIC is meaningless: -+ *djgpp*) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -+ ;; -+ *) -+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" -+ ;; -+esac -+]) -+ -+ -+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -+# ------------------------------------ -+# See if the linker supports building shared libraries. -+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -+ifelse([$1],[CXX],[ -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ case $host_os in -+ aix4* | aix5*) -+ # 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 -+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' -+ else -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' -+ fi -+ ;; -+ pw32*) -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" -+ ;; -+ cygwin* | mingw*) -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' -+ ;; -+ linux*) -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=no -+ ;; -+ *) -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ ;; -+ esac -+],[ -+ runpath_var= -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)= -+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no -+ _LT_AC_TAGVAR(archive_cmds, $1)= -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)= -+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= -+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -+ _LT_AC_TAGVAR(hardcode_automatic, $1)=no -+ _LT_AC_TAGVAR(module_cmds, $1)= -+ _LT_AC_TAGVAR(module_expsym_cmds, $1)= -+ _LT_AC_TAGVAR(always_export_symbols, $1)=no -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ # include_expsyms should be a list of space-separated symbols to be *always* -+ # included in the symbol list -+ _LT_AC_TAGVAR(include_expsyms, $1)= -+ # 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'. -+ _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" -+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -+ # platforms (ab)use it in PIC code, but their linkers get confused if -+ # the symbol is explicitly referenced. Since portable code cannot -+ # rely on this symbol name, it's probably fine to never include it in -+ # preloaded symbol tables. -+ extract_expsyms_cmds= -+ # Just being paranoid about ensuring that cc_basename is set. -+ _LT_CC_BASENAME([$compiler]) -+ case $host_os in -+ cygwin* | mingw* | pw32*) -+ # 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 -+ ;; -+ openbsd*) -+ with_gnu_ld=no -+ ;; -+ esac -+ -+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes -+ if test "$with_gnu_ld" = 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 -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${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 -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ else -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -+ fi -+ supports_anon_versioning=no -+ case `$LD -v 2>/dev/null` in -+ *\ [[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 -+ aix3* | aix4* | aix5*) -+ # On AIX/PPC, the GNU linker is very broken -+ if test "$host_cpu" != ia64; then -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ cat <&2 -+ -+*** Warning: the GNU linker, at least up to release 2.9.1, is reported -+*** to be unable to reliably create shared libraries on AIX. -+*** Therefore, libtool is disabling shared libraries support. If you -+*** really care for shared libraries, you may want to modify your PATH -+*** so that a non-GNU linker is found, and then restart. -+ -+EOF -+ fi -+ ;; -+ -+ amigaos*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$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)' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ -+ # Samuel A. Falvo II reports -+ # that the semantics of dynamic libraries on AmigaOS, at least up -+ # to version 4, is to share data among multiple programs linked -+ # with the same dynamic library. Since this doesn't match the -+ # behavior of shared libraries on other platforms, we can't use -+ # them. -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ -+ beos*) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported -+ # Joseph Beckenbach says some releases of gcc -+ # support --undefined. This deserves some investigation. FIXME -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ else -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ -+ cygwin* | mingw* | pw32*) -+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, -+ # as there is no search path for DLLs. -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported -+ _LT_AC_TAGVAR(always_export_symbols, $1)=no -+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' -+ -+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ # If the export-symbols file already is a .def file (1st line -+ # is EXPORTS), use it as is; otherwise, prepend... -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='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}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ else -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ -+ linux*) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ tmp_addflag= -+ case $cc_basename,$host_cpu in -+ pgcc*) # Portland Group C compiler -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' -+ tmp_addflag=' $pic_flag' -+ ;; -+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$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' ;; -+ esac -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ -+ if test $supports_anon_versioning = yes; then -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -+ $echo "local: *; };" >> $output_objdir/$libname.ver~ -+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' -+ fi -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=no -+ else -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' -+ wlarc= -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ fi -+ ;; -+ -+ solaris* | sysv5*) -+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ cat <&2 -+ -+*** Warning: The releases 2.8.* of the GNU linker cannot reliably -+*** create shared libraries on Solaris systems. Therefore, libtool -+*** is disabling shared libraries support. We urge you to upgrade GNU -+*** binutils to release 2.9.1 or newer. Another option is to modify -+*** your PATH or compiler configuration so that the native linker is -+*** used, and then restart. -+ -+EOF -+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ -+ sunos4*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ wlarc= -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ *) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ fi -+ ;; -+ esac -+ -+ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then -+ runpath_var= -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -+ fi -+ else -+ # PORTME fill in a description of your system's linker (not GNU ld) -+ case $host_os in -+ aix3*) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported -+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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. -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ if test "$GCC" = yes && test -z "$link_static_flag"; then -+ # Neither direct hardcoding nor static linking is supported with a -+ # broken collect2. -+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported -+ fi -+ ;; -+ -+ aix4* | aix5*) -+ 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 -+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' -+ else -+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$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]].*|aix5*) -+ 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. -+ -+ _LT_AC_TAGVAR(archive_cmds, $1)='' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes -+ -+ 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 -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ else -+ # We have old collect2 -+ _LT_AC_TAGVAR(hardcode_direct, $1)=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 -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -+ 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 -+ -+ # It seems that -bexpall does not export symbols beginning with -+ # underscore (_), so it is better to generate a list of symbols to export. -+ _LT_AC_TAGVAR(always_export_symbols, $1)=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. -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' -+ # Determine the default libpath from the value encoded in an empty executable. -+ _LT_AC_SYS_LIBPATH_AIX -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" -+ else -+ if test "$host_cpu" = ia64; then -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ else -+ # Determine the default libpath from the value encoded in an empty executable. -+ _LT_AC_SYS_LIBPATH_AIX -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${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. -+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' -+ # -bexpall does not export symbols beginning with underscore (_) -+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes -+ # Exported symbols can be pulled into shared objects from archives -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes -+ # This is similar to how AIX traditionally builds its shared libraries. -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' -+ fi -+ fi -+ ;; -+ -+ amigaos*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$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)' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ # see comment about different semantics on the GNU ld section -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ -+ bsdi[[45]]*) -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic -+ ;; -+ -+ cygwin* | mingw* | pw32*) -+ # 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. -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=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. -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' -+ # The linker will automatically build a .lib file if we build a DLL. -+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' -+ # FIXME: Should let the user specify the lib program. -+ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' -+ _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' -+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes -+ ;; -+ -+ darwin* | rhapsody*) -+ case $host_os in -+ rhapsody* | darwin1.[[012]]) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' -+ ;; -+ *) # Darwin 1.3 on -+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ else -+ case ${MACOSX_DEPLOYMENT_TARGET} in -+ 10.[[012]]) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ ;; -+ 10.*) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' -+ ;; -+ esac -+ fi -+ ;; -+ esac -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes -+ if test "$GCC" = yes ; then -+ output_verbose_link_cmd='echo' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ case $cc_basename in -+ xlc*) -+ output_verbose_link_cmd='echo' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' -+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ ;; -+ *) -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ fi -+ ;; -+ -+ dgux*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ freebsd1*) -+ _LT_AC_TAGVAR(ld_shlibs, $1)=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*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ # Unfortunately, older versions of FreeBSD 2 do not have this feature. -+ freebsd2*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. -+ freebsd* | kfreebsd*-gnu | dragonfly*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ hpux9*) -+ if test "$GCC" = yes; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$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 -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' -+ ;; -+ -+ hpux10* | hpux11*) -+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*|ia64*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ *) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ esac -+ else -+ case $host_cpu in -+ hppa*64*|ia64*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ *) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ esac -+ fi -+ if test "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ ia64*) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ ;; -+ *) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ ;; -+ esac -+ fi -+ ;; -+ -+ irix5* | irix6* | nonstopux*) -+ if test "$GCC" = yes; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' -+ fi -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF -+ fi -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ newsos6) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ openbsd*) -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' -+ else -+ case $host_os in -+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' -+ ;; -+ *) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' -+ ;; -+ esac -+ fi -+ ;; -+ -+ os2*) -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported -+ _LT_AC_TAGVAR(archive_cmds, $1)='$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' -+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' -+ ;; -+ -+ osf3*) -+ if test "$GCC" = yes; then -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ fi -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ ;; -+ -+ osf4* | osf5*) # as osf3* with the addition of -msym flag -+ if test "$GCC" = yes; then -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' -+ else -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ -+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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 -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' -+ fi -+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: -+ ;; -+ -+ sco3.2v5*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ ;; -+ -+ solaris*) -+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' -+ if test "$GCC" = yes; then -+ wlarc='${wl}' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' -+ else -+ wlarc='' -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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' -+ fi -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ case $host_os in -+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; -+ *) -+ # The compiler driver will combine linker options so we -+ # cannot just pass the convience library names through -+ # without $wl, iff we do not link with $LD. -+ # Luckily, gcc supports the same syntax we need for Sun Studio. -+ # Supported since Solaris 2.6 (maybe 2.5.1?) -+ case $wlarc in -+ '') -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; -+ *) -+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; -+ esac ;; -+ esac -+ _LT_AC_TAGVAR(link_all_deplibs, $1)=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. -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' -+ fi -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ sysv4) -+ case $host_vendor in -+ sni) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? -+ ;; -+ siemens) -+ ## LD is ld it makes a PLAMLIB -+ ## CC just makes a GrossModule. -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no -+ ;; -+ motorola) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie -+ ;; -+ esac -+ runpath_var='LD_RUN_PATH' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ sysv4.3*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes -+ fi -+ ;; -+ -+ sysv4.2uw2*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes -+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ hardcode_runpath_var=yes -+ runpath_var=LD_RUN_PATH -+ ;; -+ -+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) -+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' -+ if test "$GCC" = yes; then -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ else -+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ fi -+ runpath_var='LD_RUN_PATH' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ sysv5*) -+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' -+ # $CC -shared without GNU ld will not create a library from C++ -+ # object files and a static libstdc++, better avoid it by now -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ runpath_var='LD_RUN_PATH' -+ ;; -+ -+ uts4*) -+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' -+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no -+ ;; -+ -+ *) -+ _LT_AC_TAGVAR(ld_shlibs, $1)=no -+ ;; -+ esac -+ fi -+]) -+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = 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 -+ -+# -+# Do we need to explicitly link libc? -+# -+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -+x|xyes) -+ # Assume -lc should be added -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes -+ -+ if test "$enable_shared" = yes && test "$GCC" = yes; then -+ case $_LT_AC_TAGVAR(archive_cmds, $1) 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. -+ AC_MSG_CHECKING([whether -lc should be explicitly linked in]) -+ $rm conftest* -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ -+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then -+ soname=conftest -+ lib=conftest -+ libobjs=conftest.$ac_objext -+ deplibs= -+ wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) -+ compiler_flags=-v -+ linker_flags=-v -+ verstring= -+ output_objdir=. -+ libname=conftest -+ lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)= -+ if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) -+ then -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -+ else -+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes -+ fi -+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag -+ else -+ cat conftest.err 1>&5 -+ fi -+ $rm conftest* -+ AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) -+ ;; -+ esac -+ fi -+ ;; -+esac -+])# AC_LIBTOOL_PROG_LD_SHLIBS -+ -+ -+# _LT_AC_FILE_LTDLL_C -+# ------------------- -+# Be careful that the start marker always follows a newline. -+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -+# /* ltdll.c starts here */ -+# #define WIN32_LEAN_AND_MEAN -+# #include -+# #undef WIN32_LEAN_AND_MEAN -+# #include -+# -+# #ifndef __CYGWIN__ -+# # ifdef __CYGWIN32__ -+# # define __CYGWIN__ __CYGWIN32__ -+# # endif -+# #endif -+# -+# #ifdef __cplusplus -+# extern "C" { -+# #endif -+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -+# #ifdef __cplusplus -+# } -+# #endif -+# -+# #ifdef __CYGWIN__ -+# #include -+# DECLARE_CYGWIN_DLL( DllMain ); -+# #endif -+# HINSTANCE __hDllInstance_base; -+# -+# BOOL APIENTRY -+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -+# { -+# __hDllInstance_base = hInst; -+# return TRUE; -+# } -+# /* ltdll.c ends here */ -+])# _LT_AC_FILE_LTDLL_C -+ -+ -+# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -+# --------------------------------- -+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) -+ -+ -+# old names -+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) -+ -+# This is just to silence aclocal about the macro not being used -+ifelse([AC_DISABLE_FAST_INSTALL]) -+ -+AC_DEFUN([LT_AC_PROG_GCJ], -+[AC_CHECK_TOOL(GCJ, gcj, no) -+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" -+ AC_SUBST(GCJFLAGS) -+]) -+ -+AC_DEFUN([LT_AC_PROG_RC], -+[AC_CHECK_TOOL(RC, windres, no) -+]) -+ -+# NOTE: This macro has been submitted for inclusion into # -+# GNU Autoconf as AC_PROG_SED. When it is available in # -+# a released version of Autoconf we should remove this # -+# macro and use it instead. # -+# LT_AC_PROG_SED -+# -------------- -+# Check for a fully-functional sed program, that truncates -+# as few characters as possible. Prefer GNU sed if found. -+AC_DEFUN([LT_AC_PROG_SED], -+[AC_MSG_CHECKING([for a sed that does not truncate output]) -+AC_CACHE_VAL(lt_cv_path_SED, -+[# Loop through the user's path and test for sed and gsed. -+# Then use that list of sed's as ones to test for truncation. -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for lt_ac_prog in sed gsed; do -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then -+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" -+ fi -+ done -+ done -+done -+lt_ac_max=0 -+lt_ac_count=0 -+# Add /usr/xpg4/bin/sed as it is typically found on Solaris -+# along with /bin/sed that truncates output. -+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do -+ test ! -f $lt_ac_sed && continue -+ cat /dev/null > conftest.in -+ lt_ac_count=0 -+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in -+ # Check for GNU sed and select it if it is found. -+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then -+ lt_cv_path_SED=$lt_ac_sed -+ break -+ fi -+ while true; do -+ cat conftest.in conftest.in >conftest.tmp -+ mv conftest.tmp conftest.in -+ cp conftest.in conftest.nl -+ echo >>conftest.nl -+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break -+ cmp -s conftest.out conftest.nl || break -+ # 10000 chars as input seems more than enough -+ test $lt_ac_count -gt 10 && break -+ lt_ac_count=`expr $lt_ac_count + 1` -+ if test $lt_ac_count -gt $lt_ac_max; then -+ lt_ac_max=$lt_ac_count -+ lt_cv_path_SED=$lt_ac_sed -+ fi -+ done -+done -+]) -+SED=$lt_cv_path_SED -+AC_MSG_RESULT([$SED]) -+]) -+ -+# longdouble.m4 serial 1 (gettext-0.12) -+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Bruno Haible. -+dnl Test whether the compiler supports the 'long double' type. -+dnl Prerequisite: AC_PROG_CC -+ -+AC_DEFUN([gt_TYPE_LONGDOUBLE], -+[ -+ AC_CACHE_CHECK([for long double], gt_cv_c_long_double, -+ [if test "$GCC" = yes; then -+ gt_cv_c_long_double=yes -+ else -+ AC_TRY_COMPILE([ -+ /* The Stardent Vistra knows sizeof(long double), but does not support it. */ -+ long double foo = 0.0; -+ /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ -+ int array [2*(sizeof(long double) >= sizeof(double)) - 1]; -+ ], , -+ gt_cv_c_long_double=yes, gt_cv_c_long_double=no) -+ fi]) -+ if test $gt_cv_c_long_double = yes; then -+ AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) -+ fi -+]) -+ -+# longlong.m4 serial 5 -+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Paul Eggert. -+ -+# Define HAVE_LONG_LONG if 'long long' works. -+ -+AC_DEFUN([gl_AC_TYPE_LONG_LONG], -+[ -+ AC_CACHE_CHECK([for long long], ac_cv_type_long_long, -+ [AC_TRY_LINK([long long ll = 1LL; int i = 63;], -+ [long long llmax = (long long) -1; -+ return ll << i | ll >> i | llmax / ll | llmax % ll;], -+ ac_cv_type_long_long=yes, -+ ac_cv_type_long_long=no)]) -+ if test $ac_cv_type_long_long = yes; then -+ AC_DEFINE(HAVE_LONG_LONG, 1, -+ [Define if you have the 'long long' type.]) -+ fi -+]) -+ -+# nls.m4 serial 2 (gettext-0.14.3) -+dnl Copyright (C) 1995-2003, 2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+dnl -+dnl This file can can be used in projects which are not available under -+dnl the GNU General Public License or the GNU Library General Public -+dnl License but which still want to provide support for the GNU gettext -+dnl functionality. -+dnl Please note that the actual code of the GNU gettext library is covered -+dnl by the GNU Library General Public License, and the rest of the GNU -+dnl gettext package package is covered by the GNU General Public License. -+dnl They are *not* in the public domain. -+ -+dnl Authors: -+dnl Ulrich Drepper , 1995-2000. -+dnl Bruno Haible , 2000-2003. -+ -+AC_PREREQ(2.50) -+ -+AC_DEFUN([AM_NLS], -+[ -+ AC_MSG_CHECKING([whether NLS is requested]) -+ dnl Default is enabled NLS -+ AC_ARG_ENABLE(nls, -+ [ --disable-nls do not use Native Language Support], -+ USE_NLS=$enableval, USE_NLS=yes) -+ AC_MSG_RESULT($USE_NLS) -+ AC_SUBST(USE_NLS) -+]) -+ -+AC_DEFUN([AM_MKINSTALLDIRS], -+[ -+ dnl Tell automake >= 1.10 to complain if mkinstalldirs is missing. -+ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([mkinstalldirs])]) -+ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly -+ dnl find the mkinstalldirs script in another subdir but $(top_srcdir). -+ dnl Try to locate it. -+ MKINSTALLDIRS= -+ if test -n "$ac_aux_dir"; then -+ case "$ac_aux_dir" in -+ /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; -+ *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; -+ esac -+ fi -+ if test -z "$MKINSTALLDIRS"; then -+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" -+ fi -+ AC_SUBST(MKINSTALLDIRS) -+]) -+ -+# po.m4 serial 7 (gettext-0.14.3) -+dnl Copyright (C) 1995-2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+dnl -+dnl This file can can be used in projects which are not available under -+dnl the GNU General Public License or the GNU Library General Public -+dnl License but which still want to provide support for the GNU gettext -+dnl functionality. -+dnl Please note that the actual code of the GNU gettext library is covered -+dnl by the GNU Library General Public License, and the rest of the GNU -+dnl gettext package package is covered by the GNU General Public License. -+dnl They are *not* in the public domain. -+ -+dnl Authors: -+dnl Ulrich Drepper , 1995-2000. -+dnl Bruno Haible , 2000-2003. -+ -+AC_PREREQ(2.50) -+ -+dnl Checks for all prerequisites of the po subdirectory. -+AC_DEFUN([AM_PO_SUBDIRS], -+[ -+ AC_REQUIRE([AC_PROG_MAKE_SET])dnl -+ AC_REQUIRE([AC_PROG_INSTALL])dnl -+ AC_REQUIRE([AM_MKINSTALLDIRS])dnl -+ AC_REQUIRE([AM_NLS])dnl -+ -+ dnl Perform the following tests also if --disable-nls has been given, -+ dnl because they are needed for "make dist" to work. -+ -+ dnl Search for GNU msgfmt in the PATH. -+ dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. -+ dnl The second test excludes FreeBSD msgfmt. -+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, -+ [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && -+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], -+ :) -+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) -+ -+ dnl Search for GNU xgettext 0.12 or newer in the PATH. -+ dnl The first test excludes Solaris xgettext and early GNU xgettext versions. -+ dnl The second test excludes FreeBSD xgettext. -+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, -+ [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && -+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], -+ :) -+ dnl Remove leftover from FreeBSD xgettext call. -+ rm -f messages.po -+ -+ dnl Search for GNU msgmerge 0.11 or newer in the PATH. -+ AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, -+ [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) -+ -+ dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. -+ dnl Test whether we really found GNU msgfmt. -+ if test "$GMSGFMT" != ":"; then -+ dnl If it is no GNU msgfmt we define it as : so that the -+ dnl Makefiles still can work. -+ if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && -+ (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -+ : ; -+ else -+ GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` -+ AC_MSG_RESULT( -+ [found $GMSGFMT program is not GNU msgfmt; ignore it]) -+ GMSGFMT=":" -+ fi -+ fi -+ -+ dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. -+ dnl Test whether we really found GNU xgettext. -+ if test "$XGETTEXT" != ":"; then -+ dnl If it is no GNU xgettext we define it as : so that the -+ dnl Makefiles still can work. -+ if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && -+ (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -+ : ; -+ else -+ AC_MSG_RESULT( -+ [found xgettext program is not GNU xgettext; ignore it]) -+ XGETTEXT=":" -+ fi -+ dnl Remove leftover from FreeBSD xgettext call. -+ rm -f messages.po -+ fi -+ -+ AC_OUTPUT_COMMANDS([ -+ for ac_file in $CONFIG_FILES; do -+ # Support "outfile[:infile[:infile...]]" -+ case "$ac_file" in -+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; -+ esac -+ # PO directories have a Makefile.in generated from Makefile.in.in. -+ case "$ac_file" in */Makefile.in) -+ # Adjust a relative srcdir. -+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` -+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" -+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` -+ # In autoconf-2.13 it is called $ac_given_srcdir. -+ # In autoconf-2.50 it is called $srcdir. -+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" -+ case "$ac_given_srcdir" in -+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; -+ /*) top_srcdir="$ac_given_srcdir" ;; -+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;; -+ esac -+ # Treat a directory as a PO directory if and only if it has a -+ # POTFILES.in file. This allows packages to have multiple PO -+ # directories under different names or in different locations. -+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then -+ rm -f "$ac_dir/POTFILES" -+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" -+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" -+ POMAKEFILEDEPS="POTFILES.in" -+ # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend -+ # on $ac_dir but don't depend on user-specified configuration -+ # parameters. -+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then -+ # The LINGUAS file contains the set of available languages. -+ if test -n "$OBSOLETE_ALL_LINGUAS"; then -+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" -+ fi -+ ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` -+ # Hide the ALL_LINGUAS assigment from automake. -+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_' -+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" -+ else -+ # The set of available languages was given in configure.in. -+ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' -+ fi -+ # Compute POFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) -+ # Compute UPDATEPOFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) -+ # Compute DUMMYPOFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) -+ # Compute GMOFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) -+ case "$ac_given_srcdir" in -+ .) srcdirpre= ;; -+ *) srcdirpre='$(srcdir)/' ;; -+ esac -+ POFILES= -+ UPDATEPOFILES= -+ DUMMYPOFILES= -+ GMOFILES= -+ for lang in $ALL_LINGUAS; do -+ POFILES="$POFILES $srcdirpre$lang.po" -+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" -+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop" -+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo" -+ done -+ # CATALOGS depends on both $ac_dir and the user's LINGUAS -+ # environment variable. -+ INST_LINGUAS= -+ if test -n "$ALL_LINGUAS"; then -+ for presentlang in $ALL_LINGUAS; do -+ useit=no -+ if test "%UNSET%" != "$LINGUAS"; then -+ desiredlanguages="$LINGUAS" -+ else -+ desiredlanguages="$ALL_LINGUAS" -+ fi -+ for desiredlang in $desiredlanguages; do -+ # Use the presentlang catalog if desiredlang is -+ # a. equal to presentlang, or -+ # b. a variant of presentlang (because in this case, -+ # presentlang can be used as a fallback for messages -+ # which are not translated in the desiredlang catalog). -+ case "$desiredlang" in -+ "$presentlang"*) useit=yes;; -+ esac -+ done -+ if test $useit = yes; then -+ INST_LINGUAS="$INST_LINGUAS $presentlang" -+ fi -+ done -+ fi -+ CATALOGS= -+ if test -n "$INST_LINGUAS"; then -+ for lang in $INST_LINGUAS; do -+ CATALOGS="$CATALOGS $lang.gmo" -+ done - fi -+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" -+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" -+ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do -+ if test -f "$f"; then -+ case "$f" in -+ *.orig | *.bak | *~) ;; -+ *) cat "$f" >> "$ac_dir/Makefile" ;; -+ esac -+ fi -+ done - fi -- fi -- done -+ ;; -+ esac -+ done], -+ [# Capture the value of obsolete ALL_LINGUAS because we need it to compute -+ # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it -+ # from automake. -+ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' -+ # Capture the value of LINGUAS because we need it to compute CATALOGS. -+ LINGUAS="${LINGUAS-%UNSET%}" -+ ]) -+]) -+ -+dnl Postprocesses a Makefile in a directory containing PO files. -+AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], -+[ -+ # When this code is run, in config.status, two variables have already been -+ # set: -+ # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, -+ # - LINGUAS is the value of the environment variable LINGUAS at configure -+ # time. -+ -+changequote(,)dnl -+ # Adjust a relative srcdir. -+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` -+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" -+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` -+ # In autoconf-2.13 it is called $ac_given_srcdir. -+ # In autoconf-2.50 it is called $srcdir. -+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" -+ case "$ac_given_srcdir" in -+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; -+ /*) top_srcdir="$ac_given_srcdir" ;; -+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;; -+ esac -+ -+ # Find a way to echo strings without interpreting backslash. -+ if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then -+ gt_echo='echo' -+ else -+ if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then -+ gt_echo='printf %s\n' -+ else -+ echo_func () { -+ cat < "$ac_file.tmp" -+ if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then -+ # Add dependencies that cannot be formulated as a simple suffix rule. -+ for lang in $ALL_LINGUAS; do -+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` -+ cat >> "$ac_file.tmp" < /dev/null; then -+ # Add dependencies that cannot be formulated as a simple suffix rule. -+ for lang in $ALL_LINGUAS; do -+ frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` -+ cat >> "$ac_file.tmp" <> "$ac_file.tmp" < -+#include -+/* The string "%2$d %1$d", with dollar characters protected from the shell's -+ dollar expansion (possibly an autoconf bug). */ -+static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; -+static char buf[100]; -+int main () -+{ -+ sprintf (buf, format, 33, 55); -+ return (strcmp (buf, "55 33") != 0); -+}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, -+ [ -+ AC_EGREP_CPP(notposix, [ -+#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ -+ notposix -+#endif -+ ], gt_cv_func_printf_posix="guessing no", -+ gt_cv_func_printf_posix="guessing yes") -+ ]) -+ ]) -+ case $gt_cv_func_printf_posix in -+ *yes) -+ AC_DEFINE(HAVE_POSIX_PRINTF, 1, -+ [Define if your printf() function supports format strings with positions.]) -+ ;; -+ esac -+]) -+ -+# progtest.m4 serial 4 (gettext-0.14.2) -+dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+dnl -+dnl This file can can be used in projects which are not available under -+dnl the GNU General Public License or the GNU Library General Public -+dnl License but which still want to provide support for the GNU gettext -+dnl functionality. -+dnl Please note that the actual code of the GNU gettext library is covered -+dnl by the GNU Library General Public License, and the rest of the GNU -+dnl gettext package package is covered by the GNU General Public License. -+dnl They are *not* in the public domain. -+ -+dnl Authors: -+dnl Ulrich Drepper , 1996. -+ -+AC_PREREQ(2.50) -+ -+# Search path for a program which passes the given test. -+ -+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, -+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -+AC_DEFUN([AM_PATH_PROG_WITH_TEST], -+[ -+# Prepare PATH_SEPARATOR. -+# The user is always right. -+if test "${PATH_SEPARATOR+set}" != set; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then -+ PATH_SEPARATOR=';' -+ else -+ PATH_SEPARATOR=: -+ fi -+ rm -f conf$$.sh -+fi -+ -+# Find out how to test for executable files. Don't use a zero-byte file, -+# as systems may use methods other than mode bits to determine executability. -+cat >conf$$.file <<_ASEOF -+#! /bin/sh -+exit 0 -+_ASEOF -+chmod +x conf$$.file -+if test -x conf$$.file >/dev/null 2>&1; then -+ ac_executable_p="test -x" -+else -+ ac_executable_p="test -f" -+fi -+rm -f conf$$.file -+ -+# Extract the first word of "$2", so it can be a program name with args. -+set dummy $2; ac_word=[$]2 -+AC_MSG_CHECKING([for $ac_word]) -+AC_CACHE_VAL(ac_cv_path_$1, -+[case "[$]$1" in -+ [[\\/]]* | ?:[[\\/]]*) -+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path. -+ ;; -+ *) -+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR -+ for ac_dir in ifelse([$5], , $PATH, [$5]); do -+ IFS="$ac_save_IFS" -+ test -z "$ac_dir" && ac_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then -+ echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD -+ if [$3]; then -+ ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" -+ break 2 -+ fi -+ fi - done -- fi -- fi -- if test "X$ltrpathdirs" != "X"; then -- dnl When using libtool, the option that works for both libraries and -- dnl executables is -R. The -R options are cumulative. -- for found_dir in $ltrpathdirs; do -- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done -+ IFS="$ac_save_IFS" -+dnl If no 4th arg is given, leave the cache variable unset, -+dnl so AC_PATH_PROGS will keep looking. -+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" -+])dnl -+ ;; -+esac])dnl -+$1="$ac_cv_path_$1" -+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then -+ AC_MSG_RESULT([$]$1) -+else -+ AC_MSG_RESULT(no) -+fi -+AC_SUBST($1)dnl -+]) -+ -+# signed.m4 serial 1 (gettext-0.10.40) -+dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Bruno Haible. -+ -+AC_DEFUN([bh_C_SIGNED], -+[ -+ AC_CACHE_CHECK([for signed], bh_cv_c_signed, -+ [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) -+ if test $bh_cv_c_signed = no; then -+ AC_DEFINE(signed, , -+ [Define to empty if the C compiler doesn't support this keyword.]) - fi - ]) - --dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, --dnl unless already present in VAR. --dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes --dnl contains two or three consecutive elements that belong together. --AC_DEFUN([AC_LIB_APPENDTOVAR], -+# size_max.m4 serial 2 -+dnl Copyright (C) 2003 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Bruno Haible. -+ -+AC_DEFUN([gl_SIZE_MAX], - [ -- for element in [$2]; do -- haveit= -- for x in $[$1]; do -- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) -- if test "X$x" = "X$element"; then -- haveit=yes -- break -+ AC_CHECK_HEADERS(stdint.h) -+ dnl First test whether the system already has SIZE_MAX. -+ AC_MSG_CHECKING([for SIZE_MAX]) -+ result= -+ AC_EGREP_CPP([Found it], [ -+#include -+#if HAVE_STDINT_H -+#include -+#endif -+#ifdef SIZE_MAX -+Found it -+#endif -+], result=yes) -+ if test -z "$result"; then -+ dnl Define it ourselves. Here we assume that the type 'size_t' is not wider -+ dnl than the type 'unsigned long'. -+ dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', -+ dnl which is guaranteed to work from LONG_MIN to LONG_MAX. -+ _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, -+ [#include ], result=?) -+ _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, -+ [#include ], result=?) -+ _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, -+ [#include ], result=?) -+ if test "$fits_in_uint" = 1; then -+ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type -+ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. -+ AC_TRY_COMPILE([#include -+ extern size_t foo; -+ extern unsigned long foo; -+ ], [], fits_in_uint=0) -+ fi -+ if test -z "$result"; then -+ if test "$fits_in_uint" = 1; then -+ result="$res_hi$res_lo"U -+ else -+ result="$res_hi$res_lo"UL - fi -- done -- if test -z "$haveit"; then -- [$1]="${[$1]}${[$1]:+ }$element" -+ else -+ dnl Shouldn't happen, but who knows... -+ result='~(size_t)0' - fi -- done -+ fi -+ AC_MSG_RESULT([$result]) -+ if test "$result" != yes; then -+ AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], -+ [Define as the maximum value of type 'size_t', if the system doesn't define it.]) -+ fi - ]) - --# lib-ld.m4 serial 1 (gettext-0.11) --dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# stdint_h.m4 serial 5 -+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. - --dnl Subroutines of libtool.m4, --dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision --dnl with libtool.m4. -+dnl From Paul Eggert. - --dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. --AC_DEFUN([AC_LIB_PROG_LD_GNU], --[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, --[# I'd rather use --version here, but apparently some GNU ld's only accept -v. --if $LD -v 2>&1 &5; then -- acl_cv_prog_gnu_ld=yes --else -- acl_cv_prog_gnu_ld=no --fi]) --with_gnu_ld=$acl_cv_prog_gnu_ld -+# Define HAVE_STDINT_H_WITH_UINTMAX if exists, -+# doesn't clash with , and declares uintmax_t. -+ -+AC_DEFUN([gl_AC_HEADER_STDINT_H], -+[ -+ AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, -+ [AC_TRY_COMPILE( -+ [#include -+#include ], -+ [uintmax_t i = (uintmax_t) -1;], -+ gl_cv_header_stdint_h=yes, -+ gl_cv_header_stdint_h=no)]) -+ if test $gl_cv_header_stdint_h = yes; then -+ AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, -+ [Define if exists, doesn't clash with , -+ and declares uintmax_t. ]) -+ fi -+]) -+ -+# uintmax_t.m4 serial 9 -+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Paul Eggert. -+ -+AC_PREREQ(2.13) -+ -+# Define uintmax_t to 'unsigned long' or 'unsigned long long' -+# if it is not already defined in or . -+ -+AC_DEFUN([gl_AC_TYPE_UINTMAX_T], -+[ -+ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) -+ AC_REQUIRE([gl_AC_HEADER_STDINT_H]) -+ if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then -+ AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG]) -+ test $ac_cv_type_unsigned_long_long = yes \ -+ && ac_type='unsigned long long' \ -+ || ac_type='unsigned long' -+ AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, -+ [Define to unsigned long or unsigned long long -+ if and don't define.]) -+ else -+ AC_DEFINE(HAVE_UINTMAX_T, 1, -+ [Define if you have the 'uintmax_t' type in or .]) -+ fi -+]) -+ -+# ulonglong.m4 serial 4 -+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Paul Eggert. -+ -+# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. -+ -+AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], -+[ -+ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, -+ [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], -+ [unsigned long long ullmax = (unsigned long long) -1; -+ return ull << i | ull >> i | ullmax / ull | ullmax % ull;], -+ ac_cv_type_unsigned_long_long=yes, -+ ac_cv_type_unsigned_long_long=no)]) -+ if test $ac_cv_type_unsigned_long_long = yes; then -+ AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, -+ [Define if you have the 'unsigned long long' type.]) -+ fi -+]) -+ -+# wchar_t.m4 serial 1 (gettext-0.12) -+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Bruno Haible. -+dnl Test whether has the 'wchar_t' type. -+dnl Prerequisite: AC_PROG_CC -+ -+AC_DEFUN([gt_TYPE_WCHAR_T], -+[ -+ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, -+ [AC_TRY_COMPILE([#include -+ wchar_t foo = (wchar_t)'\0';], , -+ gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) -+ if test $gt_cv_c_wchar_t = yes; then -+ AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) -+ fi -+]) -+ -+# wint_t.m4 serial 1 (gettext-0.12) -+dnl Copyright (C) 2003 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl From Bruno Haible. -+dnl Test whether has the 'wint_t' type. -+dnl Prerequisite: AC_PROG_CC -+ -+AC_DEFUN([gt_TYPE_WINT_T], -+[ -+ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, -+ [AC_TRY_COMPILE([#include -+ wint_t foo = (wchar_t)'\0';], , -+ gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) -+ if test $gt_cv_c_wint_t = yes; then -+ AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) -+ fi -+]) -+ -+# xsize.m4 serial 3 -+dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_XSIZE], -+[ -+ dnl Prerequisites of lib/xsize.h. -+ AC_REQUIRE([gl_SIZE_MAX]) -+ AC_REQUIRE([AC_C_INLINE]) -+ AC_CHECK_HEADERS(stdint.h) -+]) -+ -+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# AM_AUTOMAKE_VERSION(VERSION) -+# ---------------------------- -+# Automake X.Y traces this macro to ensure aclocal.m4 has been -+# generated from the m4 files accompanying Automake X.Y. -+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) -+ -+# AM_SET_CURRENT_AUTOMAKE_VERSION -+# ------------------------------- -+# Call AM_AUTOMAKE_VERSION so it can be traced. -+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -+ [AM_AUTOMAKE_VERSION([1.9.6])]) -+ -+# AM_AUX_DIR_EXPAND -*- Autoconf -*- -+ -+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -+# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -+# -+# Of course, Automake must honor this variable whenever it calls a -+# tool from the auxiliary directory. The problem is that $srcdir (and -+# therefore $ac_aux_dir as well) can be either absolute or relative, -+# depending on how configure is run. This is pretty annoying, since -+# it makes $ac_aux_dir quite unusable in subdirectories: in the top -+# source directory, any form will work fine, but in subdirectories a -+# relative path needs to be adjusted first. -+# -+# $ac_aux_dir/missing -+# fails when called from a subdirectory if $ac_aux_dir is relative -+# $top_srcdir/$ac_aux_dir/missing -+# fails if $ac_aux_dir is absolute, -+# fails when called from a subdirectory in a VPATH build with -+# a relative $ac_aux_dir -+# -+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -+# are both prefixed by $srcdir. In an in-source build this is usually -+# harmless because $srcdir is `.', but things will broke when you -+# start a VPATH build or use an absolute $srcdir. -+# -+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -+# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -+# and then we would define $MISSING as -+# MISSING="\${SHELL} $am_aux_dir/missing" -+# This will work as long as MISSING is not called from configure, because -+# unfortunately $(top_srcdir) has no meaning in configure. -+# However there are other variables, like CC, which are often used in -+# configure, and could therefore not use this "fixed" $ac_aux_dir. -+# -+# Another solution, used here, is to always expand $ac_aux_dir to an -+# absolute PATH. The drawback is that using absolute paths prevent a -+# configured tree to be moved without reconfiguration. -+ -+AC_DEFUN([AM_AUX_DIR_EXPAND], -+[dnl Rely on autoconf to set up CDPATH properly. -+AC_PREREQ([2.50])dnl -+# expand $ac_aux_dir to an absolute path -+am_aux_dir=`cd $ac_aux_dir && pwd` - ]) - --dnl From libtool-1.4. Sets the variable LD. --AC_DEFUN([AC_LIB_PROG_LD], --[AC_ARG_WITH(gnu-ld, --[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], --test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) --AC_REQUIRE([AC_PROG_CC])dnl --AC_REQUIRE([AC_CANONICAL_HOST])dnl --ac_prog=ld --if test "$GCC" = yes; then -- # Check if gcc -print-prog-name=ld gives a path. -- AC_MSG_CHECKING([for ld used by GCC]) -- 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. -- [[\\/]* | [A-Za-z]:[\\/]*)] -- [re_direlt='/[^/][^/]*/\.\./'] -- # Canonicalize the path of ld -- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` -- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do -- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` -- done -- test -z "$LD" && LD="$ac_prog" -- ;; -- "") -- # If it fails, then pretend we aren't using GCC. -- ac_prog=ld -- ;; -- *) -- # If it is relative, then search for the first ld in PATH. -- with_gnu_ld=unknown -- ;; -- esac --elif test "$with_gnu_ld" = yes; then -- AC_MSG_CHECKING([for GNU ld]) --else -- AC_MSG_CHECKING([for non-GNU ld]) --fi --AC_CACHE_VAL(acl_cv_path_LD, --[if test -z "$LD"; then -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" -- for ac_dir in $PATH; do -- test -z "$ac_dir" && ac_dir=. -- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then -- acl_cv_path_LD="$ac_dir/$ac_prog" -- # Check to see if the program is GNU ld. I'd rather use --version, -- # but apparently some GNU ld's only accept -v. -- # Break only if it was the GNU/non-GNU ld that we prefer. -- if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then -- test "$with_gnu_ld" != no && break -+# AM_CONDITIONAL -*- Autoconf -*- -+ -+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 -+# Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# serial 7 -+ -+# AM_CONDITIONAL(NAME, SHELL-CONDITION) -+# ------------------------------------- -+# Define a conditional. -+AC_DEFUN([AM_CONDITIONAL], -+[AC_PREREQ(2.52)dnl -+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], -+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -+AC_SUBST([$1_TRUE]) -+AC_SUBST([$1_FALSE]) -+if $2; then -+ $1_TRUE= -+ $1_FALSE='#' -+else -+ $1_TRUE='#' -+ $1_FALSE= -+fi -+AC_CONFIG_COMMANDS_PRE( -+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then -+ AC_MSG_ERROR([[conditional "$1" was never defined. -+Usually this means the macro was only invoked conditionally.]]) -+fi])]) -+ -+ -+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -+# Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# serial 8 -+ -+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -+# written in clear, in which case automake, when reading aclocal.m4, -+# will think it sees a *use*, and therefore will trigger all it's -+# C support machinery. Also note that it means that autoscan, seeing -+# CC etc. in the Makefile, will ask for an AC_PROG_CC use... -+ -+ -+# _AM_DEPENDENCIES(NAME) -+# ---------------------- -+# See how the compiler implements dependency checking. -+# NAME is "CC", "CXX", "GCJ", or "OBJC". -+# We try a few techniques and use that to set a single cache variable. -+# -+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -+# dependency, and given that the user is not expected to run this macro, -+# just rely on AC_PROG_CC. -+AC_DEFUN([_AM_DEPENDENCIES], -+[AC_REQUIRE([AM_SET_DEPDIR])dnl -+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -+AC_REQUIRE([AM_MAKE_INCLUDE])dnl -+AC_REQUIRE([AM_DEP_TRACK])dnl -+ -+ifelse([$1], CC, [depcc="$CC" am_compiler_list=], -+ [$1], CXX, [depcc="$CXX" am_compiler_list=], -+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], -+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], -+ [depcc="$$1" am_compiler_list=]) -+ -+AC_CACHE_CHECK([dependency style of $depcc], -+ [am_cv_$1_dependencies_compiler_type], -+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then -+ # We make a subdir and do the tests there. Otherwise we can end up -+ # making bogus files that we don't know about and never remove. For -+ # instance it was reported that on HP-UX the gcc test will end up -+ # making a dummy file named `D' -- because `-MD' means `put the output -+ # in D'. -+ mkdir conftest.dir -+ # Copy depcomp to subdir because otherwise we won't find it if we're -+ # using a relative directory. -+ cp "$am_depcomp" conftest.dir -+ cd conftest.dir -+ # We will build objects and dependencies in a subdirectory because -+ # it helps to detect inapplicable dependency modes. For instance -+ # both Tru64's cc and ICC support -MD to output dependencies as a -+ # side effect of compilation, but ICC will put the dependencies in -+ # the current directory while Tru64 will put them in the object -+ # directory. -+ mkdir sub -+ -+ am_cv_$1_dependencies_compiler_type=none -+ if test "$am_compiler_list" = ""; then -+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` -+ fi -+ for depmode in $am_compiler_list; do -+ # Setup a source with many dependencies, because some compilers -+ # like to wrap large dependency lists on column 80 (with \), and -+ # we should not choose a depcomp mode which is confused by this. -+ # -+ # We need to recreate these files for each test, as the compiler may -+ # overwrite some of them when testing with obscure command lines. -+ # This happens at least with the AIX C compiler. -+ : > sub/conftest.c -+ for i in 1 2 3 4 5 6; do -+ echo '#include "conftst'$i'.h"' >> sub/conftest.c -+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with -+ # Solaris 8's {/usr,}/bin/sh. -+ touch sub/conftst$i.h -+ done -+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf -+ -+ case $depmode in -+ nosideeffect) -+ # after this tag, mechanisms are not by side-effect, so they'll -+ # only be used when explicitly requested -+ if test "x$enable_dependency_tracking" = xyes; then -+ continue - else -- test "$with_gnu_ld" != yes && break -+ break -+ fi -+ ;; -+ none) break ;; -+ esac -+ # We check with `-c' and `-o' for the sake of the "dashmstdout" -+ # mode. It turns out that the SunPro C++ compiler does not properly -+ # handle `-M -o', and we need to detect this. -+ if depmode=$depmode \ -+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ -+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ -+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ -+ >/dev/null 2>conftest.err && -+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && -+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && -+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then -+ # icc doesn't choke on unknown options, it will just issue warnings -+ # or remarks (even with -Werror). So we grep stderr for any message -+ # that says an option was ignored or not supported. -+ # When given -MP, icc 7.0 and 7.1 complain thusly: -+ # icc: Command line warning: ignoring option '-M'; no argument required -+ # The diagnosis changed in icc 8.0: -+ # icc: Command line remark: option '-MP' not supported -+ if (grep 'ignoring option' conftest.err || -+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else -+ am_cv_$1_dependencies_compiler_type=$depmode -+ break - fi - fi - done -- IFS="$ac_save_ifs" --else -- acl_cv_path_LD="$LD" # Let the user override the test with a path. --fi]) --LD="$acl_cv_path_LD" --if test -n "$LD"; then -- AC_MSG_RESULT($LD) -+ -+ cd .. -+ rm -rf conftest.dir - else -- AC_MSG_RESULT(no) -+ am_cv_$1_dependencies_compiler_type=none - fi --test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) --AC_LIB_PROG_LD_GNU -+]) -+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -+AM_CONDITIONAL([am__fastdep$1], [ -+ test "x$enable_dependency_tracking" != xno \ -+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) - ]) - --# iconv.m4 serial AM4 (gettext-0.11.3) --dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. - --dnl From Bruno Haible. -+# AM_SET_DEPDIR -+# ------------- -+# Choose a directory name for dependency files. -+# This macro is AC_REQUIREd in _AM_DEPENDENCIES -+AC_DEFUN([AM_SET_DEPDIR], -+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -+]) - --AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], --[ -- dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. -- AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) -- AC_REQUIRE([AC_LIB_RPATH]) - -- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV -- dnl accordingly. -- AC_LIB_LINKFLAGS_BODY([iconv]) -+# AM_DEP_TRACK -+# ------------ -+AC_DEFUN([AM_DEP_TRACK], -+[AC_ARG_ENABLE(dependency-tracking, -+[ --disable-dependency-tracking speeds up one-time build -+ --enable-dependency-tracking do not reject slow dependency extractors]) -+if test "x$enable_dependency_tracking" != xno; then -+ am_depcomp="$ac_aux_dir/depcomp" -+ AMDEPBACKSLASH='\' -+fi -+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -+AC_SUBST([AMDEPBACKSLASH]) - ]) - --AC_DEFUN([AM_ICONV_LINK], --[ -- dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and -- dnl those with the standalone portable GNU libiconv installed). -+# Generate code to set up dependency tracking. -*- Autoconf -*- - -- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV -- dnl accordingly. -- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) -+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -+# Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - -- dnl Add $INCICONV to CPPFLAGS before performing the following checks, -- dnl because if the user has installed libiconv and not disabled its use -- dnl via --without-libiconv-prefix, he wants to use it. The first -- dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. -- am_save_CPPFLAGS="$CPPFLAGS" -- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) -+#serial 3 - -- AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ -- am_cv_func_iconv="no, consider installing GNU libiconv" -- am_cv_lib_iconv=no -- AC_TRY_LINK([#include --#include ], -- [iconv_t cd = iconv_open("",""); -- iconv(cd,NULL,NULL,NULL,NULL); -- iconv_close(cd);], -- am_cv_func_iconv=yes) -- if test "$am_cv_func_iconv" != yes; then -- am_save_LIBS="$LIBS" -- LIBS="$LIBS $LIBICONV" -- AC_TRY_LINK([#include --#include ], -- [iconv_t cd = iconv_open("",""); -- iconv(cd,NULL,NULL,NULL,NULL); -- iconv_close(cd);], -- am_cv_lib_iconv=yes -- am_cv_func_iconv=yes) -- LIBS="$am_save_LIBS" -- fi -- ]) -- if test "$am_cv_func_iconv" = yes; then -- AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) -- fi -- if test "$am_cv_lib_iconv" = yes; then -- AC_MSG_CHECKING([how to link with libiconv]) -- AC_MSG_RESULT([$LIBICONV]) -+# _AM_OUTPUT_DEPENDENCY_COMMANDS -+# ------------------------------ -+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -+[for mf in $CONFIG_FILES; do -+ # Strip MF so we end up with the name of the file. -+ mf=`echo "$mf" | sed -e 's/:.*$//'` -+ # Check whether this is an Automake generated Makefile or not. -+ # We used to match only the files named `Makefile.in', but -+ # some people rename them; so instead we look at the file content. -+ # Grep'ing the first line is not enough: some people post-process -+ # each Makefile.in and add a new line on top of each file to say so. -+ # So let's grep whole file. -+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then -+ dirpart=`AS_DIRNAME("$mf")` - else -- dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV -- dnl either. -- CPPFLAGS="$am_save_CPPFLAGS" -- LIBICONV= -- LTLIBICONV= -+ continue - fi -- AC_SUBST(LIBICONV) -- AC_SUBST(LTLIBICONV) --]) -+ # Extract the definition of DEPDIR, am__include, and am__quote -+ # from the Makefile without running `make'. -+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` -+ test -z "$DEPDIR" && continue -+ am__include=`sed -n 's/^am__include = //p' < "$mf"` -+ test -z "am__include" && continue -+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"` -+ # When using ansi2knr, U may be empty or an underscore; expand it -+ U=`sed -n 's/^U = //p' < "$mf"` -+ # Find all dependency output files, they are included files with -+ # $(DEPDIR) in their names. We invoke sed twice because it is the -+ # simplest approach to changing $(DEPDIR) to its actual value in the -+ # expansion. -+ for file in `sed -n " -+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ -+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do -+ # Make sure the directory exists. -+ test -f "$dirpart/$file" && continue -+ fdir=`AS_DIRNAME(["$file"])` -+ AS_MKDIR_P([$dirpart/$fdir]) -+ # echo "creating $dirpart/$file" -+ echo '# dummy' > "$dirpart/$file" -+ done -+done -+])# _AM_OUTPUT_DEPENDENCY_COMMANDS - --AC_DEFUN([AM_ICONV], --[ -- AM_ICONV_LINK -- if test "$am_cv_func_iconv" = yes; then -- AC_MSG_CHECKING([for iconv declaration]) -- AC_CACHE_VAL(am_cv_proto_iconv, [ -- AC_TRY_COMPILE([ --#include --#include --extern --#ifdef __cplusplus --"C" --#endif --#if defined(__STDC__) || defined(__cplusplus) --size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); --#else --size_t iconv(); --#endif --], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") -- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) -- am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` -- AC_MSG_RESULT([$]{ac_t:- -- }[$]am_cv_proto_iconv) -- AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, -- [Define as const if the declaration of iconv() needs const.]) -- fi -+ -+# AM_OUTPUT_DEPENDENCY_COMMANDS -+# ----------------------------- -+# This macro should only be invoked once -- use via AC_REQUIRE. -+# -+# This code is only required when automatic dependency tracking -+# is enabled. FIXME. This creates each `.P' file that we will -+# need in order to bootstrap the dependency handling code. -+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -+[AC_CONFIG_COMMANDS([depfiles], -+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], -+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) - ]) - --# progtest.m4 serial 2 (gettext-0.10.40) --dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. --dnl --dnl This file can can be used in projects which are not available under --dnl the GNU General Public License or the GNU Library General Public --dnl License but which still want to provide support for the GNU gettext --dnl functionality. --dnl Please note that the actual code of the GNU gettext library is covered --dnl by the GNU Library General Public License, and the rest of the GNU --dnl gettext package package is covered by the GNU General Public License. --dnl They are *not* in the public domain. -+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -+# Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# serial 8 - --dnl Authors: --dnl Ulrich Drepper , 1996. -+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - --# Search path for a program which passes the given test. -+# Do all the work for Automake. -*- Autoconf -*- - --dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, --dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) --AC_DEFUN([AM_PATH_PROG_WITH_TEST], --[# Extract the first word of "$2", so it can be a program name with args. --set dummy $2; ac_word=[$]2 --AC_MSG_CHECKING([for $ac_word]) --AC_CACHE_VAL(ac_cv_path_$1, --[case "[$]$1" in -- /*) -- ac_cv_path_$1="[$]$1" # Let the user override the test with a path. -- ;; -- *) -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" -- for ac_dir in ifelse([$5], , $PATH, [$5]); do -- test -z "$ac_dir" && ac_dir=. -- if test -f $ac_dir/$ac_word; then -- if [$3]; then -- ac_cv_path_$1="$ac_dir/$ac_word" -- break -- fi -- fi -- done -- IFS="$ac_save_ifs" --dnl If no 4th arg is given, leave the cache variable unset, --dnl so AC_PATH_PROGS will keep looking. --ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" --])dnl -- ;; --esac])dnl --$1="$ac_cv_path_$1" --if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then -- AC_MSG_RESULT([$]$1) --else -- AC_MSG_RESULT(no) --fi --AC_SUBST($1)dnl --]) -+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -+# Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --# isc-posix.m4 serial 2 (gettext-0.11.2) --dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -- --# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. -- --# This test replaces the one in autoconf. --# Currently this macro should have the same name as the autoconf macro --# because gettext's gettext.m4 (distributed in the automake package) --# still uses it. Otherwise, the use in gettext.m4 makes autoheader --# give these diagnostics: --# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX --# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX -+# serial 12 - --undefine([AC_ISC_POSIX]) -+# This macro actually does too much. Some checks are only needed if -+# your package does certain things. But this isn't really a big deal. - --AC_DEFUN([AC_ISC_POSIX], -- [ -- dnl This test replaces the obsolescent AC_ISC_POSIX kludge. -- AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) -- ] --) -+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -+# AM_INIT_AUTOMAKE([OPTIONS]) -+# ----------------------------------------------- -+# The call with PACKAGE and VERSION arguments is the old style -+# call (pre autoconf-2.50), which is being phased out. PACKAGE -+# and VERSION should now be passed to AC_INIT and removed from -+# the call to AM_INIT_AUTOMAKE. -+# We support both call styles for the transition. After -+# the next Automake release, Autoconf can make the AC_INIT -+# arguments mandatory, and then we can depend on a new Autoconf -+# release and drop the old call support. -+AC_DEFUN([AM_INIT_AUTOMAKE], -+[AC_PREREQ([2.58])dnl -+dnl Autoconf wants to disallow AM_ names. We explicitly allow -+dnl the ones we care about. -+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -+AC_REQUIRE([AC_PROG_INSTALL])dnl -+# test to see if srcdir already configured -+if test "`cd $srcdir && pwd`" != "`pwd`" && -+ test -f $srcdir/config.status; then -+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -+fi - --# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) --dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# test whether we have cygpath -+if test -z "$CYGPATH_W"; then -+ if (cygpath --version) >/dev/null 2>/dev/null; then -+ CYGPATH_W='cygpath -w' -+ else -+ CYGPATH_W=echo -+ fi -+fi -+AC_SUBST([CYGPATH_W]) - --# Test for the GNU C Library, version 2.1 or newer. --# From Bruno Haible. -+# Define the identity of the package. -+dnl Distinguish between old-style and new-style calls. -+m4_ifval([$2], -+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl -+ AC_SUBST([PACKAGE], [$1])dnl -+ AC_SUBST([VERSION], [$2])], -+[_AM_SET_OPTIONS([$1])dnl -+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl -+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - --AC_DEFUN([jm_GLIBC21], -- [ -- AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, -- ac_cv_gnu_library_2_1, -- [AC_EGREP_CPP([Lucky GNU user], -- [ --#include --#ifdef __GNU_LIBRARY__ -- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) -- Lucky GNU user -- #endif --#endif -- ], -- ac_cv_gnu_library_2_1=yes, -- ac_cv_gnu_library_2_1=no) -- ] -- ) -- AC_SUBST(GLIBC21) -- GLIBC21="$ac_cv_gnu_library_2_1" -- ] --) -+_AM_IF_OPTION([no-define],, -+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - --# intdiv0.m4 serial 1 (gettext-0.11.3) --dnl Copyright (C) 2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# Some tools Automake needs. -+AC_REQUIRE([AM_SANITY_CHECK])dnl -+AC_REQUIRE([AC_ARG_PROGRAM])dnl -+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -+AM_MISSING_PROG(AUTOCONF, autoconf) -+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -+AM_MISSING_PROG(AUTOHEADER, autoheader) -+AM_MISSING_PROG(MAKEINFO, makeinfo) -+AM_PROG_INSTALL_SH -+AM_PROG_INSTALL_STRIP -+AC_REQUIRE([AM_PROG_MKDIR_P])dnl -+# We need awk for the "check" target. The system "awk" is bad on -+# some platforms. -+AC_REQUIRE([AC_PROG_AWK])dnl -+AC_REQUIRE([AC_PROG_MAKE_SET])dnl -+AC_REQUIRE([AM_SET_LEADING_DOT])dnl -+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], -+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], -+ [_AM_PROG_TAR([v7])])]) -+_AM_IF_OPTION([no-dependencies],, -+[AC_PROVIDE_IFELSE([AC_PROG_CC], -+ [_AM_DEPENDENCIES(CC)], -+ [define([AC_PROG_CC], -+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -+AC_PROVIDE_IFELSE([AC_PROG_CXX], -+ [_AM_DEPENDENCIES(CXX)], -+ [define([AC_PROG_CXX], -+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -+]) -+]) - --dnl From Bruno Haible. - --AC_DEFUN([gt_INTDIV0], --[ -- AC_REQUIRE([AC_PROG_CC])dnl -- AC_REQUIRE([AC_CANONICAL_HOST])dnl -+# When config.status generates a header, we must update the stamp-h file. -+# This file resides in the same directory as the config header -+# that is generated. The stamp files are numbered to have different names. - -- AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], -- gt_cv_int_divbyzero_sigfpe, -- [ -- AC_TRY_RUN([ --#include --#include -+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -+# loop where config.status creates the headers, so we can generate -+# our stamp files there. -+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -+[# Compute $1's index in $config_headers. -+_am_stamp_count=1 -+for _am_header in $config_headers :; do -+ case $_am_header in -+ $1 | $1:* ) -+ break ;; -+ * ) -+ _am_stamp_count=`expr $_am_stamp_count + 1` ;; -+ esac -+done -+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - --static void --#ifdef __cplusplus --sigfpe_handler (int sig) --#else --sigfpe_handler (sig) int sig; --#endif --{ -- /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ -- exit (sig != SIGFPE); --} -+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --int x = 1; --int y = 0; --int z; --int nan; -+# AM_PROG_INSTALL_SH -+# ------------------ -+# Define $install_sh. -+AC_DEFUN([AM_PROG_INSTALL_SH], -+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -+install_sh=${install_sh-"$am_aux_dir/install-sh"} -+AC_SUBST(install_sh)]) - --int main () --{ -- signal (SIGFPE, sigfpe_handler); --/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ --#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) -- signal (SIGTRAP, sigfpe_handler); --#endif --/* Linux/SPARC yields signal SIGILL. */ --#if defined (__sparc__) && defined (__linux__) -- signal (SIGILL, sigfpe_handler); --#endif -+# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - -- z = x / y; -- nan = y / y; -- exit (1); --} --], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, -- [ -- # Guess based on the CPU. -- case "$host_cpu" in -- alpha* | i[34567]86 | m68k | s390*) -- gt_cv_int_divbyzero_sigfpe="guessing yes";; -- *) -- gt_cv_int_divbyzero_sigfpe="guessing no";; -- esac -- ]) -- ]) -- case "$gt_cv_int_divbyzero_sigfpe" in -- *yes) value=1;; -- *) value=0;; -- esac -- AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, -- [Define if integer division by zero raises signal SIGFPE.]) --]) -+# serial 2 - --# uintmax_t.m4 serial 6 (gettext-0.11) --dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# Check whether the underlying file-system supports filenames -+# with a leading dot. For instance MS-DOS doesn't. -+AC_DEFUN([AM_SET_LEADING_DOT], -+[rm -rf .tst 2>/dev/null -+mkdir .tst 2>/dev/null -+if test -d .tst; then -+ am__leading_dot=. -+else -+ am__leading_dot=_ -+fi -+rmdir .tst 2>/dev/null -+AC_SUBST([am__leading_dot])]) - --dnl From Paul Eggert. -+# Check to see how 'make' treats includes. -*- Autoconf -*- - --AC_PREREQ(2.13) -+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --# Define uintmax_t to `unsigned long' or `unsigned long long' --# if does not exist. -+# serial 3 - --AC_DEFUN([jm_AC_TYPE_UINTMAX_T], --[ -- AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) -- AC_REQUIRE([jm_AC_HEADER_STDINT_H]) -- if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then -- AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) -- test $ac_cv_type_unsigned_long_long = yes \ -- && ac_type='unsigned long long' \ -- || ac_type='unsigned long' -- AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, -- [Define to unsigned long or unsigned long long -- if and don't define.]) -- fi -+# AM_MAKE_INCLUDE() -+# ----------------- -+# Check to see how make treats includes. -+AC_DEFUN([AM_MAKE_INCLUDE], -+[am_make=${MAKE-make} -+cat > confinc << 'END' -+am__doit: -+ @echo done -+.PHONY: am__doit -+END -+# If we don't find an include directive, just comment out the code. -+AC_MSG_CHECKING([for style of include used by $am_make]) -+am__include="#" -+am__quote= -+_am_result=none -+# First try GNU make style include. -+echo "include confinc" > confmf -+# We grep out `Entering directory' and `Leaving directory' -+# messages which can occur if `w' ends up in MAKEFLAGS. -+# In particular we don't look at `^make:' because GNU make might -+# be invoked under some other name (usually "gmake"), in which -+# case it prints its new name instead of `make'. -+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then -+ am__include=include -+ am__quote= -+ _am_result=GNU -+fi -+# Now try BSD make style include. -+if test "$am__include" = "#"; then -+ echo '.include "confinc"' > confmf -+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then -+ am__include=.include -+ am__quote="\"" -+ _am_result=BSD -+ fi -+fi -+AC_SUBST([am__include]) -+AC_SUBST([am__quote]) -+AC_MSG_RESULT([$_am_result]) -+rm -f confinc confmf - ]) - --# inttypes_h.m4 serial 4 (gettext-0.11.4) --dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -+ -+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 -+# Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# serial 4 - --dnl From Paul Eggert. -+# AM_MISSING_PROG(NAME, PROGRAM) -+# ------------------------------ -+AC_DEFUN([AM_MISSING_PROG], -+[AC_REQUIRE([AM_MISSING_HAS_RUN]) -+$1=${$1-"${am_missing_run}$2"} -+AC_SUBST($1)]) - --# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, --# doesn't clash with , and declares uintmax_t. - --AC_DEFUN([jm_AC_HEADER_INTTYPES_H], --[ -- AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, -- [AC_TRY_COMPILE( -- [#include --#include ], -- [uintmax_t i = (uintmax_t) -1;], -- jm_ac_cv_header_inttypes_h=yes, -- jm_ac_cv_header_inttypes_h=no)]) -- if test $jm_ac_cv_header_inttypes_h = yes; then -- AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, --[Define if exists, doesn't clash with , -- and declares uintmax_t. ]) -- fi -+# AM_MISSING_HAS_RUN -+# ------------------ -+# Define MISSING if not defined so far and test if it supports --run. -+# If it does, set am_missing_run to use it, otherwise, to nothing. -+AC_DEFUN([AM_MISSING_HAS_RUN], -+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -+# Use eval to expand $SHELL -+if eval "$MISSING --run true"; then -+ am_missing_run="$MISSING --run " -+else -+ am_missing_run= -+ AC_MSG_WARN([`missing' script is too old or missing]) -+fi - ]) - --# stdint_h.m4 serial 2 (gettext-0.11.4) --dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --dnl From Paul Eggert. -+# AM_PROG_MKDIR_P -+# --------------- -+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -+# -+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -+# created by `make install' are always world readable, even if the -+# installer happens to have an overly restrictive umask (e.g. 077). -+# This was a mistake. There are at least two reasons why we must not -+# use `-m 0755': -+# - it causes special bits like SGID to be ignored, -+# - it may be too restrictive (some setups expect 775 directories). -+# -+# Do not use -m 0755 and let people choose whatever they expect by -+# setting umask. -+# -+# We cannot accept any implementation of `mkdir' that recognizes `-p'. -+# Some implementations (such as Solaris 8's) are not thread-safe: if a -+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -+# concurrently, both version can detect that a/ is missing, but only -+# one can create it and the other will error out. Consequently we -+# restrict ourselves to GNU make (using the --version option ensures -+# this.) -+AC_DEFUN([AM_PROG_MKDIR_P], -+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then -+ # We used to keeping the `.' as first argument, in order to -+ # allow $(mkdir_p) to be used without argument. As in -+ # $(mkdir_p) $(somedir) -+ # where $(somedir) is conditionally defined. However this is wrong -+ # for two reasons: -+ # 1. if the package is installed by a user who cannot write `.' -+ # make install will fail, -+ # 2. the above comment should most certainly read -+ # $(mkdir_p) $(DESTDIR)$(somedir) -+ # so it does not work when $(somedir) is undefined and -+ # $(DESTDIR) is not. -+ # To support the latter case, we have to write -+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), -+ # so the `.' trick is pointless. -+ mkdir_p='mkdir -p --' -+else -+ # On NextStep and OpenStep, the `mkdir' command does not -+ # recognize any option. It will interpret all options as -+ # directories to create, and then abort because `.' already -+ # exists. -+ for d in ./-p ./--version; -+ do -+ test -d $d && rmdir $d -+ done -+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. -+ if test -f "$ac_aux_dir/mkinstalldirs"; then -+ mkdir_p='$(mkinstalldirs)' -+ else -+ mkdir_p='$(install_sh) -d' -+ fi -+fi -+AC_SUBST([mkdir_p])]) - --# Define HAVE_STDINT_H_WITH_UINTMAX if exists, --# doesn't clash with , and declares uintmax_t. -+# Helper functions for option handling. -*- Autoconf -*- - --AC_DEFUN([jm_AC_HEADER_STDINT_H], --[ -- AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, -- [AC_TRY_COMPILE( -- [#include --#include ], -- [uintmax_t i = (uintmax_t) -1;], -- jm_ac_cv_header_stdint_h=yes, -- jm_ac_cv_header_stdint_h=no)]) -- if test $jm_ac_cv_header_stdint_h = yes; then -- AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, --[Define if exists, doesn't clash with , -- and declares uintmax_t. ]) -- fi --]) -+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) --dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# serial 3 - --dnl From Paul Eggert. -+# _AM_MANGLE_OPTION(NAME) -+# ----------------------- -+AC_DEFUN([_AM_MANGLE_OPTION], -+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - --AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], --[ -- AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, -- [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], -- [unsigned long long ullmax = (unsigned long long) -1; -- return ull << i | ull >> i | ullmax / ull | ullmax % ull;], -- ac_cv_type_unsigned_long_long=yes, -- ac_cv_type_unsigned_long_long=no)]) -- if test $ac_cv_type_unsigned_long_long = yes; then -- AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, -- [Define if you have the unsigned long long type.]) -- fi --]) -+# _AM_SET_OPTION(NAME) -+# ------------------------------ -+# Set option NAME. Presently that only means defining a flag for this option. -+AC_DEFUN([_AM_SET_OPTION], -+[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - --# inttypes.m4 serial 1 (gettext-0.11.4) --dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# _AM_SET_OPTIONS(OPTIONS) -+# ---------------------------------- -+# OPTIONS is a space-separated list of Automake options. -+AC_DEFUN([_AM_SET_OPTIONS], -+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - --dnl From Paul Eggert. -+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -+# ------------------------------------------- -+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -+AC_DEFUN([_AM_IF_OPTION], -+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - --# Define HAVE_INTTYPES_H if exists and doesn't clash with --# . -+# Check to make sure that the build environment is sane. -*- Autoconf -*- - --AC_DEFUN([gt_HEADER_INTTYPES_H], --[ -- AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, -- [ -- AC_TRY_COMPILE( -- [#include --#include ], -- [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) -- ]) -- if test $gt_cv_header_inttypes_h = yes; then -- AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, -- [Define if exists and doesn't clash with .]) -- fi --]) -+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -+# Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --# inttypes-pri.m4 serial 1 (gettext-0.11.4) --dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# serial 4 - --dnl From Bruno Haible. -+# AM_SANITY_CHECK -+# --------------- -+AC_DEFUN([AM_SANITY_CHECK], -+[AC_MSG_CHECKING([whether build environment is sane]) -+# Just in case -+sleep 1 -+echo timestamp > conftest.file -+# Do `set' in a subshell so we don't clobber the current shell's -+# arguments. Must try -L first in case configure is actually a -+# symlink; some systems play weird games with the mod time of symlinks -+# (eg FreeBSD returns the mod time of the symlink's containing -+# directory). -+if ( -+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` -+ if test "$[*]" = "X"; then -+ # -L didn't work. -+ set X `ls -t $srcdir/configure conftest.file` -+ fi -+ rm -f conftest.file -+ if test "$[*]" != "X $srcdir/configure conftest.file" \ -+ && test "$[*]" != "X conftest.file $srcdir/configure"; then - --# Define PRI_MACROS_BROKEN if exists and defines the PRI* --# macros to non-string values. This is the case on AIX 4.3.3. -+ # If neither matched, then we have a broken ls. This can happen -+ # if, for instance, CONFIG_SHELL is bash and it inherits a -+ # broken ls alias from the environment. This has actually -+ # happened. Such a system could not be considered "sane". -+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -+alias in your environment]) -+ fi - --AC_DEFUN([gt_INTTYPES_PRI], --[ -- AC_REQUIRE([gt_HEADER_INTTYPES_H]) -- if test $gt_cv_header_inttypes_h = yes; then -- AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], -- gt_cv_inttypes_pri_broken, -- [ -- AC_TRY_COMPILE([#include --#ifdef PRId32 --char *p = PRId32; --#endif --], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) -- ]) -- fi -- if test "$gt_cv_inttypes_pri_broken" = yes; then -- AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, -- [Define if exists and defines unusable PRI* macros.]) -- fi --]) -+ test "$[2]" = conftest.file -+ ) -+then -+ # Ok. -+ : -+else -+ AC_MSG_ERROR([newly created file is older than distributed files! -+Check your system clock]) -+fi -+AC_MSG_RESULT(yes)]) - --# codeset.m4 serial AM1 (gettext-0.10.40) --dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. -+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --dnl From Bruno Haible. -+# AM_PROG_INSTALL_STRIP -+# --------------------- -+# One issue with vendor `install' (even GNU) is that you can't -+# specify the program used to strip binaries. This is especially -+# annoying in cross-compiling environments, where the build's strip -+# is unlikely to handle the host's binaries. -+# Fortunately install-sh will honor a STRIPPROG variable, so we -+# always use install-sh in `make install-strip', and initialize -+# STRIPPROG with the value of the STRIP variable (set by the user). -+AC_DEFUN([AM_PROG_INSTALL_STRIP], -+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -+# Installed binaries are usually stripped using `strip' when the user -+# run `make install-strip'. However `strip' might not be the right -+# tool to use in cross-compilation environments, therefore Automake -+# will honor the `STRIP' environment variable to overrule this program. -+dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -+if test "$cross_compiling" != no; then -+ AC_CHECK_TOOL([STRIP], [strip], :) -+fi -+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -+AC_SUBST([INSTALL_STRIP_PROGRAM])]) - --AC_DEFUN([AM_LANGINFO_CODESET], --[ -- AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, -- [AC_TRY_LINK([#include ], -- [char* cs = nl_langinfo(CODESET);], -- am_cv_langinfo_codeset=yes, -- am_cv_langinfo_codeset=no) -- ]) -- if test $am_cv_langinfo_codeset = yes; then -- AC_DEFINE(HAVE_LANGINFO_CODESET, 1, -- [Define if you have and nl_langinfo(CODESET).]) -- fi --]) -+# Check how to create a tarball. -*- Autoconf -*- - --# lcmessage.m4 serial 3 (gettext-0.11.3) --dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. --dnl This file is free software, distributed under the terms of the GNU --dnl General Public License. As a special exception to the GNU General --dnl Public License, this file may be distributed as part of a program --dnl that contains a configuration script generated by Autoconf, under --dnl the same distribution terms as the rest of that program. --dnl --dnl This file can can be used in projects which are not available under --dnl the GNU General Public License or the GNU Library General Public --dnl License but which still want to provide support for the GNU gettext --dnl functionality. --dnl Please note that the actual code of the GNU gettext library is covered --dnl by the GNU Library General Public License, and the rest of the GNU --dnl gettext package package is covered by the GNU General Public License. --dnl They are *not* in the public domain. -+# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -+# -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. - --dnl Authors: --dnl Ulrich Drepper , 1995. -+# serial 2 - --# Check whether LC_MESSAGES is available in . -+# _AM_PROG_TAR(FORMAT) -+# -------------------- -+# Check how to create a tarball in format FORMAT. -+# FORMAT should be one of `v7', `ustar', or `pax'. -+# -+# Substitute a variable $(am__tar) that is a command -+# writing to stdout a FORMAT-tarball containing the directory -+# $tardir. -+# tardir=directory && $(am__tar) > result.tar -+# -+# Substitute a variable $(am__untar) that extract such -+# a tarball read from stdin. -+# $(am__untar) < result.tar -+AC_DEFUN([_AM_PROG_TAR], -+[# Always define AMTAR for backward compatibility. -+AM_MISSING_PROG([AMTAR], [tar]) -+m4_if([$1], [v7], -+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], -+ [m4_case([$1], [ustar],, [pax],, -+ [m4_fatal([Unknown tar format])]) -+AC_MSG_CHECKING([how to create a $1 tar archive]) -+# Loop over all known methods to create a tar archive until one works. -+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -+_am_tools=${am_cv_prog_tar_$1-$_am_tools} -+# Do not fold the above two line into one, because Tru64 sh and -+# Solaris sh will not grok spaces in the rhs of `-'. -+for _am_tool in $_am_tools -+do -+ case $_am_tool in -+ gnutar) -+ for _am_tar in tar gnutar gtar; -+ do -+ AM_RUN_LOG([$_am_tar --version]) && break -+ done -+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' -+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' -+ am__untar="$_am_tar -xf -" -+ ;; -+ plaintar) -+ # Must skip GNU tar: if it does not support --format= it doesn't create -+ # ustar tarball either. -+ (tar --version) >/dev/null 2>&1 && continue -+ am__tar='tar chf - "$$tardir"' -+ am__tar_='tar chf - "$tardir"' -+ am__untar='tar xf -' -+ ;; -+ pax) -+ am__tar='pax -L -x $1 -w "$$tardir"' -+ am__tar_='pax -L -x $1 -w "$tardir"' -+ am__untar='pax -r' -+ ;; -+ cpio) -+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L' -+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L' -+ am__untar='cpio -i -H $1 -d' -+ ;; -+ none) -+ am__tar=false -+ am__tar_=false -+ am__untar=false -+ ;; -+ esac - --AC_DEFUN([AM_LC_MESSAGES], --[ -- AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, -- [AC_TRY_LINK([#include ], [return LC_MESSAGES], -- am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) -- if test $am_cv_val_LC_MESSAGES = yes; then -- AC_DEFINE(HAVE_LC_MESSAGES, 1, -- [Define if your file defines LC_MESSAGES.]) -+ # If the value was cached, stop now. We just wanted to have am__tar -+ # and am__untar set. -+ test -n "${am_cv_prog_tar_$1}" && break -+ -+ # tar/untar a dummy directory, and stop if the command works -+ rm -rf conftest.dir -+ mkdir conftest.dir -+ echo GrepMe > conftest.dir/file -+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) -+ rm -rf conftest.dir -+ if test -s conftest.tar; then -+ AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi --]) -+done -+rm -rf conftest.dir -+ -+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -+AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -+AC_SUBST([am__tar]) -+AC_SUBST([am__untar]) -+]) # _AM_PROG_TAR - -+m4_include([acinclude.m4]) ---- gsmlib-1.10.orig/configure -+++ gsmlib-1.10/configure -@@ -1,178 +1,10 @@ - #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. --# Generated by GNU Autoconf 2.53. -+# Generated by GNU Autoconf 2.59. - # --# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 --# Free Software Foundation, Inc. -+# Copyright (C) 2003 Free Software Foundation, Inc. - # This configure script is free software; the Free Software Foundation - # gives unlimited permission to copy, distribute and modify it. -- --# Find the correct PATH separator. Usually this is `:', but --# DJGPP uses `;' like DOS. --if test "X${PATH_SEPARATOR+set}" != Xset; then -- UNAME=${UNAME-`uname 2>/dev/null`} -- case X$UNAME in -- *-DOS) lt_cv_sys_path_separator=';' ;; -- *) lt_cv_sys_path_separator=':' ;; -- esac -- PATH_SEPARATOR=$lt_cv_sys_path_separator --fi -- -- --# Check that we are running under the correct shell. --SHELL=${CONFIG_SHELL-/bin/sh} -- --case X$ECHO in --X*--fallback-echo) -- # Remove one level of quotation (which was required for Make). -- ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` -- ;; --esac -- --echo=${ECHO-echo} --if test "X$1" = X--no-reexec; then -- # Discard the --no-reexec flag, and continue. -- shift --elif test "X$1" = X--fallback-echo; then -- # Avoid inline document here, it may be left over -- : --elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then -- # Yippee, $echo works! -- : --else -- # Restart under the correct shell. -- exec $SHELL "$0" --no-reexec ${1+"$@"} --fi -- --if test "X$1" = X--fallback-echo; then -- # used as fallback echo -- shift -- cat </dev/null && -- echo_test_string="`eval $cmd`" && -- (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null -- then -- break -- fi -- done --fi -- --if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- : --else -- # The Solaris, AIX, and Digital Unix default echo programs unquote -- # backslashes. This makes it impossible to quote backslashes using -- # echo "$something" | sed 's/\\/\\\\/g' -- # -- # So, first we look for a working echo in the user's PATH. -- -- IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR -- for dir in $PATH /usr/ucb; do -- if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && -- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- echo="$dir/echo" -- break -- fi -- done -- IFS="$save_ifs" -- -- if test "X$echo" = Xecho; then -- # We didn't find a better echo, so look for alternatives. -- if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- # This shell has a builtin print -r that does the trick. -- echo='print -r' -- elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && -- test "X$CONFIG_SHELL" != X/bin/ksh; then -- # If we have ksh, try running configure again with it. -- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -- export ORIGINAL_CONFIG_SHELL -- CONFIG_SHELL=/bin/ksh -- export CONFIG_SHELL -- exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} -- else -- # Try using printf. -- echo='printf %s\n' -- if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -- echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- # Cool, printf works -- : -- elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && -- test "X$echo_testing_string" = 'X\t' && -- echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL -- export CONFIG_SHELL -- SHELL="$CONFIG_SHELL" -- export SHELL -- echo="$CONFIG_SHELL $0 --fallback-echo" -- elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && -- test "X$echo_testing_string" = 'X\t' && -- echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && -- test "X$echo_testing_string" = "X$echo_test_string"; then -- echo="$CONFIG_SHELL $0 --fallback-echo" -- else -- # maybe with a smaller string... -- prev=: -- -- for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do -- if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null -- then -- break -- fi -- prev="$cmd" -- done -- -- if test "$prev" != 'sed 50q "$0"'; then -- echo_test_string=`eval $prev` -- export echo_test_string -- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} -- else -- # Oops. We lost completely, so just stick with echo. -- echo=echo -- fi -- fi -- fi -- fi --fi --fi -- --# Copy echo and quote the copy suitably for passing to libtool from --# the Makefile, instead of quoting the original, which is used later. --ECHO=$echo --if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then -- ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" --fi -- -- -- --if expr a : '\(a\)' >/dev/null 2>&1; then -- as_expr=expr --else -- as_expr=false --fi -- -- - ## --------------------- ## - ## M4sh Initialization. ## - ## --------------------- ## -@@ -181,46 +13,57 @@ - 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+"$@"}'='"$@"' - elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix - fi -+DUALCASE=1; export DUALCASE # for MKS sh - --# NLS nuisances. - # Support unset when possible. --if (FOO=FOO; unset FOO) >/dev/null 2>&1; then -+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset - else - as_unset=false - fi - --(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && -- { $as_unset LANG || test "${LANG+set}" != set; } || -- { LANG=C; export LANG; } --(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && -- { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || -- { LC_ALL=C; export LC_ALL; } --(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && -- { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || -- { LC_TIME=C; export LC_TIME; } --(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && -- { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || -- { LC_CTYPE=C; export LC_CTYPE; } --(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && -- { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || -- { LANGUAGE=C; export LANGUAGE; } --(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && -- { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || -- { LC_COLLATE=C; export LC_COLLATE; } --(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && -- { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || -- { LC_NUMERIC=C; export LC_NUMERIC; } --(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && -- { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || -- { LC_MESSAGES=C; export LC_MESSAGES; } -+ -+# Work around bugs in pre-3.0 UWIN ksh. -+$as_unset ENV MAIL MAILPATH -+PS1='$ ' -+PS2='> ' -+PS4='+ ' -+ -+# NLS nuisances. -+for as_var in \ -+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ -+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ -+ LC_TELEPHONE LC_TIME -+do -+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then -+ eval $as_var=C; export $as_var -+ else -+ $as_unset $as_var -+ fi -+done -+ -+# Required to use basename. -+if expr a : '\(a\)' >/dev/null 2>&1; 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 - - - # Name of the executable. --as_me=`(basename "$0") 2>/dev/null || -+as_me=`$as_basename "$0" || - $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ -@@ -231,6 +74,7 @@ - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - -+ - # PATH needs CR, and LINENO needs CR and PATH. - # Avoid depending upon Character Ranges. - as_cr_letters='abcdefghijklmnopqrstuvwxyz' -@@ -241,15 +85,15 @@ - - # The user is always right. - if test "${PATH_SEPARATOR+set}" != set; then -- echo "#! /bin/sh" >conftest.sh -- echo "exit 0" >>conftest.sh -- chmod +x conftest.sh -- if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi -- rm -f conftest.sh -+ rm -f conf$$.sh - fi - - -@@ -297,6 +141,8 @@ - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then -+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } -+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} -@@ -369,13 +215,20 @@ - fi - rm -f conf$$ conf$$.exe conf$$.file - -+if mkdir -p . 2>/dev/null; then -+ as_mkdir_p=: -+else -+ test -d ./-p && rmdir ./-p -+ as_mkdir_p=false -+fi -+ - as_executable_p="test -f" - - # Sed expression to map a string onto a valid CPP name. --as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" -+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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" -+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - # IFS -@@ -385,76 +238,233 @@ - IFS=" $as_nl" - - # CDPATH. --$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } -- -+$as_unset CDPATH - --# Name of the host. --# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, --# so uname gets run too. --ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - --exec 6>&1 - --# --# Initializations. --# --ac_default_prefix=/usr/local --cross_compiling=no --subdirs= --MFLAGS= --MAKEFLAGS= -+# Check that we are running under the correct shell. - SHELL=${CONFIG_SHELL-/bin/sh} - --# Maximum number of lines to put in a shell here document. --# This variable seems obsolete. It should probably be removed, and --# only ac_max_sed_lines should be used. --: ${ac_max_here_lines=38} -+case X$ECHO in -+X*--fallback-echo) -+ # Remove one level of quotation (which was required for Make). -+ ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` -+ ;; -+esac - --# Identity of this package. --PACKAGE_NAME= --PACKAGE_TARNAME= --PACKAGE_VERSION= --PACKAGE_STRING= --PACKAGE_BUGREPORT= -+echo=${ECHO-echo} -+if test "X$1" = X--no-reexec; then -+ # Discard the --no-reexec flag, and continue. -+ shift -+elif test "X$1" = X--fallback-echo; then -+ # Avoid inline document here, it may be left over -+ : -+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then -+ # Yippee, $echo works! -+ : -+else -+ # Restart under the correct shell. -+ exec $SHELL "$0" --no-reexec ${1+"$@"} -+fi - --ac_unique_file="gsmlib/gsm_error.h" --# Factoring default headers for most tests. --ac_includes_default="\ --#include --#if HAVE_SYS_TYPES_H --# include --#endif --#if HAVE_SYS_STAT_H --# include --#endif --#if STDC_HEADERS --# include --# include --#else --# if HAVE_STDLIB_H --# include --# endif --#endif --#if HAVE_STRING_H --# if !STDC_HEADERS && HAVE_MEMORY_H --# include --# endif --# include --#endif --#if HAVE_STRINGS_H --# include --#endif --#if HAVE_INTTYPES_H --# include --#else --# if HAVE_STDINT_H --# include --# endif --#endif --#if HAVE_UNISTD_H --# include --#endif" -+if test "X$1" = X--fallback-echo; then -+ # used as fallback echo -+ shift -+ cat </dev/null 2>&1 && unset CDPATH -+ -+if test -z "$ECHO"; then -+if test "X${echo_test_string+set}" != Xset; then -+# find a string as large as possible, as long as the shell can cope with it -+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do -+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... -+ if (echo_test_string=`eval $cmd`) 2>/dev/null && -+ echo_test_string=`eval $cmd` && -+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null -+ then -+ break -+ fi -+ done -+fi -+ -+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ : -+else -+ # The Solaris, AIX, and Digital Unix default echo programs unquote -+ # backslashes. This makes it impossible to quote backslashes using -+ # echo "$something" | sed 's/\\/\\\\/g' -+ # -+ # So, first we look for a working echo in the user's PATH. -+ -+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -+ for dir in $PATH /usr/ucb; do -+ IFS="$lt_save_ifs" -+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && -+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ echo="$dir/echo" -+ break -+ fi -+ done -+ IFS="$lt_save_ifs" -+ -+ if test "X$echo" = Xecho; then -+ # We didn't find a better echo, so look for alternatives. -+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ # This shell has a builtin print -r that does the trick. -+ echo='print -r' -+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && -+ test "X$CONFIG_SHELL" != X/bin/ksh; then -+ # If we have ksh, try running configure again with it. -+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -+ export ORIGINAL_CONFIG_SHELL -+ CONFIG_SHELL=/bin/ksh -+ export CONFIG_SHELL -+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} -+ else -+ # Try using printf. -+ echo='printf %s\n' -+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ # Cool, printf works -+ : -+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && -+ test "X$echo_testing_string" = 'X\t' && -+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL -+ export CONFIG_SHELL -+ SHELL="$CONFIG_SHELL" -+ export SHELL -+ echo="$CONFIG_SHELL $0 --fallback-echo" -+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && -+ test "X$echo_testing_string" = 'X\t' && -+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && -+ test "X$echo_testing_string" = "X$echo_test_string"; then -+ echo="$CONFIG_SHELL $0 --fallback-echo" -+ else -+ # maybe with a smaller string... -+ prev=: -+ -+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do -+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null -+ then -+ break -+ fi -+ prev="$cmd" -+ done -+ -+ if test "$prev" != 'sed 50q "$0"'; then -+ echo_test_string=`eval $prev` -+ export echo_test_string -+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} -+ else -+ # Oops. We lost completely, so just stick with echo. -+ echo=echo -+ fi -+ fi -+ fi -+ fi -+fi -+fi -+ -+# Copy echo and quote the copy suitably for passing to libtool from -+# the Makefile, instead of quoting the original, which is used later. -+ECHO=$echo -+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then -+ ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -+fi -+ -+ -+ -+ -+tagnames=${tagnames+${tagnames},}CXX -+ -+tagnames=${tagnames+${tagnames},}F77 -+ -+# Name of the host. -+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -+# so uname gets run too. -+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -+ -+exec 6>&1 -+ -+# -+# Initializations. -+# -+ac_default_prefix=/usr/local -+ac_config_libobj_dir=. -+cross_compiling=no -+subdirs= -+MFLAGS= -+MAKEFLAGS= -+SHELL=${CONFIG_SHELL-/bin/sh} -+ -+# Maximum number of lines to put in a shell here document. -+# This variable seems obsolete. It should probably be removed, and -+# only ac_max_sed_lines should be used. -+: ${ac_max_here_lines=38} -+ -+# Identity of this package. -+PACKAGE_NAME= -+PACKAGE_TARNAME= -+PACKAGE_VERSION= -+PACKAGE_STRING= -+PACKAGE_BUGREPORT= -+ -+ac_unique_file="gsmlib/gsm_error.h" -+# Factoring default headers for most tests. -+ac_includes_default="\ -+#include -+#if HAVE_SYS_TYPES_H -+# include -+#endif -+#if HAVE_SYS_STAT_H -+# include -+#endif -+#if STDC_HEADERS -+# include -+# include -+#else -+# if HAVE_STDLIB_H -+# include -+# endif -+#endif -+#if HAVE_STRING_H -+# if !STDC_HEADERS && HAVE_MEMORY_H -+# include -+# endif -+# include -+#endif -+#if HAVE_STRINGS_H -+# include -+#endif -+#if HAVE_INTTYPES_H -+# include -+#else -+# if HAVE_STDINT_H -+# include -+# endif -+#endif -+#if HAVE_UNISTD_H -+# include -+#endif" - -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ALLOCA GSM_VERSION MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE GLIBC2 GLIBC21 INTL_MACOSX_LIBS HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB COMPILE_INTL_TRUE COMPILE_INTL_FALSE LIBOBJS LTLIBOBJS' -+ac_subst_files='' - - # Initialize some variables set by options. - ac_init_help= -@@ -812,7 +822,7 @@ - - # Be sure to have absolute paths. - for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ -- localstatedir libdir includedir oldincludedir infodir mandir -+ localstatedir libdir includedir oldincludedir infodir mandir - do - eval ac_val=$`echo $ac_var` - case $ac_val in -@@ -852,10 +862,10 @@ - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || - $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -- X"$0" : 'X\(//\)[^/]' \| \ -- X"$0" : 'X\(//\)$' \| \ -- X"$0" : 'X\(/\)' \| \ -- . : '\(.\)' 2>/dev/null || -+ X"$0" : 'X\(//\)[^/]' \| \ -+ X"$0" : 'X\(//\)$' \| \ -+ X"$0" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || - echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } -@@ -878,6 +888,9 @@ - { (exit 1); exit 1; }; } - fi - fi -+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || -+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 -+ { (exit 1); exit 1; }; } - srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` - ac_env_build_alias_set=${build_alias+set} - ac_env_build_alias_value=$build_alias -@@ -919,6 +932,18 @@ - ac_env_CXXFLAGS_value=$CXXFLAGS - ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} - ac_cv_env_CXXFLAGS_value=$CXXFLAGS -+ac_env_CXXCPP_set=${CXXCPP+set} -+ac_env_CXXCPP_value=$CXXCPP -+ac_cv_env_CXXCPP_set=${CXXCPP+set} -+ac_cv_env_CXXCPP_value=$CXXCPP -+ac_env_F77_set=${F77+set} -+ac_env_F77_value=$F77 -+ac_cv_env_F77_set=${F77+set} -+ac_cv_env_F77_value=$F77 -+ac_env_FFLAGS_set=${FFLAGS+set} -+ac_env_FFLAGS_value=$FFLAGS -+ac_cv_env_FFLAGS_set=${FFLAGS+set} -+ac_cv_env_FFLAGS_value=$FFLAGS - - # - # Report the --help message. -@@ -952,9 +977,9 @@ - cat <<_ACEOF - Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX -- [$ac_default_prefix] -+ [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX -- [PREFIX] -+ [PREFIX] - - By default, \`make install' will install all the files in - \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -@@ -998,24 +1023,31 @@ - Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] -- --disable-dependency-tracking Speeds up one-time builds -- --enable-dependency-tracking Do not reject slow dependency extractors -- --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-dependency-tracking speeds up one-time build -+ --enable-dependency-tracking do not reject slow dependency extractors -+ --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-rpath do not hardcode runtime library paths - --disable-nls do not use Native Language Support -+ --disable-rpath do not hardcode runtime library paths - - Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) -+ --with-gnu-ld assume the C compiler uses GNU ld [default=no] -+ --with-pic try to use only PIC/non-PIC objects [default=use -+ both] -+ --with-tags[=TAGS] -+ include additional configurations [automatic] - --with-gnu-ld assume the C compiler uses GNU ld default=no -- --with-pic try to use only PIC/non-PIC objects default=use both -- --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib -+ --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib - --without-libiconv-prefix don't search for libiconv in includedir and libdir - --with-included-gettext use the GNU gettext library included here -- --with-libintl-prefix=DIR search for libintl in DIR/include and DIR/lib -+ --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib - --without-libintl-prefix don't search for libintl in includedir and libdir - - Some influential environment variables: -@@ -1028,6 +1060,9 @@ - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags -+ CXXCPP C++ preprocessor -+ F77 Fortran 77 compiler command -+ FFLAGS Fortran 77 compiler flags - - Use these variables to override the choices made by `configure' or to help - it to find libraries and programs with nonstandard names/locations. -@@ -1065,12 +1100,45 @@ - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; - esac --# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be --# absolute. --ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` --ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` --ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` --ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` -+ -+# Do not use `cd foo && pwd` to compute absolute paths, because -+# the directories may not exist. -+case `pwd` in -+.) ac_abs_builddir="$ac_dir";; -+*) -+ case "$ac_dir" in -+ .) ac_abs_builddir=`pwd`;; -+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; -+ *) ac_abs_builddir=`pwd`/"$ac_dir";; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_top_builddir=${ac_top_builddir}.;; -+*) -+ case ${ac_top_builddir}. in -+ .) ac_abs_top_builddir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; -+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_srcdir=$ac_srcdir;; -+*) -+ case $ac_srcdir in -+ .) ac_abs_srcdir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; -+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_top_srcdir=$ac_top_srcdir;; -+*) -+ case $ac_top_srcdir in -+ .) ac_abs_top_srcdir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; -+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; -+ esac;; -+esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. -@@ -1081,13 +1149,13 @@ - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || -- test -f $ac_srcdir/configure.in; then -+ test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi -- cd $ac_popdir -+ cd "$ac_popdir" - done - fi - -@@ -1095,8 +1163,7 @@ - if $ac_init_version; then - cat <<\_ACEOF - --Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 --Free Software Foundation, Inc. -+Copyright (C) 2003 Free Software Foundation, Inc. - This configure script is free software; the Free Software Foundation - gives unlimited permission to copy, distribute and modify it. - _ACEOF -@@ -1108,7 +1175,7 @@ - running configure, to aid debugging if configure makes a mistake. - - It was created by $as_me, which was --generated by GNU Autoconf 2.53. Invocation command line was -+generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -@@ -1160,27 +1227,54 @@ - - # 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_sep= --for ac_arg -+ac_must_keep_next=false -+for ac_pass in 1 2 - do -- case $ac_arg in -- -no-create | --no-create | --no-creat | --no-crea | --no-cre \ -- | --no-cr | --no-c | -n ) continue ;; -- -no-recursion | --no-recursion | --no-recursio | --no-recursi \ -- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) -- continue ;; -- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) -- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; -- esac -- case " $ac_configure_args " in -- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. -- *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" -- ac_sep=" " ;; -- esac -- # Get rid of the leading space. -+ 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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; -+ esac -+ case $ac_pass in -+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; -+ 2) -+ ac_configure_args1="$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 -+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" -+ # Get rid of the leading space. -+ ac_sep=" " -+ ;; -+ esac -+ done - done -+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - - # When interrupted or exit'd, cleanup temporary files, and complete - # config.log. We remove comments because anyway the quotes in there -@@ -1191,6 +1285,7 @@ - # Save into config.log some information that might help in debugging. - { - echo -+ - cat <<\_ASBOX - ## ---------------- ## - ## Cache variables. ## -@@ -1203,16 +1298,45 @@ - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ -- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; -- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" -+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; -+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ -- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" -+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; - } - echo -+ -+ cat <<\_ASBOX -+## ----------------- ## -+## Output variables. ## -+## ----------------- ## -+_ASBOX -+ echo -+ for ac_var in $ac_subst_vars -+ do -+ eval ac_val=$`echo $ac_var` -+ echo "$ac_var='"'"'$ac_val'"'"'" -+ done | sort -+ echo -+ -+ if test -n "$ac_subst_files"; then -+ cat <<\_ASBOX -+## ------------- ## -+## Output files. ## -+## ------------- ## -+_ASBOX -+ echo -+ for ac_var in $ac_subst_files -+ do -+ eval ac_val=$`echo $ac_var` -+ echo "$ac_var='"'"'$ac_val'"'"'" -+ done | sort -+ echo -+ fi -+ - if test -s confdefs.h; then - cat <<\_ASBOX - ## ----------- ## -@@ -1220,14 +1344,14 @@ - ## ----------- ## - _ASBOX - echo -- sed "/^$/d" confdefs.h -+ sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 -- rm -f core core.* *.core && -+ rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -@@ -1307,7 +1431,7 @@ - # value. - ac_cache_corrupted=false - for ac_var in `(set) 2>&1 | -- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do -+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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" -@@ -1324,13 +1448,13 @@ - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then -- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} -- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 - echo "$as_me: former value: $ac_old_val" >&2;} -- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 - echo "$as_me: current value: $ac_new_val" >&2;} -- ac_cache_corrupted=: -+ ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. -@@ -1378,6 +1502,7 @@ - - - -+ - ac_aux_dir= - for ac_dir in scripts $srcdir/scripts; do - if test -f $ac_dir/install-sh; then -@@ -1414,6 +1539,7 @@ - # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag - # AFS /usr/afsws/bin/install, which mishandles nonexistent args - # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -+# OS/2's system install, which has a completely different semantic - # ./install, which can be erroneously created by make from ./install.sh. - echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 - echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -@@ -1430,6 +1556,7 @@ - case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ -+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. -@@ -1437,20 +1564,20 @@ - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do -- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then -- if test $ac_prog = install && -- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then -- # AIX install. It has an incompatible calling convention. -- : -- elif test $ac_prog = install && -- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then -- # program-specific install script used by HP pwplus--don't use. -- : -- else -- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" -- break 3 -- fi -- fi -+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then -+ if test $ac_prog = install && -+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then -+ # AIX install. It has an incompatible calling convention. -+ : -+ elif test $ac_prog = install && -+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then -+ # program-specific install script used by HP pwplus--don't use. -+ : -+ else -+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" -+ break 3 -+ fi -+ fi - done - done - ;; -@@ -1685,9 +1812,7 @@ - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift -- set dummy "$as_dir/$ac_word" ${1+"$@"} -- shift -- ac_cv_prog_CC="$@" -+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi - fi - fi -@@ -1792,8 +1917,10 @@ - fi - - --test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 --echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} -+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -+See \`config.log' for more details." >&5 -+echo "$as_me: error: no acceptable C compiler found in \$PATH -+See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - - # Provide some information about the compiler. -@@ -1817,15 +1944,12 @@ - (exit $ac_status); } - - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -1835,12 +1959,12 @@ - } - _ACEOF - ac_clean_files_save=$ac_clean_files --ac_clean_files="$ac_clean_files a.out a.exe" -+ac_clean_files="$ac_clean_files a.out 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. --echo "$as_me:$LINENO: checking for C compiler default output" >&5 --echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 - ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 -@@ -1854,26 +1978,39 @@ - # Be careful to initialize this variable, since it used to be cached. - # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. - ac_cv_exeext= --for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; -- ls a.out conftest 2>/dev/null; -- ls a.* conftest.* 2>/dev/null`; do -+# b.out is created by i960 compilers. -+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -+do -+ test -f "$ac_file" || continue - case $ac_file in -- *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; -- a.out ) # We found the default executable, but exeext='' is most -- # certainly right. -- break;; -- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` -- # FIXME: I believe we export ac_cv_exeext for Libtool --akim. -- export ac_cv_exeext -- break;; -- * ) break;; -+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) -+ ;; -+ conftest.$ac_ext ) -+ # This is the source file. -+ ;; -+ [ab].out ) -+ # We found the default executable, but exeext='' is most -+ # certainly right. -+ break;; -+ *.* ) -+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` -+ # FIXME: I believe we export ac_cv_exeext for Libtool, -+ # but it would be cool to find out if it's true. Does anybody -+ # maintain Libtool? --akim. -+ export ac_cv_exeext -+ break;; -+ * ) -+ break;; - esac - done - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 --echo "$as_me: error: C compiler cannot create executables" >&2;} -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -+See \`config.log' for more details." >&5 -+echo "$as_me: error: C compiler cannot create executables -+See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } - fi - -@@ -1900,9 +2037,11 @@ - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. --If you meant to cross compile, use \`--host'." >&5 -+If you meant to cross compile, use \`--host'. -+See \`config.log' for more details." >&5 - echo "$as_me: error: cannot run C compiled programs. --If you meant to cross compile, use \`--host'." >&2;} -+If you meant to cross compile, use \`--host'. -+See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -@@ -1910,7 +2049,7 @@ - echo "$as_me:$LINENO: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - --rm -f a.out a.exe conftest$ac_cv_exeext -+rm -f a.out a.exe conftest$ac_cv_exeext b.out - ac_clean_files=$ac_clean_files_save - # Check the compiler produces executables we can run. If not, either - # the compiler is broken, or we cross compile. -@@ -1930,18 +2069,21 @@ - # 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 `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do -+for ac_file in conftest.exe conftest conftest.*; do -+ test -f "$ac_file" || continue - case $ac_file in -- *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; -+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` -- export ac_cv_exeext -- break;; -+ export ac_cv_exeext -+ break;; - * ) break;; - esac - done - else -- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 --echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} -+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -+See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - -@@ -1958,15 +2100,12 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -1983,16 +2122,19 @@ - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in -- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; -+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac - done - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 --echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute suffix of object files: cannot compile -+See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - -@@ -2008,15 +2150,12 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -2030,11 +2169,20 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -2043,10 +2191,11 @@ - ac_compiler_gnu=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ac_compiler_gnu=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_c_compiler_gnu=$ac_compiler_gnu - - fi -@@ -2062,15 +2211,12 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -2081,11 +2227,20 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -2094,10 +2249,11 @@ - ac_cv_prog_cc_g=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ac_cv_prog_cc_g=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 - echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -@@ -2116,6 +2272,120 @@ - CFLAGS= - fi - fi -+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -+if test "${ac_cv_prog_cc_stdc+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_cv_prog_cc_stdc=no -+ac_save_CC=$CC -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* 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 -std1 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 -std1. */ -+int osf4_cc_array ['\x00' == 0 ? 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 -+# Don't try gcc -ansi; that turns off useful extensions and -+# breaks some systems' header files. -+# AIX -qlanglvl=ansi -+# Ultrix and OSF/1 -std1 -+# HP-UX 10.20 and later -Ae -+# HP-UX older versions -Aa -D_HPUX_SOURCE -+# SVR4 -Xc -D__EXTENSIONS__ -+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -+do -+ CC="$ac_save_CC $ac_arg" -+ rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_prog_cc_stdc=$ac_arg -+break -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext -+done -+rm -f conftest.$ac_ext conftest.$ac_objext -+CC=$ac_save_CC -+ -+fi -+ -+case "x$ac_cv_prog_cc_stdc" in -+ x|xno) -+ echo "$as_me:$LINENO: result: none needed" >&5 -+echo "${ECHO_T}none needed" >&6 ;; -+ *) -+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -+ CC="$CC $ac_cv_prog_cc_stdc" ;; -+esac -+ - # Some people use a C++ compiler to compile C. Since we use `exit', - # in C++ we need to declare it. In case someone uses the same compiler - # for both compiling C and C++ we need to have the C++ compiler decide -@@ -2127,19 +2397,27 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ -- ''\ -- '#include ' \ -+ '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ -@@ -2147,16 +2425,13 @@ - 'void exit (int);' - do - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_declaration --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+#include - int - main () - { -@@ -2167,11 +2442,20 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -2180,20 +2464,18 @@ - : - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - continue - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_declaration --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -2204,11 +2486,20 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -2217,9 +2508,10 @@ - break - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done - rm -f conftest* - if test -n "$ac_declaration"; then -@@ -2230,9 +2522,10 @@ - - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c - ac_cpp='$CPP $CPPFLAGS' - ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -2249,8 +2542,11 @@ - ac_check_lib_save_LIBS=$LIBS - LIBS="-lintl $LIBS" - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus -@@ -2259,12 +2555,6 @@ - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ - char textdomain (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -2275,11 +2565,20 @@ - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -2288,10 +2587,12 @@ - ac_cv_lib_intl_textdomain=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ac_cv_lib_intl_textdomain=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi - echo "$as_me:$LINENO: result: $ac_cv_lib_intl_textdomain" >&5 -@@ -2306,14 +2607,10 @@ - fi - - --# Add the stamp file to the list of files AC keeps track of, --# along with our hook. --ac_config_headers="$ac_config_headers gsm_config.h" -+ ac_config_headers="$ac_config_headers gsm_config.h" - - -- -- --am__api_version="1.6" -+am__api_version="1.9" - echo "$as_me:$LINENO: checking whether build environment is sane" >&5 - echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 - # Just in case -@@ -2372,7 +2669,6 @@ - program_transform_name=`echo $program_transform_name | sed -f conftest.sed` - rm conftest.sed - -- - # expand $ac_aux_dir to an absolute path - am_aux_dir=`cd $ac_aux_dir && pwd` - -@@ -2386,6 +2682,39 @@ - echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} - fi - -+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then -+ # We used to keeping the `.' as first argument, in order to -+ # allow $(mkdir_p) to be used without argument. As in -+ # $(mkdir_p) $(somedir) -+ # where $(somedir) is conditionally defined. However this is wrong -+ # for two reasons: -+ # 1. if the package is installed by a user who cannot write `.' -+ # make install will fail, -+ # 2. the above comment should most certainly read -+ # $(mkdir_p) $(DESTDIR)$(somedir) -+ # so it does not work when $(somedir) is undefined and -+ # $(DESTDIR) is not. -+ # To support the latter case, we have to write -+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), -+ # so the `.' trick is pointless. -+ mkdir_p='mkdir -p --' -+else -+ # On NextStep and OpenStep, the `mkdir' command does not -+ # recognize any option. It will interpret all options as -+ # directories to create, and then abort because `.' already -+ # exists. -+ for d in ./-p ./--version; -+ do -+ test -d $d && rmdir $d -+ done -+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. -+ if test -f "$ac_aux_dir/mkinstalldirs"; then -+ mkdir_p='$(mkinstalldirs)' -+ else -+ mkdir_p='$(install_sh) -d' -+ fi -+fi -+ - 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. -@@ -2426,15 +2755,15 @@ - test -n "$AWK" && break - done - --echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 --echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 --set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` -+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` - if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.make <<\_ACEOF - all: -- @echo 'ac_maketemp="${MAKE}"' -+ @echo 'ac_maketemp="$(MAKE)"' - _ACEOF - # GNU make sometimes prints "make[1]: Entering...", which would confuse us. - eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -@@ -2455,24 +2784,25 @@ - SET_MAKE="MAKE=${MAKE-make}" - fi - --rm -f .deps 2>/dev/null --mkdir .deps 2>/dev/null --if test -d .deps; then -- DEPDIR=.deps -+rm -rf .tst 2>/dev/null -+mkdir .tst 2>/dev/null -+if test -d .tst; then -+ am__leading_dot=. - else -- # MS-DOS does not allow filenames that begin with a dot. -- DEPDIR=_deps -+ am__leading_dot=_ - fi --rmdir .deps 2>/dev/null -+rmdir .tst 2>/dev/null - -+DEPDIR="${am__leading_dot}deps" - --ac_config_commands="$ac_config_commands depfiles" -+ ac_config_commands="$ac_config_commands depfiles" - - - am_make=${MAKE-make} - cat > confinc << 'END' --doit: -+am__doit: - @echo done -+.PHONY: am__doit - END - # If we don't find an include directive, just comment out the code. - echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -@@ -2487,7 +2817,7 @@ - # In particular we don't look at `^make:' because GNU make might - # be invoked under some other name (usually "gmake"), in which - # case it prints its new name instead of `make'. --if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then -+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -@@ -2528,7 +2858,7 @@ - - - -- # test to see if srcdir already configured -+# test to see if srcdir already configured - if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -@@ -2536,6 +2866,16 @@ - { (exit 1); exit 1; }; } - fi - -+# test whether we have cygpath -+if test -z "$CYGPATH_W"; then -+ if (cygpath --version) >/dev/null 2>/dev/null; then -+ CYGPATH_W='cygpath -w' -+ else -+ CYGPATH_W=echo -+ fi -+fi -+ -+ - # Define the identity of the package. - PACKAGE=gsmlib - VERSION=1.10 -@@ -2566,9 +2906,6 @@ - - MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -- --AMTAR=${AMTAR-"${am_missing_run}tar"} -- - install_sh=${install_sh-"$am_aux_dir/install-sh"} - - # Installed binaries are usually stripped using `strip' when the user -@@ -2661,6 +2998,13 @@ - - # We need awk for the "check" target. The system "awk" is bad on - # some platforms. -+# Always define AMTAR for backward compatibility. -+ -+AMTAR=${AMTAR-"${am_missing_run}tar"} -+ -+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' -+ -+ - - - depcc="$CC" am_compiler_list= -@@ -2681,18 +3025,34 @@ - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir -+ # We will build objects and dependencies in a subdirectory because -+ # it helps to detect inapplicable dependency modes. For instance -+ # both Tru64's cc and ICC support -MD to output dependencies as a -+ # side effect of compilation, but ICC will put the dependencies in -+ # the current directory while Tru64 will put them in the object -+ # directory. -+ mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do -+ # Setup a source with many dependencies, because some compilers -+ # like to wrap large dependency lists on column 80 (with \), and -+ # we should not choose a depcomp mode which is confused by this. -+ # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. -- echo '#include "conftest.h"' > conftest.c -- echo 'int i;' > conftest.h -- echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf -+ : > sub/conftest.c -+ for i in 1 2 3 4 5 6; do -+ echo '#include "conftst'$i'.h"' >> sub/conftest.c -+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with -+ # Solaris 8's {/usr,}/bin/sh. -+ touch sub/conftst$i.h -+ done -+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) -@@ -2710,13 +3070,25 @@ - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ -- source=conftest.c object=conftest.o \ -- depfile=conftest.Po tmpdepfile=conftest.TPo \ -- $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && -- grep conftest.h conftest.Po > /dev/null 2>&1 && -+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ -+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ -+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ -+ >/dev/null 2>conftest.err && -+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && -+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then -- am_cv_CC_dependencies_compiler_type=$depmode -- break -+ # icc doesn't choke on unknown options, it will just issue warnings -+ # or remarks (even with -Werror). So we grep stderr for any message -+ # that says an option was ignored or not supported. -+ # When given -MP, icc 7.0 and 7.1 complain thusly: -+ # icc: Command line warning: ignoring option '-M'; no argument required -+ # The diagnosis changed in icc 8.0: -+ # icc: Command line remark: option '-MP' not supported -+ if (grep 'ignoring option' conftest.err || -+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else -+ am_cv_CC_dependencies_compiler_type=$depmode -+ break -+ fi - fi - done - -@@ -2733,30 +3105,44 @@ - - - -+if -+ test "x$enable_dependency_tracking" != xno \ -+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then -+ am__fastdepCC_TRUE= -+ am__fastdepCC_FALSE='#' -+else -+ am__fastdepCC_TRUE='#' -+ am__fastdepCC_FALSE= -+fi -+ -+ -+ - - # Check whether --enable-shared or --disable-shared was given. - if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} --case $enableval in --yes) enable_shared=yes ;; --no) enable_shared=no ;; --*) -- enable_shared=no -- # Look at the argument we got. We use all the common list separators. -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," -- for pkg in $enableval; do -- if test "X$pkg" = "X$p"; then -- enable_shared=yes -- fi -- done -- IFS="$ac_save_ifs" -- ;; --esac -+ 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; - -+ - if test "$CXXFLAGS" = ""; then - CXXFLAGS="-O2" - fi -@@ -2774,46 +3160,50 @@ - if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} --case $enableval in --yes) enable_static=yes ;; --no) enable_static=no ;; --*) -- enable_static=no -- # Look at the argument we got. We use all the common list separators. -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," -- for pkg in $enableval; do -- if test "X$pkg" = "X$p"; then -- enable_static=yes -- fi -- done -- IFS="$ac_save_ifs" -- ;; --esac -+ 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 --enable-fast-install or --disable-fast-install was given. - if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} --case $enableval in --yes) enable_fast_install=yes ;; --no) enable_fast_install=no ;; --*) -- enable_fast_install=no -- # Look at the argument we got. We use all the common list separators. -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," -- for pkg in $enableval; do -- if test "X$pkg" = "X$p"; then -- enable_fast_install=yes -- fi -- done -- IFS="$ac_save_ifs" -- ;; --esac -+ 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; -+ - # Make sure we can run config.sub. - $ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -@@ -2868,16 +3258,77 @@ - host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - --# Find the correct PATH separator. Usually this is `:', but --# DJGPP uses `;' like DOS. --if test "X${PATH_SEPARATOR+set}" != Xset; then -- UNAME=${UNAME-`uname 2>/dev/null`} -- case X$UNAME in -- *-DOS) lt_cv_sys_path_separator=';' ;; -- *) lt_cv_sys_path_separator=':' ;; -- esac -- PATH_SEPARATOR=$lt_cv_sys_path_separator -+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -+if test "${lt_cv_path_SED+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ # Loop through the user's path and test for sed and gsed. -+# Then use that list of sed's as ones to test for truncation. -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for lt_ac_prog in sed gsed; do -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then -+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" -+ fi -+ done -+ done -+done -+lt_ac_max=0 -+lt_ac_count=0 -+# Add /usr/xpg4/bin/sed as it is typically found on Solaris -+# along with /bin/sed that truncates output. -+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do -+ test ! -f $lt_ac_sed && continue -+ cat /dev/null > conftest.in -+ lt_ac_count=0 -+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in -+ # Check for GNU sed and select it if it is found. -+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then -+ lt_cv_path_SED=$lt_ac_sed -+ break -+ fi -+ while true; do -+ cat conftest.in conftest.in >conftest.tmp -+ mv conftest.tmp conftest.in -+ cp conftest.in conftest.nl -+ echo >>conftest.nl -+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break -+ cmp -s conftest.out conftest.nl || break -+ # 10000 chars as input seems more than enough -+ test $lt_ac_count -gt 10 && break -+ lt_ac_count=`expr $lt_ac_count + 1` -+ if test $lt_ac_count -gt $lt_ac_max; then -+ lt_ac_max=$lt_ac_count -+ lt_cv_path_SED=$lt_ac_sed -+ fi -+ done -+done -+ -+fi -+ -+SED=$lt_cv_path_SED -+echo "$as_me:$LINENO: result: $SED" >&5 -+echo "${ECHO_T}$SED" >&6 -+ -+echo "$as_me:$LINENO: checking for egrep" >&5 -+echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -+if test "${ac_cv_prog_egrep+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1 -+ then ac_cv_prog_egrep='grep -E' -+ else ac_cv_prog_egrep='egrep' -+ fi - fi -+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -+echo "${ECHO_T}$ac_cv_prog_egrep" >&6 -+ EGREP=$ac_cv_prog_egrep -+ - - - # Check whether --with-gnu-ld or --without-gnu-ld was given. -@@ -2890,8 +3341,8 @@ - ac_prog=ld - if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. -- echo "$as_me:$LINENO: checking for ld used by GCC" >&5 --echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 -+ echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw -@@ -2901,12 +3352,12 @@ - esac - case $ac_prog in - # Accept absolute paths. -- [\\/]* | [A-Za-z]:[\\/]*) -+ [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' -- # Canonicalize the path of ld -- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` -+ # 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%/%"` -+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; -@@ -2930,22 +3381,26 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - if test -z "$LD"; then -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -+ 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 GNU ld's only accept -v. -+ # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. -- if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then -+ case `"$lt_cv_path_LD" -v 2>&1 &6 - else -- # I'd rather use --version here, but apparently some GNU ld's only accept -v. --if $LD -v 2>&1 &5; then -+ # I'd rather use --version here, but apparently some GNU lds only accept -v. -+case `$LD -v 2>&1 &5 - echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -@@ -2989,7 +3447,20 @@ - echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 - echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 - reload_flag=$lt_cv_ld_reload_flag --test -n "$reload_flag" && reload_flag=" $reload_flag" -+case $reload_flag in -+"" | " "*) ;; -+*) reload_flag=" $reload_flag" ;; -+esac -+reload_cmds='$LD$reload_flag -o $output$reload_objs' -+case $host_os in -+ darwin*) -+ if test "$GCC" = yes; then -+ reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' -+ else -+ reload_cmds='$LD$reload_flag -o $output$reload_objs' -+ fi -+ ;; -+esac - - echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 - echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 -@@ -3000,35 +3471,42 @@ - # Let the user override the test. - lt_cv_path_NM="$NM" - else -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do -+ IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. -- tmp_nm=$ac_dir/${ac_tool_prefix}nm -- if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then -+ tmp_nm="$ac_dir/${ac_tool_prefix}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 -- if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then -+ 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 -- elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then -- lt_cv_path_NM="$tmp_nm -p" -- break -- else -- 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 -- fi -+ ;; -+ *) -+ 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="$ac_save_ifs" -+ IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm - fi - fi -- -+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -+echo "${ECHO_T}$lt_cv_path_NM" >&6 - NM="$lt_cv_path_NM" --echo "$as_me:$LINENO: result: $NM" >&5 --echo "${ECHO_T}$NM" >&6 - - echo "$as_me:$LINENO: checking whether ln -s works" >&5 - echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 -@@ -3041,8 +3519,8 @@ - echo "${ECHO_T}no, using $LN_S" >&6 - fi - --echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 --echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 -+echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 -+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 - if test "${lt_cv_deplibs_check_method+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -@@ -3056,7 +3534,7 @@ - # 'pass_all' -- all dependencies passed with no checks. - # 'test_compile' -- check by making test program. - # 'file_magic [[regex]]' -- check by looking for files in library path --# which responds to the $file_magic_cmd with a given egrep regex. -+# 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. - -@@ -3069,37 +3547,36 @@ - lt_cv_deplibs_check_method=pass_all - ;; - --bsdi4*) -+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* | mingw* | pw32*) -+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'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - - darwin* | rhapsody*) -- lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' -- lt_cv_file_magic_cmd='/usr/bin/file -L' -- case "$host_os" in -- rhapsody* | darwin1.[012]) -- lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` -- ;; -- *) # Darwin 1.3 on -- lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' -- ;; -- esac -+ lt_cv_deplibs_check_method=pass_all - ;; - --freebsd*) -+freebsd* | kfreebsd*-gnu | 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)/i[3-9]86 (compact )?demand paged shared library' -+ 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.*` - ;; -@@ -3113,50 +3590,44 @@ - lt_cv_deplibs_check_method=pass_all - ;; - --hpux10.20*|hpux11*) -- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' -+hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file -- lt_cv_file_magic_test_file=/usr/lib/libc.sl -- ;; -- --irix5* | irix6*) -- case $host_os in -- irix5*) -- # this will be overridden with pass_all, but let us keep it just in case -- lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" -+ 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]) shared object file - PA-RISC [0-9].[0-9]' -+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) -- case $LD in -- *-32|*"-32 ") libmagic=32-bit;; -- *-n32|*"-n32 ") libmagic=N32;; -- *-64|*"-64 ") libmagic=64-bit;; -- *) libmagic=never-match;; -- esac -- # this will be overridden with pass_all, but let us keep it just in case -- lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" -+ 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 -- lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` -+ ;; -+ -+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-gnu*) -- case $host_cpu in -- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) -- lt_cv_deplibs_check_method=pass_all ;; -- *) -- # glibc up to 2.1.1 does not perform some relocations on ARM -- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; -- esac -- lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` -+linux*) -+ lt_cv_deplibs_check_method=pass_all - ;; - --netbsd*) -+netbsd* | netbsdelf*-gnu | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then -- lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' -+ 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$' -+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -@@ -3166,20 +3637,19 @@ - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -+nto-qnx*) -+ lt_cv_deplibs_check_method=unknown -+ ;; -+ - openbsd*) -- lt_cv_file_magic_cmd=/usr/bin/file -- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then -- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' -+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else -- lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' -+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - - osf3* | osf4* | osf5*) -- # this will be overridden with pass_all, but let us keep it just in case -- lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' -- lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -@@ -3189,11 +3659,6 @@ - - solaris*) - lt_cv_deplibs_check_method=pass_all -- lt_cv_file_magic_test_file=/lib/libc.so -- ;; -- --sysv5uw[78]* | sysv4*uw2*) -- lt_cv_deplibs_check_method=pass_all - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -@@ -3214,8 +3679,15 @@ - 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 -+ ;; - esac - ;; -+ -+sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) -+ lt_cv_deplibs_check_method=pass_all -+ ;; - esac - - fi -@@ -3223,207 +3695,208 @@ - echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 - 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 no C compiler was specified, use CC. -+LTCC=${LTCC-"$CC"} - -+# Allow CC to be a program name with arguments. -+compiler=$CC - -+# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -+if test "${enable_libtool_lock+set}" = set; then -+ enableval="$enable_libtool_lock" - --# Check for command to grab the raw symbol name followed by C symbol from nm. --echo "$as_me:$LINENO: checking command to parse $NM output" >&5 --echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 --if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&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]*\)' -- --# Transform the above into a raw symbol and a C symbol. --symxfrm='\1 \2\3 \3' -- --# Transform an extracted symbol line into a proper C declaration --lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" -- --# Transform an extracted symbol line into symbol name and symbol address --lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -- --# Define system-specific variables. --case $host_os in --aix*) -- symcode='[BCDT]' -- ;; --cygwin* | mingw* | pw32*) -- symcode='[ABCDGISTW]' -- ;; --hpux*) # Its linker distinguishes data from code symbols -- lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" -- lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -- ;; --irix*) -- symcode='[BCDEGRST]' -- ;; --solaris* | sysv5*) -- symcode='[BDT]' -- ;; --sysv4) -- symcode='[DFNSTU]' -- ;; --esac -- --# Handle CRLF in mingw tool chain --opt_cr= --case $host_os in --mingw*) -- opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp -- ;; --esac -- --# If we're using GNU nm, then use its standard symbol codes. --if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then -- symcode='[ABCDGISTW]' --fi -- --# Try without a prefix undercore, then with it. --for ac_symprfx in "" "_"; do -- -- # Write the raw and C identifiers. --lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" -- -- # Check to see that the pipe works correctly. -- pipe_works=no -- rm -f conftest* -- cat > conftest.$ac_ext < conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then -- # Now try to grab the symbols. -- nlist=conftest.nm -- if { (eval echo "$as_me:$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 -+ 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 3740 "configure"' > conftest.$ac_ext -+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && 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 -+ (exit $ac_status); }; 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* -+ ;; - -- # Make sure that we snagged all the symbols we need. -- if egrep ' nm_test_var$' "$nlist" >/dev/null; then -- if egrep ' nm_test_func$' "$nlist" >/dev/null; then -- cat < conftest.$ac_ext --#ifdef __cplusplus --extern "C" { --#endif -+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) -+ # Find out which ABI we are using. -+ echo 'int i;' > conftest.$ac_ext -+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ case `/usr/bin/file conftest.o` in -+ *32-bit*) -+ case $host in -+ 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-*linux*) -+ LD="${LD-ld} -m elf_x86_64" -+ ;; -+ ppc*-*linux*|powerpc*-*linux*) -+ LD="${LD-ld} -m elf64ppc" -+ ;; -+ s390*-*linux*) -+ LD="${LD-ld} -m elf64_s390" -+ ;; -+ sparc*-*linux*) -+ LD="${LD-ld} -m elf64_sparc" -+ ;; -+ esac -+ ;; -+ esac -+ fi -+ rm -rf conftest* -+ ;; - --EOF -- # Now generate the symbol file. -- eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' -+*-*-sco3.2v5*) -+ # On SCO OpenServer 5, we need -belf to get full-featured binaries. -+ SAVE_CFLAGS="$CFLAGS" -+ CFLAGS="$CFLAGS -belf" -+ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 -+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 -+if test "${lt_cv_cc_needs_belf+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 <> conftest.$ac_ext --#if defined (__STDC__) && __STDC__ --# define lt_ptr void * --#else --# define lt_ptr char * --# define const --#endif -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --/* The mapping between symbol names and symbols. */ --const struct { -- const char *name; -- lt_ptr address; --} --lt_preloaded_symbols[] = -+int -+main () - { --EOF -- sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext -- cat <<\EOF >> conftest.$ac_ext -- {0, (lt_ptr) 0} --}; - --#ifdef __cplusplus -+ ; -+ return 0; - } --#endif --EOF -- # Now try linking the two files. -- mv conftest.$ac_objext conftstm.$ac_objext -- save_LIBS="$LIBS" -- save_CFLAGS="$CFLAGS" -- LIBS="conftstm.$ac_objext" -- CFLAGS="$CFLAGS$no_builtin_flag" -- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && test -s conftest; then -- pipe_works=yes -- fi -- LIBS="$save_LIBS" -- CFLAGS="$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 -f 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 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ lt_cv_cc_needs_belf=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+lt_cv_cc_needs_belf=no - fi -+rm -f 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 - --global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" --if test -z "$lt_cv_sys_global_symbol_pipe"; then -- global_symbol_to_cdecl= -- global_symbol_to_c_name_address= --else -- global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" -- global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" --fi --if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; --then -- echo "$as_me:$LINENO: result: failed" >&5 --echo "${ECHO_T}failed" >&6 --else -- echo "$as_me:$LINENO: result: ok" >&5 --echo "${ECHO_T}ok" >&6 - fi -+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 -+echo "${ECHO_T}$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 -+ ;; -+ -+esac -+ -+need_locks="$enable_libtool_lock" -+ - - ac_ext=c - ac_cpp='$CPP $CPPFLAGS' -@@ -3448,24 +3921,34 @@ - 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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -- Syntax error -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ Syntax error - _ACEOF - if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -@@ -3476,7 +3959,8 @@ - : - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - # Broken: fails on valid input. - continue - fi -@@ -3485,20 +3969,24 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - _ACEOF - if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -@@ -3510,7 +3998,8 @@ - continue - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - # Passes both tests. - ac_preproc_ok=: - break -@@ -3539,24 +4028,34 @@ - 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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -- Syntax error -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ Syntax error - _ACEOF - if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -@@ -3567,7 +4066,8 @@ - : - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - # Broken: fails on valid input. - continue - fi -@@ -3576,20 +4076,24 @@ - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - _ACEOF - if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -@@ -3601,7 +4105,8 @@ - continue - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - # Passes both tests. - ac_preproc_ok=: - break -@@ -3614,8 +4119,10 @@ - if $ac_preproc_ok; then - : - else -- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 --echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} -+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -+See \`config.log' for more details." >&5 -+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -+See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - -@@ -3632,49 +4139,67 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - #include - #include - #include - -+int -+main () -+{ -+ -+ ; -+ return 0; -+} - _ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then - ac_cv_header_stdc=yes - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_cv_header_stdc=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_header_stdc=no - fi --rm -f conftest.err conftest.$ac_ext -+rm -f 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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- egrep "memchr" >/dev/null 2>&1; then -+ $EGREP "memchr" >/dev/null 2>&1; then - : - else - ac_cv_header_stdc=no -@@ -3686,13 +4211,16 @@ - if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - - _ACEOF - if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- egrep "free" >/dev/null 2>&1; then -+ $EGREP "free" >/dev/null 2>&1; then - : - else - ac_cv_header_stdc=no -@@ -3707,16 +4235,20 @@ - : - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #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 ISLOWER(c) \ -+ (('a' <= (c) && (c) <= 'i') \ -+ || ('j' <= (c) && (c) <= 'r') \ -+ || ('s' <= (c) && (c) <= 'z')) - # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) - #endif - -@@ -3727,7 +4259,7 @@ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) -- || toupper (i) != TOUPPER (i)) -+ || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); - } -@@ -3747,11 +4279,12 @@ - else - echo "$as_me: program exited with status $ac_status" >&5 - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ( exit $ac_status ) - ac_cv_header_stdc=no - fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi - fi -@@ -3776,7 +4309,7 @@ - - - for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ -- inttypes.h stdint.h unistd.h -+ inttypes.h stdint.h unistd.h - do - as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` - echo "$as_me:$LINENO: checking for $ac_header" >&5 -@@ -3785,19 +4318,31 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_includes_default - - #include <$ac_header> - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -3806,10 +4351,11 @@ - eval "$as_ac_Header=yes" - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - eval "$as_ac_Header=no" - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi - echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -@@ -3840,18 +4386,30 @@ - echo "$as_me:$LINENO: checking $ac_header usability" >&5 - echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_includes_default - #include <$ac_header> - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -3860,10 +4418,11 @@ - ac_header_compiler=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ac_header_compiler=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 - echo "${ECHO_T}$ac_header_compiler" >&6 - -@@ -3871,20 +4430,24 @@ - echo "$as_me:$LINENO: checking $ac_header presence" >&5 - echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include <$ac_header> - _ACEOF - if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -@@ -3895,7 +4458,8 @@ - ac_header_preproc=yes - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ac_header_preproc=no - fi - rm -f conftest.err conftest.$ac_ext -@@ -3903,26 +4467,43 @@ - echo "${ECHO_T}$ac_header_preproc" >&6 - - # So? What about this header? --case $ac_header_compiler:$ac_header_preproc in -- yes:no ) -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 - echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; -- no:yes ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 - echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 --echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; - esac - echo "$as_me:$LINENO: checking for $ac_header" >&5 - echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 - if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- eval "$as_ac_Header=$ac_header_preproc" -+ eval "$as_ac_Header=\$ac_header_preproc" - fi - echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 - echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -@@ -3937,159 +4518,65 @@ - - done - -- -- -- -- --# Only perform the check for file, if the check method requires it --case $deplibs_check_method in --file_magic*) -- if test "$file_magic_cmd" = '$MAGIC_CMD'; then -- echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 --echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 --if test "${lt_cv_path_MAGIC_CMD+set}" = set; then -+ac_ext=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -+ 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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- case $MAGIC_CMD in -- /*) -- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. -- ;; -- ?:/*) -- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. -- ;; -- *) -- ac_save_MAGIC_CMD="$MAGIC_CMD" -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" -- ac_dummy="/usr/bin:$PATH" -- for ac_dir in $ac_dummy; do -- 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 <&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 -+ if test -n "$CXX"; then -+ ac_cv_prog_CXX="$CXX" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done - --EOF -- fi ;; -- esac -- fi -- break -- fi -- done -- IFS="$ac_save_ifs" -- MAGIC_CMD="$ac_save_MAGIC_CMD" -- ;; --esac - fi -- --MAGIC_CMD="$lt_cv_path_MAGIC_CMD" --if test -n "$MAGIC_CMD"; then -- echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 --echo "${ECHO_T}$MAGIC_CMD" >&6 -+fi -+CXX=$ac_cv_prog_CXX -+if test -n "$CXX"; then -+ echo "$as_me:$LINENO: result: $CXX" >&5 -+echo "${ECHO_T}$CXX" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - --if test -z "$lt_cv_path_MAGIC_CMD"; then -- if test -n "$ac_tool_prefix"; then -- echo "$as_me:$LINENO: checking for file" >&5 --echo $ECHO_N "checking for file... $ECHO_C" >&6 --if test "${lt_cv_path_MAGIC_CMD+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- case $MAGIC_CMD in -- /*) -- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. -- ;; -- ?:/*) -- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. -- ;; -- *) -- ac_save_MAGIC_CMD="$MAGIC_CMD" -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" -- ac_dummy="/usr/bin:$PATH" -- for ac_dir in $ac_dummy; do -- 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 <&2 -- --*** Warning: the command libtool uses to detect shared libraries, --*** $file_magic_cmd, produces output that libtool cannot recognize. --*** The result is that libtool may fail to recognize shared libraries --*** as such. This will affect the creation of libtool libraries that --*** depend on shared libraries, but programs linked with such libtool --*** libraries will work regardless of this problem. Nevertheless, you --*** may want to report the problem to your system manager and/or to --*** bug-libtool@gnu.org -- --EOF -- fi ;; -- esac -- fi -- break -- fi -+ test -n "$CXX" && break - done -- IFS="$ac_save_ifs" -- MAGIC_CMD="$ac_save_MAGIC_CMD" -- ;; --esac --fi -- --MAGIC_CMD="$lt_cv_path_MAGIC_CMD" --if test -n "$MAGIC_CMD"; then -- echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 --echo "${ECHO_T}$MAGIC_CMD" >&6 --else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- else -- MAGIC_CMD=: -- fi - fi -- -- fi -- ;; --esac -- --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 -+if test -z "$CXX"; then -+ ac_ct_CXX=$CXX -+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 - echo "$as_me:$LINENO: checking for $ac_word" >&5 - echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_RANLIB+set}" = set; then -+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- if test -n "$RANLIB"; then -- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -+ if test -n "$ac_ct_CXX"; then -+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. - else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR - for as_dir in $PATH -@@ -4098,7 +4585,7 @@ - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" -+ ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -@@ -4107,4958 +4594,18846 @@ - - fi - fi --RANLIB=$ac_cv_prog_RANLIB --if test -n "$RANLIB"; then -- echo "$as_me:$LINENO: result: $RANLIB" >&5 --echo "${ECHO_T}$RANLIB" >&6 -+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -+if test -n "$ac_ct_CXX"; then -+ echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -+echo "${ECHO_T}$ac_ct_CXX" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 - echo "${ECHO_T}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 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_ac_ct_RANLIB="ranlib" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done -+ test -n "$ac_ct_CXX" && break - done -+test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - -- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" --fi --fi --ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB --if test -n "$ac_ct_RANLIB"; then -- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 --echo "${ECHO_T}$ac_ct_RANLIB" >&6 --else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ CXX=$ac_ct_CXX - fi - -- RANLIB=$ac_ct_RANLIB --else -- RANLIB="$ac_cv_prog_RANLIB" --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 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_STRIP+set}" = set; then -+# Provide some information about the compiler. -+echo "$as_me:$LINENO:" \ -+ "checking for C++ compiler version" >&5 -+ac_compiler=`set X $ac_compile; echo $2` -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 -+ (eval $ac_compiler --version &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 -+ (eval $ac_compiler -v &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 -+ (eval $ac_compiler -V &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ -+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_STRIP="${ac_tool_prefix}strip" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done --done -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --fi --fi --STRIP=$ac_cv_prog_STRIP --if test -n "$STRIP"; then -- echo "$as_me:$LINENO: result: $STRIP" >&5 --echo "${ECHO_T}$STRIP" >&6 -+int -+main () -+{ -+#ifndef __GNUC__ -+ choke me -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_compiler_gnu=yes - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_compiler_gnu=no - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - - 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 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then -+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -+GXX=`test $ac_compiler_gnu = yes && echo yes` -+ac_test_CXXFLAGS=${CXXFLAGS+set} -+ac_save_CXXFLAGS=$CXXFLAGS -+CXXFLAGS="-g" -+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -+if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_ac_ct_STRIP="strip" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done --done -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - -- test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" --fi --fi --ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP --if test -n "$ac_ct_STRIP"; then -- echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 --echo "${ECHO_T}$ac_ct_STRIP" >&6 --else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -+int -+main () -+{ - -- STRIP=$ac_ct_STRIP --else -- STRIP="$ac_cv_prog_STRIP" --fi -- -- --enable_dlopen=no --enable_win32_dll=no -- --# Check whether --enable-libtool-lock or --disable-libtool-lock was given. --if test "${enable_libtool_lock+set}" = set; then -- enableval="$enable_libtool_lock" -- --fi; --test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -- --# Some flags need to be propagated to the compiler or linker for good --# libtool support. --case $host in --*-*-irix6*) -- # Find out which ABI we are using. -- echo '#line 4259 "configure"' > conftest.$ac_ext -- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; then -- 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 -- rm -rf conftest* -- ;; -- --*-*-sco3.2v5*) -- # On SCO OpenServer 5, we need -belf to get full-featured binaries. -- SAVE_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -belf" -- echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 --echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 --if test "${lt_cv_cc_needs_belf+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_prog_cxx_g=yes - else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -- -- 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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ac_cv_prog_cxx_g=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -+if test "$ac_test_CXXFLAGS" = set; then -+ CXXFLAGS=$ac_save_CXXFLAGS -+elif test $ac_cv_prog_cxx_g = yes; then -+ if test "$GXX" = yes; then -+ CXXFLAGS="-g -O2" -+ else -+ CXXFLAGS="-g" -+ fi -+else -+ if test "$GXX" = yes; then -+ CXXFLAGS="-O2" -+ else -+ CXXFLAGS= -+ fi -+fi -+for ac_declaration in \ -+ '' \ -+ 'extern "C" void std::exit (int) throw (); using std::exit;' \ -+ 'extern "C" void std::exit (int); using std::exit;' \ -+ 'extern "C" void exit (int) throw ();' \ -+ 'extern "C" void exit (int);' \ -+ 'void exit (int);' -+do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_declaration -+#include - int - main () - { -- -+exit (42); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- lt_cv_cc_needs_belf=yes -+ : - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --lt_cv_cc_needs_belf=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+continue - fi --rm -f 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 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_declaration -+int -+main () -+{ -+exit (42); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ break -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - - fi --echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 --echo "${ECHO_T}$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 -- ;; -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+rm -f conftest* -+if test -n "$ac_declaration"; then -+ echo '#ifdef __cplusplus' >>confdefs.h -+ echo $ac_declaration >>confdefs.h -+ echo '#endif' >>confdefs.h -+fi - -+ac_ext=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - --esac -+depcc="$CXX" am_compiler_list= - --# Sed substitution that helps us do robust quoting. It backslashifies --# metacharacters that are still active within double-quoted strings. --Xsed='sed -e s/^X//' --sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' -+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then -+ # We make a subdir and do the tests there. Otherwise we can end up -+ # making bogus files that we don't know about and never remove. For -+ # instance it was reported that on HP-UX the gcc test will end up -+ # making a dummy file named `D' -- because `-MD' means `put the output -+ # in D'. -+ mkdir conftest.dir -+ # Copy depcomp to subdir because otherwise we won't find it if we're -+ # using a relative directory. -+ cp "$am_depcomp" conftest.dir -+ cd conftest.dir -+ # We will build objects and dependencies in a subdirectory because -+ # it helps to detect inapplicable dependency modes. For instance -+ # both Tru64's cc and ICC support -MD to output dependencies as a -+ # side effect of compilation, but ICC will put the dependencies in -+ # the current directory while Tru64 will put them in the object -+ # directory. -+ mkdir sub - --# Same as above, but do not quote variable references. --double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' -+ am_cv_CXX_dependencies_compiler_type=none -+ if test "$am_compiler_list" = ""; then -+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` -+ fi -+ for depmode in $am_compiler_list; do -+ # Setup a source with many dependencies, because some compilers -+ # like to wrap large dependency lists on column 80 (with \), and -+ # we should not choose a depcomp mode which is confused by this. -+ # -+ # We need to recreate these files for each test, as the compiler may -+ # overwrite some of them when testing with obscure command lines. -+ # This happens at least with the AIX C compiler. -+ : > sub/conftest.c -+ for i in 1 2 3 4 5 6; do -+ echo '#include "conftst'$i'.h"' >> sub/conftest.c -+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with -+ # Solaris 8's {/usr,}/bin/sh. -+ touch sub/conftst$i.h -+ done -+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - --# Sed substitution to delay expansion of an escaped shell variable in a --# double_quote_subst'ed string. --delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' -+ case $depmode in -+ nosideeffect) -+ # after this tag, mechanisms are not by side-effect, so they'll -+ # only be used when explicitly requested -+ if test "x$enable_dependency_tracking" = xyes; then -+ continue -+ else -+ break -+ fi -+ ;; -+ none) break ;; -+ esac -+ # We check with `-c' and `-o' for the sake of the "dashmstdout" -+ # mode. It turns out that the SunPro C++ compiler does not properly -+ # handle `-M -o', and we need to detect this. -+ if depmode=$depmode \ -+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ -+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ -+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ -+ >/dev/null 2>conftest.err && -+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && -+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && -+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then -+ # icc doesn't choke on unknown options, it will just issue warnings -+ # or remarks (even with -Werror). So we grep stderr for any message -+ # that says an option was ignored or not supported. -+ # When given -MP, icc 7.0 and 7.1 complain thusly: -+ # icc: Command line warning: ignoring option '-M'; no argument required -+ # The diagnosis changed in icc 8.0: -+ # icc: Command line remark: option '-MP' not supported -+ if (grep 'ignoring option' conftest.err || -+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else -+ am_cv_CXX_dependencies_compiler_type=$depmode -+ break -+ fi -+ fi -+ done - --# Constants: --rm="rm -f" -+ cd .. -+ rm -rf conftest.dir -+else -+ am_cv_CXX_dependencies_compiler_type=none -+fi - --# Global variables: --default_ofile=libtool --can_build_shared=yes -+fi -+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - --# All known linkers require a `.a' archive for static linking (except M$VC, --# which needs '.lib'). --libext=a --ltmain="$ac_aux_dir/ltmain.sh" --ofile="$default_ofile" --with_gnu_ld="$lt_cv_prog_gnu_ld" --need_locks="$enable_libtool_lock" - --old_CC="$CC" --old_CFLAGS="$CFLAGS" -- --# Set sane defaults for various variables --test -z "$AR" && AR=ar --test -z "$AR_FLAGS" && AR_FLAGS=cru --test -z "$AS" && AS=as --test -z "$CC" && CC=cc --test -z "$DLLTOOL" && DLLTOOL=dlltool --test -z "$LD" && LD=ld --test -z "$LN_S" && LN_S="ln -s" --test -z "$MAGIC_CMD" && MAGIC_CMD=file --test -z "$NM" && NM=nm --test -z "$OBJDUMP" && OBJDUMP=objdump --test -z "$RANLIB" && RANLIB=: --test -z "$STRIP" && STRIP=: --test -z "$ac_objext" && ac_objext=o -- --if test x"$host" != x"$build"; then -- ac_tool_prefix=${host_alias}- --else -- ac_tool_prefix= --fi -- --# Transform linux* to *-*-linux-gnu*, to support old configure scripts. --case $host_os in --linux-gnu*) ;; --linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` --esac -- --case $host_os in --aix3*) -- # AIX sometimes has problems with the GCC collect2 program. For some -- # reason, if we set the COLLECT_NAMES environment variable, the problems -- # vanish in a puff of smoke. -- if test "X${COLLECT_NAMES+set}" != Xset; then -- COLLECT_NAMES= -- export COLLECT_NAMES -- fi -- ;; --esac -- --# Determine commands to create old-style static archives. --old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' --old_postinstall_cmds='chmod 644 $oldlib' --old_postuninstall_cmds= -- --if test -n "$RANLIB"; then -- case $host_os in -- openbsd*) -- old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" -- ;; -- *) -- old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" -- ;; -- esac -- old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" --fi - --# Allow CC to be a program name with arguments. --set dummy $CC --compiler="$2" -- --echo "$as_me:$LINENO: checking for objdir" >&5 --echo $ECHO_N "checking for objdir... $ECHO_C" >&6 --rm -f .libs 2>/dev/null --mkdir .libs 2>/dev/null --if test -d .libs; then -- objdir=.libs -+if -+ test "x$enable_dependency_tracking" != xno \ -+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then -+ am__fastdepCXX_TRUE= -+ am__fastdepCXX_FALSE='#' - else -- # MS-DOS does not allow filenames that begin with a dot. -- objdir=_libs -+ am__fastdepCXX_TRUE='#' -+ am__fastdepCXX_FALSE= - fi --rmdir .libs 2>/dev/null --echo "$as_me:$LINENO: result: $objdir" >&5 --echo "${ECHO_T}$objdir" >&6 - - - --# Check whether --with-pic or --without-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 - --# We assume here that the value for lt_cv_prog_cc_pic will not be cached --# in isolation, and that seeing it set (from the cache) indicates that --# the associated values are set (in the cache) correctly too. --echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 --echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 --if test "${lt_cv_prog_cc_pic+set}" = set; then -+if test -n "$CXX" && ( test "X$CXX" != "Xno" && -+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || -+ (test "X$CXX" != "Xg++"))) ; then -+ ac_ext=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -+echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 -+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 -+if test -z "$CXXCPP"; then -+ if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- lt_cv_prog_cc_pic= -- lt_cv_prog_cc_shlib= -- lt_cv_prog_cc_wl= -- lt_cv_prog_cc_static= -- lt_cv_prog_cc_no_builtin= -- lt_cv_prog_cc_can_build_shared=$can_build_shared -- -- if test "$GCC" = yes; then -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static='-static' -- -- case $host_os in -- aix*) -- # Below there is a dirty hack to force normal static linking with -ldl -- # The problem is because libdl dynamically linked with both libc and -- # libC (AIX C++ library), which obviously doesn't included in libraries -- # list by gcc. This cause undefined symbols with -static flags. -- # This hack allows C programs to be linked with "-static -ldl", but -- # not sure about C++ programs. -- lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" -- ;; -- amigaos*) -- # FIXME: we need at least 68020 code to build shared libraries, but -- # adding the `-m68020' flag to GCC prevents building anything better, -- # like `-m68040'. -- lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' -- ;; -- beos* | irix5* | irix6* | osf3* | osf4* | osf5*) -- # PIC is the default for these OSes. -- ;; -- darwin* | rhapsody*) -- # PIC is the default on this platform -- # Common symbols not allowed in MH_DYLIB files -- lt_cv_prog_cc_pic='-fno-common' -- ;; -- cygwin* | mingw* | pw32* | os2*) -- # 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_cv_prog_cc_pic='-DDLL_EXPORT' -- ;; -- sysv4*MP*) -- if test -d /usr/nec; then -- lt_cv_prog_cc_pic=-Kconform_pic -- fi -- ;; -- *) -- lt_cv_prog_cc_pic='-fPIC' -- ;; -- esac -+ # Double quotes because CXXCPP needs to be expanded -+ for CXXCPP in "$CXX -E" "/lib/cpp" -+ do -+ ac_preproc_ok=false -+for ac_cxx_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 >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ Syntax error -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_cxx_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else -- # PORTME Check for PIC flags for the system compiler. -- case $host_os in -- aix3* | aix4* | aix5*) -- lt_cv_prog_cc_wl='-Wl,' -- # All AIX code is PIC. -- if test "$host_cpu" = ia64; then -- # AIX 5 now supports IA64 processor -- lt_cv_prog_cc_static='-Bstatic' -- else -- lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' -- fi -- ;; -- -- hpux9* | hpux10* | hpux11*) -- # Is there a better lt_cv_prog_cc_static that works with the bundled CC? -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" -- lt_cv_prog_cc_pic='+Z' -- ;; -- -- irix5* | irix6*) -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static='-non_shared' -- # PIC (with -KPIC) is the default. -- ;; -- -- cygwin* | mingw* | pw32* | os2*) -- # 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_cv_prog_cc_pic='-DDLL_EXPORT' -- ;; -- -- newsos6) -- lt_cv_prog_cc_pic='-KPIC' -- lt_cv_prog_cc_static='-Bstatic' -- ;; -- -- osf3* | osf4* | osf5*) -- # All OSF/1 code is PIC. -- lt_cv_prog_cc_wl='-Wl,' -- lt_cv_prog_cc_static='-non_shared' -- ;; -- -- sco3.2v5*) -- lt_cv_prog_cc_pic='-Kpic' -- lt_cv_prog_cc_static='-dn' -- lt_cv_prog_cc_shlib='-belf' -- ;; -- -- solaris*) -- lt_cv_prog_cc_pic='-KPIC' -- lt_cv_prog_cc_static='-Bstatic' -- lt_cv_prog_cc_wl='-Wl,' -- ;; -- -- sunos4*) -- lt_cv_prog_cc_pic='-PIC' -- lt_cv_prog_cc_static='-Bstatic' -- lt_cv_prog_cc_wl='-Qoption ld ' -- ;; -- -- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -- lt_cv_prog_cc_pic='-KPIC' -- lt_cv_prog_cc_static='-Bstatic' -- if test "x$host_vendor" = xsni; then -- lt_cv_prog_cc_wl='-LD' -- else -- lt_cv_prog_cc_wl='-Wl,' -- fi -- ;; -- -- uts4*) -- lt_cv_prog_cc_pic='-pic' -- lt_cv_prog_cc_static='-Bstatic' -- ;; -- -- sysv4*MP*) -- if test -d /usr/nec ;then -- lt_cv_prog_cc_pic='-Kconform_pic' -- lt_cv_prog_cc_static='-Bstatic' -- fi -- ;; -- -- *) -- lt_cv_prog_cc_can_build_shared=no -- ;; -- esac -+ ac_cpp_err= - fi -- --fi -- --if test -z "$lt_cv_prog_cc_pic"; then -- echo "$as_me:$LINENO: result: none" >&5 --echo "${ECHO_T}none" >&6 - else -- echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 --echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 -- -- # Check to make sure the pic_flag actually works. -- echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 --echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 -- if test "${lt_cv_prog_cc_pic_works+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ : - else -- save_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ -+ # Broken: fails on valid input. -+continue -+fi -+rm -f conftest.err conftest.$ac_ext - -- ; -- return 0; --} -+ # OK, works on sane cases. Now check whether non-existent headers -+ # can be detected and how. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- case $host_os in -- hpux9* | hpux10* | hpux11*) -- # On HP-UX, both CC and GCC only warn that PIC is supported... then -- # they create non-PIC objects. So, if there were any warnings, we -- # assume that PIC is not supported. -- if test -s conftest.err; then -- lt_cv_prog_cc_pic_works=no -- else -- lt_cv_prog_cc_pic_works=yes -- fi -- ;; -- *) -- lt_cv_prog_cc_pic_works=yes -- ;; -- esac -- -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_cxx_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ # Broken: success on invalid input. -+continue - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -- lt_cv_prog_cc_pic_works=no -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ # Passes both tests. -+ac_preproc_ok=: -+break - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CFLAGS="$save_CFLAGS" -+rm -f conftest.err conftest.$ac_ext - -+done -+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -+rm -f conftest.err conftest.$ac_ext -+if $ac_preproc_ok; then -+ break - fi - -+ done -+ ac_cv_prog_CXXCPP=$CXXCPP - -- if test "X$lt_cv_prog_cc_pic_works" = Xno; then -- lt_cv_prog_cc_pic= -- lt_cv_prog_cc_can_build_shared=no -- else -- lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" -- fi -- -- echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 --echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 - fi -- --# Check for any special shared library compilation flags. --if test -n "$lt_cv_prog_cc_shlib"; then -- { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 --echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} -- if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : -- else -- { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 --echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} -- lt_cv_prog_cc_can_build_shared=no -- fi --fi -- --echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 --echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 --if test "${lt_cv_prog_cc_static_works+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ CXXCPP=$ac_cv_prog_CXXCPP - else -- lt_cv_prog_cc_static_works=no -- save_LDFLAGS="$LDFLAGS" -- LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" -+ ac_cv_prog_CXXCPP=$CXXCPP -+fi -+echo "$as_me:$LINENO: result: $CXXCPP" >&5 -+echo "${ECHO_T}$CXXCPP" >&6 -+ac_preproc_ok=false -+for ac_cxx_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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#ifdef __STDC__ -+# include -+#else -+# include - #endif --int --main () --{ -- -- ; -- return 0; --} -+ Syntax error - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_cxx_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ # Broken: fails on valid input. -+continue -+fi -+rm -f conftest.err conftest.$ac_ext -+ -+ # OK, works on sane cases. Now check whether non-existent headers -+ # can be detected and how. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- lt_cv_prog_cc_static_works=yes -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_cxx_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ # Broken: success on invalid input. -+continue - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ # Passes both tests. -+ac_preproc_ok=: -+break - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -- LDFLAGS="$save_LDFLAGS" -+rm -f conftest.err conftest.$ac_ext - -+done -+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -+rm -f conftest.err conftest.$ac_ext -+if $ac_preproc_ok; then -+ : -+else -+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check -+See \`config.log' for more details." >&5 -+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } - fi - -+ac_ext=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -+ -+fi - --# Belt *and* braces to stop my trousers falling down: --test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= --echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 --echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 - --pic_flag="$lt_cv_prog_cc_pic" --special_shlib_compile_flags="$lt_cv_prog_cc_shlib" --wl="$lt_cv_prog_cc_wl" --link_static_flag="$lt_cv_prog_cc_static" --no_builtin_flag="$lt_cv_prog_cc_no_builtin" --can_build_shared="$lt_cv_prog_cc_can_build_shared" -+ac_ext=f -+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_f77_compiler_gnu -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -+ 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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_F77+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$F77"; then -+ ac_cv_prog_F77="$F77" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_F77="$ac_tool_prefix$ac_prog" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done - -+fi -+fi -+F77=$ac_cv_prog_F77 -+if test -n "$F77"; then -+ echo "$as_me:$LINENO: result: $F77" >&5 -+echo "${ECHO_T}$F77" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --# Check to see if options -o and -c are simultaneously supported by compiler --echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 --echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 --if test "${lt_cv_compiler_c_o+set}" = set; then -+ test -n "$F77" && break -+ done -+fi -+if test -z "$F77"; then -+ ac_ct_F77=$F77 -+ for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -+ if test -n "$ac_ct_F77"; then -+ ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_ac_ct_F77="$ac_prog" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+fi -+fi -+ac_ct_F77=$ac_cv_prog_ac_ct_F77 -+if test -n "$ac_ct_F77"; then -+ echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -+echo "${ECHO_T}$ac_ct_F77" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --$rm -r conftest 2>/dev/null --mkdir conftest --cd conftest --echo "int some_variable = 0;" > conftest.$ac_ext --mkdir out --# According to Tom Tromey, Ian Lance Taylor reported there are C compilers --# that will create temporary files in the current directory regardless of --# the output directory. Thus, making CWD read-only will cause this test --# to fail, enabling locking or at least warning the user not to do parallel --# builds. --chmod -w . --save_CFLAGS="$CFLAGS" --CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" --compiler_c_o=no --if { (eval echo configure:4795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && 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 -- if test -s out/conftest.err; then -- lt_cv_compiler_c_o=no -- else -- lt_cv_compiler_c_o=yes -- fi --else -- # Append any errors to the config.log. -- cat out/conftest.err 1>&5 -- lt_cv_compiler_c_o=no --fi --CFLAGS="$save_CFLAGS" --chmod u+w . --$rm conftest* out/* --rmdir out --cd .. --rmdir conftest --$rm -r conftest 2>/dev/null -+ test -n "$ac_ct_F77" && break -+done - -+ F77=$ac_ct_F77 - fi - --compiler_c_o=$lt_cv_compiler_c_o --echo "$as_me:$LINENO: result: $compiler_c_o" >&5 --echo "${ECHO_T}$compiler_c_o" >&6 -- --if test x"$compiler_c_o" = x"yes"; then -- # Check to see if we can write to a .lo -- echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 --echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 -- if test "${lt_cv_compiler_o_lo+set}" = set; then -+ -+# Provide some information about the compiler. -+echo "$as_me:5311:" \ -+ "checking for Fortran 77 compiler version" >&5 -+ac_compiler=`set X $ac_compile; echo $2` -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 -+ (eval $ac_compiler --version &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 -+ (eval $ac_compiler -v &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 -+ (eval $ac_compiler -V &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+rm -f a.out -+ -+# If we don't use `.F' as extension, the preprocessor is not run on the -+# input file. (Note that this only needs to work for GNU compilers.) -+ac_save_ext=$ac_ext -+ac_ext=F -+echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 -+if test "${ac_cv_f77_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- -- lt_cv_compiler_o_lo=no -- save_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -c -o conftest.lo" -- save_objext="$ac_objext" -- ac_objext=lo - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+ program main -+#ifndef __GNUC__ -+ choke me - #endif --int --main () --{ --int some_variable = 0; -- ; -- return 0; --} -+ -+ end - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- # The compiler can only warn and ignore the option if not recognized -- # So say no if there are warnings -- if test -s conftest.err; then -- lt_cv_compiler_o_lo=no -- else -- lt_cv_compiler_o_lo=yes -- fi -- -+ ac_compiler_gnu=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- ac_objext="$save_objext" -- CFLAGS="$save_CFLAGS" -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_compiler_gnu=no - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -- compiler_o_lo=$lt_cv_compiler_o_lo -- echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 --echo "${ECHO_T}$compiler_o_lo" >&6 --else -- compiler_o_lo=no - fi -- --# Check to see if we can do hard links to lock some files if needed --hard_links="nottested" --if test "$compiler_c_o" = no && test "$need_locks" != no; then -- # do not overwrite the value of need_locks provided by the user -- echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 --echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 -- hard_links=yes -- $rm conftest* -- ln conftest.a conftest.b 2>/dev/null && hard_links=no -- touch conftest.a -- ln conftest.a conftest.b 2>&5 || hard_links=no -- ln conftest.a conftest.b 2>/dev/null && hard_links=no -- echo "$as_me:$LINENO: result: $hard_links" >&5 --echo "${ECHO_T}$hard_links" >&6 -- if test "$hard_links" = no; then -- { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 --echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} -- need_locks=warn -- fi -+echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 -+ac_ext=$ac_save_ext -+ac_test_FFLAGS=${FFLAGS+set} -+ac_save_FFLAGS=$FFLAGS -+FFLAGS= -+echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 -+if test "${ac_cv_prog_f77_g+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- need_locks=no --fi -- --if test "$GCC" = yes; then -- # Check to see if options -fno-rtti -fno-exceptions are supported by compiler -- echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 --echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -- echo "int some_variable = 0;" > conftest.$ac_ext -- save_CFLAGS="$CFLAGS" -- CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" -- compiler_rtti_exceptions=no -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ FFLAGS=-g -+cat >conftest.$ac_ext <<_ACEOF -+ program main - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --int some_variable = 0; -- ; -- return 0; --} -+ end - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- # The compiler can only warn and ignore the option if not recognized -- # So say no if there are warnings -- if test -s conftest.err; then -- compiler_rtti_exceptions=no -- else -- compiler_rtti_exceptions=yes -- fi -- -+ ac_cv_prog_f77_g=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_prog_f77_g=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- CFLAGS="$save_CFLAGS" -- echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 --echo "${ECHO_T}$compiler_rtti_exceptions" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -- if test "$compiler_rtti_exceptions" = "yes"; then -- no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' -+fi -+echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 -+if test "$ac_test_FFLAGS" = set; then -+ FFLAGS=$ac_save_FFLAGS -+elif test $ac_cv_prog_f77_g = yes; then -+ if test "x$ac_cv_f77_compiler_gnu" = xyes; then -+ FFLAGS="-g -O2" -+ else -+ FFLAGS="-g" -+ fi -+else -+ if test "x$ac_cv_f77_compiler_gnu" = xyes; then -+ FFLAGS="-O2" - else -- no_builtin_flag=' -fno-builtin' -+ FFLAGS= - fi - fi - --# See if the linker supports building shared libraries. --echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 --echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 -+G77=`test $ac_compiler_gnu = yes && echo yes` -+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 - --allow_undefined_flag= --no_undefined_flag= --need_lib_prefix=unknown --need_version=unknown --# when you set need_version to no, make sure it does not cause -set_version --# flags to be left without arguments --archive_cmds= --archive_expsym_cmds= --old_archive_from_new_cmds= --old_archive_from_expsyms_cmds= --export_dynamic_flag_spec= --whole_archive_flag_spec= --thread_safe_flag_spec= --hardcode_into_libs=no --hardcode_libdir_flag_spec= --hardcode_libdir_separator= --hardcode_direct=no --hardcode_minus_L=no --hardcode_shlibpath_var=unsupported --runpath_var= --link_all_deplibs=unknown --always_export_symbols=no --export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' --# include_expsyms should be a list of space-separated symbols to be *always* --# included in the symbol list --include_expsyms= --# exclude_expsyms can be an egrep regular expression of symbols to exclude --# it will be wrapped by ` (' and `)$', so one must not match beginning or --# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', --# as well as any symbol that contains `d'. --exclude_expsyms="_GLOBAL_OFFSET_TABLE_" --# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out --# platforms (ab)use it in PIC code, but their linkers get confused if --# the symbol is explicitly referenced. Since portable code cannot --# rely on this symbol name, it's probably fine to never include it in --# preloaded symbol tables. --extract_expsyms_cmds= - --case $host_os in --cygwin* | mingw* | pw32*) -- # 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 -- ;; --openbsd*) -- with_gnu_ld=no -- ;; --esac -- --ld_shlibs=yes --if test "$with_gnu_ld" = yes; then -- # If archive_cmds runs LD, not CC, wlarc should be empty -- wlarc='${wl}' - -- # See if GNU ld supports shared libraries. -- case $host_os in -- aix3* | aix4* | aix5*) -- # On AIX, the GNU linker is very broken -- # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. -- ld_shlibs=no -- cat <&2 -- --*** Warning: the GNU linker, at least up to release 2.9.1, is reported --*** to be unable to reliably create shared libraries on AIX. --*** Therefore, libtool is disabling shared libraries support. If you --*** really care for shared libraries, you may want to modify your PATH --*** so that a non-GNU linker is found, and then restart. -+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - --EOF -+# find the maximum length of command line arguments -+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -+if test "${lt_cv_sys_max_cmd_len+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 - ;; - -- amigaos*) -- 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 -- -- # Samuel A. Falvo II reports -- # that the semantics of dynamic libraries on AmigaOS, at least up -- # to version 4, is to share data among multiple programs linked -- # with the same dynamic library. Since this doesn't match the -- # behavior of shared libraries on other platforms, we can use -- # them. -- ld_shlibs=no -+ 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; - ;; - -- beos*) -- if $LD --help 2>&1 | egrep ': 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*) -+ # 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; - ;; - -- cygwin* | mingw* | pw32*) -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec='-L$libdir' -- allow_undefined_flag=unsupported -- always_export_symbols=yes -- -- extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ -- sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ -- test -f $output_objdir/impgen.exe || (cd $output_objdir && \ -- if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ -- else $CC -o impgen impgen.c ; fi)~ -- $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' -- -- old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' -- -- # cygwin and mingw dlls have different entry points and sets of symbols -- # to exclude. -- # FIXME: what about values for MSVC? -- dll_entry=__cygwin_dll_entry@12 -- dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ -- case $host_os in -- mingw*) -- # mingw values -- dll_entry=_DllMainCRTStartup@12 -- dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ -- ;; -- esac -- -- # mingw and cygwin differ, and it's simplest to just exclude the union -- # of the two symbol sets. -- dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 -- -- # recent cygwin and mingw systems supply a stub DllMain which the user -- # can override, but on older systems we have to supply one (in ltdll.c) -- if test "x$lt_cv_need_dllmain" = "xyes"; then -- ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " -- ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ -- test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' -- else -- ltdll_obj= -- ltdll_cmds= -- fi -- -- # Extract the symbol export list from an `--export-all' def file, -- # then regenerate the def file from the symbol export list, so that -- # the compiled dll only exports the symbol export list. -- # Be careful not to strip the DATA tag left be newer dlltools. -- export_symbols_cmds="$ltdll_cmds"' -- $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ -- sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' -- -- # If the export-symbols file already is a .def file (1st line -- # is EXPORTS), use it as is. -- # If DATA tags from a recent dlltool are present, honour them! -- archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then -- cp $export_symbols $output_objdir/$soname-def; -- else -- echo EXPORTS > $output_objdir/$soname-def; -- _lt_hint=1; -- cat $export_symbols | while read symbol; do -- set dummy \$symbol; -- case \$# in -- 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; -- *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; -- esac; -- _lt_hint=`expr 1 + \$_lt_hint`; -- done; -- fi~ -- '"$ltdll_cmds"' -- $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ -- $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ -- $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' -+ 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*) -- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -- archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' -- wlarc= -+ 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 -- archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -- archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ 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` - ;; -- -- solaris* | sysv5*) -- if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then -- ld_shlibs=no -- cat <&2 -- --*** Warning: The releases 2.8.* of the GNU linker cannot reliably --*** create shared libraries on Solaris systems. Therefore, libtool --*** is disabling shared libraries support. We urge you to upgrade GNU --*** binutils to release 2.9.1 or newer. Another option is to modify --*** your PATH or compiler configuration so that the native linker is --*** used, and then restart. -- --EOF -- elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then -- archive_cmds='$CC -shared $libobjs $deplibs $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 -+ 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 - ;; -- -- 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 | egrep ': supported targets:.* elf' > /dev/null; then -- 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 -+ # 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. -+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} -+ while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ -+ = "XX$teststring") >/dev/null 2>&1 && -+ new_result=`expr "X$teststring" : ".*" 2>&1` && -+ lt_cv_sys_max_cmd_len=$new_result && -+ test $i != 17 # 1/2 MB should be enough -+ do -+ i=`expr $i + 1` -+ teststring=$teststring$teststring -+ done -+ 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` - ;; - esac - -- if test "$ld_shlibs" = yes; then -- runpath_var=LD_RUN_PATH -- hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' -- export_dynamic_flag_spec='${wl}--export-dynamic' -- case $host_os in -- cygwin* | mingw* | pw32*) -- # dlltool doesn't understand --whole-archive et. al. -- whole_archive_flag_spec= -- ;; -- *) -- # ancient GNU ld didn't support --whole-archive et. al. -- if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then -- whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -- else -- whole_archive_flag_spec= -- fi -- ;; -- esac -- fi --else -- # PORTME fill in a description of your system's linker (not GNU ld) -- case $host_os in -- aix3*) -- allow_undefined_flag=unsupported -- always_export_symbols=yes -- archive_expsym_cmds='$LD -o $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 "$link_static_flag"; then -- # Neither direct hardcoding nor static linking is supported with a -- # broken collect2. -- hardcode_direct=unsupported -- fi -- ;; -- -- aix4* | aix5*) -- 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 -- 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].*|aix5*) -- 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 -+fi - -- exp_sym_flag='-bexport' -- no_entry_flag='-bnoentry' -- fi -+if test -n $lt_cv_sys_max_cmd_len ; then -+ echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -+else -+ echo "$as_me:$LINENO: result: none" >&5 -+echo "${ECHO_T}none" >&6 -+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. - -- hardcode_direct=yes -- archive_cmds='' -- hardcode_libdir_separator=':' -- if test "$GCC" = yes; then -- case $host_os in aix4.[012]|aix4.[012].*) -- collect2name=`${CC} -print-prog-name=collect2` -- if test -f "$collect2name" && \ -- strings "$collect2name" | grep resolve_lib_name >/dev/null -- then -- # We have reworked collect2 -- hardcode_direct=yes -- else -- # We have old collect2 -- hardcode_direct=unsupported -- # It fails to find uninstalled libraries when the uninstalled -- # path is not listed in the libpath. Setting hardcode_minus_L -- # to unsupported forces relinking -- hardcode_minus_L=yes -- hardcode_libdir_flag_spec='-L$libdir' -- hardcode_libdir_separator= -- fi -- esac - -- shared_flag='-shared' -- else -- # not using gcc -- if test "$host_cpu" = ia64; then -- shared_flag='${wl}-G' -- else -- if test "$aix_use_runtimelinking" = yes; then -- shared_flag='${wl}-G' -- else -- shared_flag='${wl}-bM:SRE' -- fi -- fi -- fi - -- # It seems that -bexpall can do strange things, 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' -- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' -- archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${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 ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -- else -- hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' -- # Warning - without using the other run time loading flags, -- # -berok will link without error, but may produce a broken library. -- allow_undefined_flag='${wl}-berok' -- # This is a bit strange, but is similar to how AIX traditionally builds -- # it's shared libraries. -- archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' -- fi -- fi -- ;; -+# Check for command to grab the raw symbol name followed by C symbol from nm. -+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 -+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - -- amigaos*) -- 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 -- # see comment about different semantics on the GNU ld section -- ld_shlibs=no -- ;; -+# These are sane defaults that work on at least a few old systems. -+# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -- cygwin* | mingw* | pw32*) -- # When not using gcc, we currently assume that we are using -- # Microsoft Visual C++. -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec=' ' -- allow_undefined_flag=unsupported -- # Tell ltmain to make .lib files, not .a files. -- libext=lib -- # FIXME: Setting linknames here is a bad hack. -- archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' -- # The linker will automatically build a .lib file if we build a DLL. -- old_archive_from_new_cmds='true' -- # FIXME: Should let the user specify the lib program. -- old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' -- fix_srcfile_path='`cygpath -w "$srcfile"`' -- ;; -- -- darwin* | rhapsody*) -- case "$host_os" in -- rhapsody* | darwin1.[012]) -- allow_undefined_flag='-undefined suppress' -- ;; -- *) # Darwin 1.3 on -- allow_undefined_flag='-flat_namespace -undefined suppress' -- ;; -- esac -- # FIXME: Relying on posixy $() will cause problems for -- # cross-compilation, but unfortunately the echo tests do not -- # yet detect zsh echo's removal of \ escapes. -- archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' -- # We need to add '_' to the symbols in $export_symbols first -- #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' -- hardcode_direct=yes -- hardcode_shlibpath_var=no -- whole_archive_flag_spec='-all_load $convenience' -- ;; -- -- 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 -- ;; -+# Character class describing NM global symbol codes. -+symcode='[BCDEGRST]' - -- # 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 -- ;; -+# Regexp to match symbols that can be accessed directly from C. -+sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -- # FreeBSD 3 and greater uses gcc -shared to do shared libraries. -- freebsd*) -- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' -- hardcode_libdir_flag_spec='-R$libdir' -- hardcode_direct=yes -- hardcode_shlibpath_var=no -- ;; -+# Transform an extracted symbol line into a proper C declaration -+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -- hpux9* | hpux10* | hpux11*) -- case $host_os in -- hpux9*) 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' ;; -- *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; -- esac -- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' -- hardcode_libdir_separator=: -- hardcode_direct=yes -- hardcode_minus_L=yes # Not in the search PATH, but as the default -- # location of the library. -- export_dynamic_flag_spec='${wl}-E' -- ;; -+# 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\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -- irix5* | irix6*) -- if test "$GCC" = yes; then -- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -- else -- archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -- fi -- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -- hardcode_libdir_separator=: -- link_all_deplibs=yes -- ;; -+# Define system-specific variables. -+case $host_os in -+aix*) -+ symcode='[BCDT]' -+ ;; -+cygwin* | mingw* | pw32*) -+ symcode='[ABCDGISTW]' -+ ;; -+hpux*) # Its linker distinguishes data from code symbols -+ if test "$host_cpu" = ia64; then -+ symcode='[ABCDEGRST]' -+ fi -+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" -+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -+ ;; -+linux*) -+ if test "$host_cpu" = ia64; then -+ symcode='[ABCDGIRSTW]' -+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" -+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" -+ fi -+ ;; -+irix* | nonstopux*) -+ symcode='[BCDEGRST]' -+ ;; -+osf*) -+ symcode='[BCDEGQRST]' -+ ;; -+solaris* | sysv5*) -+ symcode='[BDRT]' -+ ;; -+sysv4) -+ symcode='[DFNSTU]' -+ ;; -+esac - -- 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 -- ;; -+# 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 - -- 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 -- ;; -+# If we're using GNU nm, then use its standard symbol codes. -+case `$NM -V 2>&1` in -+*GNU* | *'with BFD'*) -+ symcode='[ABCDGIRSTW]' ;; -+esac - -- openbsd*) -- hardcode_direct=yes -- hardcode_shlibpath_var=no -- 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 $linker_flags' -- 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 $linker_flags' -- hardcode_libdir_flag_spec='${wl}-rpath,$libdir' -- ;; -- esac -- fi -- ;; -+# Try without a prefix undercore, then with it. -+for ac_symprfx in "" "_"; do - -- 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' -- ;; -+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. -+ symxfrm="\\1 $ac_symprfx\\2 \\2" - -- 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" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -- else -- allow_undefined_flag=' -expect_unresolved \*' -- archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -- fi -- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -- hardcode_libdir_separator=: -- ;; -+ # Write the raw and C identifiers. -+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - -- 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} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${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='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -- archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ -- $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' -+ # Check to see that the pipe works correctly. -+ pipe_works=no - -- #Both c and cxx compiler support -rpath directly -- hardcode_libdir_flag_spec='-rpath $libdir' -- fi -- hardcode_libdir_separator=: -- ;; -+ rm -f conftest* -+ cat > conftest.$ac_ext <, C++ libraries end up with a separate -- # (to the application) exception stack for one thing. -- no_undefined_flag=' -z defs' -- if test "$GCC" = yes; then -- case `$CC --version 2>/dev/null` in -- [12].*) -- cat <&2 -+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ # Now try to grab the symbols. -+ nlist=conftest.nm -+ if { (eval echo "$as_me:$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=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && 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 - --*** Warning: Releases of GCC earlier than version 3.0 cannot reliably --*** create self contained shared libraries on Solaris systems, without --*** introducing a dependency on libgcc.a. Therefore, libtool is disabling --*** -no-undefined support, which will at least allow you to build shared --*** libraries. However, you may find that when you link such libraries --*** into an application without using GCC, you have to manually add --*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to --*** upgrade to a newer version of GCC. Another option is to rebuild your --*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. -+ # 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 < conftest.$ac_ext -+#ifdef __cplusplus -+extern "C" { -+#endif - - EOF -- no_undefined_flag= -- ;; -- esac -- fi -- # $CC -shared without GNU ld will not create a library from C++ -- # object files and a static libstdc++, better avoid it by now -- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $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' -- hardcode_libdir_flag_spec='-R$libdir' -- hardcode_shlibpath_var=no -- case $host_os in -- solaris2.[0-5] | solaris2.[0-5].*) ;; -- *) # Supported since Solaris 2.6 (maybe 2.5.1?) -- whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; -- esac -- 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) -- if test "x$host_vendor" = xsno; then -- archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' -- hardcode_direct=yes # is this really true??? -- else -- 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 -- fi -- 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' -- ;; -- -- sysv5*) -- no_undefined_flag=' -z text' -- # $CC -shared without GNU ld will not create a library from C++ -- # object files and a static libstdc++, better avoid it by now -- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $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' -- hardcode_libdir_flag_spec= -- hardcode_shlibpath_var=no -- runpath_var='LD_RUN_PATH' -- ;; -- -- uts4*) -- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -- hardcode_libdir_flag_spec='-L$libdir' -- hardcode_shlibpath_var=no -- ;; -- -- dgux*) -- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -- hardcode_libdir_flag_spec='-L$libdir' -- hardcode_shlibpath_var=no -- ;; -+ # Now generate the symbol file. -+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - -- 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 -- ;; -+ cat <> conftest.$ac_ext -+#if defined (__STDC__) && __STDC__ -+# define lt_ptr_t void * -+#else -+# define lt_ptr_t char * -+# define const -+#endif - -- sysv4.2uw2*) -- archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' -- hardcode_direct=yes -- hardcode_minus_L=no -- hardcode_shlibpath_var=no -- hardcode_runpath_var=yes -- runpath_var=LD_RUN_PATH -- ;; -+/* The mapping between symbol names and symbols. */ -+const struct { -+ const char *name; -+ lt_ptr_t address; -+} -+lt_preloaded_symbols[] = -+{ -+EOF -+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext -+ cat <<\EOF >> conftest.$ac_ext -+ {0, (lt_ptr_t) 0} -+}; - -- sysv5uw7* | unixware7*) -- no_undefined_flag='${wl}-z ${wl}text' -- if test "$GCC" = yes; then -- archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+#ifdef __cplusplus -+} -+#endif -+EOF -+ # Now try linking the two files. -+ mv conftest.$ac_objext conftstm.$ac_objext -+ lt_save_LIBS="$LIBS" -+ lt_save_CFLAGS="$CFLAGS" -+ LIBS="conftstm.$ac_objext" -+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" -+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && test -s conftest${ac_exeext}; then -+ pipe_works=yes -+ fi -+ LIBS="$lt_save_LIBS" -+ CFLAGS="$lt_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 -- archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi -- runpath_var='LD_RUN_PATH' -- hardcode_shlibpath_var=no -- ;; -- -- *) -- ld_shlibs=no -- ;; -- esac --fi --echo "$as_me:$LINENO: result: $ld_shlibs" >&5 --echo "${ECHO_T}$ld_shlibs" >&6 --test "$ld_shlibs" = no && can_build_shared=no -- --# Check hardcoding attributes. --echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 --echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 --hardcode_action= --if test -n "$hardcode_libdir_flag_spec" || \ -- test -n "$runpath_var"; then -+ else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ fi -+ rm -f conftest* conftst* - -- # We can hardcode non-existant directories. -- if test "$hardcode_direct" != no && -- # If the only mechanism to avoid hardcoding is shlibpath_var, we -- # have to relink, otherwise we might link with an installed library -- # when we should be linking with a yet-to-be-installed one -- ## test "$hardcode_shlibpath_var" != no && -- test "$hardcode_minus_L" != no; then -- # Linking always hardcodes the temporary library directory. -- hardcode_action=relink -+ # Do not use the global_symbol_pipe unless it works. -+ if test "$pipe_works" = yes; then -+ break - else -- # We can link without hardcoding, and we can hardcode nonexisting dirs. -- hardcode_action=immediate -+ 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 -+ echo "$as_me:$LINENO: result: failed" >&5 -+echo "${ECHO_T}failed" >&6 - else -- # We cannot hardcode anything, or else we can only hardcode existing -- # directories. -- hardcode_action=unsupported -+ echo "$as_me:$LINENO: result: ok" >&5 -+echo "${ECHO_T}ok" >&6 - fi --echo "$as_me:$LINENO: result: $hardcode_action" >&5 --echo "${ECHO_T}$hardcode_action" >&6 - --striplib= --old_striplib= --echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 --echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&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" -- echo "$as_me:$LINENO: result: yes" >&5 --echo "${ECHO_T}yes" >&6 -+echo "$as_me:$LINENO: checking for objdir" >&5 -+echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -+if test "${lt_cv_objdir+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ 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 -+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -+echo "${ECHO_T}$lt_cv_objdir" >&6 -+objdir=$lt_cv_objdir - --reload_cmds='$LD$reload_flag -o $output$reload_objs' --test -z "$deplibs_check_method" && deplibs_check_method=unknown - --# PORTME Fill in your ld.so characteristics --echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 --echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 --library_names_spec= --libname_spec='lib$name' --soname_spec= --postinstall_cmds= --postuninstall_cmds= --finish_cmds= --finish_eval= --shlibpath_var= --shlibpath_overrides_runpath=unknown --version_type=none --dynamic_linker="$host_os ld.so" --sys_lib_dlsearch_path_spec="/lib /usr/lib" --sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - --case $host_os in --aix3*) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix $libname.a' -- shlibpath_var=LIBPATH - -- # AIX has no versioning support, so we append a major version to the name. -- soname_spec='${libname}${release}.so$major' -- ;; - --aix4* | aix5*) -- version_type=linux -- if test "$host_cpu" = ia64; then -- # AIX 5 supports IA64 -- library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' -- 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}.so$versuffix ${libname}${release}.so$major $libname.so' -- 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}.so$major' -- fi -- shlibpath_var=LIBPATH -+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 - --amigaos*) -- library_names_spec='$libname.ixlibrary $libname.a' -- # Create ${libname}_ixlibrary.a entries in /sys/libs. -- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' -- ;; -+# 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' - --beos*) -- library_names_spec='${libname}.so' -- dynamic_linker="$host_os ld.so" -- shlibpath_var=LIBRARY_PATH -- ;; -+# Same as above, but do not quote variable references. -+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - --bsdi4*) -- version_type=linux -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" -- sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" -- export_dynamic_flag_spec=-rdynamic -- # the default ld.so.conf also contains /usr/contrib/lib and -- # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow -- # libtool to hard-code these into programs -- ;; -+# Sed substitution to delay expansion of an escaped shell variable in a -+# double_quote_subst'ed string. -+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - --cygwin* | mingw* | pw32*) -- version_type=windows -- need_version=no -- need_lib_prefix=no -- case $GCC,$host_os in -- yes,cygwin*) -- library_names_spec='$libname.dll.a' -- soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' -- postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ -- dldir=$destdir/`dirname \$dlpath`~ -- test -d \$dldir || mkdir -p \$dldir~ -- $install_prog .libs/$dlname \$dldir/$dlname' -- postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ -- dlpath=$dir/\$dldll~ -- $rm \$dlpath' -- ;; -- yes,mingw*) -- library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' -- sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` -+# Sed substitution to avoid accidental globbing in evaled expressions -+no_glob_subst='s/\*/\\\*/g' -+ -+# Constants: -+rm="rm -f" -+ -+# Global variables: -+default_ofile=libtool -+can_build_shared=yes -+ -+# All known linkers require a `.a' archive for static linking (except MSVC, -+# which needs '.lib'). -+libext=a -+ltmain="$ac_aux_dir/ltmain.sh" -+ofile="$default_ofile" -+with_gnu_ld="$lt_cv_prog_gnu_ld" -+ -+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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_AR+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_AR="${ac_tool_prefix}ar" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+fi -+fi -+AR=$ac_cv_prog_AR -+if test -n "$AR"; then -+ echo "$as_me:$LINENO: result: $AR" >&5 -+echo "${ECHO_T}$AR" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+fi -+if test -z "$ac_cv_prog_AR"; then -+ ac_ct_AR=$AR -+ # Extract the first word of "ar", so it can be a program name with args. -+set dummy ar; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_ac_ct_AR="ar" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" -+fi -+fi -+ac_ct_AR=$ac_cv_prog_ac_ct_AR -+if test -n "$ac_ct_AR"; then -+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -+echo "${ECHO_T}$ac_ct_AR" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ AR=$ac_ct_AR -+else -+ AR="$ac_cv_prog_AR" -+fi -+ -+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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_RANLIB+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+fi -+fi -+RANLIB=$ac_cv_prog_RANLIB -+if test -n "$RANLIB"; then -+ echo "$as_me:$LINENO: result: $RANLIB" >&5 -+echo "${ECHO_T}$RANLIB" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_ac_ct_RANLIB="ranlib" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -+fi -+fi -+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -+if test -n "$ac_ct_RANLIB"; then -+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -+echo "${ECHO_T}$ac_ct_RANLIB" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ RANLIB=$ac_ct_RANLIB -+else -+ RANLIB="$ac_cv_prog_RANLIB" -+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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_STRIP+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_STRIP="${ac_tool_prefix}strip" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+fi -+fi -+STRIP=$ac_cv_prog_STRIP -+if test -n "$STRIP"; then -+ echo "$as_me:$LINENO: result: $STRIP" >&5 -+echo "${ECHO_T}$STRIP" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_ac_ct_STRIP="strip" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -+fi -+fi -+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -+if test -n "$ac_ct_STRIP"; then -+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -+echo "${ECHO_T}$ac_ct_STRIP" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ STRIP=$ac_ct_STRIP -+else -+ STRIP="$ac_cv_prog_STRIP" -+fi -+ -+ -+old_CC="$CC" -+old_CFLAGS="$CFLAGS" -+ -+# Set sane defaults for various variables -+test -z "$AR" && AR=ar -+test -z "$AR_FLAGS" && AR_FLAGS=cru -+test -z "$AS" && AS=as -+test -z "$CC" && CC=cc -+test -z "$LTCC" && LTCC=$CC -+test -z "$DLLTOOL" && DLLTOOL=dlltool -+test -z "$LD" && LD=ld -+test -z "$LN_S" && LN_S="ln -s" -+test -z "$MAGIC_CMD" && MAGIC_CMD=file -+test -z "$NM" && NM=nm -+test -z "$SED" && SED=sed -+test -z "$OBJDUMP" && OBJDUMP=objdump -+test -z "$RANLIB" && RANLIB=: -+test -z "$STRIP" && STRIP=: -+test -z "$ac_objext" && ac_objext=o -+ -+# Determine commands to create old-style static archives. -+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -+old_postinstall_cmds='chmod 644 $oldlib' -+old_postuninstall_cmds= -+ -+if test -n "$RANLIB"; then -+ case $host_os in -+ openbsd*) -+ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" -+ ;; -+ *) -+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" -+ ;; -+ esac -+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -+fi -+ -+for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+ -+# Only perform the check for file, if the check method requires it -+case $deplibs_check_method in -+file_magic*) -+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then -+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 -+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 -+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 <&2 -+ -+*** Warning: the command libtool uses to detect shared libraries, -+*** $file_magic_cmd, produces output that libtool cannot recognize. -+*** The result is that libtool may fail to recognize shared libraries -+*** as such. This will affect the creation of libtool libraries that -+*** depend on shared libraries, but programs linked with such libtool -+*** libraries will work regardless of this problem. Nevertheless, you -+*** may want to report the problem to your system manager and/or to -+*** bug-libtool@gnu.org -+ -+EOF -+ fi ;; -+ esac -+ fi -+ 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 -+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -+echo "${ECHO_T}$MAGIC_CMD" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+if test -z "$lt_cv_path_MAGIC_CMD"; then -+ if test -n "$ac_tool_prefix"; then -+ echo "$as_me:$LINENO: checking for file" >&5 -+echo $ECHO_N "checking for file... $ECHO_C" >&6 -+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 <&2 -+ -+*** Warning: the command libtool uses to detect shared libraries, -+*** $file_magic_cmd, produces output that libtool cannot recognize. -+*** The result is that libtool may fail to recognize shared libraries -+*** as such. This will affect the creation of libtool libraries that -+*** depend on shared libraries, but programs linked with such libtool -+*** libraries will work regardless of this problem. Nevertheless, you -+*** may want to report the problem to your system manager and/or to -+*** bug-libtool@gnu.org -+ -+EOF -+ fi ;; -+ esac -+ fi -+ 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 -+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 -+echo "${ECHO_T}$MAGIC_CMD" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ else -+ MAGIC_CMD=: -+ fi -+fi -+ -+ fi -+ ;; -+esac -+ -+enable_dlopen=no -+enable_win32_dll=no -+ -+# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -+if test "${enable_libtool_lock+set}" = set; then -+ enableval="$enable_libtool_lock" -+ -+fi; -+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -+ -+ -+# Check whether --with-pic or --without-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 -+ -+# Use C for the default configuration in the libtool script -+tagname= -+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;\n" -+ -+# Code to be used in simple link tests -+lt_simple_link_test_code='int main(){return(0);}\n' -+ -+ -+# If no C compiler was specified, use CC. -+LTCC=${LTCC-"$CC"} -+ -+# Allow CC to be a program name with arguments. -+compiler=$CC -+ -+ -+# save warnings/boilerplate of simple test code -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_compile_test_code" >conftest.$ac_ext -+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_compiler_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_link_test_code" >conftest.$ac_ext -+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_linker_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ -+# -+# Check for any special shared library compilation flags. -+# -+lt_prog_cc_shlib= -+if test "$GCC" = no; then -+ case $host_os in -+ sco3.2v5*) -+ lt_prog_cc_shlib='-belf' -+ ;; -+ esac -+fi -+if test -n "$lt_prog_cc_shlib"; then -+ { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -+echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} -+ if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : -+ else -+ { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -+echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} -+ lt_cv_prog_cc_can_build_shared=no -+ fi -+fi -+ -+ -+# -+# Check to make sure the static flag actually works. -+# -+echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -+echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -+if test "${lt_prog_compiler_static_works+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_prog_compiler_static_works=no -+ save_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS $lt_prog_compiler_static" -+ printf "$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 "X$_lt_linker_boilerplate" | $Xsed > conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if diff conftest.exp conftest.er2 >/dev/null; then -+ lt_prog_compiler_static_works=yes -+ fi -+ else -+ lt_prog_compiler_static_works=yes -+ fi -+ fi -+ $rm conftest* -+ LDFLAGS="$save_LDFLAGS" -+ -+fi -+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 -+ -+if test x"$lt_prog_compiler_static_works" = xyes; then -+ : -+else -+ lt_prog_compiler_static= -+fi -+ -+ -+ -+ -+lt_prog_compiler_no_builtin_flag= -+ -+if test "$GCC" = yes; then -+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' -+ -+ -+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_cv_prog_compiler_rtti_exceptions=no -+ ac_outfile=conftest.$ac_objext -+ printf "$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:6407: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>conftest.err) -+ ac_status=$? -+ cat conftest.err >&5 -+ echo "$as_me:6411: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then -+ lt_cv_prog_compiler_rtti_exceptions=yes -+ fi -+ fi -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -+echo "${ECHO_T}$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= -+ -+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -+ -+ 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*) -+ # 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' -+ ;; -+ -+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) -+ # PIC is the default for these OSes. -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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' -+ ;; -+ -+ darwin* | rhapsody*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ lt_prog_compiler_pic='-fno-common' -+ ;; -+ -+ 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 -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ lt_prog_compiler_pic=-Kconform_pic -+ fi -+ ;; -+ -+ hpux*) -+ # 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='-fPIC' -+ ;; -+ esac -+ ;; -+ -+ *) -+ lt_prog_compiler_pic='-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 -+ ;; -+ darwin*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ case $cc_basename in -+ xlc*) -+ lt_prog_compiler_pic='-qnocommon' -+ lt_prog_compiler_wl='-Wl,' -+ ;; -+ esac -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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' -+ ;; -+ -+ newsos6) -+ lt_prog_compiler_pic='-KPIC' -+ lt_prog_compiler_static='-Bstatic' -+ ;; -+ -+ linux*) -+ case $cc_basename in -+ icc* | ecc*) -+ lt_prog_compiler_wl='-Wl,' -+ lt_prog_compiler_pic='-KPIC' -+ lt_prog_compiler_static='-static' -+ ;; -+ pgcc* | pgf77* | pgf90* | pgf95*) -+ # 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' -+ ;; -+ esac -+ ;; -+ -+ osf3* | osf4* | osf5*) -+ lt_prog_compiler_wl='-Wl,' -+ # All OSF/1 code is PIC. -+ lt_prog_compiler_static='-non_shared' -+ ;; -+ -+ sco3.2v5*) -+ lt_prog_compiler_pic='-Kpic' -+ lt_prog_compiler_static='-dn' -+ ;; -+ -+ solaris*) -+ lt_prog_compiler_pic='-KPIC' -+ lt_prog_compiler_static='-Bstatic' -+ case $cc_basename in -+ f77* | f90* | f95*) -+ 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* | sysv5*) -+ 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 -+ ;; -+ -+ 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 -+ -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic" >&6 -+ -+# -+# Check to make sure the PIC flag actually works. -+# -+if test -n "$lt_prog_compiler_pic"; then -+ -+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 -+if test "${lt_prog_compiler_pic_works+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_prog_compiler_pic_works=no -+ ac_outfile=conftest.$ac_objext -+ printf "$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:6669: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>conftest.err) -+ ac_status=$? -+ cat conftest.err >&5 -+ echo "$as_me:6673: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then -+ lt_prog_compiler_pic_works=yes -+ fi -+ fi -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 -+ -+if test x"$lt_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 -+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 -+ -+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -+if test "${lt_cv_prog_compiler_c_o+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_cv_prog_compiler_c_o=no -+ $rm -r conftest 2>/dev/null -+ mkdir conftest -+ cd conftest -+ mkdir out -+ printf "$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:6731: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>out/conftest.err) -+ ac_status=$? -+ cat out/conftest.err >&5 -+ echo "$as_me:6735: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp -+ $SED '/^$/d' out/conftest.err >out/conftest.er2 -+ if test ! -s out/conftest.err || 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 .. -+ rmdir conftest -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -+echo "${ECHO_T}$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 -+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 -+ hard_links=yes -+ $rm conftest* -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ touch conftest.a -+ ln conftest.a conftest.b 2>&5 || hard_links=no -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ echo "$as_me:$LINENO: result: $hard_links" >&5 -+echo "${ECHO_T}$hard_links" >&6 -+ if test "$hard_links" = no; then -+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -+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 -+ -+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -+ -+ runpath_var= -+ allow_undefined_flag= -+ enable_shared_with_static_runtimes=no -+ archive_cmds= -+ archive_expsym_cmds= -+ old_archive_From_new_cmds= -+ old_archive_from_expsyms_cmds= -+ export_dynamic_flag_spec= -+ whole_archive_flag_spec= -+ thread_safe_flag_spec= -+ hardcode_libdir_flag_spec= -+ hardcode_libdir_flag_spec_ld= -+ hardcode_libdir_separator= -+ hardcode_direct=no -+ hardcode_minus_L=no -+ hardcode_shlibpath_var=unsupported -+ link_all_deplibs=unknown -+ hardcode_automatic=no -+ module_cmds= -+ module_expsym_cmds= -+ always_export_symbols=no -+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ # include_expsyms should be a list of space-separated symbols to be *always* -+ # included in the symbol list -+ include_expsyms= -+ # exclude_expsyms can be an 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_" -+ # 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. -+ extract_expsyms_cmds= -+ # Just being paranoid about ensuring that cc_basename is set. -+ for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+ case $host_os in -+ cygwin* | mingw* | pw32*) -+ # 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 -+ ;; -+ openbsd*) -+ with_gnu_ld=no -+ ;; -+ esac -+ -+ ld_shlibs=yes -+ if test "$with_gnu_ld" = 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>/dev/null` in -+ *\ [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 -+ aix3* | aix4* | aix5*) -+ # On AIX/PPC, the GNU linker is very broken -+ if test "$host_cpu" != ia64; then -+ ld_shlibs=no -+ cat <&2 -+ -+*** Warning: the GNU linker, at least up to release 2.9.1, is reported -+*** to be unable to reliably create shared libraries on AIX. -+*** Therefore, libtool is disabling shared libraries support. If you -+*** really care for shared libraries, you may want to modify your PATH -+*** so that a non-GNU linker is found, and then restart. -+ -+EOF -+ fi -+ ;; -+ -+ amigaos*) -+ 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 -+ -+ # Samuel A. Falvo II reports -+ # that the semantics of dynamic libraries on AmigaOS, at least up -+ # to version 4, is to share data among multiple programs linked -+ # with the same dynamic library. Since this doesn't match the -+ # behavior of shared libraries on other platforms, we can't use -+ # them. -+ ld_shlibs=no -+ ;; -+ -+ 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*) -+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, -+ # as there is no search path for DLLs. -+ hardcode_libdir_flag_spec='-L$libdir' -+ allow_undefined_flag=unsupported -+ always_export_symbols=no -+ 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' -+ -+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then -+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$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}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ else -+ ld_shlibs=no -+ fi -+ ;; -+ -+ linux*) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ tmp_addflag= -+ 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; $echo \"$new_convenience\"` ${wl}--no-whole-archive' -+ tmp_addflag=' $pic_flag' -+ ;; -+ pgf77* | pgf90* | pgf95*) # 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; $echo \"$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' ;; -+ esac -+ archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ -+ if test $supports_anon_versioning = yes; 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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' -+ fi -+ link_all_deplibs=no -+ else -+ ld_shlibs=no -+ fi -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ 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 $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' -+ fi -+ ;; -+ -+ solaris* | sysv5*) -+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then -+ ld_shlibs=no -+ cat <&2 -+ -+*** Warning: The releases 2.8.* of the GNU linker cannot reliably -+*** create shared libraries on Solaris systems. Therefore, libtool -+*** is disabling shared libraries support. We urge you to upgrade GNU -+*** binutils to release 2.9.1 or newer. Another option is to modify -+*** your PATH or compiler configuration so that the native linker is -+*** used, and then restart. -+ -+EOF -+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ 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 -+ ;; -+ -+ 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 $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 -+ -+ 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 "$link_static_flag"; then -+ # Neither direct hardcoding nor static linking is supported with a -+ # broken collect2. -+ hardcode_direct=unsupported -+ fi -+ ;; -+ -+ aix4* | aix5*) -+ 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 -+ 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")) && (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].*|aix5*) -+ 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_libdir_separator=':' -+ link_all_deplibs=yes -+ -+ 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 -+ hardcode_direct=yes -+ else -+ # We have old collect2 -+ hardcode_direct=unsupported -+ # It fails to find uninstalled libraries when the uninstalled -+ # path is not listed in the libpath. Setting hardcode_minus_L -+ # to unsupported forces relinking -+ hardcode_minus_L=yes -+ hardcode_libdir_flag_spec='-L$libdir' -+ hardcode_libdir_separator= -+ fi -+ 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 -+ -+ # 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. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+ -+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" -+ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${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 $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ else -+ # Determine the default libpath from the value encoded in an empty executable. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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' -+ # -bexpall does not export symbols beginning with underscore (_) -+ always_export_symbols=yes -+ # Exported symbols can be pulled into shared objects from archives -+ whole_archive_flag_spec=' ' -+ 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 $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' -+ fi -+ fi -+ ;; -+ -+ amigaos*) -+ 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 -+ # see comment about different semantics on the GNU ld section -+ ld_shlibs=no -+ ;; -+ -+ bsdi[45]*) -+ export_dynamic_flag_spec=-rdynamic -+ ;; -+ -+ cygwin* | mingw* | pw32*) -+ # When not using gcc, we currently assume that we are using -+ # Microsoft Visual C++. -+ # hardcode_libdir_flag_spec is actually meaningless, as there is -+ # no search path for DLLs. -+ hardcode_libdir_flag_spec=' ' -+ allow_undefined_flag=unsupported -+ # Tell ltmain to make .lib files, not .a files. -+ libext=lib -+ # 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 `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' -+ # The linker will automatically build a .lib file if we build a DLL. -+ old_archive_From_new_cmds='true' -+ # FIXME: Should let the user specify the lib program. -+ old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' -+ fix_srcfile_path='`cygpath -w "$srcfile"`' -+ enable_shared_with_static_runtimes=yes -+ ;; -+ -+ darwin* | rhapsody*) -+ case $host_os in -+ rhapsody* | darwin1.[012]) -+ allow_undefined_flag='${wl}-undefined ${wl}suppress' -+ ;; -+ *) # Darwin 1.3 on -+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then -+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ else -+ case ${MACOSX_DEPLOYMENT_TARGET} in -+ 10.[012]) -+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ ;; -+ 10.*) -+ allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' -+ ;; -+ esac -+ fi -+ ;; -+ esac -+ archive_cmds_need_lc=no -+ hardcode_direct=no -+ hardcode_automatic=yes -+ hardcode_shlibpath_var=unsupported -+ whole_archive_flag_spec='' -+ link_all_deplibs=yes -+ if test "$GCC" = yes ; then -+ output_verbose_link_cmd='echo' -+ archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ case $cc_basename in -+ xlc*) -+ output_verbose_link_cmd='echo' -+ archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' -+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ ;; -+ *) -+ ld_shlibs=no -+ ;; -+ esac -+ 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* | kfreebsd*-gnu | dragonfly*) -+ archive_cmds='$CC -shared -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 -fPIC ${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* | hpux11*) -+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*|ia64*) -+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ *) -+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ esac -+ else -+ case $host_cpu in -+ hppa*64*|ia64*) -+ archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ *) -+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ esac -+ fi -+ if test "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*) -+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' -+ hardcode_libdir_flag_spec_ld='+b $libdir' -+ hardcode_libdir_separator=: -+ hardcode_direct=no -+ hardcode_shlibpath_var=no -+ ;; -+ ia64*) -+ hardcode_libdir_flag_spec='-L$libdir' -+ hardcode_direct=no -+ hardcode_shlibpath_var=no -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ hardcode_minus_L=yes -+ ;; -+ *) -+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator=: -+ hardcode_direct=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 $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ hardcode_libdir_flag_spec_ld='-rpath $libdir' -+ fi -+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator=: -+ link_all_deplibs=yes -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ 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 -+ ;; -+ -+ openbsd*) -+ hardcode_direct=yes -+ hardcode_shlibpath_var=no -+ 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 -+ ;; -+ -+ 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" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ allow_undefined_flag=' -expect_unresolved \*' -+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ fi -+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator=: -+ ;; -+ -+ osf4* | osf5*) # as osf3* with the addition of -msym flag -+ if test "$GCC" = yes; then -+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${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='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -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; echo "-hidden">> $lib.exp~ -+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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 -+ hardcode_libdir_separator=: -+ ;; -+ -+ sco3.2v5*) -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_shlibpath_var=no -+ export_dynamic_flag_spec='${wl}-Bexport' -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ ;; -+ -+ solaris*) -+ no_undefined_flag=' -z text' -+ if test "$GCC" = yes; then -+ wlarc='${wl}' -+ archive_cmds='$CC -shared ${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 ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' -+ else -+ 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' -+ 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 linker options so we -+ # cannot just pass the convience library names through -+ # without $wl, iff we do not link with $LD. -+ # Luckily, gcc supports the same syntax we need for Sun Studio. -+ # Supported since Solaris 2.6 (maybe 2.5.1?) -+ case $wlarc in -+ '') -+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; -+ *) -+ whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; -+ esac ;; -+ 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.2uw2*) -+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct=yes -+ hardcode_minus_L=no -+ hardcode_shlibpath_var=no -+ hardcode_runpath_var=yes -+ runpath_var=LD_RUN_PATH -+ ;; -+ -+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) -+ no_undefined_flag='${wl}-z ${wl}text' -+ if test "$GCC" = yes; then -+ archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ else -+ archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ fi -+ runpath_var='LD_RUN_PATH' -+ hardcode_shlibpath_var=no -+ ;; -+ -+ sysv5*) -+ no_undefined_flag=' -z text' -+ # $CC -shared without GNU ld will not create a library from C++ -+ # object files and a static libstdc++, better avoid it by now -+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $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' -+ hardcode_libdir_flag_spec= -+ hardcode_shlibpath_var=no -+ runpath_var='LD_RUN_PATH' -+ ;; -+ -+ 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 -+ fi -+ -+echo "$as_me:$LINENO: result: $ld_shlibs" >&5 -+echo "${ECHO_T}$ld_shlibs" >&6 -+test "$ld_shlibs" = 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 -+ -+# -+# 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. -+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 -+ $rm conftest* -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ -+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } 2>conftest.err; then -+ soname=conftest -+ lib=conftest -+ libobjs=conftest.$ac_objext -+ deplibs= -+ wl=$lt_prog_compiler_wl -+ 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:$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=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ then -+ archive_cmds_need_lc=no -+ else -+ archive_cmds_need_lc=yes -+ fi -+ allow_undefined_flag=$lt_save_allow_undefined_flag -+ else -+ cat conftest.err 1>&5 -+ fi -+ $rm conftest* -+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -+echo "${ECHO_T}$archive_cmds_need_lc" >&6 -+ ;; -+ esac -+ fi -+ ;; -+esac -+ -+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -+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" -+if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then -+ # 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. -+ 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 -+else -+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -+fi -+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' -+ ;; -+ -+aix4* | aix5*) -+ 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*) -+ library_names_spec='$libname.ixlibrary $libname.a' -+ # Create ${libname}_ixlibrary.a entries in /sys/libs. -+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' -+ ;; -+ -+beos*) -+ library_names_spec='${libname}${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*) -+ version_type=windows -+ shrext_cmds=".dll" -+ need_version=no -+ need_lib_prefix=no -+ -+ case $GCC,$host_os in -+ yes,cygwin* | yes,mingw* | yes,pw32*) -+ 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' -+ 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="/usr/lib /lib/w32api /lib /usr/local/lib" -+ ;; -+ mingw*) -+ # MinGW DLLs use traditional 'lib' prefix -+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then -+ # It is most probably a Windows format PATH printed by -+ # mingw gcc, but we are running on Cygwin. Gcc prints its search -+ # path with ; separators, and with drive letters. We can handle the -+ # drive letters (cygwin fileutils understands them), so leave them, -+ # especially as we might pass files found there to a mingw objdump, -+ # which wouldn't understand a cygwinified path. Ahh. -+ 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 -+ ;; -+ 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 -+ ;; -+ -+ *) -+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' -+ ;; -+ esac -+ dynamic_linker='Win32 ld.exe' -+ # 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}${versuffix}$shared_ext ${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`' -+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. -+ if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` -+ else -+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' -+ fi -+ 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 -+ ;; -+ -+kfreebsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU ld.so' -+ ;; -+ -+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 -+ ;; -+ *) # from 3.2 on -+ shlibpath_overrides_runpath=no -+ 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 -+ ;; -+ -+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' -+ ;; -+ -+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*) -+ 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 -+ # 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)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' -+ ;; -+ -+netbsdelf*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='NetBSD ld.elf_so' -+ ;; -+ -+knetbsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU 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=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 -+ ;; -+ -+openbsd*) -+ version_type=sunos -+ 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" -+ ;; -+ -+sco3.2v5*) -+ version_type=osf -+ 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 -+ ;; -+ -+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.2uw2* | sysv4.3* | sysv5*) -+ 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 -+ export_dynamic_flag_spec='${wl}-Blargedynsym' -+ 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 -+ ;; -+ -+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 -+echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -+echo "${ECHO_T}$dynamic_linker" >&6 -+test "$dynamic_linker" = no && can_build_shared=no -+ -+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -+hardcode_action= -+if test -n "$hardcode_libdir_flag_spec" || \ -+ test -n "$runpath_var" || \ -+ test "X$hardcode_automatic" = "Xyes" ; then -+ -+ # We can hardcode non-existant directories. -+ if test "$hardcode_direct" != no && -+ # If the only mechanism to avoid hardcoding is shlibpath_var, we -+ # have to relink, otherwise we might link with an installed library -+ # when we should be linking with a yet-to-be-installed one -+ ## test "$_LT_AC_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 -+echo "$as_me:$LINENO: result: $hardcode_action" >&5 -+echo "${ECHO_T}$hardcode_action" >&6 -+ -+if test "$hardcode_action" = relink; then -+ # Fast installation is not supported -+ enable_fast_install=no -+elif test "$shlibpath_overrides_runpath" = yes || -+ test "$enable_shared" = no; then -+ # Fast installation is not necessary -+ enable_fast_install=needless -+fi -+ -+striplib= -+old_striplib= -+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ ;; -+ *) -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ ;; -+ esac -+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*) -+ 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 -+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -+if test "${ac_cv_lib_dl_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldl $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dl_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dl_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -+if test $ac_cv_lib_dl_dlopen = yes; 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 -+ -+ ;; -+ -+ *) -+ echo "$as_me:$LINENO: checking for shl_load" >&5 -+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -+if test "${ac_cv_func_shl_load+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define shl_load to an innocuous variant, in case declares shl_load. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define shl_load innocuous_shl_load -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char shl_load (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef shl_load -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char shl_load (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_shl_load) || defined (__stub___shl_load) -+choke me -+#else -+char (*f) () = shl_load; -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+int -+main () -+{ -+return f != shl_load; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_shl_load=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_func_shl_load=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -+echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -+if test $ac_cv_func_shl_load = yes; then -+ lt_cv_dlopen="shl_load" -+else -+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -+if test "${ac_cv_lib_dld_shl_load+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char shl_load (); -+int -+main () -+{ -+shl_load (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dld_shl_load=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dld_shl_load=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -+if test $ac_cv_lib_dld_shl_load = yes; then -+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -+else -+ echo "$as_me:$LINENO: checking for dlopen" >&5 -+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -+if test "${ac_cv_func_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define dlopen to an innocuous variant, in case declares dlopen. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define dlopen innocuous_dlopen -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char dlopen (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef dlopen -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_dlopen) || defined (__stub___dlopen) -+choke me -+#else -+char (*f) () = dlopen; -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+int -+main () -+{ -+return f != dlopen; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_func_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -+if test $ac_cv_func_dlopen = yes; then -+ lt_cv_dlopen="dlopen" -+else -+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -+if test "${ac_cv_lib_dl_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldl $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dl_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dl_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -+if test $ac_cv_lib_dl_dlopen = yes; then -+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -+else -+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -+if test "${ac_cv_lib_svld_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lsvld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_svld_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_svld_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -+if test $ac_cv_lib_svld_dlopen = yes; then -+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -+else -+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -+if test "${ac_cv_lib_dld_dld_link+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dld_link (); -+int -+main () -+{ -+dld_link (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dld_dld_link=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dld_dld_link=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -+if test $ac_cv_lib_dld_dld_link = yes; then -+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -+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" -+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -+ -+ save_LIBS="$LIBS" -+ LIBS="$lt_cv_dlopen_libs $LIBS" -+ -+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -+if test "${lt_cv_dlopen_self+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 < -+#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 -+ -+#ifdef __cplusplus -+extern "C" void exit (int); -+#endif -+ -+void fnord() { int i=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; -+ /* dlclose (self); */ -+ } -+ -+ exit (status); -+} -+EOF -+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && 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_unknown|x*) lt_cv_dlopen_self=no ;; -+ esac -+ else : -+ # compilation failed -+ lt_cv_dlopen_self=no -+ fi -+fi -+rm -fr conftest* -+ -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -+echo "${ECHO_T}$lt_cv_dlopen_self" >&6 -+ -+ if test "x$lt_cv_dlopen_self" = xyes; then -+ LDFLAGS="$LDFLAGS $link_static_flag" -+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -+if test "${lt_cv_dlopen_self_static+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 < -+#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 -+ -+#ifdef __cplusplus -+extern "C" void exit (int); -+#endif -+ -+void fnord() { int i=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; -+ /* dlclose (self); */ -+ } -+ -+ exit (status); -+} -+EOF -+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && 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_unknown|x*) lt_cv_dlopen_self_static=no ;; -+ esac -+ else : -+ # compilation failed -+ lt_cv_dlopen_self_static=no -+ fi -+fi -+rm -fr conftest* -+ -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -+echo "${ECHO_T}$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 -+ -+ -+# Report which librarie types wil actually be built -+echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -+echo "$as_me:$LINENO: result: $can_build_shared" >&5 -+echo "${ECHO_T}$can_build_shared" >&6 -+ -+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -+test "$can_build_shared" = "no" && enable_shared=no -+ -+# On AIX, shared libraries and static libraries use the same namespace, and -+# are all built from PIC. -+case $host_os in -+aix3*) -+ test "$enable_shared" = yes && enable_static=no -+ if test -n "$RANLIB"; then -+ archive_cmds="$archive_cmds~\$RANLIB \$lib" -+ postinstall_cmds='$RANLIB $lib' -+ fi -+ ;; -+ -+aix4* | aix5*) -+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then -+ test "$enable_shared" = yes && enable_static=no -+ fi -+ ;; -+esac -+echo "$as_me:$LINENO: result: $enable_shared" >&5 -+echo "${ECHO_T}$enable_shared" >&6 -+ -+echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -+# Make sure either enable_shared or enable_static is yes. -+test "$enable_shared" = yes || enable_static=yes -+echo "$as_me:$LINENO: result: $enable_static" >&5 -+echo "${ECHO_T}$enable_static" >&6 -+ -+# The else clause should only fire when bootstrapping the -+# libtool distribution, otherwise you forgot to ship ltmain.sh -+# with your package, and you will get complaints that there are -+# no rules to generate ltmain.sh. -+if test -f "$ltmain"; then -+ # 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 -+ # Now quote all the things that may contain metacharacters while being -+ # careful not to overquote the AC_SUBSTed values. We take copies of the -+ # variables and quote the copies for generation of the libtool script. -+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ -+ SED SHELL STRIP \ -+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ -+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ -+ deplibs_check_method reload_flag reload_cmds need_locks \ -+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ -+ lt_cv_sys_global_symbol_to_c_name_address \ -+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -+ old_postinstall_cmds old_postuninstall_cmds \ -+ compiler \ -+ CC \ -+ LD \ -+ lt_prog_compiler_wl \ -+ lt_prog_compiler_pic \ -+ lt_prog_compiler_static \ -+ lt_prog_compiler_no_builtin_flag \ -+ export_dynamic_flag_spec \ -+ thread_safe_flag_spec \ -+ whole_archive_flag_spec \ -+ enable_shared_with_static_runtimes \ -+ old_archive_cmds \ -+ old_archive_from_new_cmds \ -+ predep_objects \ -+ postdep_objects \ -+ predeps \ -+ postdeps \ -+ compiler_lib_search_path \ -+ archive_cmds \ -+ archive_expsym_cmds \ -+ postinstall_cmds \ -+ postuninstall_cmds \ -+ old_archive_from_expsyms_cmds \ -+ allow_undefined_flag \ -+ no_undefined_flag \ -+ export_symbols_cmds \ -+ hardcode_libdir_flag_spec \ -+ hardcode_libdir_flag_spec_ld \ -+ hardcode_libdir_separator \ -+ hardcode_automatic \ -+ module_cmds \ -+ module_expsym_cmds \ -+ lt_cv_prog_compiler_c_o \ -+ exclude_expsyms \ -+ include_expsyms; do -+ -+ case $var in -+ old_archive_cmds | \ -+ old_archive_from_new_cmds | \ -+ archive_cmds | \ -+ archive_expsym_cmds | \ -+ module_cmds | \ -+ module_expsym_cmds | \ -+ old_archive_from_expsyms_cmds | \ -+ export_symbols_cmds | \ -+ extract_expsyms_cmds | reload_cmds | finish_cmds | \ -+ postinstall_cmds | postuninstall_cmds | \ -+ old_postinstall_cmds | old_postuninstall_cmds | \ -+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) -+ # Double-quote double-evaled strings. -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" -+ ;; -+ *) -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -+ ;; -+ esac -+ done -+ -+ case $lt_echo in -+ *'\$0 --fallback-echo"') -+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` -+ ;; -+ esac -+ -+cfgfile="${ofile}T" -+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15 -+ $rm -f "$cfgfile" -+ { echo "$as_me:$LINENO: creating $ofile" >&5 -+echo "$as_me: creating $ofile" >&6;} -+ -+ cat <<__EOF__ >> "$cfgfile" -+#! $SHELL -+ -+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -+# NOTE: Changes made to this file will be lost: look at ltmain.sh. -+# -+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -+# Free Software Foundation, Inc. -+# -+# This file is part of GNU Libtool: -+# Originally by Gordon Matzigkeit , 1996 -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -+# -+# As a special exception to the GNU General Public License, if you -+# distribute this file as part of a program that contains a -+# configuration script generated by Autoconf, you may include it under -+# the same distribution terms that you use for the rest of that program. -+ -+# A 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//" -+ -+# 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 -+ -+# The names of the tagged configurations supported by this script. -+available_tags= -+ -+# ### BEGIN LIBTOOL CONFIG -+ -+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -+ -+# Shell to use when invoking shell scripts. -+SHELL=$lt_SHELL -+ -+# Whether or not to build shared libraries. -+build_libtool_libs=$enable_shared -+ -+# Whether or not to build static libraries. -+build_old_libs=$enable_static -+ -+# Whether or not to 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 -+ -+# Whether or not to optimize for fast installation. -+fast_install=$enable_fast_install -+ -+# 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 -+ -+# An echo program that does not interpret backslashes. -+echo=$lt_echo -+ -+# The archiver. -+AR=$lt_AR -+AR_FLAGS=$lt_AR_FLAGS -+ -+# A C compiler. -+LTCC=$lt_LTCC -+ -+# A language-specific compiler. -+CC=$lt_compiler -+ -+# Is the compiler the GNU C compiler? -+with_gcc=$GCC -+ -+# An ERE matcher. -+EGREP=$lt_EGREP -+ -+# The linker used to build libraries. -+LD=$lt_LD -+ -+# Whether we need hard or soft links. -+LN_S=$lt_LN_S -+ -+# A BSD-compatible nm program. -+NM=$lt_NM -+ -+# A symbol stripping program -+STRIP=$lt_STRIP -+ -+# Used to examine libraries when file_magic_cmd begins "file" -+MAGIC_CMD=$MAGIC_CMD -+ -+# Used on cygwin: DLL creation program. -+DLLTOOL="$DLLTOOL" -+ -+# Used on cygwin: object dumper. -+OBJDUMP="$OBJDUMP" -+ -+# Used on cygwin: assembler. -+AS="$AS" -+ -+# The name of the directory that contains temporary libtool files. -+objdir=$objdir -+ -+# How to create reloadable object files. -+reload_flag=$lt_reload_flag -+reload_cmds=$lt_reload_cmds -+ -+# How to pass a linker flag through the compiler. -+wl=$lt_lt_prog_compiler_wl -+ -+# Object file suffix (normally "o"). -+objext="$ac_objext" -+ -+# Old archive suffix (normally "a"). -+libext="$libext" -+ -+# Shared library suffix (normally ".so"). -+shrext_cmds='$shrext_cmds' -+ -+# Executable file suffix (normally ""). -+exeext="$exeext" -+ -+# Additional compiler flags for building library objects. -+pic_flag=$lt_lt_prog_compiler_pic -+pic_mode=$pic_mode -+ -+# What is the maximum length of a command? -+max_cmd_len=$lt_cv_sys_max_cmd_len -+ -+# Does compiler simultaneously support -c and -o options? -+compiler_c_o=$lt_lt_cv_prog_compiler_c_o -+ -+# Must we lock files when doing compilation? -+need_locks=$lt_need_locks -+ -+# Do we need the lib prefix for modules? -+need_lib_prefix=$need_lib_prefix -+ -+# Do we need a version for libraries? -+need_version=$need_version -+ -+# Whether dlopen is supported. -+dlopen_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 -+ -+# Compiler flag to prevent dynamic linking. -+link_static_flag=$lt_lt_prog_compiler_static -+ -+# Compiler flag to turn off builtin functions. -+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag -+ -+# 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 -+ -+# Compiler flag to generate thread-safe objects. -+thread_safe_flag_spec=$lt_thread_safe_flag_spec -+ -+# Library versioning type. -+version_type=$version_type -+ -+# 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 -+ -+# Commands used to build and install an old-style archive. -+RANLIB=$lt_RANLIB -+old_archive_cmds=$lt_old_archive_cmds -+old_postinstall_cmds=$lt_old_postinstall_cmds -+old_postuninstall_cmds=$lt_old_postuninstall_cmds -+ -+# 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 and install a shared archive. -+archive_cmds=$lt_archive_cmds -+archive_expsym_cmds=$lt_archive_expsym_cmds -+postinstall_cmds=$lt_postinstall_cmds -+postuninstall_cmds=$lt_postuninstall_cmds -+ -+# Commands used to build a loadable module (assumed same as above if empty) -+module_cmds=$lt_module_cmds -+module_expsym_cmds=$lt_module_expsym_cmds -+ -+# Commands to strip libraries. -+old_striplib=$lt_old_striplib -+striplib=$lt_striplib -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predep_objects=$lt_predep_objects -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdep_objects=$lt_postdep_objects -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predeps=$lt_predeps -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdeps=$lt_postdeps -+ -+# The library search path used internally by the compiler when linking -+# a shared library. -+compiler_lib_search_path=$lt_compiler_lib_search_path -+ -+# 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 -+ -+# Flag that allows shared libraries with undefined symbols to be built. -+allow_undefined_flag=$lt_allow_undefined_flag -+ -+# Flag that forces no undefined symbols. -+no_undefined_flag=$lt_no_undefined_flag -+ -+# Commands used to finish a libtool library installation in a directory. -+finish_cmds=$lt_finish_cmds -+ -+# Same as above, but a single script fragment to be evaled but not shown. -+finish_eval=$lt_finish_eval -+ -+# 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 -+ -+# This is the shared library runtime path variable. -+runpath_var=$runpath_var -+ -+# This is the shared library path variable. -+shlibpath_var=$shlibpath_var -+ -+# Is shlibpath searched before the hard-coded library search path? -+shlibpath_overrides_runpath=$shlibpath_overrides_runpath -+ -+# How to hardcode a shared library path into an executable. -+hardcode_action=$hardcode_action -+ -+# Whether we should hardcode library paths into libraries. -+hardcode_into_libs=$hardcode_into_libs -+ -+# 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 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 -+ -+# Variables whose values should be saved in libtool wrapper scripts and -+# restored at relink time. -+variables_saved_for_relink="$variables_saved_for_relink" -+ -+# Whether libtool must link a program against all its dependency libraries. -+link_all_deplibs=$link_all_deplibs -+ -+# 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 -+ -+# Fix the shell variable \$srcfile for the compiler. -+fix_srcfile_path="$fix_srcfile_path" -+ -+# Set to yes if exported symbols are required. -+always_export_symbols=$always_export_symbols -+ -+# The commands to list exported symbols. -+export_symbols_cmds=$lt_export_symbols_cmds -+ -+# The commands to extract the exported symbol list from a shared archive. -+extract_expsyms_cmds=$lt_extract_expsyms_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 -+ -+# ### END LIBTOOL CONFIG -+ -+__EOF__ -+ -+ -+ case $host_os in -+ aix3*) -+ cat <<\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 -+EOF -+ ;; -+ esac -+ -+ # 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) -+ -+ mv -f "$cfgfile" "$ofile" || \ -+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") -+ chmod +x "$ofile" -+ -+else -+ # If there is no Makefile yet, we rely on a make rule to execute -+ # `config.status --recheck' to rerun these tests and create the -+ # libtool script then. -+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` -+ if test -f "$ltmain_in"; then -+ test -f Makefile && make "$ltmain" -+ fi -+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" -+ -+ -+# Check whether --with-tags or --without-tags was given. -+if test "${with_tags+set}" = set; then -+ withval="$with_tags" -+ tagnames="$withval" -+fi; -+ -+if test -f "$ltmain" && test -n "$tagnames"; then -+ if test ! -f "${ofile}"; then -+ { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} -+ fi -+ -+ if test -z "$LTCC"; then -+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`" -+ if test -z "$LTCC"; then -+ { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} -+ else -+ { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} -+ fi -+ fi -+ -+ # Extract list of available tagged configurations in $ofile. -+ # Note that this assumes the entire list is on one line. -+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` -+ -+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," -+ for tagname in $tagnames; do -+ IFS="$lt_save_ifs" -+ # Check whether tagname contains only valid characters -+ case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in -+ "") ;; -+ *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -+echo "$as_me: error: invalid tag name: $tagname" >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+ esac -+ -+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null -+ then -+ { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} -+ { (exit 1); exit 1; }; } -+ fi -+ -+ # Update the list of available tags. -+ if test -n "$tagname"; then -+ echo appending configuration tag \"$tagname\" to $ofile -+ -+ case $tagname in -+ CXX) -+ if test -n "$CXX" && ( test "X$CXX" != "Xno" && -+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || -+ (test "X$CXX" != "Xg++"))) ; then -+ ac_ext=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -+ -+ -+ -+ -+archive_cmds_need_lc_CXX=no -+allow_undefined_flag_CXX= -+always_export_symbols_CXX=no -+archive_expsym_cmds_CXX= -+export_dynamic_flag_spec_CXX= -+hardcode_direct_CXX=no -+hardcode_libdir_flag_spec_CXX= -+hardcode_libdir_flag_spec_ld_CXX= -+hardcode_libdir_separator_CXX= -+hardcode_minus_L_CXX=no -+hardcode_automatic_CXX=no -+module_cmds_CXX= -+module_expsym_cmds_CXX= -+link_all_deplibs_CXX=unknown -+old_archive_cmds_CXX=$old_archive_cmds -+no_undefined_flag_CXX= -+whole_archive_flag_spec_CXX= -+enable_shared_with_static_runtimes_CXX=no -+ -+# Dependencies to place before and after the object being linked: -+predep_objects_CXX= -+postdep_objects_CXX= -+predeps_CXX= -+postdeps_CXX= -+compiler_lib_search_path_CXX= -+ -+# Source file extension for C++ test sources. -+ac_ext=cpp -+ -+# Object file extension for compiled C++ test sources. -+objext=o -+objext_CXX=$objext -+ -+# Code to be used in simple compile tests -+lt_simple_compile_test_code="int some_variable = 0;\n" -+ -+# Code to be used in simple link tests -+lt_simple_link_test_code='int main(int, char *) { return(0); }\n' -+ -+# ltmain only uses $CC for tagged configurations so make sure $CC is set. -+ -+# If no C compiler was specified, use CC. -+LTCC=${LTCC-"$CC"} -+ -+# Allow CC to be a program name with arguments. -+compiler=$CC -+ -+ -+# save warnings/boilerplate of simple test code -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_compile_test_code" >conftest.$ac_ext -+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_compiler_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_link_test_code" >conftest.$ac_ext -+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_linker_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ -+# Allow CC to be a program name with arguments. -+lt_save_CC=$CC -+lt_save_LD=$LD -+lt_save_GCC=$GCC -+GCC=$GXX -+lt_save_with_gnu_ld=$with_gnu_ld -+lt_save_path_LD=$lt_cv_path_LD -+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then -+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -+else -+ unset lt_cv_prog_gnu_ld -+fi -+if test -n "${lt_cv_path_LDCXX+set}"; then -+ lt_cv_path_LD=$lt_cv_path_LDCXX -+else -+ unset lt_cv_path_LD -+fi -+test -z "${LDCXX+set}" || LD=$LDCXX -+CC=${CXX-"c++"} -+compiler=$CC -+compiler_CXX=$CC -+for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+ -+# We don't want -fno-exception wen compiling C++ code, so set the -+# no_builtin_flag separately -+if test "$GXX" = yes; then -+ lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -+else -+ lt_prog_compiler_no_builtin_flag_CXX= -+fi -+ -+if test "$GXX" = yes; then -+ # Set up default GNU C++ configuration -+ -+ -+# Check whether --with-gnu-ld or --without-gnu-ld was given. -+if test "${with_gnu_ld+set}" = set; then -+ withval="$with_gnu_ld" -+ test "$withval" = no || with_gnu_ld=yes -+else -+ with_gnu_ld=no -+fi; -+ac_prog=ld -+if test "$GCC" = yes; then -+ # Check if gcc -print-prog-name=ld gives a path. -+ echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&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 -+ echo "$as_me:$LINENO: checking for GNU ld" >&5 -+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -+else -+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -+fi -+if test "${lt_cv_path_LD+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 -+echo "${ECHO_T}$LD" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} -+ { (exit 1); exit 1; }; } -+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -+if test "${lt_cv_prog_gnu_ld+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ # I'd rather use --version here, but apparently some GNU lds only accept -v. -+case `$LD -v 2>&1 &5 -+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -+with_gnu_ld=$lt_cv_prog_gnu_ld -+ -+ -+ -+ # Check if GNU C++ uses GNU ld as the underlying linker, since the -+ # archiving commands below assume that GNU ld is being used. -+ if test "$with_gnu_ld" = yes; then -+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' -+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic' -+ -+ # If archive_cmds runs LD, not CC, wlarc should be empty -+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to -+ # investigate it a little bit more. (MM) -+ wlarc='${wl}' -+ -+ # ancient GNU ld didn't support --whole-archive et. al. -+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ -+ grep 'no-whole-archive' > /dev/null; then -+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ else -+ whole_archive_flag_spec_CXX= -+ fi -+ else -+ with_gnu_ld=no -+ wlarc= -+ -+ # A generic and very simple default shared library creation -+ # command for GNU C++ for the case where it uses the native -+ # linker, instead of GNU ld. If possible, this setting should -+ # overridden to take advantage of the native linker features on -+ # the platform it is being used on. -+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' -+ fi -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' -+ -+else -+ GXX=no -+ with_gnu_ld=no -+ wlarc= -+fi -+ -+# PORTME: fill in a description of your system's C++ link characteristics -+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -+ld_shlibs_CXX=yes -+case $host_os in -+ aix3*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ aix4* | aix5*) -+ 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 -+ 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].*|aix5*) -+ for ld_flag in $LDFLAGS; do -+ case $ld_flag in -+ *-brtl*) -+ aix_use_runtimelinking=yes -+ break -+ ;; -+ esac -+ 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_CXX='' -+ hardcode_direct_CXX=yes -+ hardcode_libdir_separator_CXX=':' -+ link_all_deplibs_CXX=yes -+ -+ if test "$GXX" = 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 -+ hardcode_direct_CXX=yes -+ else -+ # We have old collect2 -+ hardcode_direct_CXX=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_CXX=yes -+ hardcode_libdir_flag_spec_CXX='-L$libdir' -+ hardcode_libdir_separator_CXX= -+ 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 -+ -+ # 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_CXX=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_CXX='-berok' -+ # Determine the default libpath from the value encoded in an empty executable. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+ -+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" -+ -+ archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" -+ else -+ if test "$host_cpu" = ia64; then -+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' -+ allow_undefined_flag_CXX="-z nodefs" -+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ else -+ # Determine the default libpath from the value encoded in an empty executable. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+ -+ hardcode_libdir_flag_spec_CXX='${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_CXX=' ${wl}-bernotok' -+ allow_undefined_flag_CXX=' ${wl}-berok' -+ # -bexpall does not export symbols beginning with underscore (_) -+ always_export_symbols_CXX=yes -+ # Exported symbols can be pulled into shared objects from archives -+ whole_archive_flag_spec_CXX=' ' -+ archive_cmds_need_lc_CXX=yes -+ # This is similar to how AIX traditionally builds its shared libraries. -+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' -+ fi -+ fi -+ ;; -+ chorus*) -+ case $cc_basename in -+ *) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ esac -+ ;; -+ -+ -+ cygwin* | mingw* | pw32*) -+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, -+ # as there is no search path for DLLs. -+ hardcode_libdir_flag_spec_CXX='-L$libdir' -+ allow_undefined_flag_CXX=unsupported -+ always_export_symbols_CXX=no -+ enable_shared_with_static_runtimes_CXX=yes -+ -+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then -+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ # If the export-symbols file already is a .def file (1st line -+ # is EXPORTS), use it as is; otherwise, prepend... -+ archive_expsym_cmds_CXX='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ else -+ ld_shlibs_CXX=no -+ fi -+ ;; -+ darwin* | rhapsody*) -+ case $host_os in -+ rhapsody* | darwin1.[012]) -+ allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' -+ ;; -+ *) # Darwin 1.3 on -+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then -+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ else -+ case ${MACOSX_DEPLOYMENT_TARGET} in -+ 10.[012]) -+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ ;; -+ 10.*) -+ allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' -+ ;; -+ esac -+ fi -+ ;; -+ esac -+ archive_cmds_need_lc_CXX=no -+ hardcode_direct_CXX=no -+ hardcode_automatic_CXX=yes -+ hardcode_shlibpath_var_CXX=unsupported -+ whole_archive_flag_spec_CXX='' -+ link_all_deplibs_CXX=yes -+ -+ if test "$GXX" = yes ; then -+ lt_int_apple_cc_single_mod=no -+ output_verbose_link_cmd='echo' -+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then -+ lt_int_apple_cc_single_mod=yes -+ fi -+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then -+ archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ else -+ archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ fi -+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then -+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ fi -+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ case $cc_basename in -+ xlc*) -+ output_verbose_link_cmd='echo' -+ archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' -+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ ;; -+ *) -+ ld_shlibs_CXX=no -+ ;; -+ esac -+ fi -+ ;; -+ -+ dgux*) -+ case $cc_basename in -+ ec++*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ ghcx*) -+ # Green Hills C++ Compiler -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ esac -+ ;; -+ freebsd[12]*) -+ # C++ shared libraries reported to be fairly broken before switch to ELF -+ ld_shlibs_CXX=no -+ ;; -+ freebsd-elf*) -+ archive_cmds_need_lc_CXX=no -+ ;; -+ freebsd* | kfreebsd*-gnu | dragonfly*) -+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF -+ # conventions -+ ld_shlibs_CXX=yes -+ ;; -+ gnu*) -+ ;; -+ hpux9*) -+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator_CXX=: -+ export_dynamic_flag_spec_CXX='${wl}-E' -+ hardcode_direct_CXX=yes -+ hardcode_minus_L_CXX=yes # Not in the search PATH, -+ # but as the default -+ # location of the library. -+ -+ case $cc_basename in -+ CC*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ aCC*) -+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes; then -+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' -+ else -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ fi -+ ;; -+ esac -+ ;; -+ hpux10*|hpux11*) -+ if test $with_gnu_ld = no; then -+ case $host_cpu in -+ hppa*64*) -+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' -+ hardcode_libdir_flag_spec_ld_CXX='+b $libdir' -+ hardcode_libdir_separator_CXX=: -+ ;; -+ ia64*) -+ hardcode_libdir_flag_spec_CXX='-L$libdir' -+ ;; -+ *) -+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator_CXX=: -+ export_dynamic_flag_spec_CXX='${wl}-E' -+ ;; -+ esac -+ fi -+ case $host_cpu in -+ hppa*64*) -+ hardcode_direct_CXX=no -+ hardcode_shlibpath_var_CXX=no -+ ;; -+ ia64*) -+ hardcode_direct_CXX=no -+ hardcode_shlibpath_var_CXX=no -+ hardcode_minus_L_CXX=yes # Not in the search PATH, -+ # but as the default -+ # location of the library. -+ ;; -+ *) -+ hardcode_direct_CXX=yes -+ hardcode_minus_L_CXX=yes # Not in the search PATH, -+ # but as the default -+ # location of the library. -+ ;; -+ esac -+ -+ case $cc_basename in -+ CC*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ aCC*) -+ case $host_cpu in -+ hppa*64*|ia64*) -+ archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' -+ ;; -+ *) -+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' -+ ;; -+ esac -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes; then -+ if test $with_gnu_ld = no; then -+ case $host_cpu in -+ ia64*|hppa*64*) -+ archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' -+ ;; -+ *) -+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' -+ ;; -+ esac -+ fi -+ else -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ fi -+ ;; -+ esac -+ ;; -+ irix5* | irix6*) -+ case $cc_basename in -+ CC*) -+ # SGI C++ -+ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ -+ # Archives containing C++ object files must be created using -+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is -+ # necessary to make sure instantiated templates are included -+ # in the archive. -+ old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' -+ ;; -+ *) -+ if test "$GXX" = yes; then -+ if test "$with_gnu_ld" = no; then -+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' -+ fi -+ fi -+ link_all_deplibs_CXX=yes -+ ;; -+ esac -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_CXX=: -+ ;; -+ linux*) -+ case $cc_basename in -+ KCC*) -+ # Kuck and Associates, Inc. (KAI) C++ Compiler -+ -+ # KCC will only create a shared library if the output file -+ # ends with ".so" (or ".sl" for HP-UX), so rename the library -+ # to its proper name (with version) after linking. -+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' -+ archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' -+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic' -+ -+ # Archives containing C++ object files must be created using -+ # "CC -Bstatic", where "CC" is the KAI C++ compiler. -+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' -+ ;; -+ icpc*) -+ # Intel C++ -+ with_gnu_ld=yes -+ # version 8.0 and above of icpc choke on multiply defined symbols -+ # if we add $predep_objects and $postdep_objects, however 7.1 and -+ # earlier do not add the objects themselves. -+ case `$CC -V 2>&1` in -+ *"Version 7."*) -+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ ;; -+ *) # Version 8.0 or newer -+ tmp_idyn= -+ case $host_cpu in -+ ia64*) tmp_idyn=' -i_dynamic';; -+ esac -+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ ;; -+ esac -+ archive_cmds_need_lc_CXX=no -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' -+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic' -+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' -+ ;; -+ pgCC*) -+ # Portland Group C++ compiler -+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' -+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' -+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic' -+ whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' -+ ;; -+ cxx*) -+ # Compaq C++ -+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' -+ -+ runpath_var=LD_RUN_PATH -+ hardcode_libdir_flag_spec_CXX='-rpath $libdir' -+ hardcode_libdir_separator_CXX=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ esac -+ ;; -+ lynxos*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ m88k*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ mvs*) -+ case $cc_basename in -+ cxx*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ esac -+ ;; -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' -+ wlarc= -+ hardcode_libdir_flag_spec_CXX='-R$libdir' -+ hardcode_direct_CXX=yes -+ hardcode_shlibpath_var_CXX=no -+ fi -+ # Workaround some broken pre-1.5 toolchains -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' -+ ;; -+ openbsd2*) -+ # C++ shared libraries are fairly broken -+ ld_shlibs_CXX=no -+ ;; -+ openbsd*) -+ hardcode_direct_CXX=yes -+ hardcode_shlibpath_var_CXX=no -+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' -+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then -+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' -+ export_dynamic_flag_spec_CXX='${wl}-E' -+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ fi -+ output_verbose_link_cmd='echo' -+ ;; -+ osf3*) -+ case $cc_basename in -+ KCC*) -+ # Kuck and Associates, Inc. (KAI) C++ Compiler -+ -+ # KCC will only create a shared library if the output file -+ # ends with ".so" (or ".sl" for HP-UX), so rename the library -+ # to its proper name (with version) after linking. -+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' -+ hardcode_libdir_separator_CXX=: -+ -+ # Archives containing C++ object files must be created using -+ # "CC -Bstatic", where "CC" is the KAI C++ compiler. -+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' -+ -+ ;; -+ RCC*) -+ # Rational C++ 2.4.1 -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ cxx*) -+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_CXX=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then -+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_CXX=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' -+ -+ else -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ fi -+ ;; -+ esac -+ ;; -+ osf4* | osf5*) -+ case $cc_basename in -+ KCC*) -+ # Kuck and Associates, Inc. (KAI) C++ Compiler -+ -+ # KCC will only create a shared library if the output file -+ # ends with ".so" (or ".sl" for HP-UX), so rename the library -+ # to its proper name (with version) after linking. -+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' -+ hardcode_libdir_separator_CXX=: -+ -+ # Archives containing C++ object files must be created using -+ # the KAI C++ compiler. -+ old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' -+ ;; -+ RCC*) -+ # Rational C++ 2.4.1 -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ cxx*) -+ allow_undefined_flag_CXX=' -expect_unresolved \*' -+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ -+ echo "-hidden">> $lib.exp~ -+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ -+ $rm $lib.exp' -+ -+ hardcode_libdir_flag_spec_CXX='-rpath $libdir' -+ hardcode_libdir_separator_CXX=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ # -+ # There doesn't appear to be a way to prevent this compiler from -+ # explicitly linking system object files so we need to strip them -+ # from the output so that they don't get included in the library -+ # dependencies. -+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' -+ ;; -+ *) -+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then -+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ -+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_CXX=: -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' -+ -+ else -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ fi -+ ;; -+ esac -+ ;; -+ psos*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ sco*) -+ archive_cmds_need_lc_CXX=no -+ case $cc_basename in -+ CC*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ esac -+ ;; -+ sunos4*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.x -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ lcc*) -+ # Lucid -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ esac -+ ;; -+ solaris*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.2, 5.x and Centerline C++ -+ archive_cmds_need_lc_CXX=yes -+ no_undefined_flag_CXX=' -zdefs' -+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' -+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' -+ -+ hardcode_libdir_flag_spec_CXX='-R$libdir' -+ hardcode_shlibpath_var_CXX=no -+ case $host_os in -+ solaris2.[0-5] | solaris2.[0-5].*) ;; -+ *) -+ # The C++ compiler is used as linker so we must use $wl -+ # flag to pass the commands to the underlying system -+ # linker. We must also pass each convience library through -+ # to the system linker between allextract/defaultextract. -+ # The C++ compiler will combine linker options so we -+ # cannot just pass the convience library names through -+ # without $wl. -+ # Supported since Solaris 2.6 (maybe 2.5.1?) -+ whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' -+ ;; -+ esac -+ link_all_deplibs_CXX=yes -+ -+ output_verbose_link_cmd='echo' -+ -+ # Archives containing C++ object files must be created using -+ # "CC -xar", where "CC" is the Sun C++ compiler. This is -+ # necessary to make sure instantiated templates are included -+ # in the archive. -+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' -+ ;; -+ gcx*) -+ # Green Hills C++ Compiler -+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' -+ -+ # The C++ compiler must be used to create the archive. -+ old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' -+ ;; -+ *) -+ # GNU C++ compiler with Solaris linker -+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then -+ no_undefined_flag_CXX=' ${wl}-z ${wl}defs' -+ if $CC --version | grep -v '^2\.7' > /dev/null; then -+ archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' -+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" -+ else -+ # g++ 2.7 appears to require `-G' NOT `-shared' on this -+ # platform. -+ archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' -+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' -+ -+ # Commands to make compiler produce verbose output that lists -+ # what "hidden" libraries, object files and flags are used when -+ # linking a shared library. -+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" -+ fi -+ -+ hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' -+ fi -+ ;; -+ esac -+ ;; -+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) -+ archive_cmds_need_lc_CXX=no -+ ;; -+ tandem*) -+ case $cc_basename in -+ NCC*) -+ # NonStop-UX NCC 3.20 -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ esac -+ ;; -+ vxworks*) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+ *) -+ # FIXME: insert proper C++ library support -+ ld_shlibs_CXX=no -+ ;; -+esac -+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -+echo "${ECHO_T}$ld_shlibs_CXX" >&6 -+test "$ld_shlibs_CXX" = no && can_build_shared=no -+ -+GCC_CXX="$GXX" -+LD_CXX="$LD" -+ -+ -+cat > conftest.$ac_ext <&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ # Parse the compiler output and extract the necessary -+ # objects, libraries and library flags. -+ -+ # Sentinel used to keep track of whether or not we are before -+ # the conftest object file. -+ pre_test_object_deps_done=no -+ -+ # The `*' in the case matches for architectures that use `case' in -+ # $output_verbose_cmd can trigger glob expansion during the loop -+ # eval without this substitution. -+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` -+ -+ for p in `eval $output_verbose_link_cmd`; do -+ case $p in -+ -+ -L* | -R* | -l*) -+ # Some compilers place space between "-{L,R}" and the path. -+ # Remove the space. -+ if test $p = "-L" \ -+ || test $p = "-R"; then -+ prev=$p -+ continue -+ else -+ prev= -+ fi -+ -+ if test "$pre_test_object_deps_done" = no; then -+ case $p in -+ -L* | -R*) -+ # Internal compiler library paths should come after those -+ # provided the user. The postdeps already come after the -+ # user supplied libs so there is no need to process them. -+ if test -z "$compiler_lib_search_path_CXX"; then -+ compiler_lib_search_path_CXX="${prev}${p}" -+ else -+ compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" -+ fi -+ ;; -+ # The "-l" case would never come before the object being -+ # linked, so don't bother handling this case. -+ esac -+ else -+ if test -z "$postdeps_CXX"; then -+ postdeps_CXX="${prev}${p}" -+ else -+ postdeps_CXX="${postdeps_CXX} ${prev}${p}" -+ fi -+ fi -+ ;; -+ -+ *.$objext) -+ # This assumes that the test object file only shows up -+ # once in the compiler output. -+ if test "$p" = "conftest.$objext"; then -+ pre_test_object_deps_done=yes -+ continue -+ fi -+ -+ if test "$pre_test_object_deps_done" = no; then -+ if test -z "$predep_objects_CXX"; then -+ predep_objects_CXX="$p" -+ else -+ predep_objects_CXX="$predep_objects_CXX $p" -+ fi -+ else -+ if test -z "$postdep_objects_CXX"; then -+ postdep_objects_CXX="$p" -+ else -+ postdep_objects_CXX="$postdep_objects_CXX $p" -+ fi -+ fi -+ ;; -+ -+ *) ;; # Ignore the rest. -+ -+ esac -+ done -+ -+ # Clean up. -+ rm -f a.out a.exe -+else -+ echo "libtool.m4: error: problem compiling CXX test program" -+fi -+ -+$rm -f confest.$objext -+ -+# PORTME: override above test on systems where it is broken -+case $host_os in -+solaris*) -+ case $cc_basename in -+ CC*) -+ # Adding this requires a known-good setup of shared libraries for -+ # Sun compiler versions before 5.6, else PIC objects from an old -+ # archive will be linked into the output, leading to subtle bugs. -+ postdeps_CXX='-lCstd -lCrun' -+ ;; -+ esac -+esac -+ -+ -+case " $postdeps_CXX " in -+*" -lc "*) archive_cmds_need_lc_CXX=no ;; -+esac -+ -+lt_prog_compiler_wl_CXX= -+lt_prog_compiler_pic_CXX= -+lt_prog_compiler_static_CXX= -+ -+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -+ -+ # C++ specific cases for pic, static, wl, etc. -+ if test "$GXX" = yes; then -+ lt_prog_compiler_wl_CXX='-Wl,' -+ lt_prog_compiler_static_CXX='-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_CXX='-Bstatic' -+ fi -+ ;; -+ amigaos*) -+ # FIXME: we need at least 68020 code to build shared libraries, but -+ # adding the `-m68020' flag to GCC prevents building anything better, -+ # like `-m68040'. -+ lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' -+ ;; -+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) -+ # PIC is the default for these OSes. -+ ;; -+ mingw* | os2* | pw32*) -+ # 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_CXX='-DDLL_EXPORT' -+ ;; -+ darwin* | rhapsody*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ lt_prog_compiler_pic_CXX='-fno-common' -+ ;; -+ *djgpp*) -+ # DJGPP does not support shared libraries at all -+ lt_prog_compiler_pic_CXX= -+ ;; -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ lt_prog_compiler_pic_CXX=-Kconform_pic -+ fi -+ ;; -+ hpux*) -+ # 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*) -+ ;; -+ *) -+ lt_prog_compiler_pic_CXX='-fPIC' -+ ;; -+ esac -+ ;; -+ *) -+ lt_prog_compiler_pic_CXX='-fPIC' -+ ;; -+ esac -+ else -+ case $host_os in -+ aix4* | aix5*) -+ # All AIX code is PIC. -+ if test "$host_cpu" = ia64; then -+ # AIX 5 now supports IA64 processor -+ lt_prog_compiler_static_CXX='-Bstatic' -+ else -+ lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' -+ fi -+ ;; -+ chorus*) -+ case $cc_basename in -+ cxch68*) -+ # Green Hills C++ Compiler -+ # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" -+ ;; -+ esac -+ ;; -+ darwin*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ case $cc_basename in -+ xlc*) -+ lt_prog_compiler_pic_CXX='-qnocommon' -+ lt_prog_compiler_wl_CXX='-Wl,' -+ ;; -+ esac -+ ;; -+ dgux*) -+ case $cc_basename in -+ ec++*) -+ lt_prog_compiler_pic_CXX='-KPIC' -+ ;; -+ ghcx*) -+ # Green Hills C++ Compiler -+ lt_prog_compiler_pic_CXX='-pic' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ freebsd* | kfreebsd*-gnu | dragonfly*) -+ # FreeBSD uses GNU C++ -+ ;; -+ hpux9* | hpux10* | hpux11*) -+ case $cc_basename in -+ CC*) -+ lt_prog_compiler_wl_CXX='-Wl,' -+ lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" -+ if test "$host_cpu" != ia64; then -+ lt_prog_compiler_pic_CXX='+Z' -+ fi -+ ;; -+ aCC*) -+ lt_prog_compiler_wl_CXX='-Wl,' -+ lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" -+ case $host_cpu in -+ hppa*64*|ia64*) -+ # +Z the default -+ ;; -+ *) -+ lt_prog_compiler_pic_CXX='+Z' -+ ;; -+ esac -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ irix5* | irix6* | nonstopux*) -+ case $cc_basename in -+ CC*) -+ lt_prog_compiler_wl_CXX='-Wl,' -+ lt_prog_compiler_static_CXX='-non_shared' -+ # CC pic flag -KPIC is the default. -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ linux*) -+ case $cc_basename in -+ KCC*) -+ # KAI C++ Compiler -+ lt_prog_compiler_wl_CXX='--backend -Wl,' -+ lt_prog_compiler_pic_CXX='-fPIC' -+ ;; -+ icpc* | ecpc*) -+ # Intel C++ -+ lt_prog_compiler_wl_CXX='-Wl,' -+ lt_prog_compiler_pic_CXX='-KPIC' -+ lt_prog_compiler_static_CXX='-static' -+ ;; -+ pgCC*) -+ # Portland Group C++ compiler. -+ lt_prog_compiler_wl_CXX='-Wl,' -+ lt_prog_compiler_pic_CXX='-fpic' -+ lt_prog_compiler_static_CXX='-Bstatic' -+ ;; -+ cxx*) -+ # Compaq C++ -+ # Make sure the PIC flag is empty. It appears that all Alpha -+ # Linux and Compaq Tru64 Unix objects are PIC. -+ lt_prog_compiler_pic_CXX= -+ lt_prog_compiler_static_CXX='-non_shared' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ lynxos*) -+ ;; -+ m88k*) -+ ;; -+ mvs*) -+ case $cc_basename in -+ cxx*) -+ lt_prog_compiler_pic_CXX='-W c,exportall' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ ;; -+ osf3* | osf4* | osf5*) -+ case $cc_basename in -+ KCC*) -+ lt_prog_compiler_wl_CXX='--backend -Wl,' -+ ;; -+ RCC*) -+ # Rational C++ 2.4.1 -+ lt_prog_compiler_pic_CXX='-pic' -+ ;; -+ cxx*) -+ # Digital/Compaq C++ -+ lt_prog_compiler_wl_CXX='-Wl,' -+ # Make sure the PIC flag is empty. It appears that all Alpha -+ # Linux and Compaq Tru64 Unix objects are PIC. -+ lt_prog_compiler_pic_CXX= -+ lt_prog_compiler_static_CXX='-non_shared' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ psos*) -+ ;; -+ sco*) -+ case $cc_basename in -+ CC*) -+ lt_prog_compiler_pic_CXX='-fPIC' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ solaris*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.2, 5.x and Centerline C++ -+ lt_prog_compiler_pic_CXX='-KPIC' -+ lt_prog_compiler_static_CXX='-Bstatic' -+ lt_prog_compiler_wl_CXX='-Qoption ld ' -+ ;; -+ gcx*) -+ # Green Hills C++ Compiler -+ lt_prog_compiler_pic_CXX='-PIC' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ sunos4*) -+ case $cc_basename in -+ CC*) -+ # Sun C++ 4.x -+ lt_prog_compiler_pic_CXX='-pic' -+ lt_prog_compiler_static_CXX='-Bstatic' -+ ;; -+ lcc*) -+ # Lucid -+ lt_prog_compiler_pic_CXX='-pic' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ tandem*) -+ case $cc_basename in -+ NCC*) -+ # NonStop-UX NCC 3.20 -+ lt_prog_compiler_pic_CXX='-KPIC' -+ ;; -+ *) -+ ;; -+ esac -+ ;; -+ unixware*) -+ ;; -+ vxworks*) -+ ;; -+ *) -+ lt_prog_compiler_can_build_shared_CXX=no -+ ;; -+ esac -+ fi -+ -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 -+ -+# -+# Check to make sure the PIC flag actually works. -+# -+if test -n "$lt_prog_compiler_pic_CXX"; then -+ -+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 -+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_prog_compiler_pic_works_CXX=no -+ ac_outfile=conftest.$ac_objext -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ lt_compiler_flag="$lt_prog_compiler_pic_CXX -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:11334: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>conftest.err) -+ ac_status=$? -+ cat conftest.err >&5 -+ echo "$as_me:11338: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then -+ lt_prog_compiler_pic_works_CXX=yes -+ fi -+ fi -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 -+ -+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then -+ case $lt_prog_compiler_pic_CXX in -+ "" | " "*) ;; -+ *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; -+ esac -+else -+ lt_prog_compiler_pic_CXX= -+ lt_prog_compiler_can_build_shared_CXX=no -+fi -+ -+fi -+case $host_os in -+ # For platforms which do not support PIC, -DPIC is meaningless: -+ *djgpp*) -+ lt_prog_compiler_pic_CXX= -+ ;; -+ *) -+ lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" -+ ;; -+esac -+ -+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_cv_prog_compiler_c_o_CXX=no -+ $rm -r conftest 2>/dev/null -+ mkdir conftest -+ cd conftest -+ mkdir out -+ printf "$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:11396: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>out/conftest.err) -+ ac_status=$? -+ cat out/conftest.err >&5 -+ echo "$as_me:11400: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp -+ $SED '/^$/d' out/conftest.err >out/conftest.er2 -+ if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then -+ lt_cv_prog_compiler_c_o_CXX=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 .. -+ rmdir conftest -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 -+ -+ -+hard_links="nottested" -+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then -+ # do not overwrite the value of need_locks provided by the user -+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 -+ hard_links=yes -+ $rm conftest* -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ touch conftest.a -+ ln conftest.a conftest.b 2>&5 || hard_links=no -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ echo "$as_me:$LINENO: result: $hard_links" >&5 -+echo "${ECHO_T}$hard_links" >&6 -+ if test "$hard_links" = no; then -+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -+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 -+ -+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -+ -+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ case $host_os in -+ aix4* | aix5*) -+ # 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 -+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then -+ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' -+ else -+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' -+ fi -+ ;; -+ pw32*) -+ export_symbols_cmds_CXX="$ltdll_cmds" -+ ;; -+ cygwin* | mingw*) -+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' -+ ;; -+ linux*) -+ link_all_deplibs_CXX=no -+ ;; -+ *) -+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ ;; -+ esac -+ -+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -+echo "${ECHO_T}$ld_shlibs_CXX" >&6 -+test "$ld_shlibs_CXX" = 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 -+ -+# -+# Do we need to explicitly link libc? -+# -+case "x$archive_cmds_need_lc_CXX" in -+x|xyes) -+ # Assume -lc should be added -+ archive_cmds_need_lc_CXX=yes -+ -+ if test "$enable_shared" = yes && test "$GCC" = yes; then -+ case $archive_cmds_CXX 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. -+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 -+ $rm conftest* -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ -+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } 2>conftest.err; then -+ soname=conftest -+ lib=conftest -+ libobjs=conftest.$ac_objext -+ deplibs= -+ wl=$lt_prog_compiler_wl_CXX -+ compiler_flags=-v -+ linker_flags=-v -+ verstring= -+ output_objdir=. -+ libname=conftest -+ lt_save_allow_undefined_flag=$allow_undefined_flag_CXX -+ allow_undefined_flag_CXX= -+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 -+ (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ then -+ archive_cmds_need_lc_CXX=no -+ else -+ archive_cmds_need_lc_CXX=yes -+ fi -+ allow_undefined_flag_CXX=$lt_save_allow_undefined_flag -+ else -+ cat conftest.err 1>&5 -+ fi -+ $rm conftest* -+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 -+ ;; -+ esac -+ fi -+ ;; -+esac -+ -+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -+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" -+if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then -+ # 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. -+ 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 -+else -+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -+fi -+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' -+ ;; -+ -+aix4* | aix5*) -+ 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*) -+ library_names_spec='$libname.ixlibrary $libname.a' -+ # Create ${libname}_ixlibrary.a entries in /sys/libs. -+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' -+ ;; -+ -+beos*) -+ library_names_spec='${libname}${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*) -+ version_type=windows -+ shrext_cmds=".dll" -+ need_version=no -+ need_lib_prefix=no -+ -+ case $GCC,$host_os in -+ yes,cygwin* | yes,mingw* | yes,pw32*) -+ 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' -+ 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="/usr/lib /lib/w32api /lib /usr/local/lib" -+ ;; -+ mingw*) -+ # MinGW DLLs use traditional 'lib' prefix -+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then -+ # It is most probably a Windows format PATH printed by -+ # mingw gcc, but we are running on Cygwin. Gcc prints its search -+ # path with ; separators, and with drive letters. We can handle the -+ # drive letters (cygwin fileutils understands them), so leave them, -+ # especially as we might pass files found there to a mingw objdump, -+ # which wouldn't understand a cygwinified path. Ahh. -+ 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 -+ ;; -+ 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 -+ ;; -+ -+ *) -+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' -+ ;; -+ esac -+ dynamic_linker='Win32 ld.exe' -+ # 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}${versuffix}$shared_ext ${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`' -+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. -+ if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` -+ else -+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' -+ fi -+ 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 -+ ;; -+ -+kfreebsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU ld.so' -+ ;; -+ -+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 -+ ;; -+ *) # from 3.2 on -+ shlibpath_overrides_runpath=no -+ 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 -+ ;; -+ -+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' -+ ;; -+ -+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*) -+ 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 -+ # 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)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' -+ ;; -+ -+netbsdelf*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='NetBSD ld.elf_so' -+ ;; -+ -+knetbsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU 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=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 -+ ;; -+ -+openbsd*) -+ version_type=sunos -+ 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" -+ ;; -+ -+sco3.2v5*) -+ version_type=osf -+ 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 -+ ;; -+ -+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.2uw2* | sysv4.3* | sysv5*) -+ 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 -+ export_dynamic_flag_spec='${wl}-Blargedynsym' -+ 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 -+ ;; -+ -+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 -+echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -+echo "${ECHO_T}$dynamic_linker" >&6 -+test "$dynamic_linker" = no && can_build_shared=no -+ -+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -+hardcode_action_CXX= -+if test -n "$hardcode_libdir_flag_spec_CXX" || \ -+ test -n "$runpath_var_CXX" || \ -+ test "X$hardcode_automatic_CXX" = "Xyes" ; then -+ -+ # We can hardcode non-existant directories. -+ if test "$hardcode_direct_CXX" != 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_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && -+ test "$hardcode_minus_L_CXX" != no; then -+ # Linking always hardcodes the temporary library directory. -+ hardcode_action_CXX=relink -+ else -+ # We can link without hardcoding, and we can hardcode nonexisting dirs. -+ hardcode_action_CXX=immediate -+ fi -+else -+ # We cannot hardcode anything, or else we can only hardcode existing -+ # directories. -+ hardcode_action_CXX=unsupported -+fi -+echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -+echo "${ECHO_T}$hardcode_action_CXX" >&6 -+ -+if test "$hardcode_action_CXX" = relink; then -+ # Fast installation is not supported -+ enable_fast_install=no -+elif test "$shlibpath_overrides_runpath" = yes || -+ test "$enable_shared" = no; then -+ # Fast installation is not necessary -+ enable_fast_install=needless -+fi -+ -+striplib= -+old_striplib= -+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ ;; -+ *) -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ ;; -+ esac -+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*) -+ 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 -+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -+if test "${ac_cv_lib_dl_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldl $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dl_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dl_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -+if test $ac_cv_lib_dl_dlopen = yes; 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 -+ -+ ;; -+ -+ *) -+ echo "$as_me:$LINENO: checking for shl_load" >&5 -+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -+if test "${ac_cv_func_shl_load+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define shl_load to an innocuous variant, in case declares shl_load. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define shl_load innocuous_shl_load -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char shl_load (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef shl_load -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char shl_load (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_shl_load) || defined (__stub___shl_load) -+choke me -+#else -+char (*f) () = shl_load; -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+int -+main () -+{ -+return f != shl_load; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_shl_load=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_func_shl_load=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -+echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -+if test $ac_cv_func_shl_load = yes; then -+ lt_cv_dlopen="shl_load" -+else -+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -+if test "${ac_cv_lib_dld_shl_load+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char shl_load (); -+int -+main () -+{ -+shl_load (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dld_shl_load=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dld_shl_load=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -+if test $ac_cv_lib_dld_shl_load = yes; then -+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -+else -+ echo "$as_me:$LINENO: checking for dlopen" >&5 -+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -+if test "${ac_cv_func_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define dlopen to an innocuous variant, in case declares dlopen. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define dlopen innocuous_dlopen -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char dlopen (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef dlopen -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_dlopen) || defined (__stub___dlopen) -+choke me -+#else -+char (*f) () = dlopen; -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+int -+main () -+{ -+return f != dlopen; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_func_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -+if test $ac_cv_func_dlopen = yes; then -+ lt_cv_dlopen="dlopen" -+else -+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -+if test "${ac_cv_lib_dl_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldl $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dl_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dl_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -+if test $ac_cv_lib_dl_dlopen = yes; then -+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -+else -+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -+if test "${ac_cv_lib_svld_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lsvld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_svld_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_svld_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -+if test $ac_cv_lib_svld_dlopen = yes; then -+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -+else -+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -+if test "${ac_cv_lib_dld_dld_link+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dld_link (); -+int -+main () -+{ -+dld_link (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dld_dld_link=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dld_dld_link=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -+if test $ac_cv_lib_dld_dld_link = yes; then -+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -+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" -+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -+ -+ save_LIBS="$LIBS" -+ LIBS="$lt_cv_dlopen_libs $LIBS" -+ -+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -+if test "${lt_cv_dlopen_self+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 < -+#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 -+ -+#ifdef __cplusplus -+extern "C" void exit (int); -+#endif -+ -+void fnord() { int i=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; -+ /* dlclose (self); */ -+ } -+ -+ exit (status); -+} -+EOF -+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && 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_unknown|x*) lt_cv_dlopen_self=no ;; -+ esac -+ else : -+ # compilation failed -+ lt_cv_dlopen_self=no -+ fi -+fi -+rm -fr conftest* -+ -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -+echo "${ECHO_T}$lt_cv_dlopen_self" >&6 -+ -+ if test "x$lt_cv_dlopen_self" = xyes; then -+ LDFLAGS="$LDFLAGS $link_static_flag" -+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -+if test "${lt_cv_dlopen_self_static+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 < -+#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 -+ -+#ifdef __cplusplus -+extern "C" void exit (int); -+#endif -+ -+void fnord() { int i=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; -+ /* dlclose (self); */ -+ } -+ -+ exit (status); -+} -+EOF -+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && 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_unknown|x*) lt_cv_dlopen_self_static=no ;; -+ esac -+ else : -+ # compilation failed -+ lt_cv_dlopen_self_static=no -+ fi -+fi -+rm -fr conftest* -+ -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -+echo "${ECHO_T}$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 -+ -+ -+# The else clause should only fire when bootstrapping the -+# libtool distribution, otherwise you forgot to ship ltmain.sh -+# with your package, and you will get complaints that there are -+# no rules to generate ltmain.sh. -+if test -f "$ltmain"; then -+ # 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 -+ # Now quote all the things that may contain metacharacters while being -+ # careful not to overquote the AC_SUBSTed values. We take copies of the -+ # variables and quote the copies for generation of the libtool script. -+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ -+ SED SHELL STRIP \ -+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ -+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ -+ deplibs_check_method reload_flag reload_cmds need_locks \ -+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ -+ lt_cv_sys_global_symbol_to_c_name_address \ -+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -+ old_postinstall_cmds old_postuninstall_cmds \ -+ compiler_CXX \ -+ CC_CXX \ -+ LD_CXX \ -+ lt_prog_compiler_wl_CXX \ -+ lt_prog_compiler_pic_CXX \ -+ lt_prog_compiler_static_CXX \ -+ lt_prog_compiler_no_builtin_flag_CXX \ -+ export_dynamic_flag_spec_CXX \ -+ thread_safe_flag_spec_CXX \ -+ whole_archive_flag_spec_CXX \ -+ enable_shared_with_static_runtimes_CXX \ -+ old_archive_cmds_CXX \ -+ old_archive_from_new_cmds_CXX \ -+ predep_objects_CXX \ -+ postdep_objects_CXX \ -+ predeps_CXX \ -+ postdeps_CXX \ -+ compiler_lib_search_path_CXX \ -+ archive_cmds_CXX \ -+ archive_expsym_cmds_CXX \ -+ postinstall_cmds_CXX \ -+ postuninstall_cmds_CXX \ -+ old_archive_from_expsyms_cmds_CXX \ -+ allow_undefined_flag_CXX \ -+ no_undefined_flag_CXX \ -+ export_symbols_cmds_CXX \ -+ hardcode_libdir_flag_spec_CXX \ -+ hardcode_libdir_flag_spec_ld_CXX \ -+ hardcode_libdir_separator_CXX \ -+ hardcode_automatic_CXX \ -+ module_cmds_CXX \ -+ module_expsym_cmds_CXX \ -+ lt_cv_prog_compiler_c_o_CXX \ -+ exclude_expsyms_CXX \ -+ include_expsyms_CXX; do -+ -+ case $var in -+ old_archive_cmds_CXX | \ -+ old_archive_from_new_cmds_CXX | \ -+ archive_cmds_CXX | \ -+ archive_expsym_cmds_CXX | \ -+ module_cmds_CXX | \ -+ module_expsym_cmds_CXX | \ -+ old_archive_from_expsyms_cmds_CXX | \ -+ export_symbols_cmds_CXX | \ -+ extract_expsyms_cmds | reload_cmds | finish_cmds | \ -+ postinstall_cmds | postuninstall_cmds | \ -+ old_postinstall_cmds | old_postuninstall_cmds | \ -+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) -+ # Double-quote double-evaled strings. -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" -+ ;; -+ *) -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -+ ;; -+ esac -+ done -+ -+ case $lt_echo in -+ *'\$0 --fallback-echo"') -+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` -+ ;; -+ esac -+ -+cfgfile="$ofile" -+ -+ cat <<__EOF__ >> "$cfgfile" -+# ### BEGIN LIBTOOL TAG CONFIG: $tagname -+ -+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -+ -+# Shell to use when invoking shell scripts. -+SHELL=$lt_SHELL -+ -+# Whether or not to build shared libraries. -+build_libtool_libs=$enable_shared -+ -+# Whether or not to build static libraries. -+build_old_libs=$enable_static -+ -+# Whether or not to add -lc for building shared libraries. -+build_libtool_need_lc=$archive_cmds_need_lc_CXX -+ -+# Whether or not to disallow shared libs when runtime libs are static -+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX -+ -+# Whether or not to optimize for fast installation. -+fast_install=$enable_fast_install -+ -+# 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 -+ -+# An echo program that does not interpret backslashes. -+echo=$lt_echo -+ -+# The archiver. -+AR=$lt_AR -+AR_FLAGS=$lt_AR_FLAGS -+ -+# A C compiler. -+LTCC=$lt_LTCC -+ -+# A language-specific compiler. -+CC=$lt_compiler_CXX -+ -+# Is the compiler the GNU C compiler? -+with_gcc=$GCC_CXX -+ -+# An ERE matcher. -+EGREP=$lt_EGREP -+ -+# The linker used to build libraries. -+LD=$lt_LD_CXX -+ -+# Whether we need hard or soft links. -+LN_S=$lt_LN_S -+ -+# A BSD-compatible nm program. -+NM=$lt_NM -+ -+# A symbol stripping program -+STRIP=$lt_STRIP -+ -+# Used to examine libraries when file_magic_cmd begins "file" -+MAGIC_CMD=$MAGIC_CMD -+ -+# Used on cygwin: DLL creation program. -+DLLTOOL="$DLLTOOL" -+ -+# Used on cygwin: object dumper. -+OBJDUMP="$OBJDUMP" -+ -+# Used on cygwin: assembler. -+AS="$AS" -+ -+# The name of the directory that contains temporary libtool files. -+objdir=$objdir -+ -+# How to create reloadable object files. -+reload_flag=$lt_reload_flag -+reload_cmds=$lt_reload_cmds -+ -+# How to pass a linker flag through the compiler. -+wl=$lt_lt_prog_compiler_wl_CXX -+ -+# Object file suffix (normally "o"). -+objext="$ac_objext" -+ -+# Old archive suffix (normally "a"). -+libext="$libext" -+ -+# Shared library suffix (normally ".so"). -+shrext_cmds='$shrext_cmds' -+ -+# Executable file suffix (normally ""). -+exeext="$exeext" -+ -+# Additional compiler flags for building library objects. -+pic_flag=$lt_lt_prog_compiler_pic_CXX -+pic_mode=$pic_mode -+ -+# What is the maximum length of a command? -+max_cmd_len=$lt_cv_sys_max_cmd_len -+ -+# Does compiler simultaneously support -c and -o options? -+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX -+ -+# Must we lock files when doing compilation? -+need_locks=$lt_need_locks -+ -+# Do we need the lib prefix for modules? -+need_lib_prefix=$need_lib_prefix -+ -+# Do we need a version for libraries? -+need_version=$need_version -+ -+# Whether dlopen is supported. -+dlopen_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 -+ -+# Compiler flag to prevent dynamic linking. -+link_static_flag=$lt_lt_prog_compiler_static_CXX -+ -+# Compiler flag to turn off builtin functions. -+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX -+ -+# Compiler flag to allow reflexive dlopens. -+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX -+ -+# Compiler flag to generate shared objects directly from archives. -+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX -+ -+# Compiler flag to generate thread-safe objects. -+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX -+ -+# Library versioning type. -+version_type=$version_type -+ -+# 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 -+ -+# Commands used to build and install an old-style archive. -+RANLIB=$lt_RANLIB -+old_archive_cmds=$lt_old_archive_cmds_CXX -+old_postinstall_cmds=$lt_old_postinstall_cmds -+old_postuninstall_cmds=$lt_old_postuninstall_cmds -+ -+# Create an old-style archive from a shared archive. -+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX -+ -+# Create a temporary old-style archive to link instead of a shared archive. -+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX -+ -+# Commands used to build and install a shared archive. -+archive_cmds=$lt_archive_cmds_CXX -+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -+postinstall_cmds=$lt_postinstall_cmds -+postuninstall_cmds=$lt_postuninstall_cmds -+ -+# Commands used to build a loadable module (assumed same as above if empty) -+module_cmds=$lt_module_cmds_CXX -+module_expsym_cmds=$lt_module_expsym_cmds_CXX -+ -+# Commands to strip libraries. -+old_striplib=$lt_old_striplib -+striplib=$lt_striplib -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predep_objects=$lt_predep_objects_CXX -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdep_objects=$lt_postdep_objects_CXX -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predeps=$lt_predeps_CXX -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdeps=$lt_postdeps_CXX -+ -+# The library search path used internally by the compiler when linking -+# a shared library. -+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX -+ -+# 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 -+ -+# Flag that allows shared libraries with undefined symbols to be built. -+allow_undefined_flag=$lt_allow_undefined_flag_CXX -+ -+# Flag that forces no undefined symbols. -+no_undefined_flag=$lt_no_undefined_flag_CXX -+ -+# Commands used to finish a libtool library installation in a directory. -+finish_cmds=$lt_finish_cmds -+ -+# Same as above, but a single script fragment to be evaled but not shown. -+finish_eval=$lt_finish_eval -+ -+# 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 -+ -+# This is the shared library runtime path variable. -+runpath_var=$runpath_var -+ -+# This is the shared library path variable. -+shlibpath_var=$shlibpath_var -+ -+# Is shlibpath searched before the hard-coded library search path? -+shlibpath_overrides_runpath=$shlibpath_overrides_runpath -+ -+# How to hardcode a shared library path into an executable. -+hardcode_action=$hardcode_action_CXX -+ -+# Whether we should hardcode library paths into libraries. -+hardcode_into_libs=$hardcode_into_libs -+ -+# 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_CXX -+ -+# 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_CXX -+ -+# Whether we need a single -rpath flag with a separated argument. -+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX -+ -+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -+# resulting binary. -+hardcode_direct=$hardcode_direct_CXX -+ -+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -+# resulting binary. -+hardcode_minus_L=$hardcode_minus_L_CXX -+ -+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -+# the resulting binary. -+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX -+ -+# 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_CXX -+ -+# Variables whose values should be saved in libtool wrapper scripts and -+# restored at relink time. -+variables_saved_for_relink="$variables_saved_for_relink" -+ -+# Whether libtool must link a program against all its dependency libraries. -+link_all_deplibs=$link_all_deplibs_CXX -+ -+# 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 -+ -+# Fix the shell variable \$srcfile for the compiler. -+fix_srcfile_path="$fix_srcfile_path_CXX" -+ -+# Set to yes if exported symbols are required. -+always_export_symbols=$always_export_symbols_CXX -+ -+# The commands to list exported symbols. -+export_symbols_cmds=$lt_export_symbols_cmds_CXX -+ -+# The commands to extract the exported symbol list from a shared archive. -+extract_expsyms_cmds=$lt_extract_expsyms_cmds -+ -+# Symbols that should not be listed in the preloaded symbols. -+exclude_expsyms=$lt_exclude_expsyms_CXX -+ -+# Symbols that must always be exported. -+include_expsyms=$lt_include_expsyms_CXX -+ -+# ### END LIBTOOL TAG CONFIG: $tagname -+ -+__EOF__ -+ -+ -+else -+ # If there is no Makefile yet, we rely on a make rule to execute -+ # `config.status --recheck' to rerun these tests and create the -+ # libtool script then. -+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` -+ if test -f "$ltmain_in"; then -+ test -f Makefile && make "$ltmain" -+ fi -+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 -+LDCXX=$LD -+LD=$lt_save_LD -+GCC=$lt_save_GCC -+with_gnu_ldcxx=$with_gnu_ld -+with_gnu_ld=$lt_save_with_gnu_ld -+lt_cv_path_LDCXX=$lt_cv_path_LD -+lt_cv_path_LD=$lt_save_path_LD -+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -+ -+ else -+ tagname="" -+ fi -+ ;; -+ -+ F77) -+ if test -n "$F77" && test "X$F77" != "Xno"; then -+ -+ac_ext=f -+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_f77_compiler_gnu -+ -+ -+archive_cmds_need_lc_F77=no -+allow_undefined_flag_F77= -+always_export_symbols_F77=no -+archive_expsym_cmds_F77= -+export_dynamic_flag_spec_F77= -+hardcode_direct_F77=no -+hardcode_libdir_flag_spec_F77= -+hardcode_libdir_flag_spec_ld_F77= -+hardcode_libdir_separator_F77= -+hardcode_minus_L_F77=no -+hardcode_automatic_F77=no -+module_cmds_F77= -+module_expsym_cmds_F77= -+link_all_deplibs_F77=unknown -+old_archive_cmds_F77=$old_archive_cmds -+no_undefined_flag_F77= -+whole_archive_flag_spec_F77= -+enable_shared_with_static_runtimes_F77=no -+ -+# Source file extension for f77 test sources. -+ac_ext=f -+ -+# Object file extension for compiled f77 test sources. -+objext=o -+objext_F77=$objext -+ -+# Code to be used in simple compile tests -+lt_simple_compile_test_code=" subroutine t\n return\n end\n" -+ -+# Code to be used in simple link tests -+lt_simple_link_test_code=" program t\n end\n" -+ -+# ltmain only uses $CC for tagged configurations so make sure $CC is set. -+ -+# If no C compiler was specified, use CC. -+LTCC=${LTCC-"$CC"} -+ -+# Allow CC to be a program name with arguments. -+compiler=$CC -+ -+ -+# save warnings/boilerplate of simple test code -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_compile_test_code" >conftest.$ac_ext -+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_compiler_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_link_test_code" >conftest.$ac_ext -+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_linker_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ -+# Allow CC to be a program name with arguments. -+lt_save_CC="$CC" -+CC=${F77-"f77"} -+compiler=$CC -+compiler_F77=$CC -+for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+ -+echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -+echo "$as_me:$LINENO: result: $can_build_shared" >&5 -+echo "${ECHO_T}$can_build_shared" >&6 -+ -+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -+test "$can_build_shared" = "no" && enable_shared=no -+ -+# On AIX, shared libraries and static libraries use the same namespace, and -+# are all built from PIC. -+case $host_os in -+aix3*) -+ test "$enable_shared" = yes && enable_static=no -+ if test -n "$RANLIB"; then -+ archive_cmds="$archive_cmds~\$RANLIB \$lib" -+ postinstall_cmds='$RANLIB $lib' -+ fi -+ ;; -+aix4* | aix5*) -+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then -+ test "$enable_shared" = yes && enable_static=no -+ fi -+ ;; -+esac -+echo "$as_me:$LINENO: result: $enable_shared" >&5 -+echo "${ECHO_T}$enable_shared" >&6 -+ -+echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -+# Make sure either enable_shared or enable_static is yes. -+test "$enable_shared" = yes || enable_static=yes -+echo "$as_me:$LINENO: result: $enable_static" >&5 -+echo "${ECHO_T}$enable_static" >&6 -+ -+test "$ld_shlibs_F77" = no && can_build_shared=no -+ -+GCC_F77="$G77" -+LD_F77="$LD" -+ -+lt_prog_compiler_wl_F77= -+lt_prog_compiler_pic_F77= -+lt_prog_compiler_static_F77= -+ -+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -+ -+ if test "$GCC" = yes; then -+ lt_prog_compiler_wl_F77='-Wl,' -+ lt_prog_compiler_static_F77='-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_F77='-Bstatic' -+ fi -+ ;; -+ -+ amigaos*) -+ # FIXME: we need at least 68020 code to build shared libraries, but -+ # adding the `-m68020' flag to GCC prevents building anything better, -+ # like `-m68040'. -+ lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' -+ ;; -+ -+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) -+ # PIC is the default for these OSes. -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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_F77='-DDLL_EXPORT' -+ ;; -+ -+ darwin* | rhapsody*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ lt_prog_compiler_pic_F77='-fno-common' -+ ;; -+ -+ 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_F77=no -+ enable_shared=no -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ lt_prog_compiler_pic_F77=-Kconform_pic -+ fi -+ ;; -+ -+ hpux*) -+ # 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_F77='-fPIC' -+ ;; -+ esac -+ ;; -+ -+ *) -+ lt_prog_compiler_pic_F77='-fPIC' -+ ;; -+ esac -+ else -+ # PORTME Check for flag to pass linker flags through the system compiler. -+ case $host_os in -+ aix*) -+ lt_prog_compiler_wl_F77='-Wl,' -+ if test "$host_cpu" = ia64; then -+ # AIX 5 now supports IA64 processor -+ lt_prog_compiler_static_F77='-Bstatic' -+ else -+ lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' -+ fi -+ ;; -+ darwin*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ case $cc_basename in -+ xlc*) -+ lt_prog_compiler_pic_F77='-qnocommon' -+ lt_prog_compiler_wl_F77='-Wl,' -+ ;; -+ esac -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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_F77='-DDLL_EXPORT' -+ ;; -+ -+ hpux9* | hpux10* | hpux11*) -+ lt_prog_compiler_wl_F77='-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_F77='+Z' -+ ;; -+ esac -+ # Is there a better lt_prog_compiler_static that works with the bundled CC? -+ lt_prog_compiler_static_F77='${wl}-a ${wl}archive' -+ ;; -+ -+ irix5* | irix6* | nonstopux*) -+ lt_prog_compiler_wl_F77='-Wl,' -+ # PIC (with -KPIC) is the default. -+ lt_prog_compiler_static_F77='-non_shared' -+ ;; -+ -+ newsos6) -+ lt_prog_compiler_pic_F77='-KPIC' -+ lt_prog_compiler_static_F77='-Bstatic' -+ ;; -+ -+ linux*) -+ case $cc_basename in -+ icc* | ecc*) -+ lt_prog_compiler_wl_F77='-Wl,' -+ lt_prog_compiler_pic_F77='-KPIC' -+ lt_prog_compiler_static_F77='-static' -+ ;; -+ pgcc* | pgf77* | pgf90* | pgf95*) -+ # Portland Group compilers (*not* the Pentium gcc compiler, -+ # which looks to be a dead project) -+ lt_prog_compiler_wl_F77='-Wl,' -+ lt_prog_compiler_pic_F77='-fpic' -+ lt_prog_compiler_static_F77='-Bstatic' -+ ;; -+ ccc*) -+ lt_prog_compiler_wl_F77='-Wl,' -+ # All Alpha code is PIC. -+ lt_prog_compiler_static_F77='-non_shared' -+ ;; -+ esac -+ ;; -+ -+ osf3* | osf4* | osf5*) -+ lt_prog_compiler_wl_F77='-Wl,' -+ # All OSF/1 code is PIC. -+ lt_prog_compiler_static_F77='-non_shared' -+ ;; -+ -+ sco3.2v5*) -+ lt_prog_compiler_pic_F77='-Kpic' -+ lt_prog_compiler_static_F77='-dn' -+ ;; -+ -+ solaris*) -+ lt_prog_compiler_pic_F77='-KPIC' -+ lt_prog_compiler_static_F77='-Bstatic' -+ case $cc_basename in -+ f77* | f90* | f95*) -+ lt_prog_compiler_wl_F77='-Qoption ld ';; -+ *) -+ lt_prog_compiler_wl_F77='-Wl,';; -+ esac -+ ;; -+ -+ sunos4*) -+ lt_prog_compiler_wl_F77='-Qoption ld ' -+ lt_prog_compiler_pic_F77='-PIC' -+ lt_prog_compiler_static_F77='-Bstatic' -+ ;; -+ -+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -+ lt_prog_compiler_wl_F77='-Wl,' -+ lt_prog_compiler_pic_F77='-KPIC' -+ lt_prog_compiler_static_F77='-Bstatic' -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec ;then -+ lt_prog_compiler_pic_F77='-Kconform_pic' -+ lt_prog_compiler_static_F77='-Bstatic' -+ fi -+ ;; -+ -+ unicos*) -+ lt_prog_compiler_wl_F77='-Wl,' -+ lt_prog_compiler_can_build_shared_F77=no -+ ;; -+ -+ uts4*) -+ lt_prog_compiler_pic_F77='-pic' -+ lt_prog_compiler_static_F77='-Bstatic' -+ ;; -+ -+ *) -+ lt_prog_compiler_can_build_shared_F77=no -+ ;; -+ esac -+ fi -+ -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 -+ -+# -+# Check to make sure the PIC flag actually works. -+# -+if test -n "$lt_prog_compiler_pic_F77"; then -+ -+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 -+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_prog_compiler_pic_works_F77=no -+ ac_outfile=conftest.$ac_objext -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ lt_compiler_flag="$lt_prog_compiler_pic_F77" -+ # 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:13764: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>conftest.err) -+ ac_status=$? -+ cat conftest.err >&5 -+ echo "$as_me:13768: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then -+ lt_prog_compiler_pic_works_F77=yes -+ fi -+ fi -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 -+ -+if test x"$lt_prog_compiler_pic_works_F77" = xyes; then -+ case $lt_prog_compiler_pic_F77 in -+ "" | " "*) ;; -+ *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; -+ esac -+else -+ lt_prog_compiler_pic_F77= -+ lt_prog_compiler_can_build_shared_F77=no -+fi -+ -+fi -+case $host_os in -+ # For platforms which do not support PIC, -DPIC is meaningless: -+ *djgpp*) -+ lt_prog_compiler_pic_F77= -+ ;; -+ *) -+ lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" -+ ;; -+esac -+ -+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_cv_prog_compiler_c_o_F77=no -+ $rm -r conftest 2>/dev/null -+ mkdir conftest -+ cd conftest -+ mkdir out -+ printf "$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:13826: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>out/conftest.err) -+ ac_status=$? -+ cat out/conftest.err >&5 -+ echo "$as_me:13830: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp -+ $SED '/^$/d' out/conftest.err >out/conftest.er2 -+ if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then -+ lt_cv_prog_compiler_c_o_F77=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 .. -+ rmdir conftest -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 -+ -+ -+hard_links="nottested" -+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then -+ # do not overwrite the value of need_locks provided by the user -+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 -+ hard_links=yes -+ $rm conftest* -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ touch conftest.a -+ ln conftest.a conftest.b 2>&5 || hard_links=no -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ echo "$as_me:$LINENO: result: $hard_links" >&5 -+echo "${ECHO_T}$hard_links" >&6 -+ if test "$hard_links" = no; then -+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -+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 -+ -+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -+ -+ runpath_var= -+ allow_undefined_flag_F77= -+ enable_shared_with_static_runtimes_F77=no -+ archive_cmds_F77= -+ archive_expsym_cmds_F77= -+ old_archive_From_new_cmds_F77= -+ old_archive_from_expsyms_cmds_F77= -+ export_dynamic_flag_spec_F77= -+ whole_archive_flag_spec_F77= -+ thread_safe_flag_spec_F77= -+ hardcode_libdir_flag_spec_F77= -+ hardcode_libdir_flag_spec_ld_F77= -+ hardcode_libdir_separator_F77= -+ hardcode_direct_F77=no -+ hardcode_minus_L_F77=no -+ hardcode_shlibpath_var_F77=unsupported -+ link_all_deplibs_F77=unknown -+ hardcode_automatic_F77=no -+ module_cmds_F77= -+ module_expsym_cmds_F77= -+ always_export_symbols_F77=no -+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ # include_expsyms should be a list of space-separated symbols to be *always* -+ # included in the symbol list -+ include_expsyms_F77= -+ # 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_F77="_GLOBAL_OFFSET_TABLE_" -+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -+ # platforms (ab)use it in PIC code, but their linkers get confused if -+ # the symbol is explicitly referenced. Since portable code cannot -+ # rely on this symbol name, it's probably fine to never include it in -+ # preloaded symbol tables. -+ extract_expsyms_cmds= -+ # Just being paranoid about ensuring that cc_basename is set. -+ for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+ case $host_os in -+ cygwin* | mingw* | pw32*) -+ # 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 -+ ;; -+ openbsd*) -+ with_gnu_ld=no -+ ;; -+ esac -+ -+ ld_shlibs_F77=yes -+ if test "$with_gnu_ld" = 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_F77='${wl}--rpath ${wl}$libdir' -+ export_dynamic_flag_spec_F77='${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_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ else -+ whole_archive_flag_spec_F77= -+ fi -+ supports_anon_versioning=no -+ case `$LD -v 2>/dev/null` in -+ *\ [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 -+ aix3* | aix4* | aix5*) -+ # On AIX/PPC, the GNU linker is very broken -+ if test "$host_cpu" != ia64; then -+ ld_shlibs_F77=no -+ cat <&2 -+ -+*** Warning: the GNU linker, at least up to release 2.9.1, is reported -+*** to be unable to reliably create shared libraries on AIX. -+*** Therefore, libtool is disabling shared libraries support. If you -+*** really care for shared libraries, you may want to modify your PATH -+*** so that a non-GNU linker is found, and then restart. -+ -+EOF -+ fi -+ ;; -+ -+ amigaos*) -+ archive_cmds_F77='$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_F77='-L$libdir' -+ hardcode_minus_L_F77=yes -+ -+ # Samuel A. Falvo II reports -+ # that the semantics of dynamic libraries on AmigaOS, at least up -+ # to version 4, is to share data among multiple programs linked -+ # with the same dynamic library. Since this doesn't match the -+ # behavior of shared libraries on other platforms, we can't use -+ # them. -+ ld_shlibs_F77=no -+ ;; -+ -+ beos*) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ allow_undefined_flag_F77=unsupported -+ # Joseph Beckenbach says some releases of gcc -+ # support --undefined. This deserves some investigation. FIXME -+ archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ else -+ ld_shlibs_F77=no -+ fi -+ ;; -+ -+ cygwin* | mingw* | pw32*) -+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, -+ # as there is no search path for DLLs. -+ hardcode_libdir_flag_spec_F77='-L$libdir' -+ allow_undefined_flag_F77=unsupported -+ always_export_symbols_F77=no -+ enable_shared_with_static_runtimes_F77=yes -+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' -+ -+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then -+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ # If the export-symbols file already is a .def file (1st line -+ # is EXPORTS), use it as is; otherwise, prepend... -+ archive_expsym_cmds_F77='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}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ else -+ ld_shlibs_F77=no -+ fi -+ ;; -+ -+ linux*) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ tmp_addflag= -+ case $cc_basename,$host_cpu in -+ pgcc*) # Portland Group C compiler -+ whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' -+ tmp_addflag=' $pic_flag' -+ ;; -+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers -+ whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$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' ;; -+ esac -+ archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ -+ if test $supports_anon_versioning = yes; then -+ archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -+ $echo "local: *; };" >> $output_objdir/$libname.ver~ -+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' -+ fi -+ link_all_deplibs_F77=no -+ else -+ ld_shlibs_F77=no -+ fi -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' -+ wlarc= -+ else -+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ fi -+ ;; -+ -+ solaris* | sysv5*) -+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then -+ ld_shlibs_F77=no -+ cat <&2 -+ -+*** Warning: The releases 2.8.* of the GNU linker cannot reliably -+*** create shared libraries on Solaris systems. Therefore, libtool -+*** is disabling shared libraries support. We urge you to upgrade GNU -+*** binutils to release 2.9.1 or newer. Another option is to modify -+*** your PATH or compiler configuration so that the native linker is -+*** used, and then restart. -+ -+EOF -+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ ld_shlibs_F77=no -+ fi -+ ;; -+ -+ sunos4*) -+ archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ wlarc= -+ hardcode_direct_F77=yes -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ *) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ ld_shlibs_F77=no -+ fi -+ ;; -+ esac -+ -+ if test "$ld_shlibs_F77" = no; then -+ runpath_var= -+ hardcode_libdir_flag_spec_F77= -+ export_dynamic_flag_spec_F77= -+ whole_archive_flag_spec_F77= -+ fi -+ else -+ # PORTME fill in a description of your system's linker (not GNU ld) -+ case $host_os in -+ aix3*) -+ allow_undefined_flag_F77=unsupported -+ always_export_symbols_F77=yes -+ archive_expsym_cmds_F77='$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_F77=yes -+ if test "$GCC" = yes && test -z "$link_static_flag"; then -+ # Neither direct hardcoding nor static linking is supported with a -+ # broken collect2. -+ hardcode_direct_F77=unsupported -+ fi -+ ;; -+ -+ aix4* | aix5*) -+ 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 -+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then -+ export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' -+ else -+ export_symbols_cmds_F77='$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].*|aix5*) -+ 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_F77='' -+ hardcode_direct_F77=yes -+ hardcode_libdir_separator_F77=':' -+ link_all_deplibs_F77=yes -+ -+ 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 -+ hardcode_direct_F77=yes -+ else -+ # We have old collect2 -+ hardcode_direct_F77=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_F77=yes -+ hardcode_libdir_flag_spec_F77='-L$libdir' -+ hardcode_libdir_separator_F77= -+ 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 -+ -+ # 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_F77=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_F77='-berok' -+ # Determine the default libpath from the value encoded in an empty executable. -+ cat >conftest.$ac_ext <<_ACEOF -+ program main -+ -+ end -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+ -+ hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" -+ archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" -+ else -+ if test "$host_cpu" = ia64; then -+ hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' -+ allow_undefined_flag_F77="-z nodefs" -+ archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ else -+ # Determine the default libpath from the value encoded in an empty executable. -+ cat >conftest.$ac_ext <<_ACEOF -+ program main -+ -+ end -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+ -+ hardcode_libdir_flag_spec_F77='${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_F77=' ${wl}-bernotok' -+ allow_undefined_flag_F77=' ${wl}-berok' -+ # -bexpall does not export symbols beginning with underscore (_) -+ always_export_symbols_F77=yes -+ # Exported symbols can be pulled into shared objects from archives -+ whole_archive_flag_spec_F77=' ' -+ archive_cmds_need_lc_F77=yes -+ # This is similar to how AIX traditionally builds its shared libraries. -+ archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' -+ fi -+ fi -+ ;; -+ -+ amigaos*) -+ archive_cmds_F77='$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_F77='-L$libdir' -+ hardcode_minus_L_F77=yes -+ # see comment about different semantics on the GNU ld section -+ ld_shlibs_F77=no -+ ;; -+ -+ bsdi[45]*) -+ export_dynamic_flag_spec_F77=-rdynamic -+ ;; -+ -+ cygwin* | mingw* | pw32*) -+ # When not using gcc, we currently assume that we are using -+ # Microsoft Visual C++. -+ # hardcode_libdir_flag_spec is actually meaningless, as there is -+ # no search path for DLLs. -+ hardcode_libdir_flag_spec_F77=' ' -+ allow_undefined_flag_F77=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_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' -+ # The linker will automatically build a .lib file if we build a DLL. -+ old_archive_From_new_cmds_F77='true' -+ # FIXME: Should let the user specify the lib program. -+ old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' -+ fix_srcfile_path_F77='`cygpath -w "$srcfile"`' -+ enable_shared_with_static_runtimes_F77=yes -+ ;; -+ -+ darwin* | rhapsody*) -+ case $host_os in -+ rhapsody* | darwin1.[012]) -+ allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' -+ ;; -+ *) # Darwin 1.3 on -+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then -+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ else -+ case ${MACOSX_DEPLOYMENT_TARGET} in -+ 10.[012]) -+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ ;; -+ 10.*) -+ allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' -+ ;; -+ esac -+ fi -+ ;; -+ esac -+ archive_cmds_need_lc_F77=no -+ hardcode_direct_F77=no -+ hardcode_automatic_F77=yes -+ hardcode_shlibpath_var_F77=unsupported -+ whole_archive_flag_spec_F77='' -+ link_all_deplibs_F77=yes -+ if test "$GCC" = yes ; then -+ output_verbose_link_cmd='echo' -+ archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ case $cc_basename in -+ xlc*) -+ output_verbose_link_cmd='echo' -+ archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' -+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ ;; -+ *) -+ ld_shlibs_F77=no -+ ;; -+ esac -+ fi -+ ;; -+ -+ dgux*) -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_libdir_flag_spec_F77='-L$libdir' -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ freebsd1*) -+ ld_shlibs_F77=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_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' -+ hardcode_libdir_flag_spec_F77='-R$libdir' -+ hardcode_direct_F77=yes -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ # Unfortunately, older versions of FreeBSD 2 do not have this feature. -+ freebsd2*) -+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_F77=yes -+ hardcode_minus_L_F77=yes -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. -+ freebsd* | kfreebsd*-gnu | dragonfly*) -+ archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' -+ hardcode_libdir_flag_spec_F77='-R$libdir' -+ hardcode_direct_F77=yes -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ hpux9*) -+ if test "$GCC" = yes; then -+ archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${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_F77='$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_F77='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator_F77=: -+ hardcode_direct_F77=yes -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ hardcode_minus_L_F77=yes -+ export_dynamic_flag_spec_F77='${wl}-E' -+ ;; -+ -+ hpux10* | hpux11*) -+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*|ia64*) -+ archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ *) -+ archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ esac -+ else -+ case $host_cpu in -+ hppa*64*|ia64*) -+ archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ *) -+ archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ esac -+ fi -+ if test "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*) -+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' -+ hardcode_libdir_flag_spec_ld_F77='+b $libdir' -+ hardcode_libdir_separator_F77=: -+ hardcode_direct_F77=no -+ hardcode_shlibpath_var_F77=no -+ ;; -+ ia64*) -+ hardcode_libdir_flag_spec_F77='-L$libdir' -+ hardcode_direct_F77=no -+ hardcode_shlibpath_var_F77=no -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ hardcode_minus_L_F77=yes -+ ;; -+ *) -+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator_F77=: -+ hardcode_direct_F77=yes -+ export_dynamic_flag_spec_F77='${wl}-E' -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ hardcode_minus_L_F77=yes -+ ;; -+ esac -+ fi -+ ;; -+ -+ irix5* | irix6* | nonstopux*) -+ if test "$GCC" = yes; then -+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' -+ fi -+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_F77=: -+ link_all_deplibs_F77=yes -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out -+ else -+ archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF -+ fi -+ hardcode_libdir_flag_spec_F77='-R$libdir' -+ hardcode_direct_F77=yes -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ newsos6) -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_F77=yes -+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_F77=: -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ openbsd*) -+ hardcode_direct_F77=yes -+ hardcode_shlibpath_var_F77=no -+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then -+ archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' -+ archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' -+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' -+ export_dynamic_flag_spec_F77='${wl}-E' -+ else -+ case $host_os in -+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) -+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_libdir_flag_spec_F77='-R$libdir' -+ ;; -+ *) -+ archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' -+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' -+ ;; -+ esac -+ fi -+ ;; -+ -+ os2*) -+ hardcode_libdir_flag_spec_F77='-L$libdir' -+ hardcode_minus_L_F77=yes -+ allow_undefined_flag_F77=unsupported -+ archive_cmds_F77='$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_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' -+ ;; -+ -+ osf3*) -+ if test "$GCC" = yes; then -+ allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ allow_undefined_flag_F77=' -expect_unresolved \*' -+ archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ fi -+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_F77=: -+ ;; -+ -+ osf4* | osf5*) # as osf3* with the addition of -msym flag -+ if test "$GCC" = yes; then -+ allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' -+ else -+ allow_undefined_flag_F77=' -expect_unresolved \*' -+ archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ -+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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_F77='-rpath $libdir' -+ fi -+ hardcode_libdir_separator_F77=: -+ ;; -+ -+ sco3.2v5*) -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_shlibpath_var_F77=no -+ export_dynamic_flag_spec_F77='${wl}-Bexport' -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ ;; -+ -+ solaris*) -+ no_undefined_flag_F77=' -z text' -+ if test "$GCC" = yes; then -+ wlarc='${wl}' -+ archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' -+ else -+ wlarc='' -+ archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ archive_expsym_cmds_F77='$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' -+ fi -+ hardcode_libdir_flag_spec_F77='-R$libdir' -+ hardcode_shlibpath_var_F77=no -+ case $host_os in -+ solaris2.[0-5] | solaris2.[0-5].*) ;; -+ *) -+ # The compiler driver will combine linker options so we -+ # cannot just pass the convience library names through -+ # without $wl, iff we do not link with $LD. -+ # Luckily, gcc supports the same syntax we need for Sun Studio. -+ # Supported since Solaris 2.6 (maybe 2.5.1?) -+ case $wlarc in -+ '') -+ whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; -+ *) -+ whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; -+ esac ;; -+ esac -+ link_all_deplibs_F77=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_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' -+ else -+ archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' -+ fi -+ hardcode_libdir_flag_spec_F77='-L$libdir' -+ hardcode_direct_F77=yes -+ hardcode_minus_L_F77=yes -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ sysv4) -+ case $host_vendor in -+ sni) -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_F77=yes # is this really true??? -+ ;; -+ siemens) -+ ## LD is ld it makes a PLAMLIB -+ ## CC just makes a GrossModule. -+ archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' -+ reload_cmds_F77='$CC -r -o $output$reload_objs' -+ hardcode_direct_F77=no -+ ;; -+ motorola) -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie -+ ;; -+ esac -+ runpath_var='LD_RUN_PATH' -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ sysv4.3*) -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_shlibpath_var_F77=no -+ export_dynamic_flag_spec_F77='-Bexport' -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_shlibpath_var_F77=no -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ ld_shlibs_F77=yes -+ fi -+ ;; -+ -+ sysv4.2uw2*) -+ archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_F77=yes -+ hardcode_minus_L_F77=no -+ hardcode_shlibpath_var_F77=no -+ hardcode_runpath_var=yes -+ runpath_var=LD_RUN_PATH -+ ;; -+ -+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) -+ no_undefined_flag_F77='${wl}-z ${wl}text' -+ if test "$GCC" = yes; then -+ archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ else -+ archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ fi -+ runpath_var='LD_RUN_PATH' -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ sysv5*) -+ no_undefined_flag_F77=' -z text' -+ # $CC -shared without GNU ld will not create a library from C++ -+ # object files and a static libstdc++, better avoid it by now -+ archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ archive_expsym_cmds_F77='$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' -+ hardcode_libdir_flag_spec_F77= -+ hardcode_shlibpath_var_F77=no -+ runpath_var='LD_RUN_PATH' -+ ;; -+ -+ uts4*) -+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_libdir_flag_spec_F77='-L$libdir' -+ hardcode_shlibpath_var_F77=no -+ ;; -+ -+ *) -+ ld_shlibs_F77=no -+ ;; -+ esac -+ fi -+ -+echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -+echo "${ECHO_T}$ld_shlibs_F77" >&6 -+test "$ld_shlibs_F77" = 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 -+ -+# -+# Do we need to explicitly link libc? -+# -+case "x$archive_cmds_need_lc_F77" in -+x|xyes) -+ # Assume -lc should be added -+ archive_cmds_need_lc_F77=yes -+ -+ if test "$enable_shared" = yes && test "$GCC" = yes; then -+ case $archive_cmds_F77 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. -+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 -+ $rm conftest* -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ -+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } 2>conftest.err; then -+ soname=conftest -+ lib=conftest -+ libobjs=conftest.$ac_objext -+ deplibs= -+ wl=$lt_prog_compiler_wl_F77 -+ compiler_flags=-v -+ linker_flags=-v -+ verstring= -+ output_objdir=. -+ libname=conftest -+ lt_save_allow_undefined_flag=$allow_undefined_flag_F77 -+ allow_undefined_flag_F77= -+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 -+ (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ then -+ archive_cmds_need_lc_F77=no -+ else -+ archive_cmds_need_lc_F77=yes -+ fi -+ allow_undefined_flag_F77=$lt_save_allow_undefined_flag -+ else -+ cat conftest.err 1>&5 -+ fi -+ $rm conftest* -+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 -+ ;; -+ esac -+ fi -+ ;; -+esac -+ -+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -+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" -+if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then -+ # 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. -+ 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 -+else -+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -+fi -+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' -+ ;; -+ -+aix4* | aix5*) -+ 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*) -+ library_names_spec='$libname.ixlibrary $libname.a' -+ # Create ${libname}_ixlibrary.a entries in /sys/libs. -+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' -+ ;; -+ -+beos*) -+ library_names_spec='${libname}${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*) -+ version_type=windows -+ shrext_cmds=".dll" -+ need_version=no -+ need_lib_prefix=no -+ -+ case $GCC,$host_os in -+ yes,cygwin* | yes,mingw* | yes,pw32*) -+ 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' -+ 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="/usr/lib /lib/w32api /lib /usr/local/lib" -+ ;; -+ mingw*) -+ # MinGW DLLs use traditional 'lib' prefix -+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then -+ # It is most probably a Windows format PATH printed by -+ # mingw gcc, but we are running on Cygwin. Gcc prints its search -+ # path with ; separators, and with drive letters. We can handle the -+ # drive letters (cygwin fileutils understands them), so leave them, -+ # especially as we might pass files found there to a mingw objdump, -+ # which wouldn't understand a cygwinified path. Ahh. -+ 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 -+ ;; -+ 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 -+ ;; -+ -+ *) -+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' -+ ;; -+ esac -+ dynamic_linker='Win32 ld.exe' -+ # 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}${versuffix}$shared_ext ${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`' -+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. -+ if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` -+ else -+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' -+ fi -+ 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 -+ ;; -+ -+kfreebsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU ld.so' -+ ;; -+ -+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 -+ ;; -+ *) # from 3.2 on -+ shlibpath_overrides_runpath=no -+ 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 -+ ;; -+ -+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' -+ ;; -+ -+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*) -+ 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 -+ # 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)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' -+ ;; -+ -+netbsdelf*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='NetBSD ld.elf_so' -+ ;; -+ -+knetbsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU 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=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 -+ ;; -+ -+openbsd*) -+ version_type=sunos -+ 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" -+ ;; -+ -+sco3.2v5*) -+ version_type=osf -+ 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 -+ ;; -+ -+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.2uw2* | sysv4.3* | sysv5*) -+ 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 -+ export_dynamic_flag_spec='${wl}-Blargedynsym' -+ 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 -+ ;; -+ -+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 -+echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -+echo "${ECHO_T}$dynamic_linker" >&6 -+test "$dynamic_linker" = no && can_build_shared=no -+ -+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -+hardcode_action_F77= -+if test -n "$hardcode_libdir_flag_spec_F77" || \ -+ test -n "$runpath_var_F77" || \ -+ test "X$hardcode_automatic_F77" = "Xyes" ; then -+ -+ # We can hardcode non-existant directories. -+ if test "$hardcode_direct_F77" != 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_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && -+ test "$hardcode_minus_L_F77" != no; then -+ # Linking always hardcodes the temporary library directory. -+ hardcode_action_F77=relink -+ else -+ # We can link without hardcoding, and we can hardcode nonexisting dirs. -+ hardcode_action_F77=immediate -+ fi -+else -+ # We cannot hardcode anything, or else we can only hardcode existing -+ # directories. -+ hardcode_action_F77=unsupported -+fi -+echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -+echo "${ECHO_T}$hardcode_action_F77" >&6 -+ -+if test "$hardcode_action_F77" = relink; then -+ # Fast installation is not supported -+ enable_fast_install=no -+elif test "$shlibpath_overrides_runpath" = yes || -+ test "$enable_shared" = no; then -+ # Fast installation is not necessary -+ enable_fast_install=needless -+fi -+ -+striplib= -+old_striplib= -+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ ;; -+ *) -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ ;; -+ esac -+fi -+ -+ -+ -+# The else clause should only fire when bootstrapping the -+# libtool distribution, otherwise you forgot to ship ltmain.sh -+# with your package, and you will get complaints that there are -+# no rules to generate ltmain.sh. -+if test -f "$ltmain"; then -+ # 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 -+ # Now quote all the things that may contain metacharacters while being -+ # careful not to overquote the AC_SUBSTed values. We take copies of the -+ # variables and quote the copies for generation of the libtool script. -+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ -+ SED SHELL STRIP \ -+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ -+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ -+ deplibs_check_method reload_flag reload_cmds need_locks \ -+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ -+ lt_cv_sys_global_symbol_to_c_name_address \ -+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -+ old_postinstall_cmds old_postuninstall_cmds \ -+ compiler_F77 \ -+ CC_F77 \ -+ LD_F77 \ -+ lt_prog_compiler_wl_F77 \ -+ lt_prog_compiler_pic_F77 \ -+ lt_prog_compiler_static_F77 \ -+ lt_prog_compiler_no_builtin_flag_F77 \ -+ export_dynamic_flag_spec_F77 \ -+ thread_safe_flag_spec_F77 \ -+ whole_archive_flag_spec_F77 \ -+ enable_shared_with_static_runtimes_F77 \ -+ old_archive_cmds_F77 \ -+ old_archive_from_new_cmds_F77 \ -+ predep_objects_F77 \ -+ postdep_objects_F77 \ -+ predeps_F77 \ -+ postdeps_F77 \ -+ compiler_lib_search_path_F77 \ -+ archive_cmds_F77 \ -+ archive_expsym_cmds_F77 \ -+ postinstall_cmds_F77 \ -+ postuninstall_cmds_F77 \ -+ old_archive_from_expsyms_cmds_F77 \ -+ allow_undefined_flag_F77 \ -+ no_undefined_flag_F77 \ -+ export_symbols_cmds_F77 \ -+ hardcode_libdir_flag_spec_F77 \ -+ hardcode_libdir_flag_spec_ld_F77 \ -+ hardcode_libdir_separator_F77 \ -+ hardcode_automatic_F77 \ -+ module_cmds_F77 \ -+ module_expsym_cmds_F77 \ -+ lt_cv_prog_compiler_c_o_F77 \ -+ exclude_expsyms_F77 \ -+ include_expsyms_F77; do -+ -+ case $var in -+ old_archive_cmds_F77 | \ -+ old_archive_from_new_cmds_F77 | \ -+ archive_cmds_F77 | \ -+ archive_expsym_cmds_F77 | \ -+ module_cmds_F77 | \ -+ module_expsym_cmds_F77 | \ -+ old_archive_from_expsyms_cmds_F77 | \ -+ export_symbols_cmds_F77 | \ -+ extract_expsyms_cmds | reload_cmds | finish_cmds | \ -+ postinstall_cmds | postuninstall_cmds | \ -+ old_postinstall_cmds | old_postuninstall_cmds | \ -+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) -+ # Double-quote double-evaled strings. -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" -+ ;; -+ *) -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -+ ;; -+ esac -+ done -+ -+ case $lt_echo in -+ *'\$0 --fallback-echo"') -+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` -+ ;; -+ esac -+ -+cfgfile="$ofile" -+ -+ cat <<__EOF__ >> "$cfgfile" -+# ### BEGIN LIBTOOL TAG CONFIG: $tagname -+ -+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -+ -+# Shell to use when invoking shell scripts. -+SHELL=$lt_SHELL -+ -+# Whether or not to build shared libraries. -+build_libtool_libs=$enable_shared -+ -+# Whether or not to build static libraries. -+build_old_libs=$enable_static -+ -+# Whether or not to add -lc for building shared libraries. -+build_libtool_need_lc=$archive_cmds_need_lc_F77 -+ -+# Whether or not to disallow shared libs when runtime libs are static -+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 -+ -+# Whether or not to optimize for fast installation. -+fast_install=$enable_fast_install -+ -+# 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 -+ -+# An echo program that does not interpret backslashes. -+echo=$lt_echo -+ -+# The archiver. -+AR=$lt_AR -+AR_FLAGS=$lt_AR_FLAGS -+ -+# A C compiler. -+LTCC=$lt_LTCC -+ -+# A language-specific compiler. -+CC=$lt_compiler_F77 -+ -+# Is the compiler the GNU C compiler? -+with_gcc=$GCC_F77 -+ -+# An ERE matcher. -+EGREP=$lt_EGREP -+ -+# The linker used to build libraries. -+LD=$lt_LD_F77 -+ -+# Whether we need hard or soft links. -+LN_S=$lt_LN_S -+ -+# A BSD-compatible nm program. -+NM=$lt_NM -+ -+# A symbol stripping program -+STRIP=$lt_STRIP -+ -+# Used to examine libraries when file_magic_cmd begins "file" -+MAGIC_CMD=$MAGIC_CMD -+ -+# Used on cygwin: DLL creation program. -+DLLTOOL="$DLLTOOL" -+ -+# Used on cygwin: object dumper. -+OBJDUMP="$OBJDUMP" -+ -+# Used on cygwin: assembler. -+AS="$AS" -+ -+# The name of the directory that contains temporary libtool files. -+objdir=$objdir -+ -+# How to create reloadable object files. -+reload_flag=$lt_reload_flag -+reload_cmds=$lt_reload_cmds -+ -+# How to pass a linker flag through the compiler. -+wl=$lt_lt_prog_compiler_wl_F77 -+ -+# Object file suffix (normally "o"). -+objext="$ac_objext" -+ -+# Old archive suffix (normally "a"). -+libext="$libext" -+ -+# Shared library suffix (normally ".so"). -+shrext_cmds='$shrext_cmds' -+ -+# Executable file suffix (normally ""). -+exeext="$exeext" -+ -+# Additional compiler flags for building library objects. -+pic_flag=$lt_lt_prog_compiler_pic_F77 -+pic_mode=$pic_mode -+ -+# What is the maximum length of a command? -+max_cmd_len=$lt_cv_sys_max_cmd_len -+ -+# Does compiler simultaneously support -c and -o options? -+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -+ -+# Must we lock files when doing compilation? -+need_locks=$lt_need_locks -+ -+# Do we need the lib prefix for modules? -+need_lib_prefix=$need_lib_prefix -+ -+# Do we need a version for libraries? -+need_version=$need_version -+ -+# Whether dlopen is supported. -+dlopen_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 -+ -+# Compiler flag to prevent dynamic linking. -+link_static_flag=$lt_lt_prog_compiler_static_F77 -+ -+# Compiler flag to turn off builtin functions. -+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 -+ -+# Compiler flag to allow reflexive dlopens. -+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 -+ -+# Compiler flag to generate shared objects directly from archives. -+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 -+ -+# Compiler flag to generate thread-safe objects. -+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 -+ -+# Library versioning type. -+version_type=$version_type -+ -+# 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 -+ -+# Commands used to build and install an old-style archive. -+RANLIB=$lt_RANLIB -+old_archive_cmds=$lt_old_archive_cmds_F77 -+old_postinstall_cmds=$lt_old_postinstall_cmds -+old_postuninstall_cmds=$lt_old_postuninstall_cmds -+ -+# Create an old-style archive from a shared archive. -+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 -+ -+# Create a temporary old-style archive to link instead of a shared archive. -+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 -+ -+# Commands used to build and install a shared archive. -+archive_cmds=$lt_archive_cmds_F77 -+archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -+postinstall_cmds=$lt_postinstall_cmds -+postuninstall_cmds=$lt_postuninstall_cmds -+ -+# Commands used to build a loadable module (assumed same as above if empty) -+module_cmds=$lt_module_cmds_F77 -+module_expsym_cmds=$lt_module_expsym_cmds_F77 -+ -+# Commands to strip libraries. -+old_striplib=$lt_old_striplib -+striplib=$lt_striplib -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predep_objects=$lt_predep_objects_F77 -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdep_objects=$lt_postdep_objects_F77 -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predeps=$lt_predeps_F77 -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdeps=$lt_postdeps_F77 -+ -+# The library search path used internally by the compiler when linking -+# a shared library. -+compiler_lib_search_path=$lt_compiler_lib_search_path_F77 -+ -+# 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 -+ -+# Flag that allows shared libraries with undefined symbols to be built. -+allow_undefined_flag=$lt_allow_undefined_flag_F77 -+ -+# Flag that forces no undefined symbols. -+no_undefined_flag=$lt_no_undefined_flag_F77 -+ -+# Commands used to finish a libtool library installation in a directory. -+finish_cmds=$lt_finish_cmds -+ -+# Same as above, but a single script fragment to be evaled but not shown. -+finish_eval=$lt_finish_eval -+ -+# 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 -+ -+# This is the shared library runtime path variable. -+runpath_var=$runpath_var -+ -+# This is the shared library path variable. -+shlibpath_var=$shlibpath_var -+ -+# Is shlibpath searched before the hard-coded library search path? -+shlibpath_overrides_runpath=$shlibpath_overrides_runpath -+ -+# How to hardcode a shared library path into an executable. -+hardcode_action=$hardcode_action_F77 -+ -+# Whether we should hardcode library paths into libraries. -+hardcode_into_libs=$hardcode_into_libs -+ -+# 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_F77 -+ -+# 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_F77 -+ -+# Whether we need a single -rpath flag with a separated argument. -+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 -+ -+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -+# resulting binary. -+hardcode_direct=$hardcode_direct_F77 -+ -+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -+# resulting binary. -+hardcode_minus_L=$hardcode_minus_L_F77 -+ -+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -+# the resulting binary. -+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 -+ -+# 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_F77 -+ -+# Variables whose values should be saved in libtool wrapper scripts and -+# restored at relink time. -+variables_saved_for_relink="$variables_saved_for_relink" -+ -+# Whether libtool must link a program against all its dependency libraries. -+link_all_deplibs=$link_all_deplibs_F77 -+ -+# 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 -+ -+# Fix the shell variable \$srcfile for the compiler. -+fix_srcfile_path="$fix_srcfile_path_F77" -+ -+# Set to yes if exported symbols are required. -+always_export_symbols=$always_export_symbols_F77 -+ -+# The commands to list exported symbols. -+export_symbols_cmds=$lt_export_symbols_cmds_F77 -+ -+# The commands to extract the exported symbol list from a shared archive. -+extract_expsyms_cmds=$lt_extract_expsyms_cmds -+ -+# Symbols that should not be listed in the preloaded symbols. -+exclude_expsyms=$lt_exclude_expsyms_F77 -+ -+# Symbols that must always be exported. -+include_expsyms=$lt_include_expsyms_F77 -+ -+# ### END LIBTOOL TAG CONFIG: $tagname -+ -+__EOF__ -+ -+ -+else -+ # If there is no Makefile yet, we rely on a make rule to execute -+ # `config.status --recheck' to rerun these tests and create the -+ # libtool script then. -+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` -+ if test -f "$ltmain_in"; then -+ test -f Makefile && make "$ltmain" -+ fi -+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" -+ -+ else -+ tagname="" -+ fi -+ ;; -+ -+ GCJ) -+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then -+ -+ -+ -+# Source file extension for Java test sources. -+ac_ext=java -+ -+# Object file extension for compiled Java test sources. -+objext=o -+objext_GCJ=$objext -+ -+# Code to be used in simple compile tests -+lt_simple_compile_test_code="class foo {}\n" -+ -+# Code to be used in simple link tests -+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' -+ -+# ltmain only uses $CC for tagged configurations so make sure $CC is set. -+ -+# If no C compiler was specified, use CC. -+LTCC=${LTCC-"$CC"} -+ -+# Allow CC to be a program name with arguments. -+compiler=$CC -+ -+ -+# save warnings/boilerplate of simple test code -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_compile_test_code" >conftest.$ac_ext -+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_compiler_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_link_test_code" >conftest.$ac_ext -+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_linker_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ -+# Allow CC to be a program name with arguments. -+lt_save_CC="$CC" -+CC=${GCJ-"gcj"} -+compiler=$CC -+compiler_GCJ=$CC -+for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+ -+# GCJ did not exist at the time GCC didn't implicitly link libc in. -+archive_cmds_need_lc_GCJ=no -+ -+old_archive_cmds_GCJ=$old_archive_cmds -+ -+ -+lt_prog_compiler_no_builtin_flag_GCJ= -+ -+if test "$GCC" = yes; then -+ lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' -+ -+ -+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_cv_prog_compiler_rtti_exceptions=no -+ ac_outfile=conftest.$ac_objext -+ printf "$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:15967: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>conftest.err) -+ ac_status=$? -+ cat conftest.err >&5 -+ echo "$as_me:15971: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then -+ lt_cv_prog_compiler_rtti_exceptions=yes -+ fi -+ fi -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 -+ -+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then -+ lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -+else -+ : -+fi -+ -+fi -+ -+lt_prog_compiler_wl_GCJ= -+lt_prog_compiler_pic_GCJ= -+lt_prog_compiler_static_GCJ= -+ -+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -+ -+ if test "$GCC" = yes; then -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ lt_prog_compiler_static_GCJ='-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_GCJ='-Bstatic' -+ fi -+ ;; -+ -+ amigaos*) -+ # FIXME: we need at least 68020 code to build shared libraries, but -+ # adding the `-m68020' flag to GCC prevents building anything better, -+ # like `-m68040'. -+ lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' -+ ;; -+ -+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) -+ # PIC is the default for these OSes. -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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_GCJ='-DDLL_EXPORT' -+ ;; -+ -+ darwin* | rhapsody*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ lt_prog_compiler_pic_GCJ='-fno-common' -+ ;; -+ -+ 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_GCJ=no -+ enable_shared=no -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ lt_prog_compiler_pic_GCJ=-Kconform_pic -+ fi -+ ;; -+ -+ hpux*) -+ # 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_GCJ='-fPIC' -+ ;; -+ esac -+ ;; -+ -+ *) -+ lt_prog_compiler_pic_GCJ='-fPIC' -+ ;; -+ esac -+ else -+ # PORTME Check for flag to pass linker flags through the system compiler. -+ case $host_os in -+ aix*) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ if test "$host_cpu" = ia64; then -+ # AIX 5 now supports IA64 processor -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ else -+ lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' -+ fi -+ ;; -+ darwin*) -+ # PIC is the default on this platform -+ # Common symbols not allowed in MH_DYLIB files -+ case $cc_basename in -+ xlc*) -+ lt_prog_compiler_pic_GCJ='-qnocommon' -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ ;; -+ esac -+ ;; -+ -+ mingw* | pw32* | os2*) -+ # 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_GCJ='-DDLL_EXPORT' -+ ;; -+ -+ hpux9* | hpux10* | hpux11*) -+ lt_prog_compiler_wl_GCJ='-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_GCJ='+Z' -+ ;; -+ esac -+ # Is there a better lt_prog_compiler_static that works with the bundled CC? -+ lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' -+ ;; -+ -+ irix5* | irix6* | nonstopux*) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ # PIC (with -KPIC) is the default. -+ lt_prog_compiler_static_GCJ='-non_shared' -+ ;; -+ -+ newsos6) -+ lt_prog_compiler_pic_GCJ='-KPIC' -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ ;; -+ -+ linux*) -+ case $cc_basename in -+ icc* | ecc*) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ lt_prog_compiler_pic_GCJ='-KPIC' -+ lt_prog_compiler_static_GCJ='-static' -+ ;; -+ pgcc* | pgf77* | pgf90* | pgf95*) -+ # Portland Group compilers (*not* the Pentium gcc compiler, -+ # which looks to be a dead project) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ lt_prog_compiler_pic_GCJ='-fpic' -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ ;; -+ ccc*) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ # All Alpha code is PIC. -+ lt_prog_compiler_static_GCJ='-non_shared' -+ ;; -+ esac -+ ;; -+ -+ osf3* | osf4* | osf5*) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ # All OSF/1 code is PIC. -+ lt_prog_compiler_static_GCJ='-non_shared' -+ ;; -+ -+ sco3.2v5*) -+ lt_prog_compiler_pic_GCJ='-Kpic' -+ lt_prog_compiler_static_GCJ='-dn' -+ ;; -+ -+ solaris*) -+ lt_prog_compiler_pic_GCJ='-KPIC' -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ case $cc_basename in -+ f77* | f90* | f95*) -+ lt_prog_compiler_wl_GCJ='-Qoption ld ';; -+ *) -+ lt_prog_compiler_wl_GCJ='-Wl,';; -+ esac -+ ;; -+ -+ sunos4*) -+ lt_prog_compiler_wl_GCJ='-Qoption ld ' -+ lt_prog_compiler_pic_GCJ='-PIC' -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ ;; -+ -+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ lt_prog_compiler_pic_GCJ='-KPIC' -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec ;then -+ lt_prog_compiler_pic_GCJ='-Kconform_pic' -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ fi -+ ;; -+ -+ unicos*) -+ lt_prog_compiler_wl_GCJ='-Wl,' -+ lt_prog_compiler_can_build_shared_GCJ=no -+ ;; -+ -+ uts4*) -+ lt_prog_compiler_pic_GCJ='-pic' -+ lt_prog_compiler_static_GCJ='-Bstatic' -+ ;; -+ -+ *) -+ lt_prog_compiler_can_build_shared_GCJ=no -+ ;; -+ esac -+ fi -+ -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 -+ -+# -+# Check to make sure the PIC flag actually works. -+# -+if test -n "$lt_prog_compiler_pic_GCJ"; then -+ -+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 -+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_prog_compiler_pic_works_GCJ=no -+ ac_outfile=conftest.$ac_objext -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ lt_compiler_flag="$lt_prog_compiler_pic_GCJ" -+ # 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:16229: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>conftest.err) -+ ac_status=$? -+ cat conftest.err >&5 -+ echo "$as_me:16233: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp -+ $SED '/^$/d' conftest.err >conftest.er2 -+ if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then -+ lt_prog_compiler_pic_works_GCJ=yes -+ fi -+ fi -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 -+ -+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then -+ case $lt_prog_compiler_pic_GCJ in -+ "" | " "*) ;; -+ *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; -+ esac -+else -+ lt_prog_compiler_pic_GCJ= -+ lt_prog_compiler_can_build_shared_GCJ=no -+fi -+ -+fi -+case $host_os in -+ # For platforms which do not support PIC, -DPIC is meaningless: -+ *djgpp*) -+ lt_prog_compiler_pic_GCJ= -+ ;; -+ *) -+ lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" -+ ;; -+esac -+ -+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ lt_cv_prog_compiler_c_o_GCJ=no -+ $rm -r conftest 2>/dev/null -+ mkdir conftest -+ cd conftest -+ mkdir out -+ printf "$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:16291: $lt_compile\"" >&5) -+ (eval "$lt_compile" 2>out/conftest.err) -+ ac_status=$? -+ cat out/conftest.err >&5 -+ echo "$as_me:16295: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp -+ $SED '/^$/d' out/conftest.err >out/conftest.er2 -+ if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then -+ lt_cv_prog_compiler_c_o_GCJ=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 .. -+ rmdir conftest -+ $rm conftest* -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 -+ -+ -+hard_links="nottested" -+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then -+ # do not overwrite the value of need_locks provided by the user -+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 -+ hard_links=yes -+ $rm conftest* -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ touch conftest.a -+ ln conftest.a conftest.b 2>&5 || hard_links=no -+ ln conftest.a conftest.b 2>/dev/null && hard_links=no -+ echo "$as_me:$LINENO: result: $hard_links" >&5 -+echo "${ECHO_T}$hard_links" >&6 -+ if test "$hard_links" = no; then -+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -+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 -+ -+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -+ -+ runpath_var= -+ allow_undefined_flag_GCJ= -+ enable_shared_with_static_runtimes_GCJ=no -+ archive_cmds_GCJ= -+ archive_expsym_cmds_GCJ= -+ old_archive_From_new_cmds_GCJ= -+ old_archive_from_expsyms_cmds_GCJ= -+ export_dynamic_flag_spec_GCJ= -+ whole_archive_flag_spec_GCJ= -+ thread_safe_flag_spec_GCJ= -+ hardcode_libdir_flag_spec_GCJ= -+ hardcode_libdir_flag_spec_ld_GCJ= -+ hardcode_libdir_separator_GCJ= -+ hardcode_direct_GCJ=no -+ hardcode_minus_L_GCJ=no -+ hardcode_shlibpath_var_GCJ=unsupported -+ link_all_deplibs_GCJ=unknown -+ hardcode_automatic_GCJ=no -+ module_cmds_GCJ= -+ module_expsym_cmds_GCJ= -+ always_export_symbols_GCJ=no -+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' -+ # include_expsyms should be a list of space-separated symbols to be *always* -+ # included in the symbol list -+ include_expsyms_GCJ= -+ # 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_GCJ="_GLOBAL_OFFSET_TABLE_" -+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -+ # platforms (ab)use it in PIC code, but their linkers get confused if -+ # the symbol is explicitly referenced. Since portable code cannot -+ # rely on this symbol name, it's probably fine to never include it in -+ # preloaded symbol tables. -+ extract_expsyms_cmds= -+ # Just being paranoid about ensuring that cc_basename is set. -+ for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+ case $host_os in -+ cygwin* | mingw* | pw32*) -+ # 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 -+ ;; -+ openbsd*) -+ with_gnu_ld=no -+ ;; -+ esac -+ -+ ld_shlibs_GCJ=yes -+ if test "$with_gnu_ld" = 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_GCJ='${wl}--rpath ${wl}$libdir' -+ export_dynamic_flag_spec_GCJ='${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_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ else -+ whole_archive_flag_spec_GCJ= -+ fi -+ supports_anon_versioning=no -+ case `$LD -v 2>/dev/null` in -+ *\ [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 -+ aix3* | aix4* | aix5*) -+ # On AIX/PPC, the GNU linker is very broken -+ if test "$host_cpu" != ia64; then -+ ld_shlibs_GCJ=no -+ cat <&2 -+ -+*** Warning: the GNU linker, at least up to release 2.9.1, is reported -+*** to be unable to reliably create shared libraries on AIX. -+*** Therefore, libtool is disabling shared libraries support. If you -+*** really care for shared libraries, you may want to modify your PATH -+*** so that a non-GNU linker is found, and then restart. -+ -+EOF -+ fi -+ ;; -+ -+ amigaos*) -+ archive_cmds_GCJ='$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_GCJ='-L$libdir' -+ hardcode_minus_L_GCJ=yes -+ -+ # Samuel A. Falvo II reports -+ # that the semantics of dynamic libraries on AmigaOS, at least up -+ # to version 4, is to share data among multiple programs linked -+ # with the same dynamic library. Since this doesn't match the -+ # behavior of shared libraries on other platforms, we can't use -+ # them. -+ ld_shlibs_GCJ=no -+ ;; -+ -+ beos*) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ allow_undefined_flag_GCJ=unsupported -+ # Joseph Beckenbach says some releases of gcc -+ # support --undefined. This deserves some investigation. FIXME -+ archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ else -+ ld_shlibs_GCJ=no -+ fi -+ ;; -+ -+ cygwin* | mingw* | pw32*) -+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, -+ # as there is no search path for DLLs. -+ hardcode_libdir_flag_spec_GCJ='-L$libdir' -+ allow_undefined_flag_GCJ=unsupported -+ always_export_symbols_GCJ=no -+ enable_shared_with_static_runtimes_GCJ=yes -+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' -+ -+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then -+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ # If the export-symbols file already is a .def file (1st line -+ # is EXPORTS), use it as is; otherwise, prepend... -+ archive_expsym_cmds_GCJ='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}--image-base=0x10000000 ${wl}--out-implib,$lib' -+ else -+ ld_shlibs_GCJ=no -+ fi -+ ;; -+ -+ linux*) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ tmp_addflag= -+ case $cc_basename,$host_cpu in -+ pgcc*) # Portland Group C compiler -+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' -+ tmp_addflag=' $pic_flag' -+ ;; -+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers -+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$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' ;; -+ esac -+ archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ -+ if test $supports_anon_versioning = yes; then -+ archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -+ $echo "local: *; };" >> $output_objdir/$libname.ver~ -+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' -+ fi -+ link_all_deplibs_GCJ=no -+ else -+ ld_shlibs_GCJ=no -+ fi -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' -+ wlarc= -+ else -+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ fi -+ ;; -+ -+ solaris* | sysv5*) -+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then -+ ld_shlibs_GCJ=no -+ cat <&2 -+ -+*** Warning: The releases 2.8.* of the GNU linker cannot reliably -+*** create shared libraries on Solaris systems. Therefore, libtool -+*** is disabling shared libraries support. We urge you to upgrade GNU -+*** binutils to release 2.9.1 or newer. Another option is to modify -+*** your PATH or compiler configuration so that the native linker is -+*** used, and then restart. -+ -+EOF -+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ ld_shlibs_GCJ=no -+ fi -+ ;; -+ -+ sunos4*) -+ archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ wlarc= -+ hardcode_direct_GCJ=yes -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ *) -+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then -+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ ld_shlibs_GCJ=no -+ fi -+ ;; -+ esac -+ -+ if test "$ld_shlibs_GCJ" = no; then -+ runpath_var= -+ hardcode_libdir_flag_spec_GCJ= -+ export_dynamic_flag_spec_GCJ= -+ whole_archive_flag_spec_GCJ= -+ fi -+ else -+ # PORTME fill in a description of your system's linker (not GNU ld) -+ case $host_os in -+ aix3*) -+ allow_undefined_flag_GCJ=unsupported -+ always_export_symbols_GCJ=yes -+ archive_expsym_cmds_GCJ='$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_GCJ=yes -+ if test "$GCC" = yes && test -z "$link_static_flag"; then -+ # Neither direct hardcoding nor static linking is supported with a -+ # broken collect2. -+ hardcode_direct_GCJ=unsupported -+ fi -+ ;; -+ -+ aix4* | aix5*) -+ 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 -+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then -+ export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' -+ else -+ export_symbols_cmds_GCJ='$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].*|aix5*) -+ 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_GCJ='' -+ hardcode_direct_GCJ=yes -+ hardcode_libdir_separator_GCJ=':' -+ link_all_deplibs_GCJ=yes -+ -+ 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 -+ hardcode_direct_GCJ=yes -+ else -+ # We have old collect2 -+ hardcode_direct_GCJ=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_GCJ=yes -+ hardcode_libdir_flag_spec_GCJ='-L$libdir' -+ hardcode_libdir_separator_GCJ= -+ 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 -+ -+ # 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_GCJ=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_GCJ='-berok' -+ # Determine the default libpath from the value encoded in an empty executable. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+ -+ hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" -+ archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" -+ else -+ if test "$host_cpu" = ia64; then -+ hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' -+ allow_undefined_flag_GCJ="-z nodefs" -+ archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" -+ else -+ # Determine the default libpath from the value encoded in an empty executable. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ -+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'` -+# Check for a 64-bit object if we didn't find anything. -+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -+}'`; fi -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+ -+ hardcode_libdir_flag_spec_GCJ='${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_GCJ=' ${wl}-bernotok' -+ allow_undefined_flag_GCJ=' ${wl}-berok' -+ # -bexpall does not export symbols beginning with underscore (_) -+ always_export_symbols_GCJ=yes -+ # Exported symbols can be pulled into shared objects from archives -+ whole_archive_flag_spec_GCJ=' ' -+ archive_cmds_need_lc_GCJ=yes -+ # This is similar to how AIX traditionally builds its shared libraries. -+ archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' -+ fi -+ fi -+ ;; -+ -+ amigaos*) -+ archive_cmds_GCJ='$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_GCJ='-L$libdir' -+ hardcode_minus_L_GCJ=yes -+ # see comment about different semantics on the GNU ld section -+ ld_shlibs_GCJ=no -+ ;; -+ -+ bsdi[45]*) -+ export_dynamic_flag_spec_GCJ=-rdynamic -+ ;; -+ -+ cygwin* | mingw* | pw32*) -+ # When not using gcc, we currently assume that we are using -+ # Microsoft Visual C++. -+ # hardcode_libdir_flag_spec is actually meaningless, as there is -+ # no search path for DLLs. -+ hardcode_libdir_flag_spec_GCJ=' ' -+ allow_undefined_flag_GCJ=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_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' -+ # The linker will automatically build a .lib file if we build a DLL. -+ old_archive_From_new_cmds_GCJ='true' -+ # FIXME: Should let the user specify the lib program. -+ old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' -+ fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' -+ enable_shared_with_static_runtimes_GCJ=yes -+ ;; -+ -+ darwin* | rhapsody*) -+ case $host_os in -+ rhapsody* | darwin1.[012]) -+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' -+ ;; -+ *) # Darwin 1.3 on -+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then -+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ else -+ case ${MACOSX_DEPLOYMENT_TARGET} in -+ 10.[012]) -+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' -+ ;; -+ 10.*) -+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' -+ ;; -+ esac -+ fi -+ ;; -+ esac -+ archive_cmds_need_lc_GCJ=no -+ hardcode_direct_GCJ=no -+ hardcode_automatic_GCJ=yes -+ hardcode_shlibpath_var_GCJ=unsupported -+ whole_archive_flag_spec_GCJ='' -+ link_all_deplibs_GCJ=yes -+ if test "$GCC" = yes ; then -+ output_verbose_link_cmd='echo' -+ archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' -+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ else -+ case $cc_basename in -+ xlc*) -+ output_verbose_link_cmd='echo' -+ archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' -+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' -+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds -+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' -+ ;; -+ *) -+ ld_shlibs_GCJ=no -+ ;; -+ esac -+ fi -+ ;; -+ -+ dgux*) -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_libdir_flag_spec_GCJ='-L$libdir' -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ freebsd1*) -+ ld_shlibs_GCJ=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_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' -+ hardcode_libdir_flag_spec_GCJ='-R$libdir' -+ hardcode_direct_GCJ=yes -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ # Unfortunately, older versions of FreeBSD 2 do not have this feature. -+ freebsd2*) -+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_GCJ=yes -+ hardcode_minus_L_GCJ=yes -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. -+ freebsd* | kfreebsd*-gnu | dragonfly*) -+ archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' -+ hardcode_libdir_flag_spec_GCJ='-R$libdir' -+ hardcode_direct_GCJ=yes -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ hpux9*) -+ if test "$GCC" = yes; then -+ archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${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_GCJ='$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_GCJ='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator_GCJ=: -+ hardcode_direct_GCJ=yes -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ hardcode_minus_L_GCJ=yes -+ export_dynamic_flag_spec_GCJ='${wl}-E' -+ ;; -+ -+ hpux10* | hpux11*) -+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*|ia64*) -+ archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ *) -+ archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -+ ;; -+ esac -+ else -+ case $host_cpu in -+ hppa*64*|ia64*) -+ archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ *) -+ archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -+ ;; -+ esac -+ fi -+ if test "$with_gnu_ld" = no; then -+ case $host_cpu in -+ hppa*64*) -+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' -+ hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' -+ hardcode_libdir_separator_GCJ=: -+ hardcode_direct_GCJ=no -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ ia64*) -+ hardcode_libdir_flag_spec_GCJ='-L$libdir' -+ hardcode_direct_GCJ=no -+ hardcode_shlibpath_var_GCJ=no -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ hardcode_minus_L_GCJ=yes -+ ;; -+ *) -+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator_GCJ=: -+ hardcode_direct_GCJ=yes -+ export_dynamic_flag_spec_GCJ='${wl}-E' -+ -+ # hardcode_minus_L: Not really in the search PATH, -+ # but as the default location of the library. -+ hardcode_minus_L_GCJ=yes -+ ;; -+ esac -+ fi -+ ;; -+ -+ irix5* | irix6* | nonstopux*) -+ if test "$GCC" = yes; then -+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' -+ fi -+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_GCJ=: -+ link_all_deplibs_GCJ=yes -+ ;; -+ -+ netbsd* | netbsdelf*-gnu | knetbsd*-gnu) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out -+ else -+ archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF -+ fi -+ hardcode_libdir_flag_spec_GCJ='-R$libdir' -+ hardcode_direct_GCJ=yes -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ newsos6) -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_GCJ=yes -+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_GCJ=: -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ openbsd*) -+ hardcode_direct_GCJ=yes -+ hardcode_shlibpath_var_GCJ=no -+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then -+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' -+ archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' -+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' -+ export_dynamic_flag_spec_GCJ='${wl}-E' -+ else -+ case $host_os in -+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) -+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_libdir_flag_spec_GCJ='-R$libdir' -+ ;; -+ *) -+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' -+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' -+ ;; -+ esac -+ fi -+ ;; -+ -+ os2*) -+ hardcode_libdir_flag_spec_GCJ='-L$libdir' -+ hardcode_minus_L_GCJ=yes -+ allow_undefined_flag_GCJ=unsupported -+ archive_cmds_GCJ='$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_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' -+ ;; -+ -+ osf3*) -+ if test "$GCC" = yes; then -+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ else -+ allow_undefined_flag_GCJ=' -expect_unresolved \*' -+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ fi -+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator_GCJ=: -+ ;; -+ -+ osf4* | osf5*) # as osf3* with the addition of -msym flag -+ if test "$GCC" = yes; then -+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' -+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' -+ else -+ allow_undefined_flag_GCJ=' -expect_unresolved \*' -+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' -+ archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ -+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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_GCJ='-rpath $libdir' -+ fi -+ hardcode_libdir_separator_GCJ=: -+ ;; -+ -+ sco3.2v5*) -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_shlibpath_var_GCJ=no -+ export_dynamic_flag_spec_GCJ='${wl}-Bexport' -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ ;; -+ -+ solaris*) -+ no_undefined_flag_GCJ=' -z text' -+ if test "$GCC" = yes; then -+ wlarc='${wl}' -+ archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' -+ else -+ wlarc='' -+ archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ archive_expsym_cmds_GCJ='$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' -+ fi -+ hardcode_libdir_flag_spec_GCJ='-R$libdir' -+ hardcode_shlibpath_var_GCJ=no -+ case $host_os in -+ solaris2.[0-5] | solaris2.[0-5].*) ;; -+ *) -+ # The compiler driver will combine linker options so we -+ # cannot just pass the convience library names through -+ # without $wl, iff we do not link with $LD. -+ # Luckily, gcc supports the same syntax we need for Sun Studio. -+ # Supported since Solaris 2.6 (maybe 2.5.1?) -+ case $wlarc in -+ '') -+ whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; -+ *) -+ whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; -+ esac ;; -+ esac -+ link_all_deplibs_GCJ=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_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' -+ else -+ archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' -+ fi -+ hardcode_libdir_flag_spec_GCJ='-L$libdir' -+ hardcode_direct_GCJ=yes -+ hardcode_minus_L_GCJ=yes -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ sysv4) -+ case $host_vendor in -+ sni) -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_GCJ=yes # is this really true??? -+ ;; -+ siemens) -+ ## LD is ld it makes a PLAMLIB -+ ## CC just makes a GrossModule. -+ archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' -+ reload_cmds_GCJ='$CC -r -o $output$reload_objs' -+ hardcode_direct_GCJ=no -+ ;; -+ motorola) -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie -+ ;; -+ esac -+ runpath_var='LD_RUN_PATH' -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ sysv4.3*) -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_shlibpath_var_GCJ=no -+ export_dynamic_flag_spec_GCJ='-Bexport' -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_shlibpath_var_GCJ=no -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ ld_shlibs_GCJ=yes -+ fi -+ ;; -+ -+ sysv4.2uw2*) -+ archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_direct_GCJ=yes -+ hardcode_minus_L_GCJ=no -+ hardcode_shlibpath_var_GCJ=no -+ hardcode_runpath_var=yes -+ runpath_var=LD_RUN_PATH -+ ;; -+ -+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) -+ no_undefined_flag_GCJ='${wl}-z ${wl}text' -+ if test "$GCC" = yes; then -+ archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ else -+ archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' -+ fi -+ runpath_var='LD_RUN_PATH' -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ sysv5*) -+ no_undefined_flag_GCJ=' -z text' -+ # $CC -shared without GNU ld will not create a library from C++ -+ # object files and a static libstdc++, better avoid it by now -+ archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ archive_expsym_cmds_GCJ='$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' -+ hardcode_libdir_flag_spec_GCJ= -+ hardcode_shlibpath_var_GCJ=no -+ runpath_var='LD_RUN_PATH' -+ ;; -+ -+ uts4*) -+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' -+ hardcode_libdir_flag_spec_GCJ='-L$libdir' -+ hardcode_shlibpath_var_GCJ=no -+ ;; -+ -+ *) -+ ld_shlibs_GCJ=no -+ ;; -+ esac -+ fi -+ -+echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -+echo "${ECHO_T}$ld_shlibs_GCJ" >&6 -+test "$ld_shlibs_GCJ" = 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 -+ -+# -+# Do we need to explicitly link libc? -+# -+case "x$archive_cmds_need_lc_GCJ" in -+x|xyes) -+ # Assume -lc should be added -+ archive_cmds_need_lc_GCJ=yes -+ -+ if test "$enable_shared" = yes && test "$GCC" = yes; then -+ case $archive_cmds_GCJ 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. -+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 -+ $rm conftest* -+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext -+ -+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } 2>conftest.err; then -+ soname=conftest -+ lib=conftest -+ libobjs=conftest.$ac_objext -+ deplibs= -+ wl=$lt_prog_compiler_wl_GCJ -+ compiler_flags=-v -+ linker_flags=-v -+ verstring= -+ output_objdir=. -+ libname=conftest -+ lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ -+ allow_undefined_flag_GCJ= -+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 -+ (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+ then -+ archive_cmds_need_lc_GCJ=no -+ else -+ archive_cmds_need_lc_GCJ=yes -+ fi -+ allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag -+ else -+ cat conftest.err 1>&5 -+ fi -+ $rm conftest* -+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 -+ ;; -+ esac -+ fi -+ ;; -+esac -+ -+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -+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" -+if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then -+ # 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. -+ 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 -+else -+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -+fi -+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' -+ ;; -+ -+aix4* | aix5*) -+ 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*) -+ library_names_spec='$libname.ixlibrary $libname.a' -+ # Create ${libname}_ixlibrary.a entries in /sys/libs. -+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' -+ ;; -+ -+beos*) -+ library_names_spec='${libname}${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*) -+ version_type=windows -+ shrext_cmds=".dll" -+ need_version=no -+ need_lib_prefix=no -+ -+ case $GCC,$host_os in -+ yes,cygwin* | yes,mingw* | yes,pw32*) -+ 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' -+ 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="/usr/lib /lib/w32api /lib /usr/local/lib" -+ ;; -+ mingw*) -+ # MinGW DLLs use traditional 'lib' prefix -+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' -+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` -+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then -+ # It is most probably a Windows format PATH printed by -+ # mingw gcc, but we are running on Cygwin. Gcc prints its search -+ # path with ; separators, and with drive letters. We can handle the -+ # drive letters (cygwin fileutils understands them), so leave them, -+ # especially as we might pass files found there to a mingw objdump, -+ # which wouldn't understand a cygwinified path. Ahh. -+ 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 -+ ;; -+ 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 -+ ;; -+ -+ *) -+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' -+ ;; -+ esac -+ dynamic_linker='Win32 ld.exe' -+ # 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}${versuffix}$shared_ext ${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`' -+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. -+ if test "$GCC" = yes; then -+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` -+ else -+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' -+ fi -+ 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 -+ ;; -+ -+kfreebsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU ld.so' -+ ;; -+ -+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 -+ ;; -+ *) # from 3.2 on -+ shlibpath_overrides_runpath=no -+ 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 -+ ;; -+ -+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' -+ ;; -+ -+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*) -+ 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 -+ # 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)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' -+ ;; -+ -+netbsdelf*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='NetBSD ld.elf_so' -+ ;; -+ -+knetbsd*-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 -+ shlibpath_overrides_runpath=no -+ hardcode_into_libs=yes -+ dynamic_linker='GNU 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=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 -+ ;; -+ -+openbsd*) -+ version_type=sunos -+ 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" -+ ;; -+ -+sco3.2v5*) -+ version_type=osf -+ 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 -+ ;; -+ -+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.2uw2* | sysv4.3* | sysv5*) -+ 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 -+ export_dynamic_flag_spec='${wl}-Blargedynsym' -+ 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 -+ ;; -+ -+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 -+echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -+echo "${ECHO_T}$dynamic_linker" >&6 -+test "$dynamic_linker" = no && can_build_shared=no -+ -+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -+hardcode_action_GCJ= -+if test -n "$hardcode_libdir_flag_spec_GCJ" || \ -+ test -n "$runpath_var_GCJ" || \ -+ test "X$hardcode_automatic_GCJ" = "Xyes" ; then -+ -+ # We can hardcode non-existant directories. -+ if test "$hardcode_direct_GCJ" != 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_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && -+ test "$hardcode_minus_L_GCJ" != no; then -+ # Linking always hardcodes the temporary library directory. -+ hardcode_action_GCJ=relink -+ else -+ # We can link without hardcoding, and we can hardcode nonexisting dirs. -+ hardcode_action_GCJ=immediate -+ fi -+else -+ # We cannot hardcode anything, or else we can only hardcode existing -+ # directories. -+ hardcode_action_GCJ=unsupported -+fi -+echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -+echo "${ECHO_T}$hardcode_action_GCJ" >&6 -+ -+if test "$hardcode_action_GCJ" = relink; then -+ # Fast installation is not supported -+ enable_fast_install=no -+elif test "$shlibpath_overrides_runpath" = yes || -+ test "$enable_shared" = no; then -+ # Fast installation is not necessary -+ enable_fast_install=needless -+fi -+ -+striplib= -+old_striplib= -+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}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" -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 -+ else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ ;; -+ *) -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+ ;; -+ esac -+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*) -+ 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 -+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -+if test "${ac_cv_lib_dl_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldl $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dl_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dl_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -+if test $ac_cv_lib_dl_dlopen = yes; 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 -+ -+ ;; -+ -+ *) -+ echo "$as_me:$LINENO: checking for shl_load" >&5 -+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -+if test "${ac_cv_func_shl_load+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define shl_load to an innocuous variant, in case declares shl_load. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define shl_load innocuous_shl_load -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char shl_load (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef shl_load -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char shl_load (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_shl_load) || defined (__stub___shl_load) -+choke me -+#else -+char (*f) () = shl_load; -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+int -+main () -+{ -+return f != shl_load; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_shl_load=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_func_shl_load=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -+echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -+if test $ac_cv_func_shl_load = yes; then -+ lt_cv_dlopen="shl_load" -+else -+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -+if test "${ac_cv_lib_dld_shl_load+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char shl_load (); -+int -+main () -+{ -+shl_load (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dld_shl_load=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dld_shl_load=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -+if test $ac_cv_lib_dld_shl_load = yes; then -+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -+else -+ echo "$as_me:$LINENO: checking for dlopen" >&5 -+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -+if test "${ac_cv_func_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define dlopen to an innocuous variant, in case declares dlopen. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define dlopen innocuous_dlopen -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char dlopen (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef dlopen -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_dlopen) || defined (__stub___dlopen) -+choke me -+#else -+char (*f) () = dlopen; -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+int -+main () -+{ -+return f != dlopen; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_func_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -+if test $ac_cv_func_dlopen = yes; then -+ lt_cv_dlopen="dlopen" -+else -+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -+if test "${ac_cv_lib_dl_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldl $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dl_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dl_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -+if test $ac_cv_lib_dl_dlopen = yes; then -+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -+else -+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -+if test "${ac_cv_lib_svld_dlopen+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lsvld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dlopen (); -+int -+main () -+{ -+dlopen (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_svld_dlopen=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_svld_dlopen=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -+if test $ac_cv_lib_svld_dlopen = yes; then -+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -+else -+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -+if test "${ac_cv_lib_dld_dld_link+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-ldld $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char dld_link (); -+int -+main () -+{ -+dld_link (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_dld_dld_link=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_lib_dld_dld_link=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -+if test $ac_cv_lib_dld_dld_link = yes; then -+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -+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" -+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -+ -+ save_LIBS="$LIBS" -+ LIBS="$lt_cv_dlopen_libs $LIBS" -+ -+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -+if test "${lt_cv_dlopen_self+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 < -+#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 -+ -+#ifdef __cplusplus -+extern "C" void exit (int); -+#endif -+ -+void fnord() { int i=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; -+ /* dlclose (self); */ -+ } -+ -+ exit (status); -+} -+EOF -+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && 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_unknown|x*) lt_cv_dlopen_self=no ;; -+ esac -+ else : -+ # compilation failed -+ lt_cv_dlopen_self=no -+ fi -+fi -+rm -fr conftest* -+ -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -+echo "${ECHO_T}$lt_cv_dlopen_self" >&6 -+ -+ if test "x$lt_cv_dlopen_self" = xyes; then -+ LDFLAGS="$LDFLAGS $link_static_flag" -+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -+if test "${lt_cv_dlopen_self_static+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&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 < -+#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 -+ -+#ifdef __cplusplus -+extern "C" void exit (int); -+#endif -+ -+void fnord() { int i=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; -+ /* dlclose (self); */ -+ } -+ -+ exit (status); -+} -+EOF -+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && 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_unknown|x*) lt_cv_dlopen_self_static=no ;; -+ esac -+ else : -+ # compilation failed -+ lt_cv_dlopen_self_static=no -+ fi -+fi -+rm -fr conftest* -+ -+ -+fi -+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 -+ fi -+ -+ CPPFLAGS="$save_CPPFLAGS" -+ LDFLAGS="$save_LDFLAGS" -+ LIBS="$save_LIBS" - ;; -- yes,pw32*) -- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' -+ 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 -+ -+ -+# The else clause should only fire when bootstrapping the -+# libtool distribution, otherwise you forgot to ship ltmain.sh -+# with your package, and you will get complaints that there are -+# no rules to generate ltmain.sh. -+if test -f "$ltmain"; then -+ # 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 -+ # Now quote all the things that may contain metacharacters while being -+ # careful not to overquote the AC_SUBSTed values. We take copies of the -+ # variables and quote the copies for generation of the libtool script. -+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ -+ SED SHELL STRIP \ -+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ -+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ -+ deplibs_check_method reload_flag reload_cmds need_locks \ -+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ -+ lt_cv_sys_global_symbol_to_c_name_address \ -+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -+ old_postinstall_cmds old_postuninstall_cmds \ -+ compiler_GCJ \ -+ CC_GCJ \ -+ LD_GCJ \ -+ lt_prog_compiler_wl_GCJ \ -+ lt_prog_compiler_pic_GCJ \ -+ lt_prog_compiler_static_GCJ \ -+ lt_prog_compiler_no_builtin_flag_GCJ \ -+ export_dynamic_flag_spec_GCJ \ -+ thread_safe_flag_spec_GCJ \ -+ whole_archive_flag_spec_GCJ \ -+ enable_shared_with_static_runtimes_GCJ \ -+ old_archive_cmds_GCJ \ -+ old_archive_from_new_cmds_GCJ \ -+ predep_objects_GCJ \ -+ postdep_objects_GCJ \ -+ predeps_GCJ \ -+ postdeps_GCJ \ -+ compiler_lib_search_path_GCJ \ -+ archive_cmds_GCJ \ -+ archive_expsym_cmds_GCJ \ -+ postinstall_cmds_GCJ \ -+ postuninstall_cmds_GCJ \ -+ old_archive_from_expsyms_cmds_GCJ \ -+ allow_undefined_flag_GCJ \ -+ no_undefined_flag_GCJ \ -+ export_symbols_cmds_GCJ \ -+ hardcode_libdir_flag_spec_GCJ \ -+ hardcode_libdir_flag_spec_ld_GCJ \ -+ hardcode_libdir_separator_GCJ \ -+ hardcode_automatic_GCJ \ -+ module_cmds_GCJ \ -+ module_expsym_cmds_GCJ \ -+ lt_cv_prog_compiler_c_o_GCJ \ -+ exclude_expsyms_GCJ \ -+ include_expsyms_GCJ; do -+ -+ case $var in -+ old_archive_cmds_GCJ | \ -+ old_archive_from_new_cmds_GCJ | \ -+ archive_cmds_GCJ | \ -+ archive_expsym_cmds_GCJ | \ -+ module_cmds_GCJ | \ -+ module_expsym_cmds_GCJ | \ -+ old_archive_from_expsyms_cmds_GCJ | \ -+ export_symbols_cmds_GCJ | \ -+ extract_expsyms_cmds | reload_cmds | finish_cmds | \ -+ postinstall_cmds | postuninstall_cmds | \ -+ old_postinstall_cmds | old_postuninstall_cmds | \ -+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) -+ # Double-quote double-evaled strings. -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" -+ ;; -+ *) -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -+ ;; -+ esac -+ done -+ -+ case $lt_echo in -+ *'\$0 --fallback-echo"') -+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; -- *) -- library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' -+ esac -+ -+cfgfile="$ofile" -+ -+ cat <<__EOF__ >> "$cfgfile" -+# ### BEGIN LIBTOOL TAG CONFIG: $tagname -+ -+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -+ -+# Shell to use when invoking shell scripts. -+SHELL=$lt_SHELL -+ -+# Whether or not to build shared libraries. -+build_libtool_libs=$enable_shared -+ -+# Whether or not to build static libraries. -+build_old_libs=$enable_static -+ -+# Whether or not to add -lc for building shared libraries. -+build_libtool_need_lc=$archive_cmds_need_lc_GCJ -+ -+# Whether or not to disallow shared libs when runtime libs are static -+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ -+ -+# Whether or not to optimize for fast installation. -+fast_install=$enable_fast_install -+ -+# 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 -+ -+# An echo program that does not interpret backslashes. -+echo=$lt_echo -+ -+# The archiver. -+AR=$lt_AR -+AR_FLAGS=$lt_AR_FLAGS -+ -+# A C compiler. -+LTCC=$lt_LTCC -+ -+# A language-specific compiler. -+CC=$lt_compiler_GCJ -+ -+# Is the compiler the GNU C compiler? -+with_gcc=$GCC_GCJ -+ -+# An ERE matcher. -+EGREP=$lt_EGREP -+ -+# The linker used to build libraries. -+LD=$lt_LD_GCJ -+ -+# Whether we need hard or soft links. -+LN_S=$lt_LN_S -+ -+# A BSD-compatible nm program. -+NM=$lt_NM -+ -+# A symbol stripping program -+STRIP=$lt_STRIP -+ -+# Used to examine libraries when file_magic_cmd begins "file" -+MAGIC_CMD=$MAGIC_CMD -+ -+# Used on cygwin: DLL creation program. -+DLLTOOL="$DLLTOOL" -+ -+# Used on cygwin: object dumper. -+OBJDUMP="$OBJDUMP" -+ -+# Used on cygwin: assembler. -+AS="$AS" -+ -+# The name of the directory that contains temporary libtool files. -+objdir=$objdir -+ -+# How to create reloadable object files. -+reload_flag=$lt_reload_flag -+reload_cmds=$lt_reload_cmds -+ -+# How to pass a linker flag through the compiler. -+wl=$lt_lt_prog_compiler_wl_GCJ -+ -+# Object file suffix (normally "o"). -+objext="$ac_objext" -+ -+# Old archive suffix (normally "a"). -+libext="$libext" -+ -+# Shared library suffix (normally ".so"). -+shrext_cmds='$shrext_cmds' -+ -+# Executable file suffix (normally ""). -+exeext="$exeext" -+ -+# Additional compiler flags for building library objects. -+pic_flag=$lt_lt_prog_compiler_pic_GCJ -+pic_mode=$pic_mode -+ -+# What is the maximum length of a command? -+max_cmd_len=$lt_cv_sys_max_cmd_len -+ -+# Does compiler simultaneously support -c and -o options? -+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ -+ -+# Must we lock files when doing compilation? -+need_locks=$lt_need_locks -+ -+# Do we need the lib prefix for modules? -+need_lib_prefix=$need_lib_prefix -+ -+# Do we need a version for libraries? -+need_version=$need_version -+ -+# Whether dlopen is supported. -+dlopen_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 -+ -+# Compiler flag to prevent dynamic linking. -+link_static_flag=$lt_lt_prog_compiler_static_GCJ -+ -+# Compiler flag to turn off builtin functions. -+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ -+ -+# Compiler flag to allow reflexive dlopens. -+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ -+ -+# Compiler flag to generate shared objects directly from archives. -+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ -+ -+# Compiler flag to generate thread-safe objects. -+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ -+ -+# Library versioning type. -+version_type=$version_type -+ -+# 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 -+ -+# Commands used to build and install an old-style archive. -+RANLIB=$lt_RANLIB -+old_archive_cmds=$lt_old_archive_cmds_GCJ -+old_postinstall_cmds=$lt_old_postinstall_cmds -+old_postuninstall_cmds=$lt_old_postuninstall_cmds -+ -+# Create an old-style archive from a shared archive. -+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ -+ -+# Create a temporary old-style archive to link instead of a shared archive. -+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ -+ -+# Commands used to build and install a shared archive. -+archive_cmds=$lt_archive_cmds_GCJ -+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -+postinstall_cmds=$lt_postinstall_cmds -+postuninstall_cmds=$lt_postuninstall_cmds -+ -+# Commands used to build a loadable module (assumed same as above if empty) -+module_cmds=$lt_module_cmds_GCJ -+module_expsym_cmds=$lt_module_expsym_cmds_GCJ -+ -+# Commands to strip libraries. -+old_striplib=$lt_old_striplib -+striplib=$lt_striplib -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predep_objects=$lt_predep_objects_GCJ -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdep_objects=$lt_postdep_objects_GCJ -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predeps=$lt_predeps_GCJ -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdeps=$lt_postdeps_GCJ -+ -+# The library search path used internally by the compiler when linking -+# a shared library. -+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ -+ -+# 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 -+ -+# Flag that allows shared libraries with undefined symbols to be built. -+allow_undefined_flag=$lt_allow_undefined_flag_GCJ -+ -+# Flag that forces no undefined symbols. -+no_undefined_flag=$lt_no_undefined_flag_GCJ -+ -+# Commands used to finish a libtool library installation in a directory. -+finish_cmds=$lt_finish_cmds -+ -+# Same as above, but a single script fragment to be evaled but not shown. -+finish_eval=$lt_finish_eval -+ -+# 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 -+ -+# This is the shared library runtime path variable. -+runpath_var=$runpath_var -+ -+# This is the shared library path variable. -+shlibpath_var=$shlibpath_var -+ -+# Is shlibpath searched before the hard-coded library search path? -+shlibpath_overrides_runpath=$shlibpath_overrides_runpath -+ -+# How to hardcode a shared library path into an executable. -+hardcode_action=$hardcode_action_GCJ -+ -+# Whether we should hardcode library paths into libraries. -+hardcode_into_libs=$hardcode_into_libs -+ -+# 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_GCJ -+ -+# 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_GCJ -+ -+# Whether we need a single -rpath flag with a separated argument. -+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ -+ -+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -+# resulting binary. -+hardcode_direct=$hardcode_direct_GCJ -+ -+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -+# resulting binary. -+hardcode_minus_L=$hardcode_minus_L_GCJ -+ -+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -+# the resulting binary. -+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ -+ -+# 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_GCJ -+ -+# Variables whose values should be saved in libtool wrapper scripts and -+# restored at relink time. -+variables_saved_for_relink="$variables_saved_for_relink" -+ -+# Whether libtool must link a program against all its dependency libraries. -+link_all_deplibs=$link_all_deplibs_GCJ -+ -+# 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 -+ -+# Fix the shell variable \$srcfile for the compiler. -+fix_srcfile_path="$fix_srcfile_path_GCJ" -+ -+# Set to yes if exported symbols are required. -+always_export_symbols=$always_export_symbols_GCJ -+ -+# The commands to list exported symbols. -+export_symbols_cmds=$lt_export_symbols_cmds_GCJ -+ -+# The commands to extract the exported symbol list from a shared archive. -+extract_expsyms_cmds=$lt_extract_expsyms_cmds -+ -+# Symbols that should not be listed in the preloaded symbols. -+exclude_expsyms=$lt_exclude_expsyms_GCJ -+ -+# Symbols that must always be exported. -+include_expsyms=$lt_include_expsyms_GCJ -+ -+# ### END LIBTOOL TAG CONFIG: $tagname -+ -+__EOF__ -+ -+ -+else -+ # If there is no Makefile yet, we rely on a make rule to execute -+ # `config.status --recheck' to rerun these tests and create the -+ # libtool script then. -+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` -+ if test -f "$ltmain_in"; then -+ test -f Makefile && make "$ltmain" -+ fi -+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" -+ -+ else -+ tagname="" -+ fi -+ ;; -+ -+ RC) -+ -+ -+ -+# Source file extension for RC test sources. -+ac_ext=rc -+ -+# Object file extension for compiled RC test sources. -+objext=o -+objext_RC=$objext -+ -+# Code to be used in simple compile tests -+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' -+ -+# Code to be used in simple link tests -+lt_simple_link_test_code="$lt_simple_compile_test_code" -+ -+# ltmain only uses $CC for tagged configurations so make sure $CC is set. -+ -+# If no C compiler was specified, use CC. -+LTCC=${LTCC-"$CC"} -+ -+# Allow CC to be a program name with arguments. -+compiler=$CC -+ -+ -+# save warnings/boilerplate of simple test code -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_compile_test_code" >conftest.$ac_ext -+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_compiler_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ac_outfile=conftest.$ac_objext -+printf "$lt_simple_link_test_code" >conftest.$ac_ext -+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -+_lt_linker_boilerplate=`cat conftest.err` -+$rm conftest* -+ -+ -+# Allow CC to be a program name with arguments. -+lt_save_CC="$CC" -+CC=${RC-"windres"} -+compiler=$CC -+compiler_RC=$CC -+for cc_temp in $compiler""; do -+ case $cc_temp in -+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; -+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; -+ \-*) ;; -+ *) break;; -+ esac -+done -+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -+ -+lt_cv_prog_compiler_c_o_RC=yes -+ -+# The else clause should only fire when bootstrapping the -+# libtool distribution, otherwise you forgot to ship ltmain.sh -+# with your package, and you will get complaints that there are -+# no rules to generate ltmain.sh. -+if test -f "$ltmain"; then -+ # 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 -+ # Now quote all the things that may contain metacharacters while being -+ # careful not to overquote the AC_SUBSTed values. We take copies of the -+ # variables and quote the copies for generation of the libtool script. -+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ -+ SED SHELL STRIP \ -+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ -+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ -+ deplibs_check_method reload_flag reload_cmds need_locks \ -+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ -+ lt_cv_sys_global_symbol_to_c_name_address \ -+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -+ old_postinstall_cmds old_postuninstall_cmds \ -+ compiler_RC \ -+ CC_RC \ -+ LD_RC \ -+ lt_prog_compiler_wl_RC \ -+ lt_prog_compiler_pic_RC \ -+ lt_prog_compiler_static_RC \ -+ lt_prog_compiler_no_builtin_flag_RC \ -+ export_dynamic_flag_spec_RC \ -+ thread_safe_flag_spec_RC \ -+ whole_archive_flag_spec_RC \ -+ enable_shared_with_static_runtimes_RC \ -+ old_archive_cmds_RC \ -+ old_archive_from_new_cmds_RC \ -+ predep_objects_RC \ -+ postdep_objects_RC \ -+ predeps_RC \ -+ postdeps_RC \ -+ compiler_lib_search_path_RC \ -+ archive_cmds_RC \ -+ archive_expsym_cmds_RC \ -+ postinstall_cmds_RC \ -+ postuninstall_cmds_RC \ -+ old_archive_from_expsyms_cmds_RC \ -+ allow_undefined_flag_RC \ -+ no_undefined_flag_RC \ -+ export_symbols_cmds_RC \ -+ hardcode_libdir_flag_spec_RC \ -+ hardcode_libdir_flag_spec_ld_RC \ -+ hardcode_libdir_separator_RC \ -+ hardcode_automatic_RC \ -+ module_cmds_RC \ -+ module_expsym_cmds_RC \ -+ lt_cv_prog_compiler_c_o_RC \ -+ exclude_expsyms_RC \ -+ include_expsyms_RC; do -+ -+ case $var in -+ old_archive_cmds_RC | \ -+ old_archive_from_new_cmds_RC | \ -+ archive_cmds_RC | \ -+ archive_expsym_cmds_RC | \ -+ module_cmds_RC | \ -+ module_expsym_cmds_RC | \ -+ old_archive_from_expsyms_cmds_RC | \ -+ export_symbols_cmds_RC | \ -+ extract_expsyms_cmds | reload_cmds | finish_cmds | \ -+ postinstall_cmds | postuninstall_cmds | \ -+ old_postinstall_cmds | old_postuninstall_cmds | \ -+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) -+ # Double-quote double-evaled strings. -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" -+ ;; -+ *) -+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -+ ;; -+ esac -+ done -+ -+ case $lt_echo in -+ *'\$0 --fallback-echo"') -+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac -- dynamic_linker='Win32 ld.exe' -- # 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 -- # FIXME: Relying on posixy $() will cause problems for -- # cross-compilation, but unfortunately the echo tests do not -- # yet detect zsh echo's removal of \ escapes. -- library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' -- soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' -- shlibpath_overrides_runpath=yes -- shlibpath_var=DYLD_LIBRARY_PATH -- ;; -+cfgfile="$ofile" -+ -+ cat <<__EOF__ >> "$cfgfile" -+# ### BEGIN LIBTOOL TAG CONFIG: $tagname -+ -+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -+ -+# Shell to use when invoking shell scripts. -+SHELL=$lt_SHELL -+ -+# Whether or not to build shared libraries. -+build_libtool_libs=$enable_shared -+ -+# Whether or not to build static libraries. -+build_old_libs=$enable_static -+ -+# Whether or not to add -lc for building shared libraries. -+build_libtool_need_lc=$archive_cmds_need_lc_RC -+ -+# Whether or not to disallow shared libs when runtime libs are static -+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC -+ -+# Whether or not to optimize for fast installation. -+fast_install=$enable_fast_install -+ -+# 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 -+ -+# An echo program that does not interpret backslashes. -+echo=$lt_echo -+ -+# The archiver. -+AR=$lt_AR -+AR_FLAGS=$lt_AR_FLAGS -+ -+# A C compiler. -+LTCC=$lt_LTCC -+ -+# A language-specific compiler. -+CC=$lt_compiler_RC -+ -+# Is the compiler the GNU C compiler? -+with_gcc=$GCC_RC -+ -+# An ERE matcher. -+EGREP=$lt_EGREP -+ -+# The linker used to build libraries. -+LD=$lt_LD_RC -+ -+# Whether we need hard or soft links. -+LN_S=$lt_LN_S -+ -+# A BSD-compatible nm program. -+NM=$lt_NM -+ -+# A symbol stripping program -+STRIP=$lt_STRIP -+ -+# Used to examine libraries when file_magic_cmd begins "file" -+MAGIC_CMD=$MAGIC_CMD -+ -+# Used on cygwin: DLL creation program. -+DLLTOOL="$DLLTOOL" -+ -+# Used on cygwin: object dumper. -+OBJDUMP="$OBJDUMP" -+ -+# Used on cygwin: assembler. -+AS="$AS" -+ -+# The name of the directory that contains temporary libtool files. -+objdir=$objdir -+ -+# How to create reloadable object files. -+reload_flag=$lt_reload_flag -+reload_cmds=$lt_reload_cmds -+ -+# How to pass a linker flag through the compiler. -+wl=$lt_lt_prog_compiler_wl_RC -+ -+# Object file suffix (normally "o"). -+objext="$ac_objext" -+ -+# Old archive suffix (normally "a"). -+libext="$libext" -+ -+# Shared library suffix (normally ".so"). -+shrext_cmds='$shrext_cmds' -+ -+# Executable file suffix (normally ""). -+exeext="$exeext" -+ -+# Additional compiler flags for building library objects. -+pic_flag=$lt_lt_prog_compiler_pic_RC -+pic_mode=$pic_mode -+ -+# What is the maximum length of a command? -+max_cmd_len=$lt_cv_sys_max_cmd_len -+ -+# Does compiler simultaneously support -c and -o options? -+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -+ -+# Must we lock files when doing compilation? -+need_locks=$lt_need_locks -+ -+# Do we need the lib prefix for modules? -+need_lib_prefix=$need_lib_prefix -+ -+# Do we need a version for libraries? -+need_version=$need_version -+ -+# Whether dlopen is supported. -+dlopen_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 -+ -+# Compiler flag to prevent dynamic linking. -+link_static_flag=$lt_lt_prog_compiler_static_RC -+ -+# Compiler flag to turn off builtin functions. -+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC -+ -+# Compiler flag to allow reflexive dlopens. -+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC -+ -+# Compiler flag to generate shared objects directly from archives. -+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC -+ -+# Compiler flag to generate thread-safe objects. -+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC -+ -+# Library versioning type. -+version_type=$version_type -+ -+# 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 -+ -+# Commands used to build and install an old-style archive. -+RANLIB=$lt_RANLIB -+old_archive_cmds=$lt_old_archive_cmds_RC -+old_postinstall_cmds=$lt_old_postinstall_cmds -+old_postuninstall_cmds=$lt_old_postuninstall_cmds -+ -+# Create an old-style archive from a shared archive. -+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC -+ -+# Create a temporary old-style archive to link instead of a shared archive. -+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC -+ -+# Commands used to build and install a shared archive. -+archive_cmds=$lt_archive_cmds_RC -+archive_expsym_cmds=$lt_archive_expsym_cmds_RC -+postinstall_cmds=$lt_postinstall_cmds -+postuninstall_cmds=$lt_postuninstall_cmds -+ -+# Commands used to build a loadable module (assumed same as above if empty) -+module_cmds=$lt_module_cmds_RC -+module_expsym_cmds=$lt_module_expsym_cmds_RC -+ -+# Commands to strip libraries. -+old_striplib=$lt_old_striplib -+striplib=$lt_striplib -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predep_objects=$lt_predep_objects_RC -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdep_objects=$lt_postdep_objects_RC -+ -+# Dependencies to place before the objects being linked to create a -+# shared library. -+predeps=$lt_predeps_RC -+ -+# Dependencies to place after the objects being linked to create a -+# shared library. -+postdeps=$lt_postdeps_RC -+ -+# The library search path used internally by the compiler when linking -+# a shared library. -+compiler_lib_search_path=$lt_compiler_lib_search_path_RC -+ -+# 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 -+ -+# Flag that allows shared libraries with undefined symbols to be built. -+allow_undefined_flag=$lt_allow_undefined_flag_RC -+ -+# Flag that forces no undefined symbols. -+no_undefined_flag=$lt_no_undefined_flag_RC -+ -+# Commands used to finish a libtool library installation in a directory. -+finish_cmds=$lt_finish_cmds -+ -+# Same as above, but a single script fragment to be evaled but not shown. -+finish_eval=$lt_finish_eval -+ -+# 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 - --freebsd1*) -- dynamic_linker=no -- ;; -+# This is the shared library runtime path variable. -+runpath_var=$runpath_var - --freebsd*) -- objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` -- version_type=freebsd-$objformat -- case $version_type in -- freebsd-elf*) -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' -- need_version=no -- need_lib_prefix=no -- ;; -- freebsd-*) -- library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' -- need_version=yes -- ;; -- esac -- shlibpath_var=LD_LIBRARY_PATH -- case $host_os in -- freebsd2*) -- shlibpath_overrides_runpath=yes -- ;; -- *) -- shlibpath_overrides_runpath=no -- hardcode_into_libs=yes -- ;; -- esac -- ;; -+# This is the shared library path variable. -+shlibpath_var=$shlibpath_var - --gnu*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- hardcode_into_libs=yes -- ;; -+# Is shlibpath searched before the hard-coded library search path? -+shlibpath_overrides_runpath=$shlibpath_overrides_runpath - --hpux9* | hpux10* | hpux11*) -- # Give a soname corresponding to the major version so that dld.sl refuses to -- # link against other versions. -- dynamic_linker="$host_os dld.sl" -- version_type=sunos -- need_lib_prefix=no -- need_version=no -- shlibpath_var=SHLIB_PATH -- shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH -- library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' -- soname_spec='${libname}${release}.sl$major' -- # HP-UX runs *really* slowly unless shared libraries are mode 555. -- postinstall_cmds='chmod 555 $lib' -- ;; -+# How to hardcode a shared library path into an executable. -+hardcode_action=$hardcode_action_RC - --irix5* | irix6*) -- version_type=irix -- need_lib_prefix=no -- need_version=no -- soname_spec='${libname}${release}.so$major' -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' -- case $host_os in -- irix5*) -- libsuff= shlibsuff= -- ;; -- *) -- case $LD in # libtool.m4 will add one of these switches to LD -- *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; -- *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; -- *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; -- *) libsuff= shlibsuff= libmagic=never-match;; -- esac -- ;; -- esac -- shlibpath_var=LD_LIBRARY${shlibsuff}_PATH -- shlibpath_overrides_runpath=no -- sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" -- sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" -- ;; -+# Whether we should hardcode library paths into libraries. -+hardcode_into_libs=$hardcode_into_libs - --# No shared lib support for Linux oldld, aout, or coff. --linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) -- dynamic_linker=no -- ;; -+# 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_RC - --# This must be Linux ELF. --linux-gnu*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=no -- # 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 -+# 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_RC - -- # 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' -- ;; -+# Whether we need a single -rpath flag with a separated argument. -+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - --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}.so$versuffix ${libname}.so$versuffix' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' -- dynamic_linker='NetBSD (a.out) ld.so' -- else -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' -- soname_spec='${libname}${release}.so$major' -- dynamic_linker='NetBSD ld.elf_so' -+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -+# resulting binary. -+hardcode_direct=$hardcode_direct_RC -+ -+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -+# resulting binary. -+hardcode_minus_L=$hardcode_minus_L_RC -+ -+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -+# the resulting binary. -+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC -+ -+# 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_RC -+ -+# Variables whose values should be saved in libtool wrapper scripts and -+# restored at relink time. -+variables_saved_for_relink="$variables_saved_for_relink" -+ -+# Whether libtool must link a program against all its dependency libraries. -+link_all_deplibs=$link_all_deplibs_RC -+ -+# 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 -+ -+# Fix the shell variable \$srcfile for the compiler. -+fix_srcfile_path="$fix_srcfile_path_RC" -+ -+# Set to yes if exported symbols are required. -+always_export_symbols=$always_export_symbols_RC -+ -+# The commands to list exported symbols. -+export_symbols_cmds=$lt_export_symbols_cmds_RC -+ -+# The commands to extract the exported symbol list from a shared archive. -+extract_expsyms_cmds=$lt_extract_expsyms_cmds -+ -+# Symbols that should not be listed in the preloaded symbols. -+exclude_expsyms=$lt_exclude_expsyms_RC -+ -+# Symbols that must always be exported. -+include_expsyms=$lt_include_expsyms_RC -+ -+# ### END LIBTOOL TAG CONFIG: $tagname -+ -+__EOF__ -+ -+ -+else -+ # If there is no Makefile yet, we rely on a make rule to execute -+ # `config.status --recheck' to rerun these tests and create the -+ # libtool script then. -+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` -+ if test -f "$ltmain_in"; then -+ test -f Makefile && make "$ltmain" - fi -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- hardcode_into_libs=yes -- ;; -+fi - --newsos6) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- ;; - --openbsd*) -- version_type=sunos -- need_lib_prefix=no -- need_version=no -- 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 -+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" -+ -+ ;; -+ -+ *) -+ { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -+echo "$as_me: error: Unsupported tag name: $tagname" >&2;} -+ { (exit 1); exit 1; }; } -+ ;; -+ esac -+ -+ # Append the new tag name to the list of available tags. -+ if test -n "$tagname" ; then -+ available_tags="$available_tags $tagname" -+ fi -+ fi -+ done -+ IFS="$lt_save_ifs" -+ -+ # Now substitute the updated list of available tags. -+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then -+ mv "${ofile}T" "$ofile" -+ chmod +x "$ofile" - else -- shlibpath_overrides_runpath=yes -+ rm -f "${ofile}T" -+ { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -+echo "$as_me: error: unable to update list of available tagged configurations." >&2;} -+ { (exit 1); exit 1; }; } - fi -- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' -- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- ;; -+fi -+ -+ -+ -+# This can be used to rebuild libtool when needed -+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" -+ -+# Always use our own libtool. -+LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+ -+# Prevent multiple expansion - --os2*) -- libname_spec='$name' -- need_lib_prefix=no -- library_names_spec='$libname.dll $libname.a' -- dynamic_linker='OS/2 ld.exe' -- shlibpath_var=LIBPATH -- ;; - --osf3* | osf4* | osf5*) -- version_type=osf -- need_version=no -- soname_spec='${libname}${release}.so' -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' -- shlibpath_var=LD_LIBRARY_PATH -- 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" -- ;; - --sco3.2v5*) -- version_type=osf -- soname_spec='${libname}${release}.so$major' -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- shlibpath_var=LD_LIBRARY_PATH -- ;; - --solaris*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- hardcode_into_libs=yes -- # ldd complains unless libraries are executable -- postinstall_cmds='chmod +x $lib' -- ;; - --sunos4*) -- version_type=sunos -- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' -- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' -- shlibpath_var=LD_LIBRARY_PATH -- shlibpath_overrides_runpath=yes -- if test "$with_gnu_ld" = yes; then -- need_lib_prefix=no -- fi -- need_version=yes -- ;; - --sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- case $host_vendor in -- sni) -- shlibpath_overrides_runpath=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 -- ;; - --uts4*) -- version_type=linux -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- ;; - --dgux*) -- version_type=linux -- need_lib_prefix=no -- need_version=no -- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -- soname_spec='${libname}${release}.so$major' -- shlibpath_var=LD_LIBRARY_PATH -- ;; - --sysv4*MP*) -- if test -d /usr/nec ;then -- version_type=linux -- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' -- soname_spec='$libname.so.$major' -- shlibpath_var=LD_LIBRARY_PATH -- fi -- ;; - --*) -- dynamic_linker=no -- ;; --esac --echo "$as_me:$LINENO: result: $dynamic_linker" >&5 --echo "${ECHO_T}$dynamic_linker" >&6 --test "$dynamic_linker" = no && can_build_shared=no - --# Report the final consequences. --echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 --echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 --echo "$as_me:$LINENO: result: $can_build_shared" >&5 --echo "${ECHO_T}$can_build_shared" >&6 - --echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 --echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 --test "$can_build_shared" = "no" && enable_shared=no - --# On AIX, shared libraries and static libraries use the same namespace, and --# are all built from PIC. --case "$host_os" in --aix3*) -- test "$enable_shared" = yes && enable_static=no -- if test -n "$RANLIB"; then -- archive_cmds="$archive_cmds~\$RANLIB \$lib" -- postinstall_cmds='$RANLIB $lib' -- fi -- ;; - --aix4*) -- if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then -- test "$enable_shared" = yes && enable_static=no -- fi -- ;; --esac --echo "$as_me:$LINENO: result: $enable_shared" >&5 --echo "${ECHO_T}$enable_shared" >&6 - --echo "$as_me:$LINENO: checking whether to build static libraries" >&5 --echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 --# Make sure either enable_shared or enable_static is yes. --test "$enable_shared" = yes || enable_static=yes --echo "$as_me:$LINENO: result: $enable_static" >&5 --echo "${ECHO_T}$enable_static" >&6 - --if test "$hardcode_action" = relink; then -- # Fast installation is not supported -- enable_fast_install=no --elif test "$shlibpath_overrides_runpath" = yes || -- test "$enable_shared" = no; then -- # Fast installation is not necessary -- enable_fast_install=needless --fi - --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 "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 -- ;; - -- cygwin* | mingw* | pw32*) -- lt_cv_dlopen="LoadLibrary" -- lt_cv_dlopen_libs= -- ;; - -- *) -- echo "$as_me:$LINENO: checking for shl_load" >&5 --echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 --if test "${ac_cv_func_shl_load+set}" = set; then -+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 -+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -+# On Suns, sometimes $CPP names a directory. -+if test -n "$CPP" && test -d "$CPP"; then -+ CPP= -+fi -+if test -z "$CPP"; then -+ if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char shl_load (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char shl_load (); --char (*f) (); -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_shl_load) || defined (__stub___shl_load) --choke me -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#ifdef __STDC__ -+# include - #else --f = shl_load; -+# include - #endif -- -- ; -- return 0; --} -+ Syntax error - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_shl_load=yes -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_shl_load=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ ac_cpp_err=yes - fi --echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 --echo "${ECHO_T}$ac_cv_func_shl_load" >&6 --if test $ac_cv_func_shl_load = yes; then -- lt_cv_dlopen="shl_load" --else -- echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 --echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 --if test "${ac_cv_lib_dld_shl_load+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-ldld $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char shl_load (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --shl_load (); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_dld_shl_load=yes -+if test -z "$ac_cpp_err"; then -+ : - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_dld_shl_load=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 --echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 --if test $ac_cv_lib_dld_shl_load = yes; then -- lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" --else -- echo "$as_me:$LINENO: checking for dlopen" >&5 --echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 --if test "${ac_cv_func_dlopen+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char dlopen (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char dlopen (); --char (*f) (); -+sed 's/^/| /' conftest.$ac_ext >&5 - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_dlopen) || defined (__stub___dlopen) --choke me --#else --f = dlopen; --#endif -+ # Broken: fails on valid input. -+continue -+fi -+rm -f conftest.err conftest.$ac_ext - -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+ # OK, works on sane cases. Now check whether non-existent headers -+ # can be detected and how. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_func_dlopen=yes -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ # Broken: success on invalid input. -+continue - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_dlopen=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ # Passes both tests. -+ac_preproc_ok=: -+break -+fi -+rm -f conftest.err conftest.$ac_ext -+ -+done -+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -+rm -f conftest.err conftest.$ac_ext -+if $ac_preproc_ok; then -+ break - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+ -+ done -+ ac_cv_prog_CPP=$CPP -+ - fi --echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 --echo "${ECHO_T}$ac_cv_func_dlopen" >&6 --if test $ac_cv_func_dlopen = yes; then -- lt_cv_dlopen="dlopen" --else -- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 --echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 --if test "${ac_cv_lib_dl_dlopen+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ CPP=$ac_cv_prog_CPP - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-ldl $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char dlopen (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+ ac_cv_prog_CPP=$CPP -+fi -+echo "$as_me:$LINENO: result: $CPP" >&5 -+echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#ifdef __STDC__ -+# include -+#else -+# include - #endif --int --main () --{ --dlopen (); -- ; -- return 0; --} -+ Syntax error - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_dl_dlopen=yes -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_dl_dlopen=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+ ac_cpp_err=yes - fi --echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 --echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 --if test $ac_cv_lib_dl_dlopen = yes; then -- lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" --else -- echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 --echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 --if test "${ac_cv_lib_svld_dlopen+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+if test -z "$ac_cpp_err"; then -+ : - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lsvld $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char dlopen (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --dlopen (); -- ; -- return 0; --} -+ # Broken: fails on valid input. -+continue -+fi -+rm -f conftest.err conftest.$ac_ext -+ -+ # OK, works on sane cases. Now check whether non-existent headers -+ # can be detected and how. -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_svld_dlopen=yes -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_svld_dlopen=no -+ ac_cpp_err=yes - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+if test -z "$ac_cpp_err"; then -+ # Broken: success on invalid input. -+continue -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ # Passes both tests. -+ac_preproc_ok=: -+break - fi --echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 --echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 --if test $ac_cv_lib_svld_dlopen = yes; then -- lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -+rm -f conftest.err conftest.$ac_ext -+ -+done -+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -+rm -f conftest.err conftest.$ac_ext -+if $ac_preproc_ok; then -+ : - else -- echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 --echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 --if test "${ac_cv_lib_dld_dld_link+set}" = set; then -+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -+See \`config.log' for more details." >&5 -+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } -+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=cc -+ac_cpp='$CXXCPP $CPPFLAGS' -+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -+if test -n "$ac_tool_prefix"; then -+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -+ 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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-ldld $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char dld_link (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --dld_link (); -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_lib_dld_dld_link=yes -+ if test -n "$CXX"; then -+ ac_cv_prog_CXX="$CXX" # Let the user override the test. - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_dld_dld_link=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 --echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 --if test $ac_cv_lib_dld_dld_link = yes; then -- lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" --fi -- -- --fi -- -+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done - - fi -- -- - fi -- -- -+CXX=$ac_cv_prog_CXX -+if test -n "$CXX"; then -+ echo "$as_me:$LINENO: result: $CXX" >&5 -+echo "${ECHO_T}$CXX" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - -- -+ test -n "$CXX" && break -+ done - 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" -- eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -- -- save_LIBS="$LIBS" -- LIBS="$lt_cv_dlopen_libs $LIBS" -- -- echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 --echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 --if test "${lt_cv_dlopen_self+set}" = set; then -+if test -z "$CXX"; then -+ ac_ct_CXX=$CXX -+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -+do -+ # Extract the first word of "$ac_prog", so it can be a program name with args. -+set dummy $ac_prog; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- if test "$cross_compiling" = yes; then : -- lt_cv_dlopen_self=cross -+ if test -n "$ac_ct_CXX"; then -+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. - else -- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 -- lt_status=$lt_dlunknown -- cat > conftest.$ac_ext < --#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 -+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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_ac_ct_CXX="$ac_prog" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done - --/* 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 -+fi -+fi -+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -+if test -n "$ac_ct_CXX"; then -+ echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -+echo "${ECHO_T}$ac_ct_CXX" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi - --#ifdef __cplusplus --extern "C" void exit (int); --#endif -+ test -n "$ac_ct_CXX" && break -+done -+test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - --void fnord() { int i=42;} --int main () --{ -- void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); -- int status = $lt_dlunknown; -+ CXX=$ac_ct_CXX -+fi - -- if (self) -- { -- if (dlsym (self,"fnord")) status = $lt_dlno_uscore; -- else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; -- /* dlclose (self); */ -- } - -- exit (status); --} --EOF -- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+# Provide some information about the compiler. -+echo "$as_me:$LINENO:" \ -+ "checking for C++ compiler version" >&5 -+ac_compiler=`set X $ac_compile; echo $2` -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 -+ (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then -- (./conftest; exit; ) 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_unknown|x*) lt_cv_dlopen_self=no ;; -- esac -- else : -- # compilation failed -- lt_cv_dlopen_self=no -- fi --fi --rm -fr conftest* -- -- --fi --echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 --echo "${ECHO_T}$lt_cv_dlopen_self" >&6 -+ (exit $ac_status); } -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 -+ (eval $ac_compiler -v &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } -+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 -+ (eval $ac_compiler -V &5) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } - -- if test "x$lt_cv_dlopen_self" = xyes; then -- LDFLAGS="$LDFLAGS $link_static_flag" -- echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 --echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 --if test "${lt_cv_dlopen_self_static+set}" = set; then -+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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 < --#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 -- --#ifdef __cplusplus --extern "C" void exit (int); --#endif -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --void fnord() { int i=42;} --int main () -+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; -- /* dlclose (self); */ -- } -+#ifndef __GNUC__ -+ choke me -+#endif - -- exit (status); -+ ; -+ return 0; - } --EOF -- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then -- (./conftest; exit; ) 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_unknown|x*) lt_cv_dlopen_self_static=no ;; -- esac -- else : -- # compilation failed -- lt_cv_dlopen_self_static=no -- fi --fi --rm -fr conftest* -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_compiler_gnu=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_compiler_gnu=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - - fi --echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 --echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 -- fi -+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -+GXX=`test $ac_compiler_gnu = yes && echo yes` -+ac_test_CXXFLAGS=${CXXFLAGS+set} -+ac_save_CXXFLAGS=$CXXFLAGS -+CXXFLAGS="-g" -+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -+if test "${ac_cv_prog_cxx_g+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - -- CPPFLAGS="$save_CPPFLAGS" -- LDFLAGS="$save_LDFLAGS" -- LIBS="$save_LIBS" -- ;; -- esac -+int -+main () -+{ - -- case $lt_cv_dlopen_self in -- yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; -- *) enable_dlopen_self=unknown ;; -- esac -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_prog_cxx_g=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -- case $lt_cv_dlopen_self_static in -- yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; -- *) enable_dlopen_self_static=unknown ;; -- esac -+ac_cv_prog_cxx_g=no - fi -- -- --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. -- echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 --echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 -- if test "${lt_cv_archive_cmds_need_lc+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -+if test "$ac_test_CXXFLAGS" = set; then -+ CXXFLAGS=$ac_save_CXXFLAGS -+elif test $ac_cv_prog_cxx_g = yes; then -+ if test "$GXX" = yes; then -+ CXXFLAGS="-g -O2" -+ else -+ CXXFLAGS="-g" -+ fi - else -- $rm conftest* -- echo 'static int dummy;' > conftest.$ac_ext -+ if test "$GXX" = yes; then -+ CXXFLAGS="-O2" -+ else -+ CXXFLAGS= -+ fi -+fi -+for ac_declaration in \ -+ '' \ -+ 'extern "C" void std::exit (int) throw (); using std::exit;' \ -+ 'extern "C" void std::exit (int); using std::exit;' \ -+ 'extern "C" void exit (int) throw ();' \ -+ 'extern "C" void exit (int);' \ -+ 'void exit (int);' -+do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_declaration -+#include -+int -+main () -+{ -+exit (42); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+continue -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_declaration -+int -+main () -+{ -+exit (42); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; then -- soname=conftest -- lib=conftest -- libobjs=conftest.$ac_objext -- deplibs= -- wl=$lt_cv_prog_cc_wl -- compiler_flags=-v -- linker_flags=-v -- verstring= -- output_objdir=. -- libname=conftest -- save_allow_undefined_flag=$allow_undefined_flag -- allow_undefined_flag= -- if { (eval echo "$as_me:$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 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } -- then -- lt_cv_archive_cmds_need_lc=no -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ break -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+rm -f conftest* -+if test -n "$ac_declaration"; then -+ echo '#ifdef __cplusplus' >>confdefs.h -+ echo $ac_declaration >>confdefs.h -+ echo '#endif' >>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 -+ -+depcc="$CXX" am_compiler_list= -+ -+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then -+ # We make a subdir and do the tests there. Otherwise we can end up -+ # making bogus files that we don't know about and never remove. For -+ # instance it was reported that on HP-UX the gcc test will end up -+ # making a dummy file named `D' -- because `-MD' means `put the output -+ # in D'. -+ mkdir conftest.dir -+ # Copy depcomp to subdir because otherwise we won't find it if we're -+ # using a relative directory. -+ cp "$am_depcomp" conftest.dir -+ cd conftest.dir -+ # We will build objects and dependencies in a subdirectory because -+ # it helps to detect inapplicable dependency modes. For instance -+ # both Tru64's cc and ICC support -MD to output dependencies as a -+ # side effect of compilation, but ICC will put the dependencies in -+ # the current directory while Tru64 will put them in the object -+ # directory. -+ mkdir sub -+ -+ am_cv_CXX_dependencies_compiler_type=none -+ if test "$am_compiler_list" = ""; then -+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` -+ fi -+ for depmode in $am_compiler_list; do -+ # Setup a source with many dependencies, because some compilers -+ # like to wrap large dependency lists on column 80 (with \), and -+ # we should not choose a depcomp mode which is confused by this. -+ # -+ # We need to recreate these files for each test, as the compiler may -+ # overwrite some of them when testing with obscure command lines. -+ # This happens at least with the AIX C compiler. -+ : > sub/conftest.c -+ for i in 1 2 3 4 5 6; do -+ echo '#include "conftst'$i'.h"' >> sub/conftest.c -+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with -+ # Solaris 8's {/usr,}/bin/sh. -+ touch sub/conftst$i.h -+ done -+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf -+ -+ case $depmode in -+ nosideeffect) -+ # after this tag, mechanisms are not by side-effect, so they'll -+ # only be used when explicitly requested -+ if test "x$enable_dependency_tracking" = xyes; then -+ continue - else -- lt_cv_archive_cmds_need_lc=yes -+ break -+ fi -+ ;; -+ none) break ;; -+ esac -+ # We check with `-c' and `-o' for the sake of the "dashmstdout" -+ # mode. It turns out that the SunPro C++ compiler does not properly -+ # handle `-M -o', and we need to detect this. -+ if depmode=$depmode \ -+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ -+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ -+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ -+ >/dev/null 2>conftest.err && -+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && -+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && -+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then -+ # icc doesn't choke on unknown options, it will just issue warnings -+ # or remarks (even with -Werror). So we grep stderr for any message -+ # that says an option was ignored or not supported. -+ # When given -MP, icc 7.0 and 7.1 complain thusly: -+ # icc: Command line warning: ignoring option '-M'; no argument required -+ # The diagnosis changed in icc 8.0: -+ # icc: Command line remark: option '-MP' not supported -+ if (grep 'ignoring option' conftest.err || -+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else -+ am_cv_CXX_dependencies_compiler_type=$depmode -+ break - fi -- allow_undefined_flag=$save_allow_undefined_flag -- else -- cat conftest.err 1>&5 - fi --fi -- -- echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 --echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 -- ;; -- esac --fi --need_lc=${lt_cv_archive_cmds_need_lc-yes} -+ done - --# The second clause should only fire when bootstrapping the --# libtool distribution, otherwise you forgot to ship ltmain.sh --# with your package, and you will get complaints that there are --# no rules to generate ltmain.sh. --if test -f "$ltmain"; then -- : -+ cd .. -+ rm -rf conftest.dir - else -- # If there is no Makefile yet, we rely on a make rule to execute -- # `config.status --recheck' to rerun these tests and create the -- # libtool script then. -- test -f Makefile && make "$ltmain" -+ am_cv_CXX_dependencies_compiler_type=none - fi - --if test -f "$ltmain"; then -- trap "$rm \"${ofile}T\"; exit 1" 1 2 15 -- $rm -f "${ofile}T" -- -- echo creating $ofile -- -- # Now quote all the things that may contain metacharacters while being -- # careful not to overquote the AC_SUBSTed values. We take copies of the -- # variables and quote the copies for generation of the libtool script. -- for var in echo old_CC old_CFLAGS \ -- AR AR_FLAGS CC LD LN_S NM SHELL \ -- reload_flag reload_cmds wl \ -- pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ -- thread_safe_flag_spec whole_archive_flag_spec libname_spec \ -- library_names_spec soname_spec \ -- RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ -- old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ -- postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ -- old_striplib striplib file_magic_cmd export_symbols_cmds \ -- deplibs_check_method allow_undefined_flag no_undefined_flag \ -- finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ -- global_symbol_to_c_name_address \ -- hardcode_libdir_flag_spec hardcode_libdir_separator \ -- sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -- compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do -- -- case $var in -- reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ -- old_postinstall_cmds | old_postuninstall_cmds | \ -- export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ -- extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ -- postinstall_cmds | postuninstall_cmds | \ -- finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) -- # Double-quote double-evaled strings. -- eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" -- ;; -- *) -- eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -- ;; -- esac -- done -+fi -+echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - -- cat <<__EOF__ > "${ofile}T" --#! $SHELL - --# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. --# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) --# NOTE: Changes made to this file will be lost: look at ltmain.sh. --# --# Copyright (C) 1996-2000 Free Software Foundation, Inc. --# Originally by Gordon Matzigkeit , 1996 --# --# This program is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or --# (at your option) any later version. --# --# This program is distributed in the hope that it will be useful, but --# WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --# General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --# --# As a special exception to the GNU General Public License, if you --# distribute this file as part of a program that contains a --# configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. - --# Sed that helps us avoid accidentally triggering echo(1) options like -n. --Xsed="sed -e s/^X//" -+if -+ test "x$enable_dependency_tracking" != xno \ -+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then -+ am__fastdepCXX_TRUE= -+ am__fastdepCXX_FALSE='#' -+else -+ am__fastdepCXX_TRUE='#' -+ am__fastdepCXX_FALSE= -+fi - --# The HP-UX ksh and POSIX shell print the target directory to stdout --# if CDPATH is set. --if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - --# ### BEGIN LIBTOOL CONFIG - --# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -+if test "$cross_compiling" = yes; then -+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot run test program while cross compiling -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --# Shell to use when invoking shell scripts. --SHELL=$lt_SHELL -+#include -+main() -+{ -+#if defined(__GNUC__) && \ -+ ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -+ return 1; -+#endif -+ return 0; -+} - --# Whether or not to build shared libraries. --build_libtool_libs=$enable_shared -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ : -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Whether or not to build static libraries. --build_old_libs=$enable_static -+( exit $ac_status ) -+echo "need at least gcc 2.95 to compile correctly" -+exit 1 -+fi -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi - --# Whether or not to add -lc for building shared libraries. --build_libtool_need_lc=$need_lc -+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -+# for constant arguments. Useless! -+echo "$as_me:$LINENO: checking for working alloca.h" >&5 -+echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 -+if test "${ac_cv_working_alloca_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+char *p = (char *) alloca (2 * sizeof (int)); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_working_alloca_h=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Whether or not to optimize for fast installation. --fast_install=$enable_fast_install -+ac_cv_working_alloca_h=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 -+echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 -+if test $ac_cv_working_alloca_h = yes; then - --# The host system. --host_alias=$host_alias --host=$host -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_ALLOCA_H 1 -+_ACEOF - --# An echo program that does not interpret backslashes. --echo=$lt_echo -+fi - --# The archiver. --AR=$lt_AR --AR_FLAGS=$lt_AR_FLAGS -+echo "$as_me:$LINENO: checking for alloca" >&5 -+echo $ECHO_N "checking for alloca... $ECHO_C" >&6 -+if test "${ac_cv_func_alloca_works+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#ifdef __GNUC__ -+# define alloca __builtin_alloca -+#else -+# ifdef _MSC_VER -+# include -+# define alloca _alloca -+# else -+# if HAVE_ALLOCA_H -+# include -+# else -+# ifdef _AIX -+ #pragma alloca -+# else -+# ifndef alloca /* predefined by HP cc +Olibcalls */ -+char *alloca (); -+# endif -+# endif -+# endif -+# endif -+#endif - --# The default C compiler. --CC=$lt_CC -+int -+main () -+{ -+char *p = (char *) alloca (1); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_func_alloca_works=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Is the compiler the GNU C compiler? --with_gcc=$GCC -+ac_cv_func_alloca_works=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 -+echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 - --# The linker used to build libraries. --LD=$lt_LD -+if test $ac_cv_func_alloca_works = yes; then - --# Whether we need hard or soft links. --LN_S=$lt_LN_S -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_ALLOCA 1 -+_ACEOF - --# A BSD-compatible nm program. --NM=$lt_NM -+else -+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions -+# that cause trouble. Some versions do not even contain alloca or -+# contain a buggy version. If you still want to use their alloca, -+# use ar to extract alloca.o from them instead of compiling alloca.c. - --# A symbol stripping program --STRIP=$STRIP -+ALLOCA=alloca.$ac_objext - --# Used to examine libraries when file_magic_cmd begins "file" --MAGIC_CMD=$MAGIC_CMD -+cat >>confdefs.h <<\_ACEOF -+#define C_ALLOCA 1 -+_ACEOF - --# Used on cygwin: DLL creation program. --DLLTOOL="$DLLTOOL" - --# Used on cygwin: object dumper. --OBJDUMP="$OBJDUMP" -+echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 -+echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 -+if test "${ac_cv_os_cray+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#if defined(CRAY) && ! defined(CRAY2) -+webecray -+#else -+wenotbecray -+#endif - --# Used on cygwin: assembler. --AS="$AS" -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "webecray" >/dev/null 2>&1; then -+ ac_cv_os_cray=yes -+else -+ ac_cv_os_cray=no -+fi -+rm -f conftest* - --# The name of the directory that contains temporary libtool files. --objdir=$objdir -+fi -+echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 -+echo "${ECHO_T}$ac_cv_os_cray" >&6 -+if test $ac_cv_os_cray = yes; then -+ for ac_func in _getb67 GETB67 getb67; do -+ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -+echo "$as_me:$LINENO: checking for $ac_func" >&5 -+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_var+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define $ac_func to an innocuous variant, in case declares $ac_func. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define $ac_func innocuous_$ac_func - --# How to create reloadable object files. --reload_flag=$lt_reload_flag --reload_cmds=$lt_reload_cmds -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char $ac_func (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ - --# How to pass a linker flag through the compiler. --wl=$lt_wl -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif - --# Object file suffix (normally "o"). --objext="$ac_objext" -+#undef $ac_func - --# Old archive suffix (normally "a"). --libext="$libext" -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char $ac_func (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -+choke me -+#else -+char (*f) () = $ac_func; -+#endif -+#ifdef __cplusplus -+} -+#endif - --# Executable file suffix (normally ""). --exeext="$exeext" -+int -+main () -+{ -+return f != $ac_func; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ eval "$as_ac_var=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Additional compiler flags for building library objects. --pic_flag=$lt_pic_flag --pic_mode=$pic_mode -+eval "$as_ac_var=no" -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then - --# Does compiler simultaneously support -c and -o options? --compiler_c_o=$lt_compiler_c_o -+cat >>confdefs.h <<_ACEOF -+#define CRAY_STACKSEG_END $ac_func -+_ACEOF - --# Can we write directly to a .lo ? --compiler_o_lo=$lt_compiler_o_lo -+ break -+fi - --# Must we lock files when doing compilation ? --need_locks=$lt_need_locks -+ done -+fi - --# Do we need the lib prefix for modules? --need_lib_prefix=$need_lib_prefix -+echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 -+echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 -+if test "${ac_cv_c_stack_direction+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test "$cross_compiling" = yes; then -+ ac_cv_c_stack_direction=0 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+int -+find_stack_direction () -+{ -+ static char *addr = 0; -+ auto char dummy; -+ if (addr == 0) -+ { -+ addr = &dummy; -+ return find_stack_direction (); -+ } -+ else -+ return (&dummy > addr) ? 1 : -1; -+} - --# Do we need a version for libraries? --need_version=$need_version -+int -+main () -+{ -+ exit (find_stack_direction () < 0); -+} -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_c_stack_direction=1 -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Whether dlopen is supported. --dlopen_support=$enable_dlopen -+( exit $ac_status ) -+ac_cv_c_stack_direction=-1 -+fi -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+fi -+echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 -+echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 - --# Whether dlopen of programs is supported. --dlopen_self=$enable_dlopen_self -+cat >>confdefs.h <<_ACEOF -+#define STACK_DIRECTION $ac_cv_c_stack_direction -+_ACEOF - --# Whether dlopen of statically linked programs is supported. --dlopen_self_static=$enable_dlopen_self_static - --# Compiler flag to prevent dynamic linking. --link_static_flag=$lt_link_static_flag -+fi - --# Compiler flag to turn off builtin functions. --no_builtin_flag=$lt_no_builtin_flag - --# Compiler flag to allow reflexive dlopens. --export_dynamic_flag_spec=$lt_export_dynamic_flag_spec -+echo "$as_me:$LINENO: checking for getopt_long in -lc" >&5 -+echo $ECHO_N "checking for getopt_long in -lc... $ECHO_C" >&6 -+if test "${ac_cv_lib_c_getopt_long+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lc $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --# Compiler flag to generate shared objects directly from archives. --whole_archive_flag_spec=$lt_whole_archive_flag_spec -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char getopt_long (); -+int -+main () -+{ -+getopt_long (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_c_getopt_long=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Compiler flag to generate thread-safe objects. --thread_safe_flag_spec=$lt_thread_safe_flag_spec -+ac_cv_lib_c_getopt_long=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_c_getopt_long" >&5 -+echo "${ECHO_T}$ac_cv_lib_c_getopt_long" >&6 -+if test $ac_cv_lib_c_getopt_long = yes; then -+ cat >>confdefs.h <<\_ACEOF -+#define HAVE_GETOPT_LONG 1 -+_ACEOF - --# Library versioning type. --version_type=$version_type -+fi - --# 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 -+echo "$as_me:$LINENO: checking for alarm in -lc" >&5 -+echo $ECHO_N "checking for alarm in -lc... $ECHO_C" >&6 -+if test "${ac_cv_lib_c_alarm+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_check_lib_save_LIBS=$LIBS -+LIBS="-lc $LIBS" -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --# The coded name of the library, if different from the real name. --soname_spec=$lt_soname_spec -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char alarm (); -+int -+main () -+{ -+alarm (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_lib_c_alarm=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Commands used to build and install an old-style archive. --RANLIB=$lt_RANLIB --old_archive_cmds=$lt_old_archive_cmds --old_postinstall_cmds=$lt_old_postinstall_cmds --old_postuninstall_cmds=$lt_old_postuninstall_cmds -+ac_cv_lib_c_alarm=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+LIBS=$ac_check_lib_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_lib_c_alarm" >&5 -+echo "${ECHO_T}$ac_cv_lib_c_alarm" >&6 -+if test $ac_cv_lib_c_alarm = yes; then -+ cat >>confdefs.h <<\_ACEOF -+#define HAVE_ALARM 1 -+_ACEOF - --# Create an old-style archive from a shared archive. --old_archive_from_new_cmds=$lt_old_archive_from_new_cmds -+fi - --# 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 and install a shared archive. --archive_cmds=$lt_archive_cmds --archive_expsym_cmds=$lt_archive_expsym_cmds --postinstall_cmds=$lt_postinstall_cmds --postuninstall_cmds=$lt_postuninstall_cmds - --# Commands to strip libraries. --old_striplib=$lt_old_striplib --striplib=$lt_striplib -+for ac_header in netinet/in.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+else -+ # Is the header compilable? -+echo "$as_me:$LINENO: checking $ac_header usability" >&5 -+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+#include <$ac_header> -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_header_compiler=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Method to check whether dependent libraries are shared objects. --deplibs_check_method=$lt_deplibs_check_method -+ac_header_compiler=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -+echo "${ECHO_T}$ac_header_compiler" >&6 - --# Command to use when deplibs_check_method == file_magic. --file_magic_cmd=$lt_file_magic_cmd -+# Is the header present? -+echo "$as_me:$LINENO: checking $ac_header presence" >&5 -+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_header_preproc=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Flag that allows shared libraries with undefined symbols to be built. --allow_undefined_flag=$lt_allow_undefined_flag -+ ac_header_preproc=no -+fi -+rm -f conftest.err conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -+echo "${ECHO_T}$ac_header_preproc" >&6 - --# Flag that forces no undefined symbols. --no_undefined_flag=$lt_no_undefined_flag -+# So? What about this header? -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; -+esac -+echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ eval "$as_ac_Header=\$ac_header_preproc" -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - --# Commands used to finish a libtool library installation in a directory. --finish_cmds=$lt_finish_cmds -+fi -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+_ACEOF - --# Same as above, but a single script fragment to be evaled but not shown. --finish_eval=$lt_finish_eval -+fi - --# Take the output of nm and produce a listing of raw symbols and C names. --global_symbol_pipe=$lt_global_symbol_pipe -+done - --# Transform the output of nm in a proper C declaration --global_symbol_to_cdecl=$lt_global_symbol_to_cdecl - --# Transform the output of nm in a C name address pair --global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address - --# This is the shared library runtime path variable. --runpath_var=$runpath_var -+for ac_header in string.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+else -+ # Is the header compilable? -+echo "$as_me:$LINENO: checking $ac_header usability" >&5 -+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+#include <$ac_header> -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_header_compiler=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# This is the shared library path variable. --shlibpath_var=$shlibpath_var -+ac_header_compiler=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -+echo "${ECHO_T}$ac_header_compiler" >&6 - --# Is shlibpath searched before the hard-coded library search path? --shlibpath_overrides_runpath=$shlibpath_overrides_runpath -+# Is the header present? -+echo "$as_me:$LINENO: checking $ac_header presence" >&5 -+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_header_preproc=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# How to hardcode a shared library path into an executable. --hardcode_action=$hardcode_action -+ ac_header_preproc=no -+fi -+rm -f conftest.err conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -+echo "${ECHO_T}$ac_header_preproc" >&6 - --# Whether we should hardcode library paths into libraries. --hardcode_into_libs=$hardcode_into_libs -+# So? What about this header? -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; -+esac -+echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ eval "$as_ac_Header=\$ac_header_preproc" -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - --# 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 -+fi -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+_ACEOF - --# Whether we need a single -rpath flag with a separated argument. --hardcode_libdir_separator=$lt_hardcode_libdir_separator -+fi - --# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the --# resulting binary. --hardcode_direct=$hardcode_direct -+done - --# 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 - --# Variables whose values should be saved in libtool wrapper scripts and --# restored at relink time. --variables_saved_for_relink="$variables_saved_for_relink" -+for ac_header in libintl.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+else -+ # Is the header compilable? -+echo "$as_me:$LINENO: checking $ac_header usability" >&5 -+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+#include <$ac_header> -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_header_compiler=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Whether libtool must link a program against all its dependency libraries. --link_all_deplibs=$link_all_deplibs -+ac_header_compiler=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -+echo "${ECHO_T}$ac_header_compiler" >&6 - --# Compile-time system search path for libraries --sys_lib_search_path_spec=$lt_sys_lib_search_path_spec -+# Is the header present? -+echo "$as_me:$LINENO: checking $ac_header presence" >&5 -+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_header_preproc=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Run-time system search path for libraries --sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec -+ ac_header_preproc=no -+fi -+rm -f conftest.err conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -+echo "${ECHO_T}$ac_header_preproc" >&6 - --# Fix the shell variable \$srcfile for the compiler. --fix_srcfile_path="$fix_srcfile_path" -+# So? What about this header? -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; -+esac -+echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ eval "$as_ac_Header=\$ac_header_preproc" -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - --# Set to yes if exported symbols are required. --always_export_symbols=$always_export_symbols -+fi -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+_ACEOF - --# The commands to list exported symbols. --export_symbols_cmds=$lt_export_symbols_cmds -+fi - --# The commands to extract the exported symbol list from a shared archive. --extract_expsyms_cmds=$lt_extract_expsyms_cmds -+done - --# 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 -+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -+if test "${ac_cv_c_const+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --# ### END LIBTOOL CONFIG -+int -+main () -+{ -+/* FIXME: Include the comments suggested by Paul. */ -+#ifndef __cplusplus -+ /* Ultrix mips cc rejects this. */ -+ typedef int charset[2]; -+ const charset x; -+ /* SunOS 4.1.1 cc rejects this. */ -+ char const *const *ccp; -+ char **p; -+ /* 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"; -+ ccp = &g + (g ? g-g : 0); -+ /* HPUX 7.0 cc rejects these. */ -+ ++ccp; -+ p = (char**) ccp; -+ ccp = (char const *const *) p; -+ { /* SCO 3.2v4 cc rejects this. */ -+ char *t; -+ char const *s = 0 ? (char *) 0 : (char const *) 0; - --__EOF__ -+ *t++ = 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; -+ } -+#endif - -- case $host_os in -- aix3*) -- cat <<\EOF >> "${ofile}T" -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_c_const=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# 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 -+ac_cv_c_const=no - fi --EOF -- ;; -- esac -- -- case $host_os in -- cygwin* | mingw* | pw32* | os2*) -- cat <<'EOF' >> "${ofile}T" -- # This is a source program that is used to create dlls on Windows -- # Don't remove nor modify the starting and closing comments --# /* ltdll.c starts here */ --# #define WIN32_LEAN_AND_MEAN --# #include --# #undef WIN32_LEAN_AND_MEAN --# #include --# --# #ifndef __CYGWIN__ --# # ifdef __CYGWIN32__ --# # define __CYGWIN__ __CYGWIN32__ --# # endif --# #endif --# --# #ifdef __cplusplus --# extern "C" { --# #endif --# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); --# #ifdef __cplusplus --# } --# #endif --# --# #ifdef __CYGWIN__ --# #include --# DECLARE_CYGWIN_DLL( DllMain ); --# #endif --# HINSTANCE __hDllInstance_base; --# --# BOOL APIENTRY --# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) --# { --# __hDllInstance_base = hInst; --# return TRUE; --# } --# /* ltdll.c ends here */ -- # This is a source program that is used to create import libraries -- # on Windows for dlls which lack them. Don't remove nor modify the -- # starting and closing comments --# /* impgen.c starts here */ --# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. --# --# This file is part of GNU libtool. --# --# This program is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or --# (at your option) any later version. --# --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --# */ --# --# #include /* for printf() */ --# #include /* for open(), lseek(), read() */ --# #include /* for O_RDONLY, O_BINARY */ --# #include /* for strdup() */ --# --# /* O_BINARY isn't required (or even defined sometimes) under Unix */ --# #ifndef O_BINARY --# #define O_BINARY 0 --# #endif --# --# static unsigned int --# pe_get16 (fd, offset) --# int fd; --# int offset; --# { --# unsigned char b[2]; --# lseek (fd, offset, SEEK_SET); --# read (fd, b, 2); --# return b[0] + (b[1]<<8); --# } --# --# static unsigned int --# pe_get32 (fd, offset) --# int fd; --# int offset; --# { --# unsigned char b[4]; --# lseek (fd, offset, SEEK_SET); --# read (fd, b, 4); --# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); --# } --# --# static unsigned int --# pe_as32 (ptr) --# void *ptr; --# { --# unsigned char *b = ptr; --# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); --# } --# --# int --# main (argc, argv) --# int argc; --# char *argv[]; --# { --# int dll; --# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; --# unsigned long export_rva, export_size, nsections, secptr, expptr; --# unsigned long name_rvas, nexp; --# unsigned char *expdata, *erva; --# char *filename, *dll_name; --# --# filename = argv[1]; --# --# dll = open(filename, O_RDONLY|O_BINARY); --# if (dll < 1) --# return 1; --# --# dll_name = filename; --# --# for (i=0; filename[i]; i++) --# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') --# dll_name = filename + i +1; --# --# pe_header_offset = pe_get32 (dll, 0x3c); --# opthdr_ofs = pe_header_offset + 4 + 20; --# num_entries = pe_get32 (dll, opthdr_ofs + 92); --# --# if (num_entries < 1) /* no exports */ --# return 1; --# --# export_rva = pe_get32 (dll, opthdr_ofs + 96); --# export_size = pe_get32 (dll, opthdr_ofs + 100); --# nsections = pe_get16 (dll, pe_header_offset + 4 +2); --# secptr = (pe_header_offset + 4 + 20 + --# pe_get16 (dll, pe_header_offset + 4 + 16)); --# --# expptr = 0; --# for (i = 0; i < nsections; i++) --# { --# char sname[8]; --# unsigned long secptr1 = secptr + 40 * i; --# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); --# unsigned long vsize = pe_get32 (dll, secptr1 + 16); --# unsigned long fptr = pe_get32 (dll, secptr1 + 20); --# lseek(dll, secptr1, SEEK_SET); --# read(dll, sname, 8); --# if (vaddr <= export_rva && vaddr+vsize > export_rva) --# { --# expptr = fptr + (export_rva - vaddr); --# if (export_rva + export_size > vaddr + vsize) --# export_size = vsize - (export_rva - vaddr); --# break; --# } --# } --# --# expdata = (unsigned char*)malloc(export_size); --# lseek (dll, expptr, SEEK_SET); --# read (dll, expdata, export_size); --# erva = expdata - export_rva; --# --# nexp = pe_as32 (expdata+24); --# name_rvas = pe_as32 (expdata+32); --# --# printf ("EXPORTS\n"); --# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) -- -- mv -f "${ofile}T" "$ofile" || \ -- (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") -- chmod +x "$ofile" -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -+echo "${ECHO_T}$ac_cv_c_const" >&6 -+if test $ac_cv_c_const = no; then - -+cat >>confdefs.h <<\_ACEOF -+#define const -+_ACEOF - -+fi - - -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - --# This can be used to rebuild libtool when needed --LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" -- --# Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -- --# Prevent multiple expansion -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "vsnprintf" >/dev/null 2>&1; then -+ cat >>confdefs.h <<\_ACEOF -+#define HAVE_VSNPRINTF 1 -+_ACEOF - -+fi -+rm -f conftest* - - --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 --echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 --echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 --# On Suns, sometimes $CPP names a directory. --if test -n "$CPP" && test -d "$CPP"; then -- CPP= --fi --if test -z "$CPP"; then -- if test "${ac_cv_prog_CPP+set}" = set; then -+echo "$as_me:$LINENO: checking for unsigned short int" >&5 -+echo $ECHO_N "checking for unsigned short int... $ECHO_C" >&6 -+if test "${ac_cv_type_unsigned_short_int+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&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. -- # 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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -- Syntax error -+/* confdefs.h. */ - _ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+if ((unsigned short int *) 0) -+ return 0; -+if (sizeof (unsigned short int)) -+ return 0; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- : -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_type_unsigned_short_int=yes - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- # Broken: fails on valid input. --continue -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_type_unsigned_short_int=no - fi --rm -f conftest.err conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short_int" >&5 -+echo "${ECHO_T}$ac_cv_type_unsigned_short_int" >&6 - -- # OK, works on sane cases. Now check whether non-existent headers -- # can be detected and how. -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -+echo "$as_me:$LINENO: checking size of unsigned short int" >&5 -+echo $ECHO_N "checking size of unsigned short int... $ECHO_C" >&6 -+if test "${ac_cv_sizeof_unsigned_short_int+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test "$ac_cv_type_unsigned_short_int" = yes; then -+ # The cast to unsigned long works around a bug in the HP C Compiler -+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -+ # This bug is HP SR number 8606223364. -+ if test "$cross_compiling" = yes; then -+ # Depending upon the size, compute the lo and hi bounds. -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) >= 0)]; -+test_array [0] = 0 -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- # Broken: success on invalid input. --continue -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=0 ac_mid=0 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) <= $ac_mid)]; -+test_array [0] = 0 -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid; break - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- # Passes both tests. --ac_preproc_ok=: --break --fi --rm -f conftest.err conftest.$ac_ext -+sed 's/^/| /' conftest.$ac_ext >&5 - --done --# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. --rm -f conftest.err conftest.$ac_ext --if $ac_preproc_ok; then -- break -+ac_lo=`expr $ac_mid + 1` -+ if test $ac_lo -le $ac_mid; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid + 1` - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -- done -- ac_cv_prog_CPP=$CPP -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) < 0)]; -+test_array [0] = 0 - --fi -- CPP=$ac_cv_prog_CPP --else -- ac_cv_prog_CPP=$CPP --fi --echo "$as_me:$LINENO: result: $CPP" >&5 --echo "${ECHO_T}$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. -- # 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 >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -- Syntax error -+ ; -+ return 0; -+} - _ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- : --else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- # Broken: fails on valid input. --continue --fi --rm -f conftest.err conftest.$ac_ext -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=-1 ac_mid=-1 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) >= $ac_mid)]; -+test_array [0] = 0 - -- # OK, works on sane cases. Now check whether non-existent headers -- # can be detected and how. -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -+ ; -+ return 0; -+} - _ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- # Broken: success on invalid input. --continue -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=$ac_mid; break - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- # Passes both tests. --ac_preproc_ok=: --break --fi --rm -f conftest.err conftest.$ac_ext -- --done --# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. --rm -f conftest.err conftest.$ac_ext --if $ac_preproc_ok; then -- : --else -- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 --echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} -- { (exit 1); exit 1; }; } --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=cc --ac_cpp='$CXXCPP $CPPFLAGS' --ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' --ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' --ac_compiler_gnu=$ac_cv_cxx_compiler_gnu --if test -n "$ac_tool_prefix"; then -- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -- 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 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_CXX+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$CXX"; then -- ac_cv_prog_CXX="$CXX" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done --done -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_hi=`expr '(' $ac_mid ')' - 1` -+ if test $ac_mid -le $ac_hi; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid` - fi --fi --CXX=$ac_cv_prog_CXX --if test -n "$CXX"; then -- echo "$as_me:$LINENO: result: $CXX" >&5 --echo "${ECHO_T}$CXX" >&6 --else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- test -n "$CXX" && break -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done --fi --if test -z "$CXX"; then -- ac_ct_CXX=$CXX -- for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC --do -- # Extract the first word of "$ac_prog", so it can be a program name with args. --set dummy $ac_prog; ac_word=$2 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -n "$ac_ct_CXX"; then -- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_ac_ct_CXX="$ac_prog" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done --done -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo= ac_hi= - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --ac_ct_CXX=$ac_cv_prog_ac_ct_CXX --if test -n "$ac_ct_CXX"; then -- echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 --echo "${ECHO_T}$ac_ct_CXX" >&6 --else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- test -n "$ac_ct_CXX" && break --done --test -n "$ac_ct_CXX" || ac_ct_CXX="g++" -- -- CXX=$ac_ct_CXX --fi -- -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+# Binary search between lo and hi bounds. -+while test "x$ac_lo" != "x$ac_hi"; do -+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) <= $ac_mid)]; -+test_array [0] = 0 - --# Provide some information about the compiler. --echo "$as_me:$LINENO:" \ -- "checking for C++ compiler version" >&5 --ac_compiler=`set X $ac_compile; echo $2` --{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 -- (eval $ac_compiler --version &5) 2>&5 -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } --{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 -- (eval $ac_compiler -v &5) 2>&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } --{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 -- (eval $ac_compiler -V &5) 2>&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 --echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 --if test "${ac_cv_cxx_compiler_gnu+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ac_lo=`expr '(' $ac_mid ')' + 1` -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+case $ac_lo in -+?*) ac_cv_sizeof_unsigned_short_int=$ac_lo;; -+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short int), 77 -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute sizeof (unsigned short int), 77 -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } ;; -+esac -+else -+ if test "$cross_compiling" = yes; then -+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -+echo "$as_me: error: internal error: not reached in cross-compile" >&2;} -+ { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+long longval () { return (long) (sizeof (unsigned short int)); } -+unsigned long ulongval () { return (long) (sizeof (unsigned short int)); } -+#include -+#include - int - main () - { --#ifndef __GNUC__ -- choke me --#endif -+ -+ FILE *f = fopen ("conftest.val", "w"); -+ if (! f) -+ exit (1); -+ if (((long) (sizeof (unsigned short int))) < 0) -+ { -+ long i = longval (); -+ if (i != ((long) (sizeof (unsigned short int)))) -+ exit (1); -+ fprintf (f, "%ld\n", i); -+ } -+ else -+ { -+ unsigned long i = ulongval (); -+ if (i != ((long) (sizeof (unsigned short int)))) -+ exit (1); -+ fprintf (f, "%lu\n", i); -+ } -+ exit (ferror (f) || fclose (f) != 0); - - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_compiler_gnu=yes -+ ac_cv_sizeof_unsigned_short_int=`cat conftest.val` - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_compiler_gnu=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --ac_cv_cxx_compiler_gnu=$ac_compiler_gnu -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+( exit $ac_status ) -+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short int), 77 -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute sizeof (unsigned short int), 77 -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } - fi --echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 --echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 --GXX=`test $ac_compiler_gnu = yes && echo yes` --ac_test_CXXFLAGS=${CXXFLAGS+set} --ac_save_CXXFLAGS=$CXXFLAGS --CXXFLAGS="-g" --echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 --echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 --if test "${ac_cv_prog_cxx_g+set}" = set; then -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+fi -+rm -f conftest.val -+else -+ ac_cv_sizeof_unsigned_short_int=0 -+fi -+fi -+echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_short_int" >&5 -+echo "${ECHO_T}$ac_cv_sizeof_unsigned_short_int" >&6 -+cat >>confdefs.h <<_ACEOF -+#define SIZEOF_UNSIGNED_SHORT_INT $ac_cv_sizeof_unsigned_short_int -+_ACEOF -+ -+ -+echo "$as_me:$LINENO: checking for unsigned long int" >&5 -+echo $ECHO_N "checking for unsigned long int... $ECHO_C" >&6 -+if test "${ac_cv_type_unsigned_long_int+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { -- -+if ((unsigned long int *) 0) -+ return 0; -+if (sizeof (unsigned long int)) -+ return 0; - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_prog_cxx_g=yes -+ ac_cv_type_unsigned_long_int=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_prog_cxx_g=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_type_unsigned_long_int=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 --echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 --if test "$ac_test_CXXFLAGS" = set; then -- CXXFLAGS=$ac_save_CXXFLAGS --elif test $ac_cv_prog_cxx_g = yes; then -- if test "$GXX" = yes; then -- CXXFLAGS="-g -O2" -- else -- CXXFLAGS="-g" -- fi -+echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_int" >&5 -+echo "${ECHO_T}$ac_cv_type_unsigned_long_int" >&6 -+ -+echo "$as_me:$LINENO: checking size of unsigned long int" >&5 -+echo $ECHO_N "checking size of unsigned long int... $ECHO_C" >&6 -+if test "${ac_cv_sizeof_unsigned_long_int+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- if test "$GXX" = yes; then -- CXXFLAGS="-O2" -- else -- CXXFLAGS= -- fi --fi --for ac_declaration in \ -- ''\ -- '#include ' \ -- 'extern "C" void std::exit (int) throw (); using std::exit;' \ -- 'extern "C" void std::exit (int); using std::exit;' \ -- 'extern "C" void exit (int) throw ();' \ -- 'extern "C" void exit (int);' \ -- 'void exit (int);' --do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include --$ac_declaration --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ if test "$ac_cv_type_unsigned_long_int" = yes; then -+ # The cast to unsigned long works around a bug in the HP C Compiler -+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -+ # This bug is HP SR number 8606223364. -+ if test "$cross_compiling" = yes; then -+ # Depending upon the size, compute the lo and hi bounds. -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { --exit (42); -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) >= 0)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --continue --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_declaration --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ ac_lo=0 ac_mid=0 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { --exit (42); -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) <= $ac_mid)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- break -+ ac_hi=$ac_mid; break - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext conftest.$ac_ext --done --rm -f conftest* --if test -n "$ac_declaration"; then -- echo '#ifdef __cplusplus' >>confdefs.h -- echo $ac_declaration >>confdefs.h -- echo '#endif' >>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 -- --depcc="$CXX" am_compiler_list= -- --echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 --echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 --if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then -- # We make a subdir and do the tests there. Otherwise we can end up -- # making bogus files that we don't know about and never remove. For -- # instance it was reported that on HP-UX the gcc test will end up -- # making a dummy file named `D' -- because `-MD' means `put the output -- # in D'. -- mkdir conftest.dir -- # Copy depcomp to subdir because otherwise we won't find it if we're -- # using a relative directory. -- cp "$am_depcomp" conftest.dir -- cd conftest.dir -- -- am_cv_CXX_dependencies_compiler_type=none -- if test "$am_compiler_list" = ""; then -- am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` -- fi -- for depmode in $am_compiler_list; do -- # We need to recreate these files for each test, as the compiler may -- # overwrite some of them when testing with obscure command lines. -- # This happens at least with the AIX C compiler. -- echo '#include "conftest.h"' > conftest.c -- echo 'int i;' > conftest.h -- echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf -- -- case $depmode in -- nosideeffect) -- # after this tag, mechanisms are not by side-effect, so they'll -- # only be used when explicitly requested -- if test "x$enable_dependency_tracking" = xyes; then -- continue -- else -- break -- fi -- ;; -- none) break ;; -- esac -- # We check with `-c' and `-o' for the sake of the "dashmstdout" -- # mode. It turns out that the SunPro C++ compiler does not properly -- # handle `-M -o', and we need to detect this. -- if depmode=$depmode \ -- source=conftest.c object=conftest.o \ -- depfile=conftest.Po tmpdepfile=conftest.TPo \ -- $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && -- grep conftest.h conftest.Po > /dev/null 2>&1 && -- ${MAKE-make} -s -f confmf > /dev/null 2>&1; then -- am_cv_CXX_dependencies_compiler_type=$depmode -- break -- fi -- done -- -- cd .. -- rm -rf conftest.dir --else -- am_cv_CXX_dependencies_compiler_type=none --fi -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo=`expr $ac_mid + 1` -+ if test $ac_lo -le $ac_mid; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid + 1` - fi --echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 --echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 --CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type -- -- -- --if test "$cross_compiling" = yes; then -- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 --echo "$as_me: error: cannot run test program while cross compiling" >&2;} -- { (exit 1); exit 1; }; } -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --#include --main() --{ --#if defined(__GNUC__) && \ -- ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -- return 1; --#endif -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) < 0)]; -+test_array [0] = 0 -+ -+ ; - return 0; - } -- - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- : --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --( exit $ac_status ) --echo "need at least gcc 2.95 to compile correctly" --exit 1 --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -- --# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works --# for constant arguments. Useless! --echo "$as_me:$LINENO: checking for working alloca.h" >&5 --echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 --if test "${ac_cv_working_alloca_h+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ ac_hi=-1 ac_mid=-1 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { --char *p = (char *) alloca (2 * sizeof (int)); -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) >= $ac_mid)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_working_alloca_h=yes -+ ac_lo=$ac_mid; break - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_working_alloca_h=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 --echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 --if test $ac_cv_working_alloca_h = yes; then -- --cat >>confdefs.h <<\_ACEOF --#define HAVE_ALLOCA_H 1 --_ACEOF -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_hi=`expr '(' $ac_mid ')' - 1` -+ if test $ac_mid -le $ac_hi; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid` - fi -- --echo "$as_me:$LINENO: checking for alloca" >&5 --echo $ECHO_N "checking for alloca... $ECHO_C" >&6 --if test "${ac_cv_func_alloca_works+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#ifdef __GNUC__ --# define alloca __builtin_alloca --#else --# ifdef _MSC_VER --# include --# define alloca _alloca --# else --# if HAVE_ALLOCA_H --# include --# else --# ifdef _AIX -- #pragma alloca --# else --# ifndef alloca /* predefined by HP cc +Olibcalls */ --char *alloca (); --# endif --# endif --# endif --# endif --#endif -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ac_lo= ac_hi= -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+# Binary search between lo and hi bounds. -+while test "x$ac_lo" != "x$ac_hi"; do -+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { --char *p = (char *) alloca (1); -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) <= $ac_mid)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_alloca_works=yes -+ ac_hi=$ac_mid - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_func_alloca_works=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 --echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 -- --if test $ac_cv_func_alloca_works = yes; then -- --cat >>confdefs.h <<\_ACEOF --#define HAVE_ALLOCA 1 --_ACEOF -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo=`expr '(' $ac_mid ')' + 1` -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+case $ac_lo in -+?*) ac_cv_sizeof_unsigned_long_int=$ac_lo;; -+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long int), 77 -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute sizeof (unsigned long int), 77 -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } ;; -+esac - else -- # The SVR3 libPW and SVR4 libucb both contain incompatible functions --# that cause trouble. Some versions do not even contain alloca or --# contain a buggy version. If you still want to use their alloca, --# use ar to extract alloca.o from them instead of compiling alloca.c. -- --ALLOCA=alloca.$ac_objext -- --cat >>confdefs.h <<\_ACEOF --#define C_ALLOCA 1 --_ACEOF -- -- --echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 --echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 --if test "${ac_cv_os_cray+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ if test "$cross_compiling" = yes; then -+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -+echo "$as_me: error: internal error: not reached in cross-compile" >&2;} -+ { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#if defined(CRAY) && ! defined(CRAY2) --webecray --#else --wenotbecray --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+long longval () { return (long) (sizeof (unsigned long int)); } -+unsigned long ulongval () { return (long) (sizeof (unsigned long int)); } -+#include -+#include -+int -+main () -+{ -+ -+ FILE *f = fopen ("conftest.val", "w"); -+ if (! f) -+ exit (1); -+ if (((long) (sizeof (unsigned long int))) < 0) -+ { -+ long i = longval (); -+ if (i != ((long) (sizeof (unsigned long int)))) -+ exit (1); -+ fprintf (f, "%ld\n", i); -+ } -+ else -+ { -+ unsigned long i = ulongval (); -+ if (i != ((long) (sizeof (unsigned long int)))) -+ exit (1); -+ fprintf (f, "%lu\n", i); -+ } -+ exit (ferror (f) || fclose (f) != 0); - -+ ; -+ return 0; -+} - _ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- egrep "webecray" >/dev/null 2>&1; then -- ac_cv_os_cray=yes -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_sizeof_unsigned_long_int=`cat conftest.val` - else -- ac_cv_os_cray=no --fi --rm -f conftest* -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+( exit $ac_status ) -+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long int), 77 -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute sizeof (unsigned long int), 77 -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } - fi --echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 --echo "${ECHO_T}$ac_cv_os_cray" >&6 --if test $ac_cv_os_cray = yes; then -- for ac_func in _getb67 GETB67 getb67; do -- as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:$LINENO: checking for $ac_func" >&5 --echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 --if eval "test \"\${$as_ac_var+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+fi -+rm -f conftest.val - else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char $ac_func (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char $ac_func (); --char (*f) (); -+ ac_cv_sizeof_unsigned_long_int=0 -+fi -+fi -+echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long_int" >&5 -+echo "${ECHO_T}$ac_cv_sizeof_unsigned_long_int" >&6 -+cat >>confdefs.h <<_ACEOF -+#define SIZEOF_UNSIGNED_LONG_INT $ac_cv_sizeof_unsigned_long_int -+_ACEOF - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ -+echo "$as_me:$LINENO: checking for unsigned int" >&5 -+echo $ECHO_N "checking for unsigned int... $ECHO_C" >&6 -+if test "${ac_cv_type_unsigned_int+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_$ac_func) || defined (__stub___$ac_func) --choke me --#else --f = $ac_func; --#endif -- -+if ((unsigned int *) 0) -+ return 0; -+if (sizeof (unsigned int)) -+ return 0; - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_var=yes" -+ ac_cv_type_unsigned_int=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --eval "$as_ac_var=no" --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 --if test `eval echo '${'$as_ac_var'}'` = yes; then -- --cat >>confdefs.h <<_ACEOF --#define CRAY_STACKSEG_END $ac_func --_ACEOF -+sed 's/^/| /' conftest.$ac_ext >&5 - -- break -+ac_cv_type_unsigned_int=no - fi -- -- done -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -+echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_int" >&5 -+echo "${ECHO_T}$ac_cv_type_unsigned_int" >&6 - --echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 --echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 --if test "${ac_cv_c_stack_direction+set}" = set; then -+echo "$as_me:$LINENO: checking size of unsigned int" >&5 -+echo $ECHO_N "checking size of unsigned int... $ECHO_C" >&6 -+if test "${ac_cv_sizeof_unsigned_int+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -+ if test "$ac_cv_type_unsigned_int" = yes; then -+ # The cast to unsigned long works around a bug in the HP C Compiler -+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -+ # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then -- ac_cv_c_stack_direction=0 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ # Depending upon the size, compute the lo and hi bounds. -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int --find_stack_direction () -+main () - { -- static char *addr = 0; -- auto char dummy; -- if (addr == 0) -- { -- addr = &dummy; -- return find_stack_direction (); -- } -- else -- return (&dummy > addr) ? 1 : -1; --} -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) >= 0)]; -+test_array [0] = 0 - -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=0 ac_mid=0 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { -- exit (find_stack_direction () < 0); -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) <= $ac_mid)]; -+test_array [0] = 0 -+ -+ ; -+ return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_c_stack_direction=1 -+ ac_hi=$ac_mid; break - else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --( exit $ac_status ) --ac_cv_c_stack_direction=-1 --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi --fi --echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 --echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 -- --cat >>confdefs.h <<_ACEOF --#define STACK_DIRECTION $ac_cv_c_stack_direction --_ACEOF -- -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo=`expr $ac_mid + 1` -+ if test $ac_lo -le $ac_mid; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid + 1` - fi -- -- --echo "$as_me:$LINENO: checking for getopt_long in -lc" >&5 --echo $ECHO_N "checking for getopt_long in -lc... $ECHO_C" >&6 --if test "${ac_cv_lib_c_getopt_long+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lc $LIBS" -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) < 0)]; -+test_array [0] = 0 - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char getopt_long (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=-1 ac_mid=-1 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { --getopt_long (); -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) >= $ac_mid)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_c_getopt_long=yes -+ ac_lo=$ac_mid; break - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_c_getopt_long=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:$LINENO: result: $ac_cv_lib_c_getopt_long" >&5 --echo "${ECHO_T}$ac_cv_lib_c_getopt_long" >&6 --if test $ac_cv_lib_c_getopt_long = yes; then -- cat >>confdefs.h <<\_ACEOF --#define HAVE_GETOPT_LONG 1 --_ACEOF -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_hi=`expr '(' $ac_mid ')' - 1` -+ if test $ac_mid -le $ac_hi; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid` - fi -- -- --echo "$as_me:$LINENO: checking for alarm in -lc" >&5 --echo $ECHO_N "checking for alarm in -lc... $ECHO_C" >&6 --if test "${ac_cv_lib_c_alarm+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lc $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char alarm (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ac_lo= ac_hi= -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+# Binary search between lo and hi bounds. -+while test "x$ac_lo" != "x$ac_hi"; do -+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default - int - main () - { --alarm (); -+static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) <= $ac_mid)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_c_alarm=yes -+ ac_hi=$ac_mid - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_c_alarm=no --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --echo "$as_me:$LINENO: result: $ac_cv_lib_c_alarm" >&5 --echo "${ECHO_T}$ac_cv_lib_c_alarm" >&6 --if test $ac_cv_lib_c_alarm = yes; then -- cat >>confdefs.h <<\_ACEOF --#define HAVE_ALARM 1 --_ACEOF -- --fi -+sed 's/^/| /' conftest.$ac_ext >&5 - -- -- --for ac_header in netinet/in.h --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ac_lo=`expr '(' $ac_mid ')' + 1` - fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+case $ac_lo in -+?*) ac_cv_sizeof_unsigned_int=$ac_lo;; -+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int), 77 -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute sizeof (unsigned int), 77 -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } ;; -+esac - else -- # Is the header compilable? --echo "$as_me:$LINENO: checking $ac_header usability" >&5 --echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ if test "$cross_compiling" = yes; then -+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -+echo "$as_me: error: internal error: not reached in cross-compile" >&2;} -+ { (exit 1); exit 1; }; } -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_includes_default --#include <$ac_header> -+long longval () { return (long) (sizeof (unsigned int)); } -+unsigned long ulongval () { return (long) (sizeof (unsigned int)); } -+#include -+#include -+int -+main () -+{ -+ -+ FILE *f = fopen ("conftest.val", "w"); -+ if (! f) -+ exit (1); -+ if (((long) (sizeof (unsigned int))) < 0) -+ { -+ long i = longval (); -+ if (i != ((long) (sizeof (unsigned int)))) -+ exit (1); -+ fprintf (f, "%ld\n", i); -+ } -+ else -+ { -+ unsigned long i = ulongval (); -+ if (i != ((long) (sizeof (unsigned int)))) -+ exit (1); -+ fprintf (f, "%lu\n", i); -+ } -+ exit (ferror (f) || fclose (f) != 0); -+ -+ ; -+ return 0; -+} - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_header_compiler=yes -+ ac_cv_sizeof_unsigned_int=`cat conftest.val` - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_header_compiler=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 --echo "${ECHO_T}$ac_header_compiler" >&6 -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# Is the header present? --echo "$as_me:$LINENO: checking $ac_header presence" >&5 --echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include <$ac_header> -+( exit $ac_status ) -+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int), 77 -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot compute sizeof (unsigned int), 77 -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; } -+fi -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+fi -+rm -f conftest.val -+else -+ ac_cv_sizeof_unsigned_int=0 -+fi -+fi -+echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_int" >&5 -+echo "${ECHO_T}$ac_cv_sizeof_unsigned_int" >&6 -+cat >>confdefs.h <<_ACEOF -+#define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int - _ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -+ -+ -+ -+GSM_VERSION="1:4:0" -+ -+ -+LINGUAS="de" -+ALL_LINGUAS=$LINGUAS -+ -+ -+ MKINSTALLDIRS= -+ if test -n "$ac_aux_dir"; then -+ case "$ac_aux_dir" in -+ /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; -+ *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; -+ esac - fi -+ if test -z "$MKINSTALLDIRS"; then -+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" -+ fi -+ -+ -+ -+ echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 -+ # Check whether --enable-nls or --disable-nls was given. -+if test "${enable_nls+set}" = set; then -+ enableval="$enable_nls" -+ USE_NLS=$enableval - else -- ac_cpp_err=yes -+ USE_NLS=yes -+fi; -+ echo "$as_me:$LINENO: result: $USE_NLS" >&5 -+echo "${ECHO_T}$USE_NLS" >&6 -+ -+ -+ -+ -+ -+ -+# Prepare PATH_SEPARATOR. -+# The user is always right. -+if test "${PATH_SEPARATOR+set}" != set; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then -+ PATH_SEPARATOR=';' -+ else -+ PATH_SEPARATOR=: -+ fi -+ rm -f conf$$.sh - fi --if test -z "$ac_cpp_err"; then -- ac_header_preproc=yes -+ -+# Find out how to test for executable files. Don't use a zero-byte file, -+# as systems may use methods other than mode bits to determine executability. -+cat >conf$$.file <<_ASEOF -+#! /bin/sh -+exit 0 -+_ASEOF -+chmod +x conf$$.file -+if test -x conf$$.file >/dev/null 2>&1; then -+ ac_executable_p="test -x" - else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_header_preproc=no -+ ac_executable_p="test -f" - fi --rm -f conftest.err conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 --echo "${ECHO_T}$ac_header_preproc" >&6 -+rm -f conf$$.file - --# So? What about this header? --case $ac_header_compiler:$ac_header_preproc in -- yes:no ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 --echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; -- no:yes ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 --echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 --echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; --esac --echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -+# Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- eval "$as_ac_Header=$ac_header_preproc" -+ case "$MSGFMT" in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. -+ ;; -+ *) -+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR -+ for ac_dir in $PATH; do -+ IFS="$ac_save_IFS" -+ test -z "$ac_dir" && ac_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then -+ echo "$as_me: trying $ac_dir/$ac_word..." >&5 -+ if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && -+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -+ ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" -+ break 2 -+ fi -+ fi -+ done -+ done -+ IFS="$ac_save_IFS" -+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" -+ ;; -+esac - fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+MSGFMT="$ac_cv_path_MSGFMT" -+if test "$MSGFMT" != ":"; then -+ echo "$as_me:$LINENO: result: $MSGFMT" >&5 -+echo "${ECHO_T}$MSGFMT" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ # Extract the first word of "gmsgfmt", so it can be a program name with args. -+set dummy gmsgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_GMSGFMT+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ case $GMSGFMT in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_GMSGFMT="$GMSGFMT" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done - -+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" -+ ;; -+esac - fi --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<_ACEOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --_ACEOF -+GMSGFMT=$ac_cv_path_GMSGFMT - -+if test -n "$GMSGFMT"; then -+ echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -+echo "${ECHO_T}$GMSGFMT" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - --done - - -+# Prepare PATH_SEPARATOR. -+# The user is always right. -+if test "${PATH_SEPARATOR+set}" != set; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then -+ PATH_SEPARATOR=';' -+ else -+ PATH_SEPARATOR=: -+ fi -+ rm -f conf$$.sh -+fi - --for ac_header in string.h --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+# Find out how to test for executable files. Don't use a zero-byte file, -+# as systems may use methods other than mode bits to determine executability. -+cat >conf$$.file <<_ASEOF -+#! /bin/sh -+exit 0 -+_ASEOF -+chmod +x conf$$.file -+if test -x conf$$.file >/dev/null 2>&1; then -+ ac_executable_p="test -x" -+else -+ ac_executable_p="test -f" - fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+rm -f conf$$.file -+ -+# Extract the first word of "xgettext", so it can be a program name with args. -+set dummy xgettext; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_XGETTEXT+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- # Is the header compilable? --echo "$as_me:$LINENO: checking $ac_header usability" >&5 --echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#include <$ac_header> --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_header_compiler=yes -+ case "$XGETTEXT" in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. -+ ;; -+ *) -+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR -+ for ac_dir in $PATH; do -+ IFS="$ac_save_IFS" -+ test -z "$ac_dir" && ac_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then -+ echo "$as_me: trying $ac_dir/$ac_word..." >&5 -+ if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && -+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" -+ break 2 -+ fi -+ fi -+ done -+ done -+ IFS="$ac_save_IFS" -+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" -+ ;; -+esac -+fi -+XGETTEXT="$ac_cv_path_XGETTEXT" -+if test "$XGETTEXT" != ":"; then -+ echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -+echo "${ECHO_T}$XGETTEXT" >&6 - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_header_compiler=no -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 --echo "${ECHO_T}$ac_header_compiler" >&6 - --# Is the header present? --echo "$as_me:$LINENO: checking $ac_header presence" >&5 --echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -+ rm -f messages.po -+ -+ -+# Prepare PATH_SEPARATOR. -+# The user is always right. -+if test "${PATH_SEPARATOR+set}" != set; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then -+ PATH_SEPARATOR=';' - else -- ac_cpp_err= -+ PATH_SEPARATOR=: - fi --else -- ac_cpp_err=yes -+ rm -f conf$$.sh - fi --if test -z "$ac_cpp_err"; then -- ac_header_preproc=yes -+ -+# Find out how to test for executable files. Don't use a zero-byte file, -+# as systems may use methods other than mode bits to determine executability. -+cat >conf$$.file <<_ASEOF -+#! /bin/sh -+exit 0 -+_ASEOF -+chmod +x conf$$.file -+if test -x conf$$.file >/dev/null 2>&1; then -+ ac_executable_p="test -x" - else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_header_preproc=no -+ ac_executable_p="test -f" - fi --rm -f conftest.err conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 --echo "${ECHO_T}$ac_header_preproc" >&6 -+rm -f conf$$.file - --# So? What about this header? --case $ac_header_compiler:$ac_header_preproc in -- yes:no ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 --echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; -- no:yes ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 --echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 --echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; --esac --echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -+# Extract the first word of "msgmerge", so it can be a program name with args. -+set dummy msgmerge; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_MSGMERGE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- eval "$as_ac_Header=$ac_header_preproc" -+ case "$MSGMERGE" in -+ [\\/]* | ?:[\\/]*) -+ ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. -+ ;; -+ *) -+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR -+ for ac_dir in $PATH; do -+ IFS="$ac_save_IFS" -+ test -z "$ac_dir" && ac_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then -+ echo "$as_me: trying $ac_dir/$ac_word..." >&5 -+ if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then -+ ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" -+ break 2 -+ fi -+ fi -+ done -+ done -+ IFS="$ac_save_IFS" -+ test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" -+ ;; -+esac - fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -- -+MSGMERGE="$ac_cv_path_MSGMERGE" -+if test "$MSGMERGE" != ":"; then -+ echo "$as_me:$LINENO: result: $MSGMERGE" >&5 -+echo "${ECHO_T}$MSGMERGE" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<_ACEOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --_ACEOF - --fi - --done -+ if test "$GMSGFMT" != ":"; then -+ if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && -+ (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -+ : ; -+ else -+ GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` -+ echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -+echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 -+ GMSGFMT=":" -+ fi -+ fi -+ -+ if test "$XGETTEXT" != ":"; then -+ if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && -+ (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -+ : ; -+ else -+ echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 -+echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 -+ XGETTEXT=":" -+ fi -+ rm -f messages.po -+ fi - -+ ac_config_commands="$ac_config_commands default-1" - - --for ac_header in libintl.h --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ -+ echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2 or newer" >&5 -+echo $ECHO_N "checking whether we are using the GNU C Library 2 or newer... $ECHO_C" >&6 -+if test "${ac_cv_gnu_library_2+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 --fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - else -- # Is the header compilable? --echo "$as_me:$LINENO: checking $ac_header usability" >&5 --echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#include <$ac_header> -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_header_compiler=yes -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+#include -+#ifdef __GNU_LIBRARY__ -+ #if (__GLIBC__ >= 2) -+ Lucky GNU user -+ #endif -+#endif -+ -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "Lucky GNU user" >/dev/null 2>&1; then -+ ac_cv_gnu_library_2=yes - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_header_compiler=no -+ ac_cv_gnu_library_2=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 --echo "${ECHO_T}$ac_header_compiler" >&6 -+rm -f conftest* - --# Is the header present? --echo "$as_me:$LINENO: checking $ac_header presence" >&5 --echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -- ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi -+ -+ -+fi -+echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2" >&5 -+echo "${ECHO_T}$ac_cv_gnu_library_2" >&6 -+ -+ GLIBC2="$ac_cv_gnu_library_2" -+ -+ -+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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_RANLIB+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_cpp_err=yes -+ 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ - fi --if test -z "$ac_cpp_err"; then -- ac_header_preproc=yes -+fi -+RANLIB=$ac_cv_prog_RANLIB -+if test -n "$RANLIB"; then -+ echo "$as_me:$LINENO: result: $RANLIB" >&5 -+echo "${ECHO_T}$RANLIB" >&6 - else -- echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_header_preproc=no -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi --rm -f conftest.err conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 --echo "${ECHO_T}$ac_header_preproc" >&6 - --# So? What about this header? --case $ac_header_compiler:$ac_header_preproc in -- yes:no ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 --echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; -- no:yes ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 --echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 --echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; --esac --echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -+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 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- eval "$as_ac_Header=$ac_header_preproc" --fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+ 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_ac_ct_RANLIB="ranlib" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done - -+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" - fi --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<_ACEOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --_ACEOF -- -+fi -+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -+if test -n "$ac_ct_RANLIB"; then -+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -+echo "${ECHO_T}$ac_ct_RANLIB" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 - fi - --done -- -+ RANLIB=$ac_ct_RANLIB -+else -+ RANLIB="$ac_cv_prog_RANLIB" -+fi - --echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 --echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 --if test "${ac_cv_prog_cc_stdc+set}" = set; then -+echo "$as_me:$LINENO: checking for library containing strerror" >&5 -+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 -+if test "${ac_cv_search_strerror+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- ac_cv_prog_cc_stdc=no --ac_save_CC=$CC -+ ac_func_search_save_LIBS=$LIBS -+ac_cv_search_strerror=no - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "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; --} --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; --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" - #endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char strerror (); - int - main () - { --return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -+strerror (); - ; - return 0; - } - _ACEOF --# Don't try gcc -ansi; that turns off useful extensions and --# breaks some systems' header files. --# AIX -qlanglvl=ansi --# Ultrix and OSF/1 -std1 --# HP-UX 10.20 and later -Ae --# HP-UX older versions -Aa -D_HPUX_SOURCE --# SVR4 -Xc -D__EXTENSIONS__ --for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" --do -- CC="$ac_save_CC $ac_arg" -- rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_prog_cc_stdc=$ac_arg --break -+ ac_cv_search_strerror="none required" - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext --done --rm -f conftest.$ac_ext conftest.$ac_objext --CC=$ac_save_CC -+sed 's/^/| /' conftest.$ac_ext >&5 - - fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+if test "$ac_cv_search_strerror" = no; then -+ for ac_lib in cposix; do -+ LIBS="-l$ac_lib $ac_func_search_save_LIBS" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - --case "x$ac_cv_prog_cc_stdc" in -- x|xno) -- echo "$as_me:$LINENO: result: none needed" >&5 --echo "${ECHO_T}none needed" >&6 ;; -- *) -- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 --echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 -- CC="$CC $ac_cv_prog_cc_stdc" ;; --esac -- --echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 --echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 --if test "${ac_cv_c_const+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" - #endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char strerror (); - int - main () - { --/* FIXME: Include the comments suggested by Paul. */ --#ifndef __cplusplus -- /* Ultrix mips cc rejects this. */ -- typedef int charset[2]; -- const charset x; -- /* SunOS 4.1.1 cc rejects this. */ -- char const *const *ccp; -- char **p; -- /* 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"; -- ccp = &g + (g ? g-g : 0); -- /* HPUX 7.0 cc rejects these. */ -- ++ccp; -- p = (char**) ccp; -- ccp = (char const *const *) p; -- { /* SCO 3.2v4 cc rejects this. */ -- char *t; -- char const *s = 0 ? (char *) 0 : (char const *) 0; -- -- *t++ = 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; -- } --#endif -+strerror (); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_search_strerror="-l$ac_lib" -+break -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ done -+fi -+LIBS=$ac_func_search_save_LIBS -+fi -+echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 -+echo "${ECHO_T}$ac_cv_search_strerror" >&6 -+if test "$ac_cv_search_strerror" != no; then -+ test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" -+ -+fi -+ -+ -+ echo "$as_me:$LINENO: checking for signed" >&5 -+echo $ECHO_N "checking for signed... $ECHO_C" >&6 -+if test "${bh_cv_c_signed+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - -+int -+main () -+{ -+signed char x; - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_c_const=yes -+ bh_cv_c_signed=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_c_const=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+bh_cv_c_signed=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 --echo "${ECHO_T}$ac_cv_c_const" >&6 --if test $ac_cv_c_const = no; then -+echo "$as_me:$LINENO: result: $bh_cv_c_signed" >&5 -+echo "${ECHO_T}$bh_cv_c_signed" >&6 -+ if test $bh_cv_c_signed = no; then - - cat >>confdefs.h <<\_ACEOF --#define const -+#define signed - _ACEOF - --fi -- -- --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include -+ fi - -+echo "$as_me:$LINENO: checking for inline" >&5 -+echo $ECHO_N "checking for inline... $ECHO_C" >&6 -+if test "${ac_cv_c_inline+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ ac_cv_c_inline=no -+for ac_kw in inline __inline__ __inline; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- egrep "vsnprintf" >/dev/null 2>&1; then -- cat >>confdefs.h <<\_ACEOF --#define HAVE_VSNPRINTF 1 -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* 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 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_c_inline=$ac_kw; break -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - - fi --rm -f conftest* -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+ -+fi -+echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -+echo "${ECHO_T}$ac_cv_c_inline" >&6 - - --echo "$as_me:$LINENO: checking for unsigned short int" >&5 --echo $ECHO_N "checking for unsigned short int... $ECHO_C" >&6 --if test "${ac_cv_type_unsigned_short_int+set}" = set; then -+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 -+ -+echo "$as_me:$LINENO: checking for off_t" >&5 -+echo $ECHO_N "checking for off_t... $ECHO_C" >&6 -+if test "${ac_cv_type_off_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { --if ((unsigned short int *) 0) -+if ((off_t *) 0) - return 0; --if (sizeof (unsigned short int)) -+if (sizeof (off_t)) - return 0; - ; - return 0; -@@ -9066,136 +23441,198 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_unsigned_short_int=yes -+ ac_cv_type_off_t=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_type_unsigned_short_int=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_type_off_t=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short_int" >&5 --echo "${ECHO_T}$ac_cv_type_unsigned_short_int" >&6 -+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -+echo "${ECHO_T}$ac_cv_type_off_t" >&6 -+if test $ac_cv_type_off_t = yes; then -+ : -+else - --echo "$as_me:$LINENO: checking size of unsigned short int" >&5 --echo $ECHO_N "checking size of unsigned short int... $ECHO_C" >&6 --if test "${ac_cv_sizeof_unsigned_short_int+set}" = set; then -+cat >>confdefs.h <<_ACEOF -+#define off_t long -+_ACEOF -+ -+fi -+ -+echo "$as_me:$LINENO: checking for size_t" >&5 -+echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -+if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- if test "$ac_cv_type_unsigned_short_int" = yes; then -- # The cast to unsigned long works around a bug in the HP C Compiler -- # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -- # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -- # This bug is HP SR number 8606223364. -- if test "$cross_compiling" = yes; then -- # Depending upon the size, compute the lo and hi bounds. --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) >= 0)]; --test_array [0] = 0 -- -+if ((size_t *) 0) -+ return 0; -+if (sizeof (size_t)) -+ return 0; - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_lo=0 ac_mid=0 -- while :; do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ ac_cv_type_size_t=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_type_size_t=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -+echo "${ECHO_T}$ac_cv_type_size_t" >&6 -+if test $ac_cv_type_size_t = yes; then -+ : -+else -+ -+cat >>confdefs.h <<_ACEOF -+#define size_t unsigned -+_ACEOF -+ -+fi -+ -+ -+ echo "$as_me:$LINENO: checking for long long" >&5 -+echo $ECHO_N "checking for long long... $ECHO_C" >&6 -+if test "${ac_cv_type_long_long+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+long long ll = 1LL; int i = 63; - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) <= $ac_mid)]; --test_array [0] = 0 -- -+long long llmax = (long long) -1; -+ return ll << i | ll >> i | llmax / ll | llmax % ll; - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_hi=$ac_mid; break -+ ac_cv_type_long_long=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo=`expr $ac_mid + 1` -- if test $ac_lo -le $ac_mid; then -- ac_lo= ac_hi= -- break -- fi -- ac_mid=`expr 2 '*' $ac_mid + 1` -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_type_long_long=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- done -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 -+echo "${ECHO_T}$ac_cv_type_long_long" >&6 -+ if test $ac_cv_type_long_long = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_LONG_LONG 1 -+_ACEOF -+ -+ fi -+ -+ -+ echo "$as_me:$LINENO: checking for long double" >&5 -+echo $ECHO_N "checking for long double... $ECHO_C" >&6 -+if test "${gt_cv_c_long_double+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ if test "$GCC" = yes; then -+ gt_cv_c_long_double=yes -+ else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+ /* The Stardent Vistra knows sizeof(long double), but does not support it. */ -+ long double foo = 0.0; -+ /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ -+ int array [2*(sizeof(long double) >= sizeof(double)) - 1]; -+ - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) < 0)]; --test_array [0] = 0 - - ; - return 0; -@@ -9203,33 +23640,62 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_hi=-1 ac_mid=-1 -- while :; do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ gt_cv_c_long_double=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_c_long_double=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ fi -+fi -+echo "$as_me:$LINENO: result: $gt_cv_c_long_double" >&5 -+echo "${ECHO_T}$gt_cv_c_long_double" >&6 -+ if test $gt_cv_c_long_double = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_LONG_DOUBLE 1 -+_ACEOF -+ -+ fi -+ -+ -+ echo "$as_me:$LINENO: checking for wchar_t" >&5 -+echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6 -+if test "${gt_cv_c_wchar_t+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+ wchar_t foo = (wchar_t)'\0'; - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) >= $ac_mid)]; --test_array [0] = 0 - - ; - return 0; -@@ -9237,55 +23703,61 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_lo=$ac_mid; break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_hi=`expr '(' $ac_mid ')' - 1` -- if test $ac_mid -le $ac_hi; then -- ac_lo= ac_hi= -- break -- fi -- ac_mid=`expr 2 '*' $ac_mid` --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- done -+ gt_cv_c_wchar_t=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo= ac_hi= -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_c_wchar_t=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --rm -f conftest.$ac_objext conftest.$ac_ext --# Binary search between lo and hi bounds. --while test "x$ac_lo" != "x$ac_hi"; do -- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 -+echo "${ECHO_T}$gt_cv_c_wchar_t" >&6 -+ if test $gt_cv_c_wchar_t = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_WCHAR_T 1 -+_ACEOF -+ -+ fi -+ -+ -+ echo "$as_me:$LINENO: checking for wint_t" >&5 -+echo $ECHO_N "checking for wint_t... $ECHO_C" >&6 -+if test "${gt_cv_c_wint_t+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+ wint_t foo = (wchar_t)'\0'; - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned short int))) <= $ac_mid)]; --test_array [0] = 0 - - ; - return 0; -@@ -9293,437 +23765,717 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_hi=$ac_mid -+ gt_cv_c_wint_t=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo=`expr '(' $ac_mid ')' + 1` -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_c_wint_t=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext --done --case $ac_lo in --?*) ac_cv_sizeof_unsigned_short_int=$ac_lo;; --'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short int), 77" >&5 --echo "$as_me: error: cannot compute sizeof (unsigned short int), 77" >&2;} -- { (exit 1); exit 1; }; } ;; --esac --else -- if test "$cross_compiling" = yes; then -- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 --echo "$as_me: error: cannot run test program while cross compiling" >&2;} -- { (exit 1); exit 1; }; } -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 -+echo "${ECHO_T}$gt_cv_c_wint_t" >&6 -+ if test $gt_cv_c_wint_t = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_WINT_T 1 -+_ACEOF -+ -+ fi -+ -+ -+ echo "$as_me:$LINENO: checking for inttypes.h" >&5 -+echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 -+if test "${gl_cv_header_inttypes_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --long longval () { return (long) (sizeof (unsigned short int)); } --unsigned long ulongval () { return (long) (sizeof (unsigned short int)); } --#include --#include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+#include - int - main () - { -- -- FILE *f = fopen ("conftest.val", "w"); -- if (! f) -- exit (1); -- if (((long) (sizeof (unsigned short int))) < 0) -- { -- long i = longval (); -- if (i != ((long) (sizeof (unsigned short int)))) -- exit (1); -- fprintf (f, "%ld\n", i); -- } -- else -- { -- unsigned long i = ulongval (); -- if (i != ((long) (sizeof (unsigned short int)))) -- exit (1); -- fprintf (f, "%lu\n", i); -- } -- exit (ferror (f) || fclose (f) != 0); -- -+uintmax_t i = (uintmax_t) -1; - ; - return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_sizeof_unsigned_short_int=`cat conftest.val` --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --( exit $ac_status ) --{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short int), 77" >&5 --echo "$as_me: error: cannot compute sizeof (unsigned short int), 77" >&2;} -- { (exit 1); exit 1; }; } --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi --fi --rm -f conftest.val -+ gl_cv_header_inttypes_h=yes - else -- ac_cv_sizeof_unsigned_short_int=0 -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gl_cv_header_inttypes_h=no - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_short_int" >&5 --echo "${ECHO_T}$ac_cv_sizeof_unsigned_short_int" >&6 -+echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5 -+echo "${ECHO_T}$gl_cv_header_inttypes_h" >&6 -+ if test $gl_cv_header_inttypes_h = yes; then -+ - cat >>confdefs.h <<_ACEOF --#define SIZEOF_UNSIGNED_SHORT_INT $ac_cv_sizeof_unsigned_short_int -+#define HAVE_INTTYPES_H_WITH_UINTMAX 1 - _ACEOF - -+ fi - --echo "$as_me:$LINENO: checking for unsigned long int" >&5 --echo $ECHO_N "checking for unsigned long int... $ECHO_C" >&6 --if test "${ac_cv_type_unsigned_long_int+set}" = set; then -+ -+ echo "$as_me:$LINENO: checking for stdint.h" >&5 -+echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 -+if test "${gl_cv_header_stdint_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+#include - int - main () - { --if ((unsigned long int *) 0) -- return 0; --if (sizeof (unsigned long int)) -- return 0; -+uintmax_t i = (uintmax_t) -1; - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_unsigned_long_int=yes -+ gl_cv_header_stdint_h=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_type_unsigned_long_int=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gl_cv_header_stdint_h=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_int" >&5 --echo "${ECHO_T}$ac_cv_type_unsigned_long_int" >&6 -+echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5 -+echo "${ECHO_T}$gl_cv_header_stdint_h" >&6 -+ if test $gl_cv_header_stdint_h = yes; then - --echo "$as_me:$LINENO: checking size of unsigned long int" >&5 --echo $ECHO_N "checking size of unsigned long int... $ECHO_C" >&6 --if test "${ac_cv_sizeof_unsigned_long_int+set}" = set; then -+cat >>confdefs.h <<_ACEOF -+#define HAVE_STDINT_H_WITH_UINTMAX 1 -+_ACEOF -+ -+ fi -+ -+ -+ -+ -+ echo "$as_me:$LINENO: checking for intmax_t" >&5 -+echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6 -+if test "${gt_cv_c_intmax_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- if test "$ac_cv_type_unsigned_long_int" = yes; then -- # The cast to unsigned long works around a bug in the HP C Compiler -- # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -- # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -- # This bug is HP SR number 8606223364. -- if test "$cross_compiling" = yes; then -- # Depending upon the size, compute the lo and hi bounds. --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+#include -+#include -+#if HAVE_STDINT_H_WITH_UINTMAX -+#include -+#endif -+#if HAVE_INTTYPES_H_WITH_UINTMAX -+#include - #endif -+ - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) >= 0)]; --test_array [0] = 0 -- -+intmax_t x = -1; - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_lo=0 ac_mid=0 -- while :; do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+ gt_cv_c_intmax_t=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_c_intmax_t=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $gt_cv_c_intmax_t" >&5 -+echo "${ECHO_T}$gt_cv_c_intmax_t" >&6 -+ if test $gt_cv_c_intmax_t = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_INTMAX_T 1 -+_ACEOF -+ -+ fi -+ -+ -+ -+ echo "$as_me:$LINENO: checking whether printf() supports POSIX/XSI format strings" >&5 -+echo $ECHO_N "checking whether printf() supports POSIX/XSI format strings... $ECHO_C" >&6 -+if test "${gt_cv_func_printf_posix+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ if test "$cross_compiling" = yes; then -+ -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ -+ notposix - #endif --int --main () --{ --static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) <= $ac_mid)]; --test_array [0] = 0 - -- ; -- return 0; -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "notposix" >/dev/null 2>&1; then -+ gt_cv_func_printf_posix="guessing no" -+else -+ gt_cv_func_printf_posix="guessing yes" -+fi -+rm -f conftest* -+ -+ -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+#include -+#include -+/* The string "%2$d %1$d", with dollar characters protected from the shell's -+ dollar expansion (possibly an autoconf bug). */ -+static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; -+static char buf[100]; -+int main () -+{ -+ sprintf (buf, format, 33, 55); -+ return (strcmp (buf, "55 33") != 0); - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_hi=$ac_mid; break -+ gt_cv_func_printf_posix=yes - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo=`expr $ac_mid + 1` -- if test $ac_lo -le $ac_mid; then -- ac_lo= ac_hi= -- break -- fi -- ac_mid=`expr 2 '*' $ac_mid + 1` -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+( exit $ac_status ) -+gt_cv_func_printf_posix=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- done -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $gt_cv_func_printf_posix" >&5 -+echo "${ECHO_T}$gt_cv_func_printf_posix" >&6 -+ case $gt_cv_func_printf_posix in -+ *yes) -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_POSIX_PRINTF 1 -+_ACEOF -+ -+ ;; -+ esac -+ -+ -+ -+for ac_header in stdlib.h unistd.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+ # Is the header compilable? -+echo "$as_me:$LINENO: checking $ac_header usability" >&5 -+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) < 0)]; --test_array [0] = 0 -- -- ; -- return 0; --} -+#include <$ac_header> - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_hi=-1 ac_mid=-1 -- while :; do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) >= $ac_mid)]; --test_array [0] = 0 -- -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_lo=$ac_mid; break -+ ac_header_compiler=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_hi=`expr '(' $ac_mid ')' - 1` -- if test $ac_mid -le $ac_hi; then -- ac_lo= ac_hi= -- break -- fi -- ac_mid=`expr 2 '*' $ac_mid` -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_header_compiler=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- done -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -+echo "${ECHO_T}$ac_header_compiler" >&6 -+ -+# Is the header present? -+echo "$as_me:$LINENO: checking $ac_header presence" >&5 -+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_header_preproc=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo= ac_hi= -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ ac_header_preproc=no -+fi -+rm -f conftest.err conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -+echo "${ECHO_T}$ac_header_preproc" >&6 -+ -+# So? What about this header? -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; -+esac -+echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ eval "$as_ac_Header=\$ac_header_preproc" - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+ - fi --rm -f conftest.$ac_objext conftest.$ac_ext --# Binary search between lo and hi bounds. --while test "x$ac_lo" != "x$ac_hi"; do -- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+_ACEOF -+ -+fi -+ -+done -+ -+ -+for ac_func in getpagesize -+do -+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -+echo "$as_me:$LINENO: checking for $ac_func" >&5 -+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_var+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define $ac_func to an innocuous variant, in case declares $ac_func. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define $ac_func innocuous_$ac_func -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char $ac_func (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef $ac_func -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char $ac_func (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -+choke me -+#else -+char (*f) () = $ac_func; -+#endif -+#ifdef __cplusplus -+} - #endif -+ - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned long int))) <= $ac_mid)]; --test_array [0] = 0 -- -+return f != $ac_func; - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_hi=$ac_mid -+ eval "$as_ac_var=yes" - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo=`expr '(' $ac_mid ')' + 1` -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+eval "$as_ac_var=no" -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -+_ACEOF -+ - fi --rm -f conftest.$ac_objext conftest.$ac_ext - done --case $ac_lo in --?*) ac_cv_sizeof_unsigned_long_int=$ac_lo;; --'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long int), 77" >&5 --echo "$as_me: error: cannot compute sizeof (unsigned long int), 77" >&2;} -- { (exit 1); exit 1; }; } ;; --esac -+ -+echo "$as_me:$LINENO: checking for working mmap" >&5 -+echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 -+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else - if test "$cross_compiling" = yes; then -- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 --echo "$as_me: error: cannot run test program while cross compiling" >&2;} -- { (exit 1); exit 1; }; } -+ ac_cv_func_mmap_fixed_mapped=no - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - $ac_includes_default --long longval () { return (long) (sizeof (unsigned long int)); } --unsigned long ulongval () { return (long) (sizeof (unsigned long int)); } --#include --#include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+/* malloc might have been renamed as rpl_malloc. */ -+#undef malloc -+ -+/* Thanks to Mike Haertel and Jim Avera for this test. -+ Here is a matrix of mmap possibilities: -+ mmap private not fixed -+ mmap private fixed at somewhere currently unmapped -+ mmap private fixed at somewhere already mapped -+ mmap shared not fixed -+ mmap shared fixed at somewhere currently unmapped -+ mmap shared fixed at somewhere already mapped -+ For private mappings, we should verify that changes cannot be read() -+ back from the file, nor mmap's back from the file at a different -+ address. (There have been systems where private was not correctly -+ implemented like the infamous i386 svr4.0, and systems where the -+ VM page cache was not coherent with the file system buffer cache -+ like early versions of FreeBSD and possibly contemporary NetBSD.) -+ For shared mappings, we should conversely verify that changes get -+ propagated back to all the places they're supposed to be. -+ -+ Grep wants private fixed already mapped. -+ The main things grep needs to know about mmap are: -+ * does it exist and is it safe to write into the mmap'd area -+ * how to use it (BSD variants) */ -+ -+#include -+#include -+ -+#if !STDC_HEADERS && !HAVE_STDLIB_H -+char *malloc (); - #endif -+ -+/* This mess was copied from the GNU getpagesize.h. */ -+#if !HAVE_GETPAGESIZE -+/* Assume that all systems that can run configure have sys/param.h. */ -+# if !HAVE_SYS_PARAM_H -+# define HAVE_SYS_PARAM_H 1 -+# endif -+ -+# ifdef _SC_PAGESIZE -+# define getpagesize() sysconf(_SC_PAGESIZE) -+# else /* no _SC_PAGESIZE */ -+# if HAVE_SYS_PARAM_H -+# include -+# ifdef EXEC_PAGESIZE -+# define getpagesize() EXEC_PAGESIZE -+# else /* no EXEC_PAGESIZE */ -+# ifdef NBPG -+# define getpagesize() NBPG * CLSIZE -+# ifndef CLSIZE -+# define CLSIZE 1 -+# endif /* no CLSIZE */ -+# else /* no NBPG */ -+# ifdef NBPC -+# define getpagesize() NBPC -+# else /* no NBPC */ -+# ifdef PAGESIZE -+# define getpagesize() PAGESIZE -+# endif /* PAGESIZE */ -+# endif /* no NBPC */ -+# endif /* no NBPG */ -+# endif /* no EXEC_PAGESIZE */ -+# else /* no HAVE_SYS_PARAM_H */ -+# define getpagesize() 8192 /* punt totally */ -+# endif /* no HAVE_SYS_PARAM_H */ -+# endif /* no _SC_PAGESIZE */ -+ -+#endif /* no HAVE_GETPAGESIZE */ -+ - int - main () - { -+ char *data, *data2, *data3; -+ int i, pagesize; -+ int fd; - -- FILE *f = fopen ("conftest.val", "w"); -- if (! f) -+ pagesize = getpagesize (); -+ -+ /* First, make a file with some known garbage in it. */ -+ data = (char *) malloc (pagesize); -+ if (!data) - exit (1); -- if (((long) (sizeof (unsigned long int))) < 0) -- { -- long i = longval (); -- if (i != ((long) (sizeof (unsigned long int)))) -- exit (1); -- fprintf (f, "%ld\n", i); -- } -- else -- { -- unsigned long i = ulongval (); -- if (i != ((long) (sizeof (unsigned long int)))) -- exit (1); -- fprintf (f, "%lu\n", i); -- } -- exit (ferror (f) || fclose (f) != 0); -+ for (i = 0; i < pagesize; ++i) -+ *(data + i) = rand (); -+ umask (0); -+ fd = creat ("conftest.mmap", 0600); -+ if (fd < 0) -+ exit (1); -+ if (write (fd, data, pagesize) != pagesize) -+ exit (1); -+ close (fd); - -- ; -- return 0; -+ /* Next, try to mmap the file at a fixed address which already has -+ something else allocated at it. If we can, also make sure that -+ we see the same garbage. */ -+ fd = open ("conftest.mmap", O_RDWR); -+ if (fd < 0) -+ exit (1); -+ data2 = (char *) malloc (2 * pagesize); -+ if (!data2) -+ exit (1); -+ data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); -+ if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, -+ MAP_PRIVATE | MAP_FIXED, fd, 0L)) -+ exit (1); -+ for (i = 0; i < pagesize; ++i) -+ if (*(data + i) != *(data2 + i)) -+ exit (1); -+ -+ /* Finally, make sure that changes to the mapped area do not -+ percolate back to the file as seen by read(). (This is a bug on -+ some variants of i386 svr4.0.) */ -+ for (i = 0; i < pagesize; ++i) -+ *(data2 + i) = *(data2 + i) + 1; -+ data3 = (char *) malloc (pagesize); -+ if (!data3) -+ exit (1); -+ if (read (fd, data3, pagesize) != pagesize) -+ exit (1); -+ for (i = 0; i < pagesize; ++i) -+ if (*(data + i) != *(data3 + i)) -+ exit (1); -+ close (fd); -+ exit (0); - } - _ACEOF - rm -f conftest$ac_exeext -@@ -9737,279 +24489,268 @@ - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_sizeof_unsigned_long_int=`cat conftest.val` -+ ac_cv_func_mmap_fixed_mapped=yes - else - echo "$as_me: program exited with status $ac_status" >&5 - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ( exit $ac_status ) --{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long int), 77" >&5 --echo "$as_me: error: cannot compute sizeof (unsigned long int), 77" >&2;} -- { (exit 1); exit 1; }; } --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi -+ac_cv_func_mmap_fixed_mapped=no - fi --rm -f conftest.val --else -- ac_cv_sizeof_unsigned_long_int=0 -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi --echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long_int" >&5 --echo "${ECHO_T}$ac_cv_sizeof_unsigned_long_int" >&6 --cat >>confdefs.h <<_ACEOF --#define SIZEOF_UNSIGNED_LONG_INT $ac_cv_sizeof_unsigned_long_int -+echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 -+echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 -+if test $ac_cv_func_mmap_fixed_mapped = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_MMAP 1 - _ACEOF - -+fi -+rm -f conftest.mmap - --echo "$as_me:$LINENO: checking for unsigned int" >&5 --echo $ECHO_N "checking for unsigned int... $ECHO_C" >&6 --if test "${ac_cv_type_unsigned_int+set}" = set; then -+ -+ echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 -+echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6 -+if test "${ac_cv_gnu_library_2_1+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+#include -+#ifdef __GNU_LIBRARY__ -+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) -+ Lucky GNU user -+ #endif - #endif --int --main () --{ --if ((unsigned int *) 0) -- return 0; --if (sizeof (unsigned int)) -- return 0; -- ; -- return 0; --} -+ - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_type_unsigned_int=yes -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "Lucky GNU user" >/dev/null 2>&1; then -+ ac_cv_gnu_library_2_1=yes - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_type_unsigned_int=no -+ ac_cv_gnu_library_2_1=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest* -+ -+ -+ - fi --echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_int" >&5 --echo "${ECHO_T}$ac_cv_type_unsigned_int" >&6 -+echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 -+echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6 - --echo "$as_me:$LINENO: checking size of unsigned int" >&5 --echo $ECHO_N "checking size of unsigned int... $ECHO_C" >&6 --if test "${ac_cv_sizeof_unsigned_int+set}" = set; then -+ GLIBC21="$ac_cv_gnu_library_2_1" -+ -+ -+ -+ -+ echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 -+echo $ECHO_N "checking whether integer division by zero raises SIGFPE... $ECHO_C" >&6 -+if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- if test "$ac_cv_type_unsigned_int" = yes; then -- # The cast to unsigned long works around a bug in the HP C Compiler -- # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -- # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -- # This bug is HP SR number 8606223364. -- if test "$cross_compiling" = yes; then -- # Depending upon the size, compute the lo and hi bounds. --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) >= 0)]; --test_array [0] = 0 - -- ; -- return 0; --} -+ if test "$cross_compiling" = yes; then -+ -+ # Guess based on the CPU. -+ case "$host_cpu" in -+ alpha* | i3456786 | m68k | s390*) -+ gt_cv_int_divbyzero_sigfpe="guessing yes";; -+ *) -+ gt_cv_int_divbyzero_sigfpe="guessing no";; -+ esac -+ -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_lo=0 ac_mid=0 -- while :; do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+#include -+#include -+ -+static void -+#ifdef __cplusplus -+sigfpe_handler (int sig) -+#else -+sigfpe_handler (sig) int sig; - #endif --int --main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) <= $ac_mid)]; --test_array [0] = 0 -+ /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ -+ exit (sig != SIGFPE); -+} - -- ; -- return 0; -+int x = 1; -+int y = 0; -+int z; -+int nan; -+ -+int main () -+{ -+ signal (SIGFPE, sigfpe_handler); -+/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -+#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) -+ signal (SIGTRAP, sigfpe_handler); -+#endif -+/* Linux/SPARC yields signal SIGILL. */ -+#if defined (__sparc__) && defined (__linux__) -+ signal (SIGILL, sigfpe_handler); -+#endif -+ -+ z = x / y; -+ nan = y / y; -+ exit (1); - } -+ - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_hi=$ac_mid; break -+ gt_cv_int_divbyzero_sigfpe=yes - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo=`expr $ac_mid + 1` -- if test $ac_lo -le $ac_mid; then -- ac_lo= ac_hi= -- break -- fi -- ac_mid=`expr 2 '*' $ac_mid + 1` -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+( exit $ac_status ) -+gt_cv_int_divbyzero_sigfpe=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -- done -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+ -+fi -+echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 -+echo "${ECHO_T}$gt_cv_int_divbyzero_sigfpe" >&6 -+ case "$gt_cv_int_divbyzero_sigfpe" in -+ *yes) value=1;; -+ *) value=0;; -+ esac -+ -+cat >>confdefs.h <<_ACEOF -+#define INTDIV0_RAISES_SIGFPE $value -+_ACEOF -+ -+ -+ -+ echo "$as_me:$LINENO: checking for unsigned long long" >&5 -+echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 -+if test "${ac_cv_type_unsigned_long_long+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+unsigned long long ull = 1ULL; int i = 63; - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) < 0)]; --test_array [0] = 0 -- -+unsigned long long ullmax = (unsigned long long) -1; -+ return ull << i | ull >> i | ullmax / ull | ullmax % ull; - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_hi=-1 ac_mid=-1 -- while :; do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) >= $ac_mid)]; --test_array [0] = 0 -- -- ; -- return 0; --} --_ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_lo=$ac_mid; break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_hi=`expr '(' $ac_mid ')' - 1` -- if test $ac_mid -le $ac_hi; then -- ac_lo= ac_hi= -- break -- fi -- ac_mid=`expr 2 '*' $ac_mid` --fi --rm -f conftest.$ac_objext conftest.$ac_ext -- done -+ ac_cv_type_unsigned_long_long=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo= ac_hi= -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_type_unsigned_long_long=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - fi --rm -f conftest.$ac_objext conftest.$ac_ext --# Binary search between lo and hi bounds. --while test "x$ac_lo" != "x$ac_hi"; do -- ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 -+echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6 -+ if test $ac_cv_type_unsigned_long_long = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_UNSIGNED_LONG_LONG 1 -+_ACEOF -+ -+ fi -+ -+ -+ -+ -+ if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then -+ -+ test $ac_cv_type_unsigned_long_long = yes \ -+ && ac_type='unsigned long long' \ -+ || ac_type='unsigned long' -+ -+cat >>confdefs.h <<_ACEOF -+#define uintmax_t $ac_type -+_ACEOF -+ -+ else -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_UINTMAX_T 1 -+_ACEOF -+ -+ fi -+ -+ -+ echo "$as_me:$LINENO: checking for inttypes.h" >&5 -+echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 -+if test "${gt_cv_header_inttypes_h+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+#include - int - main () - { --static int test_array [1 - 2 * !(((long) (sizeof (unsigned int))) <= $ac_mid)]; --test_array [0] = 0 - - ; - return 0; -@@ -10017,1079 +24758,1229 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_hi=$ac_mid -+ gt_cv_header_inttypes_h=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_lo=`expr '(' $ac_mid ')' + 1` -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_header_inttypes_h=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext --done --case $ac_lo in --?*) ac_cv_sizeof_unsigned_int=$ac_lo;; --'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int), 77" >&5 --echo "$as_me: error: cannot compute sizeof (unsigned int), 77" >&2;} -- { (exit 1); exit 1; }; } ;; --esac --else -- if test "$cross_compiling" = yes; then -- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 --echo "$as_me: error: cannot run test program while cross compiling" >&2;} -- { (exit 1); exit 1; }; } -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ -+fi -+echo "$as_me:$LINENO: result: $gt_cv_header_inttypes_h" >&5 -+echo "${ECHO_T}$gt_cv_header_inttypes_h" >&6 -+ if test $gt_cv_header_inttypes_h = yes; then -+ -+cat >>confdefs.h <<_ACEOF -+#define HAVE_INTTYPES_H 1 -+_ACEOF -+ -+ fi -+ -+ -+ -+ if test $gt_cv_header_inttypes_h = yes; then -+ echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 -+echo $ECHO_N "checking whether the inttypes.h PRIxNN macros are broken... $ECHO_C" >&6 -+if test "${gt_cv_inttypes_pri_broken+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --long longval () { return (long) (sizeof (unsigned int)); } --unsigned long ulongval () { return (long) (sizeof (unsigned int)); } --#include --#include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ - -- FILE *f = fopen ("conftest.val", "w"); -- if (! f) -- exit (1); -- if (((long) (sizeof (unsigned int))) < 0) -- { -- long i = longval (); -- if (i != ((long) (sizeof (unsigned int)))) -- exit (1); -- fprintf (f, "%ld\n", i); -- } -- else -- { -- unsigned long i = ulongval (); -- if (i != ((long) (sizeof (unsigned int)))) -- exit (1); -- fprintf (f, "%lu\n", i); -- } -- exit (ferror (f) || fclose (f) != 0); -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+#ifdef PRId32 -+char *p = PRId32; -+#endif -+ -+int -+main () -+{ - - ; - return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_sizeof_unsigned_int=`cat conftest.val` --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --( exit $ac_status ) --{ { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned int), 77" >&5 --echo "$as_me: error: cannot compute sizeof (unsigned int), 77" >&2;} -- { (exit 1); exit 1; }; } --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi --fi --rm -f conftest.val -+ gt_cv_inttypes_pri_broken=no - else -- ac_cv_sizeof_unsigned_int=0 -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_inttypes_pri_broken=yes - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ - fi --echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_int" >&5 --echo "${ECHO_T}$ac_cv_sizeof_unsigned_int" >&6 -+echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 -+echo "${ECHO_T}$gt_cv_inttypes_pri_broken" >&6 -+ fi -+ if test "$gt_cv_inttypes_pri_broken" = yes; then -+ - cat >>confdefs.h <<_ACEOF --#define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int -+#define PRI_MACROS_BROKEN 1 - _ACEOF - -- -- --GSM_VERSION="1:4:0" -- -- --LINGUAS="de" --ALL_LINGUAS=$LINGUAS -- -- MKINSTALLDIRS= -- if test -n "$ac_aux_dir"; then -- MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" -- fi -- if test -z "$MKINSTALLDIRS"; then -- MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - -- -- -- # Extract the first word of "msgfmt", so it can be a program name with args. --set dummy msgfmt; ac_word=$2 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_MSGFMT+set}" = set; then -+for ac_header in stdint.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- case "$MSGFMT" in -- /*) -- ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. -- ;; -- *) -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" -- for ac_dir in $PATH; do -- test -z "$ac_dir" && ac_dir=. -- if test -f $ac_dir/$ac_word; then -- if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && -- (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -- ac_cv_path_MSGFMT="$ac_dir/$ac_word" -- break -- fi -- fi -- done -- IFS="$ac_save_ifs" -- test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" -- ;; --esac - fi --MSGFMT="$ac_cv_path_MSGFMT" --if test "$MSGFMT" != ":"; then -- echo "$as_me:$LINENO: result: $MSGFMT" >&5 --echo "${ECHO_T}$MSGFMT" >&6 -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -- -- # Extract the first word of "gmsgfmt", so it can be a program name with args. --set dummy gmsgfmt; ac_word=$2 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_GMSGFMT+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ # Is the header compilable? -+echo "$as_me:$LINENO: checking $ac_header usability" >&5 -+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+#include <$ac_header> -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_header_compiler=yes - else -- case $GMSGFMT in -- [\\/]* | ?:[\\/]*) -- ac_cv_path_GMSGFMT="$GMSGFMT" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done --done -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -- test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" -- ;; --esac -+ac_header_compiler=no - fi --GMSGFMT=$ac_cv_path_GMSGFMT -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -+echo "${ECHO_T}$ac_header_compiler" >&6 - --if test -n "$GMSGFMT"; then -- echo "$as_me:$LINENO: result: $GMSGFMT" >&5 --echo "${ECHO_T}$GMSGFMT" >&6 -+# Is the header present? -+echo "$as_me:$LINENO: checking $ac_header presence" >&5 -+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ ac_cpp_err=yes - fi -+if test -z "$ac_cpp_err"; then -+ ac_header_preproc=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ ac_header_preproc=no -+fi -+rm -f conftest.err conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -+echo "${ECHO_T}$ac_header_preproc" >&6 - -- # Extract the first word of "xgettext", so it can be a program name with args. --set dummy xgettext; ac_word=$2 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_XGETTEXT+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- case "$XGETTEXT" in -- /*) -- ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. -- ;; -- *) -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" -- for ac_dir in $PATH; do -- test -z "$ac_dir" && ac_dir=. -- if test -f $ac_dir/$ac_word; then -- if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && -- (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -- ac_cv_path_XGETTEXT="$ac_dir/$ac_word" -- break -- fi -- fi -- done -- IFS="$ac_save_ifs" -- test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" -- ;; -+# So? What about this header? -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; - esac --fi --XGETTEXT="$ac_cv_path_XGETTEXT" --if test "$XGETTEXT" != ":"; then -- echo "$as_me:$LINENO: result: $XGETTEXT" >&5 --echo "${ECHO_T}$XGETTEXT" >&6 -+echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ eval "$as_ac_Header=\$ac_header_preproc" - fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -- rm -f messages.po -- -- # Extract the first word of "msgmerge", so it can be a program name with args. --set dummy msgmerge; ac_word=$2 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_path_MSGMERGE+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- case "$MSGMERGE" in -- /*) -- ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. -- ;; -- *) -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" -- for ac_dir in $PATH; do -- test -z "$ac_dir" && ac_dir=. -- if test -f $ac_dir/$ac_word; then -- if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then -- ac_cv_path_MSGMERGE="$ac_dir/$ac_word" -- break -- fi -- fi -- done -- IFS="$ac_save_ifs" -- test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" -- ;; --esac - fi --MSGMERGE="$ac_cv_path_MSGMERGE" --if test "$MSGMERGE" != ":"; then -- echo "$as_me:$LINENO: result: $MSGMERGE" >&5 --echo "${ECHO_T}$MSGMERGE" >&6 --else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+_ACEOF -+ - fi - -+done - -- if test "$GMSGFMT" != ":"; then -- if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && -- (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -- : ; -- else -- GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` -- echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 --echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 -- GMSGFMT=":" -- fi -- fi -+ echo "$as_me:$LINENO: checking for SIZE_MAX" >&5 -+echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6 -+ result= -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - -- if test "$XGETTEXT" != ":"; then -- if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && -- (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then -- : ; -- else -- echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 --echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 -- XGETTEXT=":" -- fi -- rm -f messages.po -- fi -+#include -+#if HAVE_STDINT_H -+#include -+#endif -+#ifdef SIZE_MAX -+Found it -+#endif - -- ac_config_commands="$ac_config_commands default-1" -+_ACEOF -+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -+ $EGREP "Found it" >/dev/null 2>&1; then -+ result=yes -+fi -+rm -f conftest* - -+ if test -z "$result"; then -+ if test "$cross_compiling" = yes; then -+ # Depending upon the size, compute the lo and hi bounds. -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((~(size_t)0 / 10) >= 0)]; -+test_array [0] = 0 - --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 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_RANLIB+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done --done -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=0 ac_mid=0 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((~(size_t)0 / 10) <= $ac_mid)]; -+test_array [0] = 0 - --fi --fi --RANLIB=$ac_cv_prog_RANLIB --if test -n "$RANLIB"; then -- echo "$as_me:$LINENO: result: $RANLIB" >&5 --echo "${ECHO_T}$RANLIB" >&6 -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid; break - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo=`expr $ac_mid + 1` -+ if test $ac_lo -le $ac_mid; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid + 1` - 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 --echo "$as_me:$LINENO: checking for $ac_word" >&5 --echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 --if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -- if test -n "$ac_ct_RANLIB"; then -- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((~(size_t)0 / 10) < 0)]; -+test_array [0] = 0 -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=-1 ac_mid=-1 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((~(size_t)0 / 10) >= $ac_mid)]; -+test_array [0] = 0 -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=$ac_mid; break - 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_ac_ct_RANLIB="ranlib" -- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done --done -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" --fi -+ac_hi=`expr '(' $ac_mid ')' - 1` -+ if test $ac_mid -le $ac_hi; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid` - fi --ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB --if test -n "$ac_ct_RANLIB"; then -- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 --echo "${ECHO_T}$ac_ct_RANLIB" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 --fi -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -- RANLIB=$ac_ct_RANLIB --else -- RANLIB="$ac_cv_prog_RANLIB" -+ac_lo= ac_hi= - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+# Binary search between lo and hi bounds. -+while test "x$ac_lo" != "x$ac_hi"; do -+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((~(size_t)0 / 10) <= $ac_mid)]; -+test_array [0] = 0 - -- -- echo "$as_me:$LINENO: checking for strerror in -lcposix" >&5 --echo $ECHO_N "checking for strerror in -lcposix... $ECHO_C" >&6 --if test "${ac_cv_lib_cposix_strerror+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid - else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lcposix $LIBS" --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char strerror (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ac_lo=`expr '(' $ac_mid ')' + 1` -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+case $ac_lo in -+?*) res_hi=$ac_lo;; -+'') result=? ;; -+esac -+else -+ if test "$cross_compiling" = yes; then -+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -+echo "$as_me: error: internal error: not reached in cross-compile" >&2;} -+ { (exit 1); exit 1; }; } -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+long longval () { return ~(size_t)0 / 10; } -+unsigned long ulongval () { return ~(size_t)0 / 10; } -+#include -+#include - int - main () - { --strerror (); -+ -+ FILE *f = fopen ("conftest.val", "w"); -+ if (! f) -+ exit (1); -+ if ((~(size_t)0 / 10) < 0) -+ { -+ long i = longval (); -+ if (i != (~(size_t)0 / 10)) -+ exit (1); -+ fprintf (f, "%ld\n", i); -+ } -+ else -+ { -+ unsigned long i = ulongval (); -+ if (i != (~(size_t)0 / 10)) -+ exit (1); -+ fprintf (f, "%lu\n", i); -+ } -+ exit (ferror (f) || fclose (f) != 0); -+ - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext -+rm -f conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_lib_cposix_strerror=yes -+ res_hi=`cat conftest.val` - else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_lib_cposix_strerror=no -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+( exit $ac_status ) -+result=? - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: $ac_cv_lib_cposix_strerror" >&5 --echo "${ECHO_T}$ac_cv_lib_cposix_strerror" >&6 --if test $ac_cv_lib_cposix_strerror = yes; then -- LIBS="$LIBS -lcposix" - fi -+rm -f conftest.val -+ if test "$cross_compiling" = yes; then -+ # Depending upon the size, compute the lo and hi bounds. -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((~(size_t)0 % 10) >= 0)]; -+test_array [0] = 0 - -- -- --echo "$as_me:$LINENO: checking for inline" >&5 --echo $ECHO_N "checking for inline... $ECHO_C" >&6 --if test "${ac_cv_c_inline+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- ac_cv_c_inline=no --for ac_kw in inline __inline__ __inline; do -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#ifndef __cplusplus --static $ac_kw int static_foo () {return 0; } --$ac_kw int foo () {return 0; } --#endif -- -+ ; -+ return 0; -+} - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_c_inline=$ac_kw; break --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --fi --rm -f conftest.$ac_objext conftest.$ac_ext --done -- --fi --echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 --echo "${ECHO_T}$ac_cv_c_inline" >&6 --case $ac_cv_c_inline in -- inline | yes) ;; -- no) --cat >>confdefs.h <<\_ACEOF --#define inline --_ACEOF -- ;; -- *) cat >>confdefs.h <<_ACEOF --#define inline $ac_cv_c_inline -+ ac_lo=0 ac_mid=0 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF -- ;; --esac -- --echo "$as_me:$LINENO: checking for off_t" >&5 --echo $ECHO_N "checking for off_t... $ECHO_C" >&6 --if test "${ac_cv_type_off_t+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - int - main () - { --if ((off_t *) 0) -- return 0; --if (sizeof (off_t)) -- return 0; -+static int test_array [1 - 2 * !((~(size_t)0 % 10) <= $ac_mid)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_off_t=yes -+ ac_hi=$ac_mid; break - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_type_off_t=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_lo=`expr $ac_mid + 1` -+ if test $ac_lo -le $ac_mid; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid + 1` - fi --echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 --echo "${ECHO_T}$ac_cv_type_off_t" >&6 --if test $ac_cv_type_off_t = yes; then -- : -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --cat >>confdefs.h <<_ACEOF --#define off_t long -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF -- --fi -- --echo "$as_me:$LINENO: checking for size_t" >&5 --echo $ECHO_N "checking for size_t... $ECHO_C" >&6 --if test "${ac_cv_type_size_t+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - int - main () - { --if ((size_t *) 0) -- return 0; --if (sizeof (size_t)) -- return 0; -+static int test_array [1 - 2 * !((~(size_t)0 % 10) < 0)]; -+test_array [0] = 0 -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_type_size_t=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_type_size_t=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --fi --echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 --echo "${ECHO_T}$ac_cv_type_size_t" >&6 --if test $ac_cv_type_size_t = yes; then -- : --else -- --cat >>confdefs.h <<_ACEOF --#define size_t unsigned -+ ac_hi=-1 ac_mid=-1 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((~(size_t)0 % 10) >= $ac_mid)]; -+test_array [0] = 0 - --fi -- -- -- --for ac_header in stdlib.h unistd.h --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 --else -- # Is the header compilable? --echo "$as_me:$LINENO: checking $ac_header usability" >&5 --echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#include <$ac_header> -+ ; -+ return 0; -+} - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_header_compiler=yes --else -- echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_header_compiler=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 --echo "${ECHO_T}$ac_header_compiler" >&6 -- --# Is the header present? --echo "$as_me:$LINENO: checking $ac_header presence" >&5 --echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include <$ac_header> --_ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- ac_header_preproc=yes -+ (exit $ac_status); }; }; then -+ ac_lo=$ac_mid; break - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_header_preproc=no --fi --rm -f conftest.err conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 --echo "${ECHO_T}$ac_header_preproc" >&6 -+sed 's/^/| /' conftest.$ac_ext >&5 - --# So? What about this header? --case $ac_header_compiler:$ac_header_preproc in -- yes:no ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 --echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; -- no:yes ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 --echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 --echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; --esac --echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- eval "$as_ac_Header=$ac_header_preproc" -+ac_hi=`expr '(' $ac_mid ')' - 1` -+ if test $ac_mid -le $ac_hi; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid` - fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo= ac_hi= - fi --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<_ACEOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 --_ACEOF -- -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -- --done -- -- --for ac_func in getpagesize --do --as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:$LINENO: checking for $ac_func" >&5 --echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 --if eval "test \"\${$as_ac_var+set}\" = set"; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+# Binary search between lo and hi bounds. -+while test "x$ac_lo" != "x$ac_hi"; do -+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char $ac_func (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char $ac_func (); --char (*f) (); -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_$ac_func) || defined (__stub___$ac_func) --choke me --#else --f = $ac_func; --#endif -+static int test_array [1 - 2 * !((~(size_t)0 % 10) <= $ac_mid)]; -+test_array [0] = 0 - - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_var=yes" -+ ac_hi=$ac_mid - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --eval "$as_ac_var=no" --fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext --fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 --if test `eval echo '${'$as_ac_var'}'` = yes; then -- cat >>confdefs.h <<_ACEOF --#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 --_ACEOF -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo=`expr '(' $ac_mid ')' + 1` - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -- --echo "$as_me:$LINENO: checking for working mmap" >&5 --echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 --if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+case $ac_lo in -+?*) res_lo=$ac_lo;; -+'') result=? ;; -+esac - else - if test "$cross_compiling" = yes; then -- ac_cv_func_mmap_fixed_mapped=no -+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -+echo "$as_me: error: internal error: not reached in cross-compile" >&2;} -+ { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --/* malloc might have been renamed as rpl_malloc. */ --#undef malloc -- --/* Thanks to Mike Haertel and Jim Avera for this test. -- Here is a matrix of mmap possibilities: -- mmap private not fixed -- mmap private fixed at somewhere currently unmapped -- mmap private fixed at somewhere already mapped -- mmap shared not fixed -- mmap shared fixed at somewhere currently unmapped -- mmap shared fixed at somewhere already mapped -- For private mappings, we should verify that changes cannot be read() -- back from the file, nor mmap's back from the file at a different -- address. (There have been systems where private was not correctly -- implemented like the infamous i386 svr4.0, and systems where the -- VM page cache was not coherent with the file system buffer cache -- like early versions of FreeBSD and possibly contemporary NetBSD.) -- For shared mappings, we should conversely verify that changes get -- propagated back to all the places they're supposed to be. -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+long longval () { return ~(size_t)0 % 10; } -+unsigned long ulongval () { return ~(size_t)0 % 10; } -+#include -+#include -+int -+main () -+{ - -- Grep wants private fixed already mapped. -- The main things grep needs to know about mmap are: -- * does it exist and is it safe to write into the mmap'd area -- * how to use it (BSD variants) */ -+ FILE *f = fopen ("conftest.val", "w"); -+ if (! f) -+ exit (1); -+ if ((~(size_t)0 % 10) < 0) -+ { -+ long i = longval (); -+ if (i != (~(size_t)0 % 10)) -+ exit (1); -+ fprintf (f, "%ld\n", i); -+ } -+ else -+ { -+ unsigned long i = ulongval (); -+ if (i != (~(size_t)0 % 10)) -+ exit (1); -+ fprintf (f, "%lu\n", i); -+ } -+ exit (ferror (f) || fclose (f) != 0); - --#include --#include -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ res_lo=`cat conftest.val` -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --#if !STDC_HEADERS && !HAVE_STDLIB_H --char *malloc (); --#endif -+( exit $ac_status ) -+result=? -+fi -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi -+fi -+rm -f conftest.val -+ if test "$cross_compiling" = yes; then -+ # Depending upon the size, compute the lo and hi bounds. -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)]; -+test_array [0] = 0 - --/* This mess was copied from the GNU getpagesize.h. */ --#if !HAVE_GETPAGESIZE --/* Assume that all systems that can run configure have sys/param.h. */ --# if !HAVE_SYS_PARAM_H --# define HAVE_SYS_PARAM_H 1 --# endif -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=0 ac_mid=0 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; -+test_array [0] = 0 - --# ifdef _SC_PAGESIZE --# define getpagesize() sysconf(_SC_PAGESIZE) --# else /* no _SC_PAGESIZE */ --# if HAVE_SYS_PARAM_H --# include --# ifdef EXEC_PAGESIZE --# define getpagesize() EXEC_PAGESIZE --# else /* no EXEC_PAGESIZE */ --# ifdef NBPG --# define getpagesize() NBPG * CLSIZE --# ifndef CLSIZE --# define CLSIZE 1 --# endif /* no CLSIZE */ --# else /* no NBPG */ --# ifdef NBPC --# define getpagesize() NBPC --# else /* no NBPC */ --# ifdef PAGESIZE --# define getpagesize() PAGESIZE --# endif /* PAGESIZE */ --# endif /* no NBPC */ --# endif /* no NBPG */ --# endif /* no EXEC_PAGESIZE */ --# else /* no HAVE_SYS_PARAM_H */ --# define getpagesize() 8192 /* punt totally */ --# endif /* no HAVE_SYS_PARAM_H */ --# endif /* no _SC_PAGESIZE */ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid; break -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --#endif /* no HAVE_GETPAGESIZE */ -+ac_lo=`expr $ac_mid + 1` -+ if test $ac_lo -le $ac_mid; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid + 1` -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - int - main () - { -- char *data, *data2, *data3; -- int i, pagesize; -- int fd; -- -- pagesize = getpagesize (); -- -- /* First, make a file with some known garbage in it. */ -- data = (char *) malloc (pagesize); -- if (!data) -- exit (1); -- for (i = 0; i < pagesize; ++i) -- *(data + i) = rand (); -- umask (0); -- fd = creat ("conftest.mmap", 0600); -- if (fd < 0) -- exit (1); -- if (write (fd, data, pagesize) != pagesize) -- exit (1); -- close (fd); -- -- /* Next, try to mmap the file at a fixed address which already has -- something else allocated at it. If we can, also make sure that -- we see the same garbage. */ -- fd = open ("conftest.mmap", O_RDWR); -- if (fd < 0) -- exit (1); -- data2 = (char *) malloc (2 * pagesize); -- if (!data2) -- exit (1); -- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); -- if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, -- MAP_PRIVATE | MAP_FIXED, fd, 0L)) -- exit (1); -- for (i = 0; i < pagesize; ++i) -- if (*(data + i) != *(data2 + i)) -- exit (1); -+static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)]; -+test_array [0] = 0 - -- /* Finally, make sure that changes to the mapped area do not -- percolate back to the file as seen by read(). (This is a bug on -- some variants of i386 svr4.0.) */ -- for (i = 0; i < pagesize; ++i) -- *(data2 + i) = *(data2 + i) + 1; -- data3 = (char *) malloc (pagesize); -- if (!data3) -- exit (1); -- if (read (fd, data3, pagesize) != pagesize) -- exit (1); -- for (i = 0; i < pagesize; ++i) -- if (*(data + i) != *(data3 + i)) -- exit (1); -- close (fd); -- exit (0); -+ ; -+ return 0; - } - _ACEOF --rm -f conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_cv_func_mmap_fixed_mapped=yes --else -- echo "$as_me: program exited with status $ac_status" >&5 --echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --( exit $ac_status ) --ac_cv_func_mmap_fixed_mapped=no --fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext --fi --fi --echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 --echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 --if test $ac_cv_func_mmap_fixed_mapped = yes; then -+ ac_hi=-1 ac_mid=-1 -+ while :; do -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)]; -+test_array [0] = 0 - --cat >>confdefs.h <<\_ACEOF --#define HAVE_MMAP 1 -+ ; -+ return 0; -+} - _ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_lo=$ac_mid; break -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_hi=`expr '(' $ac_mid ')' - 1` -+ if test $ac_mid -le $ac_hi; then -+ ac_lo= ac_hi= -+ break -+ fi -+ ac_mid=`expr 2 '*' $ac_mid` - fi --rm -f conftest.mmap -- -- -- echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 --echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6 --if test "${ac_cv_gnu_library_2_1+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ done - else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - --#include --#ifdef __GNU_LIBRARY__ -- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) -- Lucky GNU user -- #endif --#endif -+ac_lo= ac_hi= -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+# Binary search between lo and hi bounds. -+while test "x$ac_lo" != "x$ac_hi"; do -+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; -+test_array [0] = 0 - -+ ; -+ return 0; -+} - _ACEOF --if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | -- egrep "Lucky GNU user" >/dev/null 2>&1; then -- ac_cv_gnu_library_2_1=yes -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_hi=$ac_mid - else -- ac_cv_gnu_library_2_1=no --fi --rm -f conftest* -- -- -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_lo=`expr '(' $ac_mid ')' + 1` - fi --echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 --echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6 -- -- GLIBC21="$ac_cv_gnu_library_2_1" -- -- -- -- -- echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 --echo $ECHO_N "checking whether integer division by zero raises SIGFPE... $ECHO_C" >&6 --if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+done -+case $ac_lo in -+?*) fits_in_uint=$ac_lo;; -+'') result=? ;; -+esac - else -- -- if test "$cross_compiling" = yes; then -- -- # Guess based on the CPU. -- case "$host_cpu" in -- alpha* | i3456786 | m68k | s390*) -- gt_cv_int_divbyzero_sigfpe="guessing yes";; -- *) -- gt_cv_int_divbyzero_sigfpe="guessing no";; -- esac -- -+ if test "$cross_compiling" = yes; then -+ { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 -+echo "$as_me: error: internal error: not reached in cross-compile" >&2;} -+ { (exit 1); exit 1; }; } - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -- -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+long longval () { return sizeof (size_t) <= sizeof (unsigned int); } -+unsigned long ulongval () { return sizeof (size_t) <= sizeof (unsigned int); } -+#include - #include --#include -- --static void --#ifdef __cplusplus --sigfpe_handler (int sig) --#else --sigfpe_handler (sig) int sig; --#endif -+int -+main () - { -- /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ -- exit (sig != SIGFPE); --} -- --int x = 1; --int y = 0; --int z; --int nan; - --int main () --{ -- signal (SIGFPE, sigfpe_handler); --/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ --#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) -- signal (SIGTRAP, sigfpe_handler); --#endif --/* Linux/SPARC yields signal SIGILL. */ --#if defined (__sparc__) && defined (__linux__) -- signal (SIGILL, sigfpe_handler); --#endif -+ FILE *f = fopen ("conftest.val", "w"); -+ if (! f) -+ exit (1); -+ if ((sizeof (size_t) <= sizeof (unsigned int)) < 0) -+ { -+ long i = longval (); -+ if (i != (sizeof (size_t) <= sizeof (unsigned int))) -+ exit (1); -+ fprintf (f, "%ld\n", i); -+ } -+ else -+ { -+ unsigned long i = ulongval (); -+ if (i != (sizeof (size_t) <= sizeof (unsigned int))) -+ exit (1); -+ fprintf (f, "%lu\n", i); -+ } -+ exit (ferror (f) || fclose (f) != 0); - -- z = x / y; -- nan = y / y; -- exit (1); -+ ; -+ return 0; - } -- - _ACEOF - rm -f conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -@@ -11102,329 +25993,378 @@ - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- gt_cv_int_divbyzero_sigfpe=yes -+ fits_in_uint=`cat conftest.val` - else - echo "$as_me: program exited with status $ac_status" >&5 - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - ( exit $ac_status ) --gt_cv_int_divbyzero_sigfpe=no -+result=? - fi --rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi -- - fi --echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 --echo "${ECHO_T}$gt_cv_int_divbyzero_sigfpe" >&6 -- case "$gt_cv_int_divbyzero_sigfpe" in -- *yes) value=1;; -- *) value=0;; -- esac -- --cat >>confdefs.h <<_ACEOF --#define INTDIV0_RAISES_SIGFPE $value --_ACEOF -- -- -+rm -f conftest.val -+ if test "$fits_in_uint" = 1; then -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+ extern size_t foo; -+ extern unsigned long foo; - -- echo "$as_me:$LINENO: checking for inttypes.h" >&5 --echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 --if test "${jm_ac_cv_header_inttypes_h+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include --#include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { --uintmax_t i = (uintmax_t) -1; -+ - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- jm_ac_cv_header_inttypes_h=yes -+ fits_in_uint=0 - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --jm_ac_cv_header_inttypes_h=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - fi --echo "$as_me:$LINENO: result: $jm_ac_cv_header_inttypes_h" >&5 --echo "${ECHO_T}$jm_ac_cv_header_inttypes_h" >&6 -- if test $jm_ac_cv_header_inttypes_h = yes; then -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+ fi -+ if test -z "$result"; then -+ if test "$fits_in_uint" = 1; then -+ result="$res_hi$res_lo"U -+ else -+ result="$res_hi$res_lo"UL -+ fi -+ else -+ result='~(size_t)0' -+ fi -+ fi -+ echo "$as_me:$LINENO: result: $result" >&5 -+echo "${ECHO_T}$result" >&6 -+ if test "$result" != yes; then - - cat >>confdefs.h <<_ACEOF --#define HAVE_INTTYPES_H_WITH_UINTMAX 1 -+#define SIZE_MAX $result - _ACEOF - - fi - - -- echo "$as_me:$LINENO: checking for stdint.h" >&5 --echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 --if test "${jm_ac_cv_header_stdint_h+set}" = set; then -+ -+ -+ -+for ac_header in stdint.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include --#include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --uintmax_t i = (uintmax_t) -1; -- ; -- return 0; --} -+ # Is the header compilable? -+echo "$as_me:$LINENO: checking $ac_header usability" >&5 -+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+#include <$ac_header> - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- jm_ac_cv_header_stdint_h=yes -+ ac_header_compiler=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --jm_ac_cv_header_stdint_h=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_header_compiler=no - fi --echo "$as_me:$LINENO: result: $jm_ac_cv_header_stdint_h" >&5 --echo "${ECHO_T}$jm_ac_cv_header_stdint_h" >&6 -- if test $jm_ac_cv_header_stdint_h = yes; then -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -+echo "${ECHO_T}$ac_header_compiler" >&6 - --cat >>confdefs.h <<_ACEOF --#define HAVE_STDINT_H_WITH_UINTMAX 1 -+# Is the header present? -+echo "$as_me:$LINENO: checking $ac_header presence" >&5 -+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ - _ACEOF -- -- fi -- -- -- echo "$as_me:$LINENO: checking for unsigned long long" >&5 --echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 --if test "${ac_cv_type_unsigned_long_long+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --unsigned long long ull = 1; int i = 63; --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif --int --main () --{ --unsigned long long ullmax = (unsigned long long) -1; -- return ull << i | ull >> i | ullmax / ull | ullmax % ull; -- ; -- return 0; --} -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include <$ac_header> - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -- ac_cv_type_unsigned_long_long=yes -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_header_preproc=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_cv_type_unsigned_long_long=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ ac_header_preproc=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -+echo "${ECHO_T}$ac_header_preproc" >&6 -+ -+# So? What about this header? -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; -+esac -+echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ eval "$as_ac_Header=\$ac_header_preproc" - fi --echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 --echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6 -- if test $ac_cv_type_unsigned_long_long = yes; then -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - --cat >>confdefs.h <<\_ACEOF --#define HAVE_UNSIGNED_LONG_LONG 1 -+fi -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 - _ACEOF - -- fi -- -- -- -- -- if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then -- -- test $ac_cv_type_unsigned_long_long = yes \ -- && ac_type='unsigned long long' \ -- || ac_type='unsigned long' -+fi - --cat >>confdefs.h <<_ACEOF --#define uintmax_t $ac_type --_ACEOF -+done - -- fi - - -- echo "$as_me:$LINENO: checking for inttypes.h" >&5 --echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 --if test "${gt_cv_header_inttypes_h+set}" = set; then -+ echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 -+echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6 -+if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include --#include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+ gt_save_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ gt_save_LIBS="$LIBS" -+ LIBS="$LIBS -framework CoreFoundation" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - int - main () - { -- -+CFPreferencesCopyAppValue(NULL, NULL) - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- gt_cv_header_inttypes_h=yes -+ gt_cv_func_CFPreferencesCopyAppValue=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --gt_cv_header_inttypes_h=no --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+sed 's/^/| /' conftest.$ac_ext >&5 - -+gt_cv_func_CFPreferencesCopyAppValue=no - fi --echo "$as_me:$LINENO: result: $gt_cv_header_inttypes_h" >&5 --echo "${ECHO_T}$gt_cv_header_inttypes_h" >&6 -- if test $gt_cv_header_inttypes_h = yes; then -- --cat >>confdefs.h <<_ACEOF --#define HAVE_INTTYPES_H 1 --_ACEOF -- -- fi -- -- -- -- if test $gt_cv_header_inttypes_h = yes; then -- echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 --echo $ECHO_N "checking whether the inttypes.h PRIxNN macros are broken... $ECHO_C" >&6 --if test "${gt_cv_inttypes_pri_broken+set}" = set; then -- echo $ECHO_N "(cached) $ECHO_C" >&6 --else -- -- cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include --#ifdef PRId32 --char *p = PRId32; --#endif -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ CPPFLAGS="$gt_save_CPPFLAGS" -+ LIBS="$gt_save_LIBS" -+fi -+echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 -+echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6 -+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_CFPREFERENCESCOPYAPPVALUE 1 -+_ACEOF -+ -+ fi -+ echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 -+echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6 -+if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gt_save_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ gt_save_LIBS="$LIBS" -+ LIBS="$LIBS -framework CoreFoundation" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - int - main () - { -- -+CFLocaleCopyCurrent(); - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext --if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- gt_cv_inttypes_pri_broken=no -+ gt_cv_func_CFLocaleCopyCurrent=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --gt_cv_inttypes_pri_broken=yes --fi --rm -f conftest.$ac_objext conftest.$ac_ext -+sed 's/^/| /' conftest.$ac_ext >&5 - -+gt_cv_func_CFLocaleCopyCurrent=no - fi --echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 --echo "${ECHO_T}$gt_cv_inttypes_pri_broken" >&6 -- fi -- if test "$gt_cv_inttypes_pri_broken" = yes; then -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ CPPFLAGS="$gt_save_CPPFLAGS" -+ LIBS="$gt_save_LIBS" -+fi -+echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 -+echo "${ECHO_T}$gt_cv_func_CFLocaleCopyCurrent" >&6 -+ if test $gt_cv_func_CFLocaleCopyCurrent = yes; then - --cat >>confdefs.h <<_ACEOF --#define PRI_MACROS_BROKEN 1 -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_CFLOCALECOPYCURRENT 1 - _ACEOF - - fi -+ INTL_MACOSX_LIBS= -+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then -+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" -+ fi -+ - - - if test "X$prefix" = "XNONE"; then -@@ -11450,6 +26390,19 @@ - else - with_gnu_ld=no - fi; -+# Prepare PATH_SEPARATOR. -+# The user is always right. -+if test "${PATH_SEPARATOR+set}" != set; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then -+ PATH_SEPARATOR=';' -+ else -+ PATH_SEPARATOR=: -+ fi -+ rm -f conf$$.sh -+fi - ac_prog=ld - if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. -@@ -11501,11 +26454,12 @@ - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. -- if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then -- test "$with_gnu_ld" != no && break -- else -- test "$with_gnu_ld" != yes && break -- fi -+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in -+ *GNU* | *'with BFD'*) -+ test "$with_gnu_ld" != no && break ;; -+ *) -+ test "$with_gnu_ld" != yes && break ;; -+ esac - fi - done - IFS="$ac_save_ifs" -@@ -11531,11 +26485,12 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. --if $LD -v 2>&1 &5; then -- acl_cv_prog_gnu_ld=yes --else -- acl_cv_prog_gnu_ld=no --fi -+case `$LD -v 2>&1 &5 - echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 -@@ -11543,6 +26498,7 @@ - - - -+ - echo "$as_me:$LINENO: checking for shared library run path origin" >&5 - echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 - if test "${acl_cv_rpath+set}" = set; then -@@ -11565,8 +26521,6 @@ - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" -- sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" -- sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" - # Check whether --enable-rpath or --disable-rpath was given. - if test "${enable_rpath+set}" = set; then - enableval="$enable_rpath" -@@ -11790,7 +26744,7 @@ - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in -- linux*) haveit=yes;; -+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi -@@ -11834,7 +26788,7 @@ - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in -- linux*) haveit=yes;; -+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi -@@ -11964,223 +26918,722 @@ - - - -+ echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 -+echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6 -+if test "${ac_cv_type_ptrdiff_t+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+int -+main () -+{ -+if ((ptrdiff_t *) 0) -+ return 0; -+if (sizeof (ptrdiff_t)) -+ return 0; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_type_ptrdiff_t=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_type_ptrdiff_t=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 -+echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6 -+if test $ac_cv_type_ptrdiff_t = yes; then -+ : -+else -+ -+cat >>confdefs.h <<\_ACEOF -+#define ptrdiff_t long -+_ACEOF -+ -+ -+fi -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -+stdlib.h string.h unistd.h sys/param.h -+do -+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+else -+ # Is the header compilable? -+echo "$as_me:$LINENO: checking $ac_header usability" >&5 -+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+$ac_includes_default -+#include <$ac_header> -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_header_compiler=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_header_compiler=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -+echo "${ECHO_T}$ac_header_compiler" >&6 -+ -+# Is the header present? -+echo "$as_me:$LINENO: checking $ac_header presence" >&5 -+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -+cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include <$ac_header> -+_ACEOF -+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } >/dev/null; then -+ if test -s conftest.err; then -+ ac_cpp_err=$ac_c_preproc_warn_flag -+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag -+ else -+ ac_cpp_err= -+ fi -+else -+ ac_cpp_err=yes -+fi -+if test -z "$ac_cpp_err"; then -+ ac_header_preproc=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ ac_header_preproc=no -+fi -+rm -f conftest.err conftest.$ac_ext -+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -+echo "${ECHO_T}$ac_header_preproc" >&6 -+ -+# So? What about this header? -+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in -+ yes:no: ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} -+ ac_header_preproc=yes -+ ;; -+ no:yes:* ) -+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} -+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} -+ ( -+ cat <<\_ASBOX -+## ------------------------------------------ ## -+## Report this to the AC_PACKAGE_NAME lists. ## -+## ------------------------------------------ ## -+_ASBOX -+ ) | -+ sed "s/^/$as_me: WARNING: /" >&2 -+ ;; -+esac -+echo "$as_me:$LINENO: checking for $ac_header" >&5 -+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ eval "$as_ac_Header=\$ac_header_preproc" -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+ -+fi -+if test `eval echo '${'$as_ac_Header'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+_ACEOF -+ -+fi -+ -+done -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+for ac_func in asprintf fwprintf getcwd getegid geteuid getgid getuid \ -+mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ -+strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ -+__fsetlocking -+do -+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -+echo "$as_me:$LINENO: checking for $ac_func" >&5 -+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -+if eval "test \"\${$as_ac_var+set}\" = set"; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+/* Define $ac_func to an innocuous variant, in case declares $ac_func. -+ For example, HP-UX 11i declares gettimeofday. */ -+#define $ac_func innocuous_$ac_func -+ -+/* System header to define __stub macros and hopefully few prototypes, -+ which can conflict with char $ac_func (); below. -+ Prefer to if __STDC__ is defined, since -+ exists even on freestanding compilers. */ -+ -+#ifdef __STDC__ -+# include -+#else -+# include -+#endif -+ -+#undef $ac_func -+ -+/* Override any gcc2 internal prototype to avoid an error. */ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+char $ac_func (); -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -+choke me -+#else -+char (*f) () = $ac_func; -+#endif -+#ifdef __cplusplus -+} -+#endif -+ -+int -+main () -+{ -+return f != $ac_func; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ eval "$as_ac_var=yes" -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+eval "$as_ac_var=no" -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -+if test `eval echo '${'$as_ac_var'}'` = yes; then -+ cat >>confdefs.h <<_ACEOF -+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -+_ACEOF -+ -+fi -+done -+ -+ -+ -+ echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5 -+echo $ECHO_N "checking whether _snprintf is declared... $ECHO_C" >&6 -+if test "${ac_cv_have_decl__snprintf+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+ -+#ifndef _snprintf -+ char *p = (char *) _snprintf; -+#endif - -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_have_decl__snprintf=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_cv_have_decl__snprintf=no -+fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5 -+echo "${ECHO_T}$ac_cv_have_decl__snprintf" >&6 -+ if test $ac_cv_have_decl__snprintf = yes; then -+ gt_value=1 -+ else -+ gt_value=0 -+ fi - -+cat >>confdefs.h <<_ACEOF -+#define HAVE_DECL__SNPRINTF $gt_value -+_ACEOF - - - --for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ --stdlib.h string.h unistd.h sys/param.h --do --as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` --if eval "test \"\${$as_ac_Header+set}\" = set"; then -- echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -+ echo "$as_me:$LINENO: checking whether _snwprintf is declared" >&5 -+echo $ECHO_N "checking whether _snwprintf is declared... $ECHO_C" >&6 -+if test "${ac_cv_have_decl__snwprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 --fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - else -- # Is the header compilable? --echo "$as_me:$LINENO: checking $ac_header usability" >&5 --echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --$ac_includes_default --#include <$ac_header> -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+ -+#ifndef _snwprintf -+ char *p = (char *) _snwprintf; -+#endif -+ -+ ; -+ return 0; -+} - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- ac_header_compiler=yes -+ ac_cv_have_decl__snwprintf=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --ac_header_compiler=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_have_decl__snwprintf=no - fi --rm -f conftest.$ac_objext conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 --echo "${ECHO_T}$ac_header_compiler" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_have_decl__snwprintf" >&5 -+echo "${ECHO_T}$ac_cv_have_decl__snwprintf" >&6 -+ if test $ac_cv_have_decl__snwprintf = yes; then -+ gt_value=1 -+ else -+ gt_value=0 -+ fi - --# Is the header present? --echo "$as_me:$LINENO: checking $ac_header presence" >&5 --echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 --cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --#include <$ac_header> -+cat >>confdefs.h <<_ACEOF -+#define HAVE_DECL__SNWPRINTF $gt_value - _ACEOF --if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 -- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 -+ -+ -+ -+ -+ echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 -+echo $ECHO_N "checking whether feof_unlocked is declared... $ECHO_C" >&6 -+if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+ -+#ifndef feof_unlocked -+ char *p = (char *) feof_unlocked; -+#endif -+ -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -- egrep -v '^ *\+' conftest.er1 >conftest.err -+ grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } >/dev/null; then -- if test -s conftest.err; then -- ac_cpp_err=$ac_c_preproc_warn_flag -- else -- ac_cpp_err= -- fi --else -- ac_cpp_err=yes --fi --if test -z "$ac_cpp_err"; then -- ac_header_preproc=yes -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_have_decl_feof_unlocked=yes - else - echo "$as_me: failed program was:" >&5 -- cat conftest.$ac_ext >&5 -- ac_header_preproc=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_have_decl_feof_unlocked=no - fi --rm -f conftest.err conftest.$ac_ext --echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 --echo "${ECHO_T}$ac_header_preproc" >&6 -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 -+echo "${ECHO_T}$ac_cv_have_decl_feof_unlocked" >&6 -+ if test $ac_cv_have_decl_feof_unlocked = yes; then -+ gt_value=1 -+ else -+ gt_value=0 -+ fi - --# So? What about this header? --case $ac_header_compiler:$ac_header_preproc in -- yes:no ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 --echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; -- no:yes ) -- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 --echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 --echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} -- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 --echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; --esac --echo "$as_me:$LINENO: checking for $ac_header" >&5 --echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 --if eval "test \"\${$as_ac_Header+set}\" = set"; then -+cat >>confdefs.h <<_ACEOF -+#define HAVE_DECL_FEOF_UNLOCKED $gt_value -+_ACEOF -+ -+ -+ -+ echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 -+echo $ECHO_N "checking whether fgets_unlocked is declared... $ECHO_C" >&6 -+if test "${ac_cv_have_decl_fgets_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else -- eval "$as_ac_Header=$ac_header_preproc" --fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ - --fi --if test `eval echo '${'$as_ac_Header'}'` = yes; then -- cat >>confdefs.h <<_ACEOF --#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -+#ifndef fgets_unlocked -+ char *p = (char *) fgets_unlocked; -+#endif -+ -+ ; -+ return 0; -+} - _ACEOF -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ ac_cv_have_decl_fgets_unlocked=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 - -+ac_cv_have_decl_fgets_unlocked=no - fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -+fi -+echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 -+echo "${ECHO_T}$ac_cv_have_decl_fgets_unlocked" >&6 -+ if test $ac_cv_have_decl_fgets_unlocked = yes; then -+ gt_value=1 -+ else -+ gt_value=0 -+ fi - --done -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+cat >>confdefs.h <<_ACEOF -+#define HAVE_DECL_FGETS_UNLOCKED $gt_value -+_ACEOF - - - --for ac_func in feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ --geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ --strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next --do --as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` --echo "$as_me:$LINENO: checking for $ac_func" >&5 --echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 --if eval "test \"\${$as_ac_var+set}\" = set"; then -+ echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 -+echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6 -+if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" --/* System header to define __stub macros and hopefully few prototypes, -- which can conflict with char $ac_func (); below. */ --#include --/* Override any gcc2 internal prototype to avoid an error. */ --#ifdef __cplusplus --extern "C" --#endif --/* We use char because int might match the return type of a gcc2 -- builtin and then its argument prototype would still apply. */ --char $ac_func (); --char (*f) (); -- --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include - int - main () - { --/* The GNU C library defines this for functions which it implements -- to always fail with ENOSYS. Some functions are actually named -- something starting with __ and the normal name is an alias. */ --#if defined (__stub_$ac_func) || defined (__stub___$ac_func) --choke me --#else --f = $ac_func; -+ -+#ifndef getc_unlocked -+ char *p = (char *) getc_unlocked; - #endif - - ; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+rm -f conftest.$ac_objext -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- eval "$as_ac_var=yes" -+ ac_cv_have_decl_getc_unlocked=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --eval "$as_ac_var=no" -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ac_cv_have_decl_getc_unlocked=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 --echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 --if test `eval echo '${'$as_ac_var'}'` = yes; then -- cat >>confdefs.h <<_ACEOF --#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -+echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 -+echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6 -+ if test $ac_cv_have_decl_getc_unlocked = yes; then -+ gt_value=1 -+ else -+ gt_value=0 -+ fi -+ -+cat >>confdefs.h <<_ACEOF -+#define HAVE_DECL_GETC_UNLOCKED $gt_value - _ACEOF - --fi --done -+ -+ -+ case $gt_cv_func_printf_posix in -+ *yes) HAVE_POSIX_PRINTF=1 ;; -+ *) HAVE_POSIX_PRINTF=0 ;; -+ esac -+ -+ if test "$ac_cv_func_asprintf" = yes; then -+ HAVE_ASPRINTF=1 -+ else -+ HAVE_ASPRINTF=0 -+ fi -+ -+ if test "$ac_cv_func_snprintf" = yes; then -+ HAVE_SNPRINTF=1 -+ else -+ HAVE_SNPRINTF=0 -+ fi -+ -+ if test "$ac_cv_func_wprintf" = yes; then -+ HAVE_WPRINTF=1 -+ else -+ HAVE_WPRINTF=0 -+ fi - - - -@@ -12222,16 +27675,13 @@ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - #include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -12244,11 +27694,20 @@ - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -12257,23 +27716,22 @@ - am_cv_func_iconv=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - #include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -12286,11 +27744,20 @@ - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -12300,9 +27767,11 @@ - am_cv_func_iconv=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - -@@ -12337,8 +27806,11 @@ - else - - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - - #include - #include -@@ -12352,12 +27824,6 @@ - size_t iconv(); - #endif - --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -12368,11 +27834,20 @@ - _ACEOF - rm -f conftest.$ac_objext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -- (eval $ac_compile) 2>&5 -+ (eval $ac_compile) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest.$ac_objext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -12381,10 +27856,11 @@ - am_cv_proto_iconv_arg1="" - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - am_cv_proto_iconv_arg1="const" - fi --rm -f conftest.$ac_objext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" - fi - -@@ -12407,15 +27883,12 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -12426,11 +27899,20 @@ - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -12439,10 +27921,12 @@ - am_cv_langinfo_codeset=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - am_cv_langinfo_codeset=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - - fi - echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 -@@ -12459,19 +27943,16 @@ - - echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 - echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 --if test "${am_cv_val_LC_MESSAGES+set}" = set; then -+if test "${gt_cv_val_LC_MESSAGES+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { -@@ -12482,27 +27963,38 @@ - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then -- am_cv_val_LC_MESSAGES=yes -+ gt_cv_val_LC_MESSAGES=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 --am_cv_val_LC_MESSAGES=no -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_val_LC_MESSAGES=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - fi --echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 --echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 -- if test $am_cv_val_LC_MESSAGES = yes; then -+echo "$as_me:$LINENO: result: $gt_cv_val_LC_MESSAGES" >&5 -+echo "${ECHO_T}$gt_cv_val_LC_MESSAGES" >&6 -+ if test $gt_cv_val_LC_MESSAGES = yes; then - - cat >>confdefs.h <<\_ACEOF - #define HAVE_LC_MESSAGES 1 -@@ -12512,6 +28004,10 @@ - - fi - -+ if test -n "$INTL_MACOSX_LIBS"; then -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ fi -+ - for ac_prog in bison - do - # Extract the first word of "$ac_prog", so it can be a program name with args. -@@ -12545,46 +28041,187 @@ - echo "$as_me:$LINENO: result: $INTLBISON" >&5 - echo "${ECHO_T}$INTLBISON" >&6 - else -- echo "$as_me:$LINENO: result: no" >&5 --echo "${ECHO_T}no" >&6 -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ test -n "$INTLBISON" && break -+done -+ -+ if test -z "$INTLBISON"; then -+ ac_verc_fail=yes -+ else -+ echo "$as_me:$LINENO: checking version of bison" >&5 -+echo $ECHO_N "checking version of bison... $ECHO_C" >&6 -+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -+ case $ac_prog_version in -+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; -+ 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; -+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; -+ esac -+ echo "$as_me:$LINENO: result: $ac_prog_version" >&5 -+echo "${ECHO_T}$ac_prog_version" >&6 -+ fi -+ if test $ac_verc_fail = yes; then -+ INTLBISON=: -+ fi -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5 -+echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6 -+if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gt_save_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ gt_save_LIBS="$LIBS" -+ LIBS="$LIBS -framework CoreFoundation" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+CFPreferencesCopyAppValue(NULL, NULL) -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ gt_cv_func_CFPreferencesCopyAppValue=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_func_CFPreferencesCopyAppValue=no -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ CPPFLAGS="$gt_save_CPPFLAGS" -+ LIBS="$gt_save_LIBS" -+fi -+echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 -+echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6 -+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_CFPREFERENCESCOPYAPPVALUE 1 -+_ACEOF -+ -+ fi -+ echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5 -+echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6 -+if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ gt_save_CPPFLAGS="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" -+ gt_save_LIBS="$LIBS" -+ LIBS="$LIBS -framework CoreFoundation" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+#include -+int -+main () -+{ -+CFLocaleCopyCurrent(); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ gt_cv_func_CFLocaleCopyCurrent=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+gt_cv_func_CFLocaleCopyCurrent=no - fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ CPPFLAGS="$gt_save_CPPFLAGS" -+ LIBS="$gt_save_LIBS" -+fi -+echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 -+echo "${ECHO_T}$gt_cv_func_CFLocaleCopyCurrent" >&6 -+ if test $gt_cv_func_CFLocaleCopyCurrent = yes; then - -- test -n "$INTLBISON" && break --done -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_CFLOCALECOPYCURRENT 1 -+_ACEOF - -- if test -z "$INTLBISON"; then -- ac_verc_fail=yes -- else -- echo "$as_me:$LINENO: checking version of bison" >&5 --echo $ECHO_N "checking version of bison... $ECHO_C" >&6 -- ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -- case $ac_prog_version in -- '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; -- 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -- ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; -- *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; -- esac -- echo "$as_me:$LINENO: result: $ac_prog_version" >&5 --echo "${ECHO_T}$ac_prog_version" >&6 - fi -- if test $ac_verc_fail = yes; then -- INTLBISON=: -+ INTL_MACOSX_LIBS= -+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then -+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" - fi - - - - -- -- -- -- -- -- -- -- -- -- -- - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 - echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -@@ -12599,6 +28236,7 @@ - - - -+ - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - -@@ -12636,33 +28274,39 @@ - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - extern int _nl_msg_cat_cntr; - extern int *_nl_domain_bindings; --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif - int - main () - { - bindtextdomain ("", ""); --return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings -+return * gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -12671,10 +28315,12 @@ - gt_cv_func_gnugettext1_libc=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - gt_cv_func_gnugettext1_libc=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - fi - echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 - echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 -@@ -12892,7 +28538,7 @@ - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in -- linux*) haveit=yes;; -+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi -@@ -12936,7 +28582,7 @@ - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in -- linux*) haveit=yes;; -+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi -@@ -13069,37 +28715,43 @@ - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - extern int _nl_msg_cat_cntr; - extern - #ifdef __cplusplus - "C" - #endif --const char *_nl_expand_alias (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+const char *_nl_expand_alias (const char *); - int - main () - { - bindtextdomain ("", ""); --return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) -+return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("") - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -13108,44 +28760,52 @@ - gt_cv_func_gnugettext1_libintl=yes - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - gt_cv_func_gnugettext1_libintl=no - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF --#line $LINENO "configure" --#include "confdefs.h" -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ - #include - extern int _nl_msg_cat_cntr; - extern - #ifdef __cplusplus - "C" - #endif --const char *_nl_expand_alias (); --#ifdef F77_DUMMY_MAIN --# ifdef __cplusplus -- extern "C" --# endif -- int F77_DUMMY_MAIN() { return 1; } --#endif -+const char *_nl_expand_alias (const char *); - int - main () - { - bindtextdomain ("", ""); --return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) -+return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("") - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>&5 -+ (eval $ac_link) 2>conftest.er1 - ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && -- { ac_try='test -s conftest$ac_exeext' -+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? -@@ -13157,9 +28817,11 @@ - - else - echo "$as_me: failed program was:" >&5 --cat conftest.$ac_ext >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ - fi --rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" -@@ -13170,7 +28832,8 @@ - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ -- && test "$PACKAGE" != gettext; }; then -+ && test "$PACKAGE" != gettext-runtime \ -+ && test "$PACKAGE" != gettext-tools; }; then - gt_use_preinstalled_gnugettext=yes - else - LIBINTL= -@@ -13185,20 +28848,28 @@ - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then -- INTLOBJS="\$(GETTOBJS)" -- BUILD_INCLUDED_LIBINTL=yes -+ BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - LIBINTL="\${top_builddir}/intl/libintl.a $LIBICONV" - LTLIBINTL="\${top_builddir}/intl/libintl.a $LTLIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - -+ CATOBJEXT= - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - CATOBJEXT=.gmo - fi - - -+ if test -n "$INTL_MACOSX_LIBS"; then -+ if test "$gt_use_preinstalled_gnugettext" = "yes" \ -+ || test "$nls_cv_use_gnu_gettext" = "yes"; then -+ LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" -+ LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" -+ fi -+ fi -+ - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - -@@ -13211,6 +28882,26 @@ - fi - fi - -+ echo "$as_me:$LINENO: checking whether to use NLS" >&5 -+echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6 -+ echo "$as_me:$LINENO: result: $USE_NLS" >&5 -+echo "${ECHO_T}$USE_NLS" >&6 -+ if test "$USE_NLS" = "yes"; then -+ echo "$as_me:$LINENO: checking where the gettext function comes from" >&5 -+echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6 -+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then -+ if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then -+ gt_source="external libintl" -+ else -+ gt_source="libc" -+ fi -+ else -+ gt_source="included intl directory" -+ fi -+ echo "$as_me:$LINENO: result: $gt_source" >&5 -+echo "${ECHO_T}$gt_source" >&6 -+ fi -+ - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then -@@ -13260,7 +28951,7 @@ - fi - - -- if test "$PACKAGE" = gettext; then -+ if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then - BUILD_INCLUDED_LIBINTL=yes - fi - -@@ -13268,7 +28959,6 @@ - - - -- - nls_cv_header_intl= - nls_cv_header_libgt= - -@@ -13281,6 +28971,12 @@ - GENCAT=gencat - - -+ INTLOBJS= -+ if test "$USE_INCLUDED_LIBINTL" = yes; then -+ INTLOBJS="\$(GETTOBJS)" -+ fi -+ -+ - INTL_LIBTOOL_SUFFIX_PREFIX= - - -@@ -13318,8 +29014,8 @@ - fi - - --ac_config_files="$ac_config_files Makefile gsmlib/Makefile tests/Makefile apps/Makefile win32/Makefile doc/Makefile scripts/Makefile intl/Makefile po/Makefile.in ext/Makefile" --ac_config_commands="$ac_config_commands default" -+ ac_config_files="$ac_config_files Makefile gsmlib/Makefile tests/Makefile apps/Makefile win32/Makefile doc/Makefile scripts/Makefile intl/Makefile po/Makefile.in ext/Makefile" -+ ac_config_commands="$ac_config_commands default" - 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 -@@ -13330,7 +29026,7 @@ - # 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 overriden when -+# `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. - -@@ -13348,13 +29044,13 @@ - # `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" -+ "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 \ -- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" -+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; - } | -@@ -13365,7 +29061,7 @@ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache --if cmp -s $cache_file confcache; then :; else -+if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file -@@ -13384,18 +29080,33 @@ - # 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[ ]*=/{ -+ ac_vpsub='/^[ ]*VPATH[ ]*=/{ - s/:*\$(srcdir):*/:/; - s/:*\${srcdir}:*/:/; - s/:*@srcdir@:*/:/; --s/^\([^=]*=[ ]*\):*/\1/; -+s/^\([^=]*=[ ]*\):*/\1/; - s/:*$//; --s/^[^=]*=[ ]*$//; -+s/^[^=]*=[ ]*$//; - }' - fi - - DEFS=-DHAVE_CONFIG_H - -+ac_libobjs= -+ac_ltlibobjs= -+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue -+ # 1. Remove the extension, and $U if already installed. -+ ac_i=`echo "$ac_i" | -+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'` -+ # 2. Add them. -+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" -+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -+done -+LIBOBJS=$ac_libobjs -+ -+LTLIBOBJS=$ac_ltlibobjs -+ -+ - if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. - Usually this means the macro was only invoked conditionally." >&5 -@@ -13403,6 +29114,27 @@ - Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } - fi -+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then -+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -+Usually this means the macro was only invoked conditionally." >&5 -+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -+Usually this means the macro was only invoked conditionally." >&2;} -+ { (exit 1); exit 1; }; } -+fi -+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then -+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -+Usually this means the macro was only invoked conditionally." >&5 -+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -+Usually this means the macro was only invoked conditionally." >&2;} -+ { (exit 1); exit 1; }; } -+fi -+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then -+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -+Usually this means the macro was only invoked conditionally." >&5 -+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -+Usually this means the macro was only invoked conditionally." >&2;} -+ { (exit 1); exit 1; }; } -+fi - if test -z "${COMPILE_INTL_TRUE}" && test -z "${COMPILE_INTL_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"COMPILE_INTL\" was never defined. - Usually this means the macro was only invoked conditionally." >&5 -@@ -13424,11 +29156,12 @@ - # configure, is in config.log if it exists. - - debug=false -+ac_cs_recheck=false -+ac_cs_silent=false - SHELL=\${CONFIG_SHELL-$SHELL} - _ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF -- - ## --------------------- ## - ## M4sh Initialization. ## - ## --------------------- ## -@@ -13437,46 +29170,57 @@ - 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+"$@"}'='"$@"' - elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix - fi -+DUALCASE=1; export DUALCASE # for MKS sh - --# NLS nuisances. - # Support unset when possible. --if (FOO=FOO; unset FOO) >/dev/null 2>&1; then -+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset - else - as_unset=false - fi - --(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && -- { $as_unset LANG || test "${LANG+set}" != set; } || -- { LANG=C; export LANG; } --(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && -- { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || -- { LC_ALL=C; export LC_ALL; } --(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && -- { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || -- { LC_TIME=C; export LC_TIME; } --(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && -- { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || -- { LC_CTYPE=C; export LC_CTYPE; } --(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && -- { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || -- { LANGUAGE=C; export LANGUAGE; } --(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && -- { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || -- { LC_COLLATE=C; export LC_COLLATE; } --(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && -- { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || -- { LC_NUMERIC=C; export LC_NUMERIC; } --(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && -- { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || -- { LC_MESSAGES=C; export LC_MESSAGES; } -+ -+# Work around bugs in pre-3.0 UWIN ksh. -+$as_unset ENV MAIL MAILPATH -+PS1='$ ' -+PS2='> ' -+PS4='+ ' -+ -+# NLS nuisances. -+for as_var in \ -+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ -+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ -+ LC_TELEPHONE LC_TIME -+do -+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then -+ eval $as_var=C; export $as_var -+ else -+ $as_unset $as_var -+ fi -+done -+ -+# Required to use basename. -+if expr a : '\(a\)' >/dev/null 2>&1; 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 - - - # Name of the executable. --as_me=`(basename "$0") 2>/dev/null || -+as_me=`$as_basename "$0" || - $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ -@@ -13487,6 +29231,7 @@ - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - -+ - # PATH needs CR, and LINENO needs CR and PATH. - # Avoid depending upon Character Ranges. - as_cr_letters='abcdefghijklmnopqrstuvwxyz' -@@ -13497,15 +29242,15 @@ - - # The user is always right. - if test "${PATH_SEPARATOR+set}" != set; then -- echo "#! /bin/sh" >conftest.sh -- echo "exit 0" >>conftest.sh -- chmod +x conftest.sh -- if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then -+ echo "#! /bin/sh" >conf$$.sh -+ echo "exit 0" >>conf$$.sh -+ chmod +x conf$$.sh -+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi -- rm -f conftest.sh -+ rm -f conf$$.sh - fi - - -@@ -13554,6 +29299,8 @@ - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then -+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } -+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} -@@ -13627,13 +29374,20 @@ - fi - rm -f conf$$ conf$$.exe conf$$.file - -+if mkdir -p . 2>/dev/null; then -+ as_mkdir_p=: -+else -+ test -d ./-p && rmdir ./-p -+ as_mkdir_p=false -+fi -+ - as_executable_p="test -f" - - # Sed expression to map a string onto a valid CPP name. --as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" -+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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" -+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - # IFS -@@ -13643,7 +29397,7 @@ - IFS=" $as_nl" - - # CDPATH. --$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } -+$as_unset CDPATH - - exec 6>&1 - -@@ -13660,7 +29414,7 @@ - cat >&5 <<_CSEOF - - This file was extended by $as_me, which was --generated by GNU Autoconf 2.53. Invocation command line was -+generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS -@@ -13700,12 +29454,13 @@ - - -h, --help print this help, then exit - -V, --version print version number, then exit -+ -q, --quiet 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 -+ instantiate the configuration file FILE - --header=FILE[:TEMPLATE] -- instantiate the configuration header FILE -+ instantiate the configuration header FILE - - Configuration files: - $config_files -@@ -13722,11 +29477,10 @@ - cat >>$CONFIG_STATUS <<_ACEOF - ac_cs_version="\\ - config.status --configured by $0, generated by GNU Autoconf 2.53, -+configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - --Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 --Free Software Foundation, Inc. -+Copyright (C) 2003 Free Software Foundation, Inc. - This config.status script is free software; the Free Software Foundation - gives unlimited permission to copy, distribute and modify it." - srcdir=$srcdir -@@ -13743,25 +29497,25 @@ - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` -- shift -- set dummy "$ac_option" "$ac_optarg" ${1+"$@"} -- shift -+ ac_shift=: -+ ;; -+ -*) -+ ac_option=$1 -+ ac_optarg=$2 -+ ac_shift=shift - ;; -- -*);; - *) # This is not an option, so the user has probably given explicit - # arguments. -+ ac_option=$1 - ac_need_defaults=false;; - esac - -- case $1 in -+ case $ac_option in - # Handling of the options. - _ACEOF --cat >>$CONFIG_STATUS <<_ACEOF -- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) -- echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" -- exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; --_ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF -+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) -+ ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) -@@ -13776,13 +29530,16 @@ - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) -- shift -- CONFIG_FILES="$CONFIG_FILES $1" -+ $ac_shift -+ CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) -- shift -- CONFIG_HEADERS="$CONFIG_HEADERS $1" -+ $ac_shift -+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; -+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \ -+ | -silent | --silent | --silen | --sile | --sil | --si | --s) -+ ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -@@ -13797,6 +29554,20 @@ - 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 -+if \$ac_cs_recheck; then -+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 -+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -+fi -+ - _ACEOF - - cat >>$CONFIG_STATUS <<_ACEOF -@@ -13805,10 +29576,10 @@ - # - - AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" --# Capture the value of obsolete $ALL_LINGUAS because we need it to compute -- # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it -+# Capture the value of obsolete ALL_LINGUAS because we need it to compute -+ # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it - # from automake. -- eval 'ALL_LINGUAS''="$ALL_LINGUAS"' -+ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - -@@ -13852,6 +29623,9 @@ - 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 to put it here, and in addition, -+# creating and moving files from /tmp can sometimes cause problems. - # Create a temporary directory, and hook for its removal unless debugging. - $debug || - { -@@ -13860,17 +29634,17 @@ - } - - # Create a (secure) tmp directory for tmp files. --: ${TMPDIR=/tmp} -+ - { -- tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && -+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" - } || - { -- tmp=$TMPDIR/cs$$-$RANDOM -+ tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) - } || - { -- echo "$me: cannot create a temporary directory in $TMPDIR" >&2 -+ echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } - } - -@@ -13928,6 +29702,7 @@ - s,@ac_ct_CC@,$ac_ct_CC,;t t - s,@EXEEXT@,$EXEEXT,;t t - s,@OBJEXT@,$OBJEXT,;t t -+s,@CYGPATH_W@,$CYGPATH_W,;t t - s,@PACKAGE@,$PACKAGE,;t t - s,@VERSION@,$VERSION,;t t - s,@ACLOCAL@,$ACLOCAL,;t t -@@ -13935,13 +29710,17 @@ - s,@AUTOMAKE@,$AUTOMAKE,;t t - s,@AUTOHEADER@,$AUTOHEADER,;t t - s,@MAKEINFO@,$MAKEINFO,;t t --s,@AMTAR@,$AMTAR,;t t - s,@install_sh@,$install_sh,;t t - s,@STRIP@,$STRIP,;t t - s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t - s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -+s,@mkdir_p@,$mkdir_p,;t t - s,@AWK@,$AWK,;t t - s,@SET_MAKE@,$SET_MAKE,;t t -+s,@am__leading_dot@,$am__leading_dot,;t t -+s,@AMTAR@,$AMTAR,;t t -+s,@am__tar@,$am__tar,;t t -+s,@am__untar@,$am__untar,;t t - s,@DEPDIR@,$DEPDIR,;t t - s,@am__include@,$am__include,;t t - s,@am__quote@,$am__quote,;t t -@@ -13949,6 +29728,8 @@ - s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t - s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t - s,@CCDEPMODE@,$CCDEPMODE,;t t -+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t - s,@build@,$build,;t t - s,@build_cpu@,$build_cpu,;t t - s,@build_vendor@,$build_vendor,;t t -@@ -13957,35 +29738,50 @@ - s,@host_cpu@,$host_cpu,;t t - s,@host_vendor@,$host_vendor,;t t - s,@host_os@,$host_os,;t t -+s,@EGREP@,$EGREP,;t t - s,@LN_S@,$LN_S,;t t - s,@ECHO@,$ECHO,;t t -+s,@AR@,$AR,;t t -+s,@ac_ct_AR@,$ac_ct_AR,;t t - s,@RANLIB@,$RANLIB,;t t - s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t - s,@CPP@,$CPP,;t t --s,@LIBTOOL@,$LIBTOOL,;t t - s,@CXX@,$CXX,;t t - s,@CXXFLAGS@,$CXXFLAGS,;t t - s,@ac_ct_CXX@,$ac_ct_CXX,;t t - s,@CXXDEPMODE@,$CXXDEPMODE,;t t -+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -+s,@CXXCPP@,$CXXCPP,;t t -+s,@F77@,$F77,;t t -+s,@FFLAGS@,$FFLAGS,;t t -+s,@ac_ct_F77@,$ac_ct_F77,;t t -+s,@LIBTOOL@,$LIBTOOL,;t t - s,@ALLOCA@,$ALLOCA,;t t - s,@GSM_VERSION@,$GSM_VERSION,;t t - s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t -+s,@USE_NLS@,$USE_NLS,;t t - s,@MSGFMT@,$MSGFMT,;t t - s,@GMSGFMT@,$GMSGFMT,;t t - s,@XGETTEXT@,$XGETTEXT,;t t - s,@MSGMERGE@,$MSGMERGE,;t t -+s,@GLIBC2@,$GLIBC2,;t t - s,@GLIBC21@,$GLIBC21,;t t -+s,@INTL_MACOSX_LIBS@,$INTL_MACOSX_LIBS,;t t -+s,@HAVE_POSIX_PRINTF@,$HAVE_POSIX_PRINTF,;t t -+s,@HAVE_ASPRINTF@,$HAVE_ASPRINTF,;t t -+s,@HAVE_SNPRINTF@,$HAVE_SNPRINTF,;t t -+s,@HAVE_WPRINTF@,$HAVE_WPRINTF,;t t - s,@LIBICONV@,$LIBICONV,;t t - s,@LTLIBICONV@,$LTLIBICONV,;t t - s,@INTLBISON@,$INTLBISON,;t t --s,@USE_NLS@,$USE_NLS,;t t - s,@BUILD_INCLUDED_LIBINTL@,$BUILD_INCLUDED_LIBINTL,;t t - s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t - s,@CATOBJEXT@,$CATOBJEXT,;t t --s,@INTLOBJS@,$INTLOBJS,;t t - s,@DATADIRNAME@,$DATADIRNAME,;t t - s,@INSTOBJEXT@,$INSTOBJEXT,;t t - s,@GENCAT@,$GENCAT,;t t -+s,@INTLOBJS@,$INTLOBJS,;t t - s,@INTL_LIBTOOL_SUFFIX_PREFIX@,$INTL_LIBTOOL_SUFFIX_PREFIX,;t t - s,@INTLLIBS@,$INTLLIBS,;t t - s,@LIBINTL@,$LIBINTL,;t t -@@ -13993,6 +29789,8 @@ - s,@POSUB@,$POSUB,;t t - s,@COMPILE_INTL_TRUE@,$COMPILE_INTL_TRUE,;t t - s,@COMPILE_INTL_FALSE@,$COMPILE_INTL_FALSE,;t t -+s,@LIBOBJS@,$LIBOBJS,;t t -+s,@LTLIBOBJS@,$LTLIBOBJS,;t t - CEOF - - _ACEOF -@@ -14022,9 +29820,9 @@ - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then -- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" -+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else -- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" -+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end -@@ -14042,46 +29840,51 @@ - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin -- cat >$tmp/stdin -- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` -- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; -+ cat >$tmp/stdin -+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` -+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` -- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; -+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || - $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -- X"$ac_file" : 'X\(//\)[^/]' \| \ -- X"$ac_file" : 'X\(//\)$' \| \ -- X"$ac_file" : 'X\(/\)' \| \ -- . : '\(.\)' 2>/dev/null || -+ X"$ac_file" : 'X\(//\)[^/]' \| \ -+ X"$ac_file" : 'X\(//\)$' \| \ -+ X"$ac_file" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || - echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` -- { case "$ac_dir" in -- [\\/]* | ?:[\\/]* ) as_incr_dir=;; -- *) as_incr_dir=.;; --esac --as_dummy="$ac_dir" --for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do -- case $as_mkdir_dir in -- # Skip DOS drivespec -- ?:) as_incr_dir=$as_mkdir_dir ;; -- *) -- as_incr_dir=$as_incr_dir/$as_mkdir_dir -- test -d "$as_incr_dir" || -- mkdir "$as_incr_dir" || -- { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 --echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} -- { (exit 1); exit 1; }; } -- ;; -- esac --done; } -+ { if $as_mkdir_p; then -+ mkdir -p "$ac_dir" -+ else -+ as_dir="$ac_dir" -+ as_dirs= -+ while test ! -d "$as_dir"; do -+ as_dirs="$as_dir $as_dirs" -+ as_dir=`(dirname "$as_dir") 2>/dev/null || -+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -+ X"$as_dir" : 'X\(//\)[^/]' \| \ -+ X"$as_dir" : 'X\(//\)$' \| \ -+ X"$as_dir" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || -+echo X"$as_dir" | -+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } -+ /^X\(\/\/\)[^/].*/{ s//\1/; q; } -+ /^X\(\/\/\)$/{ s//\1/; q; } -+ /^X\(\/\).*/{ s//\1/; q; } -+ s/.*/./; q'` -+ done -+ test ! -n "$as_dirs" || mkdir $as_dirs -+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} -+ { (exit 1); exit 1; }; }; } - - ac_builddir=. - -@@ -14108,12 +29911,45 @@ - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; - esac --# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be --# absolute. --ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` --ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` --ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` --ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` -+ -+# Do not use `cd foo && pwd` to compute absolute paths, because -+# the directories may not exist. -+case `pwd` in -+.) ac_abs_builddir="$ac_dir";; -+*) -+ case "$ac_dir" in -+ .) ac_abs_builddir=`pwd`;; -+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; -+ *) ac_abs_builddir=`pwd`/"$ac_dir";; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_top_builddir=${ac_top_builddir}.;; -+*) -+ case ${ac_top_builddir}. in -+ .) ac_abs_top_builddir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; -+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_srcdir=$ac_srcdir;; -+*) -+ case $ac_srcdir in -+ .) ac_abs_srcdir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; -+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_top_srcdir=$ac_top_srcdir;; -+*) -+ case $ac_top_srcdir in -+ .) ac_abs_top_srcdir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; -+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; -+ esac;; -+esac - - - case $INSTALL in -@@ -14121,11 +29957,6 @@ - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - -- if test x"$ac_file" != x-; then -- { echo "$as_me:$LINENO: creating $ac_file" >&5 --echo "$as_me: creating $ac_file" >&6;} -- rm -f "$ac_file" -- fi - # 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. */ -@@ -14135,7 +29966,7 @@ - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | -- sed 's,.*/,,'` by configure." -+ sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. -@@ -14144,26 +29975,32 @@ - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) -- # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -+ # Absolute (can't be DOS-style, as IFS=:) -+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } -- echo $f;; -+ echo "$f";; - *) # Relative -- if test -f "$f"; then -- # Build tree -- echo $f -- elif test -f "$srcdir/$f"; then -- # Source tree -- echo $srcdir/$f -- else -- # /dev/null tree -- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -+ if test -f "$f"; then -+ # Build tree -+ echo "$f" -+ elif test -f "$srcdir/$f"; then -+ # Source tree -+ echo "$srcdir/$f" -+ else -+ # /dev/null tree -+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } -- fi;; -+ fi;; - esac - done` || { (exit 1); exit 1; } -+ -+ if test x"$ac_file" != x-; then -+ { echo "$as_me:$LINENO: creating $ac_file" >&5 -+echo "$as_me: creating $ac_file" >&6;} -+ rm -f "$ac_file" -+ fi - _ACEOF - cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -@@ -14203,12 +30040,12 @@ - # NAME is the cpp macro being defined and VALUE is the value it is being given. - # - # ac_d sets the value in "#define NAME VALUE" lines. --ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' --ac_dB='[ ].*$,\1#\2' -+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -+ac_dB='[ ].*$,\1#\2' - ac_dC=' ' - ac_dD=',;t' - # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". --ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' - ac_uB='$,\1#\2define\3' - ac_uC=' ' - ac_uD=',;t' -@@ -14217,11 +30054,11 @@ - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin -- cat >$tmp/stdin -- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` -- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; -+ cat >$tmp/stdin -+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` -+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` -- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; -+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - -@@ -14235,28 +30072,29 @@ - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) -- # Absolute (can't be DOS-style, as IFS=:) -- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -+ # Absolute (can't be DOS-style, as IFS=:) -+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } -- echo $f;; -+ # Do quote $f, to prevent DOS paths from being IFS'd. -+ echo "$f";; - *) # Relative -- if test -f "$f"; then -- # Build tree -- echo $f -- elif test -f "$srcdir/$f"; then -- # Source tree -- echo $srcdir/$f -- else -- # /dev/null tree -- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -+ if test -f "$f"; then -+ # Build tree -+ echo "$f" -+ elif test -f "$srcdir/$f"; then -+ # Source tree -+ echo "$srcdir/$f" -+ else -+ # /dev/null tree -+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 - echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } -- fi;; -+ fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. -- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in -+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - - _ACEOF - -@@ -14279,9 +30117,9 @@ - s,[\\$`],\\&,g - t clear - : clear --s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp - t end --s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp - : end - _ACEOF - # If some macros were called several times there might be several times -@@ -14295,13 +30133,13 @@ - # example, in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - cat >>conftest.undefs <<\_ACEOF --s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, - _ACEOF - - # Break up conftest.defines because some shells have a limit on the size - # of here documents, and old seds have small limits too (100 cmds). - echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS --echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS - echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS - echo ' :' >>$CONFIG_STATUS - rm -f conftest.tail -@@ -14310,7 +30148,7 @@ - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. -- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS -+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS -@@ -14325,7 +30163,7 @@ - mv conftest.tail conftest.defines - done - rm -f conftest.defines --echo ' fi # egrep' >>$CONFIG_STATUS -+echo ' fi # grep' >>$CONFIG_STATUS - echo >>$CONFIG_STATUS - - # Break up conftest.undefs because some shells have a limit on the size -@@ -14337,7 +30175,7 @@ - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' -- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS -+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS -@@ -14365,41 +30203,46 @@ - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then -- if cmp -s $ac_file $tmp/config.h 2>/dev/null; then -+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 - echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || - $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -- X"$ac_file" : 'X\(//\)[^/]' \| \ -- X"$ac_file" : 'X\(//\)$' \| \ -- X"$ac_file" : 'X\(/\)' \| \ -- . : '\(.\)' 2>/dev/null || -+ X"$ac_file" : 'X\(//\)[^/]' \| \ -+ X"$ac_file" : 'X\(//\)$' \| \ -+ X"$ac_file" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || - echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` -- { case "$ac_dir" in -- [\\/]* | ?:[\\/]* ) as_incr_dir=;; -- *) as_incr_dir=.;; --esac --as_dummy="$ac_dir" --for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do -- case $as_mkdir_dir in -- # Skip DOS drivespec -- ?:) as_incr_dir=$as_mkdir_dir ;; -- *) -- as_incr_dir=$as_incr_dir/$as_mkdir_dir -- test -d "$as_incr_dir" || -- mkdir "$as_incr_dir" || -- { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 --echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} -- { (exit 1); exit 1; }; } -- ;; -- esac --done; } -+ { if $as_mkdir_p; then -+ mkdir -p "$ac_dir" -+ else -+ as_dir="$ac_dir" -+ as_dirs= -+ while test ! -d "$as_dir"; do -+ as_dirs="$as_dir $as_dirs" -+ as_dir=`(dirname "$as_dir") 2>/dev/null || -+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -+ X"$as_dir" : 'X\(//\)[^/]' \| \ -+ X"$as_dir" : 'X\(//\)$' \| \ -+ X"$as_dir" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || -+echo X"$as_dir" | -+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } -+ /^X\(\/\/\)[^/].*/{ s//\1/; q; } -+ /^X\(\/\/\)$/{ s//\1/; q; } -+ /^X\(\/\).*/{ s//\1/; q; } -+ s/.*/./; q'` -+ done -+ test ! -n "$as_dirs" || mkdir $as_dirs -+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} -+ { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file -@@ -14408,13 +30251,29 @@ - cat $tmp/config.h - rm -f $tmp/config.h - fi -- # Run the commands associated with the file. -- case $ac_file in -- gsm_config.h ) # update the timestamp --echo 'timestamp for gsm_config.h' >"./stamp-h1" -- ;; -+# Compute $ac_file's index in $config_headers. -+_am_stamp_count=1 -+for _am_header in $config_headers :; do -+ case $_am_header in -+ $ac_file | $ac_file:* ) -+ break ;; -+ * ) -+ _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac - done -+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -+ X$ac_file : 'X\(//\)[^/]' \| \ -+ X$ac_file : 'X\(//\)$' \| \ -+ X$ac_file : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || -+echo X$ac_file | -+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } -+ /^X\(\/\/\)[^/].*/{ s//\1/; q; } -+ /^X\(\/\/\)$/{ s//\1/; q; } -+ /^X\(\/\).*/{ s//\1/; q; } -+ s/.*/./; q'`/stamp-h$_am_stamp_count -+done - _ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF - -@@ -14426,16 +30285,41 @@ - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || - $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -- X"$ac_dest" : 'X\(//\)[^/]' \| \ -- X"$ac_dest" : 'X\(//\)$' \| \ -- X"$ac_dest" : 'X\(/\)' \| \ -- . : '\(.\)' 2>/dev/null || -+ X"$ac_dest" : 'X\(//\)[^/]' \| \ -+ X"$ac_dest" : 'X\(//\)$' \| \ -+ X"$ac_dest" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || - echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` -+ { if $as_mkdir_p; then -+ mkdir -p "$ac_dir" -+ else -+ as_dir="$ac_dir" -+ as_dirs= -+ while test ! -d "$as_dir"; do -+ as_dirs="$as_dir $as_dirs" -+ as_dir=`(dirname "$as_dir") 2>/dev/null || -+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -+ X"$as_dir" : 'X\(//\)[^/]' \| \ -+ X"$as_dir" : 'X\(//\)$' \| \ -+ X"$as_dir" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || -+echo X"$as_dir" | -+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } -+ /^X\(\/\/\)[^/].*/{ s//\1/; q; } -+ /^X\(\/\/\)$/{ s//\1/; q; } -+ /^X\(\/\).*/{ s//\1/; q; } -+ s/.*/./; q'` -+ done -+ test ! -n "$as_dirs" || mkdir $as_dirs -+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} -+ { (exit 1); exit 1; }; }; } -+ - ac_builddir=. - - if test "$ac_dir" != .; then -@@ -14461,12 +30345,45 @@ - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; - esac --# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be --# absolute. --ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` --ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` --ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` --ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` -+ -+# Do not use `cd foo && pwd` to compute absolute paths, because -+# the directories may not exist. -+case `pwd` in -+.) ac_abs_builddir="$ac_dir";; -+*) -+ case "$ac_dir" in -+ .) ac_abs_builddir=`pwd`;; -+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; -+ *) ac_abs_builddir=`pwd`/"$ac_dir";; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_top_builddir=${ac_top_builddir}.;; -+*) -+ case ${ac_top_builddir}. in -+ .) ac_abs_top_builddir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; -+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_srcdir=$ac_srcdir;; -+*) -+ case $ac_srcdir in -+ .) ac_abs_srcdir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; -+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; -+ esac;; -+esac -+case $ac_abs_builddir in -+.) ac_abs_top_srcdir=$ac_top_srcdir;; -+*) -+ case $ac_top_srcdir in -+ .) ac_abs_top_srcdir=$ac_abs_builddir;; -+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; -+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; -+ esac;; -+esac - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -@@ -14484,10 +30401,10 @@ - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || - $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -- X"$mf" : 'X\(//\)[^/]' \| \ -- X"$mf" : 'X\(//\)$' \| \ -- X"$mf" : 'X\(/\)' \| \ -- . : '\(.\)' 2>/dev/null || -+ X"$mf" : 'X\(//\)[^/]' \| \ -+ X"$mf" : 'X\(//\)$' \| \ -+ X"$mf" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || - echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } -@@ -14497,61 +30414,60 @@ - else - continue - fi -- grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue -- # Extract the definition of DEP_FILES from the Makefile without -- # running `make'. -- DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` -+ # Extract the definition of DEPDIR, am__include, and am__quote -+ # from the Makefile without running `make'. -+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue -+ am__include=`sed -n 's/^am__include = //p' < "$mf"` -+ test -z "am__include" && continue -+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it -- U=`sed -n -e '/^U = / s///p' < "$mf"` -- test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" -- # We invoke sed twice because it is the simplest approach to -- # changing $(DEPDIR) to its actual value in the expansion. -- for file in `sed -n -e ' -- /^DEP_FILES = .*\\\\$/ { -- s/^DEP_FILES = // -- :loop -- s/\\\\$// -- p -- n -- /\\\\$/ b loop -- p -- } -- /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ -+ U=`sed -n 's/^U = //p' < "$mf"` -+ # Find all dependency output files, they are included files with -+ # $(DEPDIR) in their names. We invoke sed twice because it is the -+ # simplest approach to changing $(DEPDIR) to its actual value in the -+ # expansion. -+ for file in `sed -n " -+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || - $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -- X"$file" : 'X\(//\)[^/]' \| \ -- X"$file" : 'X\(//\)$' \| \ -- X"$file" : 'X\(/\)' \| \ -- . : '\(.\)' 2>/dev/null || -+ X"$file" : 'X\(//\)[^/]' \| \ -+ X"$file" : 'X\(//\)$' \| \ -+ X"$file" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || - echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` -- { case $dirpart/$fdir in -- [\\/]* | ?:[\\/]* ) as_incr_dir=;; -- *) as_incr_dir=.;; --esac --as_dummy=$dirpart/$fdir --for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do -- case $as_mkdir_dir in -- # Skip DOS drivespec -- ?:) as_incr_dir=$as_mkdir_dir ;; -- *) -- as_incr_dir=$as_incr_dir/$as_mkdir_dir -- test -d "$as_incr_dir" || -- mkdir "$as_incr_dir" || -- { { echo "$as_me:$LINENO: error: cannot create $dirpart/$fdir" >&5 --echo "$as_me: error: cannot create $dirpart/$fdir" >&2;} -- { (exit 1); exit 1; }; } -- ;; -- esac --done; } -+ { if $as_mkdir_p; then -+ mkdir -p $dirpart/$fdir -+ else -+ as_dir=$dirpart/$fdir -+ as_dirs= -+ while test ! -d "$as_dir"; do -+ as_dirs="$as_dir $as_dirs" -+ as_dir=`(dirname "$as_dir") 2>/dev/null || -+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ -+ X"$as_dir" : 'X\(//\)[^/]' \| \ -+ X"$as_dir" : 'X\(//\)$' \| \ -+ X"$as_dir" : 'X\(/\)' \| \ -+ . : '\(.\)' 2>/dev/null || -+echo X"$as_dir" | -+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } -+ /^X\(\/\/\)[^/].*/{ s//\1/; q; } -+ /^X\(\/\/\)$/{ s//\1/; q; } -+ /^X\(\/\).*/{ s//\1/; q; } -+ s/.*/./; q'` -+ done -+ test ! -n "$as_dirs" || mkdir $as_dirs -+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} -+ { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" -@@ -14578,35 +30494,51 @@ - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac -+ # Treat a directory as a PO directory if and only if it has a -+ # POTFILES.in file. This allows packages to have multiple PO -+ # directories under different names or in different locations. - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" -- # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend -+ POMAKEFILEDEPS="POTFILES.in" -+ # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. -- if test -n "$ALL_LINGUAS"; then -+ if test -n "$OBSOLETE_ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi -- ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` -+ ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' -+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" -+ else -+ # The set of available languages was given in configure.in. -+ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' - fi -+ # Compute POFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) -+ # Compute UPDATEPOFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) -+ # Compute DUMMYPOFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) -+ # Compute GMOFILES -+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= -- GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= -+ GMOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" -- GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" -+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. -@@ -14641,7 +30573,7 @@ - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" -- sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" -+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in -@@ -14677,8 +30609,11 @@ - # 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_cs_success=false -+ $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. ---- gsmlib-1.10.orig/stamp-h.in -+++ gsmlib-1.10/stamp-h.in -@@ -0,0 +1 @@ -+timestamp ---- gsmlib-1.10.orig/apps/gsmsmsstore.cc -+++ gsmlib-1.10/apps/gsmsmsstore.cc -@@ -292,19 +292,14 @@ - sourceStore = new SortedSMSStore(sourceMeTa->getSMSStore(storeName)); - } - -- // make sure destination file exists -+ // make sure destination file exists if specified -+ // Use isFile() for its exception-throwing properties, and discard -+ // return value cos we don't care (yet) whether it's a device or a -+ // regular file. - if (destination != "") -- { -- try -- { -- ofstream f(destination.c_str(), ios::out | ios::app | ios::binary); -- } -- catch (exception) -- { -- } -- } -+ isFile(destination); - -- // start accessing destination destination store or file -+ // start accessing destination store or file - if (operation == CopyOp || operation == BackupOp || operation == AddOp || - operation == DeleteOp) - if (destination == "-") ---- gsmlib-1.10.orig/apps/gsmsmsd.cc -+++ gsmlib-1.10/apps/gsmsmsd.cc -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #endif - #if defined(HAVE_GETOPT_LONG) || defined(WIN32) - #include -@@ -39,6 +40,7 @@ - #include - #include - #include -+#include - - using namespace std; - using namespace gsmlib; -@@ -53,6 +55,12 @@ - {"store", required_argument, (int*)NULL, 't'}, - {"device", required_argument, (int*)NULL, 'd'}, - {"spool", required_argument, (int*)NULL, 's'}, -+ {"sent", required_argument, (int*)NULL, 'S'}, -+ {"failed", required_argument, (int*)NULL, 'F'}, -+ {"priorities", required_argument, (int*)NULL, 'P'}, -+#ifndef WIN32 -+ {"syslog", no_argument, (int*)NULL, 'L'}, -+#endif - {"sca", required_argument, (int*)NULL, 'C'}, - {"flush", no_argument, (int*)NULL, 'f'}, - {"concatenate", required_argument, (int*)NULL, 'c'}, -@@ -178,9 +186,21 @@ - - bool requestStatusReport = false; - --void sendSMS(string spoolDir, Ref at) -+void sendSMS(string spoolDirBase, string sentDirBase, string failedDirBase, -+ unsigned int priority, bool enableSyslog, Ref at) - { -- if (spoolDir != "") -+ string spoolDir = spoolDirBase; -+ string sentDir = sentDirBase; -+ string failedDir = failedDirBase; -+ if ( priority >= 1 ) -+ { -+ spoolDir = spoolDirBase + stringPrintf(_("%d"),priority); -+ sentDir = sentDirBase + stringPrintf(_("%d"),priority); -+ failedDir = failedDirBase + stringPrintf(_("%d"),priority); -+ } -+ if ( priority > 1 ) -+ sendSMS(spoolDirBase, sentDirBase, failedDirBase, priority-1, enableSyslog, at); -+ if (spoolDirBase != "") - { - // look into spoolDir for any outgoing SMS that should be sent - #ifdef WIN32 -@@ -211,6 +231,8 @@ - strcmp(entry->d_name, "..") != 0) - #endif - { -+ if ( priority > 1 ) -+ sendSMS(spoolDirBase, sentDirBase, failedDirBase, priority-1, enableSyslog, at); - // read in file - // the first line is interpreted as the phone number - // the rest is the message -@@ -221,11 +243,30 @@ - #endif - ifstream ifs(filename.c_str()); - if (! ifs) -+#ifndef WIN32 -+ if (enableSyslog) -+ { -+ syslog(LOG_WARNING, "Could not open SMS spool file %s", -+ filename.c_str()); -+ if (failedDirBase != "") { -+ string failedfilename = failedDir + "/" + entry->d_name; -+ rename(filename.c_str(),failedfilename.c_str()); -+ } -+ continue; -+ } -+ else -+#endif - throw GsmException( - stringPrintf(_("count not open SMS spool file %s"), - filename.c_str()), ParameterError); - char phoneBuf[1001]; - ifs.getline(phoneBuf, 1000); -+ for(int i=0;i<1000;i++) -+ if(phoneBuf[i]=='\t' || phoneBuf[i]==0) -+ { // ignore everything after a in the phone number -+ phoneBuf[i]=0; -+ break; -+ } - string text; - while (! ifs.eof()) - { -@@ -252,17 +293,51 @@ - submitSMS->setStatusReportRequest(requestStatusReport); - Address destAddr(phoneNumber); - submitSMS->setDestinationAddress(destAddr); -- if (concatenatedMessageId == -1) -- me->sendSMSs(submitSMS, text, true); -- else -+ try - { -- // maximum for concatenatedMessageId is 255 -- if (concatenatedMessageId > 256) -- concatenatedMessageId = 0; -- me->sendSMSs(submitSMS, text, false, concatenatedMessageId++); -+ if (concatenatedMessageId == -1) -+ me->sendSMSs(submitSMS, text, true); -+ else -+ { -+ // maximum for concatenatedMessageId is 255 -+ if (concatenatedMessageId > 256) -+ concatenatedMessageId = 0; -+ me->sendSMSs(submitSMS, text, false, concatenatedMessageId++); -+ } -+#ifndef WIN32 -+ if (enableSyslog) -+ syslog(LOG_NOTICE, "Sent SMS to %s from file %s", phoneBuf, filename.c_str()); -+#endif -+ if (sentDirBase != "") { -+#ifdef WIN32 -+ string sentfilename = sentDir + "\\" + fileInfo.name; -+#else -+ string sentfilename = sentDir + "/" + entry->d_name; -+#endif -+ rename(filename.c_str(),sentfilename.c_str()); -+ } else { -+ unlink(filename.c_str()); -+ } -+ } -+ catch (GsmException &me) -+ { -+#ifndef WIN32 -+ if (enableSyslog) -+ syslog(LOG_WARNING, "Failed sending SMS to %s from file %s: %s", phoneBuf, -+ filename.c_str(), me.what()); -+ else -+#endif -+ cerr << "Failed sending SMS to " << phoneBuf << " from " -+ << filename << ": " << me.what() << endl; -+ if (failedDirBase != "") { -+#ifdef WIN32 -+ string failedfilename = failedDir + "\\" + fileInfo.name; -+#else -+ string failedfilename = failedDir + "/" + entry->d_name; -+#endif -+ rename(filename.c_str(),failedfilename.c_str()); -+ } - } -- -- unlink(filename.c_str()); - #ifdef WIN32 - } - moreFiles = _findnext(fileHandle, &fileInfo) == 0; -@@ -276,10 +351,18 @@ - } - } - -+#ifndef WIN32 -+void syslogExit(int exitcode, int *dummy) -+{ -+ syslog(LOG_NOTICE, "exited (exit %d)",exitcode); -+} -+#endif -+ - // *** main program - - int main(int argc, char *argv[]) - { -+ bool enableSyslog = false; - try - { - string device = "/dev/mobilephone"; -@@ -291,13 +374,16 @@ - bool flushSMS = false; - bool onlyReceptionIndication = true; - string spoolDir; -+ string sentDir = ""; -+ string failedDir = ""; -+ unsigned int priorities = 0; - string initString = DEFAULT_INIT_STRING; - bool swHandshake = false; - string concatenatedMessageIdStr; - - int opt; - int dummy; -- while((opt = getopt_long(argc, argv, "c:C:I:t:fd:a:b:hvs:XDr", -+ while((opt = getopt_long(argc, argv, "c:C:I:t:fd:a:b:hvs:S:F:P:LXDr", - longOpts, &dummy)) != -1) - switch (opt) - { -@@ -328,6 +414,18 @@ - case 's': - spoolDir = optarg; - break; -+ case 'L': -+ enableSyslog = true; -+ break; -+ case 'S': -+ sentDir = optarg; -+ break; -+ case 'F': -+ failedDir = optarg; -+ break; -+ case 'P': -+ priorities = abs(atoi(optarg)); -+ break; - case 'f': - flushSMS = true; - break; -@@ -360,11 +458,21 @@ - << _(" -d, --device sets the device to connect to") << endl - << _(" -D, --direct enable direct routing of SMSs") << endl - << _(" -f, --flush flush SMS from store") << endl -+ << _(" -F, --failed directory to move failed SMS to,") << endl -+ << _(" if unset, the SMS will be deleted") << endl - << _(" -h, --help prints this message") << endl - << _(" -I, --init device AT init sequence") << endl -+#ifndef WIN32 -+ << _(" -L, --syslog log errors and information to syslog") -+ << endl -+#endif -+ << _(" -P, --priorities number of priority levels to use,") << endl -+ << _(" (default: none)") << endl - << _(" -r, --requeststat request SMS status report") << endl - << _(" -s, --spool spool directory for outgoing SMS") - << endl -+ << _(" -S, --sent directory to move sent SMS to,") << endl -+ << _(" if unset, the SMS will be deleted") << endl - << _(" -t, --store name of SMS store to use for flush\n" - " and/or temporary SMS storage") << endl - << endl -@@ -380,6 +488,14 @@ - << endl << endl - << _(" default is \"sms cb stat\"") << endl << endl - << _("If no action is given, the SMS is printed to stdout") -+ << endl << endl -+ << _("If -P is given, it activates the priority system and sets the") << endl -+ << _("number or levels to use. For every level, there must be directories") << endl -+ << _("named +.") << endl -+ << _("For example \"-P 2 -s queue -S send -F failed\" needs the following") <getAt()); -+ sendSMS(spoolDir, sentDir, failedDir, priorities, enableSyslog, me->getAt()); - } - } - catch (GsmException &ge) ---- gsmlib-1.10.orig/gsmlib/gsm_unix_serial.cc -+++ gsmlib-1.10/gsmlib/gsm_unix_serial.cc -@@ -20,12 +20,14 @@ - #include - #include - #include -+#include - #include - #include - #include - #include - #include - #include -+#include - - using namespace std; - using namespace gsmlib; -@@ -131,7 +133,7 @@ - { - int res = read(_fd, &c, 1); - if (res != 1) -- return -1; -+ throwModemException(_("end of file when reading from TA")); - else - readDone = true; - break; -@@ -178,11 +180,15 @@ - - // switch off non-blocking mode - int fdFlags; -- if ((fdFlags = fcntl(_fd, F_GETFL)) == -1) -+ if ((fdFlags = fcntl(_fd, F_GETFL)) == -1) { -+ close(_fd); - throwModemException(_("getting file status flags failed")); -+ } - fdFlags &= ~O_NONBLOCK; -- if (fcntl(_fd, F_SETFL, fdFlags) == -1) -+ if (fcntl(_fd, F_SETFL, fdFlags) == -1) { -+ close(_fd); - throwModemException(_("switching of non-blocking mode failed")); -+ } - - long int saveTimeoutVal = _timeoutVal; - _timeoutVal = 3; -@@ -194,17 +200,22 @@ - - // toggle DTR to reset modem - int mctl = TIOCM_DTR; -- if (ioctl(_fd, TIOCMBIC, &mctl) < 0) -+ if (ioctl(_fd, TIOCMBIC, &mctl) < 0) { -+ close(_fd); - throwModemException(_("clearing DTR failed")); -+ } - // the waiting time for DTR toggling is increased with each loop - usleep(holdoff[initTries]); -- if (ioctl(_fd, TIOCMBIS, &mctl) < 0) -+ if (ioctl(_fd, TIOCMBIS, &mctl) < 0) { -+ close(_fd); - throwModemException(_("setting DTR failed")); -- -+ } - // get line modes -- if (tcgetattr(_fd, &t) < 0) -+ if (tcgetattr(_fd, &t) < 0) { -+ close(_fd); - throwModemException(stringPrintf(_("tcgetattr device '%s'"), - device.c_str())); -+ } - - // set line speed - cfsetispeed(&t, lineSpeed); -@@ -229,9 +240,11 @@ - t.c_cc[VSUSP] = 0; - - // write back -- if(tcsetattr (_fd, TCSANOW, &t) < 0) -+ if(tcsetattr (_fd, TCSANOW, &t) < 0) { -+ close(_fd); - throwModemException(stringPrintf(_("tcsetattr device '%s'"), - device.c_str())); -+ } - // the waiting time for writing to the ME/TA is increased with each loop - usleep(holdoff[initTries]); - -@@ -279,11 +292,14 @@ - catch (GsmException &e) - { - _timeoutVal = saveTimeoutVal; -- if (initTries == 0) -+ if (initTries == 0) { -+ close(_fd); - throw e; -+ } - } - } - // no response after 3 tries -+ close(_fd); - throw GsmException(stringPrintf(_("reset modem failed '%s'"), - device.c_str()), OtherError); - } ---- gsmlib-1.10.orig/gsmlib/gsm_me_ta.cc -+++ gsmlib-1.10/gsmlib/gsm_me_ta.cc -@@ -19,6 +19,8 @@ - #include - #include - -+#include -+ - using namespace std; - using namespace gsmlib; - ---- gsmlib-1.10.orig/gsmlib/gsm_sorted_phonebook.cc -+++ gsmlib-1.10/gsmlib/gsm_sorted_phonebook.cc -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - - const int MAX_LINE_SIZE = 1000; - ---- gsmlib-1.10.orig/gsmlib/gsm_sms_codec.cc -+++ gsmlib-1.10/gsmlib/gsm_sms_codec.cc -@@ -23,6 +23,7 @@ - #ifdef HAVE_STRING_H - #include - #endif -+#include - #include - using namespace std; - using namespace gsmlib; ---- gsmlib-1.10.orig/gsmlib/gsm_at.cc -+++ gsmlib-1.10/gsmlib/gsm_at.cc -@@ -106,11 +106,27 @@ - putLine("AT" + atCommand); - // and gobble up CR/LF (and possibly echoed characters if echo can't be - // switched off) -+ // Also, some mobiles (e.g., Sony Ericsson K800i) respond to commands -+ // like "at+cmgf=0" with "+CMGF: 0" on success as well as the "OK" -+ // status -- so gobble that (but not if that sort of response was expected) -+ // FIXME: this is a gross hack, should be done via capabilities or sth -+ #include -+ string::size_type loc = atCommand.find( "=", 1 ); -+ string expect; -+ if (loc != string::npos) { -+ expect = atCommand; -+ expect.replace(loc, 1, " "); -+ expect.insert(loc, ":"); -+ } else { -+ expect = ""; -+ } - do - { - s = normalize(getLine()); - } -- while (s.length() == 0 || s == "AT" + atCommand); -+ while (s.length() == 0 || s == "AT" + atCommand || -+ ((response.length() == 0 || !matchResponse(s, response)) && -+ (expect.length() > 0 && matchResponse(s, expect)))); - - // handle errors - if (matchResponse(s, "+CME ERROR:") || matchResponse(s, "+CMS ERROR:")) ---- gsmlib-1.10.orig/gsmlib/gsm_map_key.h -+++ gsmlib-1.10/gsmlib/gsm_map_key.h -@@ -27,6 +27,7 @@ - - template class MapKey - { -+ public: - SortedStore &_myStore; // my store - // different type keys - Address _addressKey; -@@ -45,6 +46,7 @@ - MapKey(SortedStore &myStore, string key) : - _myStore(myStore), _strKey(key) {} - -+/* - friend - bool operator< - #ifndef WIN32 -@@ -59,6 +61,7 @@ - #endif - (const MapKey &x, - const MapKey &y); -+*/ - }; - - // compare two keys -@@ -72,7 +75,7 @@ - // MapKey members - - template -- bool gsmlib::operator<(const MapKey &x, -+ bool operator<(const MapKey &x, - const MapKey &y) - { - assert(&x._myStore == &y._myStore); -@@ -97,7 +100,7 @@ - } - - template -- bool gsmlib::operator==(const MapKey &x, -+ bool operator==(const MapKey &x, - const MapKey &y) - { - assert(&x._myStore == &y._myStore); ---- gsmlib-1.10.orig/gsmlib/gsm_me_ta.h -+++ gsmlib-1.10/gsmlib/gsm_me_ta.h -@@ -291,8 +291,8 @@ - // 3 disable phone receive RF circuits only - // 4 disable phone both transmit and receive RF circuits - // 5...127 implementation-defined -- int MeTa::getFunctionalityLevel() throw(GsmException); -- void MeTa::setFunctionalityLevel(int level) throw(GsmException); -+ int getFunctionalityLevel() throw(GsmException); -+ void setFunctionalityLevel(int level) throw(GsmException); - - // return battery charge status (+CBC): - // 0 ME is powered by the battery -@@ -386,13 +386,13 @@ - void setCallWaitingLockStatus(FacilityClass cl, - bool lock)throw(GsmException); - -- void MeTa::setCLIRPresentation(bool enable) throw(GsmException); -+ void setCLIRPresentation(bool enable) throw(GsmException); - //(+CLIR) - - // 0:according to the subscription of the CLIR service - // 1:CLIR invocation - // 2:CLIR suppression -- int MeTa::getCLIRPresentation() throw(GsmException); -+ int getCLIRPresentation() throw(GsmException); - - friend class Phonebook; - friend class SMSStore; ---- gsmlib-1.10.orig/gsmlib/gsm_util.cc -+++ gsmlib-1.10/gsmlib/gsm_util.cc -@@ -35,6 +35,7 @@ - #define __USE_GNU - #define _GNU_SOURCE - #endif -+#include - #include - #include - ---- gsmlib-1.10.orig/intl/Makefile -+++ gsmlib-1.10/intl/Makefile -@@ -0,0 +1,214 @@ -+# Makefile for directory with message catalog handling in GNU NLS Utilities. -+# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. -+# -+# 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, 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. -+ -+PACKAGE = gsmlib -+VERSION = 1.10 -+ -+SHELL = /bin/sh -+ -+srcdir = . -+top_srcdir = .. -+top_builddir = .. -+ -+ -+prefix = /usr -+exec_prefix = ${prefix} -+transform = s,x,x, -+libdir = $(exec_prefix)/lib -+includedir = $(prefix)/include -+datadir = $(prefix)/share -+localedir = $(datadir)/locale -+gnulocaledir = $(prefix)/share/locale -+gettextsrcdir = ${prefix}/share/gettext/intl -+aliaspath = $(localedir):. -+subdir = intl -+ -+INSTALL = /usr/bin/install -c -+INSTALL_DATA = ${INSTALL} -m 644 -+MKINSTALLDIRS = $(top_builddir)/scripts/mkinstalldirs -+ -+l = @l@ -+ -+AR = ar -+CC = i486-linux-gnu-gcc -+LIBTOOL = $(SHELL) $(top_builddir)/libtool -+RANLIB = ranlib -+ -+DEFS = -DGNULOCALEDIR=\"$(gnulocaledir)\" \ -+-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" -DHAVE_CONFIG_H -+CPPFLAGS = -+CFLAGS = -D_REENTRANT -g -O2 -+LDFLAGS = -+ -+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) -+ -+HEADERS = $(COMHDRS) libgettext.h loadinfo.h -+COMHDRS = gettext.h gettextP.h hash-string.h -+SOURCES = $(COMSRCS) intl-compat.c cat-compat.c -+COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \ -+finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \ -+explodename.c -+OBJECTS = bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \ -+finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \ -+explodename.$lo -+CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo -+GETTOBJS = intl-compat.$lo -+DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \ -+xopen-msg.sed $(HEADERS) $(SOURCES) -+DISTFILES.normal = VERSION -+DISTFILES.gettext = libintl.glibc intlh.inst.in -+ -+.SUFFIXES: -+.SUFFIXES: .c .o .lo -+.c.o: -+ $(COMPILE) $< -+.c.lo: -+ $(LIBTOOL) --mode=compile $(COMPILE) $< -+ -+INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib -+ -+all: all-no -+ -+all-yes: libintl.$la intlh.inst -+all-no: -+ -+libintl.a: $(OBJECTS) -+ rm -f $@ -+ $(AR) cru $@ $(OBJECTS) -+ $(RANLIB) $@ -+ -+libintl.la: $(OBJECTS) -+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \ -+ -version-info 1:0 -rpath $(libdir) -+ -+../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot -+ cd ../po && $(MAKE) cat-id-tbl.$lo -+ -+check: all -+ -+# This installation goal is only used in GNU gettext. Packages which -+# only use the library should use install instead. -+ -+# We must not install the libintl.h/libintl.a files if we are on a -+# system which has the gettext() function in its C library or in a -+# separate library or use the catgets interface. A special case is -+# where configure found a previously installed GNU gettext library. -+# If you want to use the one which comes with this version of the -+# package, you have to use `configure --with-included-gettext'. -+install: install-exec install-data -+install-exec: all -+ if test "$(PACKAGE)" = "gettext" \ -+ && test '' = '$(GETTOBJS)'; then \ -+ if test -r $(MKINSTALLDIRS); then \ -+ $(MKINSTALLDIRS) $(libdir) $(includedir); \ -+ else \ -+ $(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \ -+ fi; \ -+ $(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \ -+ $(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \ -+ else \ -+ : ; \ -+ fi -+install-data: all -+ if test "$(PACKAGE)" = "gettext"; then \ -+ if test -r $(MKINSTALLDIRS); then \ -+ $(MKINSTALLDIRS) $(gettextsrcdir); \ -+ else \ -+ $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ -+ fi; \ -+ $(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \ -+ dists="$(DISTFILES.common)"; \ -+ for file in $$dists; do \ -+ $(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \ -+ done; \ -+ else \ -+ : ; \ -+ fi -+ -+# Define this as empty until I found a useful application. -+installcheck: -+ -+uninstall: -+ dists="$(DISTFILES.common)"; \ -+ for file in $$dists; do \ -+ rm -f $(gettextsrcdir)/$$file; \ -+ done -+ -+info dvi: -+ -+$(OBJECTS): ../gsm_config.h libgettext.h -+bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h -+dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h -+ -+tags: TAGS -+ -+TAGS: $(HEADERS) $(SOURCES) -+ here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES) -+ -+id: ID -+ -+ID: $(HEADERS) $(SOURCES) -+ here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES) -+ -+ -+mostlyclean: -+ rm -f *.a *.o *.lo core core.* -+ -+clean: mostlyclean -+ -+distclean: clean -+ rm -f Makefile ID TAGS po2msg.sed po2tbl.sed -+ -+maintainer-clean: distclean -+ @echo "This command is intended for maintainers to use;" -+ @echo "it deletes files that may require special tools to rebuild." -+ -+ -+# GNU gettext needs not contain the file `VERSION' but contains some -+# other files which should not be distributed in other packages. -+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -+dist distdir: Makefile $(DISTFILES) -+ if test "$(PACKAGE)" = gettext; then \ -+ additional="$(DISTFILES.gettext)"; \ -+ else \ -+ additional="$(DISTFILES.normal)"; \ -+ fi; \ -+ for file in $(DISTFILES.common) $$additional; do \ -+ ln $(srcdir)/$$file $(distdir) 2> /dev/null \ -+ || cp -p $(srcdir)/$$file $(distdir); \ -+ done -+ -+dist-libc: -+ tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc -+ -+Makefile: Makefile.in ../config.status -+ cd .. \ -+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -+ -+# The dependency for intlh.inst is different in gettext and all other -+# packages. Because we cannot you GNU make features we have to solve -+# the problem while rewriting Makefile.in. -+@GT_YES@intlh.inst: intlh.inst.in ../config.status -+@GT_YES@ cd .. \ -+@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \ -+@GT_YES@ $(SHELL) ./config.status -+@GT_NO@.PHONY: intlh.inst -+@GT_NO@intlh.inst: -+ -+# Tell versions [3.59,3.63) of GNU make not to export all variables. -+# Otherwise a system limit (for SysV at least) may be exceeded. -+.NOEXPORT: ---- gsmlib-1.10.orig/po/cat-id-tbl.c -+++ gsmlib-1.10/po/cat-id-tbl.c -@@ -1,435 +0,0 @@ --/* Automatically generated by po2tbl.sed from gsmlib.pot. */ -- --#if HAVE_CONFIG_H --# include --#endif -- --#include "libgettext.h" -- --const struct _msg_ent _msg_tbl[] = { -- {"", 1}, -- {"could not execute '%s'", 2}, -- {"error writing to '%s'", 3}, -- {"error when calling opendir('%s')(errno: %d/%s)", 4}, -- {"count not open SMS spool file %s", 5}, -- {": version %s [compiled %s]", 6}, -- {"\ --: [-a action][-b baudrate][-C sca][-d device][-f][-h][-I init string]\n\ -- [-s spool dir][-t][-v]{sms_type}", 7}, -- {"\ -- -a, --action the action to execute when an SMS arrives\n\ -- (SMS is send to stdin of action)", 8}, -- {" -b, --baudrate baudrate to use for device (default: 38400)", 9}, -- {" -c, --concatenate start ID for concatenated SMS messages", 10}, -- {" -C, --sca SMS service centre address", 11}, -- {" -d, --device sets the device to connect to", 12}, -- {" -D, --direct enable direct routing of SMSs", 13}, -- {" -f, --flush flush SMS from store", 14}, -- {" -h, --help prints this message", 15}, -- {" -I, --init device AT init sequence", 16}, -- {" -r, --requeststat request SMS status report", 17}, -- {" -s, --spool spool directory for outgoing SMS", 18}, -- {"\ -- -t, --store name of SMS store to use for flush\n\ -- and/or temporary SMS storage", 19}, -- {" -v, --version prints version and exits", 20}, -- {" -X, --xonxoff switch on software handshake", 21}, -- {" sms_type may be any combination of", 22}, -- {" sms, no_sms controls reception of normal SMS", 23}, -- {" cb, no_cb controls reception of cell broadcast messages", 24}, -- {" stat, no_stat controls reception of status reports", 25}, -- {" default is \"sms cb stat\"", 26}, -- {"If no action is given, the SMS is printed to stdout", 27}, -- {"unknown option", 28}, -- {"error when calling sigaction() (errno: %d/%s)", 29}, -- {"store name must be given for flush option", 30}, -- {"Type of message: ", 31}, -- {"SMS message\n", 32}, -- {"submit report message\n", 33}, -- {"status report message\n", 34}, -- {"cell broadcast message\n", 35}, -- {"[ERROR]: ", 36}, -- {"(try setting sms_type, please refer to gsmsmsd manpage)", 37}, -- {"\ --: [-b baudrate][-c concatenatedID][-C sca][-d device][-h][-I init string]\n\ -- [-t][-v][-X] phonenumber [text]", 38}, -- {" -c, --concatenate ID for concatenated SMS messages", 39}, -- {" -d, --device sets the destination device to connect to", 40}, -- {"\ -- -t, --test convert text to GSM alphabet and vice\n\ -- versa, no SMS message is sent", 41}, -- {" phonenumber recipient's phone number", 42}, -- {"\ -- text optional text of the SMS message\n\ -- if omitted: read from stdin", 43}, -- {"phone number and text missing", 44}, -- {"more than two parameters given", 45}, -- {"text is larger than 160 characters", 46}, -- {"inserting '%s' tel# %s", 47}, -- {" (index #%d)", 48}, -- {"updating '%s' tel# %s to new tel# %s", 49}, -- {"updating '%s' tel# %s to new tel# %s(index %d)", 50}, -- {"deleting '%s' tel# %s", 51}, -- {"\ --: [-b baudrate][-c][-d device or file][-h][-I init string]\n\ -- [-p phonebook name][-s device or file][-t charset][-v][-V][-y][-X]", 52}, -- {" -c, --copy copy source entries to destination", 53}, -- {"\ -- -d, --destination sets the destination device to connect \n\ -- to, or the file to write", 54}, -- {" -D, --destination-backend sets the destination backend", 55}, -- {" -i, --index takes index positions into account", 56}, -- {" -p, --phonebook name of phonebook to use", 57}, -- {"\ -- -s, --source sets the source device to connect to,\n\ -- or the file to read", 58}, -- {"\ -- -t, --charset sets the character set to use for\n\ -- phonebook entries", 59}, -- {" -S, --source-backend sets the source backend", 60}, -- {" -V, --verbose print detailed progress messages", 61}, -- {"\ -- -y, --synchronize synchronize destination with source\n\ -- entries (destination is overwritten)\n\ -- (see gsmpb(1) for details)", 62}, -- {"both source and destination must be given", 63}, -- {"phonebook name must be given", 64}, -- {"\ --text '%s' is too large to fit into destination (maximum size %d characters)", 65}, -- {"\ --phone number '%s' is too large to fit into destination (maximum size %d \ --characters)", 66}, -- {"active ", 67}, -- {"inactive ", 68}, -- {"number: ", 69}, -- {" subaddr: ", 70}, -- {" time: ", 71}, -- {" Manufacturer: ", 72}, -- {" Model: ", 73}, -- {" Revision: ", 74}, -- {" Serial Number: ", 75}, -- {" Functionality Level: ", 76}, -- {"unsupported", 77}, -- {"> Status: ", 78}, -- {"unknown", 79}, -- {"current", 80}, -- {"available", 81}, -- {"forbidden", 82}, -- {" Long name: '", 83}, -- {" Short name: '", 84}, -- {" Numeric name: ", 85}, -- {" Mode: ", 86}, -- {"automatic", 87}, -- {"manual", 88}, -- {"deregister", 89}, -- {"manual/automatic", 90}, -- {" Voice", 91}, -- {" unknown", 92}, -- {" Data", 93}, -- {" Fax", 94}, -- {"on", 95}, -- {"off", 96}, -- {"UnconditionalReason", 97}, -- {"MobileBusyReason", 98}, -- {"NoReplyReason", 99}, -- {"NotReachableReason", 100}, -- {"0 ME is powered by the battery", 101}, -- {"1 ME has a battery connected, but is not powered by it", 102}, -- {"2 ME does not have a battery connected", 103}, -- {"3 Recognized power fault, calls inhibited", 104}, -- {"unknown facility class parameter '%c'", 105}, -- {"not enough parameters, minimum number of parameters is %d", 106}, -- {"too many parameters, maximum number of parameters is %d", 107}, -- {"\ --: [-b baudrate][-d device][-h][-I init string][-o operation]\n\ -- [-v][-X]{parameters}", 108}, -- {"\ -- -o, --operation operation to perform on the mobile \n\ -- phone with the specified parameters", 109}, -- {"\ -- parameters parameters to use for the operation\n\ -- (if an operation is given) or\n\ -- a specification which kind of\n\ -- information to read from the mobile phone", 110}, -- {"\ --Refer to gsmctl(1) for details on the available parameters and operations.", 111}, -- {"unknown information parameter '%s'", 112}, -- {"unknown opmode parameter '%s'", 113}, -- {"unknown forward reason parameter '%s'", 114}, -- {"unknown forward mode parameter '%s'", 115}, -- {"unknown operation '%s'", 116}, -- {"inserting entry #%d from source into destination", 117}, -- {"incompatible options '%c' and '%c'", 118}, -- {"\ --: [-a][-b baudrate][-c][-C sca][-d device or file]\n\ -- [-h][-I init string][-k][-l][-s device or file][-t SMS store name]\n\ -- [-v][-V][-x][-X]{indices}|[phonenumber text]", 119}, -- {"\ -- -a, --add add new SMS submit message\n\ -- (phonenumber and text) to destination", 120}, -- {"\ -- -c, --copy copy source entries to destination\n\ -- (if indices are given, copy only these entries)", 121}, -- {"\ -- -d, --destination sets the destination device to\n\ -- connect to, or the file to write to", 122}, -- {"\ -- -k, --backup backup new entries to destination\n\ -- (if indices are given, copy only these entries)", 123}, -- {" -l, --list list source to stdout", 124}, -- {" -t, --store name of SMS store to use", 125}, -- {" -x, --delete delete entries denoted by indices", 126}, -- {"no operation option given", 127}, -- {"both source and destination required", 128}, -- {"destination must not be given", 129}, -- {"source required", 130}, -- {"source must not be given", 131}, -- {"destination required", 132}, -- {"expected number, got '%s'", 133}, -- {"not enough parameters given", 134}, -- {"unexpected parameters", 135}, -- {"store name must be given", 136}, -- {"no index '%s' in source", 137}, -- {"index #%d", 138}, -- {"inserting new entry into destination", 139}, -- {"deleting entry #%d from destination", 140}, -- {"no index '%s' in destination", 141}, -- {"unspecified ME/TA error", 142}, -- {"ME/TA error '", 143}, -- {"(code %s)", 144}, -- {"ME/TA error '' (code not known)", 145}, -- {"unexpected response '%s' when sending 'AT%s'", 146}, -- {"unexpected character in PDU handshake", 147}, -- {"phone failure", 148}, -- {"no connection to phone", 149}, -- {"phone adaptor link reserved", 150}, -- {"operation not allowed", 151}, -- {"operation not supported", 152}, -- {"ph SIM PIN required", 153}, -- {"SIM not inserted", 154}, -- {"SIM PIN required", 155}, -- {"SIM PUK required", 156}, -- {"SIM failure", 157}, -- {"SIM busy", 158}, -- {"SIM wrong", 159}, -- {"incorrect password", 160}, -- {"SIM PIN2 required", 161}, -- {"SIM PUK2 required", 162}, -- {"memory full", 163}, -- {"invalid index", 164}, -- {"not found", 165}, -- {"memory failure", 166}, -- {"text string too long", 167}, -- {"invalid characters in text string", 168}, -- {"dial string too long", 169}, -- {"invalid characters in dial string", 170}, -- {"no network service", 171}, -- {"network timeout", 172}, -- {"invalid ME error %d", 173}, -- {"Unassigned (unallocated) number", 174}, -- {"Operator determined barring", 175}, -- {"Call barred", 176}, -- {"Network failure", 177}, -- {"Short message transfer rejected", 178}, -- {"Congestion", 179}, -- {"Destination out of service", 180}, -- {"Unidentified subscriber", 181}, -- {"Facility rejected", 182}, -- {"Unknown subscriber", 183}, -- {"Network out of order", 184}, -- {"Temporary failure", 185}, -- {"Resources unavailable, unspecified", 186}, -- {"Requested facility not subscribed", 187}, -- {"Requested facility not implemented", 188}, -- {"Invalid Transaction Identifier", 189}, -- {"Semantically incorrect message", 190}, -- {"Invalid mandatory information", 191}, -- {"Message type non-existent or not implemented", 192}, -- {"Message not compatible with short message protocol state", 193}, -- {"Information element non-existent or not implemented", 194}, -- {"Protocol error, unspecified", 195}, -- {"Interworking, unspecified", 196}, -- {"Telematic interworking not supported", 197}, -- {"Short message Type 0 not supported", 198}, -- {"Cannot replace short message", 199}, -- {"Unspecified TP-PID error", 200}, -- {"Data coding scheme (alphabet) not supported", 201}, -- {"Message class not supported", 202}, -- {"Unspecifiec TP-DCS error", 203}, -- {"Command cannot be actioned", 204}, -- {"Command unsupported", 205}, -- {"Unspecified TP-Command error", 206}, -- {"TPDU not supported", 207}, -- {"SC busy", 208}, -- {"No SC subscription", 209}, -- {"SC system failure", 210}, -- {"Invalid SME address", 211}, -- {"Destination SME barred", 212}, -- {"SM Rejected-Duplicated SM", 213}, -- {"SIM SMS storage full", 214}, -- {"No SMS storage capability in SIM", 215}, -- {"Error in MS", 216}, -- {"Memory Capacity Exceed", 217}, -- {"Unspecified error cause", 218}, -- {"ME failure", 219}, -- {"SMS service of ME reserved", 220}, -- {"invalid PDU mode parameter", 221}, -- {"invalid text mode parameter", 222}, -- {"PH-SIM PIN required", 223}, -- {"invalid memory index", 224}, -- {"SMSC address unknown", 225}, -- {"no +CNMA acknowledgement expected", 226}, -- {"unknown error", 227}, -- {"invalid SMS error %d", 228}, -- {"Short message received by the SME", 229}, -- {"\ --Short message forwarded by the SC to the SME but the SC is unable to confirm \ --delivery", 230}, -- {"Short message replaced by the SC", 231}, -- {"reserved", 232}, -- {"SME busy", 233}, -- {"No response from SME", 234}, -- {"Service rejected", 235}, -- {"Quality of service not available", 236}, -- {"Error in SME", 237}, -- {" (Temporary error, SC is not making any more transfer attempts)", 238}, -- {" (Temporary error, SC still trying to transfer SM)", 239}, -- {"Remote Procedure Error", 240}, -- {"Incompatible destination", 241}, -- {"Connection rejected by SME", 242}, -- {"Not obtainable", 243}, -- {"No interworking available", 244}, -- {"SM validity period expired", 245}, -- {"SM deleted by originating SME", 246}, -- {"SM deleted by SC administration", 247}, -- {"SM does not exit", 248}, -- {" (Permanent Error, SC is not making any more transfer attempts)", 249}, -- {"unexpected number format %d", 250}, -- {"unexpected unsolicited event '%s'", 251}, -- {"unable to set operator", 252}, -- {"call forward time must be in the range 0..30", 253}, -- {"Functionality Level commands not supported by ME", 254}, -- {"Requested Functionality Level out of range", 255}, -- {"unsupported alphabet for SMS", 256}, -- {"SMS text is larger than allowed", 257}, -- {"not more than 255 concatenated SMSs allowed", 258}, -- {"only serviceLevel 0 or 1 supported", 259}, -- {"cannot route SMS messages to TE", 260}, -- {"cannot route cell broadcast messages to TE", 261}, -- {"cannot route status reports messages to TE", 262}, -- {"cannot route status report messages to TE", 263}, -- {"expected parameter", 264}, -- {"expected '\"'", 265}, -- {"expected number", 266}, -- {"unexpected end of string '%s'", 267}, -- {" (at position %d of string '%s')", 268}, -- {"expected '%c'", 269}, -- {"expected ')' or ','", 270}, -- {"expected ')', ',' or '-'", 271}, -- {"range of the form a-b-c not allowed", 272}, -- {"range of the form a- no allowed", 273}, -- {"expected comma", 274}, -- {"expected end of line", 275}, -- {"\ --length of text '%s' exceeds maximum text length (%d characters) of phonebook \ --'%s'", 276}, -- {"\ --length of telephone number '%s' exceeds maximum telephone number length (%d \ --characters) of phonebook '%s'", 277}, -- {"phonebook full", 278}, -- {"attempt to overwrite phonebook entry", 279}, -- {"SIM card changed while accessing phonebook", 280}, -- {"unhandled SMS TPDU type", 281}, -- {"can only send SMS-SUBMIT and SMS-COMMAND TPDUs", 282}, -- {"no device given for sending SMS", 283}, -- {"Message type: SMS-DELIVER", 284}, -- {"SC address: '", 285}, -- {"More messages to send: ", 286}, -- {"Reply path: ", 287}, -- {"User data header indicator: ", 288}, -- {"Status report indication: ", 289}, -- {"Originating address: '", 290}, -- {"Protocol identifier: 0x", 291}, -- {"Data coding scheme: ", 292}, -- {"SC timestamp: ", 293}, -- {"User data length: ", 294}, -- {"User data header: 0x", 295}, -- {"User data: '", 296}, -- {"Message type: SMS-SUBMIT", 297}, -- {"Reject duplicates: ", 298}, -- {"Validity period format: ", 299}, -- {"not present", 300}, -- {"relative", 301}, -- {"absolute", 302}, -- {"Status report request: ", 303}, -- {"Message reference: ", 304}, -- {"Destination address: '", 305}, -- {"Validity period: ", 306}, -- {"Message type: SMS-STATUS-REPORT", 307}, -- {"Status report qualifier: ", 308}, -- {"Recipient address: '", 309}, -- {"Discharge time: ", 310}, -- {"Status: 0x", 311}, -- {"Message type: SMS-COMMAND", 312}, -- {"Command type: 0x", 313}, -- {"Message number: ", 314}, -- {"Command data length: ", 315}, -- {"Command data: '", 316}, -- {"Message type: SMS-DELIVER-REPORT", 317}, -- {"Protocol identifier present: ", 318}, -- {"Data coding scheme present: ", 319}, -- {"User data length present: ", 320}, -- {"Message type: SMS-SUBMIT-REPORT", 321}, -- {" minutes", 322}, -- {" days", 323}, -- {" weeks", 324}, -- {"compressed ", 325}, -- {"voicemail message waiting", 326}, -- {"fax message waiting", 327}, -- {"electronic mail message waiting", 328}, -- {"other message waiting", 329}, -- {"default alphabet", 330}, -- {"8-bit alphabet", 331}, -- {"16-bit alphabet", 332}, -- {"reserved alphabet", 333}, -- {"bad hexadecimal PDU format", 334}, -- {"premature end of PDU", 335}, -- {"unknown time period format", 336}, -- {"interrupted when reading from TA", 337}, -- {"reading from TA", 338}, -- {"timeout when reading from TA", 339}, -- {"opening device '%s'", 340}, -- {"getting file status flags failed", 341}, -- {"switching of non-blocking mode failed", 342}, -- {"clearing DTR failed", 343}, -- {"setting DTR failed", 344}, -- {"tcgetattr device '%s'", 345}, -- {"tcsetattr device '%s'", 346}, -- {"reset modem failed '%s'", 347}, -- {"interrupted when writing to TA", 348}, -- {"writing to TA", 349}, -- {"timeout when writing to TA", 350}, -- {"unknown baudrate '%s'", 351}, -- {"error when calling stat('%s') (errno: %d/%s)", 352}, -- {"file '%s' is neither file nor character device", 353}, -- {"maxmimum number of symbolic links exceeded", 354}, -- {"error renaming '%s' to '%s'", 355}, -- {"text '%s' contains illegal character '\"'", 356}, -- {"illegal character in telephone number '%s'", 357}, -- {"error reading from file '%s", 358}, -- {"entry '%s' lacks index", 359}, -- {"line '%s' has invalid format", 360}, -- {"error opening file '%s' for writing", 361}, -- {"", 362}, -- {"error writing to file '%s'", 363}, -- {"attempt to change phonebook read from ", 364}, -- {"cannot open file '%s'", 365}, -- {"", 366}, -- {"indices must be unique in phonebook", 367}, -- {"error reading from file '%s'", 368}, -- {"file '%s' has wrong version", 369}, -- {"corrupt SMS store file '%s'", 370}, -- {"attempt to change SMS store read from ", 371}, --}; -- --int _msg_tbl_length = 371; ---- gsmlib-1.10.orig/po/de.po -+++ gsmlib-1.10/po/de.po -@@ -233,7 +233,7 @@ - - #: apps/gsmsendsms.cc:171 - msgid " phonenumber recipient's phone number" --msgstr " Telefonummer die Telefonnumer des Empfängers" -+msgstr " Telefonummer die Telefonnummer des Empfängers" - - #: apps/gsmsendsms.cc:172 - msgid "" -@@ -295,7 +295,7 @@ - - #: apps/gsmpb.cc:325 - msgid " -c, --copy copy source entries to destination" --msgstr " -c, --copy kopiere Quell-Enträge zum Zielgerät/-datei" -+msgstr " -c, --copy kopiere Quell-Einträge zum Zielgerät/-datei" - - #: apps/gsmpb.cc:327 - msgid "" -@@ -626,14 +626,14 @@ - msgstr "" - ": [-a][-b Baud-Rate][-c][-C sca][-d Gerät oder Datei]\n" - " [-h][-I Init String][-k][-l][-s Gerät oder Datei][-t SMS Speichername]\n" --" [-v][-V][-x][-X]{Indices}|[Telefonnumer Text]" -+" [-v][-V][-x][-X]{Indices}|[Telefonnummer Text]" - - #: apps/gsmsmsstore.cc:191 - msgid "" - " -a, --add add new SMS submit message\n" - " (phonenumber and text) to destination" - msgstr "" --" -a, --add füge neue SMS-Submit-Nachricht (Telefonnumer und\n" -+" -a, --add füge neue SMS-Submit-Nachricht (Telefonnummer und\n" - " Text) in das Zielgerät/-datei ein" - - #: apps/gsmsmsstore.cc:197 -@@ -1437,7 +1437,7 @@ - - #: gsmlib/gsm_sms.cc:450 gsmlib/gsm_sms.cc:626 - msgid "Destination address: '" --msgstr "Zieladdresse: '" -+msgstr "Zieladresse: '" - - #: gsmlib/gsm_sms.cc:455 - msgid "Validity period: " ---- gsmlib-1.10.orig/po/gsmlib.pot -+++ gsmlib-1.10/po/gsmlib.pot -@@ -7,7 +7,8 @@ - msgid "" - msgstr "" - "Project-Id-Version: PACKAGE VERSION\n" --"POT-Creation-Date: 2002-10-22 22:48+0200\n" -+"Report-Msgid-Bugs-To: \n" -+"POT-Creation-Date: 2008-10-06 14:36+1100\n" - "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" - "Last-Translator: FULL NAME \n" - "Language-Team: LANGUAGE \n" -@@ -15,168 +16,225 @@ - "Content-Type: text/plain; charset=CHARSET\n" - "Content-Transfer-Encoding: 8bit\n" - --#: apps/gsmsmsd.cc:164 -+#: apps/gsmsmsd.cc:172 - #, c-format - msgid "could not execute '%s'" - msgstr "" - --#: apps/gsmsmsd.cc:168 -+#: apps/gsmsmsd.cc:176 - #, c-format - msgid "error writing to '%s'" - msgstr "" - --#: apps/gsmsmsd.cc:196 -+#: apps/gsmsmsd.cc:197 apps/gsmsmsd.cc:198 apps/gsmsmsd.cc:199 -+#, c-format -+msgid "%d" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:216 - #, c-format - msgid "error when calling opendir('%s')(errno: %d/%s)" - msgstr "" - --#: apps/gsmsmsd.cc:225 -+#: apps/gsmsmsd.cc:260 - #, c-format - msgid "count not open SMS spool file %s" - msgstr "" - --#: apps/gsmsmsd.cc:341 apps/gsmsendsms.cc:144 apps/gsmpb.cc:311 -+#: apps/gsmsmsd.cc:439 apps/gsmsendsms.cc:144 apps/gsmpb.cc:311 - #: apps/gsmctl.cc:380 apps/gsmsmsstore.cc:179 - #, c-format - msgid ": version %s [compiled %s]" - msgstr "" - --#: apps/gsmsmsd.cc:346 -+#: apps/gsmsmsd.cc:444 - msgid "" - ": [-a action][-b baudrate][-C sca][-d device][-f][-h][-I init string]\n" - " [-s spool dir][-t][-v]{sms_type}" - msgstr "" - --#: apps/gsmsmsd.cc:350 -+#: apps/gsmsmsd.cc:448 - msgid "" - " -a, --action the action to execute when an SMS arrives\n" - " (SMS is send to stdin of action)" - msgstr "" - --#: apps/gsmsmsd.cc:354 apps/gsmsendsms.cc:153 apps/gsmpb.cc:322 -+#: apps/gsmsmsd.cc:452 apps/gsmsendsms.cc:153 apps/gsmpb.cc:322 - #: apps/gsmctl.cc:389 apps/gsmsmsstore.cc:194 - msgid " -b, --baudrate baudrate to use for device (default: 38400)" - msgstr "" - --#: apps/gsmsmsd.cc:357 -+#: apps/gsmsmsd.cc:455 - msgid " -c, --concatenate start ID for concatenated SMS messages" - msgstr "" - --#: apps/gsmsmsd.cc:359 apps/gsmsendsms.cc:158 apps/gsmsmsstore.cc:200 -+#: apps/gsmsmsd.cc:457 apps/gsmsendsms.cc:158 apps/gsmsmsstore.cc:200 - msgid " -C, --sca SMS service centre address" - msgstr "" - --#: apps/gsmsmsd.cc:360 -+#: apps/gsmsmsd.cc:458 - msgid " -d, --device sets the device to connect to" - msgstr "" - --#: apps/gsmsmsd.cc:361 -+#: apps/gsmsmsd.cc:459 - msgid " -D, --direct enable direct routing of SMSs" - msgstr "" - --#: apps/gsmsmsd.cc:362 -+#: apps/gsmsmsd.cc:460 - msgid " -f, --flush flush SMS from store" - msgstr "" - --#: apps/gsmsmsd.cc:363 apps/gsmsendsms.cc:161 apps/gsmpb.cc:332 -+#: apps/gsmsmsd.cc:461 -+msgid " -F, --failed directory to move failed SMS to," -+msgstr "" -+ -+#: apps/gsmsmsd.cc:462 apps/gsmsmsd.cc:475 -+msgid " if unset, the SMS will be deleted" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:463 apps/gsmsendsms.cc:161 apps/gsmpb.cc:332 - #: apps/gsmctl.cc:394 apps/gsmsmsstore.cc:204 - msgid " -h, --help prints this message" - msgstr "" - --#: apps/gsmsmsd.cc:364 apps/gsmsendsms.cc:162 apps/gsmpb.cc:335 -+#: apps/gsmsmsd.cc:464 apps/gsmsendsms.cc:162 apps/gsmpb.cc:335 - #: apps/gsmctl.cc:395 apps/gsmsmsstore.cc:205 - msgid " -I, --init device AT init sequence" - msgstr "" - --#: apps/gsmsmsd.cc:365 apps/gsmsendsms.cc:163 -+#: apps/gsmsmsd.cc:466 -+msgid " -L, --syslog log errors and information to syslog" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:469 -+msgid " -P, --priorities number of priority levels to use," -+msgstr "" -+ -+#: apps/gsmsmsd.cc:470 -+msgid " (default: none)" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:471 apps/gsmsendsms.cc:163 - msgid " -r, --requeststat request SMS status report" - msgstr "" - --#: apps/gsmsmsd.cc:366 -+#: apps/gsmsmsd.cc:472 - msgid " -s, --spool spool directory for outgoing SMS" - msgstr "" - --#: apps/gsmsmsd.cc:368 -+#: apps/gsmsmsd.cc:474 -+msgid " -S, --sent directory to move sent SMS to," -+msgstr "" -+ -+#: apps/gsmsmsd.cc:476 - msgid "" - " -t, --store name of SMS store to use for flush\n" - " and/or temporary SMS storage" - msgstr "" - --#: apps/gsmsmsd.cc:371 apps/gsmsendsms.cc:167 apps/gsmpb.cc:343 -+#: apps/gsmsmsd.cc:479 apps/gsmsendsms.cc:167 apps/gsmpb.cc:343 - #: apps/gsmctl.cc:399 apps/gsmsmsstore.cc:213 - msgid " -v, --version prints version and exits" - msgstr "" - --#: apps/gsmsmsd.cc:372 apps/gsmsendsms.cc:169 apps/gsmpb.cc:346 -+#: apps/gsmsmsd.cc:480 apps/gsmsendsms.cc:169 apps/gsmpb.cc:346 - #: apps/gsmctl.cc:400 apps/gsmsmsstore.cc:218 - msgid " -X, --xonxoff switch on software handshake" - msgstr "" - --#: apps/gsmsmsd.cc:374 -+#: apps/gsmsmsd.cc:482 - msgid " sms_type may be any combination of" - msgstr "" - --#: apps/gsmsmsd.cc:375 -+#: apps/gsmsmsd.cc:483 - msgid " sms, no_sms controls reception of normal SMS" - msgstr "" - --#: apps/gsmsmsd.cc:377 -+#: apps/gsmsmsd.cc:485 - msgid " cb, no_cb controls reception of cell broadcast messages" - msgstr "" - --#: apps/gsmsmsd.cc:379 -+#: apps/gsmsmsd.cc:487 - msgid " stat, no_stat controls reception of status reports" - msgstr "" - --#: apps/gsmsmsd.cc:381 -+#: apps/gsmsmsd.cc:489 - msgid " default is \"sms cb stat\"" - msgstr "" - --#: apps/gsmsmsd.cc:382 -+#: apps/gsmsmsd.cc:490 - msgid "If no action is given, the SMS is printed to stdout" - msgstr "" - --#: apps/gsmsmsd.cc:387 apps/gsmsendsms.cc:178 apps/gsmpb.cc:354 -+#: apps/gsmsmsd.cc:492 -+msgid "If -P is given, it activates the priority system and sets the" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:493 -+msgid "number or levels to use. For every level, there must be directories" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:494 -+msgid "named +." -+msgstr "" -+ -+#: apps/gsmsmsd.cc:495 -+msgid "For example \"-P 2 -s queue -S send -F failed\" needs the following" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:496 -+msgid "directories: queue1/ queue2/ send1/ send2/ failed1/ failed2/" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:497 -+msgid "Before sending one SMS from queue2, all pending SMS from queue1" -+msgstr "" -+ -+#: apps/gsmsmsd.cc:498 -+msgid "will be sent." -+msgstr "" -+ -+#: apps/gsmsmsd.cc:503 apps/gsmsendsms.cc:178 apps/gsmpb.cc:354 - #: apps/gsmctl.cc:414 apps/gsmsmsstore.cc:223 - msgid "unknown option" - msgstr "" - --#: apps/gsmsmsd.cc:426 -+#: apps/gsmsmsd.cc:542 - #, c-format - msgid "error when calling sigaction() (errno: %d/%s)" - msgstr "" - --#: apps/gsmsmsd.cc:446 -+#: apps/gsmsmsd.cc:562 - msgid "store name must be given for flush option" - msgstr "" - - #. process the new message --#: apps/gsmsmsd.cc:454 apps/gsmsmsd.cc:522 -+#: apps/gsmsmsd.cc:570 apps/gsmsmsd.cc:638 - msgid "Type of message: " - msgstr "" - --#: apps/gsmsmsd.cc:458 apps/gsmsmsd.cc:526 -+#: apps/gsmsmsd.cc:574 apps/gsmsmsd.cc:642 - msgid "SMS message\n" - msgstr "" - --#: apps/gsmsmsd.cc:461 -+#: apps/gsmsmsd.cc:577 - msgid "submit report message\n" - msgstr "" - --#: apps/gsmsmsd.cc:464 apps/gsmsmsd.cc:532 -+#: apps/gsmsmsd.cc:580 apps/gsmsmsd.cc:648 - msgid "status report message\n" - msgstr "" - --#: apps/gsmsmsd.cc:529 -+#: apps/gsmsmsd.cc:645 - msgid "cell broadcast message\n" - msgstr "" - --#: apps/gsmsmsd.cc:585 apps/gsmsmsd.cc:587 apps/gsmsendsms.cc:253 --#: apps/gsmpb.cc:503 apps/gsmctl.cc:631 apps/gsmsmsstore.cc:435 -+#: apps/gsmsmsd.cc:701 apps/gsmsmsd.cc:703 apps/gsmsendsms.cc:253 -+#: apps/gsmpb.cc:503 apps/gsmctl.cc:631 apps/gsmsmsstore.cc:430 - msgid "[ERROR]: " - msgstr "" - --#: apps/gsmsmsd.cc:588 -+#: apps/gsmsmsd.cc:704 - msgid "(try setting sms_type, please refer to gsmsmsd manpage)" - msgstr "" - -@@ -372,7 +430,7 @@ - msgstr "" - - #: apps/gsmctl.cc:131 gsmlib/gsm_error.cc:104 gsmlib/gsm_sms.cc:441 --#: gsmlib/gsm_sms_codec.cc:204 -+#: gsmlib/gsm_sms_codec.cc:205 - msgid "unknown" - msgstr "" - -@@ -541,7 +599,7 @@ - msgid "unknown operation '%s'" - msgstr "" - --#: apps/gsmsmsstore.cc:91 apps/gsmsmsstore.cc:363 apps/gsmsmsstore.cc:380 -+#: apps/gsmsmsstore.cc:91 apps/gsmsmsstore.cc:358 apps/gsmsmsstore.cc:375 - #, c-format - msgid "inserting entry #%d from source into destination" - msgstr "" -@@ -618,7 +676,7 @@ - msgid "destination required" - msgstr "" - --#: apps/gsmsmsstore.cc:254 gsmlib/gsm_util.cc:285 -+#: apps/gsmsmsstore.cc:254 gsmlib/gsm_util.cc:286 - #, c-format - msgid "expected number, got '%s'" - msgstr "" -@@ -631,30 +689,30 @@ - msgid "unexpected parameters" - msgstr "" - --#: apps/gsmsmsstore.cc:280 apps/gsmsmsstore.cc:317 -+#: apps/gsmsmsstore.cc:280 apps/gsmsmsstore.cc:312 - msgid "store name must be given" - msgstr "" - --#: apps/gsmsmsstore.cc:344 apps/gsmsmsstore.cc:377 -+#: apps/gsmsmsstore.cc:339 apps/gsmsmsstore.cc:372 - #, c-format - msgid "no index '%s' in source" - msgstr "" - --#: apps/gsmsmsstore.cc:392 -+#: apps/gsmsmsstore.cc:387 - #, c-format - msgid "index #%d" - msgstr "" - --#: apps/gsmsmsstore.cc:406 -+#: apps/gsmsmsstore.cc:401 - msgid "inserting new entry into destination" - msgstr "" - --#: apps/gsmsmsstore.cc:421 -+#: apps/gsmsmsstore.cc:416 - #, c-format - msgid "deleting entry #%d from destination" - msgstr "" - --#: apps/gsmsmsstore.cc:426 -+#: apps/gsmsmsstore.cc:421 - #, c-format - msgid "no index '%s' in destination" - msgstr "" -@@ -1107,52 +1165,52 @@ - msgid "unexpected unsolicited event '%s'" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:536 -+#: gsmlib/gsm_me_ta.cc:538 - msgid "unable to set operator" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:663 -+#: gsmlib/gsm_me_ta.cc:665 - msgid "call forward time must be in the range 0..30" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:811 -+#: gsmlib/gsm_me_ta.cc:813 - msgid "Functionality Level commands not supported by ME" - msgstr "" - - #. If the number was just out of range, we get here. --#: gsmlib/gsm_me_ta.cc:830 -+#: gsmlib/gsm_me_ta.cc:832 - msgid "Requested Functionality Level out of range" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:941 -+#: gsmlib/gsm_me_ta.cc:943 - msgid "unsupported alphabet for SMS" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:950 -+#: gsmlib/gsm_me_ta.cc:952 - msgid "SMS text is larger than allowed" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:962 -+#: gsmlib/gsm_me_ta.cc:964 - msgid "not more than 255 concatenated SMSs allowed" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:995 -+#: gsmlib/gsm_me_ta.cc:997 - msgid "only serviceLevel 0 or 1 supported" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:1108 gsmlib/gsm_me_ta.cc:1150 -+#: gsmlib/gsm_me_ta.cc:1110 gsmlib/gsm_me_ta.cc:1152 - msgid "cannot route SMS messages to TE" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:1122 gsmlib/gsm_me_ta.cc:1164 -+#: gsmlib/gsm_me_ta.cc:1124 gsmlib/gsm_me_ta.cc:1166 - msgid "cannot route cell broadcast messages to TE" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:1134 -+#: gsmlib/gsm_me_ta.cc:1136 - msgid "cannot route status reports messages to TE" - msgstr "" - --#: gsmlib/gsm_me_ta.cc:1178 -+#: gsmlib/gsm_me_ta.cc:1180 - msgid "cannot route status report messages to TE" - msgstr "" - -@@ -1314,7 +1372,7 @@ - msgid "Validity period format: " - msgstr "" - --#: gsmlib/gsm_sms.cc:432 gsmlib/gsm_sms_codec.cc:183 -+#: gsmlib/gsm_sms.cc:432 gsmlib/gsm_sms_codec.cc:184 - msgid "not present" - msgstr "" - -@@ -1402,209 +1460,212 @@ - msgid "Message type: SMS-SUBMIT-REPORT" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:188 gsmlib/gsm_sms_codec.cc:190 -+#: gsmlib/gsm_sms_codec.cc:189 gsmlib/gsm_sms_codec.cc:191 - msgid " minutes" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:192 -+#: gsmlib/gsm_sms_codec.cc:193 - msgid " days" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:194 -+#: gsmlib/gsm_sms_codec.cc:195 - msgid " weeks" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:213 -+#: gsmlib/gsm_sms_codec.cc:214 - msgid "compressed " - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:218 -+#: gsmlib/gsm_sms_codec.cc:219 - msgid "voicemail message waiting" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:221 -+#: gsmlib/gsm_sms_codec.cc:222 - msgid "fax message waiting" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:224 -+#: gsmlib/gsm_sms_codec.cc:225 - msgid "electronic mail message waiting" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:227 -+#: gsmlib/gsm_sms_codec.cc:228 - msgid "other message waiting" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:234 -+#: gsmlib/gsm_sms_codec.cc:235 - msgid "default alphabet" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:237 -+#: gsmlib/gsm_sms_codec.cc:238 - msgid "8-bit alphabet" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:240 -+#: gsmlib/gsm_sms_codec.cc:241 - msgid "16-bit alphabet" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:243 -+#: gsmlib/gsm_sms_codec.cc:244 - msgid "reserved alphabet" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:256 -+#: gsmlib/gsm_sms_codec.cc:257 - msgid "bad hexadecimal PDU format" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:285 gsmlib/gsm_sms_codec.cc:295 --#: gsmlib/gsm_sms_codec.cc:310 gsmlib/gsm_sms_codec.cc:318 --#: gsmlib/gsm_sms_codec.cc:339 gsmlib/gsm_sms_codec.cc:347 --#: gsmlib/gsm_sms_codec.cc:368 gsmlib/gsm_sms_codec.cc:382 -+#: gsmlib/gsm_sms_codec.cc:286 gsmlib/gsm_sms_codec.cc:296 -+#: gsmlib/gsm_sms_codec.cc:311 gsmlib/gsm_sms_codec.cc:319 -+#: gsmlib/gsm_sms_codec.cc:340 gsmlib/gsm_sms_codec.cc:348 -+#: gsmlib/gsm_sms_codec.cc:369 gsmlib/gsm_sms_codec.cc:383 - msgid "premature end of PDU" - msgstr "" - --#: gsmlib/gsm_sms_codec.cc:473 -+#: gsmlib/gsm_sms_codec.cc:474 - msgid "unknown time period format" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:119 -+#: gsmlib/gsm_unix_serial.cc:121 - msgid "interrupted when reading from TA" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:144 -+#: gsmlib/gsm_unix_serial.cc:136 -+msgid "end of file when reading from TA" -+msgstr "" -+ -+#: gsmlib/gsm_unix_serial.cc:146 - msgid "reading from TA" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:149 -+#: gsmlib/gsm_unix_serial.cc:151 - msgid "timeout when reading from TA" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:176 -+#: gsmlib/gsm_unix_serial.cc:178 - #, c-format - msgid "opening device '%s'" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:182 -+#: gsmlib/gsm_unix_serial.cc:185 - msgid "getting file status flags failed" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:185 -+#: gsmlib/gsm_unix_serial.cc:190 - msgid "switching of non-blocking mode failed" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:198 -+#: gsmlib/gsm_unix_serial.cc:205 - msgid "clearing DTR failed" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:202 -+#: gsmlib/gsm_unix_serial.cc:211 - msgid "setting DTR failed" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:206 -+#: gsmlib/gsm_unix_serial.cc:216 - #, c-format - msgid "tcgetattr device '%s'" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:233 -+#: gsmlib/gsm_unix_serial.cc:245 - #, c-format - msgid "tcsetattr device '%s'" - msgstr "" - --#. no response after 3 tries --#: gsmlib/gsm_unix_serial.cc:287 -+#: gsmlib/gsm_unix_serial.cc:303 - #, c-format - msgid "reset modem failed '%s'" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:332 gsmlib/gsm_unix_serial.cc:364 -+#: gsmlib/gsm_unix_serial.cc:348 gsmlib/gsm_unix_serial.cc:380 - msgid "interrupted when writing to TA" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:347 gsmlib/gsm_unix_serial.cc:356 -+#: gsmlib/gsm_unix_serial.cc:363 gsmlib/gsm_unix_serial.cc:372 - msgid "writing to TA" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:377 -+#: gsmlib/gsm_unix_serial.cc:393 - msgid "timeout when writing to TA" - msgstr "" - --#: gsmlib/gsm_unix_serial.cc:438 -+#: gsmlib/gsm_unix_serial.cc:454 - #, c-format - msgid "unknown baudrate '%s'" - msgstr "" - --#: gsmlib/gsm_util.cc:205 -+#: gsmlib/gsm_util.cc:206 - #, c-format - msgid "error when calling stat('%s') (errno: %d/%s)" - msgstr "" - --#: gsmlib/gsm_util.cc:236 -+#: gsmlib/gsm_util.cc:237 - #, c-format - msgid "file '%s' is neither file nor character device" - msgstr "" - --#: gsmlib/gsm_util.cc:240 -+#: gsmlib/gsm_util.cc:241 - msgid "maxmimum number of symbolic links exceeded" - msgstr "" - --#: gsmlib/gsm_util.cc:250 -+#: gsmlib/gsm_util.cc:251 - #, c-format - msgid "error renaming '%s' to '%s'" - msgstr "" - --#: gsmlib/gsm_util.cc:348 -+#: gsmlib/gsm_util.cc:349 - #, c-format - msgid "text '%s' contains illegal character '\"'" - msgstr "" - --#: gsmlib/gsm_util.cc:358 -+#: gsmlib/gsm_util.cc:359 - #, c-format - msgid "illegal character in telephone number '%s'" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:95 -+#: gsmlib/gsm_sorted_phonebook.cc:96 - #, c-format - msgid "error reading from file '%s" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:109 -+#: gsmlib/gsm_sorted_phonebook.cc:110 - #, c-format - msgid "entry '%s' lacks index" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:118 gsmlib/gsm_sorted_phonebook.cc:124 -+#: gsmlib/gsm_sorted_phonebook.cc:119 gsmlib/gsm_sorted_phonebook.cc:125 - #, c-format - msgid "line '%s' has invalid format" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:173 gsmlib/gsm_sorted_sms_store.cc:159 -+#: gsmlib/gsm_sorted_phonebook.cc:174 gsmlib/gsm_sorted_sms_store.cc:159 - #, c-format - msgid "error opening file '%s' for writing" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:174 gsmlib/gsm_sorted_phonebook.cc:193 -+#: gsmlib/gsm_sorted_phonebook.cc:175 gsmlib/gsm_sorted_phonebook.cc:194 - #: gsmlib/gsm_sorted_sms_store.cc:67 gsmlib/gsm_sorted_sms_store.cc:160 - msgid "" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:192 gsmlib/gsm_sorted_sms_store.cc:66 -+#: gsmlib/gsm_sorted_phonebook.cc:193 gsmlib/gsm_sorted_sms_store.cc:66 - #, c-format - msgid "error writing to file '%s'" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:216 -+#: gsmlib/gsm_sorted_phonebook.cc:217 - msgid "attempt to change phonebook read from " - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:229 gsmlib/gsm_sorted_sms_store.cc:215 -+#: gsmlib/gsm_sorted_phonebook.cc:230 gsmlib/gsm_sorted_sms_store.cc:215 - #, c-format - msgid "cannot open file '%s'" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:244 gsmlib/gsm_sorted_sms_store.cc:55 -+#: gsmlib/gsm_sorted_phonebook.cc:245 gsmlib/gsm_sorted_sms_store.cc:55 - #: gsmlib/gsm_sorted_sms_store.cc:228 - msgid "" - msgstr "" - --#: gsmlib/gsm_sorted_phonebook.cc:361 -+#: gsmlib/gsm_sorted_phonebook.cc:362 - msgid "indices must be unique in phonebook" - msgstr "" - ---- gsmlib-1.10.orig/gsmlib-1.10.debmg/debian/gsm-utils.dirs -+++ gsmlib-1.10/gsmlib-1.10.debmg/debian/gsm-utils.dirs -@@ -0,0 +1,11 @@ -+var/spool/sms/queue1 -+var/spool/sms/queue2 -+var/spool/sms/queue3 -+var/spool/sms/sent1 -+var/spool/sms/sent2 -+var/spool/sms/sent3 -+var/spool/sms/failed1 -+var/spool/sms/failed2 -+var/spool/sms/failed3 -+var/spool/sms/tmp -+var/run/gsm-utils ---- gsmlib-1.10.orig/gsmlib-1.10.debmg/debian/gsm-utils.postinst -+++ gsmlib-1.10/gsmlib-1.10.debmg/debian/gsm-utils.postinst -@@ -0,0 +1,28 @@ -+#!/bin/sh -e -+ -+# create gsmsms group if necessary. -+if ! grep -q ^gsmsms: /etc/group; then -+# echo Adding system group: gsmsms. -+ addgroup gsmsms -+fi -+ -+# create gsmsms user if necessary. -+if ! grep -q ^gsmsms: /etc/passwd; then -+# echo Adding system user: gsmsms. -+ adduser --system --ingroup gsmsms \ -+ --no-create-home --home /var/spool/sms gsmsms -+fi -+ -+# allow gsmsms to use serial lines -+if ! groups gsmsms | grep -q dialout ; then -+ adduser gsmsms dialout -+fi -+ -+# echo Updating spool directory structure: /var/spool/sms -+chown -R gsmsms:gsmsms /var/spool/sms /var/run/gsm-utils -+chmod 700 /var/spool/sms/* -+chmod 750 /var/spool/sms -+chmod 730 /var/spool/sms/queue* /var/spool/sms/tmp -+ -+# Add the rest automatically.. -+#DEBHELPER# ---- gsmlib-1.10.orig/gsmlib-1.10.debmg/debian/gsm-utils.undocumented -+++ gsmlib-1.10/gsmlib-1.10.debmg/debian/gsm-utils.undocumented -@@ -0,0 +1,2 @@ -+gsmsmsspool.1 -+gsmsmsrequeue.8 ---- gsmlib-1.10.orig/gsmlib-1.10.debmg/debian/gsm-utils.prerm -+++ gsmlib-1.10/gsmlib-1.10.debmg/debian/gsm-utils.prerm -@@ -0,0 +1,7 @@ -+#!/bin/sh -e -+ -+deluser gsmsms || true -+delgroup gsmsms || true -+ -+# Add the rest automatically.. -+#DEBHELPER# ---- gsmlib-1.10.orig/scripts/config.sub -+++ gsmlib-1.10/scripts/config.sub -@@ -1,9 +1,10 @@ - #! /bin/sh - # Configuration validation subroutine script. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 - # Free Software Foundation, Inc. - --timestamp='2001-09-07' -+timestamp='2008-01-16' - - # This file is (in principle) common to ALL GNU software. - # The presence of a machine in this file suggests that SOME GNU software -@@ -21,15 +22,17 @@ - # - # 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. -- -+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -+# 02110-1301, 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 . -+ -+# 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. -@@ -69,8 +72,8 @@ - version="\ - GNU config.sub ($timestamp) - --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 --Free Software Foundation, Inc. -+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -+2002, 2003, 2004, 2005, 2006, 2007, 2008 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." -@@ -82,11 +85,11 @@ - while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) -- echo "$timestamp" ; exit 0 ;; -+ echo "$timestamp" ; exit ;; - --version | -v ) -- echo "$version" ; exit 0 ;; -+ echo "$version" ; exit ;; - --help | --h* | -h ) -- echo "$usage"; exit 0 ;; -+ echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. -@@ -98,7 +101,7 @@ - *local*) - # First pass through any local machine types. - echo $1 -- exit 0;; -+ exit ;; - - * ) - break ;; -@@ -117,7 +120,9 @@ - # 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* | storm-chaos* | os2-emx* | windows32-*) -+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ -+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ -+ storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; -@@ -143,7 +148,7 @@ - -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) -+ -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; -@@ -168,6 +173,10 @@ - -hiux*) - os=-hiuxwe2 - ;; -+ -sco6) -+ os=-sco5v6 -+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` -+ ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` -@@ -184,6 +193,10 @@ - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; -+ -sco5v6*) -+ # 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/'` -@@ -226,32 +239,53 @@ - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ -- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ -+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ -+ | am33_2.0 \ -+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ -+ | bfin \ - | c4x | clipper \ -- | d10v | d30v | dsp16xx \ -- | fr30 \ -+ | d10v | d30v | dlx | dsp16xx \ -+ | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ -- | m32r | m68000 | m68k | m88k | mcore \ -- | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ -- | mips64vr4100 | mips64vr4100el | mips64vr4300 \ -- | mips64vr4300el | mips64vr5000 | mips64vr5000el \ -- | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ -- | mipsisa32 \ -+ | ip2k | iq2000 \ -+ | m32c | m32r | m32rle | m68000 | m68k | m88k \ -+ | maxq | mb | microblaze | mcore | mep \ -+ | mips | mipsbe | mipseb | mipsel | mipsle \ -+ | mips16 \ -+ | mips64 | mips64el \ -+ | mips64vr | mips64vrel \ -+ | mips64orion | mips64orionel \ -+ | mips64vr4100 | mips64vr4100el \ -+ | mips64vr4300 | mips64vr4300el \ -+ | mips64vr5000 | mips64vr5000el \ -+ | mips64vr5900 | mips64vr5900el \ -+ | mipsisa32 | mipsisa32el \ -+ | mipsisa32r2 | mipsisa32r2el \ -+ | mipsisa64 | mipsisa64el \ -+ | mipsisa64r2 | mipsisa64r2el \ -+ | mipsisa64sb1 | mipsisa64sb1el \ -+ | mipsisa64sr71k | mipsisa64sr71kel \ -+ | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ -+ | mt \ -+ | msp430 \ -+ | nios | nios2 \ - | ns16k | ns32k \ -- | openrisc \ -+ | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ -- | s390 | s390x \ -- | sh | sh[34] | sh[34]eb | shbe | shle \ -- | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ -- | stormy16 | strongarm \ -- | tahoe | thumb | tic80 | tron \ -- | v850 \ -+ | score \ -+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ -+ | sh64 | sh64le \ -+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ -+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ -+ | spu | strongarm \ -+ | tahoe | thumb | tic4x | tic80 | tron \ -+ | v850 | v850e \ - | we32k \ -- | x86 | xscale \ -+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; -@@ -262,6 +296,9 @@ - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; -+ ms1) -+ basic_machine=mt-unknown -+ ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and -@@ -278,41 +315,68 @@ - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ -- | alphapca5[67]-* | arc-* \ -- | arm-* | armbe-* | armle-* | armv*-* \ -- | bs2000-* \ -- | c[123]* | c30-* | [cjt]90-* | c54x-* \ -- | clipper-* | cray2-* | cydra-* \ -- | d10v-* | d30v-* \ -+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ -+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ -+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ -+ | avr-* | avr32-* \ -+ | bfin-* | bs2000-* \ -+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ -+ | clipper-* | craynv-* | cydra-* \ -+ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ -- | f30[01]-* | f700-* | fr30-* | fx80-* \ -+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ -- | m32r-* \ -- | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ -- | m88110-* | m88k-* | mcore-* \ -- | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ -- | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ -- | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ -- | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ -+ | ip2k-* | iq2000-* \ -+ | m32c-* | m32r-* | m32rle-* \ -+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ -+ | m88110-* | m88k-* | maxq-* | mcore-* \ -+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ -+ | mips16-* \ -+ | mips64-* | mips64el-* \ -+ | mips64vr-* | mips64vrel-* \ -+ | mips64orion-* | mips64orionel-* \ -+ | mips64vr4100-* | mips64vr4100el-* \ -+ | mips64vr4300-* | mips64vr4300el-* \ -+ | mips64vr5000-* | mips64vr5000el-* \ -+ | mips64vr5900-* | mips64vr5900el-* \ -+ | mipsisa32-* | mipsisa32el-* \ -+ | mipsisa32r2-* | mipsisa32r2el-* \ -+ | mipsisa64-* | mipsisa64el-* \ -+ | mipsisa64r2-* | mipsisa64r2el-* \ -+ | mipsisa64sb1-* | mipsisa64sb1el-* \ -+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ -+ | mipstx39-* | mipstx39el-* \ -+ | mmix-* \ -+ | mt-* \ -+ | msp430-* \ -+ | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ -- | s390-* | s390x-* \ -- | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ -- | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ -- | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ -- | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ -- | v850-* | vax-* \ -+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ -+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ -+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ -+ | sparclite-* \ -+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ -+ | tahoe-* | thumb-* \ -+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ -+ | tron-* \ -+ | v850-* | v850e-* | vax-* \ - | we32k-* \ -- | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ -+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ -+ | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-*) - ;; -+ # Recognize the basic CPU types without company name, with glob match. -+ xtensa*) -+ basic_machine=$basic_machine-unknown -+ ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) -@@ -329,6 +393,9 @@ - basic_machine=a29k-amd - os=-udi - ;; -+ abacus) -+ basic_machine=abacus-unknown -+ ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout -@@ -343,6 +410,12 @@ - basic_machine=a29k-none - os=-bsd - ;; -+ amd64) -+ basic_machine=x86_64-pc -+ ;; -+ amd64-*) -+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; - amdahl) - basic_machine=580-amdahl - os=-sysv -@@ -374,6 +447,18 @@ - basic_machine=ns32k-sequent - os=-dynix - ;; -+ blackfin) -+ basic_machine=bfin-unknown -+ os=-linux -+ ;; -+ blackfin-*) -+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` -+ os=-linux -+ ;; -+ c90) -+ basic_machine=c90-cray -+ os=-unicos -+ ;; - convex-c1) - basic_machine=c1-convex - os=-bsd -@@ -394,30 +479,45 @@ - basic_machine=c38-convex - os=-bsd - ;; -- cray | ymp) -- basic_machine=ymp-cray -+ cray | j90) -+ basic_machine=j90-cray - os=-unicos - ;; -- cray2) -- basic_machine=cray2-cray -- os=-unicos -+ craynv) -+ basic_machine=craynv-cray -+ os=-unicosmp - ;; -- [cjt]90) -- basic_machine=${basic_machine}-cray -- os=-unicos -+ cr16) -+ basic_machine=cr16-unknown -+ os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; -+ crisv32 | crisv32-* | etraxfs*) -+ basic_machine=crisv32-axis -+ ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; -+ crx) -+ basic_machine=crx-unknown -+ os=-elf -+ ;; - 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 -@@ -426,6 +526,10 @@ - basic_machine=m88k-motorola - os=-sysv3 - ;; -+ djgpp) -+ basic_machine=i586-pc -+ os=-msdosdjgpp -+ ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx -@@ -576,6 +680,14 @@ - basic_machine=m68k-isi - os=-sysv - ;; -+ m68knommu) -+ basic_machine=m68k-unknown -+ os=-linux -+ ;; -+ m68knommu-*) -+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` -+ os=-linux -+ ;; - m88k-omron*) - basic_machine=m88k-omron - ;; -@@ -591,6 +703,10 @@ - basic_machine=i386-pc - os=-mingw32 - ;; -+ mingw32ce) -+ basic_machine=arm-unknown -+ os=-mingw32ce -+ ;; - miniframe) - basic_machine=m68000-convergent - ;; -@@ -598,32 +714,27 @@ - basic_machine=m68k-atari - os=-mint - ;; -- mipsel*-linux*) -- basic_machine=mipsel-unknown -- os=-linux-gnu -- ;; -- mips*-linux*) -- basic_machine=mips-unknown -- os=-linux-gnu -- ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; -- mmix*) -- basic_machine=mmix-knuth -- os=-mmixware -- ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; -+ morphos) -+ basic_machine=powerpc-unknown -+ os=-morphos -+ ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; -+ ms1-*) -+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` -+ ;; - mvs) - basic_machine=i370-ibm - os=-mvs -@@ -699,6 +810,13 @@ - basic_machine=hppa1.1-oki - os=-proelf - ;; -+ openrisc | openrisc-*) -+ basic_machine=or32-unknown -+ ;; -+ os400) -+ basic_machine=powerpc-ibm -+ os=-os400 -+ ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose -@@ -715,55 +833,75 @@ - basic_machine=i860-intel - os=-osf - ;; -+ parisc) -+ basic_machine=hppa-unknown -+ os=-linux -+ ;; -+ parisc-*) -+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` -+ os=-linux -+ ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; -- pc532 | pc532-*) -+ pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; -- pentium | p5 | k5 | k6 | nexgen) -+ pc98) -+ basic_machine=i386-pc -+ ;; -+ pc98-*) -+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; -+ pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; -- pentiumpro | p6 | 6x86 | athlon) -+ pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; -- pentiumii | pentium2) -+ pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; -- pentium-* | p5-* | k5-* | k6-* | nexgen-*) -+ 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-*) -+ 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/^[^-]*-//'` - ;; -@@ -774,6 +912,10 @@ - basic_machine=i586-unknown - os=-pw32 - ;; -+ rdos) -+ basic_machine=i386-pc -+ os=-rdos -+ ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff -@@ -784,10 +926,30 @@ - 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 -+ ;; -+ sde) -+ basic_machine=mipsisa32-sde -+ os=-elf -+ ;; -+ sei) -+ basic_machine=mips-sei -+ os=-seiux -+ ;; - sequent) - basic_machine=i386-sequent - ;; -@@ -795,7 +957,13 @@ - basic_machine=sh-hitachi - os=-hms - ;; -- sparclite-wrs) -+ sh5el) -+ basic_machine=sh5le-unknown -+ ;; -+ sh64) -+ basic_machine=sh64-unknown -+ ;; -+ sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; -@@ -862,22 +1030,46 @@ - os=-dynix - ;; - t3e) -- basic_machine=t3e-cray -+ 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 -+ ;; -+ tile*) -+ basic_machine=tile-unknown -+ os=-linux-gnu -+ ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; -+ toad1) -+ basic_machine=pdp10-xkl -+ os=-tops20 -+ ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; -+ tpf) -+ basic_machine=s390x-ibm -+ os=-tpf -+ ;; - udi29k) - basic_machine=a29k-amd - os=-udi -@@ -899,8 +1091,8 @@ - os=-vms - ;; - vpp*|vx|vx-*) -- basic_machine=f301-fujitsu -- ;; -+ basic_machine=f301-fujitsu -+ ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks -@@ -921,17 +1113,17 @@ - basic_machine=hppa1.1-winbond - os=-proelf - ;; -- windows32) -- basic_machine=i386-pc -- os=-windows32-msvcrt -- ;; -- xmp) -- basic_machine=xmp-cray -- os=-unicos -+ xbox) -+ basic_machine=i686-pc -+ os=-mingw32 - ;; -- xps | xps100) -+ xps | xps100) - basic_machine=xps100-honeywell - ;; -+ ymp) -+ basic_machine=ymp-cray -+ os=-unicos -+ ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim -@@ -952,16 +1144,12 @@ - op60c) - basic_machine=hppa1.1-oki - ;; -- mips) -- if [ x$os = x-linux-gnu ]; then -- basic_machine=mips-unknown -- else -- basic_machine=mips-mips -- fi -- ;; - romp) - basic_machine=romp-ibm - ;; -+ mmix) -+ basic_machine=mmix-knuth -+ ;; - rs6000) - basic_machine=rs6000-ibm - ;; -@@ -978,13 +1166,13 @@ - we32k) - basic_machine=we32k-att - ;; -- sh3 | sh4 | sh3eb | sh4eb) -+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; -- sparc | sparcv9 | sparcv9b) -+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; -- cydra) -+ cydra) - basic_machine=cydra-cydrome - ;; - orion) -@@ -999,10 +1187,6 @@ - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; -- c4x*) -- basic_machine=c4x-none -- os=-coff -- ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; -@@ -1058,17 +1242,23 @@ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ -- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ -- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ -+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ -+ | -openbsd* | -solidbsd* \ -+ | -ekkobsd* | -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* | -rhapsody* | -darwin* | -opened* \ -+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ -+ | -uxpv* | -beos* | -mpeix* | -udk* \ -+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ -- | -os2* | -vos*) -+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ -+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ -+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ -+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) -@@ -1080,16 +1270,21 @@ - ;; - esac - ;; -+ -nto-qnx*) -+ ;; - -nto*) -- os=-nto-qnx -+ os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ -- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ -+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; -+ -linux-dietlibc) -+ os=-linux-dietlibc -+ ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -@@ -1102,6 +1297,9 @@ - -opened*) - os=-openedition - ;; -+ -os400*) -+ os=-os400 -+ ;; - -wince*) - os=-wince - ;; -@@ -1120,14 +1318,23 @@ - -acis*) - os=-aos - ;; -+ -atheos*) -+ os=-atheos -+ ;; -+ -syllable*) -+ os=-syllable -+ ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; -+ -nova*) -+ os=-rtmk-nova -+ ;; - -ns2 ) -- os=-nextstep2 -+ os=-nextstep2 - ;; - -nsk*) - os=-nsk -@@ -1139,6 +1346,9 @@ - -sinix*) - os=-sysv4 - ;; -+ -tpf*) -+ os=-tpf -+ ;; - -triton*) - os=-sysv3 - ;; -@@ -1166,8 +1376,17 @@ - -xenix) - os=-xenix - ;; -- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) -- os=-mint -+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) -+ os=-mint -+ ;; -+ -aros*) -+ os=-aros -+ ;; -+ -kaos*) -+ os=-kaos -+ ;; -+ -zvmoe) -+ os=-zvmoe - ;; - -none) - ;; -@@ -1191,6 +1410,12 @@ - # system, and we'll never get to this point. - - case $basic_machine in -+ score-*) -+ os=-elf -+ ;; -+ spu-*) -+ os=-elf -+ ;; - *-acorn) - os=-riscix1.2 - ;; -@@ -1200,10 +1425,14 @@ - arm*-semi) - os=-aout - ;; -+ c4x-* | tic4x-*) -+ os=-coff -+ ;; -+ # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; -- pdp11-*) -+ pdp11-*) - os=-none - ;; - *-dec | vax-*) -@@ -1224,12 +1453,18 @@ - m68*-cisco) - os=-aout - ;; -+ mep-*) -+ os=-elf -+ ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; -+ or32-*) -+ os=-coff -+ ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; -@@ -1239,9 +1474,15 @@ - *-be) - os=-beos - ;; -+ *-haiku) -+ os=-haiku -+ ;; - *-ibm) - os=-aix - ;; -+ *-knuth) -+ os=-mmixware -+ ;; - *-wec) - os=-proelf - ;; -@@ -1293,19 +1534,19 @@ - *-next) - os=-nextstep3 - ;; -- *-gould) -+ *-gould) - os=-sysv - ;; -- *-highlevel) -+ *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; -- *-sgi) -+ *-sgi) - os=-irix - ;; -- *-siemens) -+ *-siemens) - os=-sysv4 - ;; - *-masscomp) -@@ -1374,10 +1615,16 @@ - -mvs* | -opened*) - vendor=ibm - ;; -+ -os400*) -+ vendor=ibm -+ ;; - -ptx*) - vendor=sequent - ;; -- -vxsim* | -vxworks*) -+ -tpf*) -+ vendor=ibm -+ ;; -+ -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) -@@ -1401,7 +1648,7 @@ - esac - - echo $basic_machine$os --exit 0 -+exit - - # Local variables: - # eval: (add-hook 'write-file-hooks 'time-stamp) ---- gsmlib-1.10.orig/scripts/ltconfig -+++ gsmlib-1.10/scripts/ltconfig -@@ -1,8 +1,8 @@ - #! /bin/sh - - # ltconfig - Create a system-specific libtool. --# Copyright (C) 1996-1998 Free Software Foundation, Inc. --# Gordon Matzigkeit , 1996 -+# Copyright (C) 1996-1999 Free Software Foundation, Inc. -+# Originally by Gordon Matzigkeit , 1996 - # - # This file is free software; you can redistribute it and/or modify it - # under the terms of the GNU General Public License as published by -@@ -32,12 +32,8 @@ - # Discard the --no-reexec flag, and continue. - shift - elif test "X$1" = X--fallback-echo; then -- # used as fallback echo -- shift -- cat </dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -@@ -46,11 +42,30 @@ - exec "$SHELL" "$0" --no-reexec ${1+"$@"} - fi - -+if test "X$1" = X--fallback-echo; then -+ # used as fallback echo -+ shift -+ cat </dev/null`} -+ case X$UNAME in -+ *-DOS) PATH_SEPARATOR=';' ;; -+ *) PATH_SEPARATOR=':' ;; -+ esac -+fi -+ - # The HP-UX ksh and POSIX shell print the target directory to stdout - # if CDPATH is set. --if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi -+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - --if test "X${echo_test_string+set}" != "Xset"; then -+if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... -@@ -70,9 +85,9 @@ - # - # So, first we look for a working echo in the user's PATH. - -- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" -+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH /usr/ucb; do -- if test -f $dir/echo && -+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$dir/echo" -@@ -87,7 +102,8 @@ - test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' -- elif test -f /bin/ksh && test "X$CONFIG_SHELL" != X/bin/ksh; then -+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && -+ test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running ltconfig again with it. - ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" - export ORIGINAL_CONFIG_SHELL -@@ -96,10 +112,10 @@ - exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} - else - # Try using printf. -- echo='printf %s\n' -+ echo='printf "%s\n"' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && -- test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then -- # Cool, printf works -+ test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then -+ # Cool, printf works - : - elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then -@@ -110,9 +126,9 @@ - echo="$CONFIG_SHELL $0 --fallback-echo" - elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then -- echo="$CONFIG_SHELL $0 --fallback-echo" -+ echo="$CONFIG_SHELL $0 --fallback-echo" - else -- # maybe with a smaller string... -+ # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do -@@ -143,15 +159,20 @@ - # Same as above, but do not quote variable references. - double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -+# Sed substitution to delay expansion of an escaped shell variable in a -+# double_quote_subst'ed string. -+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' -+ - # The name of this program. - progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` - - # Constants: - PROGRAM=ltconfig - PACKAGE=libtool --VERSION=1.2d --ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' --ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' -+VERSION=1.3.5 -+TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" -+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' - rm="rm -f" - - help="Try \`$progname --help' for more information." -@@ -160,8 +181,12 @@ - default_ofile=libtool - can_build_shared=yes - enable_shared=yes --# All known linkers require a `.a' archive for static linking. -+# All known linkers require a `.a' archive for static linking (except M$VC, -+# which needs '.lib'). - enable_static=yes -+enable_fast_install=yes -+enable_dlopen=unknown -+enable_win32_dll=no - ltmain= - silent= - srcdir= -@@ -174,18 +199,24 @@ - with_gcc=no - with_gnu_ld=no - need_locks=yes -+ac_ext=c - objext=o - libext=a -+exeext= -+cache_file= - - old_AR="$AR" - old_CC="$CC" - old_CFLAGS="$CFLAGS" - old_CPPFLAGS="$CPPFLAGS" -+old_LDFLAGS="$LDFLAGS" - old_LD="$LD" - old_LN_S="$LN_S" -+old_LIBS="$LIBS" - old_NM="$NM" - old_RANLIB="$RANLIB" - old_DLLTOOL="$DLLTOOL" -+old_OBJDUMP="$OBJDUMP" - old_AS="$AS" - - # Parse the command line options. -@@ -214,6 +245,9 @@ - --debug enable verbose shell tracing - --disable-shared do not build shared libraries - --disable-static do not build static libraries -+ --disable-fast-install do not optimize for fast installation -+ --enable-dlopen enable dlopen support -+ --enable-win32-dll enable building dlls on win32 hosts - --help display this help and exit - --no-verify do not verify that HOST is a valid host type - -o, --output=FILE specify the output file [default=$default_ofile] -@@ -224,6 +258,7 @@ - --with-gcc assume that the GNU C compiler will be used - --with-gnu-ld assume that the C compiler uses the GNU linker - --disable-lock disable file locking -+ --cache-file=FILE configure cache file - - LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program - that provides basic libtool functionality. -@@ -242,6 +277,12 @@ - - --disable-static) enable_static=no ;; - -+ --disable-fast-install) enable_fast_install=no ;; -+ -+ --enable-dlopen) enable_dlopen=yes ;; -+ -+ --enable-win32-dll) enable_win32_dll=yes ;; -+ - --quiet | --silent) silent=yes ;; - - --srcdir) prev=srcdir ;; -@@ -252,13 +293,15 @@ - --output | -o) prev=ofile ;; - --output=*) ofile="$optarg" ;; - -- --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;; -+ --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;; - - --with-gcc) with_gcc=yes ;; - --with-gnu-ld) with_gnu_ld=yes ;; - - --disable-lock) need_locks=no ;; - -+ --cache-file=*) cache_file="$optarg" ;; -+ - -*) - echo "$progname: unrecognized option \`$option'" 1>&2 - echo "$help" 1>&2 -@@ -326,8 +369,13 @@ - # Only set LANG and LC_ALL to C if already set. - # These must not be set unconditionally because not all systems understand - # e.g. LANG=C (notably SCO). --if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi --if test "${LANG+set}" = set; then LANG=C; export LANG; fi -+if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi -+if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi -+ -+if test -n "$cache_file" && test -r "$cache_file"; then -+ echo "loading cache $cache_file within ltconfig" -+ . $cache_file -+fi - - if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. -@@ -343,7 +391,7 @@ - - if test -z "$srcdir"; then - # Assume the source directory is the same one as the path to LTMAIN. -- srcdir=`$echo "$ltmain" | $Xsed -e 's%/[^/]*$%%'` -+ srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` - test "$srcdir" = "$ltmain" && srcdir=. - fi - -@@ -414,7 +462,7 @@ - # 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 "${COLLECT_NAMES+set}" != set; then -+ if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi -@@ -429,15 +477,18 @@ - # Set a sane default for `AR'. - test -z "$AR" && AR=ar - -+# Set a sane default for `OBJDUMP'. -+test -z "$OBJDUMP" && OBJDUMP=objdump -+ - # If RANLIB is not set, then run the test. - if test "${RANLIB+set}" != "set"; then - result=no - - echo $ac_n "checking for ranlib... $ac_c" 1>&6 -- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" -+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do - test -z "$dir" && dir=. -- if test -f $dir/ranlib; then -+ if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then - RANLIB="ranlib" - result="ranlib" - break -@@ -453,8 +504,9 @@ - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - fi - --# Set sane defaults for `DLLTOOL' and `AS', used on cygwin32. -+# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. - test -z "$DLLTOOL" && DLLTOOL=dlltool -+test -z "$OBJDUMP" && OBJDUMP=objdump - test -z "$AS" && AS=as - - # Check to see if we are using GCC. -@@ -462,11 +514,10 @@ - # If CC is not set, then try to find GCC or a usable CC. - if test -z "$CC"; then - echo $ac_n "checking for gcc... $ac_c" 1>&6 -- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" -+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do -- IFS="$save_ifs" - test -z "$dir" && dir=. -- if test -f $dir/gcc; then -+ if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then - CC="gcc" - break - fi -@@ -483,11 +534,11 @@ - # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". - if test -z "$CC"; then - echo $ac_n "checking for cc... $ac_c" 1>&6 -- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" -+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - cc_rejected=no - for dir in $PATH; do - test -z "$dir" && dir=. -- if test -f $dir/cc; then -+ if test -f $dir/cc || test -f $dir/cc$ac_exeext; then - if test "$dir/cc" = "/usr/ucb/cc"; then - cc_rejected=yes - continue -@@ -527,7 +578,7 @@ - # Now see if the compiler is really GCC. - with_gcc=no - echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 -- echo "$progname:530: checking whether we are using GNU C" >&5 -+ echo "$progname:581: checking whether we are using GNU C" >&5 - - $rm conftest.c - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then -+ if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - with_gcc=yes - fi - $rm conftest.c -@@ -549,8 +600,8 @@ - echo $ac_n "checking for object suffix... $ac_c" 1>&6 - $rm conftest* - echo 'int i = 1;' > conftest.c --echo "$progname:552: checking for object suffix" >& 5 --if { (eval echo $progname:553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then -+echo "$progname:603: checking for object suffix" >& 5 -+if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - -@@ -568,6 +619,38 @@ - $rm conftest* - echo "$ac_t$objext" 1>&6 - -+echo $ac_n "checking for executable suffix... $ac_c" 1>&6 -+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ ac_cv_exeext="no" -+ $rm conftest* -+ echo 'main () { return 0; }' > conftest.c -+ echo "$progname:629: checking for executable suffix" >& 5 -+ if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then -+ # Append any warnings to the config.log. -+ cat conftest.err 1>&5 -+ -+ for ac_file in conftest.*; do -+ case $ac_file in -+ *.c | *.err | *.$objext ) ;; -+ *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; -+ esac -+ done -+ else -+ cat conftest.err 1>&5 -+ echo "$progname: failed program was:" >&5 -+ cat conftest.c >&5 -+ fi -+ $rm conftest* -+fi -+if test "X$ac_cv_exeext" = Xno; then -+ exeext="" -+else -+ exeext="$ac_cv_exeext" -+fi -+echo "$ac_t$ac_cv_exeext" 1>&6 -+ - echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 - pic_flag= - special_shlib_compile_flags= -@@ -580,10 +663,19 @@ - link_static_flag='-static' - - case "$host_os" in -- aix3* | aix4* | irix5* | irix6* | osf3* | osf4*) -+ beos* | irix5* | irix6* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; -- cygwin32* | mingw32* | os2*) -+ aix*) -+ # Below there is a dirty hack to force normal static linking with -ldl -+ # The problem is because libdl dynamically linked with both libc and -+ # libC (AIX C++ library), which obviously doesn't included in libraries -+ # list by gcc. This cause undefined symbols with -static flags. -+ # This hack allows C programs to be linked with "-static -ldl", but -+ # we not sure about C++ programs. -+ link_static_flag="$link_static_flag ${wl}-lC" -+ ;; -+ cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - amigaos*) -@@ -592,6 +684,11 @@ - # like `-m68040'. - pic_flag='-m68020 -resident32 -malways-restore-a4' - ;; -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ pic_flag=-Kconform_pic -+ fi -+ ;; - *) - pic_flag='-fPIC' - ;; -@@ -617,11 +714,11 @@ - # PIC (with -KPIC) is the default. - ;; - -- cygwin32* | mingw32* | os2*) -+ cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - -- osf3* | osf4*) -+ osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - wl='-Wl,' - link_static_flag='-non_shared' -@@ -645,7 +742,7 @@ - wl='-Qoption ld ' - ;; - -- sysv4.2uw2* | sysv5*) -+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' -@@ -655,7 +752,12 @@ - pic_flag='-pic' - link_static_flag='-Bstatic' - ;; -- -+ sysv4*MP*) -+ if test -d /usr/nec ;then -+ pic_flag='-Kconform_pic' -+ link_static_flag='-Bstatic' -+ fi -+ ;; - *) - can_build_shared=no - ;; -@@ -671,22 +773,30 @@ - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pic_flag -DPIC" -- echo "$progname:674: checking if $compiler PIC flag $pic_flag works" >&5 -- if { (eval echo $progname:675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then -+ echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 -+ if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 -- -- # On HP-UX, both CC and GCC only warn that PIC is supported... then they -- # create non-PIC objects. So, if there were any warnings, we assume that -- # PIC is not supported. -- if test -s conftest.err; then -- echo "$ac_t"no 1>&6 -- can_build_shared=no -- pic_flag= -- else -+ -+ case "$host_os" in -+ hpux9* | hpux10* | hpux11*) -+ # On HP-UX, both CC and GCC only warn that PIC is supported... then they -+ # create non-PIC objects. So, if there were any warnings, we assume that -+ # PIC is not supported. -+ if test -s conftest.err; then -+ echo "$ac_t"no 1>&6 -+ can_build_shared=no -+ pic_flag= -+ else -+ echo "$ac_t"yes 1>&6 -+ pic_flag=" $pic_flag" -+ fi -+ ;; -+ *) - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" -- fi -+ ;; -+ esac - else - # Append any errors to the config.log. - cat conftest.err 1>&5 -@@ -702,16 +812,26 @@ - - # Check to see if options -o and -c are simultaneously supported by compiler - echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 -+$rm -r conftest 2>/dev/null -+mkdir conftest -+cd conftest - $rm conftest* - echo "int some_variable = 0;" > conftest.c -+mkdir out -+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -+# that will create temporary files in the current directory regardless of -+# the output directory. Thus, making CWD read-only will cause this test -+# to fail, enabling locking or at least warning the user not to do parallel -+# builds. -+chmod -w . - save_CFLAGS="$CFLAGS" --CFLAGS="$CFLAGS -c -o conftest2.o" --echo "$progname:709: checking if $compiler supports -c -o file.o" >&5 --if { (eval echo $progname:710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest2.o; then -+CFLAGS="$CFLAGS -o out/conftest2.o" -+echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 -+if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings -- if test -s conftest.err; then -+ if test -s out/conftest.err; then - echo "$ac_t"no 1>&6 - compiler_c_o=no - else -@@ -720,12 +840,17 @@ - fi - else - # Append any errors to the config.log. -- cat conftest.err 1>&5 -+ cat out/conftest.err 1>&5 - compiler_c_o=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" --$rm conftest* -+chmod u+w . -+$rm conftest* out/* -+rmdir out -+cd .. -+rmdir conftest -+$rm -r conftest 2>/dev/null - - if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo -@@ -734,8 +859,8 @@ - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" -- echo "$progname:737: checking if $compiler supports -c -o file.lo" >&5 --if { (eval echo $progname:738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then -+ echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 -+if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings -@@ -743,8 +868,8 @@ - echo "$ac_t"no 1>&6 - compiler_o_lo=no - else -- echo "$ac_t"yes 1>&6 -- compiler_o_lo=yes -+ echo "$ac_t"yes 1>&6 -+ compiler_o_lo=yes - fi - else - # Append any errors to the config.log. -@@ -786,17 +911,17 @@ - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" -- echo "$progname:789: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -- if { (eval echo $progname:790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then -+ echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -+ if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then -- echo "$ac_t"no 1>&6 -- compiler_rtti_exceptions=no -+ echo "$ac_t"no 1>&6 -+ compiler_rtti_exceptions=no - else -- echo "$ac_t"yes 1>&6 -- compiler_rtti_exceptions=yes -+ echo "$ac_t"yes 1>&6 -+ compiler_rtti_exceptions=yes - fi - else - # Append any errors to the config.log. -@@ -830,8 +955,8 @@ - echo 'main(){return(0);}' > conftest.c - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $link_static_flag" --echo "$progname:833: checking if $compiler static flag $link_static_flag works" >&5 --if { (eval echo $progname:834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then -+echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 -+if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - echo "$ac_t$link_static_flag" 1>&6 - else - echo "$ac_t"none 1>&6 -@@ -843,9 +968,9 @@ - if test -z "$LN_S"; then - # Check to see if we can use ln -s, or we need hard links. - echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 -- $rm conftestdata -- if ln -s X conftestdata 2>/dev/null; then -- $rm conftestdata -+ $rm conftest.dat -+ if ln -s X conftest.dat 2>/dev/null; then -+ $rm conftest.dat - LN_S="ln -s" - else - LN_S=ln -@@ -863,48 +988,18 @@ - if test "$with_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 -- echo "$progname:866: checking for ld used by GCC" >&5 -+ echo "$progname:991: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. -- /* | [A-Za-z]:/*) -+ [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' -- sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%' -- # Canonicalize the path of ld -- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do -- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` -- done -- case "$host_os" in -- cygwin*) -- # Convert to a UNC path for cygwin -- test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"` -- ;; -- *) -- test -z "$LD" && LD="$ac_prog" -- ;; -- esac -- ;; -- ## -- ## FIXME: The code fails later on if we try to use an $LD with -- ## '\\' path separators. -- ## -- [A-Za-z]:[\\]*) -- re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)' -- sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%' -- sub_uncdir='s%\\%/%g' - # Canonicalize the path of ld -+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do -- ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"` -+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done -- case "$host_os" in -- cygwin*) -- # Convert to a UNC path for cygwin -- test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive" -e "$sub_uncdir"` -- ;; -- *) -- test -z "$LD" && LD="$ac_prog" -- ;; -- esac -+ test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we are not using GCC. -@@ -917,17 +1012,17 @@ - esac - elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld... $ac_c" 1>&6 -- echo "$progname:920: checking for GNU ld" >&5 -+ echo "$progname:1015: checking for GNU ld" >&5 - else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -- echo "$progname:923: checking for non-GNU ld" >&5 -+ echo "$progname:1018: checking for non-GNU ld" >&5 - fi - - if test -z "$LD"; then -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" -+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. -- if test -f "$ac_dir/$ac_prog"; then -+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. -@@ -969,130 +1064,208 @@ - - allow_undefined_flag= - no_undefined_flag= -+need_lib_prefix=unknown -+need_version=unknown -+# when you set need_version to no, make sure it does not cause -set_version -+# flags to be left without arguments - archive_cmds= --archive_sym_cmds= -+archive_expsym_cmds= - old_archive_from_new_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= -+thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - runpath_var= -+always_export_symbols=no -+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -+# include_expsyms should be a list of space-separated symbols to be *always* -+# included in the symbol list -+include_expsyms= -+# exclude_expsyms can be an egrep regular expression of symbols to exclude -+# it will be wrapped by ` (' and `)$', so one must not match beginning or -+# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -+# as well as any symbol that contains `d'. -+exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -+# platforms (ab)use it in PIC code, but their linkers get confused if -+# the symbol is explicitly referenced. Since portable code cannot -+# rely on this symbol name, it's probably fine to never include it in -+# preloaded symbol tables. - - case "$host_os" in --aix3* | aix4*) -- # On AIX, the GNU linker works like the native linker. -- with_gnu_ld=no -+cygwin* | mingw*) -+ # FIXME: the MSVC++ port hasn't been tested in a loooong time -+ # When not using gcc, we currently assume that we are using -+ # Microsoft Visual C++. -+ if test "$with_gcc" != yes; then -+ with_gnu_ld=no -+ fi - ;; -+ - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then -+ # If archive_cmds runs LD, not CC, wlarc should be empty -+ wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case "$host_os" in -+ aix3* | aix4*) -+ # On AIX, the GNU linker is very broken -+ ld_shlibs=no -+ cat <&2 -+ -+*** Warning: the GNU linker, at least up to release 2.9.1, is reported -+*** to be unable to reliably create shared libraries on AIX. -+*** Therefore, libtool is disabling shared libraries support. If you -+*** really care for shared libraries, you may want to modify your PATH -+*** so that a non-GNU linker is found, and then restart. -+ -+EOF -+ ;; -+ - amigaos*) -- archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib$libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' -+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes -- ;; - -- sunos4*) -- archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs' -- hardcode_direct=yes -- hardcode_minus_L=yes -- hardcode_shlibpath_var=no -+ # Samuel A. Falvo II reports -+ # that the semantics of dynamic libraries on AmigaOS, at least up -+ # to version 4, is to share data among multiple programs linked -+ # with the same dynamic library. Since this doesn't match the -+ # behavior of shared libraries on other platforms, we can use -+ # them. -+ ld_shlibs=no - ;; - -- cygwin32* | mingw32*) -- if test "$with_gcc" = yes; then -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec='-L$libdir' -+ beos*) -+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported -- # Very, very bogus. -- echo ' --#define WIN32_LEAN_AND_MEAN --#include --#undef WIN32_LEAN_AND_MEAN --#include -+ # Joseph Beckenbach says some releases of gcc -+ # support --undefined. This deserves some investigation. FIXME -+ archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' -+ else -+ ld_shlibs=no -+ fi -+ ;; - --BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -+ cygwin* | mingw*) -+ # hardcode_libdir_flag_spec is actually meaningless, as there is -+ # no search path for DLLs. -+ hardcode_libdir_flag_spec='-L$libdir' -+ allow_undefined_flag=unsupported -+ always_export_symbols=yes - --#include --DECLARE_CYGWIN_DLL( DllMain ); --HINSTANCE __hDllInstance_base; -+ # Extract the symbol export list from an `--export-all' def file, -+ # then regenerate the def file from the symbol export list, so that -+ # the compiled dll only exports the symbol export list. -+ # Be careful not to strip the DATA tag left by newer dlltools. -+ export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ -+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ -+ $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ -+ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' -+ -+ # If DATA tags from a recent dlltool are present, honour them! -+ archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ -+ _lt_hint=1; -+ cat $export_symbols | while read symbol; do -+ set dummy \$symbol; -+ case \$# in -+ 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; -+ *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; -+ esac; -+ _lt_hint=`expr 1 + \$_lt_hint`; -+ done~ -+ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ -+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ -+ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ -+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ -+ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ -+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ -+ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' - --BOOL APIENTRY --DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) --{ -- __hDllInstance_base = hInst; -- return TRUE; --} --' > ltdll.c -- archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ -- $DLLTOOL --export-all --output-def $lib-def $libobjs ltdll.$objext~ -- $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $rm ltdll.$objext $soname-base $soname-exp' -- archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ -- cat "$export_symbols" >> $lib-def~ -- $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $rm ltdll.$objext $soname-base $soname-exp' -- old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib-def --output-lib $objdir/$libname.a~$rm $lib.exp' -- else -- # When not using gcc, we currently assume that we are using -- # Microsoft Visual C++. -- with_gnu_ld=no -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec=' ' -- allow_undefined_flag=unsupported -- # Tell ltmain to make .lib files, not .a files. -- libext=lib -- # FIXME: Setting linknames here is a bad hack. -- archive_cmds='$CC -o $lib$libobjs`echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' -- # The linker will automatically build a .lib file if we build a DLL. -- old_archive_from_new_cmds='true' -- # FIXME: Should let the user specify the lib program. -- old_archive_cmds='lib /OUT:$oldlib$oldobjs' -- fix_srcfile_path='`cygpath -w $srcfile`' -+ old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' -+ ;; -+ -+ netbsd*) -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' -+ # can we support soname and/or expsyms with a.out? -oliva - fi - ;; - -+ solaris* | sysv5*) -+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then -+ ld_shlibs=no -+ cat <&2 -+ -+*** Warning: The releases 2.8.* of the GNU linker cannot reliably -+*** create shared libraries on Solaris systems. Therefore, libtool -+*** is disabling shared libraries support. We urge you to upgrade GNU -+*** binutils to release 2.9.1 or newer. Another option is to modify -+*** your PATH or compiler configuration so that the native linker is -+*** used, and then restart. -+ -+EOF -+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then -+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ else -+ ld_shlibs=no -+ fi -+ ;; -+ -+ sunos4*) -+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' -+ wlarc= -+ hardcode_direct=yes -+ hardcode_shlibpath_var=no -+ ;; -+ - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then -- archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' -- archive_sym_cmds='$CC -shared ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib$libobjs$deplibs' -+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' -+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - -- if test "$ld_shlibs" = yes && test "$with_gnu_ld" = yes; then -+ if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' -- whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' -+ case $host_os in -+ cygwin* | mingw*) -+ # dlltool doesn't understand --whole-archive et. al. -+ whole_archive_flag_spec= -+ ;; -+ *) -+ # ancient GNU ld didn't support --whole-archive et. al. -+ if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then -+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' -+ else -+ whole_archive_flag_spec= -+ fi -+ ;; -+ esac - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case "$host_os" in - aix3*) - allow_undefined_flag=unsupported -- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp~ -- $LD -o $objdir/$soname$libobjs$deplibs -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' -- archive_sym_cmds='$LD -o $objdir/$soname$libobjs$deplibs -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' -+ always_export_symbols=yes -+ archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes -@@ -1104,80 +1277,67 @@ - ;; - - aix4*) -- allow_undefined_flag=unsupported -- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp else cat $export_symbols > $lib.exp~ -- $CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry~$AR cru $lib $objdir/$soname' -- archive_sym_cmds='$CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry~$AR cru $lib $objdir/$soname' -- hardcode_direct=yes -- hardcode_minus_L=yes -- ;; -+ hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' -+ hardcode_libdir_separator=':' -+ if test "$with_gcc" = yes; then -+ collect2name=`${CC} -print-prog-name=collect2` -+ if test -f "$collect2name" && \ -+ strings "$collect2name" | grep resolve_lib_name >/dev/null -+ then -+ # We have reworked collect2 -+ hardcode_direct=yes -+ else -+ # We have old collect2 -+ hardcode_direct=unsupported -+ # It fails to find uninstalled libraries when the uninstalled -+ # path is not listed in the libpath. Setting hardcode_minus_L -+ # to unsupported forces relinking -+ hardcode_minus_L=yes -+ hardcode_libdir_flag_spec='-L$libdir' -+ hardcode_libdir_separator= -+ fi -+ shared_flag='-shared' -+ else -+ shared_flag='${wl}-bM:SRE' -+ hardcode_direct=yes -+ fi -+ allow_undefined_flag=' ${wl}-berok' -+ archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' -+ archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' -+ case "$host_os" in aix4.[01]|aix4.[01].*) -+ # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on -+ always_export_symbols=yes ;; -+ esac -+ ;; - - amigaos*) -- archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib$libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' -+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes -+ # see comment about different semantics on the GNU ld section -+ ld_shlibs=no - ;; - -- cygwin32* | mingw32*) -- if test "$with_gcc" = yes; then -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec='-L$libdir' -- allow_undefined_flag=unsupported -- # Very, very bogus. -- echo ' --#define WIN32_LEAN_AND_MEAN --#include --#undef WIN32_LEAN_AND_MEAN --#include -- --BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -- --#include --DECLARE_CYGWIN_DLL( DllMain ); --HINSTANCE __hDllInstance_base; -+ cygwin* | mingw*) -+ # When not using gcc, we currently assume that we are using -+ # Microsoft Visual C++. -+ # hardcode_libdir_flag_spec is actually meaningless, as there is -+ # no search path for DLLs. -+ hardcode_libdir_flag_spec=' ' -+ allow_undefined_flag=unsupported -+ # Tell ltmain to make .lib files, not .a files. -+ libext=lib -+ # FIXME: Setting linknames here is a bad hack. -+ archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' -+ # The linker will automatically build a .lib file if we build a DLL. -+ old_archive_from_new_cmds='true' -+ # FIXME: Should let the user specify the lib program. -+ old_archive_cmds='lib /OUT:$oldlib$oldobjs' -+ fix_srcfile_path='`cygpath -w $srcfile`' -+ ;; - --BOOL APIENTRY --DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) --{ -- __hDllInstance_base = hInst; -- return TRUE; --} --' > ltdll.c -- archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ -- $DLLTOOL --export-all --output-def $lib-def $libobjs ltdll.$objext~ -- $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $rm ltdll.$objext $soname-base $soname-exp' -- archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib-def~ -- cat "$export_symbols" >> $lib-def~ -- $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobjs ltdll.$objext~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib-def --base-file $soname-base --output-exp $soname-exp~ -- $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ -- $rm ltdll.$objext $soname-base $soname-exp' -- old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib-def --output-lib $objdir/$libname.a~$rm $lib.exp' -- else -- # When not using gcc, we currently assume that we are using -- # Microsoft Visual C++. -- # hardcode_libdir_flag_spec is actually meaningless, as there is -- # no search path for DLLs. -- hardcode_libdir_flag_spec=' ' -- allow_undefined_flag=unsupported -- # Tell ltmain to make .lib files, not .a files. -- libext=lib -- # FIXME: Setting linknames here is a bad hack. -- archive_cmds='$CC -o $lib$libobjs`echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' -- # The linker will automatically build a .lib file if we build a DLL. -- old_archive_from_new_cmds='true' -- # FIXME: Should let the user specify the lib program. -- old_archive_cmds='lib /OUT:$oldlib$oldobjs' -- fix_srcfile_path='`cygpath -w $srcfile`' -- fi -+ freebsd1*) -+ ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor -@@ -1185,65 +1345,64 @@ - # 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 /usr/lib/c++rt0.o' -+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes -- hardcode_minus_L=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' -+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - -- # FreeBSD 3, at last, uses gcc -shared to do shared libraries. -- freebsd3*) -- archive_cmds='$CC -shared -o $lib$libobjs$deplibs' -+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries. -+ freebsd*) -+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes -- hardcode_minus_L=no - hardcode_shlibpath_var=no - ;; - -- hpux9*) -- archive_cmds='$rm $objdir/$soname~$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs~test $objdir/$soname = $lib || mv $objdir/$soname $lib' -- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' -- hardcode_direct=yes -- hardcode_minus_L=yes -- export_dynamic_flag_spec='${wl}-E' -- ;; -- -- hpux10* | hpux11*) -- archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' -+ hpux9* | hpux10* | hpux11*) -+ case "$host_os" in -+ hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; -+ *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; -+ esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' -+ hardcode_libdir_separator=: - hardcode_direct=yes -- hardcode_minus_L=yes -+ hardcode_minus_L=yes # Not in the search PATH, but as the default -+ # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6*) - if test "$with_gcc" = yes; then -- archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring$libobjs$deplibs' -+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else -- archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' -+ archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator=: - ;; - - netbsd*) -- # Tested with NetBSD 1.2 ld -- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' -- hardcode_libdir_flag_spec='-R$libdir' -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out -+ else -+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF -+ fi -+ hardcode_libdir_flag_spec='${wl}-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - openbsd*) -- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' -+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no -@@ -1253,102 +1412,169 @@ - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported -- archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp$libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib$libobjs$deplibs $objdir/$libname.def' -+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' - ;; - -- osf3* | osf4*) -+ osf3*) - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' -- archive_cmds='$CC -shared${allow_undefined_flag} -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring$libobjs$deplibs' -+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' -- archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' -+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - -- sco3.2v5*) -- archive_cmds='$LD -G -o $lib$libobjs$deplibs' -+ osf4* | osf5*) # As osf3* with the addition of the -msym flag -+ if test "$with_gcc" = yes; then -+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' -+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' -+ else -+ allow_undefined_flag=' -expect_unresolved \*' -+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' -+ fi -+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' -+ hardcode_libdir_separator=: -+ ;; -+ rhapsody*) -+ archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' -+ hardcode_libdir_flags_spec='-L$libdir' - hardcode_direct=yes -+ hardcode_shlibpath_var=no -+ ;; -+ -+ sco3.2v5*) -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' -+ hardcode_shlibpath_var=no -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now -- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs$deplibs' -- archive_sym_cmds='$echo "{ global:" > $lib.exp~sed $export_symbols -e "s/.*/\1;/" >> $lib.exp~$echo "local: * }" >> $lib.exp~ -- $LD -G${allow_undefined_flag} -M $export_symbols -h $soname -o $lib$libobjs$deplibs~$rm $lib.exp' -+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' -+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no -- -- # Solaris 2 before 2.5 hardcodes -L paths. - case "$host_os" in -- solaris2.[0-4]*) -- hardcode_minus_L=yes -- ;; -+ solaris2.[0-5] | solaris2.[0-5].*) ;; -+ *) # Supported since Solaris 2.6 (maybe 2.5.1?) -+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - ;; - - sunos4*) -- # Why do we need -Bstatic? To avoid inter-library dependencies, maybe... -- if test "$with_gcc" = yes; then -- archive_cmds='$CC -shared ${wl}-Bstatic -o $lib$libobjs$deplibs' -- else -- archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs' -- fi -+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - -+ sysv4) -+ if test "x$host_vendor" = xsequent; then -+ # Use $CC to link under sequent, because it throws in some extra .o -+ # files that make .init and .fini sections work. -+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' -+ else -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' -+ fi -+ runpath_var='LD_RUN_PATH' -+ hardcode_shlibpath_var=no -+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie -+ ;; -+ -+ sysv4.3*) -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' -+ hardcode_shlibpath_var=no -+ export_dynamic_flag_spec='-Bexport' -+ ;; -+ -+ sysv5*) -+ no_undefined_flag=' -z text' -+ # $CC -shared without GNU ld will not create a library from C++ -+ # object files and a static libstdc++, better avoid it by now -+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' -+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ -+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' -+ hardcode_libdir_flag_spec= -+ hardcode_shlibpath_var=no -+ runpath_var='LD_RUN_PATH' -+ ;; -+ - uts4*) -- archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' -- hardcode_direct=no -- hardcode_minus_L=no - hardcode_shlibpath_var=no - ;; - - dgux*) -- archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' -- hardcode_direct=no -+ hardcode_shlibpath_var=no -+ ;; -+ -+ sysv4*MP*) -+ if test -d /usr/nec; then -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' -+ hardcode_shlibpath_var=no -+ runpath_var=LD_RUN_PATH -+ hardcode_runpath_var=yes -+ ld_shlibs=yes -+ fi -+ ;; -+ -+ sysv4.2uw2*) -+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' -+ hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no -+ hardcode_runpath_var=yes -+ runpath_var=LD_RUN_PATH -+ ;; -+ -+ unixware7*) -+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' -+ runpath_var='LD_RUN_PATH' -+ hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no -- can_build_shared=no - ;; - esac - fi - echo "$ac_t$ld_shlibs" 1>&6 -+test "$ld_shlibs" = no && can_build_shared=no - - if test -z "$NM"; then - echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 - case "$NM" in -- /* | [A-Za-z]:[/\\]*) ;; # Let the user override the test with a path. -+ [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. - *) -- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" -- for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do -+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" -+ for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do - test -z "$ac_dir" && ac_dir=. -- if test -f $ac_dir/nm; then -- # Check to see if the nm accepts a BSD-compat flag. -- # Adding the `sed 1q' prevents false positives on HP-UX, which says: -- # nm: unknown option "B" ignored -- if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then -- NM="$ac_dir/nm -B" -- elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then -- NM="$ac_dir/nm -p" -+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then -+ # Check to see if the nm accepts a BSD-compat flag. -+ # Adding the `sed 1q' prevents false positives on HP-UX, which says: -+ # nm: unknown option "B" ignored -+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then -+ NM="$ac_dir/nm -B" -+ break -+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then -+ NM="$ac_dir/nm -p" -+ break - else -- NM="$ac_dir/nm" -+ NM=${NM="$ac_dir/nm"} # keep the first match, but -+ continue # so that we can try to find one that supports BSD flags - fi -- break - fi - done - IFS="$ac_save_ifs" -@@ -1365,52 +1591,54 @@ - # [They come from Ultrix. What could be older than Ultrix?!! ;)] - - # Character class describing NM global symbol codes. --symcode='[BCDEGRSTU]' -+symcode='[BCDEGRST]' - - # Regexp to match symbols that can be accessed directly from C. - sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - - # Transform the above into a raw symbol and a C symbol. --symxfrm='\1 \1' -+symxfrm='\1 \2\3 \3' -+ -+# Transform an extracted symbol line into a proper C declaration -+global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - - # Define system-specific variables. - case "$host_os" in - aix*) -- symcode='[BCDTU]' -+ symcode='[BCDT]' -+ ;; -+cygwin* | mingw*) -+ symcode='[ABCDGISTW]' - ;; --sunos* | cygwin32* | mingw32*) -- sympat='_\([_A-Za-z][_A-Za-z0-9]*\)' -- symxfrm='_\1 \1' -+hpux*) # Its linker distinguishes data from code symbols -+ global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" - ;; - irix*) -- # Cannot use undefined symbols on IRIX because inlined functions mess us up. - symcode='[BCDEGRST]' - ;; - solaris*) -- symcode='[BDTU]' -+ symcode='[BDT]' -+ ;; -+sysv4) -+ symcode='[DFNSTU]' - ;; - esac - - # If we're using GNU nm, then use its standard symbol codes. - if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then -- symcode='[ABCDGISTUW]' -+ symcode='[ABCDGISTW]' - fi - --case "$host_os" in --cygwin32* | mingw32*) -- # We do not want undefined symbols on cygwin32. The user must -- # arrange to define them via -l arguments. -- symcode='[ABCDGISTW]' -- ;; --esac -+# Try without a prefix undercore, then with it. -+for ac_symprfx in "" "_"; do - --# Write the raw and C identifiers. --global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'" -+ # Write the raw and C identifiers. -+ global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" - --# Check to see that the pipe works correctly. --pipe_works=no --$rm conftest* --cat > conftest.c < conftest.c <&5 --if { (eval echo $progname:1426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then -- # Now try to grab the symbols. -- nlist=conftest.nm -- if { echo "$progname:1429: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then -- -- # Try sorting and uniquifying the output. -- if sort "$nlist" | uniq > "$nlist"T; then -- mv -f "$nlist"T "$nlist" -- wcout=`wc "$nlist" 2>/dev/null` -- count=`$echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` -- (test "$count" -ge 0) 2>/dev/null || count=-1 -- else -- rm -f "$nlist"T -- count=-1 -- fi -+ echo "$progname:1653: checking if global_symbol_pipe works" >&5 -+ if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then -+ # Now try to grab the symbols. -+ nlist=conftest.nm -+ if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then -+ -+ # Try sorting and uniquifying the output. -+ if sort "$nlist" | uniq > "$nlist"T; then -+ mv -f "$nlist"T "$nlist" -+ else -+ rm -f "$nlist"T -+ fi - -- # Make sure that we snagged all the symbols we need. -- if egrep ' nm_test_var$' "$nlist" >/dev/null; then -- if egrep ' nm_test_func$' "$nlist" >/dev/null; then -- cat < conftest.c -+ # Make sure that we snagged all the symbols we need. -+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then -+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then -+ cat < conftest.c - #ifdef __cplusplus - extern "C" { - #endif - - EOF -- # Now generate the symbol file. -- sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c -+ # Now generate the symbol file. -+ eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' - -- cat <> conftest.c -+ cat <> conftest.c - #if defined (__STDC__) && __STDC__ --# define __ptr_t void * -+# define lt_ptr_t void * - #else --# define __ptr_t char * -+# define lt_ptr_t char * -+# define const - #endif - --/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ --int dld_preloaded_symbol_count = $count; -- - /* The mapping between symbol names and symbols. */ --struct { -- char *name; -- __ptr_t address; -+const struct { -+ const char *name; -+ lt_ptr_t address; - } --dld_preloaded_symbols[] = -+lt_preloaded_symbols[] = - { - EOF -- sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> conftest.c -- cat <<\EOF >> conftest.c -- {0, (__ptr_t) 0} -+ sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c -+ cat <<\EOF >> conftest.c -+ {0, (lt_ptr_t) 0} - }; - - #ifdef __cplusplus - } - #endif - EOF -- # Now try linking the two files. -- mv conftest.$objext conftestm.$objext -- save_LIBS="$LIBS" -- save_CFLAGS="$CFLAGS" -- LIBS="conftestm.$objext" -- CFLAGS="$CFLAGS$no_builtin_flag" -- if { (eval echo $progname:1487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then -- pipe_works=yes -- else -- echo "$progname: failed program was:" >&5 -- cat conftest.c >&5 -- fi -- LIBS="$save_LIBS" -+ # Now try linking the two files. -+ mv conftest.$objext conftstm.$objext -+ save_LIBS="$LIBS" -+ save_CFLAGS="$CFLAGS" -+ LIBS="conftstm.$objext" -+ CFLAGS="$CFLAGS$no_builtin_flag" -+ if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then -+ pipe_works=yes -+ else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.c >&5 -+ fi -+ LIBS="$save_LIBS" -+ else -+ echo "cannot find nm_test_func in $nlist" >&5 -+ fi - else -- echo "cannot find nm_test_func in $nlist" >&5 -+ echo "cannot find nm_test_var in $nlist" >&5 - fi - else -- echo "cannot find nm_test_var in $nlist" >&5 -+ echo "cannot run $global_symbol_pipe" >&5 - fi - else -- echo "cannot run $global_symbol_pipe" >&5 -+ echo "$progname: failed program was:" >&5 -+ cat conftest.c >&5 - fi -+ $rm conftest* conftst* -+ -+ # Do not use the global_symbol_pipe unless it works. -+ if test "$pipe_works" = yes; then -+ break -+ else -+ global_symbol_pipe= -+ fi -+done -+if test "$pipe_works" = yes; then -+ echo "${ac_t}ok" 1>&6 - else -- echo "$progname: failed program was:" >&5 -- cat conftest.c >&5 -+ echo "${ac_t}failed" 1>&6 - fi --$rm conftest* - --# Do not use the global_symbol_pipe unless it works. --echo "$ac_t$pipe_works" 1>&6 --test "$pipe_works" = yes || global_symbol_pipe= -+if test -z "$global_symbol_pipe"; then -+ global_symbol_to_cdecl= -+fi - - # Check hardcoding attributes. - echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 -@@ -1517,10 +1752,12 @@ - test -n "$runpath_var"; then - - # We can hardcode non-existant directories. -- if test "$hardcode_direct" != no && \ -- test "$hardcode_minus_L" != no && \ -- test "$hardcode_shlibpath_var" != no; then -- -+ if test "$hardcode_direct" != no && -+ # If the only mechanism to avoid hardcoding is shlibpath_var, we -+ # have to relink, otherwise we might link with an installed library -+ # when we should be linking with a yet-to-be-installed one -+ ## test "$hardcode_shlibpath_var" != no && -+ test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else -@@ -1552,26 +1789,27 @@ - finish_cmds= - finish_eval= - shlibpath_var= -+shlibpath_overrides_runpath=unknown - version_type=none - dynamic_linker="$host_os ld.so" --sys_lib_search_path="/lib /usr/lib /usr/local/lib" --check_shared_deplibs_method='none' -+sys_lib_dlsearch_path_spec="/lib /usr/lib" -+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -+file_magic_cmd= -+file_magic_test_file= -+deplibs_check_method='unknown' - # Need to set the preceding variable on all platforms that support - # interlibrary dependencies. - # 'none' -- dependencies not supported. -+# `unknown' -- same as none, but documents that we really don't know. - # 'pass_all' -- all dependencies passed with no checks. - # 'test_compile' -- check by making test program. --# 'file_regex' -- check by looking for filenames that look like the shared --# library in the library path. --# 'file_magic [regex]' -- check by looking for files in library path which --# responds to the "file" command with a given regex. This is actually a --# superset of the file_regex command. If you have file on your system, you'll --# want to use this instead. --# Notes: regexes are run through expr. -- -+# 'file_magic [regex]' -- check by looking for files in library path -+# which responds to the $file_magic_cmd with a given egrep regex. -+# If you have `file' or equivalent on your system and you're not sure -+# whether `pass_all' will *always* work, you probably want this one. - echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 - case "$host_os" in --aix3* | aix4*) -+aix3*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' - shlibpath_var=LIBPATH -@@ -1580,44 +1818,111 @@ - soname_spec='${libname}${release}.so$major' - ;; - -+aix4*) -+ version_type=linux -+ # AIX has no versioning support, so currently we can not hardcode correct -+ # soname into executable. Probably we can add versioning support to -+ # collect2, so additional links can be useful in future. -+ # We preserve .a as extension for shared libraries though AIX4.2 -+ # and later linker supports .so -+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' -+ shlibpath_var=LIBPATH -+ deplibs_check_method=pass_all -+ ;; -+ - amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -+beos*) -+ library_names_spec='${libname}.so' -+ dynamic_linker="$host_os ld.so" -+ shlibpath_var=LIBRARY_PATH -+ deplibs_check_method=pass_all -+ lt_cv_dlopen="load_add_on" -+ lt_cv_dlopen_libs= -+ lt_cv_dlopen_self=yes -+ ;; -+ - bsdi4*) - version_type=linux -- library_names_spec='${libname}.so.$major ${libname}.so' -- soname_spec='${libname}.so' -- finish_cmds='PATH="$PATH:/sbin" ldconfig $libdir' -+ need_version=no -+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -+ soname_spec='${libname}${release}.so$major' -+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH -+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' -+ file_magic_cmd=/usr/bin/file -+ file_magic_test_file=/shlib/libc.so -+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" -+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" -+ export_dynamic_flag_spec=-rdynamic -+ # the default ld.so.conf also contains /usr/contrib/lib and -+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow -+ # libtool to hard-code these into programs - ;; - --cygwin32* | mingw32*) -+cygwin* | mingw*) - version_type=windows -+ need_version=no -+ need_lib_prefix=no - if test "$with_gcc" = yes; then - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' - else - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' - fi - dynamic_linker='Win32 ld.exe' -- libname_spec='$name' -+ deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' -+ file_magic_cmd='${OBJDUMP} -f' -+ # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH -+ lt_cv_dlopen="LoadLibrary" -+ lt_cv_dlopen_libs= - ;; - --freebsd2* | freebsd3*) -+freebsd1*) -+ dynamic_linker=no -+ ;; -+ -+freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat -- library_names_spec='${libname}${release}.so$versuffix $libname.so' -- finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="$objformat" ldconfig -m $libdir' -+ case "$version_type" in -+ freebsd-elf*) -+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' -+ file_magic_cmd=/usr/bin/file -+ file_magic_test_file=`echo /usr/lib/libc.so*` -+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' -+ need_version=no -+ need_lib_prefix=no -+ ;; -+ freebsd-*) -+ deplibs_check_method=unknown -+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' -+ need_version=yes -+ ;; -+ esac - shlibpath_var=LD_LIBRARY_PATH -+ case "$host_os" in -+ freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) -+ shlibpath_overrides_runpath=yes -+ ;; -+ *) # from 3.2 on -+ shlibpath_overrides_runpath=no -+ ;; -+ esac - ;; - - gnu*) - version_type=linux -- library_names_spec='${libname}${release}.so$versuffix ${libname}.so' -+ need_lib_prefix=no -+ need_version=no -+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' -+ soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH -+ deplibs_check_method=pass_all - ;; - - hpux9* | hpux10* | hpux11*) -@@ -1625,25 +1930,52 @@ - # link against other versions. - dynamic_linker="$host_os dld.sl" - version_type=sunos -+ need_lib_prefix=no -+ need_version=no - shlibpath_var=SHLIB_PATH -+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' -+ case "$host_os" in -+ hpux10.20*) -+ # TODO: Does this work for hpux-11 too? -+ deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' -+ file_magic_cmd=/usr/bin/file -+ file_magic_test_file=/usr/lib/libc.sl -+ ;; -+ esac - ;; - --irix5*) -- version_type=osf -- soname_spec='${libname}${release}.so' -- library_names_spec='${libname}${release}.so$versuffix $libname.so' -- shlibpath_var=LD_LIBRARY_PATH -- ;; -- --irix6*) -- version_type=osf -- soname_spec='${libname}${release}.so' -- library_names_spec='${libname}${release}.so$versuffix $libname.so' -- shlibpath_var=LD_LIBRARYN32_PATH -+irix5* | irix6*) -+ version_type=irix -+ need_lib_prefix=no -+ need_version=no -+ soname_spec='${libname}${release}.so.$major' -+ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' -+ case "$host_os" in -+ irix5*) -+ libsuff= shlibsuff= -+ # this will be overridden with pass_all, but let us keep it just in case -+ deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" -+ ;; -+ *) -+ case "$LD" in # libtool.m4 will add one of these switches to LD -+ *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; -+ *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; -+ *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; -+ *) libsuff= shlibsuff= libmagic=never-match;; -+ esac -+ ;; -+ esac -+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH -+ shlibpath_overrides_runpath=no -+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" -+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" -+ file_magic_cmd=/usr/bin/file -+ file_magic_test_file=`echo /lib${libsuff}/libc.so*` -+ deplibs_check_method='pass_all' - ;; - - # No shared lib support for Linux oldld, aout, or coff. -@@ -1654,12 +1986,14 @@ - # This must be Linux ELF. - linux-gnu*) - version_type=linux -+ need_lib_prefix=no -+ need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH -- check_shared_deplibs_method='file_magic ELF 32-bit LSB shared object' -- sys_lib_search_path="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`" -+ shlibpath_overrides_runpath=no -+ deplibs_check_method=pass_all - - if test -f /lib/ld.so.1; then - dynamic_linker='GNU ld.so' -@@ -1672,26 +2006,60 @@ - fi - ;; - --netbsd* | openbsd*) -+netbsd*) -+ version_type=sunos -+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then -+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' -+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' -+ dynamic_linker='NetBSD (a.out) ld.so' -+ else -+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' -+ soname_spec='${libname}${release}.so$major' -+ dynamic_linker='NetBSD ld.elf_so' -+ fi -+ shlibpath_var=LD_LIBRARY_PATH -+ ;; -+ -+openbsd*) - version_type=sunos -- library_names_spec='${libname}${release}.so$versuffix' -+ if test "$with_gnu_ld" = yes; then -+ need_lib_prefix=no -+ need_version=no -+ fi -+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - - os2*) - libname_spec='$name' -+ need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - --osf3* | osf4*) -+osf3* | osf4* | osf5*) - version_type=osf -+ need_version=no - soname_spec='${libname}${release}.so' -- library_names_spec='${libname}${release}.so$versuffix $libname.so' -+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - shlibpath_var=LD_LIBRARY_PATH -- check_shared_deplibs_method='pass_all' -+ # this will be overridden with pass_all, but let us keep it just in case -+ deplibs_check_method='file_magic COFF format alpha shared library' -+ file_magic_cmd=/usr/bin/file -+ file_magic_test_file=/shlib/libc.so -+ deplibs_check_method='pass_all' -+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" -+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" -+ ;; -+ -+rhapsody*) -+ version_type=sunos -+ library_names_spec='${libname}.so' -+ soname_spec='${libname}.so' -+ shlibpath_var=DYLD_LIBRARY_PATH -+ deplibs_check_method=pass_all - ;; - - sco3.2v5*) -@@ -1703,11 +2071,17 @@ - - solaris*) - version_type=linux -+ need_lib_prefix=no -+ need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH -+ shlibpath_overrides_runpath=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' -+ deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" -+ file_magic_cmd=/usr/bin/file -+ file_magic_test_file=/lib/libc.so - ;; - - sunos4*) -@@ -1715,29 +2089,63 @@ - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH -+ shlibpath_overrides_runpath=yes -+ if test "$with_gnu_ld" = yes; then -+ need_lib_prefix=no -+ fi -+ need_version=yes - ;; - --sysv4.2uw2*) -+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH -+ case "$host_vendor" in -+ sequent) -+ file_magic_cmd='/bin/file' -+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' -+ ;; -+ ncr) -+ deplibs_check_method='pass_all' -+ ;; -+ motorola) -+ need_lib_prefix=no -+ need_version=no -+ shlibpath_overrides_runpath=no -+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' -+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' -+ file_magic_cmd=/usr/bin/file -+ file_magic_test_file=`echo /usr/lib/libc.so*` -+ ;; -+ esac - ;; - - uts4*) - version_type=linux -- library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' -- soname_spec='${libname}${release}.so.$major' -+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' -+ soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - - dgux*) - version_type=linux -+ need_lib_prefix=no -+ need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -+sysv4*MP*) -+ if test -d /usr/nec ;then -+ version_type=linux -+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' -+ soname_spec='$libname.so.$major' -+ shlibpath_var=LD_LIBRARY_PATH -+ fi -+ ;; -+ - *) - dynamic_linker=no - ;; -@@ -1748,19 +2156,58 @@ - # Report the final consequences. - echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 - -+# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in -+# configure.in, otherwise build static only libraries. -+case "$host_os" in -+cygwin* | mingw* | os2*) -+ if test x$can_build_shared = xyes; then -+ test x$enable_win32_dll = xno && can_build_shared=no -+ echo "checking if package supports dlls... $can_build_shared" 1>&6 -+ fi -+;; -+esac -+ -+if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then -+ case "$deplibs_check_method" in -+ "file_magic "*) -+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" -+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | -+ egrep "$file_magic_regex" > /dev/null; then -+ : -+ else -+ cat <&2 -+ -+*** Warning: the command libtool uses to detect shared libraries, -+*** $file_magic_cmd, produces output that libtool cannot recognize. -+*** The result is that libtool may fail to recognize shared libraries -+*** as such. This will affect the creation of libtool libraries that -+*** depend on shared libraries, but programs linked with such libtool -+*** libraries will work regardless of this problem. Nevertheless, you -+*** may want to report the problem to your system manager and/or to -+*** bug-libtool@gnu.org -+ -+EOF -+ fi ;; -+ esac -+fi -+ - echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case "$host_os" in --aix*) -+aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -+ -+aix4*) -+ test "$enable_shared" = yes && enable_static=no -+ ;; - esac - - echo "$ac_t$enable_shared" 1>&6 -@@ -1770,6 +2217,15 @@ - - echo "checking whether to build static libraries... $enable_static" 1>&6 - -+if test "$hardcode_action" = relink; then -+ # Fast installation is not supported -+ enable_fast_install=no -+elif test "$shlibpath_overrides_runpath" = yes || -+ test "$enable_shared" = no; then -+ # Fast installation is not necessary -+ enable_fast_install=needless -+fi -+ - echo $ac_n "checking for objdir... $ac_c" 1>&6 - rm -f .libs 2>/dev/null - mkdir .libs 2>/dev/null -@@ -1782,6 +2238,449 @@ - rmdir .libs 2>/dev/null - echo "$ac_t$objdir" 1>&6 - -+if test "x$enable_dlopen" != xyes; then -+ enable_dlopen=unknown -+ enable_dlopen_self=unknown -+ enable_dlopen_self_static=unknown -+else -+if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then -+ lt_cv_dlopen=no lt_cv_dlopen_libs= -+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -+echo "$progname:2248: checking for dlopen in -ldl" >&5 -+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` -+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ ac_save_LIBS="$LIBS" -+LIBS="-ldl $LIBS" -+cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then -+ rm -rf conftest* -+ eval "ac_cv_lib_$ac_lib_var=yes" -+else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -rf conftest* -+ eval "ac_cv_lib_$ac_lib_var=no" -+fi -+rm -f conftest* -+LIBS="$ac_save_LIBS" -+ -+fi -+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then -+ echo "$ac_t""yes" 1>&6 -+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -+else -+ echo "$ac_t""no" 1>&6 -+echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -+echo "$progname:2288: checking for dlopen" >&5 -+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ cat > conftest.$ac_ext < -+/* Override any gcc2 internal prototype to avoid an error. */ -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+char dlopen(); -+ -+int main() { -+ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_dlopen) || defined (__stub___dlopen) -+choke me -+#else -+dlopen(); -+#endif -+ -+; return 0; } -+EOF -+if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then -+ rm -rf conftest* -+ eval "ac_cv_func_dlopen=yes" -+else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -rf conftest* -+ eval "ac_cv_func_dlopen=no" -+fi -+rm -f conftest* -+fi -+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then -+ echo "$ac_t""yes" 1>&6 -+ lt_cv_dlopen="dlopen" -+else -+ echo "$ac_t""no" 1>&6 -+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 -+echo "$progname:2335: checking for dld_link in -ldld" >&5 -+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` -+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ ac_save_LIBS="$LIBS" -+LIBS="-ldld $LIBS" -+cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then -+ rm -rf conftest* -+ eval "ac_cv_lib_$ac_lib_var=yes" -+else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -rf conftest* -+ eval "ac_cv_lib_$ac_lib_var=no" -+fi -+rm -f conftest* -+LIBS="$ac_save_LIBS" -+ -+fi -+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then -+ echo "$ac_t""yes" 1>&6 -+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -+else -+ echo "$ac_t""no" 1>&6 -+echo $ac_n "checking for shl_load""... $ac_c" 1>&6 -+echo "$progname:2375: checking for shl_load" >&5 -+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ cat > conftest.$ac_ext < -+/* Override any gcc2 internal prototype to avoid an error. */ -+/* We use char because int might match the return type of a gcc2 -+ builtin and then its argument prototype would still apply. */ -+#ifdef __cplusplus -+extern "C" -+#endif -+char shl_load(); -+ -+int main() { -+ -+/* The GNU C library defines this for functions which it implements -+ to always fail with ENOSYS. Some functions are actually named -+ something starting with __ and the normal name is an alias. */ -+#if defined (__stub_shl_load) || defined (__stub___shl_load) -+choke me -+#else -+shl_load(); -+#endif -+ -+; return 0; } -+EOF -+if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then -+ rm -rf conftest* -+ eval "ac_cv_func_shl_load=yes" -+else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -rf conftest* -+ eval "ac_cv_func_shl_load=no" -+fi -+rm -f conftest* -+fi -+ -+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then -+ echo "$ac_t""yes" 1>&6 -+ lt_cv_dlopen="shl_load" -+else -+ echo "$ac_t""no" 1>&6 -+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -+echo "$progname:2423: checking for shl_load in -ldld" >&5 -+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` -+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ ac_save_LIBS="$LIBS" -+LIBS="-ldld $LIBS" -+cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then -+ rm -rf conftest* -+ eval "ac_cv_lib_$ac_lib_var=yes" -+else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -rf conftest* -+ eval "ac_cv_lib_$ac_lib_var=no" -+fi -+rm -f conftest* -+LIBS="$ac_save_LIBS" -+ -+fi -+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then -+ echo "$ac_t""yes" 1>&6 -+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -+else -+ echo "$ac_t""no" 1>&6 -+fi -+ -+ -+fi -+ -+ -+fi -+ -+ -+fi -+ -+ -+fi -+ -+fi -+ -+ if test "x$lt_cv_dlopen" != xno; then -+ enable_dlopen=yes -+ fi -+ -+ case "$lt_cv_dlopen" in -+ dlopen) -+for ac_hdr in dlfcn.h; do -+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -+echo "$progname:2488: checking for $ac_hdr" >&5 -+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ cat > conftest.$ac_ext < -+int fnord = 0; -+EOF -+ac_try="$ac_compile >/dev/null 2>conftest.out" -+{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -+if test -z "$ac_err"; then -+ rm -rf conftest* -+ eval "ac_cv_header_$ac_safe=yes" -+else -+ echo "$ac_err" >&5 -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -rf conftest* -+ eval "ac_cv_header_$ac_safe=no" -+fi -+rm -f conftest* -+fi -+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then -+ echo "$ac_t""yes" 1>&6 -+else -+ echo "$ac_t""no" 1>&6 -+fi -+done -+ -+ if test "x$ac_cv_header_dlfcn_h" = xyes; then -+ CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" -+ fi -+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" -+ LIBS="$lt_cv_dlopen_libs $LIBS" -+ -+ echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 -+echo "$progname:2526: checking whether a program can dlopen itself" >&5 -+if test "${lt_cv_dlopen_self+set}" = set; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ if test "$cross_compiling" = yes; then -+ lt_cv_dlopen_self=cross -+ else -+ cat > conftest.c < -+#endif -+ -+#include -+ -+#ifdef RTLD_GLOBAL -+# define LTDL_GLOBAL RTLD_GLOBAL -+#else -+# ifdef DL_GLOBAL -+# define LTDL_GLOBAL DL_GLOBAL -+# else -+# define LTDL_GLOBAL 0 -+# endif -+#endif -+ -+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we -+ find out it does not work in some platform. */ -+#ifndef LTDL_LAZY_OR_NOW -+# ifdef RTLD_LAZY -+# define LTDL_LAZY_OR_NOW RTLD_LAZY -+# else -+# ifdef DL_LAZY -+# define LTDL_LAZY_OR_NOW DL_LAZY -+# else -+# ifdef RTLD_NOW -+# define LTDL_LAZY_OR_NOW RTLD_NOW -+# else -+# ifdef DL_NOW -+# define LTDL_LAZY_OR_NOW DL_NOW -+# else -+# define LTDL_LAZY_OR_NOW 0 -+# endif -+# endif -+# endif -+# endif -+#endif -+ -+fnord() { int i=42;} -+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); -+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); -+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } -+ -+EOF -+if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -+then -+ lt_cv_dlopen_self=yes -+else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -fr conftest* -+ lt_cv_dlopen_self=no -+fi -+rm -fr conftest* -+fi -+ -+fi -+ -+echo "$ac_t""$lt_cv_dlopen_self" 1>&6 -+ -+ if test "$lt_cv_dlopen_self" = yes; then -+ LDFLAGS="$LDFLAGS $link_static_flag" -+ echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 -+echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 -+if test "${lt_cv_dlopen_self_static+set}" = set; then -+ echo $ac_n "(cached) $ac_c" 1>&6 -+else -+ if test "$cross_compiling" = yes; then -+ lt_cv_dlopen_self_static=cross -+ else -+ cat > conftest.c < -+#endif -+ -+#include -+ -+#ifdef RTLD_GLOBAL -+# define LTDL_GLOBAL RTLD_GLOBAL -+#else -+# ifdef DL_GLOBAL -+# define LTDL_GLOBAL DL_GLOBAL -+# else -+# define LTDL_GLOBAL 0 -+# endif -+#endif -+ -+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we -+ find out it does not work in some platform. */ -+#ifndef LTDL_LAZY_OR_NOW -+# ifdef RTLD_LAZY -+# define LTDL_LAZY_OR_NOW RTLD_LAZY -+# else -+# ifdef DL_LAZY -+# define LTDL_LAZY_OR_NOW DL_LAZY -+# else -+# ifdef RTLD_NOW -+# define LTDL_LAZY_OR_NOW RTLD_NOW -+# else -+# ifdef DL_NOW -+# define LTDL_LAZY_OR_NOW DL_NOW -+# else -+# define LTDL_LAZY_OR_NOW 0 -+# endif -+# endif -+# endif -+# endif -+#endif -+ -+fnord() { int i=42;} -+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); -+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); -+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } -+ -+EOF -+if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -+then -+ lt_cv_dlopen_self_static=yes -+else -+ echo "$progname: failed program was:" >&5 -+ cat conftest.$ac_ext >&5 -+ rm -fr conftest* -+ lt_cv_dlopen_self_static=no -+fi -+rm -fr conftest* -+fi -+ -+fi -+ -+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 -+fi -+ ;; -+ esac -+ -+ case "$lt_cv_dlopen_self" in -+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; -+ *) enable_dlopen_self=unknown ;; -+ esac -+ -+ case "$lt_cv_dlopen_self_static" in -+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; -+ *) enable_dlopen_self_static=unknown ;; -+ esac -+fi -+ - # Copy echo and quote the copy, instead of the original, because it is - # used later. - ltecho="$echo" -@@ -1790,30 +2689,36 @@ - fi - LTSHELL="$SHELL" - -+LTCONFIG_VERSION="$VERSION" -+ - # Only quote variables if we're using ltmain.sh. - case "$ltmain" in - *.sh) - # Now quote all the things that may contain metacharacters. -- for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ -- old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL VERSION \ -+ for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ -+ old_LD old_LDFLAGS old_LIBS \ -+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ -+ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ -- whole_archive_flag_spec libname_spec library_names_spec soname_spec \ -+ thread_safe_flag_spec whole_archive_flag_spec libname_spec \ -+ library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ -- old_postuninstall_cmds archive_cmds archive_sym_cmds postinstall_cmds postuninstall_cmds \ -- check_shared_deplibs_method allow_undefined_flag no_undefined_flag \ -- finish_cmds finish_eval global_symbol_pipe \ -- hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path \ -- compiler_c_o compiler_o_lo need_locks; do -+ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ -+ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ -+ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ -+ hardcode_libdir_flag_spec hardcode_libdir_separator \ -+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ -+ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do - - case "$var" in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ -- archive_cmds | archive_sym_cmds | \ -+ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - postinstall_cmds | postuninstall_cmds | \ -- finish_cmds | sys_lib_search_path) -+ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. -- eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`\\\"" -+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" -@@ -1823,8 +2728,7 @@ - - case "$ltecho" in - *'\$0 --fallback-echo"') -- ltecho=`$echo "X$ltecho" | -- $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` -+ ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -@@ -1835,11 +2739,11 @@ - #! $SHELL - - # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. --# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION) -+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) - # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. - # --# Copyright (C) 1996-1998 Free Software Foundation, Inc. --# Gordon Matzigkeit , 1996 -+# Copyright (C) 1996-1999 Free Software Foundation, Inc. -+# Originally by Gordon Matzigkeit , 1996 - # - # This program is free software; you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by -@@ -1865,7 +2769,7 @@ - - # The HP-UX ksh and POSIX shell print the target directory to stdout - # if CDPATH is set. --if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi -+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - - ### BEGIN LIBTOOL CONFIG - EOF -@@ -1874,8 +2778,9 @@ - - *) - # Double-quote the variables that need it (for aesthetics). -- for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ -- old_LN_S old_DLLTOOL old_AS; do -+ for var in old_CC old_CFLAGS old_CPPFLAGS \ -+ old_LD old_LDFLAGS old_LIBS \ -+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do - eval "$var=\\\"\$var\\\"" - done - -@@ -1886,7 +2791,7 @@ - $rm "$cfgfile" - cat < "$cfgfile" - # `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. --# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION) -+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) - EOF - ;; - esac -@@ -1895,15 +2800,16 @@ - # Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - # - # CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ --# LD=$old_LD NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ --# DLLTOOL="$old_DLLTOOL" AS="$old_AS" \\ -+# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ -+# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ -+# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ - # $0$ltconfig_args - # - # Compiler and other test output produced by $progname, useful for - # debugging $progname, is in ./config.log if it exists. - - # The version of $progname that generated this script. --LTCONFIG_VERSION=$VERSION -+LTCONFIG_VERSION=$LTCONFIG_VERSION - - # Shell to use when invoking shell scripts. - SHELL=$LTSHELL -@@ -1914,6 +2820,9 @@ - # Whether or not to build static libraries. - build_old_libs=$enable_static - -+# Whether or not to optimize for fast installation. -+fast_install=$enable_fast_install -+ - # The host system. - host_alias=$host_alias - host=$host -@@ -1936,10 +2845,13 @@ - # A BSD-compatible nm program. - NM=$NM - --# Used on cygwin32: DLL creation program. -+# Used on cygwin: DLL creation program. - DLLTOOL="$DLLTOOL" - --# Used on cygwin32: assembler. -+# Used on cygwin: object dumper. -+OBJDUMP="$OBJDUMP" -+ -+# Used on cygwin: assembler. - AS="$AS" - - # The name of the directory that contains temporary libtool files. -@@ -1958,10 +2870,13 @@ - # Old archive suffix (normally "a"). - libext="$libext" - -+# Executable file suffix (normally ""). -+exeext="$exeext" -+ - # Additional compiler flags for building library objects. - pic_flag=$pic_flag - --# Does compiler simultaneously support -c and -o options -+# Does compiler simultaneously support -c and -o options? - compiler_c_o=$compiler_c_o - - # Can we write directly to a .lo ? -@@ -1970,6 +2885,21 @@ - # Must we lock files when doing compilation ? - need_locks=$need_locks - -+# Do we need the lib prefix for modules? -+need_lib_prefix=$need_lib_prefix -+ -+# Do we need a version for libraries? -+need_version=$need_version -+ -+# Whether dlopen is supported. -+dlopen=$enable_dlopen -+ -+# Whether dlopen of programs is supported. -+dlopen_self=$enable_dlopen_self -+ -+# Whether dlopen of statically linked programs is supported. -+dlopen_self_static=$enable_dlopen_self_static -+ - # Compiler flag to prevent dynamic linking. - link_static_flag=$link_static_flag - -@@ -1982,6 +2912,9 @@ - # Compiler flag to generate shared objects directly from archives. - whole_archive_flag_spec=$whole_archive_flag_spec - -+# Compiler flag to generate thread-safe objects. -+thread_safe_flag_spec=$thread_safe_flag_spec -+ - # Library versioning type. - version_type=$version_type - -@@ -2006,12 +2939,15 @@ - - # Commands used to build and install a shared archive. - archive_cmds=$archive_cmds --archive_sym_cmds=$archive_sym_cmds -+archive_expsym_cmds=$archive_expsym_cmds - postinstall_cmds=$postinstall_cmds - postuninstall_cmds=$postuninstall_cmds - - # Method to check whether dependent libraries are shared objects. --check_shared_deplibs_method=$check_shared_deplibs_method -+deplibs_check_method=$deplibs_check_method -+ -+# Command to use when deplibs_check_method == file_magic. -+file_magic_cmd=$file_magic_cmd - - # Flag that allows shared libraries with undefined symbols to be built. - allow_undefined_flag=$allow_undefined_flag -@@ -2028,12 +2964,18 @@ - # Take the output of nm and produce a listing of raw symbols and C names. - global_symbol_pipe=$global_symbol_pipe - -+# Transform the output of nm in a proper C declaration -+global_symbol_to_cdecl=$global_symbol_to_cdecl -+ - # This is the shared library runtime path variable. - runpath_var=$runpath_var - - # This is the shared library path variable. - shlibpath_var=$shlibpath_var - -+# Is shlibpath searched before the hard-coded library search path? -+shlibpath_overrides_runpath=$shlibpath_overrides_runpath -+ - # How to hardcode a shared library path into an executable. - hardcode_action=$hardcode_action - -@@ -2056,11 +2998,27 @@ - # the resulting binary. - hardcode_shlibpath_var=$hardcode_shlibpath_var - --# System search path for libraries --sys_lib_search_path=$sys_lib_search_path -+# Compile-time system search path for libraries -+sys_lib_search_path_spec=$sys_lib_search_path_spec -+ -+# Run-time system search path for libraries -+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec - - # Fix the shell variable \$srcfile for the compiler. - fix_srcfile_path="$fix_srcfile_path" -+ -+# Set to yes if exported symbols are required. -+always_export_symbols=$always_export_symbols -+ -+# The commands to list exported symbols. -+export_symbols_cmds=$export_symbols_cmds -+ -+# Symbols that should not be listed in the preloaded symbols. -+exclude_expsyms=$exclude_expsyms -+ -+# Symbols that must always be exported. -+include_expsyms=$include_expsyms -+ - EOF - - case "$ltmain" in -@@ -2074,7 +3032,7 @@ - # 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 "${COLLECT_NAMES+set}" != set; then -+if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi -@@ -2083,7 +3041,11 @@ - esac - - # Append the ltmain.sh script. -- cat "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) -+ sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) -+ # We use sed instead of cat because bash on DJGPP gets confused if -+ # if finds mixed CR/LF and LF-only lines. Since sed operates in -+ # text mode, it properly converts lines to CR/LF. This bash problem -+ # is reportedly fixed, but why not run on old versions too? - - chmod +x "$ofile" - ;; -@@ -2093,6 +3055,58 @@ - echo "FIXME: would compile $ltmain" - ;; - esac -+ -+test -n "$cache_file" || exit 0 -+ -+# AC_CACHE_SAVE -+trap '' 1 2 15 -+cat > confcache <<\EOF -+# This file is a shell script that caches the results of configure -+# tests run on this system so they can be shared between configure -+# scripts and configure runs. It is not useful on other systems. -+# If it contains results you don't want to keep, you may remove or edit it. -+# -+# By default, configure uses ./config.cache as the cache file, -+# creating it if it does not exist already. You can give configure -+# the --cache-file=FILE option to use a different cache file; that is -+# what configure does when it calls configure scripts in -+# subdirectories, so they share the cache. -+# Giving --cache-file=/dev/null disables caching, for debugging configure. -+# config.status only pays attention to the cache file if you give it the -+# --recheck option to rerun configure. -+# -+EOF -+# The following way of writing the cache mishandles newlines in values, -+# but we know of no workaround that is simple, portable, and efficient. -+# So, don't put newlines in cache variables' values. -+# Ultrix sh set writes to stderr and can't be redirected directly, -+# and sets the high bit in the cache file unless we assign to the vars. -+(set) 2>&1 | -+ case `(ac_space=' '; set | grep ac_space) 2>&1` in -+ *ac_space=\ *) -+ # `set' does not quote correctly, so add quotes (double-quote substitution -+ # turns \\\\ into \\, and sed turns \\ into \). -+ sed -n \ -+ -e "s/'/'\\\\''/g" \ -+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" -+ ;; -+ *) -+ # `set' quotes correctly as required by POSIX, so do not add quotes. -+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' -+ ;; -+ esac >> confcache -+if cmp -s $cache_file confcache; then -+ : -+else -+ if test -w $cache_file; then -+ echo "updating cache $cache_file" -+ cat confcache > $cache_file -+ else -+ echo "not updating unwritable cache $cache_file" -+ fi -+fi -+rm -f confcache -+ - exit 0 - - # Local Variables: ---- gsmlib-1.10.orig/scripts/config.guess -+++ gsmlib-1.10/scripts/config.guess -@@ -1,9 +1,10 @@ - #! /bin/sh - # Attempt to guess a canonical system name. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 - # Free Software Foundation, Inc. - --timestamp='2001-09-04' -+timestamp='2008-01-23' - - # 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 -@@ -17,15 +18,18 @@ - # - # 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. -+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -+# 02110-1301, USA. - # - # As a special exception to the GNU General Public License, if you - # distribute this file as part of a program that contains a - # configuration script generated by Autoconf, you may include it under - # the same distribution terms that you use for the rest of that program. - --# Written by Per Bothner . --# Please send patches to . -+ -+# 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 -@@ -52,8 +56,8 @@ - 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. -+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -+2002, 2003, 2004, 2005, 2006, 2007, 2008 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." -@@ -65,11 +69,11 @@ - while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) -- echo "$timestamp" ; exit 0 ;; -+ echo "$timestamp" ; exit ;; - --version | -v ) -- echo "$version" ; exit 0 ;; -+ echo "$version" ; exit ;; - --help | --h* | -h ) -- echo "$usage"; exit 0 ;; -+ echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. -@@ -87,30 +91,42 @@ - exit 1 - fi - -+trap 'exit 1' 1 2 15 - --dummy=dummy-$$ --trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; 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. - --# CC_FOR_BUILD -- compiler used by this script. - # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still - # use `HOST_CC' if defined, but it is deprecated. - --set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in -- ,,) echo "int dummy(){}" > $dummy.c ; -- for c in cc gcc c89 ; do -- ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; -- if test $? = 0 ; then -+# 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 "$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 ; -- rm -f $dummy.c $dummy.o $dummy.rel ; - 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' -+esac ; set_cc_for_build= ;' - - # This is needed to find uname on a Pyramid OSx when run in the BSD universe. - # (ghazi@noc.rutgers.edu 1994-08-24) -@@ -127,29 +143,31 @@ - - case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) -- # Netbsd (nbsd) targets should (where applicable) match one or -+ # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. -- # Determine the machine/vendor (is the vendor relevant). -- case "${UNAME_MACHINE}" in -- amiga) machine=m68k-unknown ;; -- arm32) machine=arm-unknown ;; -- atari*) machine=m68k-atari ;; -- sun3*) machine=m68k-sun ;; -- mac68k) machine=m68k-apple ;; -- macppc) machine=powerpc-apple ;; -- hp3[0-9][05]) machine=m68k-hp ;; -- ibmrt|romp-ibm) machine=romp-ibm ;; -- *) machine=${UNAME_MACHINE}-unknown ;; -+ # -+ # 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 ;; -+ sh5el) machine=sh5le-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}" in -- i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) -+ 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 -@@ -166,120 +184,128 @@ - ;; - esac - # The OS release -- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` -+ # 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 ;; -+ exit ;; -+ *:OpenBSD:*:*) -+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` -+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} -+ exit ;; -+ *:ekkoBSD:*:*) -+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} -+ exit ;; -+ *:SolidBSD:*:*) -+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} -+ exit ;; -+ macppc:MirBSD:*:*) -+ echo powerpc-unknown-mirbsd${UNAME_RELEASE} -+ exit ;; -+ *:MirBSD:*:*) -+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} -+ exit ;; - alpha:OSF1:*:*) -- if test $UNAME_RELEASE = "V4.0"; then -+ case $UNAME_RELEASE in -+ *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` -- fi -+ ;; -+ *5.*) -+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` -+ ;; -+ esac -+ # 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 Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. -- cat <$dummy.s -- .data --\$Lformat: -- .byte 37,100,45,37,120,10,0 # "%d-%x\n" -- -- .text -- .globl main -- .align 4 -- .ent main --main: -- .frame \$30,16,\$26,0 -- ldgp \$29,0(\$27) -- .prologue 1 -- .long 0x47e03d80 # implver \$0 -- lda \$2,-1 -- .long 0x47e20c21 # amask \$2,\$1 -- lda \$16,\$Lformat -- mov \$0,\$17 -- not \$1,\$18 -- jsr \$26,printf -- ldgp \$29,0(\$26) -- mov 0,\$16 -- jsr \$26,exit -- .end main --EOF -- eval $set_cc_for_build -- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null -- if test "$?" = 0 ; then -- case `./$dummy` in -- 0-0) -- UNAME_MACHINE="alpha" -- ;; -- 1-0) -- UNAME_MACHINE="alphaev5" -- ;; -- 1-1) -- UNAME_MACHINE="alphaev56" -- ;; -- 1-101) -- UNAME_MACHINE="alphapca56" -- ;; -- 2-303) -- UNAME_MACHINE="alphaev6" -- ;; -- 2-307) -- UNAME_MACHINE="alphaev67" -- ;; -- 2-1307) -- UNAME_MACHINE="alphaev68" -- ;; -- esac -- fi -- rm -f $dummy.s $dummy -- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` -- exit 0 ;; -+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` -+ exit ;; - 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 ;; -+ exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 -- exit 0 ;; -+ exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 -- exit 0;; -- amiga:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos -- exit 0 ;; -- arc64:OpenBSD:*:*) -- echo mips64el-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- arc:OpenBSD:*:*) -- echo mipsel-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- hkmips:OpenBSD:*:*) -- echo mips-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- pmax:OpenBSD:*:*) -- echo mipsel-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- sgi:OpenBSD:*:*) -- echo mips-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- wgrisc:OpenBSD:*:*) -- echo mipsel-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ *:[Mm]orph[Oo][Ss]:*:*) -+ echo ${UNAME_MACHINE}-unknown-morphos -+ exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition -- exit 0 ;; -+ exit ;; -+ *:z/VM:*:*) -+ echo s390-ibm-zvmoe -+ exit ;; -+ *:OS400:*:*) -+ echo powerpc-ibm-os400 -+ exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} -- exit 0;; -+ exit ;; -+ arm:riscos:*:*|arm:RISCOS:*:*) -+ echo arm-unknown-riscos -+ exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp -- exit 0;; -+ exit ;; - 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 -@@ -287,25 +313,32 @@ - else - echo pyramid-pyramid-bsd - fi -- exit 0 ;; -+ exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 -- exit 0 ;; -+ exit ;; -+ DRS?6000:unix:4.0:6*) -+ echo sparc-icl-nx6 -+ exit ;; -+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) -+ case `/usr/bin/uname -p` in -+ sparc) echo sparc-icl-nx7; exit ;; -+ esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -- i86pc:SunOS:5.*:*) -+ exit ;; -+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - 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 ;; -+ exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) -@@ -314,12 +347,12 @@ - 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 ;; -+ exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - sun*:*:4.2BSD:*) -- UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` -+ 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) -@@ -329,16 +362,10 @@ - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac -- exit 0 ;; -+ exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} -- exit 0 ;; -- sparc*:NetBSD:*) -- echo `uname -p`-unknown-netbsd${UNAME_RELEASE} -- exit 0 ;; -- atari*:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - # 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 -@@ -349,49 +376,40 @@ - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} -- exit 0 ;; -- sun3*:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mac68k:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvme68k:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvme88k:OpenBSD:*:*) -- echo m88k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ m68k:machten:*:*) -+ echo m68k-apple-machten${UNAME_RELEASE} -+ exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 -- exit 0 ;; -+ exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -@@ -415,27 +433,33 @@ - exit (-1); - } - EOF -- $CC_FOR_BUILD $dummy.c -o $dummy \ -- && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ -- && rm -f $dummy.c $dummy && exit 0 -- rm -f $dummy.c $dummy -+ $CC_FOR_BUILD -o $dummy $dummy.c && -+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && -+ SYSTEM_NAME=`$dummy $dummyarg` && -+ { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax -- exit 0 ;; -+ exit ;; -+ Motorola:*:4.3:PL8-*) -+ echo powerpc-harris-powermax -+ exit ;; -+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) -+ echo powerpc-harris-powermax -+ exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix -- exit 0 ;; -+ exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 -- exit 0 ;; -+ exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 -- exit 0 ;; -+ exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 -- exit 0 ;; -+ exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` -@@ -451,29 +475,29 @@ - else - echo i586-dg-dgux${UNAME_RELEASE} - fi -- exit 0 ;; -+ exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 -- exit 0 ;; -+ exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 -- exit 0 ;; -+ exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 -- exit 0 ;; -+ exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd -- exit 0 ;; -+ exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` -- exit 0 ;; -+ exit ;; - ????????: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 ' -+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id -+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix -- exit 0 ;; -+ exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` -@@ -481,7 +505,7 @@ - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} -- exit 0 ;; -+ exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build -@@ -496,17 +520,20 @@ - exit(0); - } - EOF -- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 -- rm -f $dummy.c $dummy -- echo rs6000-ibm-aix3.2.5 -+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` -+ then -+ echo "$SYSTEM_NAME" -+ else -+ echo rs6000-ibm-aix3.2.5 -+ fi - 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 | head -1 | awk '{ print $1 }'` -+ exit ;; -+ *:AIX:*:[456]) -+ 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 -@@ -518,38 +545,36 @@ - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} -- exit 0 ;; -+ exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix -- exit 0 ;; -+ exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 -- exit 0 ;; -+ exit ;; - 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 -+ exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx -- exit 0 ;; -+ exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 -- exit 0 ;; -+ exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd -- exit 0 ;; -+ exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 -- exit 0 ;; -+ exit ;; - 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]) -- case "${HPUX_REV}" in -- 11.[0-9][0-9]) -- if [ -x /usr/bin/getconf ]; then -- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` -+ 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 -@@ -558,13 +583,13 @@ - 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 ;; -- esac -- if [ "${HP_ARCH}" = "" ]; then -- eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -+ fi -+ if [ "${HP_ARCH}" = "" ]; then -+ eval $set_cc_for_build -+ sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include -@@ -597,17 +622,37 @@ - exit (0); - } - EOF -- (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` -- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi -- rm -f $dummy.c $dummy -- fi ;; -+ (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 -+ eval $set_cc_for_build -+ -+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating -+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler -+ # generating 64-bit code. GNU and HP use different nomenclature: -+ # -+ # $ CC_FOR_BUILD=cc ./config.guess -+ # => hppa2.0w-hp-hpux11.23 -+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess -+ # => hppa64-hp-hpux11.23 -+ -+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | -+ grep __LP64__ >/dev/null -+ then -+ HP_ARCH="hppa2.0w" -+ else -+ HP_ARCH="hppa64" -+ fi -+ fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} -- exit 0 ;; -+ exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} -- exit 0 ;; -+ exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -@@ -635,158 +680,247 @@ - exit (0); - } - EOF -- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 -- rm -f $dummy.c $dummy -+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && -+ { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 -- exit 0 ;; -+ exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd -- exit 0 ;; -+ exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd -- exit 0 ;; -+ exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix -- exit 0 ;; -+ exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf -- exit 0 ;; -+ exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf -- exit 0 ;; -+ exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi -- exit 0 ;; -+ exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites -- exit 0 ;; -- hppa*:OpenBSD:*:*) -- echo hppa-unknown-openbsd -- exit 0 ;; -+ exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd -- exit 0 ;; -+ exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi -- exit 0 ;; -+ exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd -- exit 0 ;; -+ exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd -- exit 0 ;; -+ exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd -- exit 0 ;; -- CRAY*X-MP:*:*:*) -- echo xmp-cray-unicos -- exit 0 ;; -+ exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - 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 ;; -+ exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -- CRAY*T3D:*:*:*) -- echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -- CRAY-2:*:*:*) -- echo cray2-cray-unicos -- exit 0 ;; -+ exit ;; -+ *:UNICOS/mp:*:*) -+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -+ exit ;; - 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 ;; -- hp300:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ 5000:UNIX_System_V:4.*:*) -+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` -+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -+ exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:FreeBSD:*:*) -- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` -- exit 0 ;; -- *:OpenBSD:*:*) -- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` -- exit 0 ;; -+ case ${UNAME_MACHINE} in -+ pc98) -+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ amd64) -+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ *) -+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ esac -+ exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin -- exit 0 ;; -- i*:MINGW*:*) -+ exit ;; -+ *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 -- exit 0 ;; -+ exit ;; -+ i*:windows32*:*) -+ # uname -m includes "-pc" on this system. -+ echo ${UNAME_MACHINE}-mingw32 -+ exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 -- exit 0 ;; -+ exit ;; -+ *:Interix*:[3456]*) -+ case ${UNAME_MACHINE} in -+ x86) -+ echo i586-pc-interix${UNAME_RELEASE} -+ exit ;; -+ EM64T | authenticamd) -+ echo x86_64-unknown-interix${UNAME_RELEASE} -+ exit ;; -+ IA64) -+ echo ia64-unknown-interix${UNAME_RELEASE} -+ exit ;; -+ esac ;; -+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) -+ echo i${UNAME_MACHINE}-pc-mks -+ exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? -- echo i386-pc-interix -- exit 0 ;; -+ echo i586-pc-interix -+ exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin -- exit 0 ;; -+ exit ;; -+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) -+ echo x86_64-unknown-cygwin -+ exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin -- exit 0 ;; -+ exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - *:GNU:*:*) -+ # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` -- exit 0 ;; -+ exit ;; -+ *:GNU/*:*:*) -+ # other systems with GNU libc and userland -+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu -+ exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix -- exit 0 ;; -+ exit ;; - arm*:Linux:*:*) -+ eval $set_cc_for_build -+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ -+ | grep -q __ARM_EABI__ -+ then -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ else -+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi -+ fi -+ exit ;; -+ avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ exit ;; -+ cris:Linux:*:*) -+ echo cris-axis-linux-gnu -+ exit ;; -+ crisv32:Linux:*:*) -+ echo crisv32-axis-linux-gnu -+ exit ;; -+ frv:Linux:*:*) -+ echo frv-unknown-linux-gnu -+ exit ;; - ia64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ m32r*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ exit ;; - mips:Linux:*:*) -- case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in -- big) echo mips-unknown-linux-gnu && exit 0 ;; -- little) echo mipsel-unknown-linux-gnu && exit 0 ;; -- esac -+ 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 | sed -n ' -+ /^CPU/{ -+ s: ::g -+ p -+ }'`" -+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; -+ 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 | sed -n ' -+ /^CPU/{ -+ s: ::g -+ p -+ }'`" -+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } -+ ;; -+ or32:Linux:*:*) -+ echo or32-unknown-linux-gnu -+ exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu -- exit 0 ;; -+ exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu -- exit 0 ;; -+ exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; -@@ -800,7 +934,7 @@ - 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 ;; -+ exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in -@@ -808,27 +942,37 @@ - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac -- exit 0 ;; -+ exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu -- exit 0 ;; -+ exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux -- exit 0 ;; -+ exit ;; -+ sh64*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ exit ;; -+ vax:Linux:*:*) -+ echo ${UNAME_MACHINE}-dec-linux-gnu -+ exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu -- exit 0 ;; -+ exit ;; -+ xtensa*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; - 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. -- ld_supported_targets=`cd /; ld --help 2>&1 \ -+ # 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: *// -@@ -840,52 +984,58 @@ - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" -- exit 0 ;; -+ exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" -- exit 0 ;; -+ exit ;; - "") - # 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 ;; -+ exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build -- cat >$dummy.c < --#ifdef __cplusplus --#include /* for printf() prototype */ -- int main (int argc, char *argv[]) { --#else -- int main (argc, argv) int argc; char *argv[]; { --#endif --#ifdef __ELF__ --# ifdef __GLIBC__ --# if __GLIBC__ >= 2 -- printf ("%s-pc-linux-gnu\n", argv[1]); --# else -- printf ("%s-pc-linux-gnulibc1\n", argv[1]); --# endif --# else -- printf ("%s-pc-linux-gnulibc1\n", argv[1]); --# endif --#else -- printf ("%s-pc-linux-gnuaout\n", argv[1]); --#endif -- return 0; --} -+ sed 's/^ //' << EOF >$dummy.c -+ #include -+ #ifdef __ELF__ -+ # ifdef __GLIBC__ -+ # if __GLIBC__ >= 2 -+ LIBC=gnu -+ # else -+ LIBC=gnulibc1 -+ # endif -+ # else -+ LIBC=gnulibc1 -+ # endif -+ #else -+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) -+ LIBC=gnu -+ #else -+ LIBC=gnuaout -+ #endif -+ #endif -+ #ifdef __dietlibc__ -+ LIBC=dietlibc -+ #endif - EOF -- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 -- rm -f $dummy.c $dummy -- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 -+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' -+ /^LIBC/{ -+ s: ::g -+ p -+ }'`" -+ test x"${LIBC}" != x && { -+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}" -+ exit -+ } -+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - 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 ;; -+ exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... -@@ -893,7 +1043,27 @@ - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} -- exit 0 ;; -+ exit ;; -+ 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 ;; -+ i*86:XTS-300:*:STOP) -+ echo ${UNAME_MACHINE}-unknown-stop -+ exit ;; -+ i*86:atheos:*:*) -+ echo ${UNAME_MACHINE}-unknown-atheos -+ exit ;; -+ i*86:syllable:*:*) -+ echo ${UNAME_MACHINE}-pc-syllable -+ exit ;; -+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) -+ echo i386-unknown-lynxos${UNAME_RELEASE} -+ exit ;; -+ i*86:*DOS:*:*) -+ echo ${UNAME_MACHINE}-pc-msdosdjgpp -+ exit ;; - 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 -@@ -901,99 +1071,100 @@ - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi -- exit 0 ;; -- i*86:*:5:[78]*) -+ exit ;; -+ i*86:*:5:[678]*) -+ # UnixWare 7.x, OpenUNIX and OpenServer 6. - 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 ;; -+ exit ;; - 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|egrep Release|sed -e 's/.*= //')` -- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 -- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ -+ 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|egrep '^Machine.*Pent ?II' >/dev/null) \ -+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 -- (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ -+ (/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 ;; -- i*86:*DOS:*:*) -- echo ${UNAME_MACHINE}-pc-msdosdjgpp -- exit 0 ;; -+ exit ;; - 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 ;; -+ exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 -- exit 0 ;; -+ exit ;; - paragon:*:*:*) - echo i860-intel-osf1 -- exit 0 ;; -+ exit ;; - 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 ;; -+ exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv -- exit 0 ;; -- M68*:*:R3V[567]*:*) -- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; -- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) -+ exit ;; -+ mc68k:UNIX:SYSTEM5:3.51m) -+ echo m68k-convergent-sysv -+ exit ;; -+ M680?0:D-NIX:5.3:*) -+ echo m68k-diab-dnix -+ exit ;; -+ M68*:*:R3V[5678]*:*) -+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; -+ 3[345]??:*: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 | S7501*:*: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 -+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ -- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; -+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -- && echo i486-ncr-sysv4 && exit 0 ;; -+ && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 -- exit 0 ;; -- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) -- echo i386-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 -- exit 0 ;; -+ exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 -- exit 0 ;; -+ exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` -@@ -1001,82 +1172,107 @@ - else - echo ns32k-sni-sysv - fi -- exit 0 ;; -+ exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 -- exit 0 ;; -+ exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 -- exit 0 ;; -+ exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 -- exit 0 ;; -+ exit ;; -+ i*86:VOS:*:*) -+ # From Paul.Green@stratus.com. -+ echo ${UNAME_MACHINE}-stratus-vos -+ exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos -- exit 0 ;; -+ exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 -- exit 0 ;; -+ exit ;; - 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 ;; -+ exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos -- exit 0 ;; -+ exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos -- exit 0 ;; -+ exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos -- exit 0 ;; -+ exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ SX-6:SUPER-UX:*:*) -+ echo sx6-nec-superux${UNAME_RELEASE} -+ exit ;; -+ SX-7:SUPER-UX:*:*) -+ echo sx7-nec-superux${UNAME_RELEASE} -+ exit ;; -+ SX-8:SUPER-UX:*:*) -+ echo sx8-nec-superux${UNAME_RELEASE} -+ exit ;; -+ SX-8R:SUPER-UX:*:*) -+ echo sx8r-nec-superux${UNAME_RELEASE} -+ exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Darwin:*:*) -- echo `uname -p`-apple-darwin${UNAME_RELEASE} -- exit 0 ;; -+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown -+ case $UNAME_PROCESSOR in -+ unknown) UNAME_PROCESSOR=powerpc ;; -+ esac -+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} -+ exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) -- if test "${UNAME_MACHINE}" = "x86pc"; then -+ UNAME_PROCESSOR=`uname -p` -+ if test "$UNAME_PROCESSOR" = "x86"; then -+ UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi -- echo `uname -p`-${UNAME_MACHINE}-nto-qnx -- exit 0 ;; -+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} -+ exit ;; - *:QNX:*:4*) - echo i386-pc-qnx -- exit 0 ;; -- NSR-[KW]:NONSTOP_KERNEL:*:*) -+ exit ;; -+ NSE-?:NONSTOP_KERNEL:*:*) -+ echo nse-tandem-nsk${UNAME_RELEASE} -+ exit ;; -+ NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux -- exit 0 ;; -+ exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv -- exit 0 ;; -+ exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 -@@ -1087,36 +1283,47 @@ - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 -- 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 ;; -+ exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 -- exit 0 ;; -+ exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex -- exit 0 ;; -+ exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 -- exit 0 ;; -+ exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 -- exit 0 ;; -+ exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 -- exit 0 ;; -+ exit ;; - *:ITS:*:*) - echo pdp10-unknown-its -- exit 0 ;; -- i*86:XTS-300:*:STOP) -- echo ${UNAME_MACHINE}-unknown-stop -- exit 0 ;; -- i*86:atheos:*:*) -- echo ${UNAME_MACHINE}-unknown-atheos -- exit 0 ;; -+ exit ;; -+ SEI:*:*:SEIUX) -+ echo mips-sei-seiux${UNAME_RELEASE} -+ exit ;; -+ *:DragonFly:*:*) -+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` -+ exit ;; -+ *:*VMS:*:*) -+ UNAME_MACHINE=`(uname -p) 2>/dev/null` -+ case "${UNAME_MACHINE}" in -+ A*) echo alpha-dec-vms ; exit ;; -+ I*) echo ia64-dec-vms ; exit ;; -+ V*) echo vax-dec-vms ; exit ;; -+ esac ;; -+ *:XENIX:*:SysV) -+ echo i386-pc-xenix -+ exit ;; -+ i*86:skyos:*:*) -+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' -+ exit ;; -+ i*86:rdos:*:*) -+ echo ${UNAME_MACHINE}-pc-rdos -+ exit ;; - esac - - #echo '(No uname command or uname output not recognized.)' 1>&2 -@@ -1148,7 +1355,7 @@ - #endif - - #if defined (__arm) && defined (__acorn) && defined (__unix) -- printf ("arm-acorn-riscix"); exit (0); -+ printf ("arm-acorn-riscix\n"); exit (0); - #endif - - #if defined (hp300) && !defined (hpux) -@@ -1237,12 +1444,12 @@ - } - EOF - --$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 --rm -f $dummy.c $dummy -+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && -+ { echo "$SYSTEM_NAME"; exit; } - - # Apollos put the system type in the environment. - --test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } -+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - - # Convex versions that predate uname can use getsysinfo(1) - -@@ -1251,22 +1458,22 @@ - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd -- exit 0 ;; -+ exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi -- exit 0 ;; -+ exit ;; - c34*) - echo c34-convex-bsd -- exit 0 ;; -+ exit ;; - c38*) - echo c38-convex-bsd -- exit 0 ;; -+ exit ;; - c4*) - echo c4-convex-bsd -- exit 0 ;; -+ exit ;; - esac - fi - -@@ -1277,7 +1484,9 @@ - the operating system you are using. It is advised that you - download the most up to date version of the config scripts from - -- ftp://ftp.gnu.org/pub/gnu/config/ -+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -+and -+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - - If the version you run ($0) is already up to date, please - send the following data and any information you think might be ---- gsmlib-1.10.orig/scripts/ltmain.sh -+++ gsmlib-1.10/scripts/ltmain.sh -@@ -1,7 +1,7 @@ - # ltmain.sh - Provide generalized library-building support services. - # NOTE: Changing this file will not affect anything until you rerun configure. - # --# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 - # Free Software Foundation, Inc. - # Originally by Gordon Matzigkeit , 1996 - # -@@ -17,13 +17,41 @@ - # - # 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. -+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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. - -+basename="s,^.*/,,g" -+ -+# 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" -+ -+# The name of this program: -+progname=`echo "$progpath" | $SED $basename` -+modename="$progname" -+ -+# Global variables: -+EXIT_SUCCESS=0 -+EXIT_FAILURE=1 -+ -+PROGRAM=ltmain.sh -+PACKAGE=libtool -+VERSION="1.5.20 Debian 1.5.20-2" -+TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)" -+ -+# 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 -+ - # Check that we have a working $echo. - if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. -@@ -36,7 +64,7 @@ - : - else - # Restart under the correct shell, and then maybe $echo will work. -- exec $SHELL "$0" --no-reexec ${1+"$@"} -+ exec $SHELL "$progpath" --no-reexec ${1+"$@"} - fi - - if test "X$1" = X--fallback-echo; then -@@ -45,19 +73,9 @@ - cat <&2 -- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 -- exit 1 -+ $echo "$modename: not configured to build any kind of library" 1>&2 -+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 -+ exit $EXIT_FAILURE - fi - - # Global variables. -@@ -105,8 +135,225 @@ - lo2o="s/\\.lo\$/.${objext}/" - o2lo="s/\\.${objext}\$/.lo/" - -+##################################### -+# Shell function definitions: -+# This seems to be the best place for them -+ -+# 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. -+func_win32_libid () -+{ -+ 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 -+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ -+ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then -+ win32_nmres=`eval $NM -f posix -A $1 | \ -+ sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` -+ if test "X$win32_nmres" = "Ximport" ; then -+ win32_libid_type="x86 archive import" -+ else -+ win32_libid_type="x86 archive static" -+ fi -+ 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_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 () -+{ -+ if test -n "$available_tags" && test -z "$tagname"; then -+ CC_quoted= -+ for arg in $CC; do -+ case $arg in -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -+ arg="\"$arg\"" -+ ;; -+ esac -+ CC_quoted="$CC_quoted $arg" -+ done -+ 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 "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; -+ # 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. -+ case $arg in -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -+ arg="\"$arg\"" -+ ;; -+ esac -+ CC_quoted="$CC_quoted $arg" -+ done -+ case "$@ " in -+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) -+ # 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 -+ 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 -+ $echo "$modename: unable to infer tagged configuration" -+ $echo "$modename: specify a tag with \`--tag'" 1>&2 -+ exit $EXIT_FAILURE -+# else -+# $echo "$modename: using $tagname tagged configuration" -+ fi -+ ;; -+ esac -+ fi -+} -+ -+ -+# func_extract_an_archive dir oldlib -+func_extract_an_archive () -+{ -+ f_ex_an_ar_dir="$1"; shift -+ f_ex_an_ar_oldlib="$1" -+ -+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" -+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? -+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then -+ : -+ else -+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 -+ exit $EXIT_FAILURE -+ fi -+} -+ -+# func_extract_archives gentop oldlib ... -+func_extract_archives () -+{ -+ my_gentop="$1"; shift -+ my_oldlibs=${1+"$@"} -+ my_oldobjs="" -+ my_xlib="" -+ my_xabs="" -+ my_xdir="" -+ my_status="" -+ -+ $show "${rm}r $my_gentop" -+ $run ${rm}r "$my_gentop" -+ $show "$mkdir $my_gentop" -+ $run $mkdir "$my_gentop" -+ my_status=$? -+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then -+ exit $my_status -+ fi -+ -+ 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 -+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` -+ my_xdir="$my_gentop/$my_xlib" -+ -+ $show "${rm}r $my_xdir" -+ $run ${rm}r "$my_xdir" -+ $show "$mkdir $my_xdir" -+ $run $mkdir "$my_xdir" -+ status=$? -+ if test "$status" -ne 0 && test ! -d "$my_xdir"; then -+ exit $status -+ fi -+ case $host in -+ *-darwin*) -+ $show "Extracting $my_xabs" -+ # Do not bother doing anything if just a dry run -+ if test -z "$run"; then -+ darwin_orig_dir=`pwd` -+ cd $my_xdir || exit $? -+ darwin_archive=$my_xabs -+ darwin_curdir=`pwd` -+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` -+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` -+ if test -n "$darwin_arches"; then -+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` -+ darwin_arch= -+ $show "$darwin_base_archive has multiple architectures $darwin_arches" -+ for darwin_arch in $darwin_arches ; do -+ 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 have a bunch of thin objects, gotta fatten them up :) -+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` -+ darwin_file= -+ darwin_files= -+ for darwin_file in $darwin_filelist; do -+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` -+ lipo -create -output "$darwin_file" $darwin_files -+ done # $darwin_filelist -+ ${rm}r unfat-$$ -+ cd "$darwin_orig_dir" -+ else -+ cd "$darwin_orig_dir" -+ func_extract_an_archive "$my_xdir" "$my_xabs" -+ fi # $darwin_arches -+ fi # $run -+ ;; -+ *) -+ func_extract_an_archive "$my_xdir" "$my_xabs" -+ ;; -+ esac -+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` -+ done -+ func_extract_archives_result="$my_oldobjs" -+} -+# End of Shell function definitions -+##################################### -+ -+# Darwin sucks -+eval std_shrext=\"$shrext_cmds\" -+ - # Parse our command line options once, thoroughly. --while test $# -gt 0 -+while test "$#" -gt 0 - do - arg="$1" - shift -@@ -122,6 +369,34 @@ - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; -+ tag) -+ tagname="$arg" -+ preserve_args="${preserve_args}=$arg" -+ -+ # Check whether tagname contains only valid characters -+ case $tagname in -+ *[!-_A-Za-z0-9,/]*) -+ $echo "$progname: invalid tag name: $tagname" 1>&2 -+ exit $EXIT_FAILURE -+ ;; -+ esac -+ -+ case $tagname in -+ CC) -+ # Don't test for the "default" C tag, as we know, it's there, but -+ # not specially marked. -+ ;; -+ *) -+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then -+ taglist="$taglist $tagname" -+ # Evaluate the configuration. -+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" -+ else -+ $echo "$progname: ignoring unknown tag $tagname" 1>&2 -+ fi -+ ;; -+ esac -+ ;; - *) - eval "$prev=\$arg" - ;; -@@ -139,18 +414,27 @@ - ;; - - --version) -- echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" -- exit 0 -+ $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" -+ $echo -+ $echo "Copyright (C) 2005 Free Software Foundation, Inc." -+ $echo "This is free software; see the source for copying conditions. There is NO" -+ $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -+ exit $? - ;; - - --config) -- sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 -- exit 0 -+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath -+ # Now print the configurations for the tags. -+ for tagname in $taglist; do -+ ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" -+ done -+ exit $? - ;; - - --debug) -- echo "$progname: enabling shell trace mode" -+ $echo "$progname: enabling shell trace mode" - set -x -+ preserve_args="$preserve_args $arg" - ;; - - --dry-run | -n) -@@ -158,18 +442,18 @@ - ;; - - --features) -- echo "host: $host" -+ $echo "host: $host" - if test "$build_libtool_libs" = yes; then -- echo "enable shared libraries" -+ $echo "enable shared libraries" - else -- echo "disable shared libraries" -+ $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then -- echo "enable static libraries" -+ $echo "enable static libraries" - else -- echo "disable static libraries" -+ $echo "disable static libraries" - fi -- exit 0 -+ exit $? - ;; - - --finish) mode="finish" ;; -@@ -181,6 +465,15 @@ - - --quiet | --silent) - show=: -+ preserve_args="$preserve_args $arg" -+ ;; -+ -+ --tag) prevopt="--tag" prev=tag ;; -+ --tag=*) -+ set tag "$optarg" ${1+"$@"} -+ shift -+ prev=tag -+ preserve_args="$preserve_args --tag" - ;; - - -dlopen) -@@ -191,7 +484,7 @@ - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - - *) -@@ -204,7 +497,7 @@ - if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # If this variable is set in any of the actions, the command in it -@@ -216,8 +509,10 @@ - - # Infer the operation mode. - if test -z "$mode"; then -+ $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 -+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 - case $nonopt in -- *cc | *++ | gcc* | *-gcc*) -+ *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do -@@ -258,7 +553,7 @@ - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. -@@ -272,158 +567,127 @@ - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= -- prev= -- lastarg= -- srcfile="$nonopt" -+ srcfile="$nonopt" # always keep a non-empty value in "srcfile" -+ suppress_opt=yes - suppress_output= -+ arg_mode=normal -+ libobj= -+ later= - -- user_target=no - for arg - do -- case $prev in -- "") ;; -- xcompiler) -- # Aesthetically quote the previous argument. -- prev= -- lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` -- -- case $arg in -- # Double-quote args containing other shell metacharacters. -- # Many Bourne shells cannot handle close brackets correctly -- # in scan sets, so we specify it separately. -- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -- arg="\"$arg\"" -- ;; -- esac -- -- # Add the previous argument to base_compile. -- if test -z "$base_compile"; then -- base_compile="$lastarg" -- else -- base_compile="$base_compile $lastarg" -- fi -- continue -+ case $arg_mode in -+ arg ) -+ # do not "continue". Instead, add this to base_compile -+ lastarg="$arg" -+ arg_mode=normal - ;; -- esac - -- # Accept any command-line options. -- case $arg in -- -o) -- if test "$user_target" != "no"; then -- $echo "$modename: you cannot specify \`-o' more than once" 1>&2 -- exit 1 -- fi -- user_target=next -- ;; -- -- -static) -- build_old_libs=yes -+ target ) -+ libobj="$arg" -+ arg_mode=normal - continue - ;; - -- -prefer-pic) -- pic_mode=yes -- continue -- ;; -+ normal ) -+ # Accept any command-line options. -+ case $arg in -+ -o) -+ if test -n "$libobj" ; then -+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2 -+ exit $EXIT_FAILURE -+ fi -+ arg_mode=target -+ continue -+ ;; - -- -prefer-non-pic) -- pic_mode=no -- continue -- ;; -+ -static | -prefer-pic | -prefer-non-pic) -+ later="$later $arg" -+ continue -+ ;; - -- -Xcompiler) -- prev=xcompiler -- continue -- ;; -+ -no-suppress) -+ suppress_opt=no -+ continue -+ ;; - -- -Wc,*) -- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` -- lastarg= -- save_ifs="$IFS"; IFS=',' -- for arg in $args; do -- IFS="$save_ifs" -+ -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,*) -+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` -+ lastarg= -+ save_ifs="$IFS"; IFS=',' -+ for arg in $args; do -+ IFS="$save_ifs" - -- # Double-quote args containing other shell metacharacters. -- # Many Bourne shells cannot handle close brackets correctly -- # in scan sets, so we specify it separately. -- case $arg in -- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -- arg="\"$arg\"" -- ;; -- esac -- lastarg="$lastarg $arg" -- done -- IFS="$save_ifs" -- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` -+ # Double-quote args containing other shell metacharacters. -+ # Many Bourne shells cannot handle close brackets correctly -+ # in scan sets, so we specify it separately. -+ case $arg in -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -+ arg="\"$arg\"" -+ ;; -+ esac -+ lastarg="$lastarg $arg" -+ done -+ IFS="$save_ifs" -+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - -- # Add the arguments to base_compile. -- if test -z "$base_compile"; then -- base_compile="$lastarg" -- else -+ # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" -- fi -- continue -- ;; -- esac -+ continue -+ ;; - -- case $user_target in -- next) -- # The next one is the -o target name -- user_target=yes -- continue -- ;; -- yes) -- # We got the output file -- user_target=set -- libobj="$arg" -- continue -+ * ) -+ # Accept the current argument as the source file. -+ # The previous "srcfile" becomes the current argument. -+ # -+ lastarg="$srcfile" -+ srcfile="$arg" -+ ;; -+ esac # case $arg - ;; -- esac -- -- # Accept the current argument as the source file. -- lastarg="$srcfile" -- srcfile="$arg" -+ esac # case $arg_mode - - # Aesthetically quote the previous argument. -- -- # Backslashify any backslashes, double quotes, and dollar signs. -- # These are the only characters that are still specially -- # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - -+ case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly -- # in scan sets, so we specify it separately. -- case $lastarg in -+ # in scan sets, and some SunOS ksh mistreat backslash-escaping -+ # in scan sets (worked around with variable expansion), -+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets -+ # at all, so we specify them separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - -- # Add the previous argument to base_compile. -- if test -z "$base_compile"; then -- base_compile="$lastarg" -- else -- base_compile="$base_compile $lastarg" -- fi -- done -+ base_compile="$base_compile $lastarg" -+ done # for arg - -- case $user_target in -- set) -+ case $arg_mode in -+ arg) -+ $echo "$modename: you must specify an argument for -Xcompile" -+ exit $EXIT_FAILURE - ;; -- no) -- # Get the name of the library object. -- libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` -+ target) -+ $echo "$modename: you must specify a target with \`-o'" 1>&2 -+ exit $EXIT_FAILURE - ;; - *) -- $echo "$modename: you must specify a target with \`-o'" 1>&2 -- exit 1 -+ # Get the name of the library object. -+ [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo -- xform='[cCFSfmso]' -+ xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; -@@ -431,10 +695,13 @@ - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; -+ *.ii) xform=ii ;; -+ *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; -+ *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` -@@ -443,25 +710,63 @@ - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - -+ func_infer_tag $base_compile -+ -+ for arg in $later; do -+ case $arg in -+ -static) -+ build_old_libs=yes -+ continue -+ ;; -+ -+ -prefer-pic) -+ pic_mode=yes -+ continue -+ ;; -+ -+ -prefer-non-pic) -+ pic_mode=no -+ continue -+ ;; -+ esac -+ done -+ -+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` -+ case $qlibobj in -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -+ qlibobj="\"$qlibobj\"" ;; -+ esac -+ test "X$libobj" != "X$qlibobj" \ -+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ -+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." -+ objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` -+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` -+ if test "X$xdir" = "X$obj"; then -+ xdir= -+ else -+ xdir=$xdir/ -+ fi -+ lobj=${xdir}$objdir/$objname -+ - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then -- removelist="$obj $libobj" -+ removelist="$obj $lobj $libobj ${libobj}T" - else -- removelist="$libobj" -+ removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist -- trap "$run $rm $removelist; exit 1" 1 2 15 -+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in -@@ -480,8 +785,9 @@ - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" -- trap "$run $rm $removelist; exit 1" 1 2 15 -+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - else -+ output_obj= - need_locks=no - lockfile= - fi -@@ -489,13 +795,13 @@ - # 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 $run ln "$0" "$lockfile" 2>/dev/null; do -+ until $run ln "$progpath" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then -- echo "\ -+ $echo "\ - *** ERROR, $lockfile exists and contains: - `cat $lockfile 2>/dev/null` - -@@ -507,14 +813,33 @@ - compiler." - - $run $rm $removelist -- exit 1 -+ exit $EXIT_FAILURE - fi -- echo $srcfile > "$lockfile" -+ $echo "$srcfile" > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi -+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` -+ case $qsrcfile in -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -+ qsrcfile="\"$qsrcfile\"" ;; -+ esac -+ -+ $run $rm "$libobj" "${libobj}T" -+ -+ # Create a libtool object file (analogous to a ".la" file), -+ # but don't create it if we're doing a dry run. -+ test -z "$run" && cat > ${libobj}T </dev/null`" != x"$srcfile"; then -- echo "\ -+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then -+ $echo "\ - *** ERROR, $lockfile contains: - `cat $lockfile 2>/dev/null` - -@@ -583,13 +893,13 @@ - compiler." - - $run $rm $removelist -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one -- if test x"$output_obj" != x"$libobj"; then -- $show "$mv $output_obj $libobj" -- if $run $mv $output_obj $libobj; then : -+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then -+ $show "$mv $output_obj $lobj" -+ if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist -@@ -597,77 +907,50 @@ - fi - fi - -- # If we have no pic_flag, then copy the object into place and finish. -- if (test -z "$pic_flag" || test "$pic_mode" != default) && -- test "$build_old_libs" = yes; then -- # Rename the .lo from within objdir to obj -- if test -f $obj; then -- $show $rm $obj -- $run $rm $obj -- fi -+ # Append the name of the PIC object to the libtool object file. -+ test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != x"$srcfile"; then -- echo "\ -+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then -+ $echo "\ - *** ERROR, $lockfile contains: - `cat $lockfile 2>/dev/null` - -@@ -682,11 +965,11 @@ - compiler." - - $run $rm $removelist -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Just move the object if needed -- if test x"$output_obj" != x"$obj"; then -+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else -@@ -696,29 +979,31 @@ - fi - fi - -- # Create an invalid libtool object if no PIC, so that we do not -- # accidentally link it into a program. -- if test "$build_libtool_libs" != yes; then -- $show "echo timestamp > $libobj" -- $run eval "echo timestamp > \$libobj" || exit $? -- else -- # Move the .lo from within objdir -- $show "$mv $libobj $lo_libobj" -- if $run $mv $libobj $lo_libobj; then : -- else -- error=$? -- $run $rm $removelist -- exit $error -- fi -- fi -+ # Append the name of the non-PIC object the libtool object file. -+ # Only append if the libtool object file exists. -+ test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1; then -+ pic_object= -+ non_pic_object= -+ -+ # Read the .lo file -+ # If there is no directory component, then add one. -+ case $arg in -+ */* | *\\*) . $arg ;; -+ *) . ./$arg ;; -+ esac -+ -+ if test -z "$pic_object" || \ -+ test -z "$non_pic_object" || -+ test "$pic_object" = none && \ -+ test "$non_pic_object" = none; then -+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2 -+ exit $EXIT_FAILURE -+ fi -+ -+ # Extract subdirectory from the argument. -+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` -+ if test "X$xdir" = "X$arg"; then -+ xdir= -+ else -+ xdir="$xdir/" -+ fi -+ -+ 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 -+ dlfiles="$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. -+ dlprefiles="$dlprefiles $pic_object" -+ prev= -+ fi -+ -+ # A PIC object. -+ libobjs="$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 -+ non_pic_objects="$non_pic_objects $non_pic_object" -+ if test -z "$pic_object" || test "$pic_object" = none ; then -+ arg="$non_pic_object" -+ fi -+ fi -+ else -+ # Only an error if not doing a dry-run. -+ if test -z "$run"; then -+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 -+ exit $EXIT_FAILURE -+ else -+ # Dry-run case. -+ -+ # Extract subdirectory from the argument. -+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` -+ if test "X$xdir" = "X$arg"; then -+ xdir= -+ else -+ xdir="$xdir/" -+ fi -+ -+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` -+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` -+ libobjs="$libobjs $pic_object" -+ non_pic_objects="$non_pic_objects $non_pic_object" -+ fi -+ fi -+ done -+ else -+ $echo "$modename: link input file \`$save_arg' does not exist" -+ exit $EXIT_FAILURE -+ fi -+ arg=$save_arg -+ prev= -+ continue -+ ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - if test "$prev" = rpath; then -@@ -938,13 +1341,33 @@ - finalize_command="$finalize_command $wl$qarg" - continue - ;; -+ xcclinker) -+ linker_flags="$linker_flags $qarg" -+ compiler_flags="$compiler_flags $qarg" -+ prev= -+ compile_command="$compile_command $qarg" -+ finalize_command="$finalize_command $qarg" -+ continue -+ ;; -+ shrext) -+ shrext_cmds="$arg" -+ prev= -+ continue -+ ;; -+ darwin_framework) -+ compiler_flags="$compiler_flags $arg" -+ compile_command="$compile_command $arg" -+ finalize_command="$finalize_command $arg" -+ prev= -+ continue -+ ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac -- fi # test -n $prev -+ fi # test -n "$prev" - - prevarg="$arg" - -@@ -986,7 +1409,7 @@ - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" -- exit 1 -+ exit $EXIT_FAILURE - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms -@@ -996,6 +1419,14 @@ - continue - ;; - -+ -framework|-arch) -+ prev=darwin_framework -+ compiler_flags="$compiler_flags $arg" -+ compile_command="$compile_command $arg" -+ finalize_command="$finalize_command $arg" -+ continue -+ ;; -+ - -inst-prefix-dir) - prev=inst_prefix - continue -@@ -1005,7 +1436,7 @@ - # 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*) -+ no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; -@@ -1022,7 +1453,7 @@ - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - dir="$absdir" - ;; -@@ -1056,25 +1487,75 @@ - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; -- *-*-openbsd*) -+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; -- esac -- elif test "X$arg" = "X-lc_r"; then -- case $host in -- *-*-openbsd*) -- # Do not include libc_r directly, use -pthread flag. -+ *-*-rhapsody* | *-*-darwin1.[012]) -+ # Rhapsody C and math libraries are in the System framework -+ deplibs="$deplibs -framework System" - 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 - deplibs="$deplibs $arg" - continue - ;; - -- -module) -- module=yes -+ # Tru64 UNIX uses -model [arg] to determine the layout of C++ -+ # classes, name mangling, and exception handling. -+ -model) -+ compile_command="$compile_command $arg" -+ compiler_flags="$compiler_flags $arg" -+ finalize_command="$finalize_command $arg" -+ prev=xcompiler -+ continue -+ ;; -+ -+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) -+ compiler_flags="$compiler_flags $arg" -+ compile_command="$compile_command $arg" -+ finalize_command="$finalize_command $arg" -+ continue -+ ;; -+ -+ -module) -+ module=yes -+ continue -+ ;; -+ -+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler -+ # -r[0-9][0-9]* specifies the processor on the SGI compiler -+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler -+ # +DA*, +DD* enable 64-bit mode on the HP compiler -+ # -q* pass through compiler args for the IBM compiler -+ # -m* pass through architecture-specific compiler args for GCC -+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) -+ -+ # Unknown arguments in both finalize_command and compile_command need -+ # to be aesthetically quoted because they are evaled later. -+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` -+ case $arg in -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") -+ arg="\"$arg\"" -+ ;; -+ esac -+ compile_command="$compile_command $arg" -+ finalize_command="$finalize_command $arg" -+ if test "$with_gcc" = "yes" ; then -+ compiler_flags="$compiler_flags $arg" -+ fi -+ continue -+ ;; -+ -+ -shrext) -+ prev=shrext - continue - ;; - -@@ -1102,8 +1583,18 @@ - continue - ;; - -+ -objectlist) -+ prev=objectlist -+ continue -+ ;; -+ - -o) prev=output ;; - -+ -precious-files-regex) -+ prev=precious_regex -+ continue -+ ;; -+ - -release) - prev=release - continue -@@ -1126,7 +1617,7 @@ - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - case "$xrpath " in -@@ -1154,6 +1645,11 @@ - prev=vinfo - continue - ;; -+ -version-number) -+ prev=vinfo -+ vinfo_number=yes -+ continue -+ ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` -@@ -1202,6 +1698,11 @@ - continue - ;; - -+ -XCClinker) -+ prev=xcclinker -+ continue -+ ;; -+ - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need -@@ -1214,29 +1715,101 @@ - esac - ;; - -- *.lo | *.$objext) -- # A library or standard object. -- if test "$prev" = dlfiles; then -- # This file was specified with -dlopen. -- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then -- dlfiles="$dlfiles $arg" -- prev= -- continue -- else -- # If libtool objects are unsupported, then we need to preload. -- prev=dlprefiles -- fi -- fi -+ *.$objext) -+ # A standard object. -+ objs="$objs $arg" -+ ;; - -- if test "$prev" = dlprefiles; then -- # Preload the old-style object. -- dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` -- prev= -- else -+ *.lo) -+ # A libtool-controlled object. -+ -+ # Check to see that this really is a libtool object. -+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -+ pic_object= -+ non_pic_object= -+ -+ # Read the .lo file -+ # If there is no directory component, then add one. - case $arg in -- *.lo) libobjs="$libobjs $arg" ;; -- *) objs="$objs $arg" ;; -+ */* | *\\*) . $arg ;; -+ *) . ./$arg ;; - esac -+ -+ if test -z "$pic_object" || \ -+ test -z "$non_pic_object" || -+ test "$pic_object" = none && \ -+ test "$non_pic_object" = none; then -+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2 -+ exit $EXIT_FAILURE -+ fi -+ -+ # Extract subdirectory from the argument. -+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` -+ if test "X$xdir" = "X$arg"; then -+ xdir= -+ else -+ xdir="$xdir/" -+ fi -+ -+ 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 -+ dlfiles="$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. -+ dlprefiles="$dlprefiles $pic_object" -+ prev= -+ fi -+ -+ # A PIC object. -+ libobjs="$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 -+ non_pic_objects="$non_pic_objects $non_pic_object" -+ if test -z "$pic_object" || test "$pic_object" = none ; then -+ arg="$non_pic_object" -+ fi -+ fi -+ else -+ # Only an error if not doing a dry-run. -+ if test -z "$run"; then -+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 -+ exit $EXIT_FAILURE -+ else -+ # Dry-run case. -+ -+ # Extract subdirectory from the argument. -+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` -+ if test "X$xdir" = "X$arg"; then -+ xdir= -+ else -+ xdir="$xdir/" -+ fi -+ -+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` -+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` -+ libobjs="$libobjs $pic_object" -+ non_pic_objects="$non_pic_objects $non_pic_object" -+ fi - fi - ;; - -@@ -1287,7 +1860,7 @@ - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then -@@ -1296,6 +1869,7 @@ - finalize_command="$finalize_command $arg" - fi - -+ oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" -@@ -1330,7 +1904,7 @@ - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; -@@ -1338,7 +1912,17 @@ - *) linkmode=prog ;; # Anything else should be a program. - esac - -+ case $host in -+ *cygwin* | *mingw* | *pw32*) -+ # don't eliminate duplications in $postdeps and $predeps -+ duplicate_compiler_generated_deps=yes -+ ;; -+ *) -+ duplicate_compiler_generated_deps=$duplicate_deps -+ ;; -+ esac - specialdeplibs= -+ - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) -@@ -1358,7 +1942,7 @@ - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= -- if test "X$duplicate_deps" = "Xyes" ; then -+ if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; -@@ -1383,7 +1967,7 @@ - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - done -@@ -1400,39 +1984,58 @@ - ;; - esac - for pass in $passes; do -+ if test "$linkmode,$pass" = "lib,link" || -+ test "$linkmode,$pass" = "prog,scan"; then -+ libs="$deplibs" -+ deplibs= -+ fi - if test "$linkmode" = prog; then -- # Determine which files to process - case $pass in -- dlopen) -- libs="$dlfiles" -- save_deplibs="$deplibs" # Collect dlpreopened libraries -- deplibs= -- ;; -+ dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; -- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; -+ link) -+ libs="$deplibs %DEPLIBS%" -+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" -+ ;; - esac - 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 -- -l*) -- if test "$linkmode" = oldlib && test "$linkmode" = obj; then -- $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 -- continue -+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) -+ if test "$linkmode,$pass" = "prog,link"; then -+ compile_deplibs="$deplib $compile_deplibs" -+ finalize_deplibs="$deplib $finalize_deplibs" -+ else -+ compiler_flags="$compiler_flags $deplib" - fi -- if test "$pass" = conv; then -- deplibs="$deplib $deplibs" -+ continue -+ ;; -+ -l*) -+ if test "$linkmode" != lib && test "$linkmode" != prog; then -+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do -- # Search the libtool library -- lib="$searchdir/lib${name}.la" -- if test -f "$lib"; then -- found=yes -- break -- fi -+ 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 -@@ -1444,6 +2047,42 @@ - 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 (${SED} -e '2q' $lib | -+ grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -+ library_names= -+ old_library= -+ case $lib in -+ */* | *\\*) . $lib ;; -+ *) . ./$lib ;; -+ esac -+ 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 -+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` -+ test "X$ladir" = "X$lib" && ladir="." -+ 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 - -L*) -@@ -1461,14 +2100,14 @@ - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" -- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi -+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - *) -- $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 -+ $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue -@@ -1493,16 +2132,33 @@ - fi - case $linkmode in - lib) -- if test "$deplibs_check_method" != pass_all; then -- echo -- echo "*** Warning: This library needs some functionality provided by $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." -+ valid_a_lib=no -+ case $deplibs_check_method in -+ match_pattern*) -+ set dummy $deplibs_check_method -+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` -+ 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 used here." - else -- echo -- echo "*** Warning: Linking the shared library $output against the" -- echo "*** static library $deplib is not portable!" -+ $echo -+ $echo "*** Warning: Linking the shared library $output against the" -+ $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue -@@ -1519,14 +2175,18 @@ - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) -- 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. -- newdlprefiles="$newdlprefiles $deplib" -- compile_deplibs="$deplib $compile_deplibs" -- finalize_deplibs="$deplib $finalize_deplibs" -- else -- newdlfiles="$newdlfiles $deplib" -+ 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. -+ newdlprefiles="$newdlprefiles $deplib" -+ compile_deplibs="$deplib $compile_deplibs" -+ finalize_deplibs="$deplib $finalize_deplibs" -+ else -+ newdlfiles="$newdlfiles $deplib" -+ fi - fi - continue - ;; -@@ -1538,14 +2198,14 @@ - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Check to see that this really is a libtool archive. -- if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : -+ if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` -@@ -1558,8 +2218,11 @@ - library_names= - old_library= - # If the library was installed with an old release of libtool, -- # it will not redefine variable installed. -+ # it will not redefine variables installed, or shouldnotlink - installed=yes -+ shouldnotlink=no -+ avoidtemprpath= -+ - - # Read the .la file - case $lib in -@@ -1569,8 +2232,7 @@ - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || -- { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then -- # Add dl[pre]opened files of deplib -+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi -@@ -1581,7 +2243,7 @@ - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" -@@ -1598,11 +2260,12 @@ - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - continue - fi # $pass = conv - -+ - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do -@@ -1610,19 +2273,23 @@ - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi -- if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then -+ 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. -- dlprefiles="$dlprefiles $lib" -+ # 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. -+ dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi -@@ -1654,11 +2321,19 @@ - dir="$libdir" - absdir="$libdir" - fi -+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else -- dir="$ladir/$objdir" -- absdir="$abs_ladir/$objdir" -- # Remove this search path later -- notinst_path="$notinst_path $abs_ladir" -+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then -+ dir="$ladir" -+ absdir="$abs_ladir" -+ # Remove this search path later -+ notinst_path="$notinst_path $abs_ladir" -+ else -+ dir="$ladir/$objdir" -+ absdir="$abs_ladir/$objdir" -+ # Remove this search path later -+ notinst_path="$notinst_path $abs_ladir" -+ fi - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - -@@ -1666,7 +2341,7 @@ - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). -@@ -1688,11 +2363,12 @@ - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else -- deplibs="$lib $deplibs" -+ deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - -+ - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" -@@ -1726,13 +2402,19 @@ - continue - fi # $linkmode = prog... - -- link_static=no # Whether the deplib will be linked statically -- if test -n "$library_names" && -- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then -- # Link against this shared library -+ if test "$linkmode,$pass" = "prog,link"; then -+ if test -n "$library_names" && -+ { test "$prefer_static_libs" = no || 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 -+ *" $dir "*) ;; -+ *" $absdir "*) ;; -+ *) temp_rpath="$temp_rpath $absdir" ;; -+ esac -+ fi - -- if test "$linkmode,$pass" = "prog,link" || -- { 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. -@@ -1754,17 +2436,6 @@ - esac - ;; - esac -- if test "$linkmode" = prog; then -- # We need to hardcode the library path -- if test -n "$shlibpath_var"; then -- # Make sure the rpath contains only unique directories. -- case "$temp_rpath " in -- *" $dir "*) ;; -- *" $absdir "*) ;; -- *) temp_rpath="$temp_rpath $dir" ;; -- esac -- fi -- fi - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && -@@ -1774,11 +2445,52 @@ - # We only need to search for static libraries - continue - fi -+ fi - -+ link_static=no # Whether the deplib will be linked statically -+ if test -n "$library_names" && -+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi -+ # This is a shared library -+ -+ # Warn about portability, can't link against -module's on -+ # some systems (darwin) -+ if 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 "*) ;; -+ *) compile_rpath="$compile_rpath $absdir" -+ esac -+ ;; -+ esac -+ case " $sys_lib_dlsearch_path " in -+ *" $libdir "*) ;; -+ *) -+ case "$finalize_rpath " in -+ *" $libdir "*) ;; -+ *) finalize_rpath="$finalize_rpath $libdir" -+ esac -+ ;; -+ esac -+ fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname -@@ -1792,7 +2504,7 @@ - elif test -n "$soname_spec"; then - # bleh windows - case $host in -- *cygwin*) -+ *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; -@@ -1804,17 +2516,18 @@ - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" -- soname=`echo $soroot | sed -e 's/^.*\///'` -- newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" -+ soname=`$echo $soroot | ${SED} -e 's/^.*\///'` -+ newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' -- eval cmds=\"$extract_expsyms_cmds\" -+ cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done -@@ -1825,9 +2538,10 @@ - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' -- eval cmds=\"$old_archive_from_expsyms_cmds\" -+ cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done -@@ -1847,6 +2561,22 @@ - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" -+ case $host in -+ *-*-sco3.2v5* ) add_dir="-L$dir" ;; -+ *-*-darwin* ) -+ # if the lib is a module then we can not link against -+ # it, someone is ignoring the new warnings I added -+ if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; 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 -+ fi -+ esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; -@@ -1865,6 +2595,14 @@ - 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 -+ [\\/]*) -+ add_dir="$add_dir -L$inst_prefix_dir$libdir" -+ ;; -+ esac -+ fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" -@@ -1878,7 +2616,7 @@ - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" -- exit 1 -+ exit $EXIT_FAILURE - fi - - if test -n "$add_shlibpath"; then -@@ -1912,16 +2650,7 @@ - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then -- # Try looking first in the location we're being installed to. -- add_dir= -- if test -n "$inst_prefix_dir"; then -- case "$libdir" in -- [\\/]*) -- add_dir="-L$inst_prefix_dir$libdir" -- ;; -- esac -- fi -- add_dir="$add_dir -L$libdir" -+ add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in -@@ -1929,18 +2658,24 @@ - *) finalize_shlibpath="$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. -- add_dir= - if test -n "$inst_prefix_dir"; then -- case "$libdir" in -- [\\/]*) -- add_dir="-L$inst_prefix_dir$libdir" -- ;; -+ case $libdir in -+ [\\/]*) -+ add_dir="$add_dir -L$inst_prefix_dir$libdir" -+ ;; - esac - fi -- add_dir="$add_dir -L$libdir" - add="-l$name" - fi - -@@ -1953,15 +2688,6 @@ - fi - fi - elif test "$linkmode" = prog; then -- 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 -- -- # Try to link the static library - # 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. -@@ -1981,20 +2707,21 @@ - - # 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 library needs some functionality provided by $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." -+ $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 "*** Therefore, libtool will create a static module, that should work " -- echo "*** as long as the dlopening application is linked with the -dlopen flag." -+ $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." -+ $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 -@@ -2004,8 +2731,6 @@ - fi - fi - else -- convenience="$convenience $dir/$old_library" -- old_convenience="$old_convenience $dir/$old_library" - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi -@@ -2013,7 +2738,8 @@ - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && -- { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || -+ { test "$hardcode_into_libs" != yes || -+ test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= -@@ -2065,29 +2791,75 @@ - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then -- path="-L$absdir/$objdir" -+ path="$absdir/$objdir" - else -- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` -+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi -- path="-L$absdir" -+ path="$absdir" - fi -+ depdepl= -+ case $host in -+ *-*-darwin*) -+ # we do not want to link against static libs, -+ # but need to link against shared -+ 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 "$path/$depdepl" ; then -+ depdepl="$path/$depdepl" -+ fi -+ # do not add paths which are already there -+ case " $newlib_search_path " in -+ *" $path "*) ;; -+ *) newlib_search_path="$newlib_search_path $path";; -+ esac -+ fi -+ path="" -+ ;; -+ *) -+ path="-L$path" -+ ;; -+ esac -+ ;; -+ -l*) -+ case $host in -+ *-*-darwin*) -+ # Again, we only want to link against shared libraries -+ eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` -+ for tmp in $newlib_search_path ; do -+ if test -f "$tmp/lib$tmp_libs.dylib" ; then -+ eval depdepl="$tmp/lib$tmp_libs.dylib" -+ break -+ fi -+ done -+ path="" -+ ;; -+ *) continue ;; -+ esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $path "*) ;; -- *) deplibs="$deplibs $path" ;; -+ *) deplibs="$path $deplibs" ;; -+ esac -+ case " $deplibs " in -+ *" $depdepl "*) ;; -+ *) deplibs="$depdepl $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs -+ dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do -@@ -2095,7 +2867,6 @@ - done - fi - if test "$pass" != dlopen; then -- test "$pass" != scan && dependency_libs="$newdependency_libs" - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= -@@ -2118,9 +2889,30 @@ - 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" ;; - *) -@@ -2148,11 +2940,20 @@ - eval $var=\"$tmp_libs\" - done # for var - fi -- if test "$pass" = "conv" && -- { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then -- libs="$deplibs" # reset libs -- deplibs= -- 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 -+ tmp_libs="$tmp_libs $i" -+ fi -+ done -+ dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" -@@ -2161,6 +2962,10 @@ - - case $linkmode in - oldlib) -+ if test -n "$deplibs"; then -+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 -+ fi -+ - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi -@@ -2174,7 +2979,7 @@ - fi - - if test -n "$vinfo"; then -- $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 -+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then -@@ -2196,17 +3001,19 @@ - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` -+ eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` -+ eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` -@@ -2217,11 +3024,11 @@ - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 -- exit 1 -+ exit $EXIT_FAILURE - else -- echo -- echo "*** Warning: Linking the shared library $output against the non-libtool" -- echo "*** objects $objs is not portable!" -+ $echo -+ $echo "*** Warning: Linking the shared library $output against the non-libtool" -+ $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi -@@ -2240,14 +3047,16 @@ - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. -- libext=al -+ # 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 - - if test -n "$vinfo"; then -- $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 -+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then -@@ -2263,45 +3072,87 @@ - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - -- current="$2" -- revision="$3" -- age="$4" -+ # 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="$2" -+ number_minor="$3" -+ number_revision="$4" -+ # -+ # 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) -+ current=`expr $number_major + $number_minor` -+ age="$number_minor" -+ revision="$number_revision" -+ ;; -+ freebsd-aout|freebsd-elf|sunos) -+ current="$number_major" -+ revision="$number_minor" -+ age="0" -+ ;; -+ irix|nonstopux) -+ current=`expr $number_major + $number_minor - 1` -+ age="$number_minor" -+ revision="$number_minor" -+ ;; -+ *) -+ $echo "$modename: unknown library version type \`$version_type'" 1>&2 -+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 -+ exit $EXIT_FAILURE -+ ;; -+ esac -+ ;; -+ no) -+ current="$2" -+ revision="$3" -+ age="$4" -+ ;; -+ esac - - # Check that each of the things are valid numbers. - case $current in -- [0-9]*) ;; -+ 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]) ;; - *) -- $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 -+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - - case $revision in -- [0-9]*) ;; -+ 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]) ;; - *) -- $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 -+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - - case $age in -- [0-9]*) ;; -+ 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]) ;; - *) -- $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 -+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Calculate the version variables. -@@ -2318,7 +3169,7 @@ - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` -- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" -+ verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - ;; - - freebsd-aout) -@@ -2331,16 +3182,21 @@ - versuffix=".$current"; - ;; - -- irix) -+ irix | nonstopux) - major=`expr $current - $age + 1` -- verstring="sgi$major.$revision" -+ -+ 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 - iface=`expr $revision - $loop` - loop=`expr $loop - 1` -- verstring="sgi$major.$iface:$verstring" -+ verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. -@@ -2354,7 +3210,7 @@ - ;; - - osf) -- major=`expr $current - $age` -+ major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - -@@ -2384,20 +3240,19 @@ - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 -- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 -- exit 1 -+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 -+ exit $EXIT_FAILURE - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= -- verstring="0.0" - 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= - ;; - *) - verstring="0.0" -@@ -2431,9 +3286,30 @@ - fi - - if test "$mode" != relink; then -- # Remove our outputs. -- $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" -- $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* -+ # 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) -+ ;; -+ $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 -+ removelist="$removelist $p" -+ ;; -+ *) ;; -+ esac -+ done -+ if test -n "$removelist"; then -+ $show "${rm}r $removelist" -+ $run ${rm}r $removelist -+ fi - fi - - # Now set the variables for building old libraries. -@@ -2446,9 +3322,9 @@ - - # Eliminate all temporary directories. - for path in $notinst_path; do -- lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` -- deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` -- dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` -+ lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` -+ deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` -+ dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then -@@ -2499,10 +3375,11 @@ - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; -- *-*-openbsd*) -+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. -+ test "X$arg" = "X-lc" && continue - ;; -- *) -+ *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" -@@ -2531,7 +3408,7 @@ - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just -- # implementing what was already the behaviour. -+ # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) -@@ -2544,64 +3421,88 @@ - int main() { return 0; } - EOF - $rm conftest -- $CC -o conftest conftest.c $deplibs -+ $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - for i in $deplibs; do -- name="`expr $i : '-l\(.*\)'`" -+ name=`expr $i : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. -- if test -n "$name" && test "$name" != "0"; then -- libname=`eval \\$echo \"$libname_spec\"` -- deplib_matches=`eval \\$echo \"$library_names_spec\"` -- set dummy $deplib_matches -- deplib_match=$2 -- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then -- newdeplibs="$newdeplibs $i" -- else -- droppeddeps=yes -- echo -- echo "*** Warning: This library needs some functionality provided by $i." -- echo "*** I have the capability to make that library automatically link in when" -- echo "*** you link to this library. But I can only do this if you have a" -- echo "*** shared version of the library, which you do not appear to have." -+ if test "$name" != "" && test "$name" -ne "0"; then -+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then -+ case " $predeps $postdeps " in -+ *" $i "*) -+ newdeplibs="$newdeplibs $i" -+ i="" -+ ;; -+ esac -+ fi -+ if test -n "$i" ; then -+ libname=`eval \\$echo \"$libname_spec\"` -+ deplib_matches=`eval \\$echo \"$library_names_spec\"` -+ set dummy $deplib_matches -+ deplib_match=$2 -+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then -+ newdeplibs="$newdeplibs $i" -+ else -+ droppeddeps=yes -+ $echo -+ $echo "*** Warning: dynamic linker does not accept needed library $i." -+ $echo "*** I have the capability to make that library automatically link in when" -+ $echo "*** you link to this library. But I can only do this if you have a" -+ $echo "*** shared version of the library, which I believe you do not have" -+ $echo "*** because a test_compile did reveal that the linker did not use it for" -+ $echo "*** its dynamic dependency list that programs get resolved with at runtime." -+ fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else -- # Error occured in the first compile. Let's try to salvage the situation: -- # Compile a seperate program for each library. -+ # Error occurred in the first compile. Let's try to salvage -+ # the situation: Compile a separate program for each library. - for i in $deplibs; do -- name="`expr $i : '-l\(.*\)'`" -- # If $name is empty we are operating on a -L argument. -- if test -n "$name" && test "$name" != "0"; then -+ name=`expr $i : '-l\(.*\)'` -+ # If $name is empty we are operating on a -L argument. -+ if test "$name" != "" && test "$name" != "0"; then - $rm conftest -- $CC -o conftest conftest.c $i -+ $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` -- libname=`eval \\$echo \"$libname_spec\"` -- deplib_matches=`eval \\$echo \"$library_names_spec\"` -- set dummy $deplib_matches -- deplib_match=$2 -- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then -- newdeplibs="$newdeplibs $i" -- else -- droppeddeps=yes -- echo -- echo "*** Warning: This library needs some functionality provided by $i." -- echo "*** I have the capability to make that library automatically link in when" -- echo "*** you link to this library. But I can only do this if you have a" -- echo "*** shared version of the library, which you do not appear to have." -+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then -+ case " $predeps $postdeps " in -+ *" $i "*) -+ newdeplibs="$newdeplibs $i" -+ i="" -+ ;; -+ esac -+ fi -+ if test -n "$i" ; then -+ libname=`eval \\$echo \"$libname_spec\"` -+ deplib_matches=`eval \\$echo \"$library_names_spec\"` -+ set dummy $deplib_matches -+ deplib_match=$2 -+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then -+ newdeplibs="$newdeplibs $i" -+ else -+ droppeddeps=yes -+ $echo -+ $echo "*** Warning: dynamic linker does not accept needed library $i." -+ $echo "*** I have the capability to make that library automatically link in when" -+ $echo "*** you link to this library. But I can only do this if you have a" -+ $echo "*** shared version of the library, which you do not appear to have" -+ $echo "*** because a test_compile did reveal that the linker did not use this one" -+ $echo "*** as a dynamic dependency that programs can get resolved with at runtime." -+ fi - fi - else - droppeddeps=yes -- echo -- echo "*** Warning! Library $i is needed by this library but I was not able to" -- echo "*** make it link in! You will probably need to install it or some" -- echo "*** library that it depends on before this library will be fully" -- echo "*** functional. Installing it before continuing would be even better." -+ $echo -+ $echo "*** Warning! Library $i is needed by this library but I was not able to" -+ $echo "*** make it link in! You will probably need to install it or some" -+ $echo "*** library that it depends on before this library will be fully" -+ $echo "*** functional. Installing it before continuing would be even better." - fi - else - newdeplibs="$newdeplibs $i" -@@ -2613,13 +3514,22 @@ - set dummy $deplibs_check_method - file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do -- name="`expr $a_deplib : '-l\(.*\)'`" -+ name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. -- if test -n "$name" && test "$name" != "0"; 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 -+ if test "$name" != "" && test "$name" != "0"; then -+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then -+ case " $predeps $postdeps " in -+ *" $a_deplib "*) -+ newdeplibs="$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 - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then -@@ -2632,28 +3542,36 @@ - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do -- potliblink=`ls -ld $potlib | sed 's/.* -> //'` -+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ -- | sed 10q \ -- | egrep "$file_magic_regex" > /dev/null; then -+ | ${SED} 10q \ -+ | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi -- done -- done -+ done -+ done -+ fi - if test -n "$a_deplib" ; then - droppeddeps=yes -- echo -- echo "*** Warning: This library needs some functionality provided by $a_deplib." -- echo "*** I have the capability to make that library automatically link in when" -- echo "*** you link to this library. But I can only do this if you have a" -- echo "*** shared version of the library, which you do not appear to have." -+ $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 - else - # Add a -L argument. -@@ -2665,29 +3583,47 @@ - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do -- name="`expr $a_deplib : '-l\(.*\)'`" -+ name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; 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 -- if eval echo \"$potent_lib\" 2>/dev/null \ -- | sed 10q \ -- | egrep "$match_pattern_regex" > /dev/null; then -- newdeplibs="$newdeplibs $a_deplib" -- a_deplib="" -- break 2 -- fi -+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then -+ case " $predeps $postdeps " in -+ *" $a_deplib "*) -+ newdeplibs="$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 -+ newdeplibs="$newdeplibs $a_deplib" -+ a_deplib="" -+ break 2 -+ fi -+ done - done -- done -+ fi - if test -n "$a_deplib" ; then - droppeddeps=yes -- echo -- echo "*** Warning: This library needs some functionality provided by $a_deplib." -- echo "*** I have the capability to make that library automatically link in when" -- echo "*** you link to this library. But I can only do this if you have a" -- echo "*** shared version of the library, which you do not appear to have." -+ $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 - else - # Add a -L argument. -@@ -2697,16 +3633,23 @@ - ;; - none | unknown | *) - newdeplibs="" -- if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -- -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | -- grep . >/dev/null; then -- echo -+ tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -+ -e '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 "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` -+ done -+ fi -+ if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ -+ | grep . >/dev/null; then -+ $echo - if test "X$deplibs_check_method" = "Xnone"; then -- echo "*** Warning: inter-library dependencies are not supported in this platform." -+ $echo "*** Warning: inter-library dependencies are not supported in this platform." - else -- echo "*** Warning: inter-library dependencies are not known to be supported." -+ $echo "*** Warning: inter-library dependencies are not known to be supported." - fi -- echo "*** All declared inter-library dependencies are being dropped." -+ $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; -@@ -2726,17 +3669,17 @@ - - 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." -+ $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." -+ $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" -@@ -2746,16 +3689,16 @@ - 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." -+ $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." -+ $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 -@@ -2813,7 +3756,11 @@ - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" -- eval dep_rpath=\"$hardcode_libdir_flag_spec\" -+ 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. -@@ -2833,6 +3780,7 @@ - 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 - realname="$2" -@@ -2843,7 +3791,9 @@ - else - soname="$realname" - fi -- test -z "$dlname" && dlname=$soname -+ if test -z "$dlname"; then -+ dlname=$soname -+ fi - - lib="$output_objdir/$realname" - for link -@@ -2851,23 +3801,6 @@ - linknames="$linknames $link" - done - -- # Ensure that we have .o objects for linkers which dislike .lo -- # (e.g. aix) in case we are running --disable-static -- for obj in $libobjs; do -- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` -- if test "X$xdir" = "X$obj"; then -- xdir="." -- else -- xdir="$xdir" -- fi -- baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` -- oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` -- if test ! -f $xdir/$oldobj; then -- $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" -- $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? -- fi -- done -- - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - -@@ -2877,17 +3810,29 @@ - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols -- eval cmds=\"$export_symbols_cmds\" -+ cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -- $show "$cmd" -- $run eval "$cmd" || exit $? -+ eval cmd=\"$cmd\" -+ if len=`expr "X$cmd" : ".*"` && -+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then -+ $show "$cmd" -+ $run eval "$cmd" || exit $? -+ skipped_export=false -+ else -+ # The command line is too long to execute in one step. -+ $show "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"; then -- $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" -- $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' -+ $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" -+ $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi -@@ -2898,46 +3843,30 @@ - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - -+ tmp_deplibs= -+ for test_deplib in $deplibs; do -+ case " $convenience " in -+ *" $test_deplib "*) ;; -+ *) -+ tmp_deplibs="$tmp_deplibs $test_deplib" -+ ;; -+ esac -+ done -+ deplibs="$tmp_deplibs" -+ - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then -+ save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" -- $show "${rm}r $gentop" -- $run ${rm}r "$gentop" -- $show "mkdir $gentop" -- $run mkdir "$gentop" -- status=$? -- if test "$status" -ne 0 && test ! -d "$gentop"; then -- exit $status -- fi - generated="$generated $gentop" - -- for xlib in $convenience; do -- # Extract the objects. -- case $xlib in -- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; -- *) xabs=`pwd`"/$xlib" ;; -- esac -- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` -- xdir="$gentop/$xlib" -- -- $show "${rm}r $xdir" -- $run ${rm}r "$xdir" -- $show "mkdir $xdir" -- $run mkdir "$xdir" -- status=$? -- if test "$status" -ne 0 && test ! -d "$xdir"; then -- exit $status -- fi -- $show "(cd $xdir && $AR x $xabs)" -- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? -- -- libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` -- done -+ func_extract_archives $gentop $convenience -+ libobjs="$libobjs $func_extract_archives_result" - fi - fi -- -+ - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" -@@ -2949,23 +3878,175 @@ - 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 cmds=\"$archive_expsym_cmds\" -+ 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:" && -+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` && -+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then -+ : - else -- eval cmds=\"$archive_cmds\" -+ # The command line is too long to link in one step, link piecewise. -+ $echo "creating reloadable object files..." -+ -+ # 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 -+ output_la=`$echo "X$output" | $Xsed -e "$basename"` -+ -+ # Clear the reloadable object creation command queue and -+ # initialize k to one. -+ test_cmds= -+ concat_cmds= -+ objlist= -+ delfiles= -+ last_robj= -+ k=1 -+ output=$output_objdir/$output_la-${k}.$objext -+ # Loop over the list of objects to be linked. -+ for obj in $save_libobjs -+ do -+ eval test_cmds=\"$reload_cmds $objlist $last_robj\" -+ if test "X$objlist" = X || -+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && -+ test "$len" -le "$max_cmd_len"; }; then -+ objlist="$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. -+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\" -+ else -+ # All subsequent reloadable object files will link in -+ # the last one created. -+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" -+ fi -+ last_robj=$output_objdir/$output_la-${k}.$objext -+ k=`expr $k + 1` -+ output=$output_objdir/$output_la-${k}.$objext -+ objlist=$obj -+ len=1 -+ 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~ -+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" -+ -+ if ${skipped_export-false}; then -+ $show "generating symbol list for \`$libname.la'" -+ export_symbols="$output_objdir/$libname.exp" -+ $run $rm $export_symbols -+ libobjs=$output -+ # Append the command to create the export file. -+ eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" -+ fi -+ -+ # Set up a command to remove the reloadable object files -+ # after they are used. -+ i=0 -+ while test "$i" -lt "$k" -+ do -+ i=`expr $i + 1` -+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" -+ done -+ -+ $echo "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" -+ $show "$cmd" -+ $run eval "$cmd" || exit $? -+ done -+ IFS="$save_ifs" -+ -+ 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\" -+ 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 -+ -+ # Append the command to remove the reloadable object files -+ # to the just-reset $cmds. -+ eval cmds=\"\$cmds~\$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" -- $run eval "$cmd" || exit $? -+ $run eval "$cmd" || { -+ lt_exit=$? -+ -+ # Restore the uninstalled library and exit -+ if test "$mode" = relink; then -+ $run eval '(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 "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? -- exit 0 -+ -+ if test -n "$convenience"; then -+ if test -z "$whole_archive_flag_spec"; then -+ $show "${rm}r $gentop" -+ $run ${rm}r "$gentop" -+ fi -+ fi -+ -+ exit $EXIT_SUCCESS - fi - - # Create links to the real library. -@@ -3013,7 +4094,7 @@ - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` -@@ -3042,38 +4123,10 @@ - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" -- $show "${rm}r $gentop" -- $run ${rm}r "$gentop" -- $show "mkdir $gentop" -- $run mkdir "$gentop" -- status=$? -- if test "$status" -ne 0 && test ! -d "$gentop"; then -- exit $status -- fi - generated="$generated $gentop" - -- for xlib in $convenience; do -- # Extract the objects. -- case $xlib in -- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; -- *) xabs=`pwd`"/$xlib" ;; -- esac -- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` -- xdir="$gentop/$xlib" -- -- $show "${rm}r $xdir" -- $run ${rm}r "$xdir" -- $show "mkdir $xdir" -- $run mkdir "$xdir" -- status=$? -- if test "$status" -ne 0 && test ! -d "$xdir"; then -- exit $status -- fi -- $show "(cd $xdir && $AR x $xabs)" -- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? -- -- reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` -- done -+ func_extract_archives $gentop $convenience -+ reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - -@@ -3081,10 +4134,11 @@ - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" -- eval cmds=\"$reload_cmds\" -+ cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done -@@ -3097,7 +4151,7 @@ - $run ${rm}r $gentop - fi - -- exit 0 -+ exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then -@@ -3108,37 +4162,24 @@ - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. -- $show "echo timestamp > $libobj" -- $run eval "echo timestamp > $libobj" || exit $? -- exit 0 -+ # $show "echo timestamp > $libobj" -+ # $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" -- eval cmds=\"$reload_cmds\" -+ cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" -- else -- # Just create a symlink. -- $show $rm $libobj -- $run $rm $libobj -- xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` -- if test "X$xdir" = "X$libobj"; then -- xdir="." -- else -- xdir="$xdir" -- fi -- baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` -- oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` -- $show "(cd $xdir && $LN_S $oldobj $baseobj)" -- $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? - fi - - if test -n "$gentop"; then -@@ -3146,12 +4187,12 @@ - $run ${rm}r $gentop - fi - -- exit 0 -+ exit $EXIT_SUCCESS - ;; - - prog) - case $host in -- *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; -+ *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 -@@ -3176,6 +4217,16 @@ - ;; - esac - -+ case $host in -+ *darwin*) -+ # Don't allow lazy linking, it breaks C++ global constructors -+ if test "$tagname" = CXX ; then -+ compile_command="$compile_command ${wl}-bind_at_load" -+ finalize_command="$finalize_command ${wl}-bind_at_load" -+ fi -+ ;; -+ esac -+ - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - -@@ -3326,31 +4377,31 @@ - done - - if test -n "$exclude_expsyms"; then -- $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' -+ $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then -- $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' -+ $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then -- export_symbols="$output_objdir/$output.exp" -+ export_symbols="$output_objdir/$outputname.exp" - $run $rm $export_symbols -- $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' -+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else -- $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' -- $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' -+ $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' -+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" -- name=`echo "$arg" | sed -e 's%^.*/%%'` -- $run eval 'echo ": $name " >> "$nlist"' -+ name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` -+ $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - -@@ -3359,12 +4410,18 @@ - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then -- egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T -+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. -- if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then -+ 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 -@@ -3373,7 +4430,7 @@ - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else -- echo '/* NONE */' >> "$output_objdir/$dlsyms" -+ $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ -@@ -3388,7 +4445,26 @@ - #endif - - /* The mapping between symbol names and symbols. */ -+" -+ -+ case $host in -+ *cygwin* | *mingw* ) -+ $echo >> "$output_objdir/$dlsyms" "\ -+/* DATA imports from DLLs on WIN32 can't be const, because -+ runtime relocations are performed -- see ld's documentation -+ on pseudo-relocs */ -+struct { -+" -+ ;; -+ * ) -+ $echo >> "$output_objdir/$dlsyms" "\ - const struct { -+" -+ ;; -+ esac -+ -+ -+ $echo >> "$output_objdir/$dlsyms" "\ - const char *name; - lt_ptr address; - } -@@ -3425,18 +4501,18 @@ - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; -- *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; -+ *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; -- *) pic_flag_for_symtable=" $pic_flag -DPIC";; -+ *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. -- $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" -- $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? -+ $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" -+ $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" -@@ -3448,7 +4524,7 @@ - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - else -@@ -3536,7 +4612,7 @@ - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? -- exit 0 -+ exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then -@@ -3591,10 +4667,10 @@ - fi - - # Quote $echo for shipping. -- if test "X$echo" = "X$SHELL $0 --fallback-echo"; then -- case $0 in -- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; -- *) qecho="$SHELL `pwd`/$0 --fallback-echo";; -+ if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then -+ case $progpath in -+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; -+ *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else -@@ -3606,15 +4682,231 @@ - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in -- *.exe) output=`echo $output|sed 's,.exe$,,'` ;; -+ *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in -- *cygwin*) exeext=.exe ;; -+ *cygwin*) -+ exeext=.exe -+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac -+ case $host in -+ *cygwin* | *mingw* ) -+ cwrappersource=`$echo ${objdir}/lt-${outputname}.c` -+ cwrapper=`$echo ${output}.exe` -+ $rm $cwrappersource $cwrapper -+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 -+ -+ cat > $cwrappersource <> $cwrappersource<<"EOF" -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#if defined(PATH_MAX) -+# define LT_PATHMAX PATH_MAX -+#elif defined(MAXPATHLEN) -+# define LT_PATHMAX MAXPATHLEN -+#else -+# define LT_PATHMAX 1024 -+#endif -+ -+#ifndef DIR_SEPARATOR -+#define DIR_SEPARATOR '/' -+#endif -+ -+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ -+ defined (__OS2__) -+#define HAVE_DOS_BASED_FILE_SYSTEM -+#ifndef DIR_SEPARATOR_2 -+#define DIR_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 */ -+ -+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -+#define XFREE(stale) do { \ -+ if (stale) { free ((void *) stale); stale = 0; } \ -+} while (0) -+ -+const char *program_name = NULL; -+ -+void * xmalloc (size_t num); -+char * xstrdup (const char *string); -+char * basename (const char *name); -+char * fnqualify(const char *path); -+char * strendzap(char *str, const char *pat); -+void lt_fatal (const char *message, ...); -+ -+int -+main (int argc, char *argv[]) -+{ -+ char **newargz; -+ int i; -+ -+ program_name = (char *) xstrdup ((char *) basename (argv[0])); -+ newargz = XMALLOC(char *, argc+2); -+EOF -+ -+ cat >> $cwrappersource <> $cwrappersource <<"EOF" -+ newargz[1] = fnqualify(argv[0]); -+ /* we know the script has the same name, without the .exe */ -+ /* so make sure newargz[1] doesn't end in .exe */ -+ strendzap(newargz[1],".exe"); -+ for (i = 1; i < argc; i++) -+ newargz[i+1] = xstrdup(argv[i]); -+ newargz[argc+1] = NULL; -+EOF -+ -+ cat >> $cwrappersource <> $cwrappersource <<"EOF" -+ return 127; -+} -+ -+void * -+xmalloc (size_t num) -+{ -+ void * p = (void *) malloc (num); -+ if (!p) -+ lt_fatal ("Memory exhausted"); -+ -+ return p; -+} -+ -+char * -+xstrdup (const char *string) -+{ -+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -+; -+} -+ -+char * -+basename (const char *name) -+{ -+ const char *base; -+ -+#if defined (HAVE_DOS_BASED_FILE_SYSTEM) -+ /* Skip over the disk name in MSDOS pathnames. */ -+ if (isalpha (name[0]) && name[1] == ':') -+ name += 2; -+#endif -+ -+ for (base = name; *name; name++) -+ if (IS_DIR_SEPARATOR (*name)) -+ base = name + 1; -+ return (char *) base; -+} -+ -+char * -+fnqualify(const char *path) -+{ -+ size_t size; -+ char *p; -+ char tmp[LT_PATHMAX + 1]; -+ -+ assert(path != NULL); -+ -+ /* Is it qualified already? */ -+#if defined (HAVE_DOS_BASED_FILE_SYSTEM) -+ if (isalpha (path[0]) && path[1] == ':') -+ return xstrdup (path); -+#endif -+ if (IS_DIR_SEPARATOR (path[0])) -+ return xstrdup (path); -+ -+ /* prepend the current directory */ -+ /* doesn't handle '~' */ -+ if (getcwd (tmp, LT_PATHMAX) == NULL) -+ lt_fatal ("getcwd failed"); -+ size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ -+ p = XMALLOC(char, size); -+ sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); -+ return p; -+} -+ -+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; -+} -+ -+static void -+lt_error_core (int exit_status, const char * mode, -+ const char * message, va_list ap) -+{ -+ fprintf (stderr, "%s: %s: ", program_name, mode); -+ vfprintf (stderr, message, ap); -+ fprintf (stderr, ".\n"); -+ -+ if (exit_status >= 0) -+ exit (exit_status); -+} -+ -+void -+lt_fatal (const char *message, ...) -+{ -+ va_list ap; -+ va_start (ap, message); -+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap); -+ va_end (ap); -+} -+EOF -+ # we should really use a build-platform specific compiler -+ # here, but OTOH, the wrappers (shell script and this C one) -+ # are only useful if you want to execute the "real" binary. -+ # Since the "real" binary is built for $host, then this -+ # wrapper might as well be built for $host, too. -+ $run $LTCC -s -o $cwrapper $cwrappersource -+ ;; -+ esac - $rm $output -- trap "$rm $output; exit 1" 1 2 15 -+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ - #! $SHELL -@@ -3630,12 +4922,12 @@ - - # Sed substitution that helps us do robust quoting. It backslashifies - # metacharacters that are still active within double-quoted strings. --Xsed='sed -e 1s/^X//' -+Xsed='${SED} -e 1s/^X//' - sed_quote_subst='$sed_quote_subst' - - # The HP-UX ksh and POSIX shell print the target directory to stdout - # if CDPATH is set. --if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi -+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - relink_command=\"$relink_command\" - -@@ -3668,7 +4960,7 @@ - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. -- file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` -+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - -@@ -3681,7 +4973,7 @@ - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` -- file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` -+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. -@@ -3690,12 +4982,12 @@ - " - - if test "$fast_install" = yes; then -- echo >> $output "\ -+ $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ -- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ -+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" -@@ -3706,7 +4998,7 @@ - $rm \"\$progdir/\$file\" - fi" - -- echo >> $output "\ -+ $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then -@@ -3714,7 +5006,7 @@ - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" -- exit 1 -+ exit $EXIT_FAILURE - fi - fi - -@@ -3724,13 +5016,13 @@ - $rm \"\$progdir/\$file\" - fi" - else -- echo >> $output "\ -+ $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" - " - fi - -- echo >> $output "\ -+ $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - -@@ -3761,47 +5053,35 @@ - # Run the actual program with our arguments. - " - case $host in -- # win32 systems need to use the prog path for dll -- # lookup to work -- *-*-cygwin* | *-*-pw32*) -- $echo >> $output "\ -- exec \$progdir/\$program \${1+\"\$@\"} --" -- ;; -- - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ -- exec \$progdir\\\\\$program \${1+\"\$@\"} -+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} - " - ;; - - *) - $echo >> $output "\ -- # Export the path to the program. -- PATH=\"\$progdir:\$PATH\" -- export PATH -- -- exec \$program \${1+\"\$@\"} -+ exec \"\$progdir/\$program\" \${1+\"\$@\"} - " - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" -- exit 1 -+ exit $EXIT_FAILURE - fi - else - # The program doesn't exist. -- \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 -+ \$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 -+ $echo \"See the $PACKAGE documentation for more information.\" 1>&2 -+ exit $EXIT_FAILURE - fi - fi\ - " - chmod +x $output - fi -- exit 0 -+ exit $EXIT_SUCCESS - ;; - esac - -@@ -3817,74 +5097,130 @@ - oldobjs="$libobjs_save" - build_libtool_libs=no - else -- oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` -+ oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" -- $show "${rm}r $gentop" -- $run ${rm}r "$gentop" -- $show "mkdir $gentop" -- $run mkdir "$gentop" -- status=$? -- if test "$status" -ne 0 && test ! -d "$gentop"; then -- exit $status -- fi - generated="$generated $gentop" - -- # Add in members from convenience archives. -- for xlib in $addlibs; do -- # Extract the objects. -- case $xlib in -- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; -- *) xabs=`pwd`"/$xlib" ;; -- esac -- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` -- xdir="$gentop/$xlib" -- -- $show "${rm}r $xdir" -- $run ${rm}r "$xdir" -- $show "mkdir $xdir" -- $run mkdir "$xdir" -- status=$? -- if test "$status" -ne 0 && test ! -d "$xdir"; then -- exit $status -- fi -- $show "(cd $xdir && $AR x $xabs)" -- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? -- -- oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` -- done -+ func_extract_archives $gentop $addlibs -+ oldobjs="$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 -- eval cmds=\"$old_archive_from_new_cmds\" -+ cmds=$old_archive_from_new_cmds - else -- # Ensure that we have .o objects in place in case we decided -- # not to build a shared library, and have fallen back to building -- # static libs even though --disable-static was passed! -- for oldobj in $oldobjs; do -- if test ! -f $oldobj; then -- xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` -- if test "X$xdir" = "X$oldobj"; then -- xdir="." -- else -- xdir="$xdir" -+ # 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 -+ $echo "X$obj" | $Xsed -e 's%^.*/%%' -+ done | sort | sort -uc >/dev/null 2>&1); then -+ : -+ else -+ $echo "copying selected object files to avoid basename conflicts..." -+ -+ if test -z "$gentop"; then -+ gentop="$output_objdir/${outputname}x" -+ generated="$generated $gentop" -+ -+ $show "${rm}r $gentop" -+ $run ${rm}r "$gentop" -+ $show "$mkdir $gentop" -+ $run $mkdir "$gentop" -+ status=$? -+ if test "$status" -ne 0 && test ! -d "$gentop"; then -+ exit $status - fi -- baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` -- obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` -- $show "(cd $xdir && ${LN_S} $obj $baseobj)" -- $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi -- done -+ -+ save_oldobjs=$oldobjs -+ oldobjs= -+ counter=1 -+ for obj in $save_oldobjs -+ do -+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` -+ case " $oldobjs " in -+ " ") oldobjs=$obj ;; -+ *[\ /]"$objbase "*) -+ while :; do -+ # Make sure we don't pick an alternate name that also -+ # overlaps. -+ newobj=lt$counter-$objbase -+ counter=`expr $counter + 1` -+ case " $oldobjs " in -+ *[\ /]"$newobj "*) ;; -+ *) if test ! -f "$gentop/$newobj"; then break; fi ;; -+ esac -+ done -+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" -+ $run ln "$obj" "$gentop/$newobj" || -+ $run cp "$obj" "$gentop/$newobj" -+ oldobjs="$oldobjs $gentop/$newobj" -+ ;; -+ *) oldobjs="$oldobjs $obj" ;; -+ esac -+ done -+ fi - - eval cmds=\"$old_archive_cmds\" -+ -+ if len=`expr "X$cmds" : ".*"` && -+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then -+ cmds=$old_archive_cmds -+ else -+ # the command line is too long to link in one step, link in parts -+ $echo "using piecewise archive linking..." -+ save_RANLIB=$RANLIB -+ RANLIB=: -+ objlist= -+ concat_cmds= -+ save_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 -+ for obj in $save_oldobjs -+ do -+ oldobjs="$objlist $obj" -+ objlist="$objlist $obj" -+ eval test_cmds=\"$old_archive_cmds\" -+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && -+ test "$len" -le "$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= -+ 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 - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do -+ eval cmd=\"$cmd\" - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? -@@ -3916,8 +5252,12 @@ - fi - done - # Quote the link command for shipping. -- relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" -+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` -+ if test "$hardcode_automatic" = yes ; then -+ relink_command= -+ fi -+ - - # Only create the output if not a dry run. - if test -z "$run"; then -@@ -3933,10 +5273,10 @@ - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` -- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` -+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; -@@ -3947,10 +5287,10 @@ - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` -- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` -+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" - done -@@ -3958,20 +5298,39 @@ - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` -- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` -+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" -+ else -+ newdlfiles= -+ for lib in $dlfiles; do -+ case $lib in -+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; -+ *) abs=`pwd`"/$lib" ;; -+ esac -+ newdlfiles="$newdlfiles $abs" -+ done -+ dlfiles="$newdlfiles" -+ newdlprefiles= -+ for lib in $dlprefiles; do -+ case $lib in -+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; -+ *) abs=`pwd`"/$lib" ;; -+ esac -+ newdlprefiles="$newdlprefiles $abs" -+ done -+ dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in -- *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; -+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ - # $outputname - a libtool library file -@@ -4000,6 +5359,9 @@ - # 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' -@@ -4019,7 +5381,7 @@ - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac -- exit 0 -+ exit $EXIT_SUCCESS - ;; - - # libtool install mode -@@ -4030,11 +5392,11 @@ - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. -- $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then -+ $echo "X$nonopt" | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in -- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac -@@ -4043,14 +5405,14 @@ - shift - else - install_prog= -- arg="$nonopt" -+ arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in -- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac -@@ -4068,28 +5430,31 @@ - do - if test -n "$dest"; then - files="$files $dest" -- dest="$arg" -+ dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; -- -f) prev="-f" ;; -- -g) prev="-g" ;; -- -m) prev="-m" ;; -- -o) prev="-o" ;; -+ -f) -+ case " $install_prog " in -+ *[\\\ /]cp\ *) ;; -+ *) prev=$arg ;; -+ esac -+ ;; -+ -g | -m | -o) prev=$arg ;; - -s) - stripme=" -s" - continue - ;; -- -*) ;; -- -+ -*) -+ ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else -- dest="$arg" -+ dest=$arg - continue - fi - ;; -@@ -4098,7 +5463,7 @@ - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in -- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) -+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac -@@ -4108,13 +5473,13 @@ - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - if test -z "$files"; then -@@ -4124,7 +5489,7 @@ - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. -@@ -4145,7 +5510,7 @@ - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - fi - case $destdir in -@@ -4157,7 +5522,7 @@ - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - done -@@ -4182,11 +5547,11 @@ - - *.la) - # Check to see that this really is a libtool archive. -- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : -+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - library_names= -@@ -4218,21 +5583,24 @@ - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. -- inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` -+ inst_prefix_dir=`$echo "$destdir" | $SED "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. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - 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%"` -+ 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@%%"` -+ relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 -@@ -4240,7 +5608,7 @@ - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - fi - -@@ -4264,23 +5632,36 @@ - - 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 - if test "$linkname" != "$realname"; then -- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" -- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" -+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" -+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" -- eval cmds=\"$postinstall_cmds\" -+ cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" -- $run eval "$cmd" || exit $? -+ $run eval "$cmd" || { -+ lt_exit=$? -+ -+ # Restore the uninstalled library and exit -+ if test "$mode" = relink; then -+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' -+ fi -+ -+ exit $lt_exit -+ } - done - IFS="$save_ifs" - fi -@@ -4318,7 +5699,7 @@ - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - -@@ -4336,7 +5717,7 @@ - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi -- exit 0 -+ exit $EXIT_SUCCESS - ;; - - *) -@@ -4348,21 +5729,47 @@ - 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 -+ file=`$echo $file|${SED} 's,.exe$,,'` -+ stripped_ext=".exe" -+ fi -+ ;; -+ esac -+ - # Do a test to see if this is really a libtool program. -- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -+ case $host in -+ *cygwin*|*mingw*) -+ wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` -+ ;; -+ *) -+ wrapper=$file -+ ;; -+ esac -+ if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - -+ # Note that it is not necessary on cygwin/mingw to append a dot to -+ # foo even if both foo 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. -+ # - # If there is no directory component, then add one. -- case $file in -- */* | *\\*) . $file ;; -- *) . ./$file ;; -+ case $wrapper in -+ */* | *\\*) . ${wrapper} ;; -+ *) . ./${wrapper} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then -- $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 -- exit 1 -+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 -+ exit $EXIT_FAILURE - fi - - finalize=yes -@@ -4384,10 +5791,15 @@ - done - - relink_command= -+ # Note that it is not necessary on cygwin/mingw to append a dot to -+ # foo even if both foo 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. -+ # - # If there is no directory component, then add one. -- case $file in -- */* | *\\*) . $file ;; -- *) . ./$file ;; -+ case $wrapper in -+ */* | *\\*) . ${wrapper} ;; -+ *) . ./${wrapper} ;; - esac - - outputname= -@@ -4395,17 +5807,17 @@ - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" -- tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` -- if test $? = 0 ; then : -- else -- tmpdir="$tmpdir/libtool-$$" -- fi -- if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : -+ tmpdir="$tmpdir/libtool-$$" -+ save_umask=`umask` -+ umask 0077 -+ if $mkdir "$tmpdir"; then -+ umask $save_umask - else -+ umask $save_umask - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi -- file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` -+ file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` -@@ -4423,14 +5835,14 @@ - fi - else - # Install the binary that we compiled earlier. -- file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` -+ file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another -- # one anyways -+ # one anyway - case $install_prog,$host in -- /usr/bin/install*,*cygwin*) -+ */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok -@@ -4439,7 +5851,7 @@ - destfile=$destfile.exe - ;; - *:*.exe) -- destfile=`echo $destfile | sed -e 's,.exe$,,'` -+ destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; -@@ -4460,16 +5872,17 @@ - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - -- if test -n "$stripme" && test -n "$striplib"; then -+ if test -n "$stripme" && test -n "$old_striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. -- eval cmds=\"$old_postinstall_cmds\" -+ cmds=$old_postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done -@@ -4483,9 +5896,9 @@ - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" -- exec_cmd='$SHELL $0 --finish$current_libdirs' -+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else -- exit 0 -+ exit $EXIT_SUCCESS - fi - ;; - -@@ -4504,10 +5917,11 @@ - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. -- eval cmds=\"$finish_cmds\" -+ cmds=$finish_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" -@@ -4524,43 +5938,43 @@ - fi - - # Exit here if they wanted silent mode. -- test "$show" = : && exit 0 -+ test "$show" = : && exit $EXIT_SUCCESS - -- echo "----------------------------------------------------------------------" -- echo "Libraries have been installed in:" -+ $echo "----------------------------------------------------------------------" -+ $echo "Libraries have been installed in:" - for libdir in $libdirs; do -- echo " $libdir" -+ $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:" -+ $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" -+ $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" -+ $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" -+ $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then -- echo " - have your system administrator run these commands:$admincmds" -+ $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'" -+ $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi -- echo -- echo "See any operating system documentation about shared libraries for" -- echo "more information, such as the ld(1) and ld.so(8) manual pages." -- echo "----------------------------------------------------------------------" -- exit 0 -+ $echo -+ $echo "See any operating system documentation about shared libraries for" -+ $echo "more information, such as the ld(1) and ld.so(8) manual pages." -+ $echo "----------------------------------------------------------------------" -+ exit $EXIT_SUCCESS - ;; - - # libtool execute mode -@@ -4572,7 +5986,7 @@ - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. -@@ -4580,18 +5994,18 @@ - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. -- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : -+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - # Read the libtool library. -@@ -4618,7 +6032,7 @@ - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - ;; - -@@ -4658,7 +6072,7 @@ - -*) ;; - *) - # Do a test to see if this is really a libtool program. -- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; -@@ -4681,7 +6095,7 @@ - eval "export $shlibpath_var" - fi - -- # Restore saved enviroment variables -+ # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi -@@ -4698,7 +6112,7 @@ - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" -- exit 0 -+ exit $EXIT_SUCCESS - fi - ;; - -@@ -4726,18 +6140,19 @@ - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - - rmdirs= - -+ origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. -- objdir="$objdir" -+ objdir="$origobjdir" - else -- objdir="$dir/$objdir" -+ objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" -@@ -4767,7 +6182,7 @@ - case $name in - *.la) - # Possibly a libtool archive, so verify it. -- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. -@@ -4780,10 +6195,11 @@ - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. -- eval cmds=\"$postuninstall_cmds\" -+ cmds=$postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then -@@ -4795,10 +6211,11 @@ - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. -- eval cmds=\"$old_postuninstall_cmds\" -+ cmds=$old_postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" -+ eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then -@@ -4813,22 +6230,52 @@ - ;; - - *.lo) -- if test "$build_old_libs" = yes; then -- oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` -- rmfiles="$rmfiles $dir/$oldobj" -+ # Possibly a libtool object, so verify it. -+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -+ -+ # Read the .lo file -+ . $dir/$name -+ -+ # Add PIC object to the list of files to remove. -+ if test -n "$pic_object" \ -+ && test "$pic_object" != none; then -+ rmfiles="$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 -+ rmfiles="$rmfiles $dir/$non_pic_object" -+ fi - fi - ;; - - *) -- # Do a test to see if this is a libtool program. -- if test "$mode" = clean && -- (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -- relink_command= -- . $dir/$file -+ if test "$mode" = clean ; then -+ noexename=$name -+ case $file in -+ *.exe) -+ file=`$echo $file|${SED} 's,.exe$,,'` -+ noexename=`$echo $name|${SED} 's,.exe$,,'` -+ # $file with .exe has already been added to rmfiles, -+ # add $file without .exe -+ rmfiles="$rmfiles $file" -+ ;; -+ esac -+ # Do a test to see if this is a libtool program. -+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then -+ relink_command= -+ . $dir/$noexename - -- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" -- if test "$fast_install" = yes && test -n "$relink_command"; then -- rmfiles="$rmfiles $objdir/lt-$name" -+ # note $name still contains .exe if it was in $file originally -+ # as does the version of $file that was added into $rmfiles -+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" -+ if test "$fast_install" = yes && test -n "$relink_command"; then -+ rmfiles="$rmfiles $objdir/lt-$name" -+ fi -+ if test "X$noexename" != "X$name" ; then -+ rmfiles="$rmfiles $objdir/lt-${noexename}.c" -+ fi - fi - fi - ;; -@@ -4836,6 +6283,7 @@ - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done -+ objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do -@@ -4851,20 +6299,20 @@ - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - fi - fi # test -z "$show_help" - - if test -n "$exec_cmd"; then - eval exec $exec_cmd -- exit 1 -+ exit $EXIT_FAILURE - fi - - # We need to display help for each of the modes. -@@ -4883,6 +6331,7 @@ - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages -+ --tag=TAG use configuration variables from tag TAG - --version print version information - - MODE must be one of the following: -@@ -4896,8 +6345,10 @@ - uninstall remove libraries from an installed directory - - MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for --a more detailed description of MODE." -- exit 0 -+a more detailed description of MODE. -+ -+Report bugs to ." -+ exit $EXIT_SUCCESS - ;; - - clean) -@@ -5008,6 +6459,9 @@ - -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 -@@ -5049,14 +6503,34 @@ - *) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 -- exit 1 -+ exit $EXIT_FAILURE - ;; - esac - --echo -+$echo - $echo "Try \`$modename --help' for more information about other modes." - --exit 0 -+exit $? -+ -+# 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 ---- gsmlib-1.10.orig/doc/gsmsmsstore.man -+++ gsmlib-1.10/doc/gsmsmsstore.man -@@ -15,36 +15,36 @@ - gsmsmsstore \- SMS store manipulation program - .SH SYNOPSIS - .B gsmsmsstore --[ \fB-a\fP ] --[ \fB--add\fP ] --[ \fB-b\fP \fIbaudrate\fP ] --[ \fB--baudrate\fP \fIbaudrate\fP ] --[ \fB-c\fP ] --[ \fB--copy\fP ] --[ \fB-C\fP \fIservice centre address\fP ] --[ \fB--sca\fP \fIservice centre address\fP ] --[ \fB-d\fP \fIdestination device or file\fP ] --[ \fB--destination\fP \fIdestination device or file\fP ] --[ \fB-h\fP ] --[ \fB--help\fP ] --[ \fB-I\fP \fIinit string\fP ] --[ \fB--init\fP \fIinit string\fP ] --[ \fB-k\fP ] --[ \fB--backup\fP ] --[ \fB-l\fP ] --[ \fB--list\fP ] --[ \fB-s\fP \fIsource device or file\fP ] --[ \fB--source\fP \fIsource device or file\fP ] --[ \fB-t\fP \fISMS store name\fP ] --[ \fB--store\fP \fISMS store name\fP ] --[ \fB-v\fP ] --[ \fB--version\fP ] --[ \fB-V\fP ] --[ \fB--verbose\fP ] --[ \fB-x\fP ] --[ \fB--delete\fP ] --[ \fB-X\fP ] --[ \fB--xonxoff\fP ] -+[ \fB\-a\fP ] -+[ \fB\-\-add\fP ] -+[ \fB\-b\fP \fIbaudrate\fP ] -+[ \fB\-\-baudrate\fP \fIbaudrate\fP ] -+[ \fB\-c\fP ] -+[ \fB\-\-copy\fP ] -+[ \fB\-C\fP \fIservice centre address\fP ] -+[ \fB\-\-sca\fP \fIservice centre address\fP ] -+[ \fB\-d\fP \fIdestination device or file\fP ] -+[ \fB\-\-destination\fP \fIdestination device or file\fP ] -+[ \fB\-h\fP ] -+[ \fB\-\-help\fP ] -+[ \fB\-I\fP \fIinit string\fP ] -+[ \fB\-\-init\fP \fIinit string\fP ] -+[ \fB\-k\fP ] -+[ \fB\-\-backup\fP ] -+[ \fB\-l\fP ] -+[ \fB\-\-list\fP ] -+[ \fB\-s\fP \fIsource device or file\fP ] -+[ \fB\-\-source\fP \fIsource device or file\fP ] -+[ \fB\-t\fP \fISMS store name\fP ] -+[ \fB\-\-store\fP \fISMS store name\fP ] -+[ \fB\-v\fP ] -+[ \fB\-\-version\fP ] -+[ \fB\-V\fP ] -+[ \fB\-\-verbose\fP ] -+[ \fB\-x\fP ] -+[ \fB\-\-delete\fP ] -+[ \fB\-X\fP ] -+[ \fB\-\-xonxoff\fP ] - { \fIindices\fP } - [ \fIphonenumber\fP \fItext\fP ] - .PP -@@ -57,19 +57,19 @@ - \fIgsmsmsstore\fP reads entries from the source which can be a mobile - phone (if a serial device file is given) or a file (if a file name is - given). The source is never modified. \fIgsmsmsstore\fP writes SMS --messages to a destination file or device in the case of \fB--copy\fP, --\fB--backup\fP, and \fB--add\fP. -+messages to a destination file or device in the case of \fB\-\-copy\fP, -+\fB\-\-backup\fP, and \fB\-\-add\fP. - .PP --The \fB--list\fP option does not change any file but just lists the -+The \fB\-\-list\fP option does not change any file but just lists the - contents to standard output. - .PP --The \fB--backup\fP and \fB--copy\fP options require both source and --destination files or devices. The \fB--list\fP option requires a --source. The \fB--add\fP and \fB--delete\fP options require a -+The \fB\-\-backup\fP and \fB\-\-copy\fP options require both source and -+destination files or devices. The \fB\-\-list\fP option requires a -+source. The \fB\-\-add\fP and \fB\-\-delete\fP options require a - destination file or device. - .PP --If "-" is given as the parameter for the \fB--source\fP or --\fB--destination\fP options, the SMS store is read from standard input -+If "\-" is given as the parameter for the \fB\-\-source\fP or -+\fB\-\-destination\fP options, the SMS store is read from standard input - and/or written to standard output, respectively. - .PP - SMS message files are not human-readable. -@@ -79,61 +79,61 @@ - .PP - .SH OPTIONS - .TP --\fB-a\fP, \fB--add\fP -+\fB\-a\fP, \fB\-\-add\fP - Adds an SMS submit message with recipient address \fIphonenumber\fP and - text \fItext\fP to the destination. - .TP --\fB-b\fP \fIbaudrate\fP, \fB--baudrate\fP \fIbaudrate\fP -+\fB\-b\fP \fIbaudrate\fP, \fB\-\-baudrate\fP \fIbaudrate\fP - The baud rate to use. The default baudrate is 38400. - .TP --\fB-c\fP, \fB--copy\fP -+\fB\-c\fP, \fB\-\-copy\fP - This causes the contents of the source to be copied to the - destination. After this operation the destination has exactly the same - contents as the source. If \fIindices\fP are given on the command - line only those SMS messages denoted by the indices are copied to the - destination. - .TP --\fB-C\fP \fIservice centre address\fP, \fB--sca\fP \fIservice centre address\fP -+\fB\-C\fP \fIservice centre address\fP, \fB\-\-sca\fP \fIservice centre address\fP - Sets the service centre address to use for all SUBMIT SMSs (may not - work with some phones). - .TP --\fB-d\fP \fIdestination\fP, \fB--destination\fP \fIdestination\fP -+\fB\-d\fP \fIdestination\fP, \fB\-\-destination\fP \fIdestination\fP - The destination device or file. - .TP --\fB-h\fP, \fB--help\fP -+\fB\-h\fP, \fB\-\-help\fP - Prints an option summary. - .TP --\fB-I\fP \fIinit string\fP, \fB--init\fP \fIinit string\fP -+\fB\-I\fP \fIinit string\fP, \fB\-\-init\fP \fIinit string\fP - Initialization string to send to the TA (default: "E0"). Note that the - sequence "ATZ" is sent first. - .TP --\fB-k\fP, \fB--backup\fP -+\fB\-k\fP, \fB\-\-backup\fP - This causes those entries to be added from the source to the - destination that are not already present in the destination. If - \fIindices\fP are given on the command line only those SMS messages - denoted by the indices are backed up (ie. added) to the destination. - .TP --\fB-l\fP, \fB--list\fP -+\fB\-l\fP, \fB\-\-list\fP - Prints out the entire contents of the source in human-readable form. - .TP --\fB-s\fP \fIsource\fP, \fB--source\fP \fIsource\fP -+\fB\-s\fP \fIsource\fP, \fB\-\-source\fP \fIsource\fP - The source device or file. - .TP --\fB-t\fP \fISMS store name\fP, \fB--store\fP \fISMS store name\fP -+\fB\-t\fP \fISMS store name\fP, \fB\-\-store\fP \fISMS store name\fP - The name of the SMS store to read from or write to. This information is - only used for device sources and destinations. A commonly available message - store is "SM" (SIM card). - .TP --\fB-v\fP, \fB--version\fP -+\fB\-v\fP, \fB\-\-version\fP - Prints the program version. - .TP --\fB-V\fP, \fB--verbose\fP -+\fB\-V\fP, \fB\-\-verbose\fP - Prints out a detailed progress report. - .TP --\fB-x\fP, \fB--delete\fP -+\fB\-x\fP, \fB\-\-delete\fP - Delete the SMS messages as denoted by the \fIindices\fP from the destination. - .TP --\fB-X\fP, \fB--xonxoff\fP -+\fB\-X\fP, \fB\-\-xonxoff\fP - Uses software handshaking (XON/XOFF) for accessing the device. - .PP - .SH EXAMPLES -@@ -141,15 +141,15 @@ - to \fI/dev/mobilephone\fP to the standard output: - .PP - .nf --gsmsmsstore -b 19200 -s /dev/mobilephone -t SM -l -+gsmsmsstore \-b 19200 \-s /dev/mobilephone \-t SM \-l - .fi - .PP - The following adds entries 4, 7, and 10 from the device - \fI/dev/mobilephone\fP to the file \fIsmsstore\fP: - .PP - .nf --gsmsmsstore -s /dev/mobilephone -d /home/fred/smsstore -- -t SM -b 4 7 10 -+gsmsmsstore \-s /dev/mobilephone \-d /home/fred/smsstore -+ \-t SM \-b 4 7 10 - .fi - .PP - .SH AUTHOR ---- gsmlib-1.10.orig/doc/gsmsmsd.man -+++ gsmlib-1.10/doc/gsmsmsd.man -@@ -17,34 +17,34 @@ - .PP - .SH SYNOPSIS - .B gsmsmsd --[ \fB-a\fP \fIaction\fP ] --[ \fB--action\fP \fIaction\fP ] --[ \fB-b\fP \fIbaudrate\fP ] --[ \fB--baudrate\fP \fIbaudrate\fP ] --[ \fB-c\fP \fIconcatenatedID\fP ] --[ \fB--concatenate\fP \fIconcatenatedID\fP ] --[ \fB-C\fP \fIservice centre address\fP ] --[ \fB--sca\fP \fIservice centre address\fP ] --[ \fB-d\fP \fIdevice\fP ] --[ \fB--device\fP \fIdevice\fP ] --[ \fB-D\fP ] --[ \fB--direct\fP ] --[ \fB-f\fP ] --[ \fB--flush\fP ] --[ \fB-h\fP ] --[ \fB--help\fP ] --[ \fB-I\fP \fIinit string\fP ] --[ \fB--init\fP \fIinit string\fP ] --[ \fB-r\fP ] --[ \fB--requeststat\fP ] --[ \fB-s\fP \fIspool directory\fP ] --[ \fB--spool\fP \fIspool directory\fP ] --[ \fB-t\fP \fISMS store name\fP ] --[ \fB--store\fP \fISMS store name\fP ] --[ \fB-v\fP ] --[ \fB--version\fP ] --[ \fB-X\fP ] --[ \fB--xonxoff\fP ] -+[ \fB\-a\fP \fIaction\fP ] -+[ \fB\-\-action\fP \fIaction\fP ] -+[ \fB\-b\fP \fIbaudrate\fP ] -+[ \fB\-\-baudrate\fP \fIbaudrate\fP ] -+[ \fB\-c\fP \fIconcatenatedID\fP ] -+[ \fB\-\-concatenate\fP \fIconcatenatedID\fP ] -+[ \fB\-C\fP \fIservice centre address\fP ] -+[ \fB\-\-sca\fP \fIservice centre address\fP ] -+[ \fB\-d\fP \fIdevice\fP ] -+[ \fB\-\-device\fP \fIdevice\fP ] -+[ \fB\-D\fP ] -+[ \fB\-\-direct\fP ] -+[ \fB\-f\fP ] -+[ \fB\-\-flush\fP ] -+[ \fB\-h\fP ] -+[ \fB\-\-help\fP ] -+[ \fB\-I\fP \fIinit string\fP ] -+[ \fB\-\-init\fP \fIinit string\fP ] -+[ \fB\-r\fP ] -+[ \fB\-\-requeststat\fP ] -+[ \fB\-s\fP \fIspool directory\fP ] -+[ \fB\-\-spool\fP \fIspool directory\fP ] -+[ \fB\-t\fP \fISMS store name\fP ] -+[ \fB\-\-store\fP \fISMS store name\fP ] -+[ \fB\-v\fP ] -+[ \fB\-\-version\fP ] -+[ \fB\-X\fP ] -+[ \fB\-\-xonxoff\fP ] - { \fIsms_type\fP } - .PP - .SH DESCRIPTION -@@ -65,10 +65,10 @@ - \fIgsmsmsd\fP needs one empty storage slot for SMS messages in the - mobile phone, otherwise SMS reception will not work. The SMS store to - use for temporary storage of incoming SMS can be selected using the --\fB--store\fP option, otherwise the ME default store is used. -+\fB\-\-store\fP option, otherwise the ME default store is used. - .PP - To terminate \fIgsmsmsd\fP cleanly (without losing SMS messages) one --should send either SIGINT (CTRL-C on the command line) or SIGTERM to -+should send either SIGINT (CTRL\-C on the command line) or SIGTERM to - the process. - .PP - Error messages are printed to the standard error output. If the program -@@ -89,14 +89,14 @@ - .PP - .SH OPTIONS - .TP --\fB-a\fP \fIaction\fP, \fB--action\fP \fIaction\fP -+\fB\-a\fP \fIaction\fP, \fB\-\-action\fP \fIaction\fP - The action to execute for each incoming SMS message. If no action - is given the SMS is written to the standard output. - .TP --\fB-b\fP \fIbaudrate\fP, \fB--baudrate\fP \fIbaudrate\fP -+\fB\-b\fP \fIbaudrate\fP, \fB\-\-baudrate\fP \fIbaudrate\fP - The baud rate to use. - .TP --\fB-c\fP \fIconcatenatedID\fP, \fB--concatenate\fP \fIconcatenatedID\fP -+\fB\-c\fP \fIconcatenatedID\fP, \fB\-\-concatenate\fP \fIconcatenatedID\fP - If an ID is given, large SMSs are split into several, concatenated - SMSs. All SMSs have the same ID and are numbered consecutively so that - the receiving phone can assemble them in the correct order. IDs must -@@ -108,43 +108,43 @@ - carried in the user data header element at the beginning of the SMS - user data. This information may show up as garbage in such phones. - .TP --\fB-C\fP \fIservice centre address\fP, \fB--sca\fP \fIservice centre address\fP -+\fB\-C\fP \fIservice centre address\fP, \fB\-\-sca\fP \fIservice centre address\fP - Sets the service centre address to use for all SUBMIT SMSs (may not - work with some phones). - .TP --\fB-d\fP \fIdevice\fP, \fB--device\fP \fIdevice\fP -+\fB\-d\fP \fIdevice\fP, \fB\-\-device\fP \fIdevice\fP - The device to which the GSM modem is connected. The default is - \fI/dev/mobilephone\fP. - .TP --\fB-D\fP, \fB--direct\fP -+\fB\-D\fP, \fB\-\-direct\fP - Enables direct routing of incoming SMS messages to the TE. This is not - supported by many mobile phone/GSM modem combinations. Therefore, the - default is to store incoming SMS temporarily before processing them in - the indicated store. - .TP --\fB-f\fP, \fB--flush\fP -+\fB\-f\fP, \fB\-\-flush\fP - This option causes \fIgsmsmsd\fP to flush (ie. read and erase) - existing SMS messages from --the SMS store selected by the \fB--store\fP option. The action given --by the \fB--action\fP option is executed on each of the flushed -+the SMS store selected by the \fB\-\-store\fP option. The action given -+by the \fB\-\-action\fP option is executed on each of the flushed - SMS. This option should be used to ensure that enough space is - available in the SMS store for temporary storage of incoming SMS, - otherwise incoming SMS might be ignored silently by the ME. - .TP --\fB-h\fP, \fB--help\fP -+\fB\-h\fP, \fB\-\-help\fP - Prints an option summary. - .TP --\fB-I\fP \fIinit string\fP, \fB--init\fP \fIinit string\fP -+\fB\-I\fP \fIinit string\fP, \fB\-\-init\fP \fIinit string\fP - Initialization string to send to the TA (default: "E0"). Note that the - sequence "ATZ" is sent first. - .TP --\fB-r\fP, \fB--requeststat\fP -+\fB\-r\fP, \fB\-\-requeststat\fP - Request status reports for sent SMS. Note: This option only makes - sense if the phone supports routing of status reports to the - TE. Otherwise the status reports might show on the phone's display or - get lost. - .TP --\fB-s\fP \fIspool directory\fP, \fB--spool\fP \fIspool directory\fP -+\fB\-s\fP \fIspool directory\fP, \fB\-\-spool\fP \fIspool directory\fP - This option sets the spool directory where \fIgsmsmsd\fP expects SMS - messages to send. The format of SMS files is very simple: The first - line contains the phone number of the recipient. Everything else after -@@ -154,18 +154,18 @@ - \fIgsmsmsd\fP polls the spool directory every 5 seconds. Sent - SMS message files are removed. - .TP --\fB-t\fP \fISMS store name\fP, \fB--store\fP \fISMS store name\fP --The name of the SMS store to read from (for the \fB--flush\fP option) -+\fB\-t\fP \fISMS store name\fP, \fB\-\-store\fP \fISMS store name\fP -+The name of the SMS store to read from (for the \fB\-\-flush\fP option) - or write to (for temporary SMS storage). This option must --be must be used in conjunction with the \fB--flush\fP option. If this -+be must be used in conjunction with the \fB\-\-flush\fP option. If this - option is omitted the ME uses it's default SMS store for temporary - storage of incoming SMS. A commonly available message - store is "SM" (SIM card). - .TP --\fB-v\fP, \fB--version\fP -+\fB\-v\fP, \fB\-\-version\fP - Prints the program version. - .TP --\fB-X\fP, \fB--xonxoff\fP -+\fB\-X\fP, \fB\-\-xonxoff\fP - Uses software handshaking (XON/XOFF) for accessing the device. - .PP - .SH EXAMPLES -@@ -173,14 +173,14 @@ - as a mail to the user "smsadmin": - .PP - .nf --gsmsmsd -d /dev/ttyS2 -b 19200 -a "mail smsadmin" -+gsmsmsd \-d /dev/ttyS2 \-b 19200 \-a "mail smsadmin" - .fi - .PP - This is the format of SMS deliver messages as output from \fIgsmsmsd\fP: - .PP - .nf - ---------------------------------------------------------------- --Message type: SMS-DELIVER -+Message type: SMS\-DELIVER - SC address: '491710762100' - More messages to send: 1 - Reply path: 0 -@@ -202,7 +202,7 @@ - .PP - .nf - ---------------------------------------------------------------- --Message type: SMS-STATUS-REPORT -+Message type: SMS\-STATUS\-REPORT - SC address: '' - More messages to send: 0 - Status report qualifier: 0 -@@ -219,8 +219,8 @@ - directory for SMS to send: - .PP - .nf --gsmsmsd -d /dev/ttyS2 --spool /tmp/spooldir -f --store sm \\ ----action 'mail smsadmin' -+gsmsmsd \-d /dev/ttyS2 \-\-spool /tmp/spooldir \-f \-\-store sm \\ -+\-\-action 'mail smsadmin' - .fi - .PP - .SH FILES ---- gsmlib-1.10.orig/doc/gsmctl.man -+++ gsmlib-1.10/doc/gsmctl.man -@@ -1,6 +1,6 @@ - .TH GSMCTL 8 "##DATE##" "gsmctl v##VERSION##" - .SH NAME --gsmctl \- GSM mobile phone control program -+gsmctl, gsmsiectl \- GSM mobile phone control program - .SH SYNOPSIS - .B gsmctl - .RB [\| \-b -@@ -25,6 +25,30 @@ - .RB | \ \-\-operation - .IR operation \ | - .I parameters -+.PP -+.B gsmsiectl -+.RB [\| \-b -+.IR baudrate \|] -+.RB [\| \-\-baudrate -+.IR baudrate\| ] -+.RB [ \|\-d -+.IR device\| ] -+.RB [ \|\-\-device -+.IR device\fP ] -+.RB [ \|\-h\| ] -+.RB [ \|\-\-help\| ] -+.RB [ \|\-I -+.IR "init string" \|] -+.RB [ \|\-\-init -+.IR "init string" \|] -+.RB [ \|\-v\| ] -+.RB [ \|\-\-version\| ] -+.RB [ \|\-X\| ] -+.RB [ \|\-\-xonxoff\| ] -+.BI \-o \ operation -+.RB | \ \-\-operation -+.IR operation \ | -+.I parameters - .SH DESCRIPTION - .B gsmctl - can request information from or perform operations on an GSM mobile -@@ -38,7 +62,7 @@ - If no - .I device - is given, the device --.I/dev/mobilephone -+.I /dev/mobilephone - is used. If no - .I baudrate - is given, a default baud rate of 38400 is used. -@@ -61,6 +85,12 @@ - .B OPERATIONS - for more details. - .PP -+.B gsmsiectl -+is the same program with some extension for Siemens mobile phones. -+Some extra -+.B OPERATIONS -+are available in this case. -+.PP - Error messages are printed to the standard error output. If the - program terminates on error the error code 1 is returned. - .SH OPTIONS -@@ -252,14 +282,14 @@ - .I SIM PUK - ME is waiting SIM PUK to be given. - .TP --.I PH-SIM PIN --ME is waiting phone-to-SIM card password to be given. -+.I PH\-SIM PIN -+ME is waiting phone/-to/-SIM card password to be given. - .TP --.I PH-FSIM PIN --ME is waiting phone-to-very first SIM card password to be given. -+.I PH/-FSIM PIN -+ME is waiting phone/-to/-very first SIM card password to be given. - .TP --.I PH-FSIM PUK --ME is waiting phone-to-very first SIM card unblocking password to be -+.I PH/-FSIM PUK -+ME is waiting phone/-to/-very first SIM card unblocking password to be - given. - .TP - .I SIM PIN2 -@@ -268,13 +298,13 @@ - .I SIM PUK2 - ME is waiting SIM PUK2 to be given. - .TP --.I PH-NET PIN -+.I PH/-NET PIN - ME is waiting network personalisation password to be given. - .TP --.I PH-NET PUK -+.I PH/-NET PUK - ME is waiting network personalisation unblocking password to be given. - .TP --.I PH-NETSUB PIN -+.I PH/-NETSUB PIN - ME is waiting network subset personalisation password to be given. - .RE - .TP 7 -@@ -458,6 +488,33 @@ - This is the reverse operation to \fBlock\fP. See above for a - description of the parameters. - .RE -+.PP -+.B Extra operators for gsmsiectl: -+.PP -+.B cset -+.RS -+Charset info. -+.RE -+.PP -+.B pbook -+.RS -+Phone book info. -+.RE -+.PP -+.B signal -+.RS -+Signal tone info. -+.RE -+.PP -+.B ring -+.RS -+Ringing tone info. -+.RE -+.PP -+.B binary -+.RS -+Binary info. -+.RE - .SH EXAMPLES - The following invocation of - .I gsmctl -@@ -482,11 +539,11 @@ - .HP - Serial Number: 448058511817585 - .HP -- Status: available Long name: 'D1-TELEKOM' Short name: '' Numeric name: 26201 -+ Status: available Long name: 'D1/-TELEKOM' Short name: '' Numeric name: 26201 - .HP - Status: forbidden Long name: 'D2 PRIVAT' Short name: '' Numeric name: 26202 - .HP -- Long name: 'D1-TELEKOM' Short name: '' Numeric name: 26201 Mode: automatic -+ Long name: 'D1/-TELEKOM' Short name: '' Numeric name: 26201 Mode: automatic - .HP - 'CS' - .HP ---- gsmlib-1.10.orig/doc/gsmsendsms.man -+++ gsmlib-1.10/doc/gsmsendsms.man -@@ -17,26 +17,26 @@ - .PP - .SH SYNOPSIS - .B gsmsendsms --[ \fB-b\fP \fIbaudrate\fP ] --[ \fB--baudrate\fP \fIbaudrate\fP ] --[ \fB-c\fP \fIconcatenatedID\fP ] --[ \fB--concatenate\fP \fIconcatenatedID\fP ] --[ \fB-C\fP \fIservice centre address\fP ] --[ \fB--sca\fP \fIservice centre address\fP ] --[ \fB-d\fP \fIdevice\fP ] --[ \fB--device\fP \fIdevice\fP ] --[ \fB-h\fP ] --[ \fB--help\fP ] --[ \fB-I\fP \fIinit string\fP ] --[ \fB--init\fP \fIinit string\fP ] --[ \fB-r\fP ] --[ \fB--requeststat\fP ] --[ \fB-t\fP ] --[ \fB--test\fP ] --[ \fB-v\fP ] --[ \fB--version\fP ] --[ \fB-X\fP ] --[ \fB--xonxoff\fP ] -+[ \fB\-b\fP \fIbaudrate\fP ] -+[ \fB\-\-baudrate\fP \fIbaudrate\fP ] -+[ \fB\-c\fP \fIconcatenatedID\fP ] -+[ \fB\-\-concatenate\fP \fIconcatenatedID\fP ] -+[ \fB\-C\fP \fIservice centre address\fP ] -+[ \fB\-\-sca\fP \fIservice centre address\fP ] -+[ \fB\-d\fP \fIdevice\fP ] -+[ \fB\-\-device\fP \fIdevice\fP ] -+[ \fB\-h\fP ] -+[ \fB\-\-help\fP ] -+[ \fB\-I\fP \fIinit string\fP ] -+[ \fB\-\-init\fP \fIinit string\fP ] -+[ \fB\-r\fP ] -+[ \fB\-\-requeststat\fP ] -+[ \fB\-t\fP ] -+[ \fB\-\-test\fP ] -+[ \fB\-v\fP ] -+[ \fB\-\-version\fP ] -+[ \fB\-X\fP ] -+[ \fB\-\-xonxoff\fP ] - \fIphonenumber\fP - [ \fItext\fP ] - .PP -@@ -51,7 +51,7 @@ - \fIgsmsendsms\fP accepts a phone number (recipient address) and the - short message text as parameters. The text may have a maximum length - of 160 characters which is the maximum SMS message length. The GSM --default alphabet is used for encoding. ASCII and Latin-1 characters -+default alphabet is used for encoding. ASCII and Latin\-1 characters - that can not be encoded using the GSM default alphabet are converted - to the GSM delta character (GSM code 16). - .PP -@@ -60,10 +60,10 @@ - .PP - .SH OPTIONS - .TP --\fB-b\fP \fIbaudrate\fP, \fB--baudrate\fP \fIbaudrate\fP -+\fB\-b\fP \fIbaudrate\fP, \fB\-\-baudrate\fP \fIbaudrate\fP - The baud rate to use. - .TP --\fB-c\fP \fIconcatenatedID\fP, \fB--concatenate\fP \fIconcatenatedID\fP -+\fB\-c\fP \fIconcatenatedID\fP, \fB\-\-concatenate\fP \fIconcatenatedID\fP - If an ID is given, large SMSs are split into several, concatenated - SMSs. All SMSs have the same ID and are numbered consecutively so that - the receiving phone can assemble them in the correct order. IDs must -@@ -73,37 +73,37 @@ - carried in the user data header element at the beginning of the SMS - user data. This information may show up as garbage in such phones. - .TP --\fB-C\fP \fIservice centre address\fP, \fB--sca\fP \fIservice centre address\fP -+\fB\-C\fP \fIservice centre address\fP, \fB\-\-sca\fP \fIservice centre address\fP - Sets the service centre address to use for all SUBMIT SMSs (may not - work with some phones). - .TP --\fB-d\fP \fIdevice\fP, \fB--device\fP \fIdevice\fP -+\fB\-d\fP \fIdevice\fP, \fB\-\-device\fP \fIdevice\fP - The device to which the GSM modem is connected. The default is - \fI/dev/mobilephone\fP. - .TP --\fB-h\fP, \fB--help\fP -+\fB\-h\fP, \fB\-\-help\fP - Prints an option summary. - .TP --\fB-I\fP \fIinit string\fP, \fB--init\fP \fIinit string\fP -+\fB-I\fP \fIinit string\fP, \fB\-\-init\fP \fIinit string\fP - Initialization string to send to the TA (default: "E0"). Note that the - sequence "ATZ" is sent first. - .TP --\fB-r\fP, \fB--requeststat\fP -+\fB\-r\fP, \fB\-\-requeststat\fP - Request status reports for sent SMS. - .TP --\fB-t\fP, \fB--test\fP -+\fB\-t\fP, \fB\-\-test\fP - If this option is given the text is converted --to the GSM default alphabet and back to Latin-1. This option can be --used to find out how ASCII or Latin-1 texts are converted to the GSM -+to the GSM default alphabet and back to Latin\-1. This option can be -+used to find out how ASCII or Latin\-1 texts are converted to the GSM - default alphabet. Characters that can not be converted to the GSM default --alphabet are reported as ASCII code 172 (Latin-1 boolean "not") -+alphabet are reported as ASCII code 172 (Latin\-1 boolean "not") - after this double conversion. No SMS messages are sent, a connection - to a mobile phone is not established. - .TP --\fB-v\fP, \fB--version\fP -+\fB\-v\fP, \fB\-\-version\fP - Prints the program version. - .TP --\fB-X\fP, \fB--xonxoff\fP -+\fB\-X\fP, \fB\-\-xonxoff\fP - Uses software handshaking (XON/XOFF) for accessing the device. - .PP - .SH EXAMPLES -@@ -111,8 +111,8 @@ - SMS message to the number "1234": - .PP - .nf --gsmsendsms -d /dev/ttyS2 -b 19200 1234 "This is a test." --echo "This is a test." | gsmsendsms -d /dev/ttyS2 -b 19200 1234 -+gsmsendsms \-d /dev/ttyS2 \-b 19200 1234 "This is a test." -+echo "This is a test." | gsmsendsms \-d /dev/ttyS2 \-b 19200 1234 - .fi - .PP - .SH FILES ---- gsmlib-1.10.orig/doc/gsmpb.man -+++ gsmlib-1.10/doc/gsmpb.man -@@ -15,32 +15,32 @@ - gsmpb \- GSM mobile phone phonebook manipulation program - .SH SYNOPSIS - .B gsmpb --[ \fB-b\fP \fIbaudrate\fP ] --[ \fB--baudrate\fP \fIbaudrate\fP ] --[ \fB-c\fP ] --[ \fB--copy\fP ] --[ \fB-d\fP \fIdestination device or file\fP ] --[ \fB--destination\fP \fIdestination device or file\fP ] --[ \fB-h\fP ] --[ \fB--help\fP ] --[ \fB-i\fP ] --[ \fB--index\fP ] --[ \fB-I\fP \fIinit string\fP ] --[ \fB--init\fP \fIinit string\fP ] --[ \fB-p\fP \fIphonebook name\fP ] --[ \fB--phonebook\fP \fIphonebook name\fP ] --[ \fB-s\fP \fIsource device or file\fP ] --[ \fB--source\fP \fIsource device or file\fP ] --[ \fB-t\fP \fIcharacter set\fP ] --[ \fB--charset\fP \fIcharacter set\fP ] --[ \fB-v\fP ] --[ \fB--version\fP ] --[ \fB-V\fP ] --[ \fB--verbose\fP ] --[ \fB-X\fP ] --[ \fB--xonxoff\fP ] --[ \fB-y\fP ] --[ \fB--synchronize\fP ] -+[ \fB\-b\fP \fIbaudrate\fP ] -+[ \fB\-\-baudrate\fP \fIbaudrate\fP ] -+[ \fB\-c\fP ] -+[ \fB\-\-copy\fP ] -+[ \fB\-d\fP \fIdestination device or file\fP ] -+[ \fB\-\-destination\fP \fIdestination device or file\fP ] -+[ \fB\-h\fP ] -+[ \fB\-\-help\fP ] -+[ \fB\-i\fP ] -+[ \fB\-\-index\fP ] -+[ \fB\-I\fP \fIinit string\fP ] -+[ \fB\-\-init\fP \fIinit string\fP ] -+[ \fB\-p\fP \fIphonebook name\fP ] -+[ \fB\-\-phonebook\fP \fIphonebook name\fP ] -+[ \fB\-s\fP \fIsource device or file\fP ] -+[ \fB\-\-source\fP \fIsource device or file\fP ] -+[ \fB\-t\fP \fIcharacter set\fP ] -+[ \fB\-\-charset\fP \fIcharacter set\fP ] -+[ \fB\-v\fP ] -+[ \fB\-\-version\fP ] -+[ \fB\-V\fP ] -+[ \fB\-\-verbose\fP ] -+[ \fB\-X\fP ] -+[ \fB\-\-xonxoff\fP ] -+[ \fB\-y\fP ] -+[ \fB\-\-synchronize\fP ] - .PP - .SH DESCRIPTION - \fIgsmpb\fP can store or retrieve phonebook entries residing in a GSM -@@ -55,45 +55,45 @@ - destination, or the destination is synchronized with regard to the - source which is the default (details see below). - .PP --If "-" is given as the parameter for the \fB--source\fP or --\fB--destination\fP options, the phonebook is read from standard input -+If "\-" is given as the parameter for the \fB\-\-source\fP or -+\fB\-\-destination\fP options, the phonebook is read from standard input - and/or written to standard output, respectively. - .PP - Phonebook entries names are encoded using the GSM default alphabet in --the mobile phone, whereas they are stored using the Latin-1 encoding -+the mobile phone, whereas they are stored using the Latin\-1 encoding - in phonebook files. When reading phonebook entries from a mobile phone --entry names are converted from the GSM default to Latin-1. Characters --that can not be converted to Latin-1 are encoded as character code --172 (Latin-1 boolean "not"). When writing file-based phonebook entries -+entry names are converted from the GSM default to Latin\-1. Characters -+that can not be converted to Latin\-1 are encoded as character code -+172 (Latin\-1 boolean "not"). When writing file-based phonebook entries - to a mobile phone a conversion to the GSM default alphabet takes - place. Characters that can not be converted are encoded as GSM delta - (code 16). If the default character set has been changed using the --\fB--charset\fP option no conversion takes place. -+\fB\-\-charset\fP option no conversion takes place. - .PP - Error messages are printed to the standard error output. If the program - terminates on error the error code 1 is returned. - .PP - .SH OPTIONS - .TP .7i --\fB-b\fP \fIbaudrate\fP, \fB--baudrate\fP \fIbaudrate\fP -+\fB\-b\fP \fIbaudrate\fP, \fB\-\-baudrate\fP \fIbaudrate\fP - The baud rate to use. The default baudrate is 38400. - .TP .7i --\fB-c\fP, \fB--copy\fP -+\fB\-c\fP, \fB\-\-copy\fP - This causes the contents of the source to be copied to the - destination. After this operation the destination has exactly the same - contents as the source. - .TP .7i --\fB-d\fP \fIdestination\fP, \fB--destination\fP \fIdestination\fP -+\fB\-d\fP \fIdestination\fP, \fB\-\-destination\fP \fIdestination\fP - The destination device or file. - .TP .7i --\fB-h\fP, \fB--help\fP -+\fB\-h\fP, \fB\-\-help\fP - Prints an option summary. - .TP .7i --\fB-I\fP \fIinit string\fP, \fB--init\fP \fIinit string\fP -+\fB\-I\fP \fIinit string\fP, \fB\-\-init\fP \fIinit string\fP - Initialization string to send to the TA (default: "E0"). Note that the - sequence "ATZ" is sent first. - .TP .7i --\fB-i\fP, \fB--index\fP -+\fB\-i\fP, \fB\-\-index\fP - If the index position is given, \fIgsmpb\fP preserves the assignment - of entries to memory slots in the mobile phone's phonebook. This can - be used to backup phonebook entries with their position into a -@@ -104,7 +104,7 @@ - be unique, ie. it is not allowed to assign one entry twice to a - specific position in the mobile phone's phonebook. - .TP .7i --\fB-p\fP \fIphonebook\fP, \fB--phonebook\fP \fIphonebook\fP -+\fB\-p\fP \fIphonebook\fP, \fB\-\-phonebook\fP \fIphonebook\fP - The name of the phonebook to read from or write to. This is only used - for device sources and destinations. Commonly available phonebooks - are: -@@ -112,10 +112,10 @@ - .po +0.7i - .ll 5.8i - \fIFD\fP --SIM fixdialling-phonebook -+SIM fixdialling\-phonebook - .TP .3i - \fILD\fP --SIM last-dialling-phonebook -+SIM last\-dialling\-phonebook - .TP .3i - \fIME\fP - ME phonebook -@@ -131,23 +131,23 @@ - .TP .7i - .po -0.7i - .ll 6.5i --\fB-s\fP \fIsource\fP, \fB--source\fP \fIsource\fP -+\fB\-s\fP \fIsource\fP, \fB\-\-source\fP \fIsource\fP - The source device or file. - .TP --\fB-t\fP \fIcharacter set\fP, \fB--charset\fP \fIcharacter set\fP -+\fB\-t\fP \fIcharacter set\fP, \fB\-\-charset\fP \fIcharacter set\fP - Set the character set to use for phonebook operations (default is the - GSM default alphabet). - .TP --\fB-v\fP, \fB--version\fP -+\fB\-v\fP, \fB\-\-version\fP - Prints the program version. - .TP .7i --\fB-V\fP, \fB--verbose\fP -+\fB\-V\fP, \fB\-\-verbose\fP - Prints out a detailed progress report. - .TP .7i --\fB-X\fP, \fB--xonxoff\fP -+\fB\-X\fP, \fB\-\-xonxoff\fP - Uses software handshaking (XON/XOFF) for accessing the device. - .TP .7i --\fB-y\fP, \fB--synchronize\fP -+\fB\-y\fP, \fB\-\-synchronize\fP - This causes the contents of the source to be synchronized with the - destination (default). Synchronization in this context means: - .TP .2i -@@ -188,7 +188,7 @@ - \fIindex\fP - The index of the entry which must be a positive number. The index may - also be empty. Indices can be used in conjunction with the --\fB--index\fP option to store the entry into a specific position in -+\fB\-\-index\fP option to store the entry into a specific position in - the mobile phone. - .TP .7i - \fItext\fP -@@ -199,7 +199,7 @@ - encoded using the GSM default alphabet (see comments above). - .TP .7i - \fIphone number\fP --Phone numbers can only contains the digits 0-9 and the '+' sign. A '+' -+Phone numbers can only contains the digits 0\-9 and the '+' sign. A '+' - sign denotes an international number. - .PP - .SH EXAMPLES -@@ -207,8 +207,8 @@ - SIM phonebook with the file $HOME/.phonebook: - .PP - .nf --gsmpb --synchronize -b 19200 -d /dev/mobilephone \\ -- -s $HOME/.phonebook -p "SM" -+gsmpb \-\-synchronize \-b 19200 \-d /dev/mobilephone \\ -+ \-s $HOME/.phonebook \-p "SM" - .fi - .PP - .SH AUTHOR ---- gsmlib-1.10.orig/debian/compat -+++ gsmlib-1.10/debian/compat -@@ -0,0 +1 @@ -+4 ---- gsmlib-1.10.orig/debian/gsm-utils.cron.d -+++ gsmlib-1.10/debian/gsm-utils.cron.d -@@ -0,0 +1,3 @@ -+# /etc/cron.d/gsm-utils: crontab fragment for gsm-utils -+ -+*/5 * * * * root if [ -x /usr/bin/gsmsmsrequeue ]; then /usr/bin/gsmsmsrequeue; fi ---- gsmlib-1.10.orig/debian/copyright -+++ gsmlib-1.10/debian/copyright -@@ -0,0 +1,34 @@ -+This package was debianized by Mikael Hedin on -+Thu, 14 Dec 2000 01:06:40 +0100. -+ -+It was downloaded from http://www.pxh.de/fs/gsmlib/index.html -+ -+Upstream Author: Peter Hofmann -+ -+ext/gsmsiexfer.cc:// * Author: Christian W. Zuckschwerdt -+ -+Copyright: -+ -+ Copyright (C) 1999-2002 Peter Hofmann -+ -+License: -+ -+ This package 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 of the License, or (at your option) any later version. -+ -+ This package 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 package; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -+ -+On Debian systems, the complete text of the GNU Lesser General -+Public License can be found in `/usr/share/common-licenses/LGPL'. -+ -+The Debian packaging is (C) 2000, Mikael Hedin and -+is licensed under the GPL, see `/usr/share/common-licenses/GPL'. ---- gsmlib-1.10.orig/debian/gsm-utils.dirs -+++ gsmlib-1.10/debian/gsm-utils.dirs -@@ -0,0 +1,11 @@ -+var/spool/sms/queue1 -+var/spool/sms/queue2 -+var/spool/sms/queue3 -+var/spool/sms/sent1 -+var/spool/sms/sent2 -+var/spool/sms/sent3 -+var/spool/sms/failed1 -+var/spool/sms/failed2 -+var/spool/sms/failed3 -+var/spool/sms/tmp -+var/run/gsm-utils ---- gsmlib-1.10.orig/debian/gsm-utils.default -+++ gsmlib-1.10/debian/gsm-utils.default -@@ -0,0 +1,18 @@ -+PHONEDEV=/dev/mobilephone # or /dev/ttyS0 or /dev/ircomm0 -+BAUDRATE=9600 -+PIN="" # or 1234 -+ -+# RUNGSMSMS: If set to anything other that 'yes', the asterisk init.d script -+# will not run. The default is 'yes'. -+# You should probaly also install the crontab from /usr/share/doc/gsm-utils/examples -+RUNGSMSMS=no -+ -+SPOOLDIR=/var/spool/sms -+PRIORITIES=3 -+ -+SMSADMIN=root -+SUBJECT="SMS delivery report:" -+ -+SMSPROCESSOR="" # or /usr/bin/gsmsmsprocessor -+ -+do_accounting () { true; } # it's your turn ---- gsmlib-1.10.orig/debian/watch -+++ gsmlib-1.10/debian/watch -@@ -0,0 +1,2 @@ -+version=2 -+http://www.pxh.de/fs/gsmlib/download/content.html gsmlib-(.*)\.tar\.gz ---- gsmlib-1.10.orig/debian/gsm-utils.postinst -+++ gsmlib-1.10/debian/gsm-utils.postinst -@@ -0,0 +1,28 @@ -+#!/bin/sh -e -+ -+# create gsmsms group if necessary. -+if ! grep -q ^gsmsms: /etc/group; then -+# echo Adding system group: gsmsms. -+ addgroup --system gsmsms -+fi -+ -+# create gsmsms user if necessary. -+if ! grep -q ^gsmsms: /etc/passwd; then -+# echo Adding system user: gsmsms. -+ adduser --system --ingroup gsmsms \ -+ --no-create-home --home /var/spool/sms gsmsms -+fi -+ -+# allow gsmsms to use serial lines -+if ! groups gsmsms | grep -q dialout ; then -+ adduser gsmsms dialout -+fi -+ -+# echo Updating spool directory structure: /var/spool/sms -+chown -R gsmsms:gsmsms /var/spool/sms /var/run/gsm-utils -+chmod 700 /var/spool/sms/* -+chmod 750 /var/spool/sms -+chmod 730 /var/spool/sms/queue* /var/spool/sms/tmp -+ -+# Add the rest automatically.. -+#DEBHELPER# ---- gsmlib-1.10.orig/debian/control -+++ gsmlib-1.10/debian/control -@@ -0,0 +1,45 @@ -+Source: gsmlib -+Section: comm -+Priority: extra -+Maintainer: Mark Purcell -+Build-Depends: debhelper (>= 3.0.0), chrpath -+Standards-Version: 3.7.3 -+Homepage: http://www.pxh.de/fs/gsmlib/ -+ -+Package: libgsmme-dev -+Section: libdevel -+Architecture: any -+Depends: libgsmme1c2a (= ${binary:Version}), libc6-dev -+Description: Header files and static libraries for gsmlib -+ Headers and static libraries for use when compiling programs with -+ gsmlib. -+ . -+ gsmlib is a library for access to a GSM mobile phone using the -+ standards ETSI GSM 07.07, ETSI GSM 07.05, and others. -+ -+Package: libgsmme1c2a -+Conflicts: libgsmme1, libgsmme1c102, libgsmme1c2 -+Replaces: libgsmme1c102, libgsmme1c2 -+Section: libs -+Architecture: any -+Depends: ${shlibs:Depends} -+Description: GSM mobile phone access library -+ Library to access GSM mobile phones through GSM modems or IrDA devices. -+ Features include: -+ . -+ * modification of phone books stored in the mobile phone or on the -+ SIM card -+ * reading and writing of SMS messages stored in the mobile phone -+ * sending and reception of SMS messages -+ . -+ gsmlib uses standard ETSI GSM 07.07, ETSI GSM 07.05, and others. -+ -+Package: gsm-utils -+Section: comm -+Architecture: any -+Depends: ${shlibs:Depends}, adduser -+Description: GSM mobile phone access applications -+ Some simple command line programs to access a GSM mobile phone via -+ GSM modem or IrDA. Functions include: modification of phone books and -+ reading, writing, sending and receiving SMS messages. Uses the GSM -+ standards ETSI GSM 07.07, ETSI GSM 07.05, and others. ---- gsmlib-1.10.orig/debian/gsm-utils.postrm -+++ gsmlib-1.10/debian/gsm-utils.postrm -@@ -0,0 +1,43 @@ -+#!/bin/sh -+# postrm script for #PACKAGE# -+# -+# see: dh_installdeb(1) -+ -+set -e -+ -+# summary of how this script can be called: -+# * `remove' -+# * `purge' -+# * `upgrade' -+# * `failed-upgrade' -+# * `abort-install' -+# * `abort-install' -+# * `abort-upgrade' -+# * `disappear' -+# -+# for details, see http://www.debian.org/doc/debian-policy/ or -+# the debian-policy package -+ -+ -+case "$1" in -+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) -+ ;; -+ -+ purge) -+ deluser gsmsms -+ ;; -+ -+ *) -+ echo "postrm called with unknown argument \`$1'" >&2 -+ exit 1 -+ ;; -+esac -+ -+# dh_installdeb will replace this with shell code automatically -+# generated by other debhelper scripts. -+ -+#DEBHELPER# -+ -+exit 0 -+ -+ ---- gsmlib-1.10.orig/debian/gsmsiexfer.1 -+++ gsmlib-1.10/debian/gsmsiexfer.1 -@@ -0,0 +1,29 @@ -+.\" -*- eval: (nroff-mode) -*- -+.de TQ -+.br -+.ns -+.TP \\$1 -+.. -+.\" Like TP, but if specified indent is more than half -+.\" the current line-length - indent, use the default indent. -+.de Tp -+.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP -+.el .TP "\\$1" -+.. -+.TH GSMSIEXFER 1 "" "gsmsiexfer" -+.SH NAME -+gsmsiexfer \- Siemens ME file transfer program for Siemens phones S25, S35, S45, ME45, SL45 -+.SH SYNOPSIS -+.B gsmsiexfer \-\-help -+.PP -+.SH DESCRIPTION -+\fIgsmsiexer\fP comes with no man page. Try gsmsiexfer \-\-help, or -+read the source. -+.PP -+.SH "SEE ALSO" -+.BR gsminfo(7), -+.BR gsmctl(1), -+.BR gsmsendsms(1), -+.BR gsmsmsd(8), -+.BR gsmsmsstore(1). -+ ---- gsmlib-1.10.orig/debian/gsm-utils.examples -+++ gsmlib-1.10/debian/gsm-utils.examples -@@ -0,0 +1,2 @@ -+contrib/gsm-utils.cron.d -+contrib/gsm-utils.init ---- gsmlib-1.10.orig/debian/dirs -+++ gsmlib-1.10/debian/dirs -@@ -0,0 +1 @@ -+/var/run/gsm-utils ---- gsmlib-1.10.orig/debian/libgsmme-dev.docs -+++ gsmlib-1.10/debian/libgsmme-dev.docs -@@ -0,0 +1,2 @@ -+doc/README.developers -+doc/README.NLS ---- gsmlib-1.10.orig/debian/gsm-utils.init -+++ gsmlib-1.10/debian/gsm-utils.init -@@ -0,0 +1,87 @@ -+#! /bin/sh -+### BEGIN INIT INFO -+# Provides: gsm-utils -+# Required-Start: $remote_fs $syslog -+# Required-Stop: $remote_fs $syslog -+# Default-Start: 2 3 4 5 -+# Default-Stop: 0 1 6 -+# Short-Description: Start daemon at boot time -+# Description: Enable service provided by daemon. -+### END INIT INFO -+# -+# /etc/init.d/gsm-utils: Controls the GSM SMS send daemon -+# -+# written by Matthias Goebl -+ -+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -+DAEMON=/usr/bin/gsmsmsd -+NAME=gsmsmsd -+DESC="GSM SMS send daemon" -+ -+test -x $DAEMON || exit 0 -+ -+if [ "$RUNGSMSMS" != "yes" ];then -+ echo "GSM SMS deamon not yet configured. Edit /etc/default/gsm-utils first." -+ exit 0 -+fi -+ -+ -+PHONEDEV=/dev/mobilephone # or /dev/ttyS0 or /dev/ircomm0 -+BAUDRATE=9600 -+PIN="" # or 1234 -+SMSPROCESSOR="" # or /usr/bin/gsmsmsprocessor -+SPOOLDIR=/var/spool/sms -+PRIORITIES=3 -+STARTOPTS="" -+SMSUSER="gsmsms:gsmsms" -+test -r /etc/default/gsm-utils && . /etc/default/gsm-utils # for overwriting some parameters -+ -+OPTIONS="-d $PHONEDEV -b $BAUDRATE -L -P $PRIORITIES" -+OPTIONS="$OPTIONS -s $SPOOLDIR/queue -S $SPOOLDIR/sent -F $SPOOLDIR/failed" -+test -n "$SMSPROCESSOR" && OPTIONS="$OPTIONS -a $SMSPROCESSOR" -+test -n "$SMSUSER" && STARTOPTS="$STARTOPTS --chuid $SMSUSER" -+test -r /etc/default/gsm-utils && . /etc/default/gsm-utils # for overwriting OPTIONS -+ -+case "$1" in -+ start) -+ echo -n "Starting $DESC: " -+ if [ -n "$PIN" ];then -+ echo -n "entering PIN.. " -+ ( -+ # This is ugly.. But if the PIN is already entered, the ME returns -+ # "ERROR" and makes gsmctl retrying.. -+ /usr/bin/gsmctl -d $PHONEDEV -b $BAUDRATE -I "+cpin=$PIN" & -+ PID=$! -+ sleep 3 -+ kill $PID 2>/dev/null -+ ) >/dev/null 2>&1 -+ fi -+ echo -n "$NAME" -+ start-stop-daemon --start --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --make-pidfile --background $STARTOPTS --exec $DAEMON -- $OPTIONS -+ echo "." -+ ;; -+ stop) -+ echo -n "Stopping $DESC: $NAME " -+ start-stop-daemon --stop --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --exec $DAEMON -+ sleep 5 -+ echo "." -+ ;; -+ restart|force-reload) -+ echo -n "Restarting $DESC: $NAME" -+ start-stop-daemon --stop --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --make-pidfile --background --exec $DAEMON -- $OPTIONS -+ sleep 5 -+ start-stop-daemon --start --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --make-pidfile --background $STARTOPTS --exec $DAEMON -- $OPTIONS -+ echo "." -+ ;; -+ *) -+ N=/etc/init.d/gsm-utils -+ echo "Usage: $N {start|stop|restart|force-reload}" >&2 -+ exit 1 -+ ;; -+esac -+ -+exit 0 ---- gsmlib-1.10.orig/debian/changelog -+++ gsmlib-1.10/debian/changelog -@@ -0,0 +1,284 @@ -+gsmlib (1.10-13) unstable; urgency=low -+ -+ * Ack NMU, Thanks Michael, Christoph & Petter -+ * debian/control add Homepage: -+ * Update debian/copyright; gsm-lib/COPYING actually specifies LGPL: -+ - fixes lintian:copyright-without-copyright-notice -+ * Update manpages fixes lintian:hyphen-used-as-minus-sign -+ * Update debian/gsm-utils.init -+ - fixes lintian:init.d-script-missing-lsb-short-description -+ * Bug fixes from ubuntu -+ - Don't install contrib/gsm-utils.init dh_installinit debian/gsm-utils.init -+ - Create /var/run/gsm-utils -+ * Add case 'L' to apps/gsmsmsd.cc - thks to Andrew Suffield -+ - syslog support does not work (Closes: #346240) -+ * gsm-utils.init really call restart with --stop first -+ - init script calls --start twice (Closes: #377448) -+ * Explictly set /bin/bash: gsmsmsspool & gsmsmsrequeue -+ - bashism in /bin/sh script (Closes: #464981) -+ - gsmsmsrequeue contains bashism or function error (Closes: #459396) -+ * Patch apps/gsmsmsstore.cc - thks Isaac Wilcox -+ - gsmsmsstore device existence check causes problems with RFCOMM -+ devices (Closes: #340179) -+ * Only start gsmsmsd if set in /etc/default/gsm-utils. crontab -> examples -+ - gsmsmsd should be optional / start only if told so in -+ /etc/default/gsm-utils (Closes: #474093) -+ * Apply patch from Stefan Katerkamp & Jacob Nevins -+ - Gsmsendsms fails with SonyEricsson W880 (fix included) (Closes: -+ #413341) -+ -+ -- Mark Purcell Mon, 06 Oct 2008 15:01:49 +1100 -+ -+gsmlib (1.10-12.5) unstable; urgency=low -+ -+ * Non-maintainer upload. -+ * Yet another bashism that was later on reported on the old bug report, thus -+ again closes: #464981 -+ * Also found a shell related problem in debian/rules and fixed it. -+ * Bumped standard to 3.7.3. -+ -+ -- Michael Meskes Mon, 14 Apr 2008 10:48:19 +0200 -+ -+gsmlib (1.10-12.4) unstable; urgency=low -+ -+ * Non-maintainer upload. -+ * Argh, somehow I mananged to upload without fixing the bug completely, -+ sorry. Added those missing braces, closes: #464981. -+ -+ -- Michael Meskes Wed, 09 Apr 2008 14:46:08 +0200 -+ -+gsmlib (1.10-12.3) unstable; urgency=high -+ -+ * Non-maintainer upload. -+ * Removed bashism in contrib/gsmsmsrequeue (Closes: #464981). -+ -+ -- Michael Meskes Sun, 06 Apr 2008 15:37:35 +0200 -+ -+gsmlib (1.10-12.2) unstable; urgency=low -+ -+ * Non-maintainer upload. -+ * Fix FTBFS with GCC 4.3: 'strerror' was not declared in this scope, thanks -+ to Cyril Brulebois for the patch (Closes: #455402). -+ -+ -- Christoph Berg Fri, 04 Apr 2008 18:01:05 +0200 -+ -+gsmlib (1.10-12.1) unstable; urgency=low -+ -+ * Non-maintainer upload to solve release goal. -+ * Add LSB dependency header to init.d scripts (Closes: #464061). -+ -+ -- Petter Reinholdtsen Fri, 28 Mar 2008 11:39:20 +0100 -+ -+gsmlib (1.10-12) unstable; urgency=low -+ -+ * addgroup --system gsmsms works better. Thanks Jon -+ * only delete gsmsms on purge -+ - gsm-utils: deletes and recreates the gsmsms user on each upgrade -+ (Closes: #346238) -+ - gsm-utils fails installation / addgroup: The user gsmsms; does -+ not exist (Closes: #445404) -+ * lintian cleanup: debian-rules-ignores-make-clean-error substvar- -+ source-version-is-deprecated -+ * Scripts are installed +x -+ - gsm-utils: uselessly installs non-executable scripts into /usr/bin -+ (Closes: #346230) -+ * Remove bogus symlink -+ - gsm-utils: wrong symlink for manpage gsmsiectl.1 (Closes: #322382) -+ - gsm-utils: gsmsiectl.1 dangling symlink (Closes: #399582) -+ * debian/gsm-utils.init reload/restart was not calling --stop. Thanks -+ Barry -+ - init script calls --start twice (Closes: #377448) -+ -+ -- Mark Purcell Mon, 08 Oct 2007 21:44:00 +0100 -+ -+gsmlib (1.10-11) unstable; urgency=low -+ -+ * Create system group gsmsms - Thanks Emmanuel -+ - gsm-utils: creates group in non-system gid range (Closes: #353967) -+ - gsm-utils: postinst should create system grp gsmsms (Closes: -+ #390266) -+ * Upgrade to compat 4 -+ * Apply gcc-4.3 patch from Martin -+ - FTBFS with GCC 4.3: missing #includes (Closes: #417222) -+ -+ -- Mark Purcell Sat, 29 Sep 2007 18:22:56 +0100 -+ -+gsmlib (1.10-10) unstable; urgency=low -+ -+ * FTBFS with G++ 4.1: extra qualifications (Closes: #356109) -+ -+ -- Mark Purcell Sat, 20 May 2006 21:54:42 +0100 -+ -+gsmlib (1.10-9) unstable; urgency=low -+ -+ * library package needs to be renamed (libstdc++ allocator change) -+ (Closes: #339179) -+ -+ -- Mark Purcell Mon, 21 Nov 2005 21:19:51 +0000 -+ -+gsmlib (1.10-8) unstable; urgency=low -+ -+ * removal of automake1.6 (Closes: #335123) -+ * fails with dash [bashisms in scripts] (Closes: #309834) -+ * Update libtool Fixes: gsmlib(GNU/k*BSD): FTBFS: out of date libtool scripts (Closes: -+ #319688) -+ * [INTL:de] German PO file corrections (Closes: #314060) -+ * Fix: old-fsf-address-in-copyright-file -+ -+ -- Mark Purcell Thu, 3 Nov 2005 22:40:19 +0000 -+ -+gsmlib (1.10-7) unstable; urgency=low -+ -+ * C++ 4.0 transition -+ * Closes: #315864: Missing manpages -+ * gsm-utils: maintainer-script-needs-depends-on-adduser postinst -+ -+ -- Mark Purcell Sat, 23 Jul 2005 00:46:31 +1000 -+ -+gsmlib (1.10-6) unstable; urgency=low -+ -+ * Rebuild for invalid dependancies -+ * Closes: #258056: libgsmme 99% cpu usage -+ - Patch from Emard -+ * Closes: #274382: FTBFS with gcc-3.4: template-id `operator< -+ <>' for `bool gsmlib::operator<(const -+ gsmlib::MapKey<gsmlib::SortedPhonebookBase>&, const -+ gsmlib::MapKey<gsmlib::SortedPhonebookBase>&)' does not -+ match any template declaration -+ - Patch from Andreas Jochens -+ * Closes: #294251: FTBFS (amd64/gcc-4.0): explicit qualification in -+ declaration of `bool gsmlib::operator<(const -+ gsmlib::MapKey<SortedStore>&, const -+ gsmlib::MapKey<SortedStore>&)' -+ - Patch from Andreas Jochens -+ * Closes: #200189: Patch and contribution -+ + Added multi-queue-priority-system and syslog patch (Matthias Goebl) -+ + Included init, spool and requeue scripts for gsmsmsd (Matthias Goebl) -+ + gsmsmsd runs with own user and group (gsmsms:gsmsms) (Matthias Goebl) -+ -+ -- Mark Purcell Tue, 17 May 2005 11:34:45 +0100 -+ -+gsmlib (1.10-5) unstable; urgency=low -+ -+ * Change Section: libdevel -+ * gsm_unix_serial.cc patch from Daniel Schepler to fix g++-3.3 -+ compliation. Thanks. (Closes: Bug#195151) -+ -+ -- Mark Purcell Sat, 19 Jul 2003 15:57:28 +1000 -+ -+gsmlib (1.10-4) unstable; urgency=low -+ -+ * Include file descriptor leak patch from Edd Dumbill (Closes: -+ Bug#168475) -+ * lintian cleanup: description-synopsis-might-not-be-phrased-properly -+ * lintian cleanup: configure-generated-file-in-source -+ -+ -- Mark Purcell Sun, 9 Feb 2003 14:04:54 +1100 -+ -+gsmlib (1.10-3) unstable; urgency=low -+ -+ * New Maintainer (Closes: Bug#180061). Thanks Mikael for your work. -+ -+ -- Mark Purcell Sat, 8 Feb 2003 16:55:26 +1100 -+ -+gsmlib (1.10-2) unstable; urgency=low -+ -+ * Rebuild to use the new c++ ABI (GCC 3.2) -+ -+ -- Mikael Hedin Thu, 23 Jan 2003 20:57:50 +0100 -+ -+gsmlib (1.10-1) unstable; urgency=low -+ -+ * New upstrem release. -+ -+ -- Mikael Hedin Wed, 6 Nov 2002 17:44:17 +0100 -+ -+gsmlib (1.9-2) unstable; urgency=low -+ -+ * Made new rules for the config.guess/sub update thing (closes: #146865, -+ #146867). -+ -+ -- Mikael Hedin Tue, 14 May 2002 09:28:03 +0200 -+ -+gsmlib (1.9-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Use chrpath to get rid of rpaths. -+ * Add mini-manpage for gsmsiexfer. -+ * Remove b-d on auto-stuff, we don't use them. -+ -+ -- Mikael Hedin Mon, 13 May 2002 22:10:28 +0200 -+ -+gsmlib (1.8-2) unstable; urgency=low -+ -+ * Removed b-d on gcc 3.0, as they are no longer nessecary. -+ -+ -- Mikael Hedin Thu, 24 Jan 2002 12:59:07 +0100 -+ -+gsmlib (1.8-1) unstable; urgency=low -+ -+ * New upstream version. -+ * Revert the arch hack, now it should compile with either g++. -+ * Include the new lib in libgsmme1. Run dh_makeshlibs -V because of this. -+ * Added info for gsmsiectl in gsmctl(1). -+ -+ -- Mikael Hedin Wed, 9 Jan 2002 22:38:45 +0100 -+ -+gsmlib (1.7-2) unstable; urgency=low -+ -+ * gsm-utils: Added shlibs:Depends (closes: #126127). -+ * Spelling correction (closes: #124705, #124972) -+ * Rm libgsmme1.postins, and let dh_makeshlibs take care of ldconfig. -+ * Made explicit arch list without sparc and arm, they cannot use g++-3.0 -+ right now. -+ -+ -- Mikael Hedin Sat, 22 Dec 2001 20:27:54 +0100 -+ -+gsmlib (1.7-1) unstable; urgency=low -+ -+ * New upstream -+ * Use gcc-3.0 and g++-3.0, 2.95 doesn't compile. -+ -+ -- Mikael Hedin Thu, 1 Nov 2001 10:24:33 +0100 -+ -+gsmlib (1.6-5) unstable; urgency=low -+ -+ * Updated manpage (closes: #110973) -+ * Corrected problem with OP status (closes: #110970) -+ -+ -- Mikael Hedin Sat, 8 Sep 2001 18:12:17 +0200 -+ -+gsmlib (1.6-4) unstable; urgency=low -+ -+ * Support DEB_BUILD_OPTIONS -+ * Changed libgsmme-dev to section devel. -+ * Reran libtoolize. -+ * Lots of small patches to compile with g++-3.0. (Closes: #104411) -+ * Removed dh_testversion. -+ -+ -- Mikael Hedin Thu, 12 Jul 2001 16:06:23 +0200 -+ -+gsmlib (1.6-3) unstable; urgency=low -+ -+ * Various minor corrections. -+ -+ -- Mikael Hedin Thu, 8 Mar 2001 16:24:07 +0100 -+ -+gsmlib (1.6-2) unstable; urgency=low -+ -+ * Dont install INSTALL. Correct indentation for libgsmme1 description. -+ -+ -- Mikael Hedin Tue, 6 Mar 2001 14:55:05 +0100 -+ -+gsmlib (1.6-1) unstable; urgency=low -+ -+ * New upstream version. -+ -+ -- Mikael Hedin Mon, 29 Jan 2001 17:57:21 +0100 -+ -+gsmlib (1.5-1) unstable; urgency=low -+ -+ * Initial Release. -+ -+ -- Mikael Hedin Thu, 14 Dec 2000 01:06:40 +0100 -+ ---- gsmlib-1.10.orig/debian/gsm-utils.docs -+++ gsmlib-1.10/debian/gsm-utils.docs -@@ -0,0 +1,4 @@ -+NEWS -+README -+TODO -+doc/FAQ ---- gsmlib-1.10.orig/debian/rules -+++ gsmlib-1.10/debian/rules -@@ -0,0 +1,129 @@ -+#!/usr/bin/make -f -+ -+# Uncomment this to turn on verbose mode. -+#export DH_VERBOSE=1 -+ -+# shared library versions, option 1 -+#version=2.0.5 -+#major=2 -+# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so -+me_version=`ls gsmlib/.libs/libgsmme*.so.* | \ -+ awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` -+me_major=`ls gsmlib/.libs/libgsmme*.so.* | \ -+ awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` -+ex_version=`ls ext/.libs/libgsmext*.so.* | \ -+ awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` -+ex_major=`ls ext/.libs/libgsmext*.so.* | \ -+ awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` -+ -+ -+export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -+export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -+ -+ -+# FOR AUTOCONF 2.13 ONLY -+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) -+ confflags += $(DEB_HOST_GNU_TYPE) -+else -+ confflags += --host $(DEB_BUILD_GNU_TYPE) --build $(DEB_HOST_GNU_TYPE) -+endif -+ -+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) -+CFLAGS += -g -+CXXFLAGS += -g -+endif -+ -+configure: configure-stamp -+configure-stamp: -+ dh_testdir -+ # Add here commands to configure the package. -+ CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" INSTALL_PROGRAM=$(INSTALL_PROGRAM) \ -+ ./configure $(confflags) --prefix=/usr --mandir=\$${prefix}/share/man \ -+ --infodir=\$${prefix}/share/info -+ -+ touch configure-stamp -+ -+build: configure-stamp build-stamp -+build-stamp: -+ dh_testdir -+ -+ # Add here commands to compile the package. -+ $(MAKE) -+ -+ touch build-stamp -+ -+clean: -+ dh_testdir -+ dh_testroot -+ -+ # Add here commands to clean up after the build process. -+ [ ! -f Makefile ] || $(MAKE) distclean -+ rm -f build-stamp configure-stamp config.log config.status po/de.gmo -+ -+ -test -r /usr/share/misc/config.sub && \ -+ cp -f /usr/share/misc/config.sub scripts/config.sub -+ -test -r /usr/share/misc/config.guess && \ -+ cp -f /usr/share/misc/config.guess scripts/config.guess -+ -+ dh_clean -+ -+install: build -+ dh_testdir -+ dh_testroot -+ dh_clean -k -+ dh_installdirs -+ dh_installdirs -pgsm-utils -+ -+ # Add here commands to install the package into debian/gsmlib. -+ $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp -+ chrpath -d debian/tmp/usr/bin/* -+ cp contrib/gsmsmsspool contrib/gsmsmsrequeue debian/tmp/usr/bin -+ -+ -+# Build architecture-independent files here. -+binary-indep: build install -+# We have nothing to do by default. -+ -+# Build architecture-dependent files here. -+binary-arch: build install -+ dh_testdir -+ dh_testroot -+ # -+ # build libgsmlib${major} package by moving files from gsmlib-dev -+ # -+ dh_movefiles -plibgsmme$(me_major)c2a \ -+ usr/lib/libgsmme.so.$(me_major) \ -+ usr/lib/libgsmme.so.$(me_version) \ -+ usr/lib/libgsmext.so.$(ex_major) \ -+ usr/lib/libgsmext.so.$(ex_version) \ -+ usr/share/locale -+ -+ dh_movefiles -plibgsmme-dev \ -+ usr/include \ -+ usr/lib -+ -+ dh_movefiles -pgsm-utils \ -+ usr/bin -+ -+ -+ dh_installdocs -+ dh_installexamples -+ dh_installmenu -+ dh_installinit -+ dh_installcron -+ dh_installman -pgsm-utils debian/*.1 debian/tmp/usr/share/man/man*/* -+ dh_installinfo -+ dh_installchangelogs ChangeLog -+ dh_link -+ dh_strip -+ dh_compress -+ dh_fixperms -+ dh_makeshlibs -V -+ dh_installdeb -+ dh_shlibdeps -ldebian/libgsmme1c2a/usr/lib -+ dh_gencontrol -+ dh_md5sums -+ dh_builddeb -+ -+binary: binary-indep binary-arch -+.PHONY: build clean binary-indep binary-arch binary install configure ---- gsmlib-1.10.orig/contrib/gsmsmsrequeue -+++ gsmlib-1.10/contrib/gsmsmsrequeue -@@ -0,0 +1,48 @@ -+#! /bin/bash -+# -+# /usr/bin/gsmsmsrequeue: Re-queues failed SMS -+# -+# written by Matthias Goebl -+ -+SPOOLDIR=/var/spool/sms -+PRIORITIES=3 -+SMSADMIN=root -+SUBJECT="SMS delivery report:" -+ -+send_notify() -+{ -+ tmpfile="$SPOOLDIR/tmp/"`basename "$1"` -+ status="$2" -+ if mv "$1" "$tmpfile" 2>/dev/null; then -+ # extract the first tab-separated field after the phone number as -+ # email-address to send the notification to -+ mailto=` cat "$tmpfile" | sed -ne '1s/^[^ ]* \([^ ]*\).*/\1/p' ` -+ test -z "$mailto" && mailto="$SMSADMIN" -+ cat "$tmpfile" | mail -s "$SUBJECT $status" "$mailto" -+ rm "$tmpfile" -+ fi -+} -+do_accounting() -+{ -+ true; -+} -+ -+test -r /etc/default/gsm-utils && . /etc/default/gsm-utils -+ -+for p in `seq 1 $PRIORITIES`; do -+ ls "$SPOOLDIR/failed$p" | while read file; do -+ if expr "$file" : ".*rrrrrrrrrrrr" >/dev/null; then -+ send_notify "$SPOOLDIR/failed$p/$file" "failed" -+ else -+ # re-queue SMS -+ mv "$SPOOLDIR/failed$p/$file" "$SPOOLDIR/queue$p/${file}r" 2>/dev/null -+ fi -+ done -+done -+ -+for p in `seq 1 $PRIORITIES`; do -+ ls "$SPOOLDIR/sent$p" | while read file; do -+ do_accounting "$SPOOLDIR/sent$p/$file" "sent" -+ send_notify "$SPOOLDIR/sent$p/$file" "sent" -+ done -+done ---- gsmlib-1.10.orig/contrib/gsm-utils.cron.d -+++ gsmlib-1.10/contrib/gsm-utils.cron.d -@@ -0,0 +1,3 @@ -+# /etc/cron.d/gsm-utils: crontab fragment for gsm-utils -+ -+*/5 * * * * root if [ -x /usr/bin/gsmsmsrequeue ]; then /usr/bin/gsmsmsrequeue; fi ---- gsmlib-1.10.orig/contrib/gsm-utils.default -+++ gsmlib-1.10/contrib/gsm-utils.default -@@ -0,0 +1,13 @@ -+PHONEDEV=/dev/mobilephone # or /dev/ttyS0 or /dev/ircomm0 -+BAUDRATE=9600 -+PIN="" # or 1234 -+ -+SPOOLDIR=/var/spool/sms -+PRIORITIES=3 -+ -+SMSADMIN=root -+SUBJECT="SMS delivery report:" -+ -+SMSPROCESSOR="" # or /usr/bin/gsmsmsprocessor -+ -+do_accounting () { true; } # it's your turn ---- gsmlib-1.10.orig/contrib/gsmsmsspool -+++ gsmlib-1.10/contrib/gsmsmsspool -@@ -0,0 +1,34 @@ -+#! /bin/bash -+# -+# /usr/bin/gsmsmsspool: Queues SMS for sending -+# -+# written by Matthias Goebl -+ -+SPOOLDIR=/var/spool/sms -+PRIORITIES=3 -+test -r /etc/default/gsm-utils && . /etc/default/gsm-utils -+ -+if [ -z "$1" ]; then -+ echo "Usage: gsmsmsspool NUMBER [MESSAGE]" -+ exit 1 -+fi -+ -+priority=$PRIORITIES # default priority -+test -n "$GSMSMS_PRIORITY" && priority="$GSMSMS_PRIORITY" -+mailto=`id -un` -+test -n "$GSMSMS_NOTIFY" && mailto="$GSMSMS_NOTIFY" -+ -+tmpfile="$SPOOLDIR/tmp/`date +%s`.$$" -+umask 022 -+echo "$1 $mailto" > "$tmpfile" -+if [ -n "$2" ]; then -+ echo "$2" | head -c 160 >> "$tmpfile" -+else -+ head -c 160 >> "$tmpfile" -+fi -+ -+if [ "`id -un`" = "root" ]; then -+ chown gsmsms:gsmsms "$tmpfile" -+fi -+ -+mv "$tmpfile" "$SPOOLDIR/queue$priority/" ---- gsmlib-1.10.orig/contrib/gsm-utils.init -+++ gsmlib-1.10/contrib/gsm-utils.init -@@ -0,0 +1,81 @@ -+#! /bin/sh -+### BEGIN INIT INFO -+# Provides: gsm-utils -+# Required-Start: $remote_fs $syslog -+# Required-Stop: $remote_fs $syslog -+# Default-Start: 2 3 4 5 -+# Default-Stop: 0 1 6 -+# Short-Description: Start daemon at boot time -+# Description: Enable service provided by daemon. -+### END INIT INFO -+# -+# /etc/init.d/gsm-utils: Controls the GSM SMS send daemon -+# -+# written by Matthias Goebl -+ -+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -+DAEMON=/usr/bin/gsmsmsd -+NAME=gsmsmsd -+DESC="GSM SMS send daemon" -+ -+test -x $DAEMON || exit 0 -+ -+PHONEDEV=/dev/mobilephone # or /dev/ttyS0 or /dev/ircomm0 -+BAUDRATE=9600 -+PIN="" # or 1234 -+SMSPROCESSOR="" # or /usr/bin/gsmsmsprocessor -+SPOOLDIR=/var/spool/sms -+PRIORITIES=3 -+STARTOPTS="" -+SMSUSER="gsmsms:gsmsms" -+test -r /etc/default/gsm-utils && . /etc/default/gsm-utils # for overwriting some parameters -+ -+OPTIONS="-d $PHONEDEV -b $BAUDRATE -L -P $PRIORITIES" -+OPTIONS="$OPTIONS -s $SPOOLDIR/queue -S $SPOOLDIR/sent -F $SPOOLDIR/failed" -+test -n "$SMSPROCESSOR" && OPTIONS="$OPTIONS -a $SMSPROCESSOR" -+test -n "$SMSUSER" && STARTOPTS="$STARTOPTS --chuid $SMSUSER" -+test -r /etc/default/gsm-utils && . /etc/default/gsm-utils # for overwriting OPTIONS -+ -+case "$1" in -+ start) -+ echo -n "Starting $DESC: " -+ if [ -n "$PIN" ];then -+ echo -n "entering PIN.. " -+ ( -+ # This is ugly.. But if the PIN is already entered, the ME returns -+ # "ERROR" and makes gsmctl retrying.. -+ /usr/bin/gsmctl -d $PHONEDEV -b $BAUDRATE -I "+cpin=$PIN" & -+ PID=$! -+ sleep 3 -+ kill $PID 2>/dev/null -+ ) >/dev/null 2>&1 -+ fi -+ echo -n "$NAME" -+ start-stop-daemon --start --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --make-pidfile --background $STARTOPTS --exec $DAEMON -- $OPTIONS -+ echo "." -+ ;; -+ stop) -+ echo -n "Stopping $DESC: $NAME " -+ start-stop-daemon --stop --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --exec $DAEMON -+ sleep 5 -+ echo "." -+ ;; -+ restart|force-reload) -+ echo -n "Restarting $DESC: $NAME" -+ start-stop-daemon --stop --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --make-pidfile --background $STARTOPTS --exec $DAEMON -- $OPTIONS -+ sleep 5 -+ start-stop-daemon --start --quiet --pidfile /var/run/gsm-utils/$NAME.pid \ -+ --make-pidfile --background --exec $DAEMON -- $OPTIONS -+ echo "." -+ ;; -+ *) -+ N=/etc/init.d/gsm-utils -+ echo "Usage: $N {start|stop|restart|force-reload}" >&2 -+ exit 1 -+ ;; -+esac -+ -+exit 0 diff --git a/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib_1.10.orig.tar.gz b/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib_1.10.orig.tar.gz deleted file mode 100644 index c3e2c3bb743da9a3ff5fd23c22226e7e9c20d6c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 474591 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
+ + + + + + + + + +
+ +#; + + +while (my $request = $scgi->accept) { + + # fork every new req into its own process (optional) + next unless(fork()); + my $handle = $request->connection; + + $request->read_env; + + # get the body that contains the PARAMS + read $handle, $body, $request->env->{CONTENT_LENGTH}; + + # Dump SCGI HEADERS + print Dumper $request->env; + + # Create a CGI parser on the PARAMS + my $cgi = CGI->new($body); + my %params = $cgi->Vars(); + # might be big output + print Dumper \%params; + + + ### DO something CGI-like here with %params ... I'm just going to return static xml + + # header is not necessary but optional + #print $handle "Content-Type: text/xml\n\n"; + + print $handle $xml; + +} From 5cf33770e1409c1c4719e8da3158f321a6284a5d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 May 2012 14:09:29 -0500 Subject: [PATCH 0242/1057] add conf for mod_xml_scgi --- build/modules.conf.in | 1 + conf/vanilla/autoload_configs/modules.conf.xml | 1 + conf/vanilla/autoload_configs/xml_scgi.conf.xml | 12 ++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 conf/vanilla/autoload_configs/xml_scgi.conf.xml diff --git a/build/modules.conf.in b/build/modules.conf.in index 18babbfec9..98a88e0622 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -124,6 +124,7 @@ xml_int/mod_xml_cdr #xml_int/mod_xml_curl #xml_int/mod_xml_ldap xml_int/mod_xml_rpc +xml_int/mod_xml_scgi #../../libs/freetdm/mod_freetdm #../../libs/openzap/mod_openzap diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index 50353ac849..5038713afe 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -16,6 +16,7 @@ + diff --git a/conf/vanilla/autoload_configs/xml_scgi.conf.xml b/conf/vanilla/autoload_configs/xml_scgi.conf.xml new file mode 100644 index 0000000000..b9662d1638 --- /dev/null +++ b/conf/vanilla/autoload_configs/xml_scgi.conf.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + From 6c0e1f90f93db19355e6d646b56b222e54f892dc Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 9 May 2012 17:11:03 -0500 Subject: [PATCH 0243/1057] tweak --- src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl index bf56c9c0c1..4be66361e5 100644 --- a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl +++ b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl @@ -89,5 +89,5 @@ while (my $request = $scgi->accept) { #print $handle "Content-Type: text/xml\n\n"; print $handle $xml; - + exit; } From 7b54701d7ce60394734edbcbe0c19cbc4813ad7d Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Wed, 9 May 2012 15:18:12 -0700 Subject: [PATCH 0244/1057] mod_voicemail: Improved feedback to user when chaning vm passwords. --- conf/vanilla/lang/en/vm/sounds.xml | 4 ++-- src/mod/applications/mod_voicemail/mod_voicemail.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/conf/vanilla/lang/en/vm/sounds.xml b/conf/vanilla/lang/en/vm/sounds.xml index ff8844ae97..fdef472a5b 100644 --- a/conf/vanilla/lang/en/vm/sounds.xml +++ b/conf/vanilla/lang/en/vm/sounds.xml @@ -29,7 +29,7 @@ - + @@ -37,7 +37,7 @@ - + diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 44bafb3ea2..2ed70ce05d 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2197,8 +2197,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p if (fail) { /* add feedback for user - let him/her know that the password they tried to change to is not allowed */ - /* change the following macro to VM_CHANGE_PASS_FAIL_MACRO when new prompts have been recorded */ - switch_ivr_phrase_macro(session, VM_FAIL_AUTH_MACRO, NULL, NULL, NULL); + switch_ivr_phrase_macro(session, VM_CHANGE_PASS_FAIL_MACRO, NULL, NULL, NULL); } else { sql = switch_mprintf("update voicemail_prefs set password='%s' where username='%s' and domain='%s'", buf, myid, domain_name); vm_execute_sql(profile, sql, profile->mutex); From a9977a7cac8d16d1015269d26022766301eaf793 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 21:44:55 +0000 Subject: [PATCH 0245/1057] debian: separate out libfreeswitch1 --- debian/.gitignore | 1 + debian/bootstrap.sh | 20 ++++++++++++++++++++ debian/freeswitch.install | 1 - debian/libfreeswitch1.install | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 debian/libfreeswitch1.install diff --git a/debian/.gitignore b/debian/.gitignore index 437658053c..dc57b0b450 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -28,3 +28,4 @@ /freeswitch-sounds*/ /freeswitch-systemd/ /freeswitch-sysvinit/ +/libfreeswitch*/ diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 4c40b7eaed..8e26928043 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -194,6 +194,16 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch . This package contains the FreeSWITCH core. +Package: libfreeswitch1 +Architecture: any +Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends} +Recommends: +Suggests: libfreeswitch1-dbg +Description: Cross-Platform Scalable Multi-Protocol Soft Switch + $(debian_wrap "${fs_description}") + . + This package contains the FreeSWITCH core library. + Package: freeswitch-meta-bare Architecture: any Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) @@ -335,6 +345,16 @@ Description: debugging symbols for FreeSWITCH . This package contains debugging symbols for FreeSWITCH. +Package: libfreeswitch1-dbg +Section: debug +Priority: extra +Architecture: any +Depends: \${misc:Depends}, libfreeswitch1 (= \${binary:Version}) +Description: debugging symbols for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains debugging symbols for libfreeswitch1. + Package: freeswitch-dev Section: libdevel Architecture: any diff --git a/debian/freeswitch.install b/debian/freeswitch.install index 199329cdd3..d713fe0607 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -1,3 +1,2 @@ /usr/bin -/usr/lib/libfreeswitch.so.* /usr/share/freeswitch/scripts diff --git a/debian/libfreeswitch1.install b/debian/libfreeswitch1.install new file mode 100644 index 0000000000..216259cdd4 --- /dev/null +++ b/debian/libfreeswitch1.install @@ -0,0 +1 @@ +/usr/lib/libfreeswitch.so.* From 52fe417d936069f538d4bf71bc1dba2bbe2f2c38 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 21:48:30 +0000 Subject: [PATCH 0246/1057] debian: don't put module .la files in freeswitch-dev --- debian/freeswitch-dev.install | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/freeswitch-dev.install b/debian/freeswitch-dev.install index b63cfa4530..3d92ab2480 100644 --- a/debian/freeswitch-dev.install +++ b/debian/freeswitch-dev.install @@ -1,5 +1,4 @@ /usr/include -/usr/lib/freeswitch/mod/*.la /usr/lib/libfreeswitch.so /usr/lib/*.a /usr/lib/*.la From d64c72e88d37af374e7659e3c2e9288922a81039 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 22:00:04 +0000 Subject: [PATCH 0247/1057] debian: don't distribute .la files with modules Debian wants rid of .la files, and these module .la files shouldn't be necessary on a Debian system. --- debian/bootstrap.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 8e26928043..a2e6ec7eca 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -516,7 +516,6 @@ EOF print_mod_install () { cat < Date: Wed, 9 May 2012 22:05:15 +0000 Subject: [PATCH 0248/1057] debian: add mod_xml_scgi --- debian/control-modules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debian/control-modules b/debian/control-modules index 922bbf119d..8ea77b00f0 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -641,3 +641,7 @@ Module: xml_int/mod_xml_rpc Description: mod_xml_rpc Adds mod_xml_rpc. +Module: xml_int/mod_xml_scgi +Description: mod_xml_scgi + Adds mod_xml_scgi. + From 4e4b0d45e2969a598aadbb4b90b8d53ff3ed6571 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 22:28:31 +0000 Subject: [PATCH 0249/1057] debian: reduce edit distance between control-modules and .gen --- debian/bootstrap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index a2e6ec7eca..4757284bc9 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -841,7 +841,8 @@ parse_mod_control echo "Displaying includes/excludes..." >&2 map_modules 'mod_filter_show' '' '' echo "Generating control-modules.gen as sanity check..." >&2 -(echo "# -*- mode:debian-control -*-"; echo; \ +(echo "# -*- mode:debian-control -*-"; \ + echo "##### Author: Travis Cross "; echo; \ map_modules ':' 'genmodctl_cat' 'genmodctl_mod' \ ) > control-modules.gen From 9c6a3d76d3aea03624120e3d1f71981f1c7b7462 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 22:31:25 +0000 Subject: [PATCH 0250/1057] debian: rename libfreeswitch-dev package appropriately --- debian/bootstrap.sh | 2 +- debian/{freeswitch-dev.install => libfreeswitch-dev.install} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename debian/{freeswitch-dev.install => libfreeswitch-dev.install} (100%) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 4757284bc9..436ae77dca 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -355,7 +355,7 @@ Description: debugging symbols for FreeSWITCH . This package contains debugging symbols for libfreeswitch1. -Package: freeswitch-dev +Package: libfreeswitch-dev Section: libdevel Architecture: any Depends: \${misc:Depends}, freeswitch diff --git a/debian/freeswitch-dev.install b/debian/libfreeswitch-dev.install similarity index 100% rename from debian/freeswitch-dev.install rename to debian/libfreeswitch-dev.install From 7624ca0ba652060ece83dd26f6bb027af1fc6c31 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 22:49:30 +0000 Subject: [PATCH 0251/1057] debian: don't distribute .la file with libfreeswitch-dev Debian wants rid of .la files, and leaving this out shouldn't do any harm on a Debian system. --- debian/libfreeswitch-dev.install | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/libfreeswitch-dev.install b/debian/libfreeswitch-dev.install index 3d92ab2480..730856899c 100644 --- a/debian/libfreeswitch-dev.install +++ b/debian/libfreeswitch-dev.install @@ -1,5 +1,4 @@ /usr/include /usr/lib/libfreeswitch.so /usr/lib/*.a -/usr/lib/*.la /usr/lib/pkgconfig From 76330ec918259e61907fbc37e6b2ab2f648b6674 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 23:20:37 +0000 Subject: [PATCH 0252/1057] debian: update package name for lintian override --- debian/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 436ae77dca..852571aeed 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -878,9 +878,9 @@ grep -e '^Package:' control | while xread l; do print_long_filename_override "$m" >> $f fi done -f=freeswitch.lintian-overrides +f=libfreeswitch1.lintian-overrides [ -s $f ] || print_edit_warning >> $f -print_gpl_openssl_override "freeswitch" >> $f +print_gpl_openssl_override "libfreeswitch1" >> $f echo "Done bootstrapping debian/" >&2 touch .stamp-bootstrap From 3ba5c72977f6f3fd26c935717842f35dd48f5ad5 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Thu, 10 May 2012 10:19:45 +0200 Subject: [PATCH 0253/1057] release mutex after iterating over channel vars --- .../event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c b/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c index f2ecd35a4a..4c8aded61c 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c @@ -124,11 +124,16 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) /* Channel variables */ bson_append_start_object(&cdr, "variables"); - for (hi = switch_channel_variable_first(channel); hi; hi = hi->next) { - if (!zstr(hi->name) && !zstr(hi->value)) { - bson_append_string(&cdr, hi->name, hi->value); + + if ((hi = switch_channel_variable_first(channel))) { + for (; hi; hi = hi->next) { + if (!zstr(hi->name) && !zstr(hi->value)) { + bson_append_string(&cdr, hi->name, hi->value); + } } + switch_channel_variable_last(channel); } + bson_append_finish_object(&cdr); /* variables */ From 951f15990194d637e013bc4e70ed7089a1a62bc4 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Thu, 10 May 2012 11:03:04 +0200 Subject: [PATCH 0254/1057] update mongo-c-driver to 0.5.2 --- .../event_handlers/mod_cdr_mongodb/Makefile | 6 +- .../mod_cdr_mongodb/driver/HISTORY.md | 30 + .../mod_cdr_mongodb/driver/README.md | 4 +- .../mod_cdr_mongodb/driver/SConstruct | 178 ------ .../mod_cdr_mongodb/driver/src/bson.c | 308 ++++++---- .../mod_cdr_mongodb/driver/src/bson.h | 241 +++++--- .../mod_cdr_mongodb/driver/src/encoding.c | 2 +- .../mod_cdr_mongodb/driver/src/encoding.h | 6 +- .../mod_cdr_mongodb/driver/src/env.h | 39 ++ .../mod_cdr_mongodb/driver/src/env_posix.c | 165 +++++ .../mod_cdr_mongodb/driver/src/env_standard.c | 168 +++++ .../mod_cdr_mongodb/driver/src/env_win32.c | 183 ++++++ .../mod_cdr_mongodb/driver/src/gridfs.c | 115 ++-- .../mod_cdr_mongodb/driver/src/gridfs.h | 64 +- .../mod_cdr_mongodb/driver/src/md5.c | 6 +- .../mod_cdr_mongodb/driver/src/md5.h | 19 +- .../mod_cdr_mongodb/driver/src/mongo.c | 576 +++++++++++++----- .../mod_cdr_mongodb/driver/src/mongo.h | 191 ++++-- .../mod_cdr_mongodb/driver/src/net.c | 98 --- .../mod_cdr_mongodb/driver/src/net.h | 57 -- .../mod_cdr_mongodb/driver/src/numbers.c | 2 +- .../mod_cdr_mongodb/driver/src/platform.h | 94 --- .../driver/src/platform/linux/net.c | 183 ------ .../driver/src/platform/linux/net.h | 51 -- 24 files changed, 1598 insertions(+), 1188 deletions(-) delete mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/SConstruct create mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/env.h create mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_posix.c create mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_standard.c create mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_win32.c delete mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.c delete mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.h delete mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform.h delete mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.c delete mode 100644 src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.h diff --git a/src/mod/event_handlers/mod_cdr_mongodb/Makefile b/src/mod/event_handlers/mod_cdr_mongodb/Makefile index b9e04b983d..6a412a0f66 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/Makefile +++ b/src/mod/event_handlers/mod_cdr_mongodb/Makefile @@ -2,8 +2,8 @@ include ../../../../build/modmake.rules MONGODB_DRIVER=./driver/src LOCAL_CFLAGS=-I$(MONGODB_DRIVER) -LOCAL_OBJS=$(MONGODB_DRIVER)/md5.o \ - $(MONGODB_DRIVER)/mongo.o $(MONGODB_DRIVER)/net.o \ - $(MONGODB_DRIVER)/bson.o $(MONGODB_DRIVER)/numbers.o $(MONGODB_DRIVER)/encoding.o \ +LOCAL_OBJS=$(MONGODB_DRIVER)/encoding.o $(MONGODB_DRIVER)/env_posix.o \ + $(MONGODB_DRIVER)/bson.o $(MONGODB_DRIVER)/md5.o \ + $(MONGODB_DRIVER)/mongo.o $(MONGODB_DRIVER)/numbers.o local_depend: $(LOCAL_OBJS) diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/HISTORY.md b/src/mod/event_handlers/mod_cdr_mongodb/driver/HISTORY.md index f3f0fab21d..1659192909 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/HISTORY.md +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/HISTORY.md @@ -1,5 +1,35 @@ # MongoDB C Driver History +## 0.5.2 +2012-5-4 + +* Validate collection and database names on insert. +* Validate insert limits using max BSON size. +* Support getaddrinfo and SO_RCVTIMEO and SO_SNDTIMEO on Windows. +* Store errno/WSAGetLastError() on errors. +* Various bug fixes and refactorings. +* Update error reporting docs. + +## 0.5.1 + +* Env for POSIX, WIN32, and standard C. +* Various bug fixes. + +## 0.5 +2012-3-31 + +* Separate cursor-specific errors into their own enum: mongo_cursor_error_t. +* Catch $err return on bad queries and store the result in conn->getlasterrorcode + and conn->getlasterrstr. +* On queries that return $err, set cursor->err to MONGO_CURSOR_QUERY_FAIL. +* When passing bad BSON to a cursor object, set cursor->err to MONGO_CURSOR_BSON_ERROR, + and store the specific BSON error on the conn->err field. +* Remove bson_copy_basic(). +* bson_copy() will copy finished bson objects only. +* bson_copy() returns BSON_OK on success and BSON_ERROR on failure. +* Added a Makefile for easy compile and install on Linux and OS X. +* Replica set connect fixes. + ## 0.4 THIS RELEASE INCLUDES NUMEROUS BACKWARD-BREAKING CHANGES. diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/README.md b/src/mod/event_handlers/mod_cdr_mongodb/driver/README.md index 1afe39e69c..d8c7526683 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/README.md +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/README.md @@ -12,9 +12,9 @@ Until the 1.0 release, this driver should be considered alpha. Keep in mind that # Building First check out the version you want to build. *Always build from a particular tag, since HEAD may be -a work in progress.* For example, to build version 0.4, run: +a work in progress.* For example, to build version 0.5.2, run: - git checkout v0.4 + git checkout v0.5.2 You can then build the driver with scons: diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/SConstruct b/src/mod/event_handlers/mod_cdr_mongodb/driver/SConstruct deleted file mode 100644 index d3be2d89a6..0000000000 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/SConstruct +++ /dev/null @@ -1,178 +0,0 @@ -# -*- mode: python; -*- - -VERSION = "0.4" - -# --- options ---- -AddOption('--test-server', - dest='test_server', - default='127.0.0.1', - type='string', - nargs=1, - action='store', - help='IP address of server to use for testing') - -AddOption('--seed-start-port', - dest='seed_start_port', - default=30000, - type='int', - nargs=1, - action='store', - help='IP address of server to use for testing') - -AddOption('--c99', - dest='use_c99', - default=False, - action='store_true', - help='Compile with c99 (recommended for gcc)') - -AddOption('--d', - dest='optimize', - default=True, - action='store_false', - help='disable optimizations') - -AddOption('--use-platform', - dest='compile_platform', - default='GENERIC', - type='string', - nargs=1, - action='store', - help='Compile for a specific platform to take advantage ' - ' of particular system features. For the moment, this include timeouts only.' - ' Current options include LINUX, ' - ' GENERIC, and CUSTOM. If you specific CUSTOM, you must place a' - ' system-specific implementation of net.h and net.c in src/platform/custom/') - -import os, sys - -env = Environment( ENV=os.environ ) - -# ---- Docs ---- -def build_docs(env, target, source): - buildscript_path = os.path.join(os.path.abspath("docs")) - sys.path.insert(0, buildscript_path) - import buildscripts - from buildscripts import docs - docs.main() - -env.Alias("docs", [], [build_docs]) -env.AlwaysBuild("docs") - -# ---- Platforms ---- -PLATFORM_TEST_DIR = None -if "LINUX" == GetOption('compile_platform'): - env.Append( CPPFLAGS=" -D_MONGO_USE_LINUX_SYSTEM" ) - NET_LIB = "src/platform/linux/net.c" - PLATFORM_TEST_DIR = "test/platform/linux/" - PLATFORM_TESTS = [ "timeouts" ] -elif "CUSTOM" == GetOption('compile_platform'): - env.Append( CPPFLAGS=" -D_MONGO_USE_CUSTOM_SYSTEM" ) - NET_LIB = "src/platform/custom/net.c" -else: - NET_LIB = "src/net.c" - -# ---- Libraries ---- -if os.sys.platform in ["darwin", "linux2"]: - env.Append( CPPFLAGS=" -pedantic -Wall -ggdb -DMONGO_HAVE_STDINT" ) - env.Append( CPPPATH=["/opt/local/include/"] ) - env.Append( LIBPATH=["/opt/local/lib/"] ) - - if GetOption('use_c99'): - env.Append( CFLAGS=" -std=c99 " ) - env.Append( CXXDEFINES="MONGO_HAVE_STDINT" ) - else: - env.Append( CFLAGS=" -ansi " ) - - if GetOption('optimize'): - env.Append( CPPFLAGS=" -O3 " ) - # -O3 benchmarks *significantly* faster than -O2 when disabling networking -elif 'win32' == os.sys.platform: - env.Append( LIBS='ws2_32' ) - -#we shouldn't need these options in c99 mode -if not GetOption('use_c99'): - conf = Configure(env) - - if not conf.CheckType('int64_t'): - if conf.CheckType('int64_t', '#include \n'): - conf.env.Append( CPPDEFINES="MONGO_HAVE_STDINT" ) - elif conf.CheckType('int64_t', '#include \n'): - conf.env.Append( CPPDEFINES="MONGO_HAVE_UNISTD" ) - elif conf.CheckType('__int64'): - conf.env.Append( CPPDEFINES="MONGO_USE__INT64" ) - elif conf.CheckType('long long int'): - conf.env.Append( CPPDEFINES="MONGO_USE_LONG_LONG_INT" ) - else: - print "*** what is your 64 bit int type? ****" - Exit(1) - - env = conf.Finish() - -have_libjson = False -conf = Configure(env) -if conf.CheckLib('json'): - have_libjson = True -env = conf.Finish() - -if sys.byteorder == 'big': - env.Append( CPPDEFINES="MONGO_BIG_ENDIAN" ) - -env.Append( CPPPATH=["src/"] ) - -coreFiles = ["src/md5.c" ] -mFiles = [ "src/mongo.c", NET_LIB, "src/gridfs.c"] -bFiles = [ "src/bson.c", "src/numbers.c", "src/encoding.c"] -mLibFiles = coreFiles + mFiles + bFiles -bLibFiles = coreFiles + bFiles -m = env.Library( "mongoc" , mLibFiles ) -b = env.Library( "bson" , bLibFiles ) -env.Default( env.Alias( "lib" , [ m[0] , b[0] ] ) ) - -if os.sys.platform == "linux2": - env.Append( SHLINKFLAGS="-shared -Wl,-soname,libmongoc.so." + VERSION ) - env.Append( SHLINKFLAGS = "-shared -Wl,-soname,libbson.so." + VERSION ) - -dynm = env.SharedLibrary( "mongoc" , mLibFiles ) -dynb = env.SharedLibrary( "bson" , bLibFiles ) -env.Default( env.Alias( "sharedlib" , [ dynm[0] , dynb[0] ] ) ) - - - -# ---- Benchmarking ---- -benchmarkEnv = env.Clone() -benchmarkEnv.Append( CPPDEFINES=[('TEST_SERVER', r'\"%s\"'%GetOption('test_server')), -('SEED_START_PORT', r'%d'%GetOption('seed_start_port'))] ) -benchmarkEnv.Append( LIBS=[m, b] ) -benchmarkEnv.Prepend( LIBPATH=["."] ) -benchmarkEnv.Program( "benchmark" , [ "test/benchmark.c"] ) - -# ---- Tests ---- -testEnv = benchmarkEnv.Clone() -testCoreFiles = [ ] - -def run_tests( root, tests ): - for name in tests: - filename = "%s/%s.c" % (root, name) - exe = "test_" + name - test = testEnv.Program( exe , testCoreFiles + [filename] ) - test_alias = testEnv.Alias('test', [test], test[0].abspath + ' 2> ' + os.path.devnull) - AlwaysBuild(test_alias) - -tests = Split("sizes resize endian_swap bson bson_subobject simple update errors " -"count_delete auth gridfs validate examples helpers oid functions cursors replica_set") - -# Run standard tests -run_tests("test", tests) - -# Run platform tests -if not PLATFORM_TEST_DIR is None: - run_tests( PLATFORM_TEST_DIR, PLATFORM_TESTS ) - -if have_libjson: - tests.append('json') - testEnv.Append( LIBS=["json"] ) - -# special case for cpptest -test = testEnv.Program( 'test_cpp' , testCoreFiles + ['test/cpptest.cpp'] ) -test_alias = testEnv.Alias('test', [test], test[0].abspath + ' 2> '+ os.path.devnull) -AlwaysBuild(test_alias) diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.c index 349f42284c..26d17d8696 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.c @@ -33,7 +33,11 @@ static const int zero = 0; void *( *bson_malloc_func )( size_t ) = malloc; void *( *bson_realloc_func )( void *, size_t ) = realloc; void ( *bson_free )( void * ) = free; +#ifdef R_SAFETY_NET +bson_printf_func bson_printf; +#else bson_printf_func bson_printf = printf; +#endif bson_fprintf_func bson_fprintf = fprintf; bson_sprintf_func bson_sprintf = sprintf; @@ -48,33 +52,32 @@ static int ( *oid_inc_func )( void ) = NULL; READING ------------------------------ */ -bson *bson_empty( bson *obj ) { +MONGO_EXPORT bson* bson_create() { + return (bson*)bson_malloc(sizeof(bson)); +} + +MONGO_EXPORT void bson_dispose(bson* b) { + bson_free(b); +} + +MONGO_EXPORT bson *bson_empty( bson *obj ) { static char *data = "\005\0\0\0\0"; bson_init_data( obj, data ); obj->finished = 1; obj->err = 0; + obj->errstr = NULL; obj->stackPos = 0; return obj; } -void bson_copy_basic( bson *out, const bson *in ) { - if ( !out ) return; +MONGO_EXPORT int bson_copy( bson *out, const bson *in ) { + if ( !out ) return BSON_ERROR; + if ( !in->finished ) return BSON_ERROR; bson_init_size( out, bson_size( in ) ); memcpy( out->data, in->data, bson_size( in ) ); -} + out->finished = 1; -void bson_copy( bson *out, const bson *in ) { - int i; - - if ( !out ) return; - bson_copy_basic( out, in ); - out->cur = out->data + ( in->cur - in->data ); - out->dataSize = in->dataSize; - out->finished = in->finished; - out->stackPos = in->stackPos; - out->err = in->err; - for( i=0; istackPos; i++ ) - out->stack[i] = in->stack[i]; + return BSON_OK; } int bson_init_data( bson *b, char *data ) { @@ -82,6 +85,12 @@ int bson_init_data( bson *b, char *data ) { return BSON_OK; } +int bson_init_finished_data( bson *b, char *data ) { + bson_init_data( b, data ); + b->finished = 1; + return BSON_OK; +} + static void _bson_reset( bson *b ) { b->finished = 0; b->stackPos = 0; @@ -89,7 +98,7 @@ static void _bson_reset( bson *b ) { b->errstr = NULL; } -int bson_size( const bson *b ) { +MONGO_EXPORT int bson_size( const bson *b ) { int i; if ( ! b || ! b->data ) return 0; @@ -97,7 +106,12 @@ int bson_size( const bson *b ) { return i; } -const char *bson_data( bson *b ) { +MONGO_EXPORT int bson_buffer_size( const bson *b ) { + return (b->cur - b->data + 1); +} + + +MONGO_EXPORT const char *bson_data( const bson *b ) { return (const char *)b->data; } @@ -146,14 +160,14 @@ static char hexbyte( char hex ) { } } -void bson_oid_from_string( bson_oid_t *oid, const char *str ) { +MONGO_EXPORT void bson_oid_from_string( bson_oid_t *oid, const char *str ) { int i; for ( i=0; i<12; i++ ) { oid->bytes[i] = ( hexbyte( str[2*i] ) << 4 ) | hexbyte( str[2*i + 1] ); } } -void bson_oid_to_string( const bson_oid_t *oid, char *str ) { +MONGO_EXPORT void bson_oid_to_string( const bson_oid_t *oid, char *str ) { static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; int i; for ( i=0; i<12; i++ ) { @@ -163,15 +177,15 @@ void bson_oid_to_string( const bson_oid_t *oid, char *str ) { str[24] = '\0'; } -void bson_set_oid_fuzz( int ( *func )( void ) ) { +MONGO_EXPORT void bson_set_oid_fuzz( int ( *func )( void ) ) { oid_fuzz_func = func; } -void bson_set_oid_inc( int ( *func )( void ) ) { +MONGO_EXPORT void bson_set_oid_inc( int ( *func )( void ) ) { oid_inc_func = func; } -void bson_oid_gen( bson_oid_t *oid ) { +MONGO_EXPORT void bson_oid_gen( bson_oid_t *oid ) { static int incr = 0; static int fuzz = 0; int i; @@ -196,18 +210,18 @@ void bson_oid_gen( bson_oid_t *oid ) { bson_big_endian32( &oid->ints[2], &i ); } -time_t bson_oid_generated_time( bson_oid_t *oid ) { +MONGO_EXPORT time_t bson_oid_generated_time( bson_oid_t *oid ) { time_t out; bson_big_endian32( &out, &oid->ints[0] ); return out; } -void bson_print( bson *b ) { +MONGO_EXPORT void bson_print( const bson *b ) { bson_print_raw( b->data , 0 ); } -void bson_print_raw( const char *data , int depth ) { +MONGO_EXPORT void bson_print_raw( const char *data , int depth ) { bson_iterator i; const char *key; int temp; @@ -223,69 +237,69 @@ void bson_print_raw( const char *data , int depth ) { key = bson_iterator_key( &i ); for ( temp=0; temp<=depth; temp++ ) - printf( "\t" ); + bson_printf( "\t" ); bson_printf( "%s : %d \t " , key , t ); switch ( t ) { case BSON_DOUBLE: - printf( "%f" , bson_iterator_double( &i ) ); + bson_printf( "%f" , bson_iterator_double( &i ) ); break; case BSON_STRING: - printf( "%s" , bson_iterator_string( &i ) ); + bson_printf( "%s" , bson_iterator_string( &i ) ); break; case BSON_SYMBOL: - printf( "SYMBOL: %s" , bson_iterator_string( &i ) ); + bson_printf( "SYMBOL: %s" , bson_iterator_string( &i ) ); break; case BSON_OID: bson_oid_to_string( bson_iterator_oid( &i ), oidhex ); - printf( "%s" , oidhex ); + bson_printf( "%s" , oidhex ); break; case BSON_BOOL: - printf( "%s" , bson_iterator_bool( &i ) ? "true" : "false" ); + bson_printf( "%s" , bson_iterator_bool( &i ) ? "true" : "false" ); break; case BSON_DATE: - printf( "%ld" , ( long int )bson_iterator_date( &i ) ); + bson_printf( "%ld" , ( long int )bson_iterator_date( &i ) ); break; case BSON_BINDATA: - printf( "BSON_BINDATA" ); + bson_printf( "BSON_BINDATA" ); break; case BSON_UNDEFINED: - printf( "BSON_UNDEFINED" ); + bson_printf( "BSON_UNDEFINED" ); break; case BSON_NULL: - printf( "BSON_NULL" ); + bson_printf( "BSON_NULL" ); break; case BSON_REGEX: - printf( "BSON_REGEX: %s", bson_iterator_regex( &i ) ); + bson_printf( "BSON_REGEX: %s", bson_iterator_regex( &i ) ); break; case BSON_CODE: - printf( "BSON_CODE: %s", bson_iterator_code( &i ) ); + bson_printf( "BSON_CODE: %s", bson_iterator_code( &i ) ); break; case BSON_CODEWSCOPE: - printf( "BSON_CODE_W_SCOPE: %s", bson_iterator_code( &i ) ); + bson_printf( "BSON_CODE_W_SCOPE: %s", bson_iterator_code( &i ) ); bson_init( &scope ); bson_iterator_code_scope( &i, &scope ); - printf( "\n\t SCOPE: " ); + bson_printf( "\n\t SCOPE: " ); bson_print( &scope ); break; case BSON_INT: - printf( "%d" , bson_iterator_int( &i ) ); + bson_printf( "%d" , bson_iterator_int( &i ) ); break; case BSON_LONG: - printf( "%lld" , ( long long int )bson_iterator_long( &i ) ); + bson_printf( "%lld" , ( uint64_t )bson_iterator_long( &i ) ); break; case BSON_TIMESTAMP: ts = bson_iterator_timestamp( &i ); - printf( "i: %d, t: %d", ts.i, ts.t ); + bson_printf( "i: %d, t: %d", ts.i, ts.t ); break; case BSON_OBJECT: case BSON_ARRAY: - printf( "\n" ); + bson_printf( "\n" ); bson_print_raw( bson_iterator_value( &i ) , depth + 1 ); break; default: bson_errprintf( "can't print type : %d\n" , t ); } - printf( "\n" ); + bson_printf( "\n" ); } } @@ -293,17 +307,25 @@ void bson_print_raw( const char *data , int depth ) { ITERATOR ------------------------------ */ -void bson_iterator_init( bson_iterator *i, const bson *b ) { +MONGO_EXPORT bson_iterator* bson_iterator_create() { + return (bson_iterator*)malloc(sizeof(bson_iterator*)); +} + +MONGO_EXPORT void bson_iterator_dispose(bson_iterator* i) { + free(i); +} + +MONGO_EXPORT void bson_iterator_init( bson_iterator *i, const bson *b ) { i->cur = b->data + 4; i->first = 1; } -void bson_iterator_from_buffer( bson_iterator *i, const char *buffer ) { +MONGO_EXPORT void bson_iterator_from_buffer( bson_iterator *i, const char *buffer ) { i->cur = buffer + 4; i->first = 1; } -bson_type bson_find( bson_iterator *it, const bson *obj, const char *name ) { +MONGO_EXPORT bson_type bson_find( bson_iterator *it, const bson *obj, const char *name ) { bson_iterator_init( it, (bson *)obj ); while( bson_iterator_next( it ) ) { if ( strcmp( name, bson_iterator_key( it ) ) == 0 ) @@ -312,11 +334,11 @@ bson_type bson_find( bson_iterator *it, const bson *obj, const char *name ) { return bson_iterator_type( it ); } -bson_bool_t bson_iterator_more( const bson_iterator *i ) { +MONGO_EXPORT bson_bool_t bson_iterator_more( const bson_iterator *i ) { return *( i->cur ); } -bson_type bson_iterator_next( bson_iterator *i ) { +MONGO_EXPORT bson_type bson_iterator_next( bson_iterator *i ) { int ds; if ( i->first ) { @@ -384,15 +406,15 @@ bson_type bson_iterator_next( bson_iterator *i ) { return ( bson_type )( *i->cur ); } -bson_type bson_iterator_type( const bson_iterator *i ) { +MONGO_EXPORT bson_type bson_iterator_type( const bson_iterator *i ) { return ( bson_type )i->cur[0]; } -const char *bson_iterator_key( const bson_iterator *i ) { +MONGO_EXPORT const char *bson_iterator_key( const bson_iterator *i ) { return i->cur + 1; } -const char *bson_iterator_value( const bson_iterator *i ) { +MONGO_EXPORT const char *bson_iterator_value( const bson_iterator *i ) { const char *t = i->cur + 1; t += strlen( t ) + 1; return t; @@ -422,11 +444,11 @@ bson_bool_t bson_iterator_bool_raw( const bson_iterator *i ) { return bson_iterator_value( i )[0]; } -bson_oid_t *bson_iterator_oid( const bson_iterator *i ) { +MONGO_EXPORT bson_oid_t *bson_iterator_oid( const bson_iterator *i ) { return ( bson_oid_t * )bson_iterator_value( i ); } -int bson_iterator_int( const bson_iterator *i ) { +MONGO_EXPORT int bson_iterator_int( const bson_iterator *i ) { switch ( bson_iterator_type( i ) ) { case BSON_INT: return bson_iterator_int_raw( i ); @@ -439,7 +461,7 @@ int bson_iterator_int( const bson_iterator *i ) { } } -double bson_iterator_double( const bson_iterator *i ) { +MONGO_EXPORT double bson_iterator_double( const bson_iterator *i ) { switch ( bson_iterator_type( i ) ) { case BSON_INT: return bson_iterator_int_raw( i ); @@ -452,7 +474,7 @@ double bson_iterator_double( const bson_iterator *i ) { } } -int64_t bson_iterator_long( const bson_iterator *i ) { +MONGO_EXPORT int64_t bson_iterator_long( const bson_iterator *i ) { switch ( bson_iterator_type( i ) ) { case BSON_INT: return bson_iterator_int_raw( i ); @@ -465,14 +487,29 @@ int64_t bson_iterator_long( const bson_iterator *i ) { } } -bson_timestamp_t bson_iterator_timestamp( const bson_iterator *i ) { +MONGO_EXPORT bson_timestamp_t bson_iterator_timestamp( const bson_iterator *i ) { bson_timestamp_t ts; bson_little_endian32( &( ts.i ), bson_iterator_value( i ) ); bson_little_endian32( &( ts.t ), bson_iterator_value( i ) + 4 ); return ts; } -bson_bool_t bson_iterator_bool( const bson_iterator *i ) { + +MONGO_EXPORT int bson_iterator_timestamp_time( const bson_iterator *i ) { + int time; + bson_little_endian32( &time, bson_iterator_value( i ) + 4 ); + return time; +} + + +MONGO_EXPORT int bson_iterator_timestamp_increment( const bson_iterator *i ) { + int increment; + bson_little_endian32( &increment, bson_iterator_value( i ) ); + return increment; +} + + +MONGO_EXPORT bson_bool_t bson_iterator_bool( const bson_iterator *i ) { switch ( bson_iterator_type( i ) ) { case BSON_BOOL: return bson_iterator_bool_raw( i ); @@ -490,15 +527,21 @@ bson_bool_t bson_iterator_bool( const bson_iterator *i ) { } } -const char *bson_iterator_string( const bson_iterator *i ) { - return bson_iterator_value( i ) + 4; +MONGO_EXPORT const char *bson_iterator_string( const bson_iterator *i ) { + switch ( bson_iterator_type( i ) ) { + case BSON_STRING: + case BSON_SYMBOL: + return bson_iterator_value( i ) + 4; + default: + return ""; + } } int bson_iterator_string_len( const bson_iterator *i ) { return bson_iterator_int_raw( i ); } -const char *bson_iterator_code( const bson_iterator *i ) { +MONGO_EXPORT const char *bson_iterator_code( const bson_iterator *i ) { switch ( bson_iterator_type( i ) ) { case BSON_STRING: case BSON_CODE: @@ -510,57 +553,59 @@ const char *bson_iterator_code( const bson_iterator *i ) { } } -void bson_iterator_code_scope( const bson_iterator *i, bson *scope ) { +MONGO_EXPORT void bson_iterator_code_scope( const bson_iterator *i, bson *scope ) { if ( bson_iterator_type( i ) == BSON_CODEWSCOPE ) { int code_len; bson_little_endian32( &code_len, bson_iterator_value( i )+4 ); bson_init_data( scope, ( void * )( bson_iterator_value( i )+8+code_len ) ); + _bson_reset( scope ); + scope->finished = 1; } else { bson_empty( scope ); } } -bson_date_t bson_iterator_date( const bson_iterator *i ) { +MONGO_EXPORT bson_date_t bson_iterator_date( const bson_iterator *i ) { return bson_iterator_long_raw( i ); } -time_t bson_iterator_time_t( const bson_iterator *i ) { +MONGO_EXPORT time_t bson_iterator_time_t( const bson_iterator *i ) { return bson_iterator_date( i ) / 1000; } -int bson_iterator_bin_len( const bson_iterator *i ) { +MONGO_EXPORT int bson_iterator_bin_len( const bson_iterator *i ) { return ( bson_iterator_bin_type( i ) == BSON_BIN_BINARY_OLD ) ? bson_iterator_int_raw( i ) - 4 : bson_iterator_int_raw( i ); } -char bson_iterator_bin_type( const bson_iterator *i ) { +MONGO_EXPORT char bson_iterator_bin_type( const bson_iterator *i ) { return bson_iterator_value( i )[4]; } -const char *bson_iterator_bin_data( const bson_iterator *i ) { +MONGO_EXPORT const char *bson_iterator_bin_data( const bson_iterator *i ) { return ( bson_iterator_bin_type( i ) == BSON_BIN_BINARY_OLD ) ? bson_iterator_value( i ) + 9 : bson_iterator_value( i ) + 5; } -const char *bson_iterator_regex( const bson_iterator *i ) { +MONGO_EXPORT const char *bson_iterator_regex( const bson_iterator *i ) { return bson_iterator_value( i ); } -const char *bson_iterator_regex_opts( const bson_iterator *i ) { +MONGO_EXPORT const char *bson_iterator_regex_opts( const bson_iterator *i ) { const char *p = bson_iterator_value( i ); return p + strlen( p ) + 1; } -void bson_iterator_subobject( const bson_iterator *i, bson *sub ) { +MONGO_EXPORT void bson_iterator_subobject( const bson_iterator *i, bson *sub ) { bson_init_data( sub, ( char * )bson_iterator_value( i ) ); _bson_reset( sub ); sub->finished = 1; } -void bson_iterator_subiterator( const bson_iterator *i, bson_iterator *sub ) { +MONGO_EXPORT void bson_iterator_subiterator( const bson_iterator *i, bson_iterator *sub ) { bson_iterator_from_buffer( sub, bson_iterator_value( i ) ); } @@ -578,7 +623,7 @@ static void _bson_init_size( bson *b, int size ) { _bson_reset( b ); } -void bson_init( bson *b ) { +MONGO_EXPORT void bson_init( bson *b ) { _bson_init_size( b, initialBufferSize ); } @@ -635,7 +680,7 @@ int bson_ensure_space( bson *b, const int bytesNeeded ) { return BSON_OK; } -int bson_finish( bson *b ) { +MONGO_EXPORT int bson_finish( bson *b ) { int i; if( b->err & BSON_NOT_UTF8 ) @@ -652,12 +697,14 @@ int bson_finish( bson *b ) { return BSON_OK; } -void bson_destroy( bson *b ) { - bson_free( b->data ); - b->err = 0; - b->data = 0; - b->cur = 0; - b->finished = 1; +MONGO_EXPORT void bson_destroy( bson *b ) { + if (b) { + bson_free( b->data ); + b->err = 0; + b->data = 0; + b->cur = 0; + b->finished = 1; + } } static int bson_append_estart( bson *b, int type, const char *name, const int dataSize ) { @@ -686,41 +733,41 @@ static int bson_append_estart( bson *b, int type, const char *name, const int da BUILDING TYPES ------------------------------ */ -int bson_append_int( bson *b, const char *name, const int i ) { +MONGO_EXPORT int bson_append_int( bson *b, const char *name, const int i ) { if ( bson_append_estart( b, BSON_INT, name, 4 ) == BSON_ERROR ) return BSON_ERROR; bson_append32( b , &i ); return BSON_OK; } -int bson_append_long( bson *b, const char *name, const int64_t i ) { +MONGO_EXPORT int bson_append_long( bson *b, const char *name, const int64_t i ) { if ( bson_append_estart( b , BSON_LONG, name, 8 ) == BSON_ERROR ) return BSON_ERROR; bson_append64( b , &i ); return BSON_OK; } -int bson_append_double( bson *b, const char *name, const double d ) { +MONGO_EXPORT int bson_append_double( bson *b, const char *name, const double d ) { if ( bson_append_estart( b, BSON_DOUBLE, name, 8 ) == BSON_ERROR ) return BSON_ERROR; bson_append64( b , &d ); return BSON_OK; } -int bson_append_bool( bson *b, const char *name, const bson_bool_t i ) { +MONGO_EXPORT int bson_append_bool( bson *b, const char *name, const bson_bool_t i ) { if ( bson_append_estart( b, BSON_BOOL, name, 1 ) == BSON_ERROR ) return BSON_ERROR; bson_append_byte( b , i != 0 ); return BSON_OK; } -int bson_append_null( bson *b, const char *name ) { +MONGO_EXPORT int bson_append_null( bson *b, const char *name ) { if ( bson_append_estart( b , BSON_NULL, name, 0 ) == BSON_ERROR ) return BSON_ERROR; return BSON_OK; } -int bson_append_undefined( bson *b, const char *name ) { +MONGO_EXPORT int bson_append_undefined( bson *b, const char *name ) { if ( bson_append_estart( b, BSON_UNDEFINED, name, 0 ) == BSON_ERROR ) return BSON_ERROR; return BSON_OK; @@ -741,31 +788,31 @@ int bson_append_string_base( bson *b, const char *name, return BSON_OK; } -int bson_append_string( bson *b, const char *name, const char *value ) { +MONGO_EXPORT int bson_append_string( bson *b, const char *name, const char *value ) { return bson_append_string_base( b, name, value, strlen ( value ), BSON_STRING ); } -int bson_append_symbol( bson *b, const char *name, const char *value ) { +MONGO_EXPORT int bson_append_symbol( bson *b, const char *name, const char *value ) { return bson_append_string_base( b, name, value, strlen ( value ), BSON_SYMBOL ); } -int bson_append_code( bson *b, const char *name, const char *value ) { +MONGO_EXPORT int bson_append_code( bson *b, const char *name, const char *value ) { return bson_append_string_base( b, name, value, strlen ( value ), BSON_CODE ); } -int bson_append_string_n( bson *b, const char *name, const char *value, int len ) { +MONGO_EXPORT int bson_append_string_n( bson *b, const char *name, const char *value, int len ) { return bson_append_string_base( b, name, value, len, BSON_STRING ); } -int bson_append_symbol_n( bson *b, const char *name, const char *value, int len ) { +MONGO_EXPORT int bson_append_symbol_n( bson *b, const char *name, const char *value, int len ) { return bson_append_string_base( b, name, value, len, BSON_SYMBOL ); } -int bson_append_code_n( bson *b, const char *name, const char *value, int len ) { +MONGO_EXPORT int bson_append_code_n( bson *b, const char *name, const char *value, int len ) { return bson_append_string_base( b, name, value, len, BSON_CODE ); } -int bson_append_code_w_scope_n( bson *b, const char *name, +MONGO_EXPORT int bson_append_code_w_scope_n( bson *b, const char *name, const char *code, int len, const bson *scope ) { int sl = len + 1; @@ -779,11 +826,11 @@ int bson_append_code_w_scope_n( bson *b, const char *name, return BSON_OK; } -int bson_append_code_w_scope( bson *b, const char *name, const char *code, const bson *scope ) { +MONGO_EXPORT int bson_append_code_w_scope( bson *b, const char *name, const char *code, const bson *scope ) { return bson_append_code_w_scope_n( b, name, code, strlen ( code ), scope ); } -int bson_append_binary( bson *b, const char *name, char type, const char *str, int len ) { +MONGO_EXPORT int bson_append_binary( bson *b, const char *name, char type, const char *str, int len ) { if ( type == BSON_BIN_BINARY_OLD ) { int subtwolen = len + 4; if ( bson_append_estart( b, BSON_BINDATA, name, 4+1+4+len ) == BSON_ERROR ) @@ -802,20 +849,20 @@ int bson_append_binary( bson *b, const char *name, char type, const char *str, i return BSON_OK; } -int bson_append_oid( bson *b, const char *name, const bson_oid_t *oid ) { +MONGO_EXPORT int bson_append_oid( bson *b, const char *name, const bson_oid_t *oid ) { if ( bson_append_estart( b, BSON_OID, name, 12 ) == BSON_ERROR ) return BSON_ERROR; bson_append( b , oid , 12 ); return BSON_OK; } -int bson_append_new_oid( bson *b, const char *name ) { +MONGO_EXPORT int bson_append_new_oid( bson *b, const char *name ) { bson_oid_t oid; bson_oid_gen( &oid ); return bson_append_oid( b, name, &oid ); } -int bson_append_regex( bson *b, const char *name, const char *pattern, const char *opts ) { +MONGO_EXPORT int bson_append_regex( bson *b, const char *name, const char *pattern, const char *opts ) { const int plen = strlen( pattern )+1; const int olen = strlen( opts )+1; if ( bson_append_estart( b, BSON_REGEX, name, plen + olen ) == BSON_ERROR ) @@ -827,14 +874,14 @@ int bson_append_regex( bson *b, const char *name, const char *pattern, const cha return BSON_OK; } -int bson_append_bson( bson *b, const char *name, const bson *bson ) { +MONGO_EXPORT int bson_append_bson( bson *b, const char *name, const bson *bson ) { if ( bson_append_estart( b, BSON_OBJECT, name, bson_size( bson ) ) == BSON_ERROR ) return BSON_ERROR; bson_append( b , bson->data , bson_size( bson ) ); return BSON_OK; } -int bson_append_element( bson *b, const char *name_or_null, const bson_iterator *elem ) { +MONGO_EXPORT int bson_append_element( bson *b, const char *name_or_null, const bson_iterator *elem ) { bson_iterator next = *elem; int size; @@ -854,7 +901,7 @@ int bson_append_element( bson *b, const char *name_or_null, const bson_iterator return BSON_OK; } -int bson_append_timestamp( bson *b, const char *name, bson_timestamp_t *ts ) { +MONGO_EXPORT int bson_append_timestamp( bson *b, const char *name, bson_timestamp_t *ts ) { if ( bson_append_estart( b, BSON_TIMESTAMP, name, 8 ) == BSON_ERROR ) return BSON_ERROR; bson_append32( b , &( ts->i ) ); @@ -863,31 +910,39 @@ int bson_append_timestamp( bson *b, const char *name, bson_timestamp_t *ts ) { return BSON_OK; } -int bson_append_date( bson *b, const char *name, bson_date_t millis ) { +MONGO_EXPORT int bson_append_timestamp2( bson *b, const char *name, int time, int increment ) { + if ( bson_append_estart( b, BSON_TIMESTAMP, name, 8 ) == BSON_ERROR ) return BSON_ERROR; + + bson_append32( b , &increment ); + bson_append32( b , &time ); + return BSON_OK; +} + +MONGO_EXPORT int bson_append_date( bson *b, const char *name, bson_date_t millis ) { if ( bson_append_estart( b, BSON_DATE, name, 8 ) == BSON_ERROR ) return BSON_ERROR; bson_append64( b , &millis ); return BSON_OK; } -int bson_append_time_t( bson *b, const char *name, time_t secs ) { +MONGO_EXPORT int bson_append_time_t( bson *b, const char *name, time_t secs ) { return bson_append_date( b, name, ( bson_date_t )secs * 1000 ); } -int bson_append_start_object( bson *b, const char *name ) { +MONGO_EXPORT int bson_append_start_object( bson *b, const char *name ) { if ( bson_append_estart( b, BSON_OBJECT, name, 5 ) == BSON_ERROR ) return BSON_ERROR; b->stack[ b->stackPos++ ] = b->cur - b->data; bson_append32( b , &zero ); return BSON_OK; } -int bson_append_start_array( bson *b, const char *name ) { +MONGO_EXPORT int bson_append_start_array( bson *b, const char *name ) { if ( bson_append_estart( b, BSON_ARRAY, name, 5 ) == BSON_ERROR ) return BSON_ERROR; b->stack[ b->stackPos++ ] = b->cur - b->data; bson_append32( b , &zero ); return BSON_OK; } -int bson_append_finish_object( bson *b ) { +MONGO_EXPORT int bson_append_finish_object( bson *b ) { char *start; int i; if ( bson_ensure_space( b, 1 ) == BSON_ERROR ) return BSON_ERROR; @@ -900,22 +955,25 @@ int bson_append_finish_object( bson *b ) { return BSON_OK; } -int bson_append_finish_array( bson *b ) { - return bson_append_finish_object( b ); +MONGO_EXPORT double bson_int64_to_double( int64_t i64 ) { + return (double)i64; } +MONGO_EXPORT int bson_append_finish_array( bson *b ) { + return bson_append_finish_object( b ); +} /* Error handling and allocators. */ static bson_err_handler err_handler = NULL; -bson_err_handler set_bson_err_handler( bson_err_handler func ) { +MONGO_EXPORT bson_err_handler set_bson_err_handler( bson_err_handler func ) { bson_err_handler old = err_handler; err_handler = func; return old; } -void *bson_malloc( int size ) { +MONGO_EXPORT void *bson_malloc( int size ) { void *p; p = bson_malloc_func( size ); bson_fatal_msg( !!p, "malloc() failed" ); @@ -933,7 +991,9 @@ int _bson_errprintf( const char *format, ... ) { va_list ap; int ret; va_start( ap, format ); +#ifndef R_SAFETY_NET ret = vfprintf( stderr, format, ap ); +#endif va_end( ap ); return ret; @@ -961,9 +1021,10 @@ void bson_fatal_msg( int ok , const char *msg ) { if ( err_handler ) { err_handler( msg ); } - +#ifndef R_SAFETY_NET bson_errprintf( "error: %s\n" , msg ); exit( -5 ); +#endif } @@ -976,3 +1037,28 @@ void bson_numstr( char *str, int i ) { else bson_sprintf( str,"%d", i ); } + +MONGO_EXPORT void bson_swap_endian64( void *outp, const void *inp ) { + const char *in = ( const char * )inp; + char *out = ( char * )outp; + + out[0] = in[7]; + out[1] = in[6]; + out[2] = in[5]; + out[3] = in[4]; + out[4] = in[3]; + out[5] = in[2]; + out[6] = in[1]; + out[7] = in[0]; + +} + +MONGO_EXPORT void bson_swap_endian32( void *outp, const void *inp ) { + const char *in = ( const char * )inp; + char *out = ( char * )outp; + + out[0] = in[3]; + out[1] = in[2]; + out[2] = in[1]; + out[3] = in[0]; +} diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.h index 2e385b9160..b83d1ca9c9 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.h +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/bson.h @@ -3,7 +3,7 @@ * @brief BSON Declarations */ -/* Copyright 2009-2011 10gen Inc. +/* Copyright 2009-2012 10gen Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,63 @@ * limitations under the License. */ -#ifndef _BSON_H_ -#define _BSON_H_ +#ifndef BSON_H_ +#define BSON_H_ -#include "platform.h" #include #include #include #include #include +#ifdef __GNUC__ + #define MONGO_INLINE static __inline__ + #define MONGO_EXPORT +#else + #define MONGO_INLINE static + #ifdef MONGO_STATIC_BUILD + #define MONGO_EXPORT + #elif defined(MONGO_DLL_BUILD) + #define MONGO_EXPORT __declspec(dllexport) + #else + #define MONGO_EXPORT __declspec(dllimport) + #endif +#endif + +#ifdef __cplusplus +#define MONGO_EXTERN_C_START extern "C" { +#define MONGO_EXTERN_C_END } +#else +#define MONGO_EXTERN_C_START +#define MONGO_EXTERN_C_END +#endif + +#if defined(MONGO_HAVE_STDINT) || __STDC_VERSION__ >= 199901L +#include +#elif defined(MONGO_HAVE_UNISTD) +#include +#elif defined(MONGO_USE__INT64) +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#elif defined(MONGO_USE_LONG_LONG_INT) +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#else +#error Must compile with c99 or define MONGO_HAVE_STDINT, MONGO_HAVE_UNISTD, MONGO_USE__INT64, or MONGO_USE_LONG_INT. +#endif + +#ifdef MONGO_BIG_ENDIAN +#define bson_little_endian64(out, in) ( bson_swap_endian64(out, in) ) +#define bson_little_endian32(out, in) ( bson_swap_endian32(out, in) ) +#define bson_big_endian64(out, in) ( memcpy(out, in, 8) ) +#define bson_big_endian32(out, in) ( memcpy(out, in, 4) ) +#else +#define bson_little_endian64(out, in) ( memcpy(out, in, 8) ) +#define bson_little_endian32(out, in) ( memcpy(out, in, 4) ) +#define bson_big_endian64(out, in) ( bson_swap_endian64(out, in) ) +#define bson_big_endian32(out, in) ( bson_swap_endian32(out, in) ) +#endif + MONGO_EXTERN_C_START #define BSON_OK 0 @@ -84,12 +131,12 @@ typedef struct { } bson_iterator; typedef struct { - char *data; - char *cur; - int dataSize; - bson_bool_t finished; - int stack[32]; - int stackPos; + char *data; /**< Pointer to a block of data in this BSON object. */ + char *cur; /**< Pointer to the current position. */ + int dataSize; /**< The number of bytes allocated to char *data. */ + bson_bool_t finished; /**< When finished, the BSON object can no longer be modified. */ + int stack[32]; /**< A stack used to keep track of nested BSON elements. */ + int stackPos; /**< Index of current stack position. */ int err; /**< Bitfield representing errors or warnings on this buffer */ char *errstr; /**< A string representation of the most recent error or warning. */ } bson; @@ -112,6 +159,9 @@ typedef struct { READING ------------------------------ */ +MONGO_EXPORT bson* bson_create(); +MONGO_EXPORT void bson_dispose(bson* b); + /** * Size of a BSON object. * @@ -119,21 +169,22 @@ typedef struct { * * @return the size. */ -int bson_size( const bson *b ); +MONGO_EXPORT int bson_size( const bson *b ); +MONGO_EXPORT int bson_buffer_size( const bson *b ); /** * Print a string representation of a BSON object. * * @param b the BSON object to print. */ -void bson_print( bson *b ); +MONGO_EXPORT void bson_print( const bson *b ); /** * Return a pointer to the raw buffer stored by this bson object. * * @param b a BSON object */ -const char *bson_data( bson *b ); +MONGO_EXPORT const char *bson_data( const bson *b ); /** * Print a string representation of a BSON object. @@ -141,7 +192,7 @@ const char *bson_data( bson *b ); * @param bson the raw data to print. * @param depth the depth to recurse the object.x */ -void bson_print_raw( const char *bson , int depth ); +MONGO_EXPORT void bson_print_raw( const char *bson , int depth ); /** * Advance a bson_iterator to the named field. @@ -152,15 +203,18 @@ void bson_print_raw( const char *bson , int depth ); * * @return the type of the found object or BSON_EOO if it is not found. */ -bson_type bson_find( bson_iterator *it, const bson *obj, const char *name ); +MONGO_EXPORT bson_type bson_find( bson_iterator *it, const bson *obj, const char *name ); + +MONGO_EXPORT bson_iterator* bson_iterator_create(); +MONGO_EXPORT void bson_iterator_dispose(bson_iterator*); /** * Initialize a bson_iterator. * * @param i the bson_iterator to initialize. * @param bson the BSON object to associate with the iterator. */ -void bson_iterator_init( bson_iterator *i , const bson *b ); +MONGO_EXPORT void bson_iterator_init( bson_iterator *i , const bson *b ); /** * Initialize a bson iterator from a const char* buffer. Note @@ -169,7 +223,7 @@ void bson_iterator_init( bson_iterator *i , const bson *b ); * @param i the bson_iterator to initialize. * @param buffer the buffer to point to. */ -void bson_iterator_from_buffer( bson_iterator *i, const char *buffer ); +MONGO_EXPORT void bson_iterator_from_buffer( bson_iterator *i, const char *buffer ); /* more returns true for eoo. best to loop with bson_iterator_next(&it) */ /** @@ -179,7 +233,7 @@ void bson_iterator_from_buffer( bson_iterator *i, const char *buffer ); * * @return returns true if there is more data. */ -bson_bool_t bson_iterator_more( const bson_iterator *i ); +MONGO_EXPORT bson_bool_t bson_iterator_more( const bson_iterator *i ); /** * Point the iterator at the next BSON object. @@ -188,7 +242,7 @@ bson_bool_t bson_iterator_more( const bson_iterator *i ); * * @return the type of the next BSON object. */ -bson_type bson_iterator_next( bson_iterator *i ); +MONGO_EXPORT bson_type bson_iterator_next( bson_iterator *i ); /** * Get the type of the BSON object currently pointed to by the iterator. @@ -197,7 +251,7 @@ bson_type bson_iterator_next( bson_iterator *i ); * * @return the type of the current BSON object. */ -bson_type bson_iterator_type( const bson_iterator *i ); +MONGO_EXPORT bson_type bson_iterator_type( const bson_iterator *i ); /** * Get the key of the BSON object currently pointed to by the iterator. @@ -206,7 +260,7 @@ bson_type bson_iterator_type( const bson_iterator *i ); * * @return the key of the current BSON object. */ -const char *bson_iterator_key( const bson_iterator *i ); +MONGO_EXPORT const char *bson_iterator_key( const bson_iterator *i ); /** * Get the value of the BSON object currently pointed to by the iterator. @@ -215,7 +269,7 @@ const char *bson_iterator_key( const bson_iterator *i ); * * @return the value of the current BSON object. */ -const char *bson_iterator_value( const bson_iterator *i ); +MONGO_EXPORT const char *bson_iterator_value( const bson_iterator *i ); /* these convert to the right type (return 0 if non-numeric) */ /** @@ -226,7 +280,7 @@ const char *bson_iterator_value( const bson_iterator *i ); * * @return the value of the current BSON object. */ -double bson_iterator_double( const bson_iterator *i ); +MONGO_EXPORT double bson_iterator_double( const bson_iterator *i ); /** * Get the int value of the BSON object currently pointed to by the iterator. @@ -235,7 +289,7 @@ double bson_iterator_double( const bson_iterator *i ); * * @return the value of the current BSON object. */ -int bson_iterator_int( const bson_iterator *i ); +MONGO_EXPORT int bson_iterator_int( const bson_iterator *i ); /** * Get the long value of the BSON object currently pointed to by the iterator. @@ -244,7 +298,7 @@ int bson_iterator_int( const bson_iterator *i ); * * @return the value of the current BSON object. */ -int64_t bson_iterator_long( const bson_iterator *i ); +MONGO_EXPORT int64_t bson_iterator_long( const bson_iterator *i ); /* return the bson timestamp as a whole or in parts */ /** @@ -255,7 +309,9 @@ int64_t bson_iterator_long( const bson_iterator *i ); * * @return the value of the current BSON object. */ -bson_timestamp_t bson_iterator_timestamp( const bson_iterator *i ); +MONGO_EXPORT bson_timestamp_t bson_iterator_timestamp( const bson_iterator *i ); +MONGO_EXPORT int bson_iterator_timestamp_time( const bson_iterator *i ); +MONGO_EXPORT int bson_iterator_timestamp_increment( const bson_iterator *i ); /** * Get the boolean value of the BSON object currently pointed to by @@ -267,7 +323,7 @@ bson_timestamp_t bson_iterator_timestamp( const bson_iterator *i ); */ /* false: boolean false, 0 in any type, or null */ /* true: anything else (even empty strings and objects) */ -bson_bool_t bson_iterator_bool( const bson_iterator *i ); +MONGO_EXPORT bson_bool_t bson_iterator_bool( const bson_iterator *i ); /** * Get the double value of the BSON object currently pointed to by the @@ -318,7 +374,7 @@ bson_bool_t bson_iterator_bool_raw( const bson_iterator *i ); * * @return the value of the current BSON object. */ -bson_oid_t *bson_iterator_oid( const bson_iterator *i ); +MONGO_EXPORT bson_oid_t *bson_iterator_oid( const bson_iterator *i ); /** * Get the string value of the BSON object currently pointed to by the @@ -329,7 +385,7 @@ bson_oid_t *bson_iterator_oid( const bson_iterator *i ); * @return the value of the current BSON object. */ /* these can also be used with bson_code and bson_symbol*/ -const char *bson_iterator_string( const bson_iterator *i ); +MONGO_EXPORT const char *bson_iterator_string( const bson_iterator *i ); /** * Get the string length of the BSON object currently pointed to by the @@ -352,7 +408,7 @@ int bson_iterator_string_len( const bson_iterator *i ); */ /* works with bson_code, bson_codewscope, and BSON_STRING */ /* returns NULL for everything else */ -const char *bson_iterator_code( const bson_iterator *i ); +MONGO_EXPORT const char *bson_iterator_code( const bson_iterator *i ); /** * Calls bson_empty on scope if not a bson_codewscope @@ -361,7 +417,7 @@ const char *bson_iterator_code( const bson_iterator *i ); * @param scope the bson scope. */ /* calls bson_empty on scope if not a bson_codewscope */ -void bson_iterator_code_scope( const bson_iterator *i, bson *scope ); +MONGO_EXPORT void bson_iterator_code_scope( const bson_iterator *i, bson *scope ); /** * Get the date value of the BSON object currently pointed to by the @@ -372,7 +428,7 @@ void bson_iterator_code_scope( const bson_iterator *i, bson *scope ); * @return the date value of the current BSON object. */ /* both of these only work with bson_date */ -bson_date_t bson_iterator_date( const bson_iterator *i ); +MONGO_EXPORT bson_date_t bson_iterator_date( const bson_iterator *i ); /** * Get the time value of the BSON object currently pointed to by the @@ -382,7 +438,7 @@ bson_date_t bson_iterator_date( const bson_iterator *i ); * * @return the time value of the current BSON object. */ -time_t bson_iterator_time_t( const bson_iterator *i ); +MONGO_EXPORT time_t bson_iterator_time_t( const bson_iterator *i ); /** * Get the length of the BSON binary object currently pointed to by the @@ -392,7 +448,7 @@ time_t bson_iterator_time_t( const bson_iterator *i ); * * @return the length of the current BSON binary object. */ -int bson_iterator_bin_len( const bson_iterator *i ); +MONGO_EXPORT int bson_iterator_bin_len( const bson_iterator *i ); /** * Get the type of the BSON binary object currently pointed to by the @@ -402,7 +458,7 @@ int bson_iterator_bin_len( const bson_iterator *i ); * * @return the type of the current BSON binary object. */ -char bson_iterator_bin_type( const bson_iterator *i ); +MONGO_EXPORT char bson_iterator_bin_type( const bson_iterator *i ); /** * Get the value of the BSON binary object currently pointed to by the @@ -412,7 +468,7 @@ char bson_iterator_bin_type( const bson_iterator *i ); * * @return the value of the current BSON binary object. */ -const char *bson_iterator_bin_data( const bson_iterator *i ); +MONGO_EXPORT const char *bson_iterator_bin_data( const bson_iterator *i ); /** * Get the value of the BSON regex object currently pointed to by the @@ -422,7 +478,7 @@ const char *bson_iterator_bin_data( const bson_iterator *i ); * * @return the value of the current BSON regex object. */ -const char *bson_iterator_regex( const bson_iterator *i ); +MONGO_EXPORT const char *bson_iterator_regex( const bson_iterator *i ); /** * Get the options of the BSON regex object currently pointed to by the @@ -432,7 +488,7 @@ const char *bson_iterator_regex( const bson_iterator *i ); * * @return the options of the current BSON regex object. */ -const char *bson_iterator_regex_opts( const bson_iterator *i ); +MONGO_EXPORT const char *bson_iterator_regex_opts( const bson_iterator *i ); /* these work with BSON_OBJECT and BSON_ARRAY */ /** @@ -442,7 +498,7 @@ const char *bson_iterator_regex_opts( const bson_iterator *i ); * @param i the bson_iterator. * @param sub the BSON subobject destination. */ -void bson_iterator_subobject( const bson_iterator *i, bson *sub ); +MONGO_EXPORT void bson_iterator_subobject( const bson_iterator *i, bson *sub ); /** * Get a bson_iterator that on the BSON subobject. @@ -450,7 +506,7 @@ void bson_iterator_subobject( const bson_iterator *i, bson *sub ); * @param i the bson_iterator. * @param sub the iterator to point at the BSON subobject. */ -void bson_iterator_subiterator( const bson_iterator *i, bson_iterator *sub ); +MONGO_EXPORT void bson_iterator_subiterator( const bson_iterator *i, bson_iterator *sub ); /* str must be at least 24 hex chars + null byte */ /** @@ -459,7 +515,7 @@ void bson_iterator_subiterator( const bson_iterator *i, bson_iterator *sub ); * @param oid the bson_oid_t destination. * @param str a null terminated string comprised of at least 24 hex chars. */ -void bson_oid_from_string( bson_oid_t *oid, const char *str ); +MONGO_EXPORT void bson_oid_from_string( bson_oid_t *oid, const char *str ); /** * Create a string representation of the bson_oid_t. @@ -467,14 +523,14 @@ void bson_oid_from_string( bson_oid_t *oid, const char *str ); * @param oid the bson_oid_t source. * @param str the string representation destination. */ -void bson_oid_to_string( const bson_oid_t *oid, char *str ); +MONGO_EXPORT void bson_oid_to_string( const bson_oid_t *oid, char *str ); /** * Create a bson_oid object. * * @param oid the destination for the newly created bson_oid_t. */ -void bson_oid_gen( bson_oid_t *oid ); +MONGO_EXPORT void bson_oid_gen( bson_oid_t *oid ); /** * Set a function to be used to generate the second four bytes @@ -482,7 +538,7 @@ void bson_oid_gen( bson_oid_t *oid ); * * @param func a pointer to a function that returns an int. */ -void bson_set_oid_fuzz( int ( *func )( void ) ); +MONGO_EXPORT void bson_set_oid_fuzz( int ( *func )( void ) ); /** * Set a function to be used to generate the incrementing part @@ -491,14 +547,14 @@ void bson_set_oid_fuzz( int ( *func )( void ) ); * * @param func a pointer to a function that returns an int. */ -void bson_set_oid_inc( int ( *func )( void ) ); +MONGO_EXPORT void bson_set_oid_inc( int ( *func )( void ) ); /** * Get the time a bson_oid_t was created. * * @param oid the bson_oid_t. */ -time_t bson_oid_generated_time( bson_oid_t *oid ); /* Gives the time the OID was created */ +MONGO_EXPORT time_t bson_oid_generated_time( bson_oid_t *oid ); /* Gives the time the OID was created */ /* ---------------------------- BUILDING @@ -512,7 +568,7 @@ time_t bson_oid_generated_time( bson_oid_t *oid ); /* Gives the time the OID was * @note When finished, you must pass the bson object to * bson_destroy( ). */ -void bson_init( bson *b ); +MONGO_EXPORT void bson_init( bson *b ); /** * Initialize a BSON object, and point its data @@ -524,6 +580,7 @@ void bson_init( bson *b ); * @return BSON_OK or BSON_ERROR. */ int bson_init_data( bson *b , char *data ); +int bson_init_finished_data( bson *b, char *data ) ; /** * Initialize a BSON object, and set its @@ -555,7 +612,7 @@ int bson_ensure_space( bson *b, const int bytesNeeded ); * @return the standard error code. To deallocate memory, * call bson_destroy on the bson object. */ -int bson_finish( bson *b ); +MONGO_EXPORT int bson_finish( bson *b ); /** * Destroy a bson object. @@ -563,7 +620,7 @@ int bson_finish( bson *b ); * @param b the bson object to destroy. * */ -void bson_destroy( bson *b ); +MONGO_EXPORT void bson_destroy( bson *b ); /** * Returns a pointer to a static empty BSON object. @@ -573,23 +630,17 @@ void bson_destroy( bson *b ); * @return the empty initialized BSON object. */ /* returns pointer to static empty bson object */ -bson *bson_empty( bson *obj ); - -/** - * Copy BSON data only from one object to another. - * - * @param out the copy destination BSON object. - * @param in the copy source BSON object. - */ -void bson_copy_basic( bson *out, const bson *in ); +MONGO_EXPORT bson *bson_empty( bson *obj ); /** * Make a complete copy of the a BSON object. + * The source bson object must be in a finished + * state; otherwise, the copy will fail. * * @param out the copy destination BSON object. * @param in the copy source BSON object. */ -void bson_copy( bson *out, const bson *in ); /* puts data in new buffer. NOOP if out==NULL */ +MONGO_EXPORT int bson_copy( bson *out, const bson *in ); /* puts data in new buffer. NOOP if out==NULL */ /** * Append a previously created bson_oid_t to a bson object. @@ -600,7 +651,7 @@ void bson_copy( bson *out, const bson *in ); /* puts data in new buffer. NOOP if * * @return BSON_OK or BSON_ERROR. */ -int bson_append_oid( bson *b, const char *name, const bson_oid_t *oid ); +MONGO_EXPORT int bson_append_oid( bson *b, const char *name, const bson_oid_t *oid ); /** * Append a bson_oid_t to a bson. @@ -610,7 +661,7 @@ int bson_append_oid( bson *b, const char *name, const bson_oid_t *oid ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_new_oid( bson *b, const char *name ); +MONGO_EXPORT int bson_append_new_oid( bson *b, const char *name ); /** * Append an int to a bson. @@ -621,7 +672,7 @@ int bson_append_new_oid( bson *b, const char *name ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_int( bson *b, const char *name, const int i ); +MONGO_EXPORT int bson_append_int( bson *b, const char *name, const int i ); /** * Append an long to a bson. @@ -632,7 +683,7 @@ int bson_append_int( bson *b, const char *name, const int i ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_long( bson *b, const char *name, const int64_t i ); +MONGO_EXPORT int bson_append_long( bson *b, const char *name, const int64_t i ); /** * Append an double to a bson. @@ -643,7 +694,7 @@ int bson_append_long( bson *b, const char *name, const int64_t i ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_double( bson *b, const char *name, const double d ); +MONGO_EXPORT int bson_append_double( bson *b, const char *name, const double d ); /** * Append a string to a bson. @@ -654,7 +705,7 @@ int bson_append_double( bson *b, const char *name, const double d ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_string( bson *b, const char *name, const char *str ); +MONGO_EXPORT int bson_append_string( bson *b, const char *name, const char *str ); /** * Append len bytes of a string to a bson. @@ -666,7 +717,7 @@ int bson_append_string( bson *b, const char *name, const char *str ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_string_n( bson *b, const char *name, const char *str, int len ); +MONGO_EXPORT int bson_append_string_n( bson *b, const char *name, const char *str, int len ); /** * Append a symbol to a bson. @@ -677,7 +728,7 @@ int bson_append_string_n( bson *b, const char *name, const char *str, int len ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_symbol( bson *b, const char *name, const char *str ); +MONGO_EXPORT int bson_append_symbol( bson *b, const char *name, const char *str ); /** * Append len bytes of a symbol to a bson. @@ -689,7 +740,7 @@ int bson_append_symbol( bson *b, const char *name, const char *str ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_symbol_n( bson *b, const char *name, const char *str, int len ); +MONGO_EXPORT int bson_append_symbol_n( bson *b, const char *name, const char *str, int len ); /** * Append code to a bson. @@ -701,7 +752,7 @@ int bson_append_symbol_n( bson *b, const char *name, const char *str, int len ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_code( bson *b, const char *name, const char *str ); +MONGO_EXPORT int bson_append_code( bson *b, const char *name, const char *str ); /** * Append len bytes of code to a bson. @@ -713,7 +764,7 @@ int bson_append_code( bson *b, const char *name, const char *str ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_code_n( bson *b, const char *name, const char *str, int len ); +MONGO_EXPORT int bson_append_code_n( bson *b, const char *name, const char *str, int len ); /** * Append code to a bson with scope. @@ -725,7 +776,7 @@ int bson_append_code_n( bson *b, const char *name, const char *str, int len ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_code_w_scope( bson *b, const char *name, const char *code, const bson *scope ); +MONGO_EXPORT int bson_append_code_w_scope( bson *b, const char *name, const char *code, const bson *scope ); /** * Append len bytes of code to a bson with scope. @@ -738,7 +789,7 @@ int bson_append_code_w_scope( bson *b, const char *name, const char *code, const * * @return BSON_OK or BSON_ERROR. */ -int bson_append_code_w_scope_n( bson *b, const char *name, const char *code, int size, const bson *scope ); +MONGO_EXPORT int bson_append_code_w_scope_n( bson *b, const char *name, const char *code, int size, const bson *scope ); /** * Append binary data to a bson. @@ -751,7 +802,7 @@ int bson_append_code_w_scope_n( bson *b, const char *name, const char *code, int * * @return BSON_OK or BSON_ERROR. */ -int bson_append_binary( bson *b, const char *name, char type, const char *str, int len ); +MONGO_EXPORT int bson_append_binary( bson *b, const char *name, char type, const char *str, int len ); /** * Append a bson_bool_t to a bson. @@ -762,7 +813,7 @@ int bson_append_binary( bson *b, const char *name, char type, const char *str, i * * @return BSON_OK or BSON_ERROR. */ -int bson_append_bool( bson *b, const char *name, const bson_bool_t v ); +MONGO_EXPORT int bson_append_bool( bson *b, const char *name, const bson_bool_t v ); /** * Append a null value to a bson. @@ -772,7 +823,7 @@ int bson_append_bool( bson *b, const char *name, const bson_bool_t v ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_null( bson *b, const char *name ); +MONGO_EXPORT int bson_append_null( bson *b, const char *name ); /** * Append an undefined value to a bson. @@ -782,7 +833,7 @@ int bson_append_null( bson *b, const char *name ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_undefined( bson *b, const char *name ); +MONGO_EXPORT int bson_append_undefined( bson *b, const char *name ); /** * Append a regex value to a bson. @@ -794,7 +845,7 @@ int bson_append_undefined( bson *b, const char *name ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_regex( bson *b, const char *name, const char *pattern, const char *opts ); +MONGO_EXPORT int bson_append_regex( bson *b, const char *name, const char *pattern, const char *opts ); /** * Append bson data to a bson. @@ -805,7 +856,7 @@ int bson_append_regex( bson *b, const char *name, const char *pattern, const cha * * @return BSON_OK or BSON_ERROR. */ -int bson_append_bson( bson *b, const char *name, const bson *bson ); +MONGO_EXPORT int bson_append_bson( bson *b, const char *name, const bson *bson ); /** * Append a BSON element to a bson from the current point of an iterator. @@ -816,7 +867,7 @@ int bson_append_bson( bson *b, const char *name, const bson *bson ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_element( bson *b, const char *name_or_null, const bson_iterator *elem ); +MONGO_EXPORT int bson_append_element( bson *b, const char *name_or_null, const bson_iterator *elem ); /** * Append a bson_timestamp_t value to a bson. @@ -827,7 +878,8 @@ int bson_append_element( bson *b, const char *name_or_null, const bson_iterator * * @return BSON_OK or BSON_ERROR. */ -int bson_append_timestamp( bson *b, const char *name, bson_timestamp_t *ts ); +MONGO_EXPORT int bson_append_timestamp( bson *b, const char *name, bson_timestamp_t *ts ); +MONGO_EXPORT int bson_append_timestamp2( bson *b, const char *name, int time, int increment ); /* these both append a bson_date */ /** @@ -839,7 +891,7 @@ int bson_append_timestamp( bson *b, const char *name, bson_timestamp_t *ts ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_date( bson *b, const char *name, bson_date_t millis ); +MONGO_EXPORT int bson_append_date( bson *b, const char *name, bson_date_t millis ); /** * Append a time_t value to a bson. @@ -850,7 +902,7 @@ int bson_append_date( bson *b, const char *name, bson_date_t millis ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_time_t( bson *b, const char *name, time_t secs ); +MONGO_EXPORT int bson_append_time_t( bson *b, const char *name, time_t secs ); /** * Start appending a new object to a bson. @@ -860,7 +912,7 @@ int bson_append_time_t( bson *b, const char *name, time_t secs ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_start_object( bson *b, const char *name ); +MONGO_EXPORT int bson_append_start_object( bson *b, const char *name ); /** * Start appending a new array to a bson. @@ -870,7 +922,7 @@ int bson_append_start_object( bson *b, const char *name ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_start_array( bson *b, const char *name ); +MONGO_EXPORT int bson_append_start_array( bson *b, const char *name ); /** * Finish appending a new object or array to a bson. @@ -879,7 +931,7 @@ int bson_append_start_array( bson *b, const char *name ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_finish_object( bson *b ); +MONGO_EXPORT int bson_append_finish_object( bson *b ); /** * Finish appending a new object or array to a bson. This @@ -889,13 +941,13 @@ int bson_append_finish_object( bson *b ); * * @return BSON_OK or BSON_ERROR. */ -int bson_append_finish_array( bson *b ); +MONGO_EXPORT int bson_append_finish_array( bson *b ); void bson_numstr( char *str, int i ); void bson_incnumstr( char *str ); -/* Error handling and stadard library function over-riding. */ +/* Error handling and standard library function over-riding. */ /* -------------------------------------------------------- */ /* bson_err_handlers shouldn't return!!! */ @@ -912,7 +964,6 @@ extern void ( *bson_free )( void * ); extern bson_printf_func bson_printf; extern bson_fprintf_func bson_fprintf; extern bson_sprintf_func bson_sprintf; - extern bson_printf_func bson_errprintf; /** @@ -924,7 +975,7 @@ extern bson_printf_func bson_errprintf; * * @sa malloc(3) */ -void *bson_malloc( int size ); +MONGO_EXPORT void *bson_malloc( int size ); /** * Changes the size of allocated memory and checks return value, @@ -946,7 +997,7 @@ void *bson_realloc( void *ptr, int size ); * * @return the old error handling function, or NULL. */ -bson_err_handler set_bson_err_handler( bson_err_handler func ); +MONGO_EXPORT bson_err_handler set_bson_err_handler( bson_err_handler func ); /* does nothing if ok != 0 */ /** @@ -971,5 +1022,15 @@ void bson_fatal_msg( int ok, const char *msg ); */ void bson_builder_error( bson *b ); +/** + * Cast an int64_t to double. This is necessary for embedding in + * certain environments. + * + */ +MONGO_EXPORT double bson_int64_to_double( int64_t i64 ); + +MONGO_EXPORT void bson_swap_endian32( void *outp, const void *inp ); +MONGO_EXPORT void bson_swap_endian64( void *outp, const void *inp ); + MONGO_EXTERN_C_END #endif diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.c index 8d2da1502f..00ecf18c92 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.c @@ -1,5 +1,5 @@ /* - * Copyright 2009-2011 10gen, Inc. + * Copyright 2009-2012 10gen, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.h index a2a07c6d5d..f13c31ee89 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.h +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/encoding.h @@ -1,5 +1,5 @@ /* - * Copyright 2009-2011 10gen, Inc. + * Copyright 2009-2012 10gen, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef _BSON_ENCODING_H_ -#define _BSON_ENCODING_H_ +#ifndef BSON_ENCODING_H_ +#define BSON_ENCODING_H_ MONGO_EXTERN_C_START diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env.h new file mode 100644 index 0000000000..463ee32f79 --- /dev/null +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env.h @@ -0,0 +1,39 @@ +/** @file env.h */ + +/* Copyright 2009-2012 10gen Inc. + * + * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Header for generic net.h */ +#ifndef MONGO_ENV_H_ +#define MONGO_ENV_H_ + +#include "mongo.h" + +MONGO_EXTERN_C_START + +/* This is a no-op in the generic implementation. */ +int mongo_env_set_socket_op_timeout( mongo *conn, int millis ); +int mongo_env_read_socket( mongo *conn, void *buf, int len ); +int mongo_env_write_socket( mongo *conn, const void *buf, int len ); +int mongo_env_socket_connect( mongo *conn, const char *host, int port ); + +/* Initialize socket services */ +MONGO_EXPORT int mongo_env_sock_init( void ); + +/* Close a socket */ +MONGO_EXPORT int mongo_env_close_socket( int socket ); + +MONGO_EXTERN_C_END +#endif diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_posix.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_posix.c new file mode 100644 index 0000000000..f1020ca80d --- /dev/null +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_posix.c @@ -0,0 +1,165 @@ +/* env_posix.c */ + +/* Copyright 2009-2012 10gen Inc. + * + * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Networking and other niceties for POSIX systems. */ +#include "env.h" +#include "mongo.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif + +int mongo_env_close_socket( int socket ) { + return close( socket ); +} + +int mongo_env_sock_init( void ) { + return 0; +} + +int mongo_env_write_socket( mongo *conn, const void *buf, int len ) { + const char *cbuf = buf; +#ifdef __APPLE__ + int flags = 0; +#else + int flags = MSG_NOSIGNAL; +#endif + + while ( len ) { + int sent = send( conn->sock, cbuf, len, flags ); + if ( sent == -1 ) { + if (errno == EPIPE) + conn->connected = 0; + __mongo_set_error( conn, MONGO_IO_ERROR, strerror( errno ), errno ); + return MONGO_ERROR; + } + cbuf += sent; + len -= sent; + } + + return MONGO_OK; +} + +int mongo_env_read_socket( mongo *conn, void *buf, int len ) { + char *cbuf = buf; + while ( len ) { + int sent = recv( conn->sock, cbuf, len, 0 ); + if ( sent == 0 || sent == -1 ) { + __mongo_set_error( conn, MONGO_IO_ERROR, strerror( errno ), errno ); + return MONGO_ERROR; + } + cbuf += sent; + len -= sent; + } + + return MONGO_OK; +} + +int mongo_env_set_socket_op_timeout( mongo *conn, int millis ) { + struct timeval tv; + tv.tv_sec = millis / 1000; + tv.tv_usec = ( millis % 1000 ) * 1000; + + if ( setsockopt( conn->sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof( tv ) ) == -1 ) { + conn->err = MONGO_IO_ERROR; + __mongo_set_error( conn, MONGO_IO_ERROR, "setsockopt SO_RCVTIMEO failed.", errno ); + return MONGO_ERROR; + } + + if ( setsockopt( conn->sock, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof( tv ) ) == -1 ) { + __mongo_set_error( conn, MONGO_IO_ERROR, "setsockopt SO_SNDTIMEO failed.", errno ); + return MONGO_ERROR; + } + + return MONGO_OK; +} + +int mongo_env_socket_connect( mongo *conn, const char *host, int port ) { + char port_str[NI_MAXSERV]; + int status; + + struct addrinfo ai_hints; + struct addrinfo *ai_list = NULL; + struct addrinfo *ai_ptr = NULL; + + conn->sock = 0; + conn->connected = 0; + sprintf(port_str,"%d",port); + + bson_sprintf( port_str, "%d", port ); + + memset( &ai_hints, 0, sizeof( ai_hints ) ); +#ifdef AI_ADDRCONFIG + ai_hints.ai_flags = AI_ADDRCONFIG; +#endif + ai_hints.ai_family = AF_UNSPEC; + ai_hints.ai_socktype = SOCK_STREAM; + + status = getaddrinfo( host, port_str, &ai_hints, &ai_list ); + if ( status != 0 ) { + bson_errprintf( "getaddrinfo failed: %s", gai_strerror( status ) ); + conn->err = MONGO_CONN_ADDR_FAIL; + return MONGO_ERROR; + } + + for ( ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next ) { + conn->sock = socket( ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol ); + if ( conn->sock < 0 ) { + conn->sock = 0; + continue; + } + + status = connect( conn->sock, ai_ptr->ai_addr, ai_ptr->ai_addrlen ); + if ( status != 0 ) { + mongo_env_close_socket( conn->sock ); + conn->sock = 0; + continue; + } + + if ( ai_ptr->ai_protocol == IPPROTO_TCP ) { + int flag = 1; + + setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, + ( void * ) &flag, sizeof( flag ) ); + if ( conn->op_timeout_ms > 0 ) + mongo_env_set_socket_op_timeout( conn, conn->op_timeout_ms ); + } + + conn->connected = 1; + break; + } + + freeaddrinfo( ai_list ); + + if ( ! conn->connected ) { + conn->err = MONGO_CONN_FAIL; + return MONGO_ERROR; + } + + return MONGO_OK; +} diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_standard.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_standard.c new file mode 100644 index 0000000000..36fa9f65c4 --- /dev/null +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_standard.c @@ -0,0 +1,168 @@ +/* env_standard.c */ + +/* Copyright 2009-2012 10gen Inc. + * + * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Vanilla networking designed to work on all systems. */ +#include "env.h" +#include +#include + +#ifdef _WIN32 + #ifdef _MSC_VER + #include // send,recv,socklen_t etc + #include // addrinfo + #else + #include + #include + typedef int socklen_t; + #endif +#else +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif + +int mongo_env_close_socket( int socket ) { +#ifdef _WIN32 + return closesocket( socket ); +#else + return close( socket ); +#endif +} + +int mongo_env_write_socket( mongo *conn, const void *buf, int len ) { + const char *cbuf = buf; +#ifdef _WIN32 + int flags = 0; +#else +#ifdef __APPLE__ + int flags = 0; +#else + int flags = MSG_NOSIGNAL; +#endif +#endif + + while ( len ) { + int sent = send( conn->sock, cbuf, len, flags ); + if ( sent == -1 ) { + if (errno == EPIPE) + conn->connected = 0; + conn->err = MONGO_IO_ERROR; + return MONGO_ERROR; + } + cbuf += sent; + len -= sent; + } + + return MONGO_OK; +} + +int mongo_env_read_socket( mongo *conn, void *buf, int len ) { + char *cbuf = buf; + while ( len ) { + int sent = recv( conn->sock, cbuf, len, 0 ); + if ( sent == 0 || sent == -1 ) { + conn->err = MONGO_IO_ERROR; + return MONGO_ERROR; + } + cbuf += sent; + len -= sent; + } + + return MONGO_OK; +} + +/* This is a no-op in the generic implementation. */ +int mongo_env_set_socket_op_timeout( mongo *conn, int millis ) { + return MONGO_OK; +} + +int mongo_env_socket_connect( mongo *conn, const char *host, int port ) { + struct sockaddr_in sa; + socklen_t addressSize; + int flag = 1; + + if ( ( conn->sock = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 ) { + conn->sock = 0; + conn->err = MONGO_CONN_NO_SOCKET; + return MONGO_ERROR; + } + + memset( sa.sin_zero , 0 , sizeof( sa.sin_zero ) ); + sa.sin_family = AF_INET; + sa.sin_port = htons( port ); + sa.sin_addr.s_addr = inet_addr( host ); + addressSize = sizeof( sa ); + + if ( connect( conn->sock, ( struct sockaddr * )&sa, addressSize ) == -1 ) { + mongo_env_close_socket( conn->sock ); + conn->connected = 0; + conn->sock = 0; + conn->err = MONGO_CONN_FAIL; + return MONGO_ERROR; + } + + setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, ( char * ) &flag, sizeof( flag ) ); + + if( conn->op_timeout_ms > 0 ) + mongo_env_set_socket_op_timeout( conn, conn->op_timeout_ms ); + + conn->connected = 1; + + return MONGO_OK; +} + +MONGO_EXPORT int mongo_env_sock_init( void ) { + +#if defined(_WIN32) + WSADATA wsaData; + WORD wVers; +#elif defined(SIGPIPE) + struct sigaction act; +#endif + + static int called_once; + static int retval; + if (called_once) return retval; + called_once = 1; + +#if defined(_WIN32) + wVers = MAKEWORD(1, 1); + retval = (WSAStartup(wVers, &wsaData) == 0); +#elif defined(MACINTOSH) + GUSISetup(GUSIwithInternetSockets); + retval = 1; +#elif defined(SIGPIPE) + retval = 1; + if (sigaction(SIGPIPE, (struct sigaction *)NULL, &act) < 0) + retval = 0; + else if (act.sa_handler == SIG_DFL) { + act.sa_handler = SIG_IGN; + if (sigaction(SIGPIPE, &act, (struct sigaction *)NULL) < 0) + retval = 0; + } +#endif + return retval; +} diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_win32.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_win32.c new file mode 100644 index 0000000000..0b301cea61 --- /dev/null +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/env_win32.c @@ -0,0 +1,183 @@ +/* env_win32.c */ + +/* Copyright 2009-2012 10gen Inc. + * + * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Networking and other niceties for WIN32. */ +#include "env.h" +#include "mongo.h" +#include + +#ifdef _MSC_VER +#include // send,recv,socklen_t etc +#include // addrinfo +#else +#include +#include +typedef int socklen_t; +#endif + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif + +static void mongo_clear_errors( mongo *conn ) { + conn->err = 0; + memset( conn->errstr, 0, MONGO_ERR_LEN ); +} + +int mongo_env_close_socket( int socket ) { + return closesocket( socket ); +} + +int mongo_env_write_socket( mongo *conn, const void *buf, int len ) { + const char *cbuf = buf; + int flags = 0; + + while ( len ) { + int sent = send( conn->sock, cbuf, len, flags ); + if ( sent == -1 ) { + __mongo_set_error( conn, MONGO_IO_ERROR, NULL, WSAGetLastError() ); + conn->connected = 0; + return MONGO_ERROR; + } + cbuf += sent; + len -= sent; + } + + return MONGO_OK; +} + +int mongo_env_read_socket( mongo *conn, void *buf, int len ) { + char *cbuf = buf; + + while ( len ) { + int sent = recv( conn->sock, cbuf, len, 0 ); + if ( sent == 0 || sent == -1 ) { + __mongo_set_error( conn, MONGO_IO_ERROR, NULL, WSAGetLastError() ); + return MONGO_ERROR; + } + cbuf += sent; + len -= sent; + } + + return MONGO_OK; +} + +int mongo_env_set_socket_op_timeout( mongo *conn, int millis ) { + if ( setsockopt( conn->sock, SOL_SOCKET, SO_RCVTIMEO, (const char *)&millis, + sizeof( millis ) ) == -1 ) { + __mongo_set_error( conn, MONGO_IO_ERROR, "setsockopt SO_RCVTIMEO failed.", + WSAGetLastError() ); + return MONGO_ERROR; + } + + if ( setsockopt( conn->sock, SOL_SOCKET, SO_SNDTIMEO, (const char *)&millis, + sizeof( millis ) ) == -1 ) { + __mongo_set_error( conn, MONGO_IO_ERROR, "setsockopt SO_SNDTIMEO failed.", + WSAGetLastError() ); + return MONGO_ERROR; + } + + return MONGO_OK; +} + +int mongo_env_socket_connect( mongo *conn, const char *host, int port ) { + char port_str[NI_MAXSERV]; + char errstr[MONGO_ERR_LEN]; + int status; + + struct addrinfo ai_hints; + struct addrinfo *ai_list = NULL; + struct addrinfo *ai_ptr = NULL; + + conn->sock = 0; + conn->connected = 0; + + bson_sprintf( port_str, "%d", port ); + + memset( &ai_hints, 0, sizeof( ai_hints ) ); + ai_hints.ai_family = AF_UNSPEC; + ai_hints.ai_socktype = SOCK_STREAM; + ai_hints.ai_protocol = IPPROTO_TCP; + + status = getaddrinfo( host, port_str, &ai_hints, &ai_list ); + if ( status != 0 ) { + bson_sprintf( errstr, "getaddrinfo failed with error %d", status ); + __mongo_set_error( conn, MONGO_CONN_ADDR_FAIL, errstr, WSAGetLastError() ); + return MONGO_ERROR; + } + + for ( ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next ) { + conn->sock = socket( ai_ptr->ai_family, ai_ptr->ai_socktype, + ai_ptr->ai_protocol ); + + if ( conn->sock < 0 ) { + __mongo_set_error( conn, MONGO_SOCKET_ERROR, "socket() failed", + WSAGetLastError() ); + conn->sock = 0; + continue; + } + + status = connect( conn->sock, ai_ptr->ai_addr, ai_ptr->ai_addrlen ); + if ( status != 0 ) { + __mongo_set_error( conn, MONGO_SOCKET_ERROR, "connect() failed", + WSAGetLastError() ); + mongo_env_close_socket( conn->sock ); + conn->sock = 0; + continue; + } + + if ( ai_ptr->ai_protocol == IPPROTO_TCP ) { + int flag = 1; + + setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, + ( void * ) &flag, sizeof( flag ) ); + + if ( conn->op_timeout_ms > 0 ) + mongo_env_set_socket_op_timeout( conn, conn->op_timeout_ms ); + } + + conn->connected = 1; + break; + } + + freeaddrinfo( ai_list ); + + if ( ! conn->connected ) { + conn->err = MONGO_CONN_FAIL; + return MONGO_ERROR; + } + else { + mongo_clear_errors( conn ); + return MONGO_OK; + } +} + +MONGO_EXPORT int mongo_env_sock_init( void ) { + + WSADATA wsaData; + WORD wVers; + static int called_once; + static int retval; + + if (called_once) return retval; + + called_once = 1; + wVers = MAKEWORD(1, 1); + retval = (WSAStartup(wVers, &wsaData) == 0); + + return retval; +} diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/gridfs.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/gridfs.c index f51b397d3f..9b2d1455ef 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/gridfs.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/gridfs.c @@ -1,6 +1,6 @@ /* gridfs.c */ -/* Copyright 2009-2011 10gen Inc. +/* Copyright 2009-2012 10gen Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,27 @@ #include #include +MONGO_EXPORT gridfs* gridfs_create() { + return (gridfs*)bson_malloc(sizeof(gridfs)); +} + +MONGO_EXPORT void gridfs_dispose(gridfs* gfs) { + free(gfs); +} + +MONGO_EXPORT gridfile* gridfile_create() { + return (gridfile*)bson_malloc(sizeof(gridfile)); +} + +MONGO_EXPORT void gridfile_dispose(gridfile* gf) { + free(gf); +} + +MONGO_EXPORT void gridfile_get_descriptor(gridfile* gf, bson* out) { + *out = *gf->meta; +} + + static bson *chunk_new( bson_oid_t id, int chunkNumber, const char *data, int len ) { bson *b = bson_malloc( sizeof( bson ) ); @@ -104,7 +125,7 @@ int gridfs_init( mongo *client, const char *dbname, const char *prefix, return MONGO_OK; } -void gridfs_destroy( gridfs *gfs ) { +MONGO_EXPORT void gridfs_destroy( gridfs *gfs ) { if ( gfs == NULL ) return; if ( gfs->dbname ) bson_free( ( char * )gfs->dbname ); if ( gfs->prefix ) bson_free( ( char * )gfs->prefix ); @@ -120,14 +141,17 @@ static int gridfs_insert_file( gridfs *gfs, const char *name, bson res; bson_iterator it; int result; + int64_t d; /* Check run md5 */ bson_init( &command ); bson_append_oid( &command, "filemd5", &id ); bson_append_string( &command, "root", gfs->prefix ); bson_finish( &command ); - assert( mongo_run_command( gfs->client, gfs->dbname, &command, &res ) == MONGO_OK ); + result = mongo_run_command( gfs->client, gfs->dbname, &command, &res ); bson_destroy( &command ); + if (result != MONGO_OK) + return result; /* Create and insert BSON for file metadata */ bson_init( &ret ); @@ -137,7 +161,8 @@ static int gridfs_insert_file( gridfs *gfs, const char *name, } bson_append_long( &ret, "length", length ); bson_append_int( &ret, "chunkSize", DEFAULT_CHUNK_SIZE ); - bson_append_date( &ret, "uploadDate", ( bson_date_t )1000*time( NULL ) ); + d = ( bson_date_t )1000*time( NULL ); + bson_append_date( &ret, "uploadDate", d); bson_find( &it, &res, "md5" ); bson_append_string( &ret, "md5", bson_iterator_string( &it ) ); bson_destroy( &res ); @@ -151,7 +176,7 @@ static int gridfs_insert_file( gridfs *gfs, const char *name, return result; } -int gridfs_store_buffer( gridfs *gfs, const char *data, +MONGO_EXPORT int gridfs_store_buffer( gridfs *gfs, const char *data, gridfs_offset length, const char *remotename, const char *contenttype ) { @@ -163,7 +188,7 @@ int gridfs_store_buffer( gridfs *gfs, const char *data, bson *oChunk; /* Large files Assertion */ - assert( length <= 0xffffffff ); + /* assert( length <= 0xffffffff ); */ /* Generate and append an oid*/ bson_oid_gen( &id ); @@ -183,7 +208,7 @@ int gridfs_store_buffer( gridfs *gfs, const char *data, return gridfs_insert_file( gfs, remotename, id, length, contenttype ); } -void gridfile_writer_init( gridfile *gfile, gridfs *gfs, +MONGO_EXPORT void gridfile_writer_init( gridfile *gfile, gridfs *gfs, const char *remote_name, const char *content_type ) { gfile->gfs = gfs; @@ -200,7 +225,7 @@ void gridfile_writer_init( gridfile *gfile, gridfs *gfs, strcpy( ( char * )gfile->content_type, content_type ); } -void gridfile_write_buffer( gridfile *gfile, const char *data, +MONGO_EXPORT void gridfile_write_buffer( gridfile *gfile, const char *data, gridfs_offset length ) { int bytes_left = 0; @@ -221,14 +246,13 @@ void gridfile_write_buffer( gridfile *gfile, const char *data, gfile->pending_len += length; } else { /* At least one chunk of data to write */ + chunks_to_write = to_write / DEFAULT_CHUNK_SIZE; + bytes_left = to_write % DEFAULT_CHUNK_SIZE; /* If there's a pending chunk to be written, we need to combine * the buffer provided up to DEFAULT_CHUNK_SIZE. */ if ( gfile->pending_len > 0 ) { - chunks_to_write = to_write / DEFAULT_CHUNK_SIZE; - bytes_left = to_write % DEFAULT_CHUNK_SIZE; - data_partial_len = DEFAULT_CHUNK_SIZE - gfile->pending_len; buffer = ( char * )bson_malloc( DEFAULT_CHUNK_SIZE ); memcpy( buffer, gfile->pending_data, gfile->pending_len ); @@ -270,7 +294,7 @@ void gridfile_write_buffer( gridfile *gfile, const char *data, } } -int gridfile_writer_done( gridfile *gfile ) { +MONGO_EXPORT int gridfile_writer_done( gridfile *gfile ) { /* write any remaining pending chunk data. * pending data will always take up less than one chunk */ @@ -307,8 +331,11 @@ int gridfs_store_file( gridfs *gfs, const char *filename, /* Open the file and the correct stream */ if ( strcmp( filename, "-" ) == 0 ) fd = stdin; - else fd = fopen( filename, "rb" ); - assert( fd != NULL ); /* No such file */ + else { + fd = fopen( filename, "rb" ); + if (fd == NULL) + return MONGO_ERROR; + } /* Generate and append an oid*/ bson_oid_gen( &id ); @@ -339,7 +366,7 @@ int gridfs_store_file( gridfs *gfs, const char *filename, return gridfs_insert_file( gfs, remotename, id, length, contenttype ); } -void gridfs_remove_filename( gridfs *gfs, const char *filename ) { +MONGO_EXPORT void gridfs_remove_filename( gridfs *gfs, const char *filename ) { bson query; mongo_cursor *files; bson file; @@ -433,7 +460,7 @@ int gridfile_init( gridfs *gfs, bson *meta, gridfile *gfile ) return MONGO_OK; } -void gridfile_destroy( gridfile *gfile ) +MONGO_EXPORT void gridfile_destroy( gridfile *gfile ) { bson_destroy( gfile->meta ); @@ -444,21 +471,21 @@ bson_bool_t gridfile_exists( gridfile *gfile ) { return ( bson_bool_t )( gfile != NULL || gfile->meta == NULL ); } -const char *gridfile_get_filename( gridfile *gfile ) { +MONGO_EXPORT const char *gridfile_get_filename( gridfile *gfile ) { bson_iterator it; bson_find( &it, gfile->meta, "filename" ); return bson_iterator_string( &it ); } -int gridfile_get_chunksize( gridfile *gfile ) { +MONGO_EXPORT int gridfile_get_chunksize( gridfile *gfile ) { bson_iterator it; bson_find( &it, gfile->meta, "chunkSize" ); return bson_iterator_int( &it ); } -gridfs_offset gridfile_get_contentlength( gridfile *gfile ) { +MONGO_EXPORT gridfs_offset gridfile_get_contentlength( gridfile *gfile ) { bson_iterator it; bson_find( &it, gfile->meta, "length" ); @@ -469,7 +496,7 @@ gridfs_offset gridfile_get_contentlength( gridfile *gfile ) { return ( gridfs_offset )bson_iterator_long( &it ); } -const char *gridfile_get_contenttype( gridfile *gfile ) { +MONGO_EXPORT const char *gridfile_get_contenttype( gridfile *gfile ) { bson_iterator it; if ( bson_find( &it, gfile->meta, "contentType" ) ) @@ -477,14 +504,14 @@ const char *gridfile_get_contenttype( gridfile *gfile ) { else return NULL; } -bson_date_t gridfile_get_uploaddate( gridfile *gfile ) { +MONGO_EXPORT bson_date_t gridfile_get_uploaddate( gridfile *gfile ) { bson_iterator it; bson_find( &it, gfile->meta, "uploadDate" ); return bson_iterator_date( &it ); } -const char *gridfile_get_md5( gridfile *gfile ) { +MONGO_EXPORT const char *gridfile_get_md5( gridfile *gfile ) { bson_iterator it; bson_find( &it, gfile->meta, "md5" ); @@ -505,20 +532,16 @@ bson_bool_t gridfile_get_boolean( gridfile *gfile, const char *name ) { return bson_iterator_bool( &it ); } -bson gridfile_get_metadata( gridfile *gfile ) { - bson sub; +MONGO_EXPORT void gridfile_get_metadata( gridfile *gfile, bson* out ) { bson_iterator it; - if ( bson_find( &it, gfile->meta, "metadata" ) ) { - bson_iterator_subobject( &it, &sub ); - return sub; - } else { - bson_empty( &sub ); - return sub; - } + if ( bson_find( &it, gfile->meta, "metadata" ) ) + bson_iterator_subobject( &it, out ); + else + bson_empty( out ); } -int gridfile_get_numchunks( gridfile *gfile ) { +MONGO_EXPORT int gridfile_get_numchunks( gridfile *gfile ) { bson_iterator it; gridfs_offset length; gridfs_offset chunkSize; @@ -539,11 +562,12 @@ int gridfile_get_numchunks( gridfile *gfile ) { : ( int )( numchunks ); } -bson gridfile_get_chunk( gridfile *gfile, int n ) { +MONGO_EXPORT void gridfile_get_chunk( gridfile *gfile, int n, bson* out ) { bson query; - bson out; + bson_iterator it; bson_oid_t id; + int result; bson_init( &query ); bson_find( &it, gfile->meta, "_id" ); @@ -552,15 +576,18 @@ bson gridfile_get_chunk( gridfile *gfile, int n ) { bson_append_int( &query, "n", n ); bson_finish( &query ); - assert( mongo_find_one( gfile->gfs->client, - gfile->gfs->chunks_ns, - &query, NULL, &out ) == MONGO_OK ); - + result = (mongo_find_one(gfile->gfs->client, + gfile->gfs->chunks_ns, + &query, NULL, out ) == MONGO_OK ); bson_destroy( &query ); - return out; + if (!result) { + bson empty; + bson_empty(&empty); + bson_copy(out, &empty); + } } -mongo_cursor *gridfile_get_chunks( gridfile *gfile, int start, int size ) { +MONGO_EXPORT mongo_cursor *gridfile_get_chunks( gridfile *gfile, int start, int size ) { bson_iterator it; bson_oid_t id; bson gte; @@ -613,18 +640,18 @@ gridfs_offset gridfile_write_file( gridfile *gfile, FILE *stream ) { const int num = gridfile_get_numchunks( gfile ); for ( i=0; i Length of pending_data buffer */ } gridfile; +MONGO_EXPORT gridfs* gridfs_create(); +MONGO_EXPORT void gridfs_dispose(gridfs* gfs); +MONGO_EXPORT gridfile* gridfile_create(); +MONGO_EXPORT void gridfile_dispose(gridfile* gf); +MONGO_EXPORT void gridfile_get_descriptor(gridfile* gf, bson* out); + /** * Initializes a GridFS object * @param client - db connection @@ -60,7 +66,7 @@ typedef struct { * * @return - MONGO_OK or MONGO_ERROR. */ -int gridfs_init( mongo *client, const char *dbname, +MONGO_EXPORT int gridfs_init( mongo *client, const char *dbname, const char *prefix, gridfs *gfs ); /** @@ -69,7 +75,7 @@ int gridfs_init( mongo *client, const char *dbname, * * @param gfs a grid */ -void gridfs_destroy( gridfs *gfs ); +MONGO_EXPORT void gridfs_destroy( gridfs *gfs ); /** * Initializes a gridfile for writing incrementally with gridfs_write_buffer. @@ -77,7 +83,7 @@ void gridfs_destroy( gridfs *gfs ); * When done, you must call gridfs_writer_done to save the file metadata. * */ -void gridfile_writer_init( gridfile *gfile, gridfs *gfs, const char *remote_name, +MONGO_EXPORT void gridfile_writer_init( gridfile *gfile, gridfs *gfs, const char *remote_name, const char *content_type ); /** @@ -86,7 +92,7 @@ void gridfile_writer_init( gridfile *gfile, gridfs *gfs, const char *remote_name * stream to a GridFS file. When finished, be sure to call gridfs_writer_done. * */ -void gridfile_write_buffer( gridfile *gfile, const char *data, +MONGO_EXPORT void gridfile_write_buffer( gridfile *gfile, const char *data, gridfs_offset length ); /** @@ -96,7 +102,7 @@ void gridfile_write_buffer( gridfile *gfile, const char *data, * * @return - MONGO_OK or MONGO_ERROR. */ -int gridfile_writer_done( gridfile *gfile ); +MONGO_EXPORT int gridfile_writer_done( gridfile *gfile ); /** * Store a buffer as a GridFS file. @@ -108,7 +114,7 @@ int gridfile_writer_done( gridfile *gfile ); * * @return - MONGO_OK or MONGO_ERROR. */ -int gridfs_store_buffer( gridfs *gfs, const char *data, gridfs_offset length, +MONGO_EXPORT int gridfs_store_buffer( gridfs *gfs, const char *data, gridfs_offset length, const char *remotename, const char *contenttype ); @@ -121,7 +127,7 @@ int gridfs_store_buffer( gridfs *gfs, const char *data, gridfs_offset length, * * @return - MONGO_OK or MONGO_ERROR. */ -int gridfs_store_file( gridfs *gfs, const char *filename, +MONGO_EXPORT int gridfs_store_file( gridfs *gfs, const char *filename, const char *remotename, const char *contenttype ); /** @@ -129,7 +135,7 @@ int gridfs_store_file( gridfs *gfs, const char *filename, * @param gfs - the working GridFS * @param filename - the filename of the file/s to be removed */ -void gridfs_remove_filename( gridfs *gfs, const char *filename ); +MONGO_EXPORT void gridfs_remove_filename( gridfs *gfs, const char *filename ); /** * Find the first file matching the provided query within the @@ -141,7 +147,7 @@ void gridfs_remove_filename( gridfs *gfs, const char *filename ); * * @return MONGO_OK if successful, MONGO_ERROR otherwise */ -int gridfs_find_query( gridfs *gfs, bson *query, gridfile *gfile ); +MONGO_EXPORT int gridfs_find_query( gridfs *gfs, bson *query, gridfile *gfile ); /** * Find the first file referenced by filename within the GridFS @@ -152,7 +158,7 @@ int gridfs_find_query( gridfs *gfs, bson *query, gridfile *gfile ); * * @return MONGO_OK or MONGO_ERROR. */ -int gridfs_find_filename( gridfs *gfs, const char *filename, gridfile *gfile ); +MONGO_EXPORT int gridfs_find_filename( gridfs *gfs, const char *filename, gridfile *gfile ); /** * Initializes a GridFile containing the GridFS and file bson @@ -162,20 +168,20 @@ int gridfs_find_filename( gridfs *gfs, const char *filename, gridfile *gfile ); * * @return - MONGO_OK or MONGO_ERROR. */ -int gridfile_init( gridfs *gfs, bson *meta, gridfile *gfile ); +MONGO_EXPORT int gridfile_init( gridfs *gfs, bson *meta, gridfile *gfile ); /** * Destroys the GridFile * * @param oGridFIle - the GridFile being destroyed */ -void gridfile_destroy( gridfile *gfile ); +MONGO_EXPORT void gridfile_destroy( gridfile *gfile ); /** * Returns whether or not the GridFile exists * @param gfile - the GridFile being examined */ -bson_bool_t gridfile_exists( gridfile *gfile ); +MONGO_EXPORT bson_bool_t gridfile_exists( gridfile *gfile ); /** * Returns the filename of GridFile @@ -183,7 +189,7 @@ bson_bool_t gridfile_exists( gridfile *gfile ); * * @return - the filename of the Gridfile */ -const char *gridfile_get_filename( gridfile *gfile ); +MONGO_EXPORT const char *gridfile_get_filename( gridfile *gfile ); /** * Returns the size of the chunks of the GridFile @@ -191,7 +197,7 @@ const char *gridfile_get_filename( gridfile *gfile ); * * @return - the size of the chunks of the Gridfile */ -int gridfile_get_chunksize( gridfile *gfile ); +MONGO_EXPORT int gridfile_get_chunksize( gridfile *gfile ); /** * Returns the length of GridFile's data @@ -200,7 +206,7 @@ int gridfile_get_chunksize( gridfile *gfile ); * * @return - the length of the Gridfile's data */ -gridfs_offset gridfile_get_contentlength( gridfile *gfile ); +MONGO_EXPORT gridfs_offset gridfile_get_contentlength( gridfile *gfile ); /** * Returns the MIME type of the GridFile @@ -210,7 +216,7 @@ gridfs_offset gridfile_get_contentlength( gridfile *gfile ); * @return - the MIME type of the Gridfile * (NULL if no type specified) */ -const char *gridfile_get_contenttype( gridfile *gfile ); +MONGO_EXPORT const char *gridfile_get_contenttype( gridfile *gfile ); /** * Returns the upload date of GridFile @@ -219,7 +225,7 @@ const char *gridfile_get_contenttype( gridfile *gfile ); * * @return - the upload date of the Gridfile */ -bson_date_t gridfile_get_uploaddate( gridfile *gfile ); +MONGO_EXPORT bson_date_t gridfile_get_uploaddate( gridfile *gfile ); /** * Returns the MD5 of GridFile @@ -228,7 +234,7 @@ bson_date_t gridfile_get_uploaddate( gridfile *gfile ); * * @return - the MD5 of the Gridfile */ -const char *gridfile_get_md5( gridfile *gfile ); +MONGO_EXPORT const char *gridfile_get_md5( gridfile *gfile ); /** * Returns the field in GridFile specified by name @@ -260,7 +266,7 @@ bson_bool_t gridfile_get_boolean( gridfile *gfile, * @return - the metadata of the Gridfile in a bson object * (an empty bson is returned if none exists) */ -bson gridfile_get_metadata( gridfile *gfile ); +MONGO_EXPORT void gridfile_get_metadata( gridfile *gfile, bson* out ); /** * Returns the number of chunks in the GridFile @@ -268,7 +274,7 @@ bson gridfile_get_metadata( gridfile *gfile ); * * @return - the number of chunks in the Gridfile */ -int gridfile_get_numchunks( gridfile *gfile ); +MONGO_EXPORT int gridfile_get_numchunks( gridfile *gfile ); /** * Returns chunk n of GridFile @@ -276,7 +282,7 @@ int gridfile_get_numchunks( gridfile *gfile ); * * @return - the nth chunk of the Gridfile */ -bson gridfile_get_chunk( gridfile *gfile, int n ); +MONGO_EXPORT void gridfile_get_chunk( gridfile *gfile, int n, bson* out ); /** * Returns a mongo_cursor of *size* chunks starting with chunk *start* @@ -287,7 +293,7 @@ bson gridfile_get_chunk( gridfile *gfile, int n ); * * @return - mongo_cursor of the chunks (must be destroyed after use) */ -mongo_cursor *gridfile_get_chunks( gridfile *gfile, int start, int size ); +MONGO_EXPORT mongo_cursor *gridfile_get_chunks( gridfile *gfile, int start, int size ); /** * Writes the GridFile to a stream @@ -295,7 +301,7 @@ mongo_cursor *gridfile_get_chunks( gridfile *gfile, int start, int size ); * @param gfile - the working GridFile * @param stream - the file stream to write to */ -gridfs_offset gridfile_write_file( gridfile *gfile, FILE *stream ); +MONGO_EXPORT gridfs_offset gridfile_write_file( gridfile *gfile, FILE *stream ); /** * Reads length bytes from the GridFile to a buffer @@ -309,7 +315,7 @@ gridfs_offset gridfile_write_file( gridfile *gfile, FILE *stream ); * * @return - the number of bytes read */ -gridfs_offset gridfile_read( gridfile *gfile, gridfs_offset size, char *buf ); +MONGO_EXPORT gridfs_offset gridfile_read( gridfile *gfile, gridfs_offset size, char *buf ); /** * Updates the position in the file @@ -321,6 +327,6 @@ gridfs_offset gridfile_read( gridfile *gfile, gridfs_offset size, char *buf ); * * @return - resulting offset location */ -gridfs_offset gridfile_seek( gridfile *gfile, gridfs_offset offset ); +MONGO_EXPORT gridfs_offset gridfile_seek( gridfile *gfile, gridfs_offset offset ); #endif diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.c index d1c1e3ab0b..68edd29513 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.c @@ -309,7 +309,7 @@ mongo_md5_process(mongo_md5_state_t *pms, const mongo_md5_byte_t *data /*[64]*/) pms->abcd[3] += d; } -void +MONGO_EXPORT void mongo_md5_init(mongo_md5_state_t *pms) { pms->count[0] = pms->count[1] = 0; @@ -319,7 +319,7 @@ mongo_md5_init(mongo_md5_state_t *pms) pms->abcd[3] = 0x10325476; } -void +MONGO_EXPORT void mongo_md5_append(mongo_md5_state_t *pms, const mongo_md5_byte_t *data, int nbytes) { const mongo_md5_byte_t *p = data; @@ -357,7 +357,7 @@ mongo_md5_append(mongo_md5_state_t *pms, const mongo_md5_byte_t *data, int nbyte memcpy(pms->buf, p, left); } -void +MONGO_EXPORT void mongo_md5_finish(mongo_md5_state_t *pms, mongo_md5_byte_t digest[16]) { static const mongo_md5_byte_t pad[64] = { diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.h index 540da3a584..342b6a7307 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.h +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/md5.h @@ -47,8 +47,8 @@ 1999-05-03 lpd Original version. */ -#ifndef md5_INCLUDED -# define md5_INCLUDED +#ifndef MONGO_MD5_H_ +#define MONGO_MD5_H_ /* * This package supports both compile-time and run-time determination of CPU @@ -59,6 +59,7 @@ * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. */ +#include "bson.h" typedef unsigned char mongo_md5_byte_t; /* 8-bit byte */ typedef unsigned int mongo_md5_word_t; /* 32-bit word */ @@ -75,17 +76,17 @@ extern "C" { #endif - /* Initialize the algorithm. */ - void mongo_md5_init(mongo_md5_state_t *pms); +/* Initialize the algorithm. */ +MONGO_EXPORT void mongo_md5_init(mongo_md5_state_t *pms); - /* Append a string to the message. */ - void mongo_md5_append(mongo_md5_state_t *pms, const mongo_md5_byte_t *data, int nbytes); +/* Append a string to the message. */ +MONGO_EXPORT void mongo_md5_append(mongo_md5_state_t *pms, const mongo_md5_byte_t *data, int nbytes); - /* Finish the message and return the digest. */ - void mongo_md5_finish(mongo_md5_state_t *pms, mongo_md5_byte_t digest[16]); +/* Finish the message and return the digest. */ +MONGO_EXPORT void mongo_md5_finish(mongo_md5_state_t *pms, mongo_md5_byte_t digest[16]); #ifdef __cplusplus } /* end extern "C" */ #endif -#endif /* md5_INCLUDED */ +#endif /* MONGO_MD5_H_ */ diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c index 2090e74312..eb16392297 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.c @@ -1,6 +1,6 @@ /* mongo.c */ -/* Copyright 2009-2011 10gen Inc. +/* Copyright 2009-2012 10gen Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,235 @@ #include "mongo.h" #include "md5.h" +#include "env.h" #include #include #include #include -#ifdef _USE_LINUX_SYSTEM -#include "platform/linux/net.h" -#elif defined _USE_CUSTOM_SYSTEM -#include "platform/custom/net.h" -#else -#include "net.h" -#endif +MONGO_EXPORT mongo* mongo_create() { + return (mongo*)bson_malloc(sizeof(mongo)); +} + + +MONGO_EXPORT void mongo_dispose(mongo* conn) { + free(conn); +} + +MONGO_EXPORT int mongo_get_err(mongo* conn) { + return conn->err; +} + + +MONGO_EXPORT int mongo_is_connected(mongo* conn) { + return conn->connected != 0; +} + + +MONGO_EXPORT int mongo_get_op_timeout(mongo* conn) { + return conn->op_timeout_ms; +} + + +const char* _get_host_port(mongo_host_port* hp) { + static char _hp[sizeof(hp->host)+12]; + bson_sprintf(_hp, "%s:%d", hp->host, hp->port); + return _hp; +} + + +MONGO_EXPORT const char* mongo_get_primary(mongo* conn) { + mongo* conn_ = (mongo*)conn; + return _get_host_port(conn_->primary); +} + + +MONGO_EXPORT int mongo_get_socket(mongo* conn) { + mongo* conn_ = (mongo*)conn; + return conn_->sock; +} + + +MONGO_EXPORT int mongo_get_host_count(mongo* conn) { + mongo_replset* r = conn->replset; + mongo_host_port* hp; + int count = 0; + if (!r) return 0; + for (hp = r->hosts; hp; hp = hp->next) + ++count; + return count; +} + + +MONGO_EXPORT const char* mongo_get_host(mongo* conn, int i) { + mongo_replset* r = conn->replset; + mongo_host_port* hp; + int count = 0; + if (!r) return 0; + for (hp = r->hosts; hp; hp = hp->next) { + if (count == i) + return _get_host_port(hp); + ++count; + } + return 0; +} + + +MONGO_EXPORT mongo_cursor* mongo_cursor_create() { + return (mongo_cursor*)bson_malloc(sizeof(mongo_cursor)); +} + + +MONGO_EXPORT void mongo_cursor_dispose(mongo_cursor* cursor) { + free(cursor); +} + + +MONGO_EXPORT int mongo_get_server_err(mongo* conn) { + return conn->lasterrcode; +} + + +MONGO_EXPORT const char* mongo_get_server_err_string(mongo* conn) { + return conn->lasterrstr; +} + +MONGO_EXPORT void __mongo_set_error( mongo *conn, mongo_error_t err, const char *str, + int errcode ) { + int errstr_size, str_size; + + conn->err = err; + conn->errcode = errcode; + + if( str ) { + str_size = strlen( str ) + 1; + errstr_size = str_size > MONGO_ERR_LEN ? MONGO_ERR_LEN : str_size; + memcpy( conn->errstr, str, errstr_size ); + conn->errstr[errstr_size] = '\0'; + } +} + +MONGO_EXPORT void mongo_clear_errors( mongo *conn ) { + conn->err = 0; + conn->errcode = 0; + conn->lasterrcode = 0; + memset( conn->errstr, 0, MONGO_ERR_LEN ); + memset( conn->lasterrstr, 0, MONGO_ERR_LEN ); +} + +MONGO_EXPORT int mongo_validate_ns( mongo *conn, const char *ns ) { + char *last = NULL; + char *current = NULL; + const char *db_name = ns; + char *collection_name = NULL; + char errmsg[64]; + int ns_len = 0; + + /* If the first character is a '.', fail. */ + if( *ns == '.' ) { + __mongo_set_error( conn, MONGO_NS_INVALID, "ns cannot start with a '.'.", 0 ); + return MONGO_ERROR; + } + + /* Find the division between database and collection names. */ + for( current = (char *)ns; *current != '\0'; current++ ) { + if( *current == '.' ) { + current++; + break; + } + } + + /* Fail because the ns doesn't contain a '.' + * or the collection part starts with a dot. */ + if( *current == '\0' || *current == '.' ) { + __mongo_set_error( conn, MONGO_NS_INVALID, "ns cannot start with a '.'.", 0 ); + return MONGO_ERROR; + } + + /* Fail if collection length is 0. */ + if( *(current + 1) == '\0' ) { + __mongo_set_error( conn, MONGO_NS_INVALID, "Collection name missing.", 0 ); + return MONGO_ERROR; + } + + + /* Point to the beginning of the collection name. */ + collection_name = current; + + /* Ensure that the database name is greater than one char.*/ + if( collection_name - 1 == db_name ) { + __mongo_set_error( conn, MONGO_NS_INVALID, "Database name missing.", 0 ); + return MONGO_ERROR; + } + + /* Go back and validate the database name. */ + for( current = (char *)db_name; *current != '.'; current++ ) { + switch( *current ) { + case ' ': + case '$': + case '/': + case '\\': + __mongo_set_error( conn, MONGO_NS_INVALID, + "Database name may not contain ' ', '$', '/', or '\\'", 0 ); + return MONGO_ERROR; + default: + break; + } + + ns_len++; + } + + /* Add one to the length for the '.' character. */ + ns_len++; + + /* Now validate the collection name. */ + for( current = collection_name; *current != '\0'; current++ ) { + + /* Cannot have two consecutive dots. */ + if( last && *last == '.' && *current == '.' ) { + __mongo_set_error( conn, MONGO_NS_INVALID, + "Collection may not contain two consecutive '.'", 0 ); + return MONGO_ERROR; + } + + /* Cannot contain a '$' */ + if( *current == '$' ) { + __mongo_set_error( conn, MONGO_NS_INVALID, + "Collection may not contain '$'", 0 ); + return MONGO_ERROR; + } + + last = current; + ns_len++; + } + + if( ns_len > 128 ) { + bson_sprintf( errmsg, "Namespace too long; has %d but must <= 128.", + ns_len ); + __mongo_set_error( conn, MONGO_NS_INVALID, errmsg, 0 ); + return MONGO_ERROR; + } + + /* Cannot end with a '.' */ + if( *(current - 1) == '.' ) { + __mongo_set_error( conn, MONGO_NS_INVALID, + "Collection may not end with '.'", 0 ); + return MONGO_ERROR; + } + + return MONGO_OK; +} + +static void mongo_set_last_error( mongo *conn, bson_iterator *it, bson *obj ) { + int result_len = bson_iterator_string_len( it ); + const char *result_string = bson_iterator_string( it ); + int len = result_len < MONGO_ERR_LEN ? result_len : MONGO_ERR_LEN; + memcpy( conn->lasterrstr, result_string, len ); + + if( bson_find( it, obj, "code" ) != BSON_NULL ) + conn->lasterrcode = bson_iterator_int( it ); +} static const int ZERO = 0; static const int ONE = 1; @@ -57,13 +273,13 @@ int mongo_message_send( mongo *conn, mongo_message *mm ) { bson_little_endian32( &head.responseTo, &mm->head.responseTo ); bson_little_endian32( &head.op, &mm->head.op ); - res = mongo_write_socket( conn, &head, sizeof( head ) ); + res = mongo_env_write_socket( conn, &head, sizeof( head ) ); if( res != MONGO_OK ) { bson_free( mm ); return res; } - res = mongo_write_socket( conn, &mm->data, mm->head.len - sizeof( head ) ); + res = mongo_env_write_socket( conn, &mm->data, mm->head.len - sizeof( head ) ); if( res != MONGO_OK ) { bson_free( mm ); return res; @@ -80,8 +296,8 @@ int mongo_read_response( mongo *conn, mongo_reply **reply ) { unsigned int len; int res; - mongo_read_socket( conn, &head, sizeof( head ) ); - mongo_read_socket( conn, &fields, sizeof( fields ) ); + mongo_env_read_socket( conn, &head, sizeof( head ) ); + mongo_env_read_socket( conn, &fields, sizeof( fields ) ); bson_little_endian32( &len, &head.len ); @@ -100,7 +316,7 @@ int mongo_read_response( mongo *conn, mongo_reply **reply ) { bson_little_endian32( &out->fields.start, &fields.start ); bson_little_endian32( &out->fields.num, &fields.num ); - res = mongo_read_socket( conn, &out->objs, len-sizeof( head )-sizeof( fields ) ); + res = mongo_env_read_socket( conn, &out->objs, len-sizeof( head )-sizeof( fields ) ); if( res != MONGO_OK ) { bson_free( out ); return res; @@ -133,12 +349,17 @@ static int mongo_check_is_master( mongo *conn ) { bson out; bson_iterator it; bson_bool_t ismaster = 0; + int max_bson_size = MONGO_DEFAULT_MAX_BSON_SIZE; out.data = NULL; if ( mongo_simple_int_command( conn, "admin", "ismaster", 1, &out ) == MONGO_OK ) { if( bson_find( &it, &out, "ismaster" ) ) ismaster = bson_iterator_bool( &it ); + if( bson_find( &it, &out, "maxBsonObjectSize" ) ) { + max_bson_size = bson_iterator_int( &it ); + } + conn->max_bson_size = max_bson_size; } else { return MONGO_ERROR; } @@ -153,25 +374,25 @@ static int mongo_check_is_master( mongo *conn ) { } } -void mongo_init( mongo *conn ) { - conn->replset = NULL; - conn->err = 0; - conn->errstr = NULL; - conn->lasterrcode = 0; - conn->lasterrstr = NULL; - - conn->conn_timeout_ms = 0; - conn->op_timeout_ms = 0; +MONGO_EXPORT void mongo_init_sockets( void ) { + mongo_env_sock_init(); } -int mongo_connect( mongo *conn , const char *host, int port ) { + +MONGO_EXPORT void mongo_init( mongo *conn ) { + memset( conn, 0, sizeof( mongo ) ); + conn->max_bson_size = MONGO_DEFAULT_MAX_BSON_SIZE; +} + +MONGO_EXPORT int mongo_connect( mongo *conn , const char *host, int port ) { + mongo_init( conn ); + conn->primary = bson_malloc( sizeof( mongo_host_port ) ); strncpy( conn->primary->host, host, strlen( host ) + 1 ); conn->primary->port = port; conn->primary->next = NULL; - mongo_init( conn ); - if( mongo_socket_connect( conn, host, port ) != MONGO_OK ) + if( mongo_env_socket_connect( conn, host, port ) != MONGO_OK ) return MONGO_ERROR; if( mongo_check_is_master( conn ) != MONGO_OK ) @@ -180,7 +401,7 @@ int mongo_connect( mongo *conn , const char *host, int port ) { return MONGO_OK; } -void mongo_replset_init( mongo *conn, const char *name ) { +MONGO_EXPORT void mongo_replset_init( mongo *conn, const char *name ) { mongo_init( conn ); conn->replset = bson_malloc( sizeof( mongo_replset ) ); @@ -222,7 +443,7 @@ static void mongo_replset_free_list( mongo_host_port **list ) { *list = NULL; } -void mongo_replset_add_seed( mongo *conn, const char *host, int port ) { +MONGO_EXPORT void mongo_replset_add_seed( mongo *conn, const char *host, int port ) { mongo_replset_add_node( &conn->replset->seeds, host, port ); } @@ -291,7 +512,7 @@ static void mongo_replset_check_seed( mongo *conn ) { bson_destroy( &out ); bson_destroy( &hosts ); - mongo_close_socket( conn->sock ); + mongo_env_close_socket( conn->sock ); conn->sock = 0; conn->connected = 0; @@ -306,6 +527,7 @@ static int mongo_replset_check_host( mongo *conn ) { bson_iterator it; bson_bool_t ismaster = 0; const char *set_name; + int max_bson_size = MONGO_DEFAULT_MAX_BSON_SIZE; out.data = NULL; @@ -313,6 +535,10 @@ static int mongo_replset_check_host( mongo *conn ) { if( bson_find( &it, &out, "ismaster" ) ) ismaster = bson_iterator_bool( &it ); + if( bson_find( &it, &out, "maxBsonObjectSize" ) ) + max_bson_size = bson_iterator_int( &it ); + conn->max_bson_size = max_bson_size; + if( bson_find( &it, &out, "setName" ) ) { set_name = bson_iterator_string( &it ); if( strcmp( set_name, conn->replset->name ) != 0 ) { @@ -328,13 +554,13 @@ static int mongo_replset_check_host( mongo *conn ) { if( ismaster ) { conn->replset->primary_connected = 1; } else { - mongo_close_socket( conn->sock ); + mongo_env_close_socket( conn->sock ); } return MONGO_OK; } -int mongo_replset_connect( mongo *conn ) { +MONGO_EXPORT int mongo_replset_connect( mongo *conn ) { int res = 0; mongo_host_port *node; @@ -347,15 +573,12 @@ int mongo_replset_connect( mongo *conn ) { */ node = conn->replset->seeds; while( node != NULL ) { - res = mongo_socket_connect( conn, ( const char * )&node->host, node->port ); - if( res != MONGO_OK ) - return MONGO_ERROR; - - mongo_replset_check_seed( conn ); - - if( conn->replset->hosts ) - break; - + res = mongo_env_socket_connect( conn, ( const char * )&node->host, node->port ); + if( res == MONGO_OK ) { + mongo_replset_check_seed( conn ); + if( conn->replset->hosts ) + break; + } node = node->next; } @@ -367,19 +590,22 @@ int mongo_replset_connect( mongo *conn ) { node = conn->replset->hosts; while( node != NULL ) { - res = mongo_socket_connect( conn, ( const char * )&node->host, node->port ); + res = mongo_env_socket_connect( conn, ( const char * )&node->host, node->port ); if( res == MONGO_OK ) { if( mongo_replset_check_host( conn ) != MONGO_OK ) return MONGO_ERROR; /* Primary found, so return. */ - else if( conn->replset->primary_connected ) + else if( conn->replset->primary_connected ) { + strncpy( conn->primary->host, node->host, strlen( node->host ) + 1 ); + conn->primary->port = node->port; return MONGO_OK; + } /* No primary, so close the connection. */ else { - mongo_close_socket( conn->sock ); + mongo_env_close_socket( conn->sock ); conn->sock = 0; conn->connected = 0; } @@ -394,15 +620,15 @@ int mongo_replset_connect( mongo *conn ) { return MONGO_ERROR; } -int mongo_set_op_timeout( mongo *conn, int millis ) { +MONGO_EXPORT int mongo_set_op_timeout( mongo *conn, int millis ) { conn->op_timeout_ms = millis; if( conn->sock && conn->connected ) - mongo_set_socket_op_timeout( conn, millis ); + mongo_env_set_socket_op_timeout( conn, millis ); return MONGO_OK; } -int mongo_reconnect( mongo *conn ) { +MONGO_EXPORT int mongo_reconnect( mongo *conn ) { int res; mongo_disconnect( conn ); @@ -413,10 +639,10 @@ int mongo_reconnect( mongo *conn ) { res = mongo_replset_connect( conn ); return res; } else - return mongo_socket_connect( conn, conn->primary->host, conn->primary->port ); + return mongo_env_socket_connect( conn, conn->primary->host, conn->primary->port ); } -int mongo_check_connection( mongo *conn ) { +MONGO_EXPORT int mongo_check_connection( mongo *conn ) { if( ! conn->connected ) return MONGO_ERROR; @@ -426,7 +652,7 @@ int mongo_check_connection( mongo *conn ) { return MONGO_ERROR; } -void mongo_disconnect( mongo *conn ) { +MONGO_EXPORT void mongo_disconnect( mongo *conn ) { if( ! conn->connected ) return; @@ -436,13 +662,13 @@ void mongo_disconnect( mongo *conn ) { conn->replset->hosts = NULL; } - mongo_close_socket( conn->sock ); + mongo_env_close_socket( conn->sock ); conn->sock = 0; conn->connected = 0; } -void mongo_destroy( mongo *conn ) { +MONGO_EXPORT void mongo_destroy( mongo *conn ) { mongo_disconnect( conn ); if( conn->replset ) { @@ -454,17 +680,20 @@ void mongo_destroy( mongo *conn ) { } bson_free( conn->primary ); - bson_free( conn->errstr ); - bson_free( conn->lasterrstr ); - conn->err = 0; - conn->errstr = NULL; - conn->lasterrcode = 0; - conn->lasterrstr = NULL; + mongo_clear_errors( conn ); } /* Determine whether this BSON object is valid for the given operation. */ -static int mongo_bson_valid( mongo *conn, bson *bson, int write ) { +static int mongo_bson_valid( mongo *conn, const bson *bson, int write ) { + int size; + + size = bson_size( bson ); + if( size > conn->max_bson_size ) { + conn->err = MONGO_BSON_TOO_LARGE; + return MONGO_ERROR; + } + if( ! bson->finished ) { conn->err = MONGO_BSON_NOT_FINISHED; return MONGO_ERROR; @@ -486,20 +715,21 @@ static int mongo_bson_valid( mongo *conn, bson *bson, int write ) { } conn->err = 0; - conn->errstr = NULL; return MONGO_OK; } /* Determine whether this BSON object is valid for the given operation. */ -static int mongo_cursor_bson_valid( mongo_cursor *cursor, bson *bson ) { +static int mongo_cursor_bson_valid( mongo_cursor *cursor, const bson *bson ) { if( ! bson->finished ) { - cursor->err = MONGO_BSON_NOT_FINISHED; + cursor->err = MONGO_CURSOR_BSON_ERROR; + cursor->conn->err = MONGO_BSON_NOT_FINISHED; return MONGO_ERROR; } if( bson->err & BSON_NOT_UTF8 ) { - cursor->err = MONGO_BSON_INVALID; + cursor->err = MONGO_CURSOR_BSON_ERROR; + cursor->conn->err = MONGO_BSON_INVALID; return MONGO_ERROR; } @@ -508,13 +738,17 @@ static int mongo_cursor_bson_valid( mongo_cursor *cursor, bson *bson ) { /* MongoDB CRUD API */ -int mongo_insert_batch( mongo *conn, const char *ns, - bson **bsons, int count ) { +MONGO_EXPORT int mongo_insert_batch( mongo *conn, const char *ns, + const bson **bsons, int count ) { - int size = 16 + 4 + strlen( ns ) + 1; - int i; mongo_message *mm; + int i; char *data; + int overhead = 16 + 4 + strlen( ns ) + 1; + int size = overhead; + + if( mongo_validate_ns( conn, ns ) != MONGO_OK ) + return MONGO_ERROR; for( i=0; i conn->max_bson_size ) { + conn->err = MONGO_BSON_TOO_LARGE; + return MONGO_ERROR; + } + mm = mongo_message_create( size , 0 , 0 , MONGO_OP_INSERT ); data = &mm->data; @@ -535,11 +774,14 @@ int mongo_insert_batch( mongo *conn, const char *ns, return mongo_message_send( conn, mm ); } -int mongo_insert( mongo *conn , const char *ns , bson *bson ) { +MONGO_EXPORT int mongo_insert( mongo *conn , const char *ns , const bson *bson ) { char *data; mongo_message *mm; + if( mongo_validate_ns( conn, ns ) != MONGO_OK ) + return MONGO_ERROR; + /* Make sure that BSON is valid for insert. */ if( mongo_bson_valid( conn, bson, 1 ) != MONGO_OK ) { return MONGO_ERROR; @@ -559,7 +801,7 @@ int mongo_insert( mongo *conn , const char *ns , bson *bson ) { return mongo_message_send( conn, mm ); } -int mongo_update( mongo *conn, const char *ns, const bson *cond, +MONGO_EXPORT int mongo_update( mongo *conn, const char *ns, const bson *cond, const bson *op, int flags ) { char *data; @@ -590,14 +832,9 @@ int mongo_update( mongo *conn, const char *ns, const bson *cond, return mongo_message_send( conn, mm ); } -int mongo_remove( mongo *conn, const char *ns, const bson *cond ) { +MONGO_EXPORT int mongo_remove( mongo *conn, const char *ns, const bson *cond ) { char *data; - mongo_message *mm = mongo_message_create( 16 /* header */ - + 4 /* ZERO */ - + strlen( ns ) + 1 - + 4 /* ZERO */ - + bson_size( cond ) - , 0 , 0 , MONGO_OP_DELETE ); + mongo_message *mm; /* Make sure that the BSON is valid UTF-8. * TODO: decide whether to check cond as well. @@ -606,6 +843,13 @@ int mongo_remove( mongo *conn, const char *ns, const bson *cond ) { return MONGO_ERROR; } + mm = mongo_message_create( 16 /* header */ + + 4 /* ZERO */ + + strlen( ns ) + 1 + + 4 /* ZERO */ + + bson_size( cond ) + , 0 , 0 , MONGO_OP_DELETE ); + data = &mm->data; data = mongo_data_append32( data, &ZERO ); data = mongo_data_append( data, ns, strlen( ns ) + 1 ); @@ -621,6 +865,11 @@ static int mongo_cursor_op_query( mongo_cursor *cursor ) { bson empty; char *data; mongo_message *mm; + bson temp; + bson_iterator it; + + /* Clear any errors. */ + mongo_clear_errors( cursor->conn ); /* Set up default values for query and fields, if necessary. */ if( ! cursor->query ) @@ -662,6 +911,15 @@ static int mongo_cursor_op_query( mongo_cursor *cursor ) { return MONGO_ERROR; } + if( cursor->reply->fields.num == 1 ) { + bson_init_data( &temp, &cursor->reply->objs ); + if( bson_find( &it, &temp, "$err" ) ) { + mongo_set_last_error( cursor->conn, &it, &temp ); + cursor->err = MONGO_CURSOR_QUERY_FAIL; + return MONGO_ERROR; + } + } + cursor->seen += cursor->reply->fields.num; cursor->flags |= MONGO_CURSOR_QUERY_SENT; return MONGO_OK; @@ -719,8 +977,8 @@ static int mongo_cursor_get_more( mongo_cursor *cursor ) { } } -mongo_cursor *mongo_find( mongo *conn, const char *ns, bson *query, - bson *fields, int limit, int skip, int options ) { +MONGO_EXPORT mongo_cursor *mongo_find( mongo *conn, const char *ns, const bson *query, + const bson *fields, int limit, int skip, int options ) { mongo_cursor *cursor = ( mongo_cursor * )bson_malloc( sizeof( mongo_cursor ) ); mongo_cursor_init( cursor, conn, ns ); @@ -740,13 +998,20 @@ mongo_cursor *mongo_find( mongo *conn, const char *ns, bson *query, } } -int mongo_find_one( mongo *conn, const char *ns, bson *query, - bson *fields, bson *out ) { +MONGO_EXPORT int mongo_find_one( mongo *conn, const char *ns, const bson *query, + const bson *fields, bson *out ) { - mongo_cursor *cursor = mongo_find( conn, ns, query, fields, 1, 0, 0 ); + mongo_cursor cursor[1]; + mongo_cursor_init( cursor, conn, ns ); + mongo_cursor_set_query( cursor, query ); + mongo_cursor_set_fields( cursor, fields ); + mongo_cursor_set_limit( cursor, 1 ); - if ( cursor && mongo_cursor_next( cursor ) == MONGO_OK ) { - bson_copy_basic( out, &cursor->current ); + if ( mongo_cursor_next( cursor ) == MONGO_OK ) { + bson_init_size( out, bson_size( (bson *)&cursor->current ) ); + memcpy( out->data, cursor->current.data, + bson_size( (bson *)&cursor->current ) ); + out->finished = 1; mongo_cursor_destroy( cursor ); return MONGO_OK; } else { @@ -755,56 +1020,49 @@ int mongo_find_one( mongo *conn, const char *ns, bson *query, } } -void mongo_cursor_init( mongo_cursor *cursor, mongo *conn, const char *ns ) { +MONGO_EXPORT void mongo_cursor_init( mongo_cursor *cursor, mongo *conn, const char *ns ) { + memset( cursor, 0, sizeof( mongo_cursor ) ); cursor->conn = conn; cursor->ns = ( const char * )bson_malloc( strlen( ns ) + 1 ); strncpy( ( char * )cursor->ns, ns, strlen( ns ) + 1 ); cursor->current.data = NULL; - cursor->reply = NULL; - cursor->flags = 0; - cursor->seen = 0; - cursor->err = 0; - cursor->options = 0; - cursor->query = NULL; - cursor->fields = NULL; - cursor->skip = 0; - cursor->limit = 0; } -void mongo_cursor_set_query( mongo_cursor *cursor, bson *query ) { +MONGO_EXPORT void mongo_cursor_set_query( mongo_cursor *cursor, const bson *query ) { cursor->query = query; } -void mongo_cursor_set_fields( mongo_cursor *cursor, bson *fields ) { +MONGO_EXPORT void mongo_cursor_set_fields( mongo_cursor *cursor, const bson *fields ) { cursor->fields = fields; } -void mongo_cursor_set_skip( mongo_cursor *cursor, int skip ) { +MONGO_EXPORT void mongo_cursor_set_skip( mongo_cursor *cursor, int skip ) { cursor->skip = skip; } -void mongo_cursor_set_limit( mongo_cursor *cursor, int limit ) { +MONGO_EXPORT void mongo_cursor_set_limit( mongo_cursor *cursor, int limit ) { cursor->limit = limit; } -void mongo_cursor_set_options( mongo_cursor *cursor, int options ) { +MONGO_EXPORT void mongo_cursor_set_options( mongo_cursor *cursor, int options ) { cursor->options = options; } -const char *mongo_cursor_data( mongo_cursor *cursor ) { +MONGO_EXPORT const char *mongo_cursor_data( mongo_cursor *cursor ) { return cursor->current.data; } -const bson *mongo_cursor_bson( mongo_cursor *cursor ) { +MONGO_EXPORT const bson *mongo_cursor_bson( mongo_cursor *cursor ) { return (const bson *)&(cursor->current); } -int mongo_cursor_next( mongo_cursor *cursor ) { +MONGO_EXPORT int mongo_cursor_next( mongo_cursor *cursor ) { char *next_object; char *message_end; if( ! ( cursor->flags & MONGO_CURSOR_QUERY_SENT ) ) - mongo_cursor_op_query( cursor ); + if( mongo_cursor_op_query( cursor ) != MONGO_OK ) + return MONGO_ERROR; if( !cursor->reply ) return MONGO_ERROR; @@ -826,7 +1084,7 @@ int mongo_cursor_next( mongo_cursor *cursor ) { /* first */ if ( cursor->current.data == NULL ) { - bson_init_data( &cursor->current, &cursor->reply->objs ); + bson_init_finished_data( &cursor->current, &cursor->reply->objs ); return MONGO_OK; } @@ -843,15 +1101,15 @@ int mongo_cursor_next( mongo_cursor *cursor ) { return MONGO_ERROR; } - bson_init_data( &cursor->current, &cursor->reply->objs ); + bson_init_finished_data( &cursor->current, &cursor->reply->objs ); } else { - bson_init_data( &cursor->current, next_object ); + bson_init_finished_data( &cursor->current, next_object ); } return MONGO_OK; } -int mongo_cursor_destroy( mongo_cursor *cursor ) { +MONGO_EXPORT int mongo_cursor_destroy( mongo_cursor *cursor ) { int result = MONGO_OK; if ( !cursor ) return result; @@ -883,7 +1141,7 @@ int mongo_cursor_destroy( mongo_cursor *cursor ) { /* MongoDB Helper Functions */ -int mongo_create_index( mongo *conn, const char *ns, bson *key, int options, bson *out ) { +MONGO_EXPORT int mongo_create_index( mongo *conn, const char *ns, const bson *key, int options, bson *out ) { bson b; bson_iterator it; char name[255] = {'_'}; @@ -933,10 +1191,10 @@ bson_bool_t mongo_create_simple_index( mongo *conn, const char *ns, const char * return success; } -int64_t mongo_count( mongo *conn, const char *db, const char *ns, bson *query ) { +MONGO_EXPORT double mongo_count( mongo *conn, const char *db, const char *ns, const bson *query ) { bson cmd; bson out = {NULL, 0}; - int64_t count = -1; + double count = -1; bson_init( &cmd ); bson_append_string( &cmd, "count", ns ); @@ -947,7 +1205,7 @@ int64_t mongo_count( mongo *conn, const char *db, const char *ns, bson *query ) if( mongo_run_command( conn, db, &cmd, &out ) == MONGO_OK ) { bson_iterator it; if( bson_find( &it, &out, "n" ) ) - count = bson_iterator_long( &it ); + count = bson_iterator_double( &it ); bson_destroy( &cmd ); bson_destroy( &out ); return count; @@ -958,38 +1216,51 @@ int64_t mongo_count( mongo *conn, const char *db, const char *ns, bson *query ) } } -int mongo_run_command( mongo *conn, const char *db, bson *command, +MONGO_EXPORT int mongo_run_command( mongo *conn, const char *db, const bson *command, bson *out ) { + bson response = {NULL, 0}; bson fields; int sl = strlen( db ); char *ns = bson_malloc( sl + 5 + 1 ); /* ".$cmd" + nul */ - int res; + int res, success = 0; strcpy( ns, db ); strcpy( ns+sl, ".$cmd" ); - res = mongo_find_one( conn, ns, command, bson_empty( &fields ), out ); + res = mongo_find_one( conn, ns, command, bson_empty( &fields ), &response ); bson_free( ns ); - return res; + + if( res != MONGO_OK ) + return MONGO_ERROR; + else { + bson_iterator it; + if( bson_find( &it, &response, "ok" ) ) + success = bson_iterator_bool( &it ); + + if( !success ) { + conn->err = MONGO_COMMAND_FAILED; + return MONGO_ERROR; + } else { + if( out ) + *out = response; + return MONGO_OK; + } + } } -int mongo_simple_int_command( mongo *conn, const char *db, +MONGO_EXPORT int mongo_simple_int_command( mongo *conn, const char *db, const char *cmdstr, int arg, bson *realout ) { bson out = {NULL, 0}; bson cmd; - bson_bool_t success = 0; + int result; bson_init( &cmd ); bson_append_int( &cmd, cmdstr, arg ); bson_finish( &cmd ); - if( mongo_run_command( conn, db, &cmd, &out ) == MONGO_OK ) { - bson_iterator it; - if( bson_find( &it, &out, "ok" ) ) - success = bson_iterator_bool( &it ); - } + result = mongo_run_command( conn, db, &cmd, &out ); bson_destroy( &cmd ); @@ -998,30 +1269,21 @@ int mongo_simple_int_command( mongo *conn, const char *db, else bson_destroy( &out ); - if( success ) - return MONGO_OK; - else { - conn->err = MONGO_COMMAND_FAILED; - return MONGO_ERROR; - } + return result; } -int mongo_simple_str_command( mongo *conn, const char *db, +MONGO_EXPORT int mongo_simple_str_command( mongo *conn, const char *db, const char *cmdstr, const char *arg, bson *realout ) { bson out = {NULL, 0}; - int success = 0; + int result; bson cmd; bson_init( &cmd ); bson_append_string( &cmd, cmdstr, arg ); bson_finish( &cmd ); - if( mongo_run_command( conn, db, &cmd, &out ) == MONGO_OK ) { - bson_iterator it; - if( bson_find( &it, &out, "ok" ) ) - success = bson_iterator_bool( &it ); - } + result = mongo_run_command( conn, db, &cmd, &out ); bson_destroy( &cmd ); @@ -1030,21 +1292,18 @@ int mongo_simple_str_command( mongo *conn, const char *db, else bson_destroy( &out ); - if( success ) - return MONGO_OK; - else - return MONGO_ERROR; + return result; } -int mongo_cmd_drop_db( mongo *conn, const char *db ) { +MONGO_EXPORT int mongo_cmd_drop_db( mongo *conn, const char *db ) { return mongo_simple_int_command( conn, db, "dropDatabase", 1, NULL ); } -int mongo_cmd_drop_collection( mongo *conn, const char *db, const char *collection, bson *out ) { +MONGO_EXPORT int mongo_cmd_drop_collection( mongo *conn, const char *db, const char *collection, bson *out ) { return mongo_simple_str_command( conn, db, "drop", collection, out ); } -void mongo_cmd_reset_error( mongo *conn, const char *db ) { +MONGO_EXPORT void mongo_cmd_reset_error( mongo *conn, const char *db ) { mongo_simple_int_command( conn, db, "reseterror", 1, NULL ); } @@ -1055,23 +1314,13 @@ static int mongo_cmd_get_error_helper( mongo *conn, const char *db, bson_bool_t haserror = 0; /* Reset last error codes. */ - conn->lasterrcode = 0; - bson_free( conn->lasterrstr ); - conn->lasterrstr = NULL; + mongo_clear_errors( conn ); /* If there's an error, store its code and string in the connection object. */ if( mongo_simple_int_command( conn, db, cmdtype, 1, &out ) == MONGO_OK ) { bson_iterator it; haserror = ( bson_find( &it, &out, "err" ) != BSON_NULL ); - if( haserror ) { - conn->lasterrstr = ( char * )bson_malloc( bson_iterator_string_len( &it ) ); - if( conn->lasterrstr ) { - strcpy( conn->lasterrstr, bson_iterator_string( &it ) ); - } - - if( bson_find( &it, &out, "code" ) != BSON_NULL ) - conn->lasterrcode = bson_iterator_int( &it ); - } + if( haserror ) mongo_set_last_error( conn, &it, &out ); } if( realout ) @@ -1085,15 +1334,15 @@ static int mongo_cmd_get_error_helper( mongo *conn, const char *db, return MONGO_OK; } -int mongo_cmd_get_prev_error( mongo *conn, const char *db, bson *out ) { +MONGO_EXPORT int mongo_cmd_get_prev_error( mongo *conn, const char *db, bson *out ) { return mongo_cmd_get_error_helper( conn, db, out, "getpreverror" ); } -int mongo_cmd_get_last_error( mongo *conn, const char *db, bson *out ) { +MONGO_EXPORT int mongo_cmd_get_last_error( mongo *conn, const char *db, bson *out ) { return mongo_cmd_get_error_helper( conn, db, out, "getlasterror" ); } -bson_bool_t mongo_cmd_ismaster( mongo *conn, bson *realout ) { +MONGO_EXPORT bson_bool_t mongo_cmd_ismaster( mongo *conn, bson *realout ) { bson out = {NULL,0}; bson_bool_t ismaster = 0; @@ -1133,7 +1382,7 @@ static void mongo_pass_digest( const char *user, const char *pass, char hex_dige digest2hex( digest, hex_digest ); } -int mongo_cmd_add_user( mongo *conn, const char *db, const char *user, const char *pass ) { +MONGO_EXPORT int mongo_cmd_add_user( mongo *conn, const char *db, const char *user, const char *pass ) { bson user_obj; bson pass_obj; char hex_digest[33]; @@ -1164,12 +1413,12 @@ int mongo_cmd_add_user( mongo *conn, const char *db, const char *user, const cha return res; } -bson_bool_t mongo_cmd_authenticate( mongo *conn, const char *db, const char *user, const char *pass ) { +MONGO_EXPORT bson_bool_t mongo_cmd_authenticate( mongo *conn, const char *db, const char *user, const char *pass ) { bson from_db; bson cmd; bson out; const char *nonce; - bson_bool_t success = 0; + int result; mongo_md5_state_t st; mongo_md5_byte_t digest[16]; @@ -1200,18 +1449,11 @@ bson_bool_t mongo_cmd_authenticate( mongo *conn, const char *db, const char *use bson_finish( &cmd ); bson_destroy( &from_db ); - /*bson_init( &from_db ); */ - if( mongo_run_command( conn, db, &cmd, &out ) == MONGO_OK ) { - bson_iterator it; - if( bson_find( &it, &out, "ok" ) ) - success = bson_iterator_bool( &it ); - } + + result = mongo_run_command( conn, db, &cmd, &out ); bson_destroy( &from_db ); bson_destroy( &cmd ); - if( success ) - return MONGO_OK; - else - return MONGO_ERROR; + return result; } diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.h index 6f86174101..dd4c4b4f40 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.h +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/mongo.h @@ -3,7 +3,7 @@ * @brief Main MongoDB Declarations */ -/* Copyright 2009-2011 10gen Inc. +/* Copyright 2009-2012 10gen Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,22 +18,26 @@ * limitations under the License. */ -#ifndef _MONGO_H_ -#define _MONGO_H_ +#ifndef MONGO_H_ +#define MONGO_H_ #include "bson.h" MONGO_EXTERN_C_START #define MONGO_MAJOR 0 -#define MONGO_MINOR 4 -#define MONGO_PATCH 0 +#define MONGO_MINOR 5 +#define MONGO_PATCH 2 #define MONGO_OK 0 #define MONGO_ERROR -1 #define MONGO_DEFAULT_PORT 27017 +#define MONGO_DEFAULT_MAX_BSON_SIZE 4 * 1024 * 1024 + +#define MONGO_ERR_LEN 128 + typedef enum mongo_error_t { MONGO_CONN_SUCCESS = 0, /**< Connection success! */ MONGO_CONN_NO_SOCKET, /**< Could not create a socket. */ @@ -43,15 +47,25 @@ typedef enum mongo_error_t { MONGO_CONN_BAD_SET_NAME, /**< Given rs name doesn't match this replica set. */ MONGO_CONN_NO_PRIMARY, /**< Can't find primary in replica set. Connection closed. */ - MONGO_IO_ERROR, /**< An error occurred while reading or writing on socket. */ + MONGO_IO_ERROR, /**< An error occurred while reading or writing on the socket. */ + MONGO_SOCKET_ERROR, /**< Other socket error. */ MONGO_READ_SIZE_ERROR, /**< The response is not the expected length. */ MONGO_COMMAND_FAILED, /**< The command returned with 'ok' value of 0. */ + MONGO_NS_INVALID, /**< The name for the ns (database or collection) is invalid. */ + MONGO_BSON_INVALID, /**< BSON not valid for the specified op. */ + MONGO_BSON_NOT_FINISHED, /**< BSON object has not been finished. */ + MONGO_BSON_TOO_LARGE /**< BSON object exceeds max BSON size. */ +} mongo_error_t; + +typedef enum mongo_cursor_error_t { MONGO_CURSOR_EXHAUSTED, /**< The cursor has no more results. */ MONGO_CURSOR_INVALID, /**< The cursor has timed out or is not recognized. */ MONGO_CURSOR_PENDING, /**< Tailable cursor still alive but no data. */ - MONGO_BSON_INVALID, /**< BSON not valid for the specified op. */ - MONGO_BSON_NOT_FINISHED /**< BSON object has not been finished. */ -} mongo_error_t; + MONGO_CURSOR_QUERY_FAIL, /**< The server returned an '$err' object, indicating query failure. + See conn->lasterrcode and conn->lasterrstr for details. */ + MONGO_CURSOR_BSON_ERROR /**< Something is wrong with the BSON provided. See conn->err + for details. */ +} mongo_cursor_error_t; enum mongo_cursor_flags { MONGO_CURSOR_MUST_FREE = 1, /**< mongo_cursor_destroy should free cursor. */ @@ -137,12 +151,14 @@ typedef struct mongo { int flags; /**< Flags on this connection object. */ int conn_timeout_ms; /**< Connection timeout in milliseconds. */ int op_timeout_ms; /**< Read and write timeout in milliseconds. */ + int max_bson_size; /**< Largest BSON object allowed on this connection. */ bson_bool_t connected; /**< Connection status. */ - mongo_error_t err; /**< Most recent driver error code. */ - char *errstr; /**< String version of most recent driver error code. */ - int lasterrcode; /**< getlasterror given by the server on calls. */ - char *lasterrstr; /**< getlasterror string generated by server. */ + mongo_error_t err; /**< Most recent driver error code. */ + int errcode; /**< Most recent errno or WSAGetLastError(). */ + char errstr[MONGO_ERR_LEN]; /**< String version of error. */ + int lasterrcode; /**< getlasterror code from the server. */ + char lasterrstr[MONGO_ERR_LEN]; /**< getlasterror string from the server. */ } mongo; typedef struct { @@ -152,9 +168,9 @@ typedef struct { int flags; /**< Flags used internally by this drivers. */ int seen; /**< Number returned so far. */ bson current; /**< This cursor's current bson object. */ - mongo_error_t err; /**< Errors on this cursor. */ - bson *query; /**< Bitfield containing cursor options. */ - bson *fields; /**< Bitfield containing cursor options. */ + mongo_cursor_error_t err; /**< Errors on this cursor. */ + const bson *query; /**< Bitfield containing cursor options. */ + const bson *fields;/**< Bitfield containing cursor options. */ int options; /**< Bitfield containing cursor options. */ int limit; /**< Bitfield containing cursor options. */ int skip; /**< Bitfield containing cursor options. */ @@ -162,9 +178,44 @@ typedef struct { /* Connection API */ -/** Initialize a new mongo connection object. If not created - * with mongo_new, you must initialize each mongo - * object using this function. +MONGO_EXPORT mongo* mongo_create(); +MONGO_EXPORT void mongo_dispose(mongo* conn); +MONGO_EXPORT int mongo_get_err(mongo* conn); +MONGO_EXPORT int mongo_is_connected(mongo* conn); +MONGO_EXPORT int mongo_get_op_timeout(mongo* conn); +MONGO_EXPORT const char* mongo_get_primary(mongo* conn); +MONGO_EXPORT int mongo_get_socket(mongo* conn) ; +MONGO_EXPORT int mongo_get_host_count(mongo* conn); +MONGO_EXPORT const char* mongo_get_host(mongo* conn, int i); +MONGO_EXPORT mongo_cursor* mongo_cursor_create(); +MONGO_EXPORT void mongo_cursor_dispose(mongo_cursor* cursor); +MONGO_EXPORT int mongo_get_server_err(mongo* conn); +MONGO_EXPORT const char* mongo_get_server_err_string(mongo* conn); + +/** + * Set an error this mongo connection object. Mostly for internal use. + * + * @param conn a mongo connection object. + * @param err a driver error code of mongo_error_t. + * @param errstr a string version of the error. + * @param errorcode Currently errno or WSAGetLastError(). + */ +MONGO_EXPORT void __mongo_set_error( mongo *conn, mongo_error_t err, + const char *errstr, int errorcode ); +/** + * Clear all errors stored on this mongo connection object. + * + * @param conn a mongo connection object. + */ +MONGO_EXPORT void mongo_clear_errors( mongo *conn ); + +/** Initialize sockets for Windows. + */ +MONGO_EXPORT void mongo_init_sockets(); + +/** + * Initialize a new mongo connection object. You must initialize each mongo + * object using this function. * * @note When finished, you must pass this object to * mongo_destroy( ). @@ -172,7 +223,7 @@ typedef struct { * @param conn a mongo connection object allocated on the stack * or heap. */ -void mongo_init( mongo *conn ); +MONGO_EXPORT void mongo_init( mongo *conn ); /** * Connect to a single MongoDB server. @@ -182,9 +233,9 @@ void mongo_init( mongo *conn ); * @param port the port to connect to. * * @return MONGO_OK or MONGO_ERROR on failure. On failure, a constant of type - * mongo_conn_return_t will be set on the conn->err field. + * mongo_error_t will be set on the conn->err field. */ -int mongo_connect( mongo *conn , const char *host, int port ); +MONGO_EXPORT int mongo_connect( mongo *conn , const char *host, int port ); /** * Set up this connection object for connecting to a replica set. @@ -193,7 +244,7 @@ int mongo_connect( mongo *conn , const char *host, int port ); * @param conn a mongo object. * @param name the name of the replica set to connect to. * */ -void mongo_replset_init( mongo *conn, const char *name ); +MONGO_EXPORT void mongo_replset_init( mongo *conn, const char *name ); /** * Add a seed node to the replica set connection object. @@ -204,7 +255,7 @@ void mongo_replset_init( mongo *conn, const char *name ); * @param host a numerical network address or a network hostname. * @param port the port to connect to. */ -void mongo_replset_add_seed( mongo *conn, const char *host, int port ); +MONGO_EXPORT void mongo_replset_add_seed( mongo *conn, const char *host, int port ); /** * Utility function for converting a host-port string to a mongo_host_port. @@ -215,6 +266,17 @@ void mongo_replset_add_seed( mongo *conn, const char *host, int port ); */ void mongo_parse_host( const char *host_string, mongo_host_port *host_port ); +/** + * Utility function for validation database and collection names. + * + * @param conn a mongo object. + * + * @return MONGO_OK or MONGO_ERROR on failure. On failure, a constant of type + * mongo_conn_return_t will be set on the conn->err field. + * + */ +MONGO_EXPORT int mongo_validate_ns( mongo *conn, const char *ns ); + /** * Connect to a replica set. * @@ -226,7 +288,7 @@ void mongo_parse_host( const char *host_string, mongo_host_port *host_port ); * @return MONGO_OK or MONGO_ERROR on failure. On failure, a constant of type * mongo_conn_return_t will be set on the conn->err field. */ -int mongo_replset_connect( mongo *conn ); +MONGO_EXPORT int mongo_replset_connect( mongo *conn ); /** Set a timeout for operations on this connection. This * is a platform-specific feature, and only work on *nix @@ -238,7 +300,7 @@ int mongo_replset_connect( mongo *conn ); * @return MONGO_OK. On error, return MONGO_ERROR and * set the conn->err field. */ -int mongo_set_op_timeout( mongo *conn, int millis ); +MONGO_EXPORT int mongo_set_op_timeout( mongo *conn, int millis ); /** * Ensure that this connection is healthy by performing @@ -248,7 +310,7 @@ int mongo_set_op_timeout( mongo *conn, int millis ); * * @return MONGO_OK if connected; otherwise, MONGO_ERROR. */ -int mongo_check_connection( mongo *conn ); +MONGO_EXPORT int mongo_check_connection( mongo *conn ); /** * Try reconnecting to the server using the existing connection settings. @@ -261,7 +323,7 @@ int mongo_check_connection( mongo *conn ); * @return MONGO_OK or MONGO_ERROR and * set the conn->err field. */ -int mongo_reconnect( mongo *conn ); +MONGO_EXPORT int mongo_reconnect( mongo *conn ); /** * Close the current connection to the server. After calling @@ -270,7 +332,7 @@ int mongo_reconnect( mongo *conn ); * * @param conn a mongo object. */ -void mongo_disconnect( mongo *conn ); +MONGO_EXPORT void mongo_disconnect( mongo *conn ); /** * Close any existing connection to the server and free all allocated @@ -280,7 +342,7 @@ void mongo_disconnect( mongo *conn ); * * @param conn a mongo object. */ -void mongo_destroy( mongo *conn ); +MONGO_EXPORT void mongo_destroy( mongo *conn ); /** * Insert a BSON document into a MongoDB server. This function @@ -295,7 +357,7 @@ void mongo_destroy( mongo *conn ); * field is MONGO_BSON_INVALID, check the err field * on the bson struct for the reason. */ -int mongo_insert( mongo *conn, const char *ns, bson *data ); +MONGO_EXPORT int mongo_insert( mongo *conn, const char *ns, const bson *data ); /** * Insert a batch of BSON documents into a MongoDB server. This function @@ -309,8 +371,8 @@ int mongo_insert( mongo *conn, const char *ns, bson *data ); * @return MONGO_OK or MONGO_ERROR. * */ -int mongo_insert_batch( mongo *conn , const char *ns , - bson **data , int num ); +MONGO_EXPORT int mongo_insert_batch( mongo *conn , const char *ns , + const bson **data , int num ); /** * Update a document in a MongoDB server. @@ -324,7 +386,7 @@ int mongo_insert_batch( mongo *conn , const char *ns , * @return MONGO_OK or MONGO_ERROR with error stored in conn object. * */ -int mongo_update( mongo *conn, const char *ns, const bson *cond, +MONGO_EXPORT int mongo_update( mongo *conn, const char *ns, const bson *cond, const bson *op, int flags ); /** @@ -336,7 +398,7 @@ int mongo_update( mongo *conn, const char *ns, const bson *cond, * * @return MONGO_OK or MONGO_ERROR with error stored in conn object. */ -int mongo_remove( mongo *conn, const char *ns, const bson *cond ); +MONGO_EXPORT int mongo_remove( mongo *conn, const char *ns, const bson *cond ); /** * Find documents in a MongoDB server. @@ -353,8 +415,8 @@ int mongo_remove( mongo *conn, const char *ns, const bson *cond ); * an error has occurred. For finer-grained error checking, * use the cursor builder API instead. */ -mongo_cursor *mongo_find( mongo *conn, const char *ns, bson *query, - bson *fields, int limit, int skip, int options ); +MONGO_EXPORT mongo_cursor *mongo_find( mongo *conn, const char *ns, const bson *query, + const bson *fields, int limit, int skip, int options ); /** * Initalize a new cursor object. @@ -363,7 +425,7 @@ mongo_cursor *mongo_find( mongo *conn, const char *ns, bson *query, * @param ns the namespace, represented as the the database * name and collection name separated by a dot. e.g., "test.users" */ -void mongo_cursor_init( mongo_cursor *cursor, mongo *conn, const char *ns ); +MONGO_EXPORT void mongo_cursor_init( mongo_cursor *cursor, mongo *conn, const char *ns ); /** * Set the bson object specifying this cursor's query spec. If @@ -376,7 +438,7 @@ void mongo_cursor_init( mongo_cursor *cursor, mongo *conn, const char *ns ); * $query, $orderby, $hint, and/or $explain. See * http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol for details. */ -void mongo_cursor_set_query( mongo_cursor *cursor, bson *query ); +MONGO_EXPORT void mongo_cursor_set_query( mongo_cursor *cursor, const bson *query ); /** * Set the fields to return for this cursor. If you want to return @@ -386,7 +448,7 @@ void mongo_cursor_set_query( mongo_cursor *cursor, bson *query ); * @param fields a bson object representing the fields to return. * See http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields. */ -void mongo_cursor_set_fields( mongo_cursor *cursor, bson *fields ); +MONGO_EXPORT void mongo_cursor_set_fields( mongo_cursor *cursor, const bson *fields ); /** * Set the number of documents to skip. @@ -394,7 +456,7 @@ void mongo_cursor_set_fields( mongo_cursor *cursor, bson *fields ); * @param cursor * @param skip */ -void mongo_cursor_set_skip( mongo_cursor *cursor, int skip ); +MONGO_EXPORT void mongo_cursor_set_skip( mongo_cursor *cursor, int skip ); /** * Set the number of documents to return. @@ -402,7 +464,7 @@ void mongo_cursor_set_skip( mongo_cursor *cursor, int skip ); * @param cursor * @param limit */ -void mongo_cursor_set_limit( mongo_cursor *cursor, int limit ); +MONGO_EXPORT void mongo_cursor_set_limit( mongo_cursor *cursor, int limit ); /** * Set any of the available query options (e.g., MONGO_TAILABLE). @@ -411,7 +473,7 @@ void mongo_cursor_set_limit( mongo_cursor *cursor, int limit ); * @param options a bitfield storing query options. See * mongo_cursor_bitfield_t for available constants. */ -void mongo_cursor_set_options( mongo_cursor *cursor, int options ); +MONGO_EXPORT void mongo_cursor_set_options( mongo_cursor *cursor, int options ); /** * Return the current BSON object data as a const char*. This is useful @@ -419,7 +481,7 @@ void mongo_cursor_set_options( mongo_cursor *cursor, int options ); * * @param cursor */ -const char *mongo_cursor_data( mongo_cursor *cursor ); +MONGO_EXPORT const char *mongo_cursor_data( mongo_cursor *cursor ); /** * Return the current BSON object data as a const char*. This is useful @@ -427,7 +489,7 @@ const char *mongo_cursor_data( mongo_cursor *cursor ); * * @param cursor */ -const bson *mongo_cursor_bson( mongo_cursor *cursor ); +MONGO_EXPORT const bson *mongo_cursor_bson( mongo_cursor *cursor ); /** * Iterate the cursor, returning the next item. When successful, @@ -438,7 +500,7 @@ const bson *mongo_cursor_bson( mongo_cursor *cursor ); * @return MONGO_OK. On error, returns MONGO_ERROR and sets * cursor->err with a value of mongo_error_t. */ -int mongo_cursor_next( mongo_cursor *cursor ); +MONGO_EXPORT int mongo_cursor_next( mongo_cursor *cursor ); /** * Destroy a cursor object. When finished with a cursor, you @@ -449,7 +511,7 @@ int mongo_cursor_next( mongo_cursor *cursor ); * @return MONGO_OK or an error code. On error, check cursor->conn->err * for errors. */ -int mongo_cursor_destroy( mongo_cursor *cursor ); +MONGO_EXPORT int mongo_cursor_destroy( mongo_cursor *cursor ); /** * Find a single document in a MongoDB server. @@ -462,8 +524,8 @@ int mongo_cursor_destroy( mongo_cursor *cursor ); * */ /* out can be NULL if you don't care about results. useful for commands */ -bson_bool_t mongo_find_one( mongo *conn, const char *ns, bson *query, - bson *fields, bson *out ); +MONGO_EXPORT int mongo_find_one( mongo *conn, const char *ns, const bson *query, + const bson *fields, bson *out ); /* MongoDB Helper Functions */ @@ -478,8 +540,8 @@ bson_bool_t mongo_find_one( mongo *conn, const char *ns, bson *query, * @return the number of matching documents. If the command fails, * MONGO_ERROR is returned. */ -int64_t mongo_count( mongo *conn, const char *db, const char *coll, - bson *query ); +MONGO_EXPORT double mongo_count( mongo *conn, const char *db, const char *coll, + const bson *query ); /** * Create a compouned index. @@ -494,7 +556,7 @@ int64_t mongo_count( mongo *conn, const char *db, const char *coll, * * @return MONGO_OK if index is created successfully; otherwise, MONGO_ERROR. */ -int mongo_create_index( mongo *conn, const char *ns, bson *key, int options, bson *out ); +MONGO_EXPORT int mongo_create_index( mongo *conn, const char *ns, const bson *key, int options, bson *out ); /** * Create an index with a single key. @@ -521,9 +583,9 @@ bson_bool_t mongo_create_simple_index( mongo *conn, const char *ns, const char * * @param command the BSON command to run. * @param out the BSON result of the command. * - * @return true if the command ran without error. + * @return MONGO_OK if the command ran without error. */ -bson_bool_t mongo_run_command( mongo *conn, const char *db, bson *command, bson *out ); +MONGO_EXPORT int mongo_run_command( mongo *conn, const char *db, const bson *command, bson *out ); /** * Run a command that accepts a simple string key and integer value. @@ -537,7 +599,7 @@ bson_bool_t mongo_run_command( mongo *conn, const char *db, bson *command, bson * @return MONGO_OK or an error code. * */ -int mongo_simple_int_command( mongo *conn, const char *db, +MONGO_EXPORT int mongo_simple_int_command( mongo *conn, const char *db, const char *cmd, int arg, bson *out ); /** @@ -552,7 +614,7 @@ int mongo_simple_int_command( mongo *conn, const char *db, * @return true if the command ran without error. * */ -bson_bool_t mongo_simple_str_command( mongo *conn, const char *db, const char *cmd, const char *arg, bson *out ); +MONGO_EXPORT int mongo_simple_str_command( mongo *conn, const char *db, const char *cmd, const char *arg, bson *out ); /** * Drop a database. @@ -562,7 +624,7 @@ bson_bool_t mongo_simple_str_command( mongo *conn, const char *db, const char *c * * @return MONGO_OK or an error code. */ -int mongo_cmd_drop_db( mongo *conn, const char *db ); +MONGO_EXPORT int mongo_cmd_drop_db( mongo *conn, const char *db ); /** * Drop a collection. @@ -574,7 +636,7 @@ int mongo_cmd_drop_db( mongo *conn, const char *db ); * * @return true if the collection drop was successful. */ -bson_bool_t mongo_cmd_drop_collection( mongo *conn, const char *db, const char *collection, bson *out ); +MONGO_EXPORT int mongo_cmd_drop_collection( mongo *conn, const char *db, const char *collection, bson *out ); /** * Add a database user. @@ -586,7 +648,7 @@ bson_bool_t mongo_cmd_drop_collection( mongo *conn, const char *db, const char * * * @return MONGO_OK or MONGO_ERROR. */ -int mongo_cmd_add_user( mongo *conn, const char *db, const char *user, const char *pass ); +MONGO_EXPORT int mongo_cmd_add_user( mongo *conn, const char *db, const char *user, const char *pass ); /** * Authenticate a user. @@ -598,7 +660,7 @@ int mongo_cmd_add_user( mongo *conn, const char *db, const char *user, const cha * * @return MONGO_OK on sucess and MONGO_ERROR on failure. */ -int mongo_cmd_authenticate( mongo *conn, const char *db, const char *user, const char *pass ); +MONGO_EXPORT int mongo_cmd_authenticate( mongo *conn, const char *db, const char *user, const char *pass ); /** * Check if the current server is a master. @@ -609,7 +671,7 @@ int mongo_cmd_authenticate( mongo *conn, const char *db, const char *user, const * @return true if the server is a master. */ /* return value is master status */ -bson_bool_t mongo_cmd_ismaster( mongo *conn, bson *out ); +MONGO_EXPORT bson_bool_t mongo_cmd_ismaster( mongo *conn, bson *out ); /** * Get the error for the last command with the current connection. @@ -621,7 +683,7 @@ bson_bool_t mongo_cmd_ismaster( mongo *conn, bson *out ); * @return MONGO_OK if no error and MONGO_ERROR on error. On error, check the values * of conn->lasterrcode and conn->lasterrstr for the error status. */ -int mongo_cmd_get_last_error( mongo *conn, const char *db, bson *out ); +MONGO_EXPORT int mongo_cmd_get_last_error( mongo *conn, const char *db, bson *out ); /** * Get the most recent error with the current connection. @@ -633,7 +695,7 @@ int mongo_cmd_get_last_error( mongo *conn, const char *db, bson *out ); * @return MONGO_OK if no error and MONGO_ERROR on error. On error, check the values * of conn->lasterrcode and conn->lasterrstr for the error status. */ -int mongo_cmd_get_prev_error( mongo *conn, const char *db, bson *out ); +MONGO_EXPORT int mongo_cmd_get_prev_error( mongo *conn, const char *db, bson *out ); /** * Reset the error state for the connection. @@ -641,7 +703,8 @@ int mongo_cmd_get_prev_error( mongo *conn, const char *db, bson *out ); * @param conn a mongo object. * @param db the name of the database. */ -void mongo_cmd_reset_error( mongo *conn, const char *db ); +MONGO_EXPORT void mongo_cmd_reset_error( mongo *conn, const char *db ); + MONGO_EXTERN_C_END diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.c deleted file mode 100644 index 5c8ad9ba5e..0000000000 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.c +++ /dev/null @@ -1,98 +0,0 @@ -/* net.c */ - -/* Copyright 2009-2011 10gen Inc. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Implementation for generic version of net.h */ -#include "net.h" -#include - -int mongo_write_socket( mongo *conn, const void *buf, int len ) { - const char *cbuf = buf; - while ( len ) { - int sent = send( conn->sock, cbuf, len, 0 ); - if ( sent == -1 ) { - conn->err = MONGO_IO_ERROR; - return MONGO_ERROR; - } - cbuf += sent; - len -= sent; - } - - return MONGO_OK; -} - -int mongo_read_socket( mongo *conn, void *buf, int len ) { - char *cbuf = buf; - while ( len ) { - int sent = recv( conn->sock, cbuf, len, 0 ); - if ( sent == 0 || sent == -1 ) { - conn->err = MONGO_IO_ERROR; - return MONGO_ERROR; - } - cbuf += sent; - len -= sent; - } - - return MONGO_OK; -} - -/* This is a no-op in the generic implementation. */ -int mongo_set_socket_op_timeout( mongo *conn, int millis ) { - return MONGO_OK; -} - -static int mongo_create_socket( mongo *conn ) { - int fd; - - if( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) == -1 ) { - conn->err = MONGO_CONN_NO_SOCKET; - return MONGO_ERROR; - } - conn->sock = fd; - - return MONGO_OK; -} - -int mongo_socket_connect( mongo *conn, const char *host, int port ) { - struct sockaddr_in sa; - socklen_t addressSize; - int flag = 1; - - if( mongo_create_socket( conn ) != MONGO_OK ) - return MONGO_ERROR; - - memset( sa.sin_zero , 0 , sizeof( sa.sin_zero ) ); - sa.sin_family = AF_INET; - sa.sin_port = htons( port ); - sa.sin_addr.s_addr = inet_addr( host ); - addressSize = sizeof( sa ); - - if ( connect( conn->sock, ( struct sockaddr * )&sa, addressSize ) == -1 ) { - mongo_close_socket( conn->sock ); - conn->connected = 0; - conn->sock = 0; - conn->err = MONGO_CONN_FAIL; - return MONGO_ERROR; - } - - setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, ( char * ) &flag, sizeof( flag ) ); - if( conn->op_timeout_ms > 0 ) - mongo_set_socket_op_timeout( conn, conn->op_timeout_ms ); - - conn->connected = 1; - - return MONGO_OK; -} diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.h deleted file mode 100644 index 49190877c8..0000000000 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/net.h +++ /dev/null @@ -1,57 +0,0 @@ -/** @file net.h */ - -/* Copyright 2009-2011 10gen Inc. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Header for generic net.h */ -#ifndef _MONGO_NET_H_ -#define _MONGO_NET_H_ - -#include "mongo.h" - -#ifdef _WIN32 -#include -#include -#define mongo_close_socket(sock) ( closesocket(sock) ) -typedef int socklen_t; -#else -#include -#include -#include -#include -#include -#include -#include -#define mongo_close_socket(sock) ( close(sock) ) -#endif - -#ifndef _WIN32 -#include -#endif - -#if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1 -#define _MONGO_USE_GETADDRINFO -#endif - -MONGO_EXTERN_C_START - -/* This is a no-op in the generic implementation. */ -int mongo_set_socket_op_timeout( mongo *conn, int millis ); -int mongo_read_socket( mongo *conn, void *buf, int len ); -int mongo_write_socket( mongo *conn, const void *buf, int len ); -int mongo_socket_connect( mongo *conn, const char *host, int port ); - -MONGO_EXTERN_C_END -#endif diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/numbers.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/numbers.c index a63e3d73f9..b3032d5ee3 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/numbers.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/numbers.c @@ -1,4 +1,4 @@ -/* Copyright 2009-2011 10gen Inc. +/* Copyright 2009-2012 10gen Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform.h deleted file mode 100644 index 4a96af77e3..0000000000 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform.h +++ /dev/null @@ -1,94 +0,0 @@ -/** @file platform.h */ - -/** Copyright 2009-2011 10gen Inc. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/* all platform-specific ifdefs should go here */ - -#ifndef _PLATFORM_HACKS_H_ -#define _PLATFORM_HACKS_H_ - -#ifdef __GNUC__ -#define MONGO_INLINE static __inline__ -#else -#define MONGO_INLINE static -#endif - -#ifdef __cplusplus -#define MONGO_EXTERN_C_START extern "C" { -#define MONGO_EXTERN_C_END } -#else -#define MONGO_EXTERN_C_START -#define MONGO_EXTERN_C_END -#endif - - -#if defined(MONGO_HAVE_STDINT) || __STDC_VERSION__ >= 199901L -#include -#elif defined(MONGO_HAVE_UNISTD) -#include -#elif defined(MONGO_USE__INT64) -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#elif defined(MONGO_USE_LONG_LONG_INT) -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#else -#error must have a 64bit int type -#endif - -/* big endian is only used for OID generation. little is used everywhere else */ -#ifdef MONGO_BIG_ENDIAN -#define bson_little_endian64(out, in) ( bson_swap_endian64(out, in) ) -#define bson_little_endian32(out, in) ( bson_swap_endian32(out, in) ) -#define bson_big_endian64(out, in) ( memcpy(out, in, 8) ) -#define bson_big_endian32(out, in) ( memcpy(out, in, 4) ) -#else -#define bson_little_endian64(out, in) ( memcpy(out, in, 8) ) -#define bson_little_endian32(out, in) ( memcpy(out, in, 4) ) -#define bson_big_endian64(out, in) ( bson_swap_endian64(out, in) ) -#define bson_big_endian32(out, in) ( bson_swap_endian32(out, in) ) -#endif - -MONGO_EXTERN_C_START - -MONGO_INLINE void bson_swap_endian64( void *outp, const void *inp ) { - const char *in = ( const char * )inp; - char *out = ( char * )outp; - - out[0] = in[7]; - out[1] = in[6]; - out[2] = in[5]; - out[3] = in[4]; - out[4] = in[3]; - out[5] = in[2]; - out[6] = in[1]; - out[7] = in[0]; - -} -MONGO_INLINE void bson_swap_endian32( void *outp, const void *inp ) { - const char *in = ( const char * )inp; - char *out = ( char * )outp; - - out[0] = in[3]; - out[1] = in[2]; - out[2] = in[1]; - out[3] = in[0]; -} - -MONGO_EXTERN_C_END - -#endif diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.c b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.c deleted file mode 100644 index b2f7c22898..0000000000 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.c +++ /dev/null @@ -1,183 +0,0 @@ -/* net.c */ - -/* Copyright 2009-2011 10gen Inc. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Implementation for Linux version of net.h */ -#include "net.h" -#include - -int mongo_write_socket( mongo *conn, const void *buf, int len ) { - const char *cbuf = buf; - while ( len ) { - int sent = send( conn->sock, cbuf, len, 0 ); - if ( sent == -1 ) { - conn->err = MONGO_IO_ERROR; - return MONGO_ERROR; - } - cbuf += sent; - len -= sent; - } - - return MONGO_OK; -} - -int mongo_read_socket( mongo *conn, void *buf, int len ) { - char *cbuf = buf; - while ( len ) { - int sent = recv( conn->sock, cbuf, len, 0 ); - if ( sent == 0 || sent == -1 ) { - conn->err = MONGO_IO_ERROR; - return MONGO_ERROR; - } - cbuf += sent; - len -= sent; - } - - return MONGO_OK; -} - -static int mongo_create_socket( mongo *conn ) { - int fd; - - if( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) == -1 ) { - conn->err = MONGO_CONN_NO_SOCKET; - return MONGO_ERROR; - } - conn->sock = fd; - - return MONGO_OK; -} - -static int mongo_set_blocking_status( mongo *conn ) { - int flags; - int blocking; - - blocking = ( conn->conn_timeout_ms == 0 ); - if( blocking ) - return MONGO_OK; - else { - if( ( flags = fcntl( conn->sock, F_GETFL ) ) == -1 ) { - conn->err = MONGO_IO_ERROR; - mongo_close_socket( conn->sock ); - return MONGO_ERROR; - } - - flags |= O_NONBLOCK; - - if( ( flags = fcntl( conn->sock, F_SETFL, flags ) ) == -1 ) { - conn->err = MONGO_IO_ERROR; - mongo_close_socket( conn->sock ); - return MONGO_ERROR; - } - } - - return MONGO_OK; -} - -int mongo_set_socket_op_timeout( mongo *conn, int millis ) { - struct timeval tv; - tv.tv_sec = millis / 1000; - tv.tv_usec = ( millis % 1000 ) * 1000; - - if ( setsockopt( conn->sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof( tv ) ) == -1 ) { - conn->err = MONGO_IO_ERROR; - return MONGO_ERROR; - } - - if ( setsockopt( conn->sock, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof( tv ) ) == -1 ) { - conn->err = MONGO_IO_ERROR; - return MONGO_ERROR; - } - - return MONGO_OK; -} - -#ifdef _MONGO_USE_GETADDRINFO -int mongo_socket_connect( mongo *conn, const char *host, int port ) { - - struct addrinfo *addrs = NULL; - struct addrinfo hints; - int flag = 1; - char port_str[12]; - int ret; - - conn->sock = 0; - conn->connected = 0; - - memset( &hints, 0, sizeof( hints ) ); - hints.ai_family = AF_INET; - hints.ai_socktype = SOCK_STREAM; - - sprintf( port_str, "%d", port ); - - if( mongo_create_socket( conn ) != MONGO_OK ) - return MONGO_ERROR; - - if( getaddrinfo( host, port_str, &hints, &addrs ) != 0 ) { - bson_errprintf( "getaddrinfo failed: %s", gai_strerror( ret ) ); - conn->err = MONGO_CONN_ADDR_FAIL; - return MONGO_ERROR; - } - - if ( connect( conn->sock, addrs->ai_addr, addrs->ai_addrlen ) == -1 ) { - mongo_close_socket( conn->sock ); - freeaddrinfo( addrs ); - conn->err = MONGO_CONN_FAIL; - return MONGO_ERROR; - } - - setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, ( char * )&flag, sizeof( flag ) ); - if( conn->op_timeout_ms > 0 ) - mongo_set_socket_op_timeout( conn, conn->op_timeout_ms ); - - conn->connected = 1; - freeaddrinfo( addrs ); - - return MONGO_OK; -} -#else -int mongo_socket_connect( mongo *conn, const char *host, int port ) { - struct sockaddr_in sa; - socklen_t addressSize; - int flag = 1; - - if( mongo_create_socket( conn ) != MONGO_OK ) - return MONGO_ERROR; - - memset( sa.sin_zero , 0 , sizeof( sa.sin_zero ) ); - sa.sin_family = AF_INET; - sa.sin_port = htons( port ); - sa.sin_addr.s_addr = inet_addr( host ); - addressSize = sizeof( sa ); - - if ( connect( conn->sock, ( struct sockaddr * )&sa, addressSize ) == -1 ) { - mongo_close_socket( conn->sock ); - conn->connected = 0; - conn->sock = 0; - conn->err = MONGO_CONN_FAIL; - return MONGO_ERROR; - } - - setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, ( char * ) &flag, sizeof( flag ) ); - - if( conn->op_timeout_ms > 0 ) - mongo_set_socket_op_timeout( conn, conn->op_timeout_ms ); - - conn->connected = 1; - - return MONGO_OK; -} -#endif diff --git a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.h b/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.h deleted file mode 100644 index 054247c1e8..0000000000 --- a/src/mod/event_handlers/mod_cdr_mongodb/driver/src/platform/linux/net.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file net.h - * @brief Networking. - */ - -/* Copyright 2009-2011 10gen Inc. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Header for Linux net.h */ -#ifndef _MONGO_NET_H_ -#define _MONGO_NET_H_ - -#include "mongo.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define mongo_close_socket(sock) ( close(sock) ) - -#if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1 -#define _MONGO_USE_GETADDRINFO -#endif - -MONGO_EXTERN_C_START - -int mongo_set_socket_op_timeout( mongo *conn, int millis ); -int mongo_read_socket( mongo *conn, void *buf, int len ); -int mongo_write_socket( mongo *conn, const void *buf, int len ); -int mongo_socket_connect( mongo *conn, const char *host, int port ); - -MONGO_EXTERN_C_END -#endif From 576fbb97ad6c934270f62bb9c70ed3f237b3ba3f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 07:10:19 -0500 Subject: [PATCH 0255/1057] tweak --- src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl index 4be66361e5..2c7575f64c 100644 --- a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl +++ b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl @@ -65,7 +65,7 @@ my $xml = qq# while (my $request = $scgi->accept) { # fork every new req into its own process (optional) - next unless(fork()); + next unless(my $pid = fork()); my $handle = $request->connection; $request->read_env; @@ -89,5 +89,5 @@ while (my $request = $scgi->accept) { #print $handle "Content-Type: text/xml\n\n"; print $handle $xml; - exit; + exit if (!$pid); } From f917cbe29b5a9589c5019ae40b0339e721d285f9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 08:23:23 -0500 Subject: [PATCH 0256/1057] add server side to scgi --- libs/libscgi/Makefile | 7 +- libs/libscgi/src/include/scgi.h | 7 +- libs/libscgi/src/scgi.c | 184 ++++++++++++++++++++++++++++++++ libs/libscgi/testclient.c | 3 +- libs/libscgi/testserver.c | 42 ++++++++ 5 files changed, 238 insertions(+), 5 deletions(-) create mode 100644 libs/libscgi/testserver.c diff --git a/libs/libscgi/Makefile b/libs/libscgi/Makefile index fb59cb7848..88b5b4e73c 100644 --- a/libs/libscgi/Makefile +++ b/libs/libscgi/Makefile @@ -14,7 +14,7 @@ HEADERS=src/include/scgi.h SOLINK=-shared -Xlinker -x -all: $(MYLIB) testclient +all: $(MYLIB) testclient testserver $(MYLIB): $(OBJS) $(HEADERS) $(SRC) ar rcs $(MYLIB) $(OBJS) @@ -26,7 +26,10 @@ $(MYLIB): $(OBJS) $(HEADERS) $(SRC) testclient: $(MYLIB) testclient.c $(CC) $(CC_CFLAGS) $(CFLAGS) testclient.c -o testclient -lscgi $(LDFLAGS) $(LIBS) +testserver: $(MYLIB) testserver.c + $(CC) $(CC_CFLAGS) $(CFLAGS) testserver.c -o testserver -lscgi $(LDFLAGS) $(LIBS) + clean: - rm -f *.o src/*.o libscgi.a *~ src/*~ src/include/*~ testclient + rm -f *.o src/*.o libscgi.a *~ src/*~ src/include/*~ testclient testserver diff --git a/libs/libscgi/src/include/scgi.h b/libs/libscgi/src/include/scgi.h index ea8d30ade4..29abcf0271 100644 --- a/libs/libscgi/src/include/scgi.h +++ b/libs/libscgi/src/include/scgi.h @@ -138,7 +138,7 @@ typedef int scgi_filehandle_t; #define scgi_strlen_zero(s) (!s || *(s) == '\0') #define scgi_strlen_zero_buf(s) (*(s) == '\0') #define end_of(_s) *(*_s == '\0' ? _s : _s + strlen(_s) - 1) - +#define end_of_p(_s) (*_s == '\0' ? _s : _s + strlen(_s) - 1) typedef enum { SCGI_POLL_READ = (1 << 0), @@ -179,7 +179,7 @@ typedef enum { SCGI_GENERR } scgi_status_t; - +typedef void (*scgi_listen_callback_t)(scgi_socket_t server_sock, scgi_socket_t client_sock, struct sockaddr_in *addr); SCGI_DECLARE(scgi_status_t) scgi_connect(scgi_handle_t *handle, const char *host, scgi_port_t port, uint32_t timeout); SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle); @@ -190,6 +190,9 @@ SCGI_DECLARE(scgi_status_t) scgi_add_param(scgi_handle_t *handle, const char *na SCGI_DECLARE(scgi_status_t) scgi_add_body(scgi_handle_t *handle, const char *value); SCGI_DECLARE(size_t) scgi_build_message(scgi_handle_t *handle, char **buffer); SCGI_DECLARE(scgi_status_t) scgi_destroy_params(scgi_handle_t *handle); +SCGI_DECLARE(scgi_status_t) scgi_listen(const char *host, scgi_port_t port, scgi_listen_callback_t callback); +SCGI_DECLARE(const char *) scgi_get_body(scgi_handle_t *handle); +SCGI_DECLARE(const char *) scgi_get_param(scgi_handle_t *handle, const char *name); #ifdef __cplusplus } diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index eeec39a07b..74cd5cae38 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -165,6 +165,11 @@ SCGI_DECLARE(scgi_status_t) scgi_add_body(scgi_handle_t *handle, const char *val return SCGI_SUCCESS; } +SCGI_DECLARE(const char *) scgi_get_body(scgi_handle_t *handle) +{ + return handle->body; +} + SCGI_DECLARE(scgi_status_t) scgi_add_param(scgi_handle_t *handle, const char *name, const char *value) { scgi_param_t *param, *pp; @@ -190,6 +195,19 @@ SCGI_DECLARE(scgi_status_t) scgi_add_param(scgi_handle_t *handle, const char *na return SCGI_SUCCESS; } +SCGI_DECLARE(const char *) scgi_get_param(scgi_handle_t *handle, const char *name) +{ + scgi_param_t *pp; + + for(pp = handle->params; pp; pp = pp->next) { + if (!strcasecmp(pp->name, name)) { + return pp->value; + } + } + + return NULL; +} + static scgi_status_t scgi_push_param(scgi_handle_t *handle, const char *name, const char *value) { scgi_param_t *param; @@ -518,3 +536,169 @@ SCGI_DECLARE(int) scgi_wait_sock(scgi_socket_t sock, uint32_t ms, scgi_poll_t fl } #endif + +static int scgi_socket_reuseaddr(scgi_socket_t socket) +{ +#ifdef WIN32 + BOOL reuse_addr = TRUE; + return setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse_addr, sizeof(reuse_addr)); +#else + int reuse_addr = 1; + return setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr)); +#endif +} + +SCGI_DECLARE(scgi_status_t) scgi_listen(const char *host, scgi_port_t port, scgi_listen_callback_t callback) +{ + scgi_socket_t server_sock = SCGI_SOCK_INVALID; + struct sockaddr_in addr; + scgi_status_t status = SCGI_SUCCESS; + + if ((server_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + return SCGI_FAIL; + } + + scgi_socket_reuseaddr(server_sock); + + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_ANY); + addr.sin_port = htons(port); + + if (bind(server_sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + status = SCGI_FAIL; + goto end; + } + + if (listen(server_sock, 10000) < 0) { + status = SCGI_FAIL; + goto end; + } + + for (;;) { + int client_sock; + struct sockaddr_in echoClntAddr; +#ifdef WIN32 + int clntLen; +#else + unsigned int clntLen; +#endif + + clntLen = sizeof(echoClntAddr); + + if ((client_sock = accept(server_sock, (struct sockaddr *) &echoClntAddr, &clntLen)) == SCGI_SOCK_INVALID) { + status = SCGI_FAIL; + goto end; + } + + callback(server_sock, client_sock, &echoClntAddr); + } + + end: + + if (server_sock != SCGI_SOCK_INVALID) { + closesocket(server_sock); + server_sock = SCGI_SOCK_INVALID; + } + + return status; + +} + +#define next_str(_e, _s) _s = _e; while(*_s) _s++; _s++ + +SCGI_DECLARE(scgi_status_t) scgi_parse(scgi_socket_t sock, scgi_handle_t *handle) +{ + char sbuf[128] = ""; + char *p = sbuf, *e, *end; + ssize_t r = 0; + scgi_status_t status = SCGI_FAIL; + ssize_t bytes = 0; + char *headers = NULL; + int loops = 0; + ssize_t clen = 0; + char *body = NULL; + char comma = 0; + + handle->sock = sock; + handle->connected = 1; + sock_setup(handle); + + + for(;;) { + + if ((r = recv(sock, p, 1, 0)) < 1) { + break; + } + + if (*p == ':') { + *p = '\0'; + break; + } + p++; + } + + if (r <= 0) goto end; + + bytes = atoi(sbuf); + + if (bytes <= 0) goto end; + + headers = malloc(bytes); + r = recv(sock, headers, bytes, 0); + if (r <= 0) goto end; + + r = recv(sock, &comma, 1, 0); + if (r <= 0 || comma != ',') goto end; + + + p = headers; + end = p + bytes; + e = NULL; + + while(p < end) { + next_str(p, e); + + if (!e) break; + + if (!loops++) { + if (!strcasecmp(p, "CONTENT_LENGTH") && e) { + clen = atoi(e); + if (clen) { + body = malloc(clen+1); + r = recv(sock, body, clen, 0); + *(body + clen) = '\0'; + if (r <= 0) goto end; + scgi_add_body(handle, body); + scgi_safe_free(body); + } + + status = SCGI_SUCCESS; + + } else { + goto end; + } + } + + scgi_add_param(handle, p, e); + next_str(e, p); + } + + end: + + scgi_safe_free(headers); + + 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/libs/libscgi/testclient.c b/libs/libscgi/testclient.c index c43fe237c4..9b9078691c 100644 --- a/libs/libscgi/testclient.c +++ b/libs/libscgi/testclient.c @@ -10,7 +10,8 @@ int main(int argc, char *argv[]) int port = 0; if (argc < 2) { - fprintf(stderr, "usage: testclient "); + fprintf(stderr, "usage: testclient \n"); + exit(-1); } ip = argv[1]; diff --git a/libs/libscgi/testserver.c b/libs/libscgi/testserver.c new file mode 100644 index 0000000000..7cb6e32a03 --- /dev/null +++ b/libs/libscgi/testserver.c @@ -0,0 +1,42 @@ +#include + +static void callback(scgi_socket_t server_sock, scgi_socket_t client_sock, struct sockaddr_in *addr) +{ + scgi_handle_t handle = { 0 }; + + if (scgi_parse(client_sock, &handle) == SCGI_SUCCESS) { + scgi_param_t *pp; + + for(pp = handle.params; pp; pp = pp->next) { + printf("HEADER: [%s] VALUE: [%s]\n", pp->name, pp->value); + } + + if (handle.body) { + printf("\n\nBODY:\n%s\n\n", handle.body); + } + + } + + scgi_disconnect(&handle); + +} + +int main(int argc, char *argv[]) +{ + char *ip; + int port = 0; + + if (argc < 2) { + fprintf(stderr, "usage: testserver \n"); + exit(-1); + } + + ip = argv[1]; + port = atoi(argv[2]); + + + scgi_listen(ip, port, callback); + + + +} From 154678b6c228e7d46f526123f5f605351e6b7ab1 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 10 May 2012 10:27:16 -0500 Subject: [PATCH 0257/1057] tweak for config change --- freeswitch.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/freeswitch.spec b/freeswitch.spec index 470866ab2c..de228a06bf 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1756,6 +1756,7 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/xml_cdr.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/xml_curl.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/xml_rpc.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/xml_scgi.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/zeroconf.conf.xml ###################################################################################################################### # Chatplans From e0db68d20be1a1e2d03c1e1d84182aece058776a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 09:48:33 -0500 Subject: [PATCH 0258/1057] add string to url --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 687ec3aeb9..f2dbc61ee9 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -252,7 +252,7 @@ static switch_status_t do_config(void) binding->host = switch_core_strdup(globals.pool, host); binding->port = atoi(port); binding->vars_map = vars_map; - binding->url = switch_mprintf("scgi://%s:%s", host, port); + binding->url = switch_mprintf("scgi://%s:%s/%s", host, port, bname); if (bind_mask) { binding->bindings = switch_core_strdup(globals.pool, bind_mask); From 68021e862f146875f2fb6c45fb2de58b8e8d537d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 09:48:42 -0500 Subject: [PATCH 0259/1057] send silence on smaller sleeps --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 325a8083a2..e4fc807596 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -170,7 +170,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, SWITCH_IVR_VERIFY_SILENCE_DIVISOR(sval); } - if (ms > 100 && sval) { + if (ms > 10 && sval) { switch_core_session_get_read_impl(session, &imp); if (switch_core_codec_init(&codec, From 787d81db320c8a34182570ad845efae2c7783eef Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 10:57:29 -0500 Subject: [PATCH 0260/1057] fix bsd build issue --- src/include/switch_platform.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index 3d1efe425d..a011850748 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -258,8 +258,12 @@ typedef intptr_t switch_ssize_t; #endif #ifndef TIME_T_FMT +#if defined(__FreeBSD__) && SIZEOF_VOIDP == 4 +#define TIME_T_FMT "d" +#else #define TIME_T_FMT "ld" #endif +#endif #endif From aedbd06b99fb11030c498219f8e44370d7574fde Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 11:01:30 -0500 Subject: [PATCH 0261/1057] fix warning --- libs/libscgi/src/scgi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index 74cd5cae38..d1675d246f 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -226,7 +226,7 @@ static scgi_status_t scgi_push_param(scgi_handle_t *handle, const char *name, co SCGI_DECLARE(scgi_status_t) scgi_send_request(scgi_handle_t *handle) { - scgi_status_t status; + scgi_status_t status = SCGI_SUCCESS; char *buffer = NULL; size_t bytes = 0; ssize_t sent = 0; From cc36ff4800cd1df074a59eef4313b583f3d9f23f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 10 May 2012 17:19:06 +0000 Subject: [PATCH 0262/1057] debian: override gpl/openssl warning on freeswitch package --- debian/bootstrap.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 852571aeed..12dbde8e6d 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -878,9 +878,11 @@ grep -e '^Package:' control | while xread l; do print_long_filename_override "$m" >> $f fi done -f=libfreeswitch1.lintian-overrides -[ -s $f ] || print_edit_warning >> $f -print_gpl_openssl_override "libfreeswitch1" >> $f +for p in freeswitch libfreeswitch1; do + f=$p.lintian-overrides + [ -s $f ] || print_edit_warning >> $f + print_gpl_openssl_override "$p" >> $f +done echo "Done bootstrapping debian/" >&2 touch .stamp-bootstrap From adf313d0c32c2b0be38b7e513765f90200ec15a1 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 10 May 2012 17:24:37 +0000 Subject: [PATCH 0263/1057] debian: override warnings about closing an ITP bug --- debian/bootstrap.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 12dbde8e6d..7ac9b15e9e 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -541,6 +541,15 @@ ${p}: possible-gpl-code-linked-with-openssl EOF } +print_itp_override () { + local p="$1" + cat <&2 grep -e '^Package:' control | while xread l; do m="${l#*: }" f=$m.lintian-overrides - if [ ! -s $f ] || ! grep -e 'package-has-long-file-name' $f >/dev/null; then - [ -s $f ] || print_edit_warning >> $f + [ -s $f ] || print_edit_warning >> $f + if ! grep -e 'package-has-long-file-name' $f >/dev/null; then print_long_filename_override "$m" >> $f fi + if ! grep -e 'new-package-should-close-itp-bug' $f >/dev/null; then + print_itp_override "$m" >> $f + fi done for p in freeswitch libfreeswitch1; do f=$p.lintian-overrides From 62190e58367c7c1ce5334335cbf6b6e3ddfaff81 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 10 May 2012 18:25:30 +0000 Subject: [PATCH 0264/1057] debian: libfreeswitch1 shouldn't build-depend on perl:Depends --- debian/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 7ac9b15e9e..52391ba438 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -196,7 +196,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: libfreeswitch1 Architecture: any -Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends} +Depends: \${shlibs:Depends}, \${misc:Depends} Recommends: Suggests: libfreeswitch1-dbg Description: Cross-Platform Scalable Multi-Protocol Soft Switch From 9b265bdf8b9a22a5c60288d9e587fcf7b93f9b3a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 10 May 2012 18:47:02 +0000 Subject: [PATCH 0265/1057] debian: freeswitch depends on libfreeswitch1 --- debian/bootstrap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 52391ba438..f7ecd14876 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -186,7 +186,8 @@ print_core_control () { cat < Date: Thu, 10 May 2012 18:53:55 +0000 Subject: [PATCH 0266/1057] debian: don't package the SWF slim player We're not including the source code or build tools for the version of the player we're distributing, so it fails The Debian Free Software Guidelines (DFSG). --- debian/bootstrap.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index f7ecd14876..bc5ab0b62f 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -210,7 +210,6 @@ Architecture: any Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) Recommends: freeswitch-doc (= \${binary:Version}), - freeswitch-htdocs-slim (= \${binary:Version}), freeswitch-mod-commands (= \${binary:Version}), freeswitch-init (= \${binary:Version}), freeswitch-music (= \${binary:Version}), @@ -404,14 +403,6 @@ Description: FreeSWITCH systemd configuration ## misc -Package: freeswitch-htdocs-slim -Architecture: all -Depends: \${misc:Depends} -Description: FreeSWITCH htdocs slim player - $(debian_wrap "${fs_description}") - . - This package contains the slim SWF player for FreeSWITCH. - ## sounds Package: freeswitch-music From e54ab070f443f31369e99c79dae69d6607f21642 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 12:15:25 -0500 Subject: [PATCH 0267/1057] put presence-data in events --- src/include/switch_event.h | 2 ++ src/switch_channel.c | 33 +++++++++++++++++++++++++++++++++ src/switch_core_sqldb.c | 2 +- src/switch_event.c | 27 +++++++++++++++++++++++++++ src/switch_ivr_bridge.c | 38 +++++++++++++++++++++++++++++--------- 5 files changed, 92 insertions(+), 10 deletions(-) diff --git a/src/include/switch_event.h b/src/include/switch_event.h index dd5991bf07..5909c0e0c0 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -402,6 +402,8 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event); SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map); SWITCH_DECLARE(int) switch_event_check_permission_list(switch_event_t *list, const char *name); +SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix); + ///\} SWITCH_END_EXTERN_C diff --git a/src/switch_channel.c b/src/switch_channel.c index 3c4262b0a9..20734d04f4 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1160,6 +1160,38 @@ SWITCH_DECLARE(uint32_t) switch_channel_del_variable_prefix(switch_channel_t *ch return r; } + +SWITCH_DECLARE(void) switch_channel_set_presence_data_vals(switch_channel_t *channel, const char *presence_data_cols) +{ + if (!zstr(presence_data_cols)) { + char *cols[128] = { 0 }; + char header_name[128] = ""; + int col_count = 0, i = 0; + char *data_copy = NULL; + + if (zstr(presence_data_cols)) { + presence_data_cols = switch_channel_get_variable_dup(channel, "presence_data_cols", SWITCH_FALSE, -1); + if (zstr(presence_data_cols)) { + return; + } + } + + data_copy = strdup(presence_data_cols); + + col_count = switch_split(data_copy, ':', cols); + + for (i = 0; i < col_count; i++) { + const char *val = NULL; + switch_snprintf(header_name, sizeof(header_name), "PD-%s", cols[i]); + val = switch_channel_get_variable(channel, cols[i]); + switch_channel_set_profile_var(channel, header_name, val); + } + + switch_safe_free(data_copy); + } +} + + SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check) { @@ -2192,6 +2224,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann if ((v = switch_channel_get_variable(channel, "presence_data_cols"))) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Data-Cols", v); + switch_event_add_presence_data_cols(channel, event, "PD-"); } if ((v = switch_channel_get_variable(channel, "call_uuid"))) { diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index d6c64758aa..5c59d96962 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1171,7 +1171,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, static char *parse_presence_data_cols(switch_event_t *event) { - char *cols[25] = { 0 }; + char *cols[128] = { 0 }; int col_count = 0; char *data_copy; switch_stream_handle_t stream = { 0 }; diff --git a/src/switch_event.c b/src/switch_event.c index bce57b79ee..fa864526c8 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -2399,7 +2399,34 @@ SWITCH_DECLARE(int) switch_event_check_permission_list(switch_event_t *list, con return r; } +SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix) +{ + const char *data; + if (!prefix) prefix = ""; + + if ((data = switch_channel_get_variable(channel, "presence_data_cols"))) { + char *cols[128] = { 0 }; + char header_name[128] = ""; + int col_count = 0, i = 0; + char *data_copy = NULL; + + data_copy = strdup(data); + + col_count = switch_split(data_copy, ':', cols); + + for (i = 0; i < col_count; i++) { + const char *val = NULL; + switch_snprintf(header_name, sizeof(header_name), "%s%s", prefix, cols[i]); + + val = switch_channel_get_variable(channel, cols[i]); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, val); + } + + switch_safe_free(data_copy); + } + +} /* For Emacs: diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 6a2cee0405..3d9758f62b 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -968,9 +968,16 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_core_session_t *other_session; + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", msg.string_arg); switch_channel_event_set_data(channel, event); + if ((other_session = switch_core_session_locate(msg.string_arg))) { + switch_channel_t *other_channel = switch_core_session_get_channel(other_session); + switch_event_add_presence_data_cols(other_channel, event, "Bridge-B-PD-"); + switch_core_session_rwunlock(other_session); + } switch_event_fire(&event); } } @@ -1052,16 +1059,27 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session) } } - switch_core_session_rwunlock(other_session); - } + if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { + switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", uuid); + switch_event_add_presence_data_cols(other_channel, event, "Bridge-B-PD-"); + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + } - if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { - switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); - if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", uuid); - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); + switch_core_session_rwunlock(other_session); + } else { + if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { + switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", uuid); + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } } } @@ -1242,6 +1260,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", switch_core_session_get_uuid(peer_session)); switch_channel_event_set_data(caller_channel, event); + switch_event_add_presence_data_cols(peer_channel, event, "Bridge-B-PD-"); switch_event_fire(&event); br = 1; } @@ -1425,6 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", switch_core_session_get_uuid(peer_session)); switch_channel_event_set_data(caller_channel, event); + switch_event_add_presence_data_cols(peer_channel, event, "Bridge-B-PD-"); switch_event_fire(&event); } From 704427337696b19c1eb2e46dc42b9c667d2c6408 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 12:23:00 -0500 Subject: [PATCH 0268/1057] not worth it.... --- .../event_handlers/mod_event_socket/mod_event_socket.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 b56c094872..d71a6fa70e 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 @@ -1356,16 +1356,16 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, if (switch_test_flag(listener, LFLAG_LINGER)) { char disco_buf[512] = ""; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %"TIME_T_FMT"\n", - switch_channel_get_name(channel), listener->linger_timeout); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %d\n", + switch_channel_get_name(channel), (int)listener->linger_timeout); switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" "Controlled-Session-UUID: %s\n" "Content-Disposition: linger\n" "Channel-Name: %s\n" - "Linger-Time: %"TIME_T_FMT"\n" + "Linger-Time: %d\n" "Content-Length: 0\n\n", - switch_core_session_get_uuid(listener->session), switch_channel_get_name(channel), listener->linger_timeout); + switch_core_session_get_uuid(listener->session), switch_channel_get_name(channel), (int)listener->linger_timeout); if (listener->linger_timeout != (time_t) -1) { From 702cc9d49f158bd3a8ecf2cadf0acda6540c273d Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 10 May 2012 16:23:55 -0500 Subject: [PATCH 0269/1057] --resolve 4201 fix up the spec file to make sure /var/lib/freeswitch has the correct perms --- freeswitch.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/freeswitch.spec b/freeswitch.spec index de228a06bf..889dae9007 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1593,6 +1593,7 @@ fi #################################### Basic Directory Structure ####################################################### # %dir %attr(0750, freeswitch, daemon) %{sysconfdir} +%dir %attr(0750, freeswitch, daemon) %{LOCALSTATEDIR} %dir %attr(0750, freeswitch, daemon) %{DBDIR} %dir %attr(0750, freeswitch, daemon) %{GRAMMARDIR} %dir %attr(0750, freeswitch, daemon) %{HTDOCSDIR} From dbafc38b3e5797c0096fc65a4f81d9b0e483272c Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 9 May 2012 10:49:11 +0200 Subject: [PATCH 0270/1057] skypopen: sk balances gives you how many credits you have, no more errors --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index f489cc613a..08d815a7b1 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2533,9 +2533,7 @@ SWITCH_STANDARD_API(sk_function) globals.SKYPOPEN_INTERFACES[tmp_i].message + 30); } } - } - - if (!strcasecmp(argv[0], "list")) { + } else if (!strcasecmp(argv[0], "list")) { int i; unsigned int ib = 0; unsigned int ib_failed = 0; From aba8e073a4f94ed95baad9388b5639f19051b605 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 10 May 2012 23:04:58 +0200 Subject: [PATCH 0271/1057] skypopen: don't whine in debug when skypeout to pstn --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 08d815a7b1..25539fa81e 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -879,7 +879,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch switch_sleep(1000); //XXX don't like this try++; if (try < 5) { - DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG); goto read; } DEBUGA_SKYPE("READ BUFFER EMPTY, skypopen_audio_read Silence\n", SKYPOPEN_P_LOG); From b008f8c9d59f8238316d18bdb5a8529c8ae50ccf Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 11 May 2012 00:35:17 +0000 Subject: [PATCH 0272/1057] debian: attribution --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index 0cc293a346..98b31607f4 100755 --- a/debian/rules +++ b/debian/rules @@ -1,5 +1,7 @@ #!/usr/bin/make -f # -*- mode:makefile -*- +##### Author: Travis Cross + #export DH_VERBOSE=1 FS_CFLAGS?=-ggdb3 -O2 From 383130f855759fbaba88311efac6870125f62344 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 11 May 2012 02:03:58 +0000 Subject: [PATCH 0273/1057] debian: remove remnants of slimplayer as we're now packaging this under contrib --- debian/.gitignore | 1 - debian/freeswitch-htdocs-slim.install | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 debian/freeswitch-htdocs-slim.install diff --git a/debian/.gitignore b/debian/.gitignore index dc57b0b450..a5ce34d6b9 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -20,7 +20,6 @@ /freeswitch-dbg/ /freeswitch-dev/ /freeswitch-doc/ -/freeswitch-htdocs-slim*/ /freeswitch-init*/ /freeswitch-meta*/ /freeswitch-mod-*/ diff --git a/debian/freeswitch-htdocs-slim.install b/debian/freeswitch-htdocs-slim.install deleted file mode 100644 index 0975415a85..0000000000 --- a/debian/freeswitch-htdocs-slim.install +++ /dev/null @@ -1,3 +0,0 @@ -/usr/share/freeswitch/htdocs/license.txt -/usr/share/freeswitch/htdocs/slim.swf -/usr/share/freeswitch/htdocs/slimtest.htm From f9653fbd38e569289181076bd1d9dc25ed2bba52 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 May 2012 22:34:37 -0500 Subject: [PATCH 0274/1057] FS-4204 --resolve --- src/include/switch_core.h | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 12 +++++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 56 ++++++++++++++++++------ src/mod/endpoints/mod_sofia/sofia_glue.c | 4 ++ src/switch_core_media_bug.c | 22 +++++++++- src/switch_ivr_bridge.c | 2 + 7 files changed, 83 insertions(+), 16 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 91cff21d67..624d491e1d 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -141,7 +141,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session, const char *function, switch_media_bug_exec_cb_t cb, void *user_data); - +SWITCH_DECLARE(uint32_t) switch_core_media_bug_count(switch_core_session_t *orig_session, const char *function); /*! \brief Add a media bug to the session \param session the session to add the bug to diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index cf095386e5..164d0e76ff 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5375,11 +5375,23 @@ SWITCH_STANDARD_APP(sofia_sla_function) if (bargee_session == session) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "BARGE: %s (cannot barge on myself)\n", (char *) data); } else { + switch_channel_t *channel; + if (switch_core_session_check_interface(bargee_session, sofia_endpoint_interface)) { tech_pvt = switch_core_session_get_private(bargee_session); + sofia_clear_flag(tech_pvt, TFLAG_SLA_BARGING); sofia_set_flag(tech_pvt, TFLAG_SLA_BARGE); switch_ivr_transfer_variable(bargee_session, session, SWITCH_SIGNAL_BOND_VARIABLE); } + + if (switch_core_session_check_interface(session, sofia_endpoint_interface)) { + tech_pvt = switch_core_session_get_private(session); + sofia_set_flag(tech_pvt, TFLAG_SLA_BARGING); + } + + channel = switch_core_session_get_channel(session); + switch_channel_set_variable(channel, "sip_barging_uuid", (char *)data); + } switch_core_session_rwunlock(bargee_session); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 2da82ac0c2..65755500a9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -334,6 +334,7 @@ typedef enum { TFLAG_CAPTURE, TFLAG_REINVITED, TFLAG_SLA_BARGE, + TFLAG_SLA_BARGING, /* No new flags below this line */ TFLAG_MAX } TFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f87e8581b0..820118c585 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -599,6 +599,23 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, status = 200; phrase = "OK"; + if (sofia_test_flag(tech_pvt, TFLAG_SLA_BARGING)) { + const char *bargee_uuid = switch_channel_get_variable(channel, "sip_barging_uuid"); + switch_core_session_t *bargee_session; + uint32_t ttl = 0; + + if ((bargee_session = switch_core_session_locate(bargee_uuid))) { + //switch_channel_t *bargee_channel = switch_core_session_get_channel(bargee_session); + if ((ttl = switch_core_media_bug_count(bargee_session, "eavesdrop")) == 1) { + if (switch_core_session_check_interface(bargee_session, sofia_endpoint_interface)) { + private_object_t *bargee_tech_pvt = switch_core_session_get_private(bargee_session); + sofia_clear_flag(bargee_tech_pvt, TFLAG_SLA_BARGE); + } + } + switch_core_session_rwunlock(bargee_session); + } + } + if (sofia_test_flag(tech_pvt, TFLAG_SLA_BARGE)) { switch_core_session_t *new_session, *other_session; const char *other_uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE); @@ -8419,9 +8436,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if ((b_session = switch_core_session_locate(b_private->uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); - const char *uuid; - const char *app = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_VARIABLE); - const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE); + const char *bridge_uuid; switch_caller_profile_t *orig_cp; const char *sent_name, *sent_number; orig_cp = switch_channel_get_caller_profile(b_channel); @@ -8446,24 +8461,37 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Setting NAT mode based on %s\n", is_nat); } + tech_pvt->caller_profile->dialplan = "inline"; - if (app && data && !strcasecmp(app, "conference")) { - tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "answer,conference:%s+flags{dist-dtmf}", data); - tech_pvt->caller_profile->dialplan = "inline"; - } else { - if (!(uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) { - uuid = switch_core_session_get_uuid(b_session); - } + bridge_uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE); - if (uuid) { - uuid = switch_core_session_strdup(b_session, uuid); + if (call_info) { + if (!zstr(bridge_uuid) && switch_channel_test_flag(b_channel, CF_LEG_HOLDING)) { + tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, + "answer,intercept:%s", bridge_uuid); + } else { tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "answer,sofia_sla:%s", b_private->uuid); + } + } else { + if (!zstr(bridge_uuid)) { + switch_channel_mark_hold(b_channel, SWITCH_FALSE); + tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "answer,intercept:%s", bridge_uuid); + } else { + const char *b_app = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_VARIABLE); + const char *b_data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE); + + if (b_data && b_app) { + tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "answer,%s:%s", b_app, b_data); + } else if (b_app) { + tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "answer,%s", b_app); + } + - - tech_pvt->caller_profile->dialplan = "inline"; + switch_channel_hangup(b_channel, SWITCH_CAUSE_ATTENDED_TRANSFER); } } + switch_core_session_rwunlock(b_session); } } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index f787ac3cbb..2039116b41 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4061,6 +4061,10 @@ int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly) { int changed = 0; + if (sofia_test_flag(tech_pvt, TFLAG_SLA_BARGE) || sofia_test_flag(tech_pvt, TFLAG_SLA_BARGING)) { + return 0; + } + if (sendonly && switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) { if (!sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) { const char *stream; diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 3d5c26b531..8b466b111e 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -600,6 +600,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t return SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(uint32_t) switch_core_media_bug_count(switch_core_session_t *orig_session, const char *function) +{ + switch_media_bug_t *bp; + uint32_t x = 0; + + if (orig_session->bugs) { + switch_thread_rwlock_rdlock(orig_session->bug_rwlock); + for (bp = orig_session->bugs; bp; bp = bp->next) { + if (!switch_test_flag(bp, SMBF_PRUNE) && !switch_test_flag(bp, SMBF_LOCK) && !strcmp(bp->function, function)) { + x++; + } + } + switch_thread_rwlock_unlock(orig_session->bug_rwlock); + } + + return x; +} + SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session, const char *function, switch_media_bug_exec_cb_t cb, void *user_data) { @@ -629,7 +647,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess stream->write_function(stream, "\n"); if (session->bugs) { - switch_thread_rwlock_wrlock(session->bug_rwlock); + switch_thread_rwlock_rdlock(session->bug_rwlock); for (bp = session->bugs; bp; bp = bp->next) { int thread_locked = (bp->thread_id && bp->thread_id == switch_thread_self()); stream->write_function(stream, @@ -778,6 +796,8 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess switch_thread_rwlock_unlock(session->bug_rwlock); if (bp) { + switch_clear_flag(bp, SMBF_LOCK); + bp->thread_id = 0; switch_core_media_bug_close(&bp); ttl++; goto top; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 3d9758f62b..d8b548b048 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -228,6 +228,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } } + switch_channel_clear_flag(chan_a, CF_INTERCEPT); + switch_channel_clear_flag(chan_a, CF_INTERCEPTED); switch_channel_set_flag(chan_a, CF_BRIDGED); From 495dd7e5e2dc377aa756fa0a28d02073c1c8be13 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 11 May 2012 03:14:40 +0000 Subject: [PATCH 0275/1057] debian: stop if we hit any errors in util.sh --- debian/util.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index e8dc26448f..cb69823c7c 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -2,6 +2,8 @@ ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ##### Author: Travis Cross +set -e + ddir="." [ -n "${0%/*}" ] && ddir="${0%/*}" From 417c3c29fca98b6d52a8372fa92907a76833d35d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 11 May 2012 04:37:54 +0000 Subject: [PATCH 0276/1057] debian: clean up after bootstrapping --- debian/bootstrap.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index bc5ab0b62f..1ded03cc12 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -888,5 +888,10 @@ for p in freeswitch libfreeswitch1; do print_gpl_openssl_override "$p" >> $f done +echo "Cleaning up..." >&2 +rm -f control-modules.preparse +rm -rf control-modules.parse +diff control-modules control-modules.gen >/dev/null && rm -f control-modules.gen + echo "Done bootstrapping debian/" >&2 touch .stamp-bootstrap From 18de24477802f0c9f2dff91b1b205d18e65fbe62 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 11 May 2012 03:13:39 +0000 Subject: [PATCH 0277/1057] debian: add a utility to create the .orig.tar.* file --- debian/util.sh | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index cb69823c7c..e5e561a26d 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -72,10 +72,112 @@ install_build_depends () { touch $ddir/.stamp-build-depends } +cwget () { + local url="$1" f="${1##*/}" + echo "fetching: $url to $f" >&2 + if [ -n "$FS_FILES_DIR" ]; then + if ! [ -s "$FS_FILES_DIR/$f" ]; then + (cd $FS_FILES_DIR && wget -N "$url") + fi + cp -a $FS_FILES_DIR/$f . + else + wget -N "$url" + fi +} + +getlib () { + local sd="$1" url="$2" f="${2##*/}" + (cd $sd/libs \ + && cwget "$url" \ + && tar -xv --no-same-owner --no-same-permissions -f "$f" \ + && rm -f "$f" \ + && mkdir -p $f) +} + +getsound () { + local sd="$1" url="$2" f="${2##*/}" + (cd $sd \ + && cwget "$url") +} + +getlibs () { + local sd="$1" + # get pinned libraries + getlib $sd http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v1.8-latest.tgz + getlib $sd http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2 + getlib $sd http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/openldap-2.4.19.tar.gz + getlib $sd http://download.zeromq.org/zeromq-2.1.9.tar.gz \ + || getlib $sd http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.6.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz + getlib $sd http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz + # get sounds and music + for x in 8000 16000 32000 48000; do + getsound $sd http://files.freeswitch.org/freeswitch-sounds-en-us-callie-$x-1.0.18.tar.gz + getsound $sd http://files.freeswitch.org/freeswitch-sounds-music-$x-1.0.8.tar.gz + done + # cleanup mongo + ( + cd $sd/libs/mongo-cxx-driver-v1.8 + rm -rf config.log .sconf_temp *Test *Example + find . -name "*.o" -exec rm -f {} \; + ) +} + +get_current_version () { + cat $ddir/changelog \ + | grep -e '^freeswitch ' \ + | awk '{print $2}' \ + | sed -e 's/[()]//g' -e 's/-.*//' +} + +create_orig () { + . $ddir/../scripts/ci/common.sh + local xz_level="6" + while getopts 'dZ:' o; do + case "$o" in + d) set -vx;; + Z) xz_level="$OPTARG";; + esac + done + shift $(($OPTIND-1)) + eval $(parse_version "$(get_current_version)") + local destdir="$1" n=freeswitch + local d=${n}-${dver} f=${n}_${dver} + local sd=${ddir}/sdeb/$d + [ -n "$destdir" ] || destdir=$ddir/../../ + mkdir -p $sd + tar -c -C $ddir/../ \ + --exclude=.git \ + --exclude=debian \ + --exclude=freeswitch.xcodeproj \ + --exclude=fscomm \ + --exclude=htdocs \ + --exclude=w32 \ + --exclude=web \ + -vf - . | tar -x -C $sd -vf - + (cd $sd && set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev") + getlibs $sd + tar -c -C $ddir/sdeb -vf $ddir/sdeb/$f.orig.tar $d + xz -${xz_level}v $ddir/sdeb/$f.orig.tar + mv $ddir/sdeb/$f.orig.tar.xz $destdir + rm -rf $ddir/sdeb +} + cmd="$1" shift case "$cmd" in create-dbg-pkgs) create_dbg_pkgs ;; + create-orig) create_orig "$@" ;; list-build-depends) list_build_depends ;; install-build-depends) install_build_depends ;; esac From 8d366f7f984d73f2d5ab6054364bdfcdf1933ff3 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 11 May 2012 04:48:21 +0000 Subject: [PATCH 0278/1057] debian: add a utility for creating the source package --- debian/util.sh | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index e5e561a26d..e67b96df79 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -140,18 +140,10 @@ get_current_version () { | sed -e 's/[()]//g' -e 's/-.*//' } -create_orig () { +_create_orig () { . $ddir/../scripts/ci/common.sh - local xz_level="6" - while getopts 'dZ:' o; do - case "$o" in - d) set -vx;; - Z) xz_level="$OPTARG";; - esac - done - shift $(($OPTIND-1)) eval $(parse_version "$(get_current_version)") - local destdir="$1" n=freeswitch + local destdir="$1" xz_level="$2" n=freeswitch local d=${n}-${dver} f=${n}_${dver} local sd=${ddir}/sdeb/$d [ -n "$destdir" ] || destdir=$ddir/../../ @@ -173,10 +165,48 @@ create_orig () { rm -rf $ddir/sdeb } +create_orig () { + local xz_level="6" + while getopts 'dZ:' o; do + case "$o" in + d) set -vx;; + Z) xz_level="$OPTARG";; + esac + done + shift $(($OPTIND-1)) + _create_orig "$1" "$xz_level" +} + +create_dsc () { + . $ddir/../scripts/ci/common.sh + local xz_level="6" + while getopts 'dZ:' o; do + case "$o" in + d) set -vx;; + Z) xz_level="$OPTARG";; + esac + done + shift $(($OPTIND-1)) + eval $(parse_version "$(get_current_version)") + local destdir="$1" n=freeswitch + local d=${n}-${dver} f=${n}_${dver} + [ -n "$destdir" ] || destdir=$ddir/../../ + [ -f $destdir/$f.orig.tar.xz ] \ + || _create_orig "$1" "${xz_level}" + ( + ddir=$(pwd)/$ddir + cd $destdir + mkdir -p $f + cp -a $ddir $f + dpkg-source -b -i.* -Zxz -z9 $f + ) +} + cmd="$1" shift case "$cmd" in create-dbg-pkgs) create_dbg_pkgs ;; + create-dsc) create_dsc "$@" ;; create-orig) create_orig "$@" ;; list-build-depends) list_build_depends ;; install-build-depends) install_build_depends ;; From 193512e9ea290d8a5e5a4ce9941e8f0c6cba56d4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 11 May 2012 06:23:18 +0000 Subject: [PATCH 0279/1057] debian: mirror dpkg-source parameter choice --- debian/util.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index e67b96df79..be7f2f1cc0 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -167,10 +167,10 @@ _create_orig () { create_orig () { local xz_level="6" - while getopts 'dZ:' o; do + while getopts 'dz:' o; do case "$o" in d) set -vx;; - Z) xz_level="$OPTARG";; + z) xz_level="$OPTARG";; esac done shift $(($OPTIND-1)) @@ -180,10 +180,10 @@ create_orig () { create_dsc () { . $ddir/../scripts/ci/common.sh local xz_level="6" - while getopts 'dZ:' o; do + while getopts 'dz:' o; do case "$o" in d) set -vx;; - Z) xz_level="$OPTARG";; + z) xz_level="$OPTARG";; esac done shift $(($OPTIND-1)) From 03bfc941a1dea7381db54928421ad567eaae0a44 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Fri, 11 May 2012 08:08:11 +0200 Subject: [PATCH 0280/1057] gsmopen: not check for CKPD when receiving SMS --- src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 2294ee4aee..fc59687958 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1199,7 +1199,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us /* we're not in a call, neither calling */ res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CKPD=\"EEE\""); if (res) { - ERRORA("AT+CKPD=\"EEE\" (cellphone screen back to user) do not got OK from the phone\n", GSMOPEN_P_LOG); + DEBUGA_GSMOPEN("AT+CKPD=\"EEE\" (cellphone screen back to user) do not got OK from the phone\n", GSMOPEN_P_LOG); } } } //unread_msg_id From f3b1809a63f70c0da611b7dacf48e49c329b43c6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 May 2012 10:20:45 -0500 Subject: [PATCH 0281/1057] tweak to standby mode --- src/mod/endpoints/mod_sofia/sofia.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 820118c585..26fc3e2668 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1711,11 +1711,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread /* While we're running, or there is a pending sql statment that we haven't appended to sqlbuf yet, because of a lack of buffer space */ while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || sql) { - if (sofia_test_pflag(profile, PFLAG_STANDBY)) { - switch_yield(1000000); - continue; - } - if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { /* Do we have enough statements or is the timeout expired */ while (sql || (sofia_test_pflag(profile, PFLAG_RUNNING) && mod_sofia_globals.running == 1 && @@ -1812,18 +1807,21 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } } - if (++ireg_loops >= IREG_SECONDS) { - time_t now = switch_epoch_time_now(NULL); - sofia_reg_check_expire(profile, now, 0); - ireg_loops = 0; - } - if (++gateway_loops >= GATEWAY_SECONDS) { - sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); - gateway_loops = 0; - } + if (!sofia_test_pflag(profile, PFLAG_STANDBY)) { + if (++ireg_loops >= IREG_SECONDS) { + time_t now = switch_epoch_time_now(NULL); + sofia_reg_check_expire(profile, now, 0); + ireg_loops = 0; + } + + if (++gateway_loops >= GATEWAY_SECONDS) { + sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); + gateway_loops = 0; + } - sofia_sub_check_gateway(profile, time(NULL)); + sofia_sub_check_gateway(profile, time(NULL)); + } last_check = switch_micro_time_now(); } From afdfb9a6e16d0b15236cfd38439c1c0a1d6e5a3a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 May 2012 12:46:32 -0500 Subject: [PATCH 0282/1057] fix missed error condition --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index f2dbc61ee9..87fed74571 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -143,6 +143,11 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con } scgi_disconnect(&handle); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s Connection Failed: [%s]\n", binding->url, handle.err); + switch_safe_free(data); + switch_safe_free(stream.data); + return NULL; } if (GLOBAL_DEBUG) { From bbd9aa237edb57ca5ebc8b7ad85509505999062e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 May 2012 13:06:35 -0500 Subject: [PATCH 0283/1057] another tweak --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 33 +++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 87fed74571..66833b110e 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -143,30 +143,39 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con } scgi_disconnect(&handle); + + if (len < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s Connection Read Failed: [%s]\n", binding->url, handle.err); + goto end; + } + } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s Connection Failed: [%s]\n", binding->url, handle.err); - switch_safe_free(data); - switch_safe_free(stream.data); - return NULL; + goto end; } if (GLOBAL_DEBUG) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s\nPOST_DATA:\n%s\n\nRESPONSE:\n%s\n\n", binding->url, data, txt); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s\nPOST_DATA:\n%s\n\nRESPONSE:-----\n%s\n-----\n", binding->url, data, txt); } - if (!len) { - if (!(xml = switch_xml_parse_str(txt, strlen(txt)))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s]\n", binding->url, data); + if (bytes) { + if ((xml = switch_xml_parse_str(txt, strlen(txt)))) { + txt = NULL; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s] RESPONSE[%s]\n", + binding->url, data, switch_str_nil(txt)); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received error trying to fetch %s\ndata: [%s]\n", binding->url, data); - switch_safe_free(stream.data); - xml = NULL; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received error trying to fetch %s\ndata: [%s] RESPONSE [%s]\n", + binding->url, data, switch_str_nil(txt)); } + + + end: switch_safe_free(data); - - + switch_safe_free(txt); + return xml; } From dd1ae3307cffe054c3f34883235e2a90ec16564b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 May 2012 13:12:44 -0500 Subject: [PATCH 0284/1057] another tweak --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 66833b110e..722dd8c9a1 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -159,7 +159,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con } if (bytes) { - if ((xml = switch_xml_parse_str(txt, strlen(txt)))) { + if ((xml = switch_xml_parse_str_dynamic(txt, FALSE))) { txt = NULL; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s] RESPONSE[%s]\n", From 0b43b32b42854cd53005c40c6d0717d566a01281 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 May 2012 13:34:42 -0500 Subject: [PATCH 0285/1057] Wrong week to quit sniffing glue --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 722dd8c9a1..97b6bdcf0a 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -140,6 +140,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con } stream.write_function(&stream, "%s", buf); + txt = (char *) stream.data; } scgi_disconnect(&handle); @@ -154,17 +155,21 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con goto end; } + + if (GLOBAL_DEBUG) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s\nPOST_DATA:\n%s\n\nRESPONSE:-----\n%s\n-----\n", binding->url, data, txt); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s\nPOST_DATA:\n%s\n\nRESPONSE:\n-----\n%s\n-----\n", + binding->url, data, switch_str_nil(txt)); } - if (bytes) { - if ((xml = switch_xml_parse_str_dynamic(txt, FALSE))) { - txt = NULL; - } else { + + + if (bytes && txt) { + if (!(xml = switch_xml_parse_str_dynamic(txt, FALSE))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s] RESPONSE[%s]\n", binding->url, data, switch_str_nil(txt)); } + txt = NULL; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received error trying to fetch %s\ndata: [%s] RESPONSE [%s]\n", binding->url, data, switch_str_nil(txt)); From 2bd84705343c14048ec7c0d402fa2fe4e3640755 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 02:39:49 +0000 Subject: [PATCH 0286/1057] debian: trust shlibs:Depends to do its thing --- debian/control-modules | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/debian/control-modules b/debian/control-modules index 8ea77b00f0..c74f49bf0a 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -133,9 +133,6 @@ Description: MongoDB This module provides an interface to MongoDB. Build-Depends: scons, libboost-dev, libboost-system-dev, libboost-date-time-dev, libboost-thread-dev, libboost-filesystem-dev -Depends: libicu44, libboost-system1.42.0, libboost-date-time1.42.0, - libboost-serialization1.42.0, libboost-thread1.42.0, - libboost-filesystem1.42.0 Module: applications/mod_mp4 Description: MP4 video support @@ -317,7 +314,6 @@ Module: codecs/mod_speex Description: mod_speex Adds mod_speex. Build-Depends: libogg-dev -Depends: libogg0 Module: codecs/mod_theora Description: mod_theora @@ -353,7 +349,6 @@ Module: endpoints/mod_alsa Description: mod_alsa Adds mod_alsa. Build-Depends: libasound2-dev -Depends: libasound2 Module: endpoints/mod_dingaling Description: mod_dingaling @@ -399,7 +394,6 @@ Module: endpoints/mod_skypopen Description: mod_skypopen Adds mod_skypopen. Build-Depends: libx11-dev -Depends: libpthread-stubs0 Module: endpoints/mod_sofia Description: mod_sofia @@ -423,7 +417,6 @@ Module: event_handlers/mod_cdr_pg_csv Description: mod_cdr_pg_csv Adds mod_cdr_pg_csv. Build-Depends: libpq-dev -Depends: libpq5 Module: event_handlers/mod_cdr_sqlite Description: mod_cdr_sqlite @@ -483,8 +476,6 @@ Module: formats/mod_shout Description: mod_shout Adds mod_shout. Build-Depends: libogg-dev, libvorbis-dev -Depends: libogg0, libvorbis0a, libvorbisenc2, libvorbisfile3, - libvorbisidec1 Module: formats/mod_sndfile Description: mod_sndfile @@ -498,7 +489,6 @@ Module: formats/mod_vlc Description: VLC streaming This module provides VLC streaming. Build-Depends: libvlc-dev (>= 2.0.0) -Depends: libvlc5 Distro-Conflicts: squeeze ## mod/languages @@ -519,7 +509,6 @@ Module: languages/mod_perl Description: mod_perl Adds mod_perl. Build-Depends: libperl-dev -Depends: libperl5.10 Module: languages/mod_python Description: mod_python @@ -635,7 +624,6 @@ Module: xml_int/mod_xml_ldap Description: mod_xml_ldap Adds mod_xml_ldap. Build-Depends: libsasl2-dev -Depends: libsasl2-modules Module: xml_int/mod_xml_rpc Description: mod_xml_rpc From 31703ab6a4f5b7ef0b2667f55676da3306dcca0a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 04:38:56 +0000 Subject: [PATCH 0287/1057] debian: add support for per-distribution build-depends --- debian/bootstrap.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 1ded03cc12..984c90b442 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -6,6 +6,7 @@ mod_dir="../src/mod" conf_dir="../conf" fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media." mod_build_depends="." +supported_distros="squeeze wheezy sid" avoid_mods=( applications/mod_fax applications/mod_ladspa @@ -123,6 +124,11 @@ map_modules () { description="" long_description="" build_depends="" depends="" recommends="" suggests="" distro_conflicts="" + distro_vars="" + for x in $supported_distros; do + distro_vars="$distro_vars build_depends_$x" + eval build_depends_$x="" + done . $y [ -n "$description" ] || description="$module_name" [ -n "$long_description" ] || description="Adds ${module_name}." @@ -131,7 +137,7 @@ map_modules () { module module_name module_path \ description long_description \ build_depends depends recommends suggests \ - distro_conflicts + distro_conflicts $distro_vars done unset category category_path done @@ -695,11 +701,17 @@ gensound () { } accumulate_build_depends () { - if [ -n "$build_depends" ]; then + local x="" + if [ -n "$(eval echo \$build_depends_$codename)" ]; then + x="$(eval echo \$build_depends_$codename)" + else + x="${build_depends}" + fi + if [ -n "$x" ]; then if [ ! "$mod_build_depends" = "." ]; then - mod_build_depends="${mod_build_depends}, ${build_depends}" + mod_build_depends="${mod_build_depends}, ${x}" else - mod_build_depends="${build_depends}" + mod_build_depends="${x}" fi fi } @@ -815,6 +827,10 @@ genmodctl_mod () { echo " $v" done [ -n "$build_depends" ] && debian_wrap "Build-Depends: $build_depends" + for x in $supported_distros; do + [ -n "$(eval echo \$build_depends_$x)" ] \ + && debian_wrap "Build-Depends-$x: $(eval echo \$build_depends_$x)" + done [ -n "$depends" ] && debian_wrap "Depends: $depends" [ -n "$reccomends" ] && debian_wrap "Recommends: $recommends" [ -n "$suggests" ] && debian_wrap "Suggests: $suggests" From 65a29d68f9ba74de1116b0f5d6854cf50cc3657a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 02:49:15 +0000 Subject: [PATCH 0288/1057] debian: add some module build dependencies Thanks to Steven Ayre for an initial list. I've made some modifications and corrections. FS-4202 --resolve --- debian/control-modules | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/control-modules b/debian/control-modules index c74f49bf0a..a1b1178aaf 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -357,6 +357,7 @@ Description: mod_dingaling Module: endpoints/mod_gsmopen Description: mod_gsmopen Adds mod_gsmopen. +Build-Depends: libx11-dev Module: endpoints/mod_h323 Description: mod_h323 @@ -425,10 +426,12 @@ Description: mod_cdr_sqlite Module: event_handlers/mod_erlang_event Description: mod_erlang_event Adds mod_erlang_event. +Build-Depends: erlang-dev Module: event_handlers/mod_event_multicast Description: mod_event_multicast Adds mod_event_multicast. +Build-Depends: libssl-dev Module: event_handlers/mod_event_socket Description: mod_event_socket @@ -453,6 +456,7 @@ Description: mod_radius_cdr Module: event_handlers/mod_snmp Description: mod_snmp Adds mod_snmp. +Build-Depends: libsnmp-dev ## mod/formats @@ -496,6 +500,7 @@ Distro-Conflicts: squeeze Module: languages/mod_java Description: mod_java Adds mod_java. +Build-Depends: default-jdk Module: languages/mod_lua Description: mod_lua @@ -504,6 +509,7 @@ Description: mod_lua Module: languages/mod_managed Description: mod_managed Adds mod_managed. +Build-Depends: libmono-2.0-dev Module: languages/mod_perl Description: mod_perl @@ -513,10 +519,12 @@ Build-Depends: libperl-dev Module: languages/mod_python Description: mod_python Adds mod_python. +Build-Depends: python-dev Module: languages/mod_spidermonkey Description: mod_spidermonkey Adds mod_spidermonkey. +Build-Depends: unixodbc-dev Module: languages/mod_yaml Description: mod_yaml From 3e2194873d78584ce95f8938934486b923cfd4fa Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 18:10:52 +0000 Subject: [PATCH 0289/1057] debian: enable mod_snmp --- debian/bootstrap.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 984c90b442..deeaca1ff8 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -28,7 +28,6 @@ avoid_mods=( endpoints/mod_portaudio endpoints/mod_reference endpoints/mod_unicall - event_handlers/mod_snmp formats/mod_portaudio_stream formats/mod_shout languages/mod_java From 7061ff3b842f3ce107fca812ed12bc721ac7e1f2 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 05:06:14 +0000 Subject: [PATCH 0290/1057] debian: mod_java depends on gcj-jdk for a symlink to jni.h See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=371060 --- debian/control-modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control-modules b/debian/control-modules index a1b1178aaf..2d068aab0b 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -500,7 +500,7 @@ Distro-Conflicts: squeeze Module: languages/mod_java Description: mod_java Adds mod_java. -Build-Depends: default-jdk +Build-Depends: default-jdk, gcj-jdk Module: languages/mod_lua Description: mod_lua From 3eec3d79be24f03606b7ccab30f7d3c3745dcc14 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 18:11:09 +0000 Subject: [PATCH 0291/1057] debian: enable mod_java --- debian/bootstrap.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index deeaca1ff8..518d88beca 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -30,7 +30,6 @@ avoid_mods=( endpoints/mod_unicall formats/mod_portaudio_stream formats/mod_shout - languages/mod_java languages/mod_managed languages/mod_spidermonkey languages/mod_yaml From e44bdd11f443cd56fb7f8e6600d31957af1b870c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 18:11:28 +0000 Subject: [PATCH 0292/1057] debian: enable mod_managed except on squeeze mod_managed needs mono 2.8 or greater, and squeeze has only mono 2.6. --- debian/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 518d88beca..33af6fb2e3 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -30,7 +30,6 @@ avoid_mods=( endpoints/mod_unicall formats/mod_portaudio_stream formats/mod_shout - languages/mod_managed languages/mod_spidermonkey languages/mod_yaml sdk/autotools @@ -38,6 +37,7 @@ avoid_mods=( ) avoid_mods_squeeze=( formats/mod_vlc + languages/mod_managed ) err () { From ee653e58614b123708e4527ddaa28b7a6e3faf04 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 07:20:29 +0000 Subject: [PATCH 0293/1057] debian: use libjpeg62-dev rather than libjpeg8-dev Some modules such as mod_h323 pull in libjpeg62-dev which creates a dependency conflict if we try to use libjpeg8-dev for the core. --- debian/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 33af6fb2e3..cd72d4c983 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -168,7 +168,7 @@ Build-Depends: wget, pkg-config, # configure options libssl-dev, unixodbc-dev, - libncurses5-dev, libjpeg8-dev, + libncurses5-dev, libjpeg62-dev, python-dev, erlang-dev, # documentation doxygen, From 5e83530a20876bd8f5a0c61ff69c781f6b37725c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 05:49:58 +0000 Subject: [PATCH 0294/1057] debian: add build-depends and suggests for mod_ladspa --- debian/control-modules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/control-modules b/debian/control-modules index 2d068aab0b..7a29134f5d 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -114,6 +114,8 @@ Description: HTTP GET with caching Module: applications/mod_ladspa Description: LADSPA This module provides an API for accessing LADSPA plugins. +Build-Depends: ladspa-sdk +Suggests: tap-plugins, swh-plugins, autotalent Module: applications/mod_lcr Description: LCR From df19f49fd8501c235ee7aec396990296bc1d507c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 06:24:40 +0000 Subject: [PATCH 0295/1057] debian: enable mod_ladspa --- debian/bootstrap.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index cd72d4c983..39a19847f7 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -9,7 +9,6 @@ mod_build_depends="." supported_distros="squeeze wheezy sid" avoid_mods=( applications/mod_fax - applications/mod_ladspa applications/mod_limit applications/mod_mongo applications/mod_mp4 From 832d00f3daabb69a375e091409f2cac977e9c322 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 06:54:38 +0000 Subject: [PATCH 0296/1057] debian: add build-depends for mod_yaml --- debian/control-modules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control-modules b/debian/control-modules index 7a29134f5d..62ca64699e 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -531,6 +531,7 @@ Build-Depends: unixodbc-dev Module: languages/mod_yaml Description: mod_yaml Adds mod_yaml. +Build-Depends: libyaml-dev ## mod/loggers From d113dbd27af8d972523ab09a361bed12e4af9920 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 07:06:46 +0000 Subject: [PATCH 0297/1057] debian: enable mod_yaml --- debian/bootstrap.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 39a19847f7..3ff20088d3 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -30,7 +30,6 @@ avoid_mods=( formats/mod_portaudio_stream formats/mod_shout languages/mod_spidermonkey - languages/mod_yaml sdk/autotools xml_int/mod_xml_ldap ) From fb749c611f5b068f1fec50c1e631cb7db734dd65 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 05:41:25 +0000 Subject: [PATCH 0298/1057] debian: enable mod_portaudio and mod_portaudio_stream --- debian/bootstrap.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 3ff20088d3..2fc8b72f66 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -24,10 +24,8 @@ avoid_mods=( endpoints/mod_h323 endpoints/mod_khomp endpoints/mod_opal - endpoints/mod_portaudio endpoints/mod_reference endpoints/mod_unicall - formats/mod_portaudio_stream formats/mod_shout languages/mod_spidermonkey sdk/autotools From 0f50f044f3bb3598e865483c69d6dfa4de788783 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 06:47:21 +0000 Subject: [PATCH 0299/1057] debian: add build-depends for mod_h323 --- debian/control-modules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control-modules b/debian/control-modules index 62ca64699e..8038771e3b 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -364,6 +364,7 @@ Build-Depends: libx11-dev Module: endpoints/mod_h323 Description: mod_h323 Adds mod_h323. +Build-Depends: libopenh323-dev, libpt-dev Module: endpoints/mod_khomp Description: mod_khomp From ed42f37212bb9dfcf855c71d7aa52c3b65859871 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 06:34:54 +0000 Subject: [PATCH 0300/1057] debian: add build-depends and section for mod_mp4 This needs a package from debian-multimedia.org, so it needs to go in contrib/ and we can't build it as part of this source package. --- debian/control-modules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/control-modules b/debian/control-modules index 8038771e3b..55f73c4532 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -139,6 +139,8 @@ Build-Depends: scons, libboost-dev, libboost-system-dev, Module: applications/mod_mp4 Description: MP4 video support This module adds support for MP4 video playback. +Build-Depends: libmp4v2-dev +Section: contrib/comm Module: applications/mod_nibblebill Description: Nibblebill From b19b6498db6f789e6e78c751ae68588bcc9c4bc4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 06:37:27 +0000 Subject: [PATCH 0301/1057] debian: add build-depends for mod_osp --- debian/control-modules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control-modules b/debian/control-modules index 55f73c4532..1255b8ef40 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -150,6 +150,7 @@ Description: Nibblebill Module: applications/mod_osp Description: Open Settlement Protocol This module adds support for the Open Settlement Protocol (OSP). +Build-Depends: libosptk3-dev Module: applications/mod_rad_auth Description: RADIUS AA From c77d9a18dd4c54ab367bc1099926346bbfd42a39 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 18:53:00 +0000 Subject: [PATCH 0302/1057] spelling fix --- libs/libg722_1/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libg722_1/README b/libs/libg722_1/README index 424c281581..865accacde 100644 --- a/libs/libg722_1/README +++ b/libs/libg722_1/README @@ -18,7 +18,7 @@ a separate process, and your application communicates with it through pipes or sockets. This implementation of G.722.1 is adapted from the reference source code -provided by Polycom. Polycom has given its concent for this library to be +provided by Polycom. Polycom has given its consent for this library to be distributed as source code, either on its own or as part of a larger package which they have licenced under their royalty free licencing scheme. From a7151174e29da4e07f4d5cb3696734fd4053c92a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 19:58:48 +0000 Subject: [PATCH 0303/1057] debian: support per-module section headers --- debian/bootstrap.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 2fc8b72f66..dcee07d3d0 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -115,7 +115,7 @@ map_modules () { module=${y##*/} module_path=$y $filterfn $category/$module || continue module="" category="" module_name="" - description="" long_description="" + section="" description="" long_description="" build_depends="" depends="" recommends="" suggests="" distro_conflicts="" distro_vars="" @@ -129,7 +129,7 @@ map_modules () { for f in $permodfns; do $f; done unset \ module module_name module_path \ - description long_description \ + section description long_description \ build_depends depends recommends suggests \ distro_conflicts $distro_vars done @@ -477,8 +477,10 @@ EOF } print_mod_control () { + local m_section="${section-comm}" cat < Date: Sat, 12 May 2012 19:51:16 +0000 Subject: [PATCH 0304/1057] debian: put mod_siren in non-free Despite the relatively-generous patent grant from Polycom, the requirement to execute further agreements to use the code and patents means this module fails the DFSG. We'll need to exclude this code from the source package as well. --- debian/control-modules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control-modules b/debian/control-modules index 1255b8ef40..fbcca77a9f 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -310,6 +310,7 @@ Description: mod_silk Module: codecs/mod_siren Description: mod_siren Adds mod_siren. +Section: non-free/comm Module: codecs/mod_skel_codec Description: mod_skel_codec From 243f950c2a36ac22591d19b0fb0bb399d8c70d65 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 19:57:25 +0000 Subject: [PATCH 0305/1057] debian: rearrange section headers --- debian/control-modules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control-modules b/debian/control-modules index fbcca77a9f..a82d163107 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -137,10 +137,10 @@ Build-Depends: scons, libboost-dev, libboost-system-dev, libboost-date-time-dev, libboost-thread-dev, libboost-filesystem-dev Module: applications/mod_mp4 +Section: contrib/comm Description: MP4 video support This module adds support for MP4 video playback. Build-Depends: libmp4v2-dev -Section: contrib/comm Module: applications/mod_nibblebill Description: Nibblebill @@ -308,9 +308,9 @@ Description: mod_silk Adds mod_silk. Module: codecs/mod_siren +Section: non-free/comm Description: mod_siren Adds mod_siren. -Section: non-free/comm Module: codecs/mod_skel_codec Description: mod_skel_codec From e84686943fc3ab093c1b18363c82b7a15e8c8caf Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 21:30:53 +0000 Subject: [PATCH 0306/1057] debian: put mod_ilbc in non-free The iLBC library in our tree is non-free software. Google has purchased Global IP Sound and released a newer version of this library as part of WebRTC as free software, but we need to upgrade to take advantage of this more favorable licensing. Until we do that, we also need to remove libs/ilbc from the Debian source packaging. --- debian/control-modules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control-modules b/debian/control-modules index a82d163107..3e066ac8b0 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -284,6 +284,7 @@ Description: mod_h26x Adds mod_h26x. Module: codecs/mod_ilbc +Section: non-free/comm Description: mod_ilbc Adds mod_ilbc. From 566123cc50c54bd24a3c5d6d439f526b325f0fa4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 12 May 2012 21:57:57 +0000 Subject: [PATCH 0307/1057] debian: mod_managed needs mono-gmcs to build --- debian/control-modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control-modules b/debian/control-modules index 3e066ac8b0..2327495663 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -517,7 +517,7 @@ Description: mod_lua Module: languages/mod_managed Description: mod_managed Adds mod_managed. -Build-Depends: libmono-2.0-dev +Build-Depends: libmono-2.0-dev, mono-gmcs Module: languages/mod_perl Description: mod_perl From 916624c58bdfbee2a41b41040e5f543a398913b5 Mon Sep 17 00:00:00 2001 From: William King Date: Sun, 13 May 2012 10:33:19 -0700 Subject: [PATCH 0308/1057] Adding mod_vlc as a commented out option into modules.conf. --- build/modules.conf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/build/modules.conf.in b/build/modules.conf.in index 98a88e0622..31aea530fb 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -96,6 +96,7 @@ formats/mod_native_file #formats/mod_shout formats/mod_sndfile formats/mod_tone_stream +#formats/mod_vlc #languages/mod_java languages/mod_lua #languages/mod_managed From 3bc4aa39fe7505e9253e3e6a42dc556c7f28a4d9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 13 May 2012 05:59:03 +0000 Subject: [PATCH 0309/1057] debian: handle copyright information for pocketsphinx Debian expects all copyright information to be in one place, so we copy the license details to debian/copyright and remove the COPYING files when we install components. --- debian/copyright | 38 ++++++++++++++++++++++++++++++++++++++ debian/rules | 1 + 2 files changed, 39 insertions(+) diff --git a/debian/copyright b/debian/copyright index 658614828f..732b2b7d0c 100644 --- a/debian/copyright +++ b/debian/copyright @@ -23,3 +23,41 @@ License: MPL for the specific language governing rights and limitations under the License. +Files: libs/pocketsphinx* +Copyright: 2010 Carnegie Mellon University + /* ==================================================================== + * Copyright (c) 1999-2010 Carnegie Mellon University. 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. + * + * This work was supported in part by funding from the Defense Advanced + * Research Projects Agency and the National Science Foundation of the + * United States of America, and the CMU Sphinx Speech Consortium. + * + * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND + * ANY EXPRESSED 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 CARNEGIE MELLON UNIVERSITY + * NOR ITS EMPLOYEES 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/debian/rules b/debian/rules index 98b31607f4..60c5210940 100755 --- a/debian/rules +++ b/debian/rules @@ -93,6 +93,7 @@ override_dh_auto_install: -$(FS_INSTALL_SOUNDS) && DESTDIR=debian/tmp make cd-sounds-install cd-moh-install mkdir -p debian/tmp/lib/systemd/system install -m0644 debian/freeswitch-systemd.freeswitch.service debian/tmp/lib/systemd/system/freeswitch.service + rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING override_dh_installinit: dh_installinit -pfreeswitch-sysvinit --name=freeswitch From 117582adcac5b514df6e24d8b4130c514ca466bb Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 13 May 2012 20:53:58 +0000 Subject: [PATCH 0310/1057] debian: match empty as well as unset section variable --- debian/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index dcee07d3d0..0c2ee5d10a 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -477,7 +477,7 @@ EOF } print_mod_control () { - local m_section="${section-comm}" + local m_section="${section:-comm}" cat < Date: Sun, 13 May 2012 18:27:51 +0200 Subject: [PATCH 0311/1057] gsmopen: mod_sms tweak --- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index d75dd5e6c4..d1443afc50 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -2978,6 +2978,7 @@ int sms_incoming(private_t *tech_pvt) DEBUGA_GSMOPEN("received SMS on interface %s: DATE=%s, SENDER=%s, BODY=%s|\n", GSMOPEN_P_LOG, tech_pvt->name, tech_pvt->sms_date, tech_pvt->sms_sender, tech_pvt->sms_body); +#ifdef NOTDEF if (!zstr(tech_pvt->session_uuid_str)) { session = switch_core_session_locate(tech_pvt->session_uuid_str); } @@ -2993,7 +2994,6 @@ int sms_incoming(private_t *tech_pvt) //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname); //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE"); -/* mod_sms begin */ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", GSMOPEN_CHAT_PROTO); @@ -3002,10 +3002,7 @@ int sms_incoming(private_t *tech_pvt) //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); -/* mod_sms end */ switch_event_add_body(event, "%s\n", tech_pvt->sms_body); - //switch_core_chat_send(GSMOPEN_CHAT_PROTO, event); /* mod_sms */ - switch_core_chat_send("GLOBAL", event); /* mod_sms */ if (session) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true"); if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) { @@ -3052,6 +3049,38 @@ int sms_incoming(private_t *tech_pvt) if (session) { switch_core_session_rwunlock(session); } +#endif //NOTDEF + /* mod_sms begin */ + if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", GSMOPEN_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->chatmessages[which].from_dispname); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", tech_pvt->sms_sender); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "date", tech_pvt->sms_date); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "datacodingscheme", tech_pvt->sms_datacodingscheme); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "servicecentreaddress", tech_pvt->sms_servicecentreaddress); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "messagetype", "%d", tech_pvt->sms_messagetype); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", GSMOPEN_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->sms_sender); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); + switch_event_add_body(event, "%s\n", tech_pvt->sms_body); + //switch_core_chat_send("GLOBAL", event); /* mod_sms */ + switch_core_chat_send("GLOBAL", event); /* mod_sms */ + } else { + + ERRORA("cannot create event on interface %s. WHY?????\n", GSMOPEN_P_LOG, tech_pvt->name); + } + /* mod_sms end */ + + //memset(&tech_pvt->chatmessages[which], '\0', sizeof(&tech_pvt->chatmessages[which]) ); //memset(tech_pvt->sms_message, '\0', sizeof(tech_pvt->sms_message)); return 0; From eb93a14eb36791a8b69fb77e849122ee3f6041eb Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 14 May 2012 01:39:10 +0200 Subject: [PATCH 0312/1057] gsmopen: correctly sends SMSs in GSM7 or UCS2. Let's check SMS receiving --- .../mod_gsmopen/gsmopen_protocol.cpp | 160 ++++++------------ 1 file changed, 51 insertions(+), 109 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index fc59687958..af89b8dfa4 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -367,7 +367,6 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) if (res) { DEBUGA_GSMOPEN("AT+CMGF? failed, continue\n", GSMOPEN_P_LOG); } -#ifndef WANT_GSMLIB res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1"); if (res) { ERRORA("Error setting SMS sending mode to TEXT on the cellphone, let's hope is TEXT by default. Continuing\n", GSMOPEN_P_LOG); @@ -402,7 +401,6 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) WARNINGA("AT+CSMP do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); } } -#else // WANT_GSMLIB res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); if (res) { @@ -410,6 +408,7 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) } tech_pvt->sms_pdu_not_supported = 0; tech_pvt->no_ucs2 = 1; +#ifdef NOTDEF //GSMLIB? XXX if (tech_pvt->no_ucs2) { res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"GSM\""); if (res) { @@ -421,7 +420,7 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) WARNINGA("AT+CSMP do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); } } -#endif // WANT_GSMLIB +#endif// NOTDEF //GSMLIB? XXX #ifdef NOTDEF //GSMLIB? XXX @@ -1666,7 +1665,6 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us } else { -#ifdef WANT_GSMLIB try { char content2[1000]; SMSMessageRef sms; @@ -1719,7 +1717,6 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us } -#endif // WANT_GSMLIB @@ -2731,117 +2728,70 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) char pdu2[16000]; memset(pdu2, '\0', sizeof(pdu2)); int pdulenght = 0; + string pdu; PUSHA_UNLOCKA(&tech_pvt->controldev_lock); LOKKA(tech_pvt->controldev_lock); -#ifndef WANT_GSMLIB - err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1"); - if (err) { - ERRORA("AT+CMGF=1 (set message sending to TEXT (as opposed to PDU) do not got OK from the phone\n", GSMOPEN_P_LOG); - } -#else // WANT_GSMLIB - err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); - if (err) { - ERRORA("AT+CMGF=0 (set message sending to TEXT (as opposed to PDU) do not got OK from the phone\n", GSMOPEN_P_LOG); - } -#endif // WANT_GSMLIB - - if (tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0) { -#ifdef WANT_GSMLIB try { - SMSMessageRef smsMessage; +int bad_8859=0; memset(mesg_test, '\0', sizeof(mesg_test)); sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 //sprintf(mesg_test,":) ciao belè èéàòìù"); //text=mesg_test; - utf8_to_iso_8859_1(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); - smsMessage = new SMSSubmitMessage(smscommand, dest); - string pdu = smsMessage->encode(); - strncpy(pdu2, pdu.c_str(), sizeof(pdu2) - 1); - memset(smscommand, '\0', sizeof(smscommand)); - pdulenght = pdu.length() / 2 - 1; - sprintf(smscommand, "AT+CMGS=%d", pdulenght); - -#ifdef NOTDEF - - ***9. How to support unicode ? You need 6 steps : 1. set datacodingschema to DCS_SIXTEEN_BIT_ALPHABET 2. set your locale correctly, for example - , my locale, china.setlocale(LC_ALL, "chs"); - - 3. translate MBCS(multiple byte character set) string to unicode string.wchar_t wstr[1000]; - memset(wstr, 0, 2000); - mbstowcs(wstr, data.c_str(), data.length()); - - 4. get unicode string length.int wcs_len = wcslen(wstr); - - 5. change unicode string to net order.for (int i = 0; i < wcs_len; i++) - wstr[i] = htons(wstr[i]); - - 6. put unicode string into pdu.char content2[1000]; - SMSMessageRef sms; - //MessageType messagetype; - //Address servicecentreaddress; - //Timestamp servicecentretimestamp; - //Address sender_recipient_address; - - sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大 - - DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str()); - - memset(content2, '\0', sizeof(content2)); - if (sms->dataCodingScheme().getAlphabet() == DCS_DEFAULT_ALPHABET) { - iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); - } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { - ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), content2, - sizeof(content2)); + bad_8859 = utf8_to_iso_8859_1(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); + if(!bad_8859){ + err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); + if (err) { + ERRORA("AT+CMGF=0 (set message sending to PDU (as opposed to TEXT) do not got OK from the phone\n", GSMOPEN_P_LOG); + } + SMSMessageRef smsMessage; + smsMessage = new SMSSubmitMessage(smscommand, dest); + //string pdu = smsMessage->encode(); + pdu = smsMessage->encode(); + strncpy(pdu2, pdu.c_str(), sizeof(pdu2) - 1); + memset(smscommand, '\0', sizeof(smscommand)); + pdulenght = pdu.length() / 2 - 1; + sprintf(smscommand, "AT+CMGS=%d", pdulenght); } else { - ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); + int ok; + UNLOCKA(tech_pvt->controldev_lock); + POPPA_UNLOCKA(&tech_pvt->controldev_lock); + + tech_pvt->no_ucs2 = 0; + tech_pvt->sms_pdu_not_supported =1; + ok= gsmopen_sendsms(tech_pvt, dest, text); + tech_pvt->no_ucs2 = 1; + tech_pvt->sms_pdu_not_supported =0; + + return ok; } - DEBUGA_GSMOPEN("dataCodingScheme=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); - DEBUGA_GSMOPEN("dataCodingScheme=%s\n", GSMOPEN_P_LOG, sms->dataCodingScheme().toString().c_str()); - DEBUGA_GSMOPEN("address=%s\n", GSMOPEN_P_LOG, sms->address().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreAddress=%s\n", GSMOPEN_P_LOG, sms->serviceCentreAddress().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreTimestamp=%s\n", GSMOPEN_P_LOG, sms->serviceCentreTimestamp().toString().c_str()); - DEBUGA_GSMOPEN("messageType=%d\n", GSMOPEN_P_LOG, sms->messageType()); - DEBUGA_GSMOPEN("userData= |||%s|||\n", GSMOPEN_P_LOG, content2); - - memset(sms_body, '\0', sizeof(sms_body)); - strncpy(sms_body, content2, sizeof(sms_body)); - DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body); - strncpy(tech_pvt->sms_body, sms_body, sizeof(tech_pvt->sms_body)); - strncpy(tech_pvt->sms_sender, sms->address().toString().c_str(), sizeof(tech_pvt->sms_sender)); - strncpy(tech_pvt->sms_date, sms->serviceCentreTimestamp().toString().c_str(), sizeof(tech_pvt->sms_date)); - strncpy(tech_pvt->sms_datacodingscheme, sms->dataCodingScheme().toString().c_str(), sizeof(tech_pvt->sms_datacodingscheme)); - strncpy(tech_pvt->sms_servicecentreaddress, sms->serviceCentreAddress().toString().c_str(), sizeof(tech_pvt->sms_servicecentreaddress)); - tech_pvt->sms_messagetype = sms->messageType(); - //messagetype = sms->messageType(); - //servicecentreaddress = sms->serviceCentreAddress(); - //servicecentretimestamp = sms->serviceCentreTimestamp(); - //sender_recipient_address = sms->address(); -#endif // NOTDEF } catch(GsmException & ge) { ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what()); } -#else // WANT_GSMLIB - ERRORA("tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0 && no WANT_GSMLIB\n", GSMOPEN_P_LOG); - return RESULT_FAILURE; -#endif // WANT_GSMLIB } else { char dest2[1048]; + err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1"); + if (err) { + ERRORA("AT+CMGF=1 (set message sending to TEXT (as opposed to PDU) do not got OK from the phone\n", GSMOPEN_P_LOG); + } + +/* err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"UCS2\""); if (err) { ERRORA("AT+CSCS=\"UCS2\" (set TE messages to ucs2) do not got OK from the phone\n", GSMOPEN_P_LOG); } +*/ memset(dest2, '\0', sizeof(dest2)); utf8_to_ucs2(tech_pvt, dest, strlen(dest), dest2, sizeof(dest2)); @@ -2854,7 +2804,6 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) goto uscita; } err = gsmopen_serial_AT_expect(tech_pvt, "> ", 0, 1); // wait 1.1s for the prompt, no crlf -#if 1 if (err) { DEBUGA_GSMOPEN ("Error or timeout getting prompt '> ' for sending sms directly to the remote party. BTW, seems that we cannot do that with Motorola c350, so we'll write to cellphone memory, then send from memory\n", @@ -2879,24 +2828,23 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) goto uscita; } } -#endif -#ifndef WANT_GSMLIB - memset(mesg_test, '\0', sizeof(mesg_test)); - sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 - //text=mesg_test; + if (tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0) { + memset(smscommand, '\0', sizeof(smscommand)); + sprintf(smscommand, "%s", pdu2); + }else{ + memset(mesg_test, '\0', sizeof(mesg_test)); + sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 + //text=mesg_test; + + memset(smscommand, '\0', sizeof(smscommand)); + if (tech_pvt->no_ucs2) { + sprintf(smscommand, "%s", text); + } else { + utf8_to_ucs2(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); + } - memset(smscommand, '\0', sizeof(smscommand)); - if (tech_pvt->no_ucs2) { - sprintf(smscommand, "%s", text); - } else { - utf8_to_ucs2(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); } -#else // WANT_GSMLIB - - memset(smscommand, '\0', sizeof(smscommand)); - sprintf(smscommand, "%s", pdu2); -#endif // WANT_GSMLIB smscommand[strlen(smscommand)] = 0x1A; DEBUGA_GSMOPEN("smscommand len is: %d, text is:|||%s|||\n", GSMOPEN_P_LOG, (int) strlen(smscommand), smscommand); @@ -2923,7 +2871,7 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) ERRORA("Error de-activating echo from modem\n", GSMOPEN_P_LOG); } } - uscita: +uscita: gsmopen_sleep(1000); if (tech_pvt->at_cmgw[0]) { @@ -2948,12 +2896,6 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) UNLOCKA(tech_pvt->controldev_lock); POPPA_UNLOCKA(&tech_pvt->controldev_lock); } -#ifdef NOTDEF - err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); - if (err) { - DEBUGA_GSMOPEN("AT+CMGF=0 (set message sending to PDU (as opposed to TEXT) do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); - } -#endif // NOTDEF DEBUGA_GSMOPEN("FINISH\n", GSMOPEN_P_LOG); if (failed) From 8a1508d669e41a4b2831233057780bb130080035 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 14 May 2012 01:55:45 +0200 Subject: [PATCH 0313/1057] gsmopen: correctly receives SMSs in GSM7 and UCS2 --- src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index af89b8dfa4..5e5cadd9b6 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1180,10 +1180,12 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us if (res) { ERRORA("AT+CMGR (read SMS) do not got OK from the phone, message sent was:|||%s|||\n", GSMOPEN_P_LOG, at_command); } - res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"GSM\""); +/* + res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"CIAPALO1\""); if (res) { - ERRORA("AT+CSCS=\"GSM\" (set TE messages to GSM) do not got OK from the phone\n", GSMOPEN_P_LOG); + ERRORA("AT+CSCS=\"CIAPALO1\" (set TE messages to GSM) do not got OK from the phone\n", GSMOPEN_P_LOG); } +*/ memset(at_command, 0, sizeof(at_command)); sprintf(at_command, "AT+CMGD=%d", tech_pvt->unread_sms_msg_id); /* delete the message */ tech_pvt->unread_sms_msg_id = 0; @@ -2399,7 +2401,7 @@ int utf8_to_iso_8859_1(private_t *tech_pvt, char *utf8_in, size_t inbytesleft, c iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); #endif // WIN32 if (iconv_res == (size_t) -1) { - ERRORA("error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno); + DEBUGA_GSMOPEN("cannot translate in iso_8859_1 error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno); return -1; } DEBUGA_GSMOPEN @@ -3038,9 +3040,9 @@ int gsmopen_serial_getstatus_AT(private_t *tech_pvt) if (res) { ERRORA("AT+CMGR (read SMS) do not got OK from the phone, message sent was:|||%s|||\n", GSMOPEN_P_LOG, at_command); } - res = gsmopen_serial_write_AT_ack(p, "AT+CSCS=\"GSM\""); + res = gsmopen_serial_write_AT_ack(p, "AT+CSCS=\"CIAPALO2\""); if (res) { - ERRORA("AT+CSCS=\"GSM\" (set TE messages to GSM) do not got OK from the phone\n", GSMOPEN_P_LOG); + ERRORA("AT+CSCS=\"CIAPALO2\" (set TE messages to GSM) do not got OK from the phone\n", GSMOPEN_P_LOG); } memset(at_command, 0, sizeof(at_command)); sprintf(at_command, "AT+CMGD=%d", p->unread_sms_msg_id); /* delete the message */ From 44fd0de8ff14a4641971e740547f5bf3d3bede13 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 14 May 2012 01:59:33 +0200 Subject: [PATCH 0314/1057] gsmopen: indented --- .../mod_gsmopen/gsmopen_protocol.cpp | 20 +++++++++---------- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 5e5cadd9b6..391dade93a 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -420,7 +420,7 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) WARNINGA("AT+CSMP do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); } } -#endif// NOTDEF //GSMLIB? XXX +#endif // NOTDEF //GSMLIB? XXX #ifdef NOTDEF //GSMLIB? XXX @@ -2737,7 +2737,7 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) if (tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0) { try { -int bad_8859=0; + int bad_8859 = 0; memset(mesg_test, '\0', sizeof(mesg_test)); sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 @@ -2745,7 +2745,7 @@ int bad_8859=0; //text=mesg_test; bad_8859 = utf8_to_iso_8859_1(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); - if(!bad_8859){ + if (!bad_8859) { err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); if (err) { ERRORA("AT+CMGF=0 (set message sending to PDU (as opposed to TEXT) do not got OK from the phone\n", GSMOPEN_P_LOG); @@ -2765,10 +2765,10 @@ int bad_8859=0; POPPA_UNLOCKA(&tech_pvt->controldev_lock); tech_pvt->no_ucs2 = 0; - tech_pvt->sms_pdu_not_supported =1; - ok= gsmopen_sendsms(tech_pvt, dest, text); + tech_pvt->sms_pdu_not_supported = 1; + ok = gsmopen_sendsms(tech_pvt, dest, text); tech_pvt->no_ucs2 = 1; - tech_pvt->sms_pdu_not_supported =0; + tech_pvt->sms_pdu_not_supported = 0; return ok; } @@ -2834,7 +2834,7 @@ int bad_8859=0; if (tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0) { memset(smscommand, '\0', sizeof(smscommand)); sprintf(smscommand, "%s", pdu2); - }else{ + } else { memset(mesg_test, '\0', sizeof(mesg_test)); sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 //text=mesg_test; @@ -2873,7 +2873,7 @@ int bad_8859=0; ERRORA("Error de-activating echo from modem\n", GSMOPEN_P_LOG); } } -uscita: + uscita: gsmopen_sleep(1000); if (tech_pvt->at_cmgw[0]) { @@ -3040,9 +3040,9 @@ int gsmopen_serial_getstatus_AT(private_t *tech_pvt) if (res) { ERRORA("AT+CMGR (read SMS) do not got OK from the phone, message sent was:|||%s|||\n", GSMOPEN_P_LOG, at_command); } - res = gsmopen_serial_write_AT_ack(p, "AT+CSCS=\"CIAPALO2\""); + res = gsmopen_serial_write_AT_ack(p, "AT+CSCS=\"GSM\""); if (res) { - ERRORA("AT+CSCS=\"CIAPALO2\" (set TE messages to GSM) do not got OK from the phone\n", GSMOPEN_P_LOG); + ERRORA("AT+CSCS=\"GSM\" (set TE messages to GSM) do not got OK from the phone\n", GSMOPEN_P_LOG); } memset(at_command, 0, sizeof(at_command)); sprintf(at_command, "AT+CMGD=%d", p->unread_sms_msg_id); /* delete the message */ diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index d1443afc50..f48d299e0a 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -3073,7 +3073,7 @@ int sms_incoming(private_t *tech_pvt) //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); switch_event_add_body(event, "%s\n", tech_pvt->sms_body); //switch_core_chat_send("GLOBAL", event); /* mod_sms */ - switch_core_chat_send("GLOBAL", event); /* mod_sms */ + switch_core_chat_send("GLOBAL", event); /* mod_sms */ } else { ERRORA("cannot create event on interface %s. WHY?????\n", GSMOPEN_P_LOG, tech_pvt->name); From 172e4a3041e821a2531b79ed0e5b4fbe2d4bf25c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 06:58:33 -0500 Subject: [PATCH 0315/1057] FS-4183 here is a start, it still needs some work but here are the basic components, initially I am using the algorithim we use to generate artifical silence (static) and using one of those values to sleep a certian number of microseconds plus the cumulative bytes of events but i bet there is still some predictability in there so it needs some more --- build/modules.conf.in | 1 + .../vanilla/autoload_configs/modules.conf.xml | 1 + src/mod/applications/mod_random/mod_random.c | 234 ++++++++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 src/mod/applications/mod_random/mod_random.c diff --git a/build/modules.conf.in b/build/modules.conf.in index 31aea530fb..534c1f0ec2 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -42,6 +42,7 @@ applications/mod_valet_parking #applications/mod_vmd applications/mod_voicemail #applications/mod_voicemail_ivr +#applications/mod_random #asr_tts/mod_cepstral #asr_tts/mod_flite #asr_tts/mod_pocketsphinx diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index 5038713afe..266b32204a 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -63,6 +63,7 @@ + diff --git a/src/mod/applications/mod_random/mod_random.c b/src/mod/applications/mod_random/mod_random.c new file mode 100644 index 0000000000..08f1a8723e --- /dev/null +++ b/src/mod/applications/mod_random/mod_random.c @@ -0,0 +1,234 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2012, 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 + * Neal Horman + * + * + * mod_random.c -- entropy source module + * + */ +#include + +/* Prototypes */ +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_random_shutdown); +SWITCH_MODULE_RUNTIME_FUNCTION(mod_random_runtime); +SWITCH_MODULE_LOAD_FUNCTION(mod_random_load); + +SWITCH_MODULE_DEFINITION(mod_random, mod_random_load, mod_random_shutdown, mod_random_runtime); + +static int RUNNING = 0; +static const char *random_device_files[] = { "/dev/hwrandom", "/dev/random", NULL }; +const char *random_device_file = NULL; + +static void event_handler(switch_event_t *event); + + +SWITCH_MODULE_LOAD_FUNCTION(mod_random_load) +{ + +#ifdef WIN32 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s missing window support\n", modname); + return SWITCH_STATUS_NOTIMPL; +#endif + + int i = 0; + + + for(i = 0 ;random_device_files[i]; i++) { + if (switch_file_exists(random_device_files[i], pool) == SWITCH_STATUS_SUCCESS) { + random_device_file = random_device_files[i]; + break; + } + } + + + if (!random_device_file) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s can't locate a random device file\n", modname); + return SWITCH_STATUS_FALSE; + } + + + if ((switch_event_bind(modname, SWITCH_EVENT_ALL, NULL, event_handler, NULL) != SWITCH_STATUS_SUCCESS)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); + return SWITCH_STATUS_TERM; + } + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + RUNNING = 1; + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_random_shutdown) +{ + + switch_event_unbind_callback(event_handler); + + RUNNING = 0; + + return SWITCH_STATUS_SUCCESS; +} + +#if WIN32 +SWITCH_MODULE_RUNTIME_FUNCTION(mod_random_runtime) +{ + RUNNING = 0; + return SWITCH_STATUS_TERM; +} +#else + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +typedef struct { + int count; + int size; + unsigned char *data; +} entropy_t; + + +static int random_add_entropy(int fd, void *buf, size_t size) +{ + entropy_t e = { 0 }; + int r = 0; + + e.count = size * 8; + e.size = size; + e.data = (unsigned char *) buf; + + if (ioctl(fd, RNDADDENTROPY, &e) != 0) { + r = 1; + } + + return r; +} + +static int rng_read(int fd, void *buf, size_t size) +{ + size_t off = 0; + ssize_t r; + unsigned char *bp = (unsigned char *) buf; + + while (size > 0) { + do { + r = read(fd, bp + off, size); + } while ((r == -1) && (errno == EINTR)); + + if (r <= 0) { + break; + } + + off += r; + size -= r; + } + + return size; +} + +static int rfd = 0; + +static void event_handler(switch_event_t *event) +{ + char *buf; + + if (switch_event_serialize(event, &buf, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + random_add_entropy(rfd, buf, strlen(buf)); + free(buf); + } + +} + +SWITCH_MODULE_RUNTIME_FUNCTION(mod_random_runtime) +{ + + unsigned char data[1024] = {0}; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Thread starting using random_device_file %s\n", modname, random_device_file); + + if ((rfd = open(random_device_file, O_RDWR)) < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Error opening random_device_file %s\n", modname, random_device_file); + RUNNING = 0; + } + + rng_read(rfd, data, 4); + + while(RUNNING) { + int16_t data[64]; + int i = 0; + int len = sizeof(data) / 2; + + switch_generate_sln_silence(data, len, 1); + random_add_entropy(rfd, data, len); + + while(i < len && !data[i]) i++; + + if (i < len) { + switch_yield(abs(data[i]) * 1000); + } + + } + + if (rfd > -1) { + close(rfd); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Thread ending\n", modname); + + return SWITCH_STATUS_TERM; +} + +#endif + + +/* 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 + */ From e7b482184451ade9f1ecfff6f80049d9c3a7e8bf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 07:13:26 -0500 Subject: [PATCH 0316/1057] clean up forking code in example --- src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl index 2c7575f64c..0f4af275bc 100644 --- a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl +++ b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl @@ -61,11 +61,17 @@ my $xml = qq# #; +$SIG{CHLD} = "IGNORE"; while (my $request = $scgi->accept) { - # fork every new req into its own process (optional) - next unless(my $pid = fork()); + my $pid = fork(); + + if ($pid) { + $request->close(); + next; + } + my $handle = $request->connection; $request->read_env; @@ -89,5 +95,9 @@ while (my $request = $scgi->accept) { #print $handle "Content-Type: text/xml\n\n"; print $handle $xml; - exit if (!$pid); + + exit unless $pid; } + + + From c3c559e4f75f39e537ee5cc0fc6e2f989e62b712 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 14 May 2012 15:52:11 +0000 Subject: [PATCH 0317/1057] debian: add mod_random --- debian/control-modules | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/debian/control-modules b/debian/control-modules index 2327495663..e229b86fc7 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -156,6 +156,11 @@ Module: applications/mod_rad_auth Description: RADIUS AA This module implements RADIUS Authentication and Authorization. +Module: applications/mod_random +Description: Entropy extraction + This module extracts entropy from FreeSWITCH and feeds it into + /dev/random. + Module: applications/mod_redis Description: Redis limit backend This module provides a mechanism to use Redis as a backend data From ec0f4c9f6ce20fa35ac49affe8620947de2a1725 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 09:47:35 -0500 Subject: [PATCH 0318/1057] FS-4218 --resolve --- libs/libscgi/src/scgi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index d1675d246f..f50b5b8d88 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -91,7 +91,7 @@ SCGI_DECLARE(size_t) scgi_build_message(scgi_handle_t *handle, char **bufferp) ctlen = strlen(handle->body); } - snprintf(tmp, sizeof(tmp), "%ld", ctlen); + snprintf(tmp, sizeof(tmp), "%d", (int)ctlen); scgi_push_param(handle, "CONTENT_LENGTH", tmp); @@ -100,14 +100,14 @@ SCGI_DECLARE(size_t) scgi_build_message(scgi_handle_t *handle, char **bufferp) plen += (strlen(pp->name) + strlen(pp->value) + 2); } - snprintf(tmp, sizeof(tmp), "%ld", plen + ctlen); + snprintf(tmp, sizeof(tmp), "%d", (int) (plen + ctlen)); len = plen + ctlen + strlen(tmp) + 2; buffer = malloc(len); memset(buffer, 0, len); - snprintf(buffer, len, "%ld:", plen); + snprintf(buffer, len, "%d:", (int)plen); bp = buffer + strlen(buffer); for(pp = handle->params; pp; pp = pp->next) { From 5b3b77071b3483181da41f3a0b0dcccede0bc975 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 10:03:35 -0500 Subject: [PATCH 0319/1057] make sure bargers use the same codec as bargee to avoid transcoding delay --- src/include/private/switch_core_pvt.h | 1 + src/include/switch_core.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 25 +++++++++++++++++++++++-- src/switch_core_codec.c | 11 +++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 95e66f2f6d..0005008252 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -120,6 +120,7 @@ struct switch_core_session { switch_codec_t *video_write_codec; switch_codec_implementation_t read_impl; + switch_codec_implementation_t real_read_impl; switch_codec_implementation_t write_impl; switch_codec_implementation_t video_read_impl; switch_codec_implementation_t video_write_impl; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 624d491e1d..522ebec1f8 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1500,6 +1500,7 @@ SWITCH_DECLARE(void) switch_core_session_unlock_codec_read(_In_ switch_core_sess SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp); +SWITCH_DECLARE(switch_status_t) switch_core_session_get_real_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp); SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp); SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp); SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 26fc3e2668..441da03052 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8464,12 +8464,33 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ bridge_uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE); if (call_info) { + const char *olu; + switch_core_session_t *os; + switch_codec_implementation_t read_impl = { 0 }; + char *codec_str = ""; + + if (!zstr(bridge_uuid) && switch_channel_test_flag(b_channel, CF_LEG_HOLDING)) { + olu = bridge_uuid; + } else { + olu = b_private->uuid; + } + + if ((os = switch_core_session_locate(olu))) { + switch_core_session_get_real_read_impl(os, &read_impl); + switch_core_session_rwunlock(os); + + codec_str = switch_core_session_sprintf(session, "set:absolute_codec_string=%s@%di,", read_impl.iananame, + read_impl.microseconds_per_packet / 1000); + } + + + if (!zstr(bridge_uuid) && switch_channel_test_flag(b_channel, CF_LEG_HOLDING)) { tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, - "answer,intercept:%s", bridge_uuid); + "%sanswer,intercept:%s", codec_str, bridge_uuid); } else { tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, - "answer,sofia_sla:%s", b_private->uuid); + "%sanswer,sofia_sla:%s", codec_str, b_private->uuid); } } else { if (!zstr(bridge_uuid)) { diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 28439c1b60..6ea47fcf13 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -206,6 +206,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s session->read_codec = session->real_read_codec = codec; if (codec->implementation) { session->read_impl = *codec->implementation; + session->real_read_impl = *codec->implementation; } else { memset(&session->read_impl, 0, sizeof(session->read_impl)); } @@ -319,6 +320,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_se return SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(switch_status_t) switch_core_session_get_real_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp) +{ + if (session->real_read_impl.codec_id) { + *impp = session->real_read_impl; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp) { if (session->write_impl.codec_id) { From 4670a770cf86a23ee33c9cf0784040ad7cde8c98 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 11:06:36 -0500 Subject: [PATCH 0320/1057] fix sofia interaction with presence api command --- src/mod/endpoints/mod_sofia/sofia_presence.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index c4eb565f85..5965c54cd8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1112,6 +1112,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_user='%q' and sip_host='%q'", rpid, status, mod_sofia_globals.hostname, profile->name, euser, host); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + proto = SOFIA_CHAT_PROTO; } if (zstr(uuid)) { From 5b38c22e9dc61a84badfdf5ee28ecec75e07eba5 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Mon, 14 May 2012 13:36:11 -0500 Subject: [PATCH 0321/1057] lets kick the auto test with a small change here that doesnt really matter --- freeswitch.spec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index 889dae9007..f4e3399715 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -15,13 +15,13 @@ # This file and all modifications and additions to the pristine package are under the same license as the package itself. # # Contributor(s): Mike Jerris -# Brian West -# Raul Fragoso -# Rupa Shomaker -# Marc Olivier Chouinard -# Raymond Chandler -# Anthony Minessale II -# +# Brian West +# Anthony Minessale II +# Raul Fragoso +# Rupa Shomaker +# Marc Olivier Chouinard +# Raymond Chandler +# Ken Rice # # Maintainer(s): Ken Rice # From 1eae27942e0a41eb3c0298b6f70f761b54501163 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 13:07:35 -0500 Subject: [PATCH 0322/1057] addition to 5b3b77071b3483181da41f3a0b0dcccede0bc975 --- 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 6ea47fcf13..e7fa3f3fe7 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -114,6 +114,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c changed_read_codec = 1; if (codec->implementation) { session->read_impl = *codec->implementation; + session->real_read_impl = *codec->implementation; } else { memset(&session->read_impl, 0, sizeof(session->read_impl)); } @@ -136,7 +137,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c session->read_codec = codec; changed_read_codec = 1; if (codec->implementation) { - session->read_impl = *codec->implementation; + session->read_impl = *codec->implementation; + session->real_read_impl = *codec->implementation; } else { memset(&session->read_impl, 0, sizeof(session->read_impl)); } From 18b88710d04d4be06a82dec5bb388d8bcf70f058 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 14 May 2012 16:23:37 -0700 Subject: [PATCH 0323/1057] Update ChangeLog through Dec 31... 1.2 on horizon --- docs/ChangeLog | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index 6f92097c5f..65588c761a 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,3 +1,18 @@ +freeswitch (1.2.0) + config: add screen_confirm macro to lang/en/ivr/sounds.xml (r:9ea3ce66) + config: support for --with-logfilesdir, --with-dbdir, --with-htdocsdir, --with-soundsdir, --with-grammardir, --with-scriptdir and --with-recordin + gsdir (r:7ae3f5b7/FS-302) + core: Add RECORD_STEREO_SWAP to reverse the record channels (r:d5042f2c/FS-3069) + core: api_on_startup (r:e164b76c) + mod_conference: Add auto-record filename to conference_recording channel variable and ability to pull filename from API (r:b9295fd5/FS-1573) + mod_conference: Convenience feature in mod_conference: apply sub cmds to non_moderator members (r:04295ac9/FS-3249) + mod_conference: New conference commands: get and set (r:ab5f3f28/FS-3254) + mod_commands: allow system API command to capture output from the executed command (r:d7a37e97) + mod_posix_timer: New timer module mod_posix_timer (r:9d7e9e67/FS-3731) + mod_sofia: Add presence-privacy parameter to exclude extension numbers from the distributed presence string (r:c6633fa3/FS-849) + mod_spandsp: Add T31 modem support to mod_spandsp - similar to iaxmodem only wired into FS. Also merge configs into single spandsp.conf.xml --see in tree example-- (r:d91f67d0) + mod_valet_parking: add orbit feature to valet_parking similar to mod_fifo (r:09725e2b) + freeswitch (1.0.7) build: Add mod_silk to windows build From 0a5a057c46e35d740e82549de53607e9ded4fa5b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 17:50:55 -0500 Subject: [PATCH 0324/1057] add inbound-reg-in-new-thread sofia param to launch a new thread to process each new inbound register when using heavier backends --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 + src/mod/endpoints/mod_sofia/sofia.c | 61 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 65755500a9..b96ff52011 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -151,6 +151,7 @@ typedef struct sofia_dispatch_event_s { sofia_profile_t *profile; int save; switch_core_session_t *session; + switch_memory_pool_t *pool; } sofia_dispatch_event_t; struct sofia_private { @@ -265,6 +266,7 @@ typedef enum { PFLAG_OPTIONS_RESPOND_503_ON_BUSY, PFLAG_PRESENCE_DISABLE_EARLY, PFLAG_CONFIRM_BLIND_TRANSFER, + PFLAG_THREAD_PER_REG, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 441da03052..df28e346ae 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1282,6 +1282,48 @@ static void our_sofia_event_callback(nua_event_t event, } } +void *SWITCH_THREAD_FUNC sofia_msg_thread_run_once(switch_thread_t *thread, void *obj) +{ + sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) obj; + switch_memory_pool_t *pool = NULL; + + if (de) { + pool = de->pool; + de->pool = NULL; + sofia_process_dispatch_event(&de); + } + + if (pool) { + switch_core_destroy_memory_pool(&pool); + } + + return NULL; +} + +void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) +{ + sofia_dispatch_event_t *de = *dep; + switch_threadattr_t *thd_attr = NULL; + switch_memory_pool_t *pool; + switch_thread_t *thread; + + switch_core_new_memory_pool(&pool); + + + *dep = NULL; + de->pool = pool; + + switch_threadattr_create(&thd_attr, de->pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&thread, + thd_attr, + sofia_msg_thread_run_once, + de, + de->pool); + + +} + void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) { sofia_dispatch_event_t *de = *dep; @@ -1387,6 +1429,13 @@ static void sofia_queue_message(sofia_dispatch_event_t *de) return; } + + if (de->profile && sofia_test_pflag(de->profile, PFLAG_THREAD_PER_REG) && de->data->e_event == nua_i_register) { + sofia_process_dispatch_event_in_thread(&de); + return; + } + + again: for (idx = 0; idx < mod_sofia_globals.msg_queue_len; idx++) { @@ -3251,6 +3300,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID); } + } else if (!strcasecmp(var, "inbound-reg-in-new-thread")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_THREAD_PER_REG); + } else { + sofia_clear_pflag(profile, PFLAG_THREAD_PER_REG); + } } else if (!strcasecmp(var, "rtp-autoflush-during-bridge")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE); @@ -4102,6 +4157,12 @@ switch_status_t config_sofia(int reload, char *profile_name) sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER); sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER); } + } else if (!strcasecmp(var, "inbound-reg-in-new-thread")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_THREAD_PER_REG); + } else { + sofia_clear_pflag(profile, PFLAG_THREAD_PER_REG); + } } else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID); From efc6f16cef7ffda7d12cb8e85b3588b56c231d82 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 15 May 2012 05:04:44 +0000 Subject: [PATCH 0325/1057] build: add convenience script to set version in configure.in --- build/set-fs-version.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 build/set-fs-version.sh diff --git a/build/set-fs-version.sh b/build/set-fs-version.sh new file mode 100755 index 0000000000..6743b58b5f --- /dev/null +++ b/build/set-fs-version.sh @@ -0,0 +1,16 @@ +#!/bin/sh +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- + +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/../scripts/ci/common.sh + +check_pwd +check_input_ver_build $@ +in_ver="$1" +if [ "$in_ver" = "auto" ]; then + in_ver="$(cat build/next-release.txt)" +fi +eval $(parse_version "$in_ver") +set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" + From fbcb1c7ae2a8e165b8b524994108d2c3de0b3419 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 15 May 2012 07:18:50 +0000 Subject: [PATCH 0326/1057] debian: don't install scripts/ with freeswitch Some modules like mod_java drop files in there during install that should be installed with the module rather than with FS. --- debian/freeswitch.install | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/freeswitch.install b/debian/freeswitch.install index d713fe0607..415f082dd9 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -1,2 +1 @@ /usr/bin -/usr/share/freeswitch/scripts From fcaf88845245786cb64729f6e38cc0acbcdc98a4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 15 May 2012 07:19:51 +0000 Subject: [PATCH 0327/1057] debian: install freeswitch.jar with mod_java --- debian/freeswitch-mod-java.install.tmpl | 1 + 1 file changed, 1 insertion(+) create mode 100644 debian/freeswitch-mod-java.install.tmpl diff --git a/debian/freeswitch-mod-java.install.tmpl b/debian/freeswitch-mod-java.install.tmpl new file mode 100644 index 0000000000..b176da4348 --- /dev/null +++ b/debian/freeswitch-mod-java.install.tmpl @@ -0,0 +1 @@ +/usr/share/freeswitch/scripts/freeswitch.jar From a7c85c804a3e079c74ef415275483606e4a69fea Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 15 May 2012 09:18:02 -0500 Subject: [PATCH 0328/1057] FS-4219 --resolve --- libs/win32/util.vbs | 103 +++++++++++--------------------------------- 1 file changed, 25 insertions(+), 78 deletions(-) diff --git a/libs/win32/util.vbs b/libs/win32/util.vbs index ace3fd6998..29a7be5715 100644 --- a/libs/win32/util.vbs +++ b/libs/win32/util.vbs @@ -270,88 +270,35 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) strVerMicro = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MICRO") strVerRev = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION") - If Right(tmpFolder, 1) <> "\" Then tmpFolder = tmpFolder & "\" End If - If Not FSO.FileExists(tmpFolder & "fs_svnversion.exe") Then - Wget ToolsBase & "fs_svnversion.exe", tmpFolder - End If - - If Not FSO.FileExists(tmpFolder & "libdb44.dll") Then - Wget ToolsBase & "libdb44.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "libsvn_diff-1.dll") Then - Wget ToolsBase & "libsvn_diff-1.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "libsvn_subr-1.dll") Then - Wget ToolsBase & "libsvn_subr-1.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "libsvn_wc-1.dll") Then - Wget ToolsBase & "libsvn_wc-1.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "intl3_svn.dll") Then - Wget ToolsBase & "intl3_svn.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "libapr-1.dll") Then - Wget ToolsBase & "libapr-1.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "libaprutil-1.dll") Then - Wget ToolsBase & "libaprutil-1.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "libapriconv-1.dll") Then - Wget ToolsBase & "libapriconv-1.dll", tmpFolder - End If - If Not FSO.FileExists(tmpFolder & "libsvn_delta-1.dll") Then - Wget ToolsBase & "libsvn_delta-1.dll", tmpFolder - End If - - Dim sLastFile - Const OverwriteIfExist = -1 - Const ForReading = 1 - - if strVerRev = "" Then - if FSO.FolderExists(VersionDir & ".svn") Then - VersionCmd="fs_svnversion " & quote & VersionDir & "." & quote & " -n" - Set MyFile = fso.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) - MyFile.WriteLine("@" & "cd " & quote & tmpFolder & quote ) - MyFile.WriteLine("@" & VersionCmd) - MyFile.Close - Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote) - Do - strFromProc = OExec.StdOut.ReadLine() - VERSION="svn-" & strFromProc - Loop While Not OExec.StdOut.atEndOfStream - sLastVersion = "" - Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) - If Not sLastFile.atEndOfStream Then - sLastVersion = sLastFile.ReadLine() - End If - sLastFile.Close - End If - - if FSO.FolderExists(VersionDir & ".git") Then - VersionCmd="git log --format=" & quote & "%%h %%ci" & quote & " -1 HEAD" - Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) - MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) - MyFile.WriteLine("@" & VersionCmd) - MyFile.Close - Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote) - Do - strFromProc = Trim(OExec.StdOut.ReadLine()) - VERSION="git-" & strFromProc - Loop While Not OExec.StdOut.atEndOfStream - sLastVersion = "" - Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) - If Not sLastFile.atEndOfStream Then - sLastVersion = sLastFile.ReadLine() - End If - sLastFile.Close - VERSION = Replace(VERSION, ":", "-") - End If - End If - + 'Set version to the one reported by configure.in if strVerRev <> "" Then VERSION = strVerRev End If + Dim sLastFile + Const ForReading = 1 + + 'Try To read revision from git, if it's found, use this instead of strVerRev found above + If FSO.FolderExists(VersionDir & ".git") Then + VersionCmd="git log --format=" & quote & "%%h %%ci" & quote & " -1 HEAD" + Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) + MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) + MyFile.WriteLine("@" & VersionCmd) + MyFile.Close + Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote) + Do + strFromProc = Trim(OExec.StdOut.ReadLine()) + VERSION="git-" & strFromProc + Loop While Not OExec.StdOut.atEndOfStream + sLastVersion = "" + Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) + If Not sLastFile.atEndOfStream Then + sLastVersion = sLastFile.ReadLine() + End If + sLastFile.Close + VERSION = Replace(VERSION, ":", "-") + End If + If VERSION = "" Then VERSION = "UNKNOWN" End If From 2e42cabf132255d826abd4a852026fddded14bf3 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 15 May 2012 10:18:14 -0500 Subject: [PATCH 0329/1057] fix sox dependancy --- freeswitch-sounds-en-us-callie.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/freeswitch-sounds-en-us-callie.spec b/freeswitch-sounds-en-us-callie.spec index 468911c53d..68c79e42b6 100644 --- a/freeswitch-sounds-en-us-callie.spec +++ b/freeswitch-sounds-en-us-callie.spec @@ -77,6 +77,7 @@ BuildArch: noarch BuildRequires: sox Requires: freeswitch Requires: freeswitch-sounds-en-us-callie-48000 +Requires: sox BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description From 0d2739bfd25c5c5cb8f00fb2b38230afbebf39a9 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 15 May 2012 10:20:52 -0500 Subject: [PATCH 0330/1057] --resolve FS-4209 --- freeswitch-sounds-music.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/freeswitch-sounds-music.spec b/freeswitch-sounds-music.spec index e43ada5736..520a7dddfe 100644 --- a/freeswitch-sounds-music.spec +++ b/freeswitch-sounds-music.spec @@ -1,3 +1,4 @@ +%define fsname freeswitch %define PREFIX %{_prefix} %define EXECPREFIX %{_exec_prefix} %define BINDIR %{_bindir} From 5c75d4cf5bdf57e7d65000981c70509655f4ceaa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 15 May 2012 08:31:33 -0500 Subject: [PATCH 0331/1057] FS-4220 --resolve i refactored this into a general cross platform function and use it everywhere else we try to set affinity --- src/include/switch_core.h | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 10 +--------- src/switch_core.c | 29 +++++++++++++++++++++++++++++ src/switch_event.c | 12 ++---------- src/switch_time.c | 9 ++------- 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 522ebec1f8..8f9220d0b9 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2328,7 +2328,7 @@ SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_ha SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *fmt, ...); SWITCH_DECLARE(int) switch_max_file_desc(void); SWITCH_DECLARE(void) switch_close_extra_files(int *keep, int keep_ttl); - +SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu); SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index df28e346ae..d7dac7581b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1363,15 +1363,7 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread %d Started\n", my_id); -#ifdef HAVE_CPU_SET_MACROS - { - cpu_set_t set; - CPU_ZERO(&set); - CPU_SET(my_id, &set); - sched_setaffinity(0, sizeof(set), &set); - } -#endif - + switch_core_thread_set_cpu_affinity(my_id); while(switch_queue_pop(q, &pop) == SWITCH_STATUS_SUCCESS && pop) { sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop; diff --git a/src/switch_core.c b/src/switch_core.c index f957a7ae5e..8139f8ccf8 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1325,6 +1325,35 @@ SWITCH_DECLARE(uint32_t) switch_core_min_dtmf_duration(uint32_t duration) return runtime.min_dtmf_duration; } +SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + + if (cpu > -1) { + +#ifdef HAVE_CPU_SET_MACROS + cpu_set_t set; + + CPU_ZERO(&set); + CPU_SET(cpu, &set); + + if (!sched_setaffinity(0, sizeof(set), &set)) { + status = SWITCH_STATUS_SUCCESS; + } + +#else +#if WIN32 + if (SetThreadAffinityMask(GetCurrentThread(), (DWORD_PTR) cpu)) { + status = SWITCH_STATUS_SUCCESS; + } +#endif +#endif + } + + return status; +} + + static void switch_core_set_serial(void) { char buf[13] = ""; diff --git a/src/switch_event.c b/src/switch_event.c index fa864526c8..23670fac93 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -253,16 +253,8 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1; switch_mutex_unlock(EVENT_QUEUE_MUTEX); - -#ifdef HAVE_CPU_SET_MACROS - { - cpu_set_t set; - CPU_ZERO(&set); - CPU_SET(my_id, &set); - sched_setaffinity(0, sizeof(set), &set); - } -#endif - + + switch_core_thread_set_cpu_affinity(my_id); for (;;) { void *pop = NULL; diff --git a/src/switch_time.c b/src/switch_time.c index 17a0a50675..e7256538f3 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -795,14 +795,9 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) runtime.profile_timer = switch_new_profile_timer(); switch_get_system_idle_time(runtime.profile_timer, &runtime.profile_time); -#ifdef HAVE_CPU_SET_MACROS - if (runtime.timer_affinity > -1) { - cpu_set_t set; - CPU_ZERO(&set); - CPU_SET(runtime.timer_affinity, &set); - sched_setaffinity(0, sizeof(set), &set); + if (runtime.timer_affinity > -1) { + switch_core_thread_set_cpu_affinity(runtime.timer_affinity); } -#endif switch_time_sync(); time_sync = runtime.time_sync; From da9aacc62e102c341136654a7c824c9309987f69 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 15 May 2012 08:48:08 -0500 Subject: [PATCH 0332/1057] FS-4217 --resolve --- src/mod/endpoints/mod_sofia/sofia_reg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 81b8da1696..c5fb57bb4d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -428,6 +428,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) gateway_ptr->status = SOFIA_GATEWAY_DOWN; nua_unregister(gateway_ptr->nh, NUTAG_URL(gateway_ptr->register_url), + TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_TO_STR(gateway_ptr->distinct_to ? gateway_ptr->register_to : gateway_ptr->register_from), From d015395566df56912f760eb88b1781474ed4724c Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 15 May 2012 11:25:50 -0500 Subject: [PATCH 0333/1057] FS-4203 --resolve add service setup to windows installer --- w32/Setup/FreeSWITCHConsole.wxs | 51 +++++++++++++++++++++++++++++++++ w32/Setup/Product.wxs | 18 ++++++------ w32/Setup/Setup.wixproj | 2 ++ 3 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 w32/Setup/FreeSWITCHConsole.wxs diff --git a/w32/Setup/FreeSWITCHConsole.wxs b/w32/Setup/FreeSWITCHConsole.wxs new file mode 100644 index 0000000000..243e614e60 --- /dev/null +++ b/w32/Setup/FreeSWITCHConsole.wxs @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index 2f072aa8ca..66bc63b61d 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -66,12 +66,12 @@ WorkingDirectory="INSTALLLOCATION"/> - - + - + + @@ -87,12 +87,12 @@ - - - - - - + + + + + + diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index fcba3f0ceb..f7873cac08 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -36,6 +36,7 @@ + @@ -791,6 +792,7 @@ {1af3a893-f7be-43dd-b697-8ab2397c0d67} True + True Binaries;Content;Satellites INSTALLLOCATION From c2a74240ee602b39fc7c92cb2743863702cd7122 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 15 May 2012 22:25:24 +0000 Subject: [PATCH 0334/1057] libzrtp: fix client-side enrollment It appears that libzrtp would prevent a non-passive client from enrolling with a PBX because of a broken license mode comparison. Thanks to Ivo Kutts for the report. FS-4223 --resolve --- libs/libzrtp/src/zrtp_pbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libzrtp/src/zrtp_pbx.c b/libs/libzrtp/src/zrtp_pbx.c index f4f5a906c4..bb33b8006d 100644 --- a/libs/libzrtp/src/zrtp_pbx.c +++ b/libs/libzrtp/src/zrtp_pbx.c @@ -356,7 +356,7 @@ zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream) /* Passive Client endpoint should NOT generate PBX Secret. */ if ((stream->mitm_mode == ZRTP_MITM_MODE_REG_CLIENT) && - (ZRTP_LICENSE_MODE_PASSIVE != stream->zrtp->lic_mode)) { + (ZRTP_LICENSE_MODE_PASSIVE == stream->zrtp->lic_mode)) { ZRTP_LOG(2,(_ZTU_,"WARNING: Passive Client endpoint should NOT generate PBX Secert.\n")); return zrtp_status_bad_param; } From 6da083551ef995c5ac5fe5c2dd1e196e6961fff6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 15 May 2012 22:26:29 +0000 Subject: [PATCH 0335/1057] libzrtp: fix spelling in log message --- libs/libzrtp/src/zrtp_pbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libzrtp/src/zrtp_pbx.c b/libs/libzrtp/src/zrtp_pbx.c index bb33b8006d..3567d4a47b 100644 --- a/libs/libzrtp/src/zrtp_pbx.c +++ b/libs/libzrtp/src/zrtp_pbx.c @@ -357,7 +357,7 @@ zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream) /* Passive Client endpoint should NOT generate PBX Secret. */ if ((stream->mitm_mode == ZRTP_MITM_MODE_REG_CLIENT) && (ZRTP_LICENSE_MODE_PASSIVE == stream->zrtp->lic_mode)) { - ZRTP_LOG(2,(_ZTU_,"WARNING: Passive Client endpoint should NOT generate PBX Secert.\n")); + ZRTP_LOG(2,(_ZTU_,"WARNING: Passive Client endpoint should NOT generate PBX Secret.\n")); return zrtp_status_bad_param; } From f0aa4ab390b1f905ec1d99f689bfec6215308dcd Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 15 May 2012 21:05:04 -0500 Subject: [PATCH 0336/1057] disable these options if zrtp isn't enabled. --- src/switch_channel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 20734d04f4..806f5f0d82 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2952,6 +2952,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi return SWITCH_STATUS_FALSE; } +#ifdef ENABLE_ZRTP SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) { @@ -3000,7 +3001,7 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) } } } - +#endif @@ -3013,7 +3014,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ const char *uuid; switch_core_session_t *other_session; +#ifdef ENABLE_ZRTP switch_channel_check_zrtp(channel); +#endif switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name); switch_channel_set_flag(channel, CF_EARLY_MEDIA); switch_channel_set_callstate(channel, CCS_EARLY); @@ -3273,7 +3276,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_mutex_unlock(channel->profile_mutex); } +#ifdef ENABLE_ZRTP switch_channel_check_zrtp(channel); +#endif switch_channel_set_flag(channel, CF_ANSWERED); switch_channel_set_callstate(channel, CCS_ACTIVE); From 7e193ed3827edf4534bf63167d3fb071a799ec1f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 16 May 2012 02:41:24 +0000 Subject: [PATCH 0337/1057] Revert "disable these options if zrtp isn't enabled" Brian and I talked about this and concurred on the reversion here. Part of the point of the ZRTP pass-through mode code is that it allows two legs to have a ZRTP-enabled call even if FS doesn't have ZRTP. This reverts commit f0aa4ab390b1f905ec1d99f689bfec6215308dcd. --- src/switch_channel.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 806f5f0d82..20734d04f4 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2952,7 +2952,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi return SWITCH_STATUS_FALSE; } -#ifdef ENABLE_ZRTP SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) { @@ -3001,7 +3000,7 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) } } } -#endif + @@ -3014,9 +3013,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ const char *uuid; switch_core_session_t *other_session; -#ifdef ENABLE_ZRTP switch_channel_check_zrtp(channel); -#endif switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name); switch_channel_set_flag(channel, CF_EARLY_MEDIA); switch_channel_set_callstate(channel, CCS_EARLY); @@ -3276,9 +3273,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_mutex_unlock(channel->profile_mutex); } -#ifdef ENABLE_ZRTP switch_channel_check_zrtp(channel); -#endif switch_channel_set_flag(channel, CF_ANSWERED); switch_channel_set_callstate(channel, CCS_ACTIVE); From 0709cc6f1bab24192697344630c8344d6808c34b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 16 May 2012 02:50:13 +0000 Subject: [PATCH 0338/1057] make log message relevant even if FS doesn't have ZRTP --- 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 20734d04f4..f7d7e3aae4 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2982,7 +2982,7 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) if (doit) { switch_channel_set_variable(channel, "zrtp_secure_media", "true"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, - "%s ZRTP not negotiated on both sides, Activating ZRTP man-in-the-middle mode.\n", switch_channel_get_name(channel)); + "%s ZRTP not negotiated on both sides; disabling ZRTP passthru mode.\n", switch_channel_get_name(channel)); switch_channel_clear_flag(channel, CF_ZRTP_PASS); switch_channel_clear_flag(channel, CF_ZRTP_HASH); From 18ee7ce3d03423d4882b171edf049f610768f7a4 Mon Sep 17 00:00:00 2001 From: Mahdi Moradi Date: Wed, 16 May 2012 20:10:13 +0430 Subject: [PATCH 0339/1057] First upload. --- src/mod/say/mod_say_fa/mod_say_fa.c | 685 ++++++++++++++++++++++++++++ 1 file changed, 685 insertions(+) create mode 100644 src/mod/say/mod_say_fa/mod_say_fa.c diff --git a/src/mod/say/mod_say_fa/mod_say_fa.c b/src/mod/say/mod_say_fa/mod_say_fa.c new file mode 100644 index 0000000000..e044fca7b6 --- /dev/null +++ b/src/mod/say/mod_say_fa/mod_say_fa.c @@ -0,0 +1,685 @@ +/* + * Copyright (c) 2007, Anthony Minessale II + * 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 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 + * Mahdi Moradi + * Babak Yakhchali + * + * mod_say_fa.c -- Say for Persian + * + */ + +#include +#include +#include + +void gregorian_to_jalali(/* output */ int *j_y, int *j_m, int *j_d, + /* input */ int g_y, int g_m, int g_d); +void jalali_to_gregorian(/* output */ int *g_y, int *g_m, int *g_d, + /* input */ int j_y, int j_m, int j_d); + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_fa_load); +SWITCH_MODULE_DEFINITION(mod_say_fa, mod_say_fa_load, NULL, NULL); + +#define say_num(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 = \ + fa_say_general_count(session, tmp, say_args, args)) \ + != SWITCH_STATUS_SUCCESS) { \ + return tstatus; \ + } \ + say_args->method = smeth; say_args->type = stype; \ + } \ + +#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) +{ + if (a) { + if ( !b && !c ) + { + if( method == SSM_COUNTED ) + { + say_file("digits/%d00om.wav", a); + } + else + say_file("digits/%d00.wav", a); + b = c = 0; + } + else + say_file("digits/%d00+.wav", a); + } + + if (b) { + if ( !c || b == 1 ) + { + if( method == SSM_COUNTED ) + { + say_file("digits/%d%dom.wav", b, c); + } + else + say_file("digits/%d%d.wav", b, c); + c = 0; + } + else + say_file("digits/%d0+.wav", b); + } + + if (c) { + if (method == SSM_COUNTED) { + say_file("digits/%dom.wav", c); + } else { + say_file("digits/%d.wav", c); + } + } + + if (what && (a || b || c)) { + say_file(what); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t fa_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + int in; + int x = 0; + int sum = 0; + char what_file[50] = ""; + 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)))) { + 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))) || strlen(tosay) > 9) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + in = 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: + case SSM_PRONOUNCED: + sum = places[5] + places[4] + places[3] + places[2] + places[1] + places[0]; + if( !sum ) + { + if( say_args->method == SSM_COUNTED ) + { + strcpy(what_file,"digits/1000000om.wav"); + } + else + strcpy(what_file,"digits/1000000.wav"); + } + else + strcpy(what_file,"digits/1000000+.wav"); + if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], what_file, session, args)) != SWITCH_STATUS_SUCCESS) { + return status; + } + sum = places[2] + places[1] + places[0]; + if( !sum ) + { if( say_args->method == SSM_COUNTED ) + { + strcpy(what_file,"digits/1000om.wav"); + } + else + strcpy(what_file,"digits/1000.wav"); + } + else + strcpy(what_file,"digits/1000+.wav"); + if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], what_file, 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) { + return status; + } + break; + default: + break; + } + } else { + say_file("digits/0.wav"); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t fa_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *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"); + int jalali_year = 1, jalali_month = 0, jalali_day = 0; + + 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 = switch_core_session_strdup(session, 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); + } + } + } 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; + } + } + + if (hours) { + say_num(hours, SSM_PRONOUNCED); + if(minutes || seconds) + { + say_file("time/hour+.wav"); + } + else + say_file("time/hour.wav"); + } + + if (minutes) { + say_num(minutes, SSM_PRONOUNCED); + if( seconds ) + { + say_file("time/minutes+.wav"); + } + else + say_file("time/minutes.wav"); + } + + if (seconds) { + say_num(seconds, SSM_PRONOUNCED); + say_file("time/seconds.wav"); + } + + 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_SESSION_LOG(session), 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) { + say_file("time/today.wav"); + } + if (say_yesterday) { + say_file("time/yesterday.wav"); + } + if (say_dow) { + say_file("time/day-%d.wav", tm.tm_wday); + } + + if (say_date) { + say_year = say_month = say_day = say_dow = 1; + say_today = say_yesterday = 0; + } + + gregorian_to_jalali(&jalali_year,&jalali_month,&jalali_day,tm.tm_year + 1900,tm.tm_mon + 1,tm.tm_mday); + + if (say_day) { + if(jalali_day > 20 && jalali_day != 30) + { + say_file("digits/%d+.wav", (jalali_day - jalali_day % 10)); + say_file("digits/%de.wav", jalali_day % 10); + } + else + say_file("digits/%de.wav", jalali_day); + } + + if (say_month) { + say_file("time/mon-%d.wav", jalali_month - 1); + } + + if (say_year) { + say_num(jalali_year, 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"); + } + + if (hour > 12) { + hour -= 12; + pm = 1; + } else if (hour == 12) { + pm = 1; + } else if (hour == 0) { + hour = 12; + pm = 0; + } + + say_file("time/hour-e.wav"); + say_file("digits/%do.wav",hour); + play_group(SSM_PRONOUNCED, 0, (tm.tm_min - tm.tm_min % 10) / 10, tm.tm_min % 10, "time/minutes-e.wav", session, args); + say_file("time/%s.wav", pm ? "p-m" : "a-m"); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t fa_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ + char *rials = NULL; + char *cents = NULL; + + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + /* valid characters are 0 - 9, period (.), minus (-), and plus (+) - remove all others */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + rials = sbuf; + + if ((cents = strchr(sbuf, '.'))) { + *cents++ = '\0'; + if (strlen(cents) > 2) { + cents[2] = '\0'; + } + } + + /* If positive sign - skip over" */ + if (sbuf[0] == '+') { + say_file("currency/positive-e.wav"); + rials++; + } + + /* If negative say "negative" */ + if (sbuf[0] == '-') { + say_file("currency/negative-e.wav"); + rials++; + } + + /* Say rial amount */ + fa_say_general_count(session, rials, say_args, args); + say_file("currency/rials.wav"); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t fa_say_telephone(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + char *phone_number; + int tosay_length = 0; + + if( !tosay || !strlen(tosay) ) + { + return SWITCH_STATUS_SUCCESS; + } + + if ((phone_number = strchr(tosay,'-'))) + { + *phone_number++ = '\0'; + fa_say_telephone(session,tosay,say_args,args); + fa_say_telephone(session,phone_number,say_args,args); + return SWITCH_STATUS_SUCCESS; + } + + tosay_length = strlen(tosay); + if( tosay_length == 1 ) + { + say_file("digits/%d.wav",tosay[0] - 48); + } + else if ( tosay[0] == '0' ) + { + if( tosay[1] == '0' ) + { + say_file("digits/00.wav"); + fa_say_telephone(session,tosay + 2,say_args,args); + } + else + { + say_file("digits/0.wav"); + fa_say_telephone(session,tosay + 1,say_args,args); + } + } + else if ( tosay_length % 2 ) + { + play_group(SSM_PRONOUNCED,tosay[0] - 48,tosay[1] - 48,tosay[2] - 48,NULL,session,args); + fa_say_telephone(session,tosay + 3,say_args,args); + } + else + { + play_group(SSM_PRONOUNCED,0,tosay[0] - 48,tosay[1] - 48,NULL,session,args); + fa_say_telephone(session,tosay + 2,say_args,args); + } + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t fa_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; + + switch (say_args->type) { + case SST_NUMBER: + case SST_ITEMS: + case SST_PERSONS: + case SST_MESSAGES: + say_cb = fa_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 = fa_say_time; + break; + case SST_IP_ADDRESS: + return switch_ivr_say_ip(session, tosay, fa_say_general_count, say_args, args); + break; + case SST_NAME_SPELLED: + case SST_NAME_PHONETIC: + return switch_ivr_say_spell(session, tosay, say_args, args); + break; + case SST_CURRENCY: + say_cb = fa_say_money; + break; + case SST_TELEPHONE_NUMBER: + say_cb = fa_say_telephone; + break; + default: + 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; +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_fa_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 = "fa"; + say_interface->say_function = fa_say; + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +/* Utility functions */ + +int g_days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; +int j_days_in_month[12] = {31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29}; + +void gregorian_to_jalali(int *j_y, int *j_m, int *j_d, + int g_y, int g_m, int g_d) +{ + int gy, gm, gd; + int jy, jm, jd; + long g_day_no, j_day_no; + int j_np; + + int i; + + gy = g_y-1600; + gm = g_m-1; + gd = g_d-1; + + g_day_no = 365*gy+(gy+3)/4-(gy+99)/100+(gy+399)/400; + for (i=0;i1 && ((gy%4==0 && gy%100!=0) || (gy%400==0))) + /* leap and after Feb */ + ++g_day_no; + g_day_no += gd; + + j_day_no = g_day_no-79; + + j_np = j_day_no / 12053; + j_day_no %= 12053; + + jy = 979+33*j_np+4*(j_day_no/1461); + j_day_no %= 1461; + + if (j_day_no >= 366) { + jy += (j_day_no-1)/365; + j_day_no = (j_day_no-1)%365; + } + + for (i = 0; i < 11 && j_day_no >= j_days_in_month[i]; ++i) { + j_day_no -= j_days_in_month[i]; + } + jm = i+1; + jd = j_day_no+1; + *j_y = jy; + *j_m = jm; + *j_d = jd; +} + +void jalali_to_gregorian(int *g_y, int *g_m, int *g_d, + int j_y, int j_m, int j_d) +{ + int gy, gm, gd; + int jy, jm, jd; + long g_day_no, j_day_no; + int leap; + + int i; + + jy = j_y-979; + jm = j_m-1; + jd = j_d-1; + + j_day_no = 365*jy + (jy/33)*8 + (jy%33+3)/4; + for (i=0; i < jm; ++i) + j_day_no += j_days_in_month[i]; + + j_day_no += jd; + + g_day_no = j_day_no+79; + + gy = 1600 + 400*(g_day_no/146097); /* 146097 = 365*400 + 400/4 - 400/100 + 400/400 */ + g_day_no = g_day_no % 146097; + + leap = 1; + if (g_day_no >= 36525) /* 36525 = 365*100 + 100/4 */ + { + g_day_no--; + gy += 100*(g_day_no/36524); /* 36524 = 365*100 + 100/4 - 100/100 */ + g_day_no = g_day_no % 36524; + + if (g_day_no >= 365) + g_day_no++; + else + leap = 0; + } + + gy += 4*(g_day_no/1461); /* 1461 = 365*4 + 4/4 */ + g_day_no %= 1461; + + if (g_day_no >= 366) { + leap = 0; + + g_day_no--; + gy += g_day_no/365; + g_day_no = g_day_no % 365; + } + + for (i = 0; g_day_no >= g_days_in_month[i] + (i == 1 && leap); i++) + g_day_no -= g_days_in_month[i] + (i == 1 && leap); + gm = i+1; + gd = g_day_no+1; + + *g_y = gy; + *g_m = gm; + *g_d = gd; +} + +/* 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: + */ \ No newline at end of file From 4e4b4444d26c424263d520fe33cfa2686762bb3f Mon Sep 17 00:00:00 2001 From: Mahdi Moradi Date: Wed, 16 May 2012 20:35:15 +0430 Subject: [PATCH 0340/1057] Microsoft visual studio project files. --- src/mod/say/mod_say_fa/mod_say_fa.2008.vcproj | 283 ++++++++++++++++++ .../say/mod_say_fa/mod_say_fa.2010.vcxproj | 135 +++++++++ .../mod_say_fa/mod_say_fa.2010.vcxproj.user | 3 + src/mod/say/mod_say_fa/mod_say_fa.vcproj | 51 ++++ 4 files changed, 472 insertions(+) create mode 100644 src/mod/say/mod_say_fa/mod_say_fa.2008.vcproj create mode 100644 src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj create mode 100644 src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user create mode 100644 src/mod/say/mod_say_fa/mod_say_fa.vcproj diff --git a/src/mod/say/mod_say_fa/mod_say_fa.2008.vcproj b/src/mod/say/mod_say_fa/mod_say_fa.2008.vcproj new file mode 100644 index 0000000000..7cd7862cd7 --- /dev/null +++ b/src/mod/say/mod_say_fa/mod_say_fa.2008.vcproj @@ -0,0 +1,283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj b/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj new file mode 100644 index 0000000000..cefc30eeab --- /dev/null +++ b/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_say_fa + {85a71f08-9f6c-11e1-9967-002186cfa17e} + mod_say_fa + 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 + + + + + + \ No newline at end of file diff --git a/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user b/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user new file mode 100644 index 0000000000..695b5c78b9 --- /dev/null +++ b/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/mod/say/mod_say_fa/mod_say_fa.vcproj b/src/mod/say/mod_say_fa/mod_say_fa.vcproj new file mode 100644 index 0000000000..02de50a6fa --- /dev/null +++ b/src/mod/say/mod_say_fa/mod_say_fa.vcproj @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 31e0e17d6b98a3b26b584f91916f8168e3752837 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 16 May 2012 21:05:41 +0000 Subject: [PATCH 0341/1057] make some ZRTP-related integer casts explicit ...to satisfy Windows Visual Studio. Thanks to Jeff Lenk. --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d481a17d49..c34da28c58 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -858,7 +858,7 @@ SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool) zrtp_config.lic_mode = ZRTP_LICENSE_MODE_ACTIVE; switch_snprintf(zrtp_cache_path, sizeof(zrtp_cache_path), "%s%szrtp.dat", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR); zrtp_zstrcpyc((zrtp_stringn_t*)zrtp_config.def_cache_path.buffer, zrtp_cache_path); - zrtp_config.def_cache_path.length = strlen(zrtp_cache_path); + zrtp_config.def_cache_path.length = (uint16_t)strlen(zrtp_cache_path); zrtp_config.def_cache_path.max_length = 255; zrtp_config.cb.event_cb.on_zrtp_protocol_event = zrtp_event_callback; zrtp_config.cb.misc_cb.on_send_packet = zrtp_send_rtp_callback; @@ -1726,7 +1726,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session rtp_session->zrtp_profile->allowclear = 0; rtp_session->zrtp_profile->disclose_bit = 0; - rtp_session->zrtp_profile->cache_ttl = -1; + rtp_session->zrtp_profile->cache_ttl = (uint32_t) -1; if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, initiator, &rtp_session->zrtp_session)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n"); From 7bd9efc7f52a725b7ef9efb64b65873b4bc4330b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 16 May 2012 21:26:50 +0000 Subject: [PATCH 0342/1057] use the typedef for an enum rather than unsigned The callback here receives both zrtp_protocol_event_t and zrtp_security_event_t events. The latter is numbered contiguously to the former. Still, it's a bit confusing to have to pick one as a type, but apparently this fixes a warning on Visual Studio on Windows. Thanks to Jeff Lenk. --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c34da28c58..9211ec2cee 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -688,7 +688,7 @@ static int zrtp_send_rtp_callback(const zrtp_stream_t *stream, char *rtp_packet, return status; } -static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event) +static void zrtp_event_callback(zrtp_stream_t *stream, zrtp_security_event_t event) { switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream); zrtp_session_info_t zrtp_session_info; From fdc9e7f8b6a81df14bee9a2bb7d4b626e8df3e1a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 17 May 2012 05:33:44 +0000 Subject: [PATCH 0343/1057] work around libzrtp API mistake for VS libzrtp's sas_is_verified field is a uint32_t, but zrtp_verified_set expects a uint8_t. This is a boolean field, so it doesn't matter one way or the other. gcc doesn't care, but Windows Visual Studio apparently throws a warning about this. --- src/switch_rtp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 9211ec2cee..9c42520ff9 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -715,7 +715,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, zrtp_security_event_t eve switch_channel_set_variable_name_printf(channel, stream->session->sas1.buffer, "zrtp_sas1_string_%s", type); switch_channel_set_variable_name_printf(channel, stream->session->sas2.buffer, "zrtp_sas2_string", type); - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); + zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); } } @@ -777,7 +777,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, zrtp_security_event_t eve if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { if (zrtp_session_info.sas_is_ready) { - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); + zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); } } } @@ -790,7 +790,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, zrtp_security_event_t eve if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { if (zrtp_session_info.sas_is_ready) { - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); + zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); } } } @@ -803,7 +803,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, zrtp_security_event_t eve if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { if (zrtp_session_info.sas_is_ready) { - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); + zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); } } } @@ -3645,7 +3645,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, - &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); + &rtp_session->zrtp_session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); rtp_session->zrtp_mitm_tries++; } } @@ -4275,7 +4275,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, - &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); + &rtp_session->zrtp_session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); rtp_session->zrtp_mitm_tries++; } rtp_session->zrtp_mitm_tries++; From d5484651ce473636fcfb5ecc2a4289c4645319ca Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 17 May 2012 06:13:32 +0000 Subject: [PATCH 0344/1057] squelch a Windows VS warning about null termination on the ZID According Jeff Lenk, Windows Visual Studio doesn't understand that people use the char type for non-null-terminated byte arrays, so it throws a warning about this that causes the build to fail on Windows. As the initial value for the ZID doesn't really matter here one iota, just null-terminate it on Windows. --- src/switch_rtp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 9c42520ff9..c4030148aa 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -73,7 +73,11 @@ typedef srtp_hdr_t rtp_hdr_t; #ifdef ENABLE_ZRTP #include "zrtp.h" static zrtp_global_t *zrtp_global; +#ifndef WIN32 static zrtp_zid_t zid = { "FreeSWITCH01" }; +#else +static zrtp_zid_t zid = { "FreeSWITCH0\0" }; +#endif static int zrtp_on = 0; #define ZRTP_MITM_TRIES 100 #endif From b65c32119373a000f93ed7d974fc95b9c4c01dcc Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 17 May 2012 08:38:11 -0500 Subject: [PATCH 0345/1057] FS-4228 --resolve add zrtp support to windows vs2010 build --- Freeswitch.2010.sln | 20 ++ .../libzrtp/projects/win/libzrtp.2010.vcxproj | 250 +++++++++++++++++ .../projects/win/libzrtp.2010.vcxproj.filters | 256 ++++++++++++++++++ libs/libzrtp/third_party/bnlib/bnconfig.win | 76 ++++++ libs/libzrtp/third_party/bnlib/lbn.h | 6 + src/switch_rtp.c | 2 +- w32/Library/FreeSwitchCore.2010.vcxproj | 19 +- 7 files changed, 620 insertions(+), 9 deletions(-) create mode 100644 libs/libzrtp/projects/win/libzrtp.2010.vcxproj create mode 100644 libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters create mode 100644 libs/libzrtp/third_party/bnlib/bnconfig.win diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index e7cccee08c..954ce1cc1b 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -525,6 +525,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsmlib", "src\mod\endpoints EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsmopen", "src\mod\endpoints\mod_gsmopen\mod_gsmopen.2010.vcxproj", "{74B120FF-6935-4DFE-A142-CDB6BEA99C90}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libs\libzrtp\projects\win\libzrtp.2010.vcxproj", "{C13CC324-0032-4492-9A30-310A6BD64FF5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3574,6 +3576,23 @@ Global {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x64.ActiveCfg = Release|x64 {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x64 Setup.ActiveCfg = Release|x64 {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x86 Setup.ActiveCfg = Release|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|Win32.ActiveCfg = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|Win32.Build.0 = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|x64.ActiveCfg = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|x64 Setup.ActiveCfg = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|x86 Setup.ActiveCfg = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|Win32.ActiveCfg = Debug|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|Win32.Build.0 = Debug|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|x64.ActiveCfg = Debug|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|x64.Build.0 = Debug|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|x86 Setup.ActiveCfg = Debug|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|Win32.ActiveCfg = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|Win32.Build.0 = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64.ActiveCfg = Release|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64.Build.0 = Release|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64 Setup.ActiveCfg = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x86 Setup.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3687,6 +3706,7 @@ Global {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {23B4D303-79FC-49E0-89E2-2280E7E28940} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {C13CC324-0032-4492-9A30-310A6BD64FF5} = {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/libs/libzrtp/projects/win/libzrtp.2010.vcxproj b/libs/libzrtp/projects/win/libzrtp.2010.vcxproj new file mode 100644 index 0000000000..3306611920 --- /dev/null +++ b/libs/libzrtp/projects/win/libzrtp.2010.vcxproj @@ -0,0 +1,250 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {C13CC324-0032-4492-9A30-310A6BD64FF5} + libzrtp.x32 + Win32Proj + libzrtp + + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + Disabled + ../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Default + + + Level3 + ProgramDatabase + CompileAsC + + + + if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" + + + + + Disabled + ../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Default + + + Level3 + ProgramDatabase + CompileAsC + + + + if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" + + + + + ../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions) + + + MultiThreadedDLL + Default + false + + + Level3 + ProgramDatabase + CompileAsC + + + + if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" + + + + + ../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=0;ZRTP_USE_BUILTIN_CACHE=1;%(PreprocessorDefinitions) + + + MultiThreadedDLL + Default + false + + + Level3 + ProgramDatabase + CompileAsC + + + + if not exist "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" copy "$(ProjectDir)..\..\third_party\bnlib\bnconfig.win" "$(ProjectDir)..\..\third_party\bnlib\bnconfig.h" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters b/libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters new file mode 100644 index 0000000000..4bae11a1dd --- /dev/null +++ b/libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters @@ -0,0 +1,256 @@ + + + + + {c0e76076-0032-445d-8c07-32b6c762622b} + + + {a03c0d83-0032-4848-9704-22cdce5ab144} + + + {dbe8a34e-0032-495e-8df7-e82218921e60} + + + {96d1a5c9-0032-4230-a764-a0ed11f434a7} + + + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bgaes + + + bgaes + + + bgaes + + + bgaes + + + bgaes + + + bgaes + + + bgaes + + + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bnlib + + + bgaes + + + bgaes + + + bgaes + + + bgaes + + + bgaes + + + bgaes + + + + + + + \ No newline at end of file diff --git a/libs/libzrtp/third_party/bnlib/bnconfig.win b/libs/libzrtp/third_party/bnlib/bnconfig.win new file mode 100644 index 0000000000..303a25b689 --- /dev/null +++ b/libs/libzrtp/third_party/bnlib/bnconfig.win @@ -0,0 +1,76 @@ +/* + * Copyright (c) 1995 Colin Plumb. All rights reserved. + * For licensing and other legal details, see the file legal.c. + * + * bnconfig.h -- Configuration file for BigNum library. + * + * This file is automatically filled in by configure. + * Everything must start out turned *off*, because configure + * (or, more properly, config.status) only knows how to turn them + * *on*. + */ +#ifndef CONFIG_H +#define CONFIG_H + +/* Define to empty if the compiler does not support 'const' variables. */ +#undef const + +/* Define to `unsigned' if doesn't define it. */ +#undef size_t + +/* Checks for the presence and absence of various header files */ +#define HAVE_ASSERT_H 1 +#define NO_ASSERT_H !HAVE_ASSERT_H +#define HAVE_LIMITS_H 1 +#define NO_LIMITS_H !HAVE_LIMITS_H +#define HAVE_STDLIB_H 1 +#define NO_STDLIB_H !HAVE_STDLIB_H +#define HAVE_STRING_H 1 +#define NO_STRING_H !HAVE_STRING_H + +#define HAVE_STRINGS_H 0 +#define NEED_MEMORY_H 0 + +/* We go to some trouble to find accurate times... */ + +/* Define if you have Posix.4 glock_gettime() */ +#define HAVE_CLOCK_GETTIME 0 +/* Define if you have Solaris-style gethrvtime() */ +#define HAVE_GETHRVTIME 0 +/* Define if you have getrusage() */ +#define HAVE_GETRUSAGE 0 +/* Define if you have clock() */ +#define HAVE_CLOCK 0 +/* Define if you have time() */ +#define HAVE_TIME 0 + +/* + * Define as 0 if #including automatically + * #includes , and doing so explicitly causes an + * error. + */ +#define TIME_WITH_SYS_TIME 0 + +/* Defines for various kinds of library brokenness */ + +/* Define if is missing prototypes (= lots of warnings!) */ +#define NO_STDIO_PROTOS 0 + +/* Define if depends on and breaks without it */ +#define ASSERT_NEEDS_STDIO 0 +/* Define if depends on and complains without it */ +#define ASSERT_NEEDS_STDLIB 0 + +/* + * Define if delcares the mem* functions to take char * + * instead of void * parameters (= lots of warnings) + */ +#define MEM_PROTOS_BROKEN 0 + +/* If not available, bcopy() is substituted */ +#define HAVE_MEMMOVE 1 +#define NO_MEMMOVE !HAVE_MEMMOVE +#define HAVE_MEMCPY 1 +#define NO_MEMCPY !HAVE_MEMCPY + +#endif /* CONFIG_H */ diff --git a/libs/libzrtp/third_party/bnlib/lbn.h b/libs/libzrtp/third_party/bnlib/lbn.h index b0fd21cfb5..43fc7c91dc 100644 --- a/libs/libzrtp/third_party/bnlib/lbn.h +++ b/libs/libzrtp/third_party/bnlib/lbn.h @@ -145,6 +145,12 @@ typedef unsigned long long bnword64; #define BNWORD64 bnword64 #endif +/*Workaround for windows for now. */ +#ifdef WIN32 +typedef unsigned long long bnword64; +#define BNWORD64 bnword64 +#endif + /* We don't even try to find a 128-bit type at the moment */ #endif /* !LBN_H */ diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c4030148aa..481bd54e84 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -76,7 +76,7 @@ static zrtp_global_t *zrtp_global; #ifndef WIN32 static zrtp_zid_t zid = { "FreeSWITCH01" }; #else -static zrtp_zid_t zid = { "FreeSWITCH0\0" }; +static zrtp_zid_t zid = { "FreeSWITCH0" }; #endif static int zrtp_on = 0; #define ZRTP_MITM_TRIES 100 diff --git a/w32/Library/FreeSwitchCore.2010.vcxproj b/w32/Library/FreeSwitchCore.2010.vcxproj index 94b5dbc55a..eb1933a7f6 100644 --- a/w32/Library/FreeSwitchCore.2010.vcxproj +++ b/w32/Library/FreeSwitchCore.2010.vcxproj @@ -88,8 +88,8 @@ Disabled - ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;%(PreprocessorDefinitions) + ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;ENABLE_ZRTP;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -146,8 +146,8 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs Disabled - ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;%(PreprocessorDefinitions) + ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;ENABLE_ZRTP;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -198,8 +198,8 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs MaxSpeed - ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;%(PreprocessorDefinitions) + ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;ENABLE_ZRTP;%(PreprocessorDefinitions) MultiThreadedDLL Use switch.h @@ -247,8 +247,8 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs MaxSpeed - ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;%(PreprocessorDefinitions) + ..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;ENABLE_ZRTP;%(PreprocessorDefinitions) MultiThreadedDLL Use switch.h @@ -766,6 +766,9 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs {89385c74-5860-4174-9caf-a39e7c48909c} false + + {c13cc324-0032-4492-9a30-310a6bd64ff5} + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} From 021f48d02ec06d27d43d440fa3e9574aa06e3ff6 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 17 May 2012 10:28:51 -0500 Subject: [PATCH 0346/1057] FS-4169 --resolve compiler warning for solaris --- src/switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch.c b/src/switch.c index a3f8759d8c..189eea40cf 100644 --- a/src/switch.c +++ b/src/switch.c @@ -288,7 +288,7 @@ void daemonize(int do_wait) while(--sanity && !system_ready) { if (sanity % 2 == 0) { - printf("FreeSWITCH[%d] Waiting for background process pid:%d to be ready.....\n", getpid(), (int) pid); + printf("FreeSWITCH[%d] Waiting for background process pid:%d to be ready.....\n", (int)getpid(), (int) pid); } sleep(1); } From 92eb698ddc4c683a6e85cac4584f8aa7e576b9c0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 May 2012 11:27:57 -0500 Subject: [PATCH 0347/1057] FS-4231 --resolve declinatio mortuus obfirmo! --- src/mod/endpoints/mod_sofia/sofia_presence.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5965c54cd8..be360520ea 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3419,9 +3419,8 @@ void sofia_presence_handle_sip_i_subscribe(int status, "sub del sql: %s\n", sql); } - switch_mutex_lock(profile->ireg_mutex); switch_assert(sql != NULL); - sofia_glue_actually_execute_sql(profile, sql, NULL); + sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex); switch_safe_free(sql); sstr = switch_mprintf("terminated;reason=noresource"); @@ -3460,7 +3459,6 @@ void sofia_presence_handle_sip_i_subscribe(int status, sstr = switch_mprintf("active;expires=%ld", exp_delta); } - switch_mutex_unlock(profile->ireg_mutex); } if (status < 200) { From 83e090c30d8851ba0ee42540e9a943541d00070d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 17 May 2012 16:24:56 +0000 Subject: [PATCH 0348/1057] add some casts to make things work with both gcc and VS This amends commit 7bd9efc7f52a725b7ef9efb64b65873b4bc4330b. Using the more explicit typedef causes gcc to warn about the incompatible types for the reasons noted in the earlier commit message. This is why we just used the unsigned type earlier so we could avoid all this casting. The things we do to make Windows happy... --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 481bd54e84..be7f180fcd 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -864,9 +864,9 @@ SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool) zrtp_zstrcpyc((zrtp_stringn_t*)zrtp_config.def_cache_path.buffer, zrtp_cache_path); zrtp_config.def_cache_path.length = (uint16_t)strlen(zrtp_cache_path); zrtp_config.def_cache_path.max_length = 255; - zrtp_config.cb.event_cb.on_zrtp_protocol_event = zrtp_event_callback; + zrtp_config.cb.event_cb.on_zrtp_protocol_event = (void (*)(zrtp_stream_t*,zrtp_protocol_event_t))zrtp_event_callback; zrtp_config.cb.misc_cb.on_send_packet = zrtp_send_rtp_callback; - zrtp_config.cb.event_cb.on_zrtp_security_event = zrtp_event_callback; + zrtp_config.cb.event_cb.on_zrtp_security_event = (void (*)(zrtp_stream_t*,zrtp_security_event_t))zrtp_event_callback; zrtp_log_set_log_engine((zrtp_log_engine *) zrtp_logger); zrtp_log_set_level(4); From ad7149bfa6c924ad7c36dea5611a00b39f4416b3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 May 2012 18:57:22 -0500 Subject: [PATCH 0349/1057] allow mod loopback bowout to reach out across stacked loopback bridges and remove all of them --- src/mod/endpoints/mod_loopback/mod_loopback.c | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 9ad780f838..200d6e5b71 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -650,6 +650,39 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch return status; } +static switch_status_t find_non_loopback_bridge(switch_core_session_t *session, switch_core_session_t **br_session, const char **br_uuid) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *a_uuid; + switch_core_session_t *sp; + + *br_session = NULL; + *br_uuid = NULL; + + a_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + + while (a_uuid && (sp = switch_core_session_locate(a_uuid))) { + if (switch_core_session_check_interface(sp, loopback_endpoint_interface)) { + private_t *tech_pvt = switch_core_session_get_private(sp); + + a_uuid = switch_channel_get_variable(tech_pvt->other_channel, SWITCH_SIGNAL_BOND_VARIABLE); + switch_core_session_rwunlock(sp); + sp = NULL; + } else { + break; + } + } + + if (sp) { + *br_session = sp; + *br_uuid = a_uuid; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; + +} + 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; @@ -678,8 +711,8 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_channel_test_flag(tech_pvt->other_channel, CF_BRIDGED) && switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && switch_channel_test_flag(tech_pvt->other_channel, CF_ANSWERED) && --tech_pvt->bowout_frame_count <= 0) { - const char *a_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); - const char *b_uuid = switch_channel_get_variable(tech_pvt->other_channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *a_uuid = NULL; + const char *b_uuid = NULL; const char *vetoa, *vetob; @@ -690,16 +723,21 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_core_session_t *br_a, *br_b; switch_channel_t *ch_a = NULL, *ch_b = NULL; int good_to_go = 0; + + find_non_loopback_bridge(session, &br_a, &a_uuid); + find_non_loopback_bridge(tech_pvt->other_session, &br_b, &b_uuid); + - if ((br_a = switch_core_session_locate(a_uuid))) { + if (br_a) { ch_a = switch_core_session_get_channel(br_a); } - if ((br_b = switch_core_session_locate(b_uuid))) { + if (br_b) { ch_b = switch_core_session_get_channel(br_b); } if (ch_a && ch_b && switch_channel_test_flag(ch_a, CF_BRIDGED) && switch_channel_test_flag(ch_b, CF_BRIDGED)) { + switch_set_flag_locked(tech_pvt, TFLAG_BOWOUT); switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_BOWOUT); From b117a65c5035cf43e00d5e5add58162f85dfecef Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 May 2012 19:57:02 -0500 Subject: [PATCH 0350/1057] put a little contention in the reg in new thread feature to prevent endless pileup --- src/mod/endpoints/mod_sofia/sofia.c | 4 +++- src/switch_core.c | 2 +- src/switch_core_sqldb.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d7dac7581b..0e579ca1f8 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1306,6 +1306,7 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) switch_threadattr_t *thd_attr = NULL; switch_memory_pool_t *pool; switch_thread_t *thread; + sofia_profile_t *profile = (*dep)->profile; switch_core_new_memory_pool(&pool); @@ -1313,6 +1314,7 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) *dep = NULL; de->pool = pool; + switch_mutex_lock(profile->ireg_mutex); switch_threadattr_create(&thd_attr, de->pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_thread_create(&thread, @@ -1320,7 +1322,7 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) sofia_msg_thread_run_once, de, de->pool); - + switch_mutex_unlock(profile->ireg_mutex); } diff --git a/src/switch_core.c b/src/switch_core.c index 8139f8ccf8..f89aeb5ee2 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1420,7 +1420,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc gethostname(runtime.hostname, sizeof(runtime.hostname)); runtime.max_db_handles = 50; - runtime.db_handle_timeout = 5000000;; + runtime.db_handle_timeout = 5000000; runtime.runlevel++; runtime.sql_buffer_len = 1024 * 32; diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 5c59d96962..85d38160ed 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -218,7 +218,7 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t } -#define SQL_CACHE_TIMEOUT 120 +#define SQL_CACHE_TIMEOUT 30 #define SQL_REG_TIMEOUT 15 From bbdcd33bde0e9aef0325aa4d93a62c7caa79c36c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 May 2012 20:10:53 -0500 Subject: [PATCH 0351/1057] performance tweaks for sip message parsing and event system --- src/include/switch_core.h | 2 + src/mod/endpoints/mod_sofia/mod_sofia.c | 12 +- src/mod/endpoints/mod_sofia/mod_sofia.h | 4 +- src/mod/endpoints/mod_sofia/sofia.c | 92 ++++++++---- src/switch_channel.c | 2 +- src/switch_event.c | 190 ++++++++---------------- src/switch_time.c | 8 +- 7 files changed, 137 insertions(+), 173 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 8f9220d0b9..9803c6708b 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2329,6 +2329,8 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f SWITCH_DECLARE(int) switch_max_file_desc(void); SWITCH_DECLARE(void) switch_close_extra_files(int *keep, int keep_ttl); SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu); +SWITCH_DECLARE(void) switch_os_yield(void); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 164d0e76ff..6f64078509 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5445,7 +5445,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_yield(1500000); mod_sofia_globals.cpu_count = switch_core_cpu_count(); - mod_sofia_globals.max_msg_queues = mod_sofia_globals.cpu_count + 1; + mod_sofia_globals.max_msg_queues = (mod_sofia_globals.cpu_count / 2) + 1; + if (mod_sofia_globals.max_msg_queues < 2) { + mod_sofia_globals.max_msg_queues = 2; + } if (mod_sofia_globals.max_msg_queues > SOFIA_MAX_MSG_QUEUE) { mod_sofia_globals.max_msg_queues = SOFIA_MAX_MSG_QUEUE; @@ -5627,11 +5630,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown) } - for (i = 0; i < mod_sofia_globals.msg_queue_len; i++) { - switch_queue_push(mod_sofia_globals.msg_queue[i], NULL); + for (i = 0; mod_sofia_globals.msg_queue_thread[i]; i++) { + switch_queue_push(mod_sofia_globals.msg_queue, NULL); } - for (i = 0; i < mod_sofia_globals.msg_queue_len; i++) { + + for (i = 0; mod_sofia_globals.msg_queue_thread[i]; i++) { switch_status_t st; switch_thread_join(&st, mod_sofia_globals.msg_queue_thread[i]); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index b96ff52011..c0fc7dfba4 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -342,7 +342,7 @@ typedef enum { } TFLAGS; #define SOFIA_MAX_MSG_QUEUE 64 -#define SOFIA_MSG_QUEUE_SIZE 250 +#define SOFIA_MSG_QUEUE_SIZE 100 struct mod_sofia_globals { switch_memory_pool_t *pool; @@ -359,7 +359,7 @@ struct mod_sofia_globals { char hostname[512]; switch_queue_t *presence_queue; switch_queue_t *mwi_queue; - switch_queue_t *msg_queue[SOFIA_MAX_MSG_QUEUE]; + switch_queue_t *msg_queue; switch_thread_t *msg_queue_thread[SOFIA_MAX_MSG_QUEUE]; int msg_queue_len; struct sofia_private destroy_private; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0e579ca1f8..8eb122b310 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1347,34 +1347,56 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) nua_handle_unref(nh); nua_stack_unref(nua); + switch_os_yield(); } + +static int msg_queue_threads = 0; +//static int count = 0; + void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj) { void *pop; switch_queue_t *q = (switch_queue_t *) obj; int my_id; + for (my_id = 0; my_id < mod_sofia_globals.msg_queue_len; my_id++) { - if (mod_sofia_globals.msg_queue[my_id] == q) { + if (mod_sofia_globals.msg_queue_thread[my_id] == thread) { + break; + } + } + + switch_mutex_lock(mod_sofia_globals.mutex); + msg_queue_threads++; + switch_mutex_unlock(mod_sofia_globals.mutex); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread %d Started\n", my_id); + + + for(;;) { + + if (switch_queue_pop(q, &pop) != SWITCH_STATUS_SUCCESS) { + switch_cond_next(); + continue; + } + + if (pop) { + sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop; + sofia_process_dispatch_event(&de); + switch_os_yield(); + } else { break; } } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread %d Started\n", my_id); - - switch_core_thread_set_cpu_affinity(my_id); - - while(switch_queue_pop(q, &pop) == SWITCH_STATUS_SUCCESS && pop) { - sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) pop; - sofia_process_dispatch_event(&de); - switch_cond_next(); - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread Ended\n"); + switch_mutex_lock(mod_sofia_globals.mutex); + msg_queue_threads--; + switch_mutex_unlock(mod_sofia_globals.mutex); + return NULL; } @@ -1392,11 +1414,14 @@ void sofia_msg_thread_start(int idx) int i; mod_sofia_globals.msg_queue_len = idx + 1; - for (i = 0; i < mod_sofia_globals.msg_queue_len; i++) { - if (!mod_sofia_globals.msg_queue[i]) { - switch_threadattr_t *thd_attr = NULL; + if (!mod_sofia_globals.msg_queue) { + switch_queue_create(&mod_sofia_globals.msg_queue, SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.cpu_count, mod_sofia_globals.pool); + } - switch_queue_create(&mod_sofia_globals.msg_queue[i], SOFIA_MSG_QUEUE_SIZE, mod_sofia_globals.pool); + + for (i = 0; i < mod_sofia_globals.msg_queue_len; i++) { + if (!mod_sofia_globals.msg_queue_thread[i]) { + switch_threadattr_t *thd_attr = NULL; switch_threadattr_create(&thd_attr, mod_sofia_globals.pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); @@ -1404,7 +1429,7 @@ void sofia_msg_thread_start(int idx) switch_thread_create(&mod_sofia_globals.msg_queue_thread[i], thd_attr, sofia_msg_thread_run, - mod_sofia_globals.msg_queue[i], + mod_sofia_globals.msg_queue, mod_sofia_globals.pool); } } @@ -1413,12 +1438,12 @@ void sofia_msg_thread_start(int idx) switch_mutex_unlock(mod_sofia_globals.mutex); } - +//static int foo = 0; static void sofia_queue_message(sofia_dispatch_event_t *de) { - int idx = 0, queued = 0; + int launch = 0; - if (mod_sofia_globals.running == 0 || !mod_sofia_globals.msg_queue[0]) { + if (mod_sofia_globals.running == 0 || !mod_sofia_globals.msg_queue) { sofia_process_dispatch_event(&de); return; } @@ -1430,25 +1455,18 @@ static void sofia_queue_message(sofia_dispatch_event_t *de) } - again: - - for (idx = 0; idx < mod_sofia_globals.msg_queue_len; idx++) { - if (switch_queue_trypush(mod_sofia_globals.msg_queue[idx], de) == SWITCH_STATUS_SUCCESS) { - queued++; - break; - } + if ((switch_queue_size(mod_sofia_globals.msg_queue) > (SOFIA_MSG_QUEUE_SIZE * msg_queue_threads))) { + launch++; } - if (!queued) { + if (launch) { if (mod_sofia_globals.msg_queue_len < mod_sofia_globals.max_msg_queues) { sofia_msg_thread_start(mod_sofia_globals.msg_queue_len + 1); - goto again; } - - switch_queue_push(mod_sofia_globals.msg_queue[0], de); } - + + switch_queue_push(mod_sofia_globals.msg_queue, de); } @@ -1468,6 +1486,7 @@ void sofia_event_callback(nua_event_t event, return; } + switch_mutex_lock(profile->flag_mutex); profile->queued_events++; @@ -1483,6 +1502,13 @@ void sofia_event_callback(nua_event_t event, de->nua = nua_stack_ref(nua); if (event == nua_i_invite && !sofia_private) { + int critical = (((SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.max_msg_queues) * 900) / 1000); + + if (switch_queue_size(mod_sofia_globals.msg_queue) > critical) { + nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END()); + return; + } + if (!(sofia_private = su_alloc(nh->nh_home, sizeof(*sofia_private)))) { abort(); } @@ -1516,8 +1542,8 @@ void sofia_event_callback(nua_event_t event, } } - sofia_queue_message(de); + switch_os_yield(); } diff --git a/src/switch_channel.c b/src/switch_channel.c index f7d7e3aae4..7afe342103 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1415,7 +1415,7 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw (other_channel && switch_channel_down_nosig(other_channel)) || switch_channel_down(channel)) { break; } - switch_yield(20000); + switch_cond_next(); } } diff --git a/src/switch_event.c b/src/switch_event.c index 23670fac93..38ec16bf26 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -35,7 +35,7 @@ #include #include //#define SWITCH_EVENT_RECYCLE -#define DISPATCH_QUEUE_LEN 1000 +#define DISPATCH_QUEUE_LEN 100 //#define DEBUG_DISPATCH_QUEUES /*! \brief A node to store binded events */ @@ -74,23 +74,20 @@ static switch_mutex_t *BLOCK = NULL; static switch_mutex_t *POOL_LOCK = NULL; static switch_memory_pool_t *RUNTIME_POOL = NULL; static switch_memory_pool_t *THRUNTIME_POOL = NULL; -#define NUMBER_OF_QUEUES 3 -static switch_thread_t *EVENT_QUEUE_THREADS[NUMBER_OF_QUEUES] = { 0 }; -static switch_queue_t *EVENT_QUEUE[NUMBER_OF_QUEUES] = { 0 }; static switch_thread_t *EVENT_DISPATCH_QUEUE_THREADS[MAX_DISPATCH_VAL] = { 0 }; static uint8_t EVENT_DISPATCH_QUEUE_RUNNING[MAX_DISPATCH_VAL] = { 0 }; -static switch_queue_t *EVENT_DISPATCH_QUEUE[MAX_DISPATCH_VAL] = { 0 }; -static int POOL_COUNT_MAX = SWITCH_CORE_QUEUE_LEN; +static switch_queue_t *EVENT_DISPATCH_QUEUE = NULL; static switch_mutex_t *EVENT_QUEUE_MUTEX = NULL; static switch_hash_t *CUSTOM_HASH = NULL; static int THREAD_COUNT = 0; +static int DISPATCH_THREAD_COUNT = 0; static int SYSTEM_RUNNING = 0; static uint64_t EVENT_SEQUENCE_NR = 0; #ifdef SWITCH_EVENT_RECYCLE static switch_queue_t *EVENT_RECYCLE_QUEUE = NULL; static switch_queue_t *EVENT_HEADER_RECYCLE_QUEUE = NULL; #endif -static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t *pool); +static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool); static char *my_dup(const char *s) { @@ -244,9 +241,10 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th switch_mutex_lock(EVENT_QUEUE_MUTEX); THREAD_COUNT++; + DISPATCH_THREAD_COUNT++; - for (my_id = 0; my_id < NUMBER_OF_QUEUES; my_id++) { - if (EVENT_DISPATCH_QUEUE[my_id] == queue) { + for (my_id = 0; my_id < MAX_DISPATCH_VAL; my_id++) { + if (EVENT_DISPATCH_QUEUE_THREADS[my_id] == thread) { break; } } @@ -254,7 +252,6 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1; switch_mutex_unlock(EVENT_QUEUE_MUTEX); - switch_core_thread_set_cpu_affinity(my_id); for (;;) { void *pop = NULL; @@ -265,7 +262,7 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th } if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) { - break; + continue; } if (!pop) { @@ -280,6 +277,7 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th switch_mutex_lock(EVENT_QUEUE_MUTEX); EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 0; THREAD_COUNT--; + DISPATCH_THREAD_COUNT--; switch_mutex_unlock(EVENT_QUEUE_MUTEX); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Dispatch Thread %d Ended.\n", my_id); @@ -287,74 +285,41 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th } - -static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, void *obj) +static switch_status_t switch_event_queue_dispatch_event(switch_event_t **eventp) { - switch_queue_t *queue = (switch_queue_t *) obj; - uint32_t index = 0; - int my_id = 0; - switch_mutex_lock(EVENT_QUEUE_MUTEX); - THREAD_COUNT++; - switch_mutex_unlock(EVENT_QUEUE_MUTEX); + switch_event_t *event = *eventp; - for (my_id = 0; my_id < NUMBER_OF_QUEUES; my_id++) { - if (EVENT_QUEUE[my_id] == queue) { - break; - } + if (!SYSTEM_RUNNING) { + return SWITCH_STATUS_FALSE; } + + while (event) { + int launch = 0; - for (;;) { - void *pop = NULL; - switch_event_t *event = NULL; + switch_mutex_lock(EVENT_QUEUE_MUTEX); - if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) { - break; + if (switch_queue_size(EVENT_DISPATCH_QUEUE) > (DISPATCH_QUEUE_LEN * DISPATCH_THREAD_COUNT)) { + launch++; } - - if (!pop) { - break; - } - - if (!SYSTEM_RUNNING) { - break; - } - - event = (switch_event_t *) pop; - - while (event) { - - for (index = 0; index < SOFT_MAX_DISPATCH; index++) { - if (switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event) == SWITCH_STATUS_SUCCESS) { - event = NULL; - break; - } - } - - if (event) { - if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) { - switch_mutex_lock(EVENT_QUEUE_MUTEX); - launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); - switch_mutex_unlock(EVENT_QUEUE_MUTEX); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Event Thread %d is blocking\n", my_id); - switch_queue_push(EVENT_DISPATCH_QUEUE[0], event); - event = NULL; - } + + if (launch) { + if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) { + launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, RUNTIME_POOL); } } + + switch_mutex_unlock(EVENT_QUEUE_MUTEX); + + *eventp = NULL; + switch_queue_push(EVENT_DISPATCH_QUEUE, event); + event = NULL; + } - - switch_mutex_lock(EVENT_QUEUE_MUTEX); - THREAD_COUNT--; - switch_mutex_unlock(EVENT_QUEUE_MUTEX); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread %d Ended.\n", my_id); - return NULL; - + + return SWITCH_STATUS_SUCCESS; } - SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event) { switch_event_types_t e; @@ -499,20 +464,23 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) SYSTEM_RUNNING = 0; switch_mutex_unlock(EVENT_QUEUE_MUTEX); - for (x = 0; x < 3; x++) { - if (EVENT_QUEUE[x]) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping event queue %d\n", x); - switch_queue_trypush(EVENT_QUEUE[x], NULL); - switch_queue_interrupt_all(EVENT_QUEUE[x]); - } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch queues\n"); + + + for(x = 0; x < DISPATCH_THREAD_COUNT; x++) { + switch_queue_trypush(EVENT_DISPATCH_QUEUE, NULL); } - for (x = 0; x < SOFT_MAX_DISPATCH; x++) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch queue %d\n", x); - switch_queue_trypush(EVENT_DISPATCH_QUEUE[x], NULL); - switch_queue_interrupt_all(EVENT_DISPATCH_QUEUE[x]); + switch_queue_interrupt_all(EVENT_DISPATCH_QUEUE); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch threads\n"); + + for(x = 0; x < DISPATCH_THREAD_COUNT; x++) { + switch_status_t st; + switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]); } + x = 0; while (x < 10000 && THREAD_COUNT) { switch_cond_next(); if (THREAD_COUNT == last) { @@ -521,37 +489,16 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) last = THREAD_COUNT; } - for (x = 0; x < SOFT_MAX_DISPATCH; x++) { + { void *pop = NULL; switch_event_t *event = NULL; - switch_status_t st; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch thread %d\n", x); - switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]); - - while (switch_queue_trypop(EVENT_DISPATCH_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) { + while (switch_queue_trypop(EVENT_DISPATCH_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) { event = (switch_event_t *) pop; switch_event_destroy(&event); } } - for (x = 0; x < NUMBER_OF_QUEUES; x++) { - void *pop = NULL; - switch_event_t *event = NULL; - switch_status_t st; - - if (EVENT_QUEUE_THREADS[x]) { - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping queue thread %d\n", x); - switch_thread_join(&st, EVENT_QUEUE_THREADS[x]); - - while (switch_queue_trypop(EVENT_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) { - event = (switch_event_t *) pop; - switch_event_destroy(&event); - } - } - } - for (hi = switch_hash_first(NULL, CUSTOM_HASH); hi; hi = switch_hash_next(hi)) { switch_event_subclass_t *subclass; switch_hash_this(hi, &var, NULL, &val); @@ -568,7 +515,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) return SWITCH_STATUS_SUCCESS; } -static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t *pool) +static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool) { switch_threadattr_t *thd_attr; uint32_t index = 0; @@ -584,14 +531,14 @@ static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t } for (index = SOFT_MAX_DISPATCH; index < max && index < MAX_DISPATCH; index++) { - if (EVENT_DISPATCH_QUEUE[index]) { + if (EVENT_DISPATCH_QUEUE_THREADS[index]) { continue; } - switch_queue_create(&EVENT_DISPATCH_QUEUE[index], len, pool); + switch_threadattr_create(&thd_attr, pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_threadattr_priority_increase(thd_attr); - switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool); + switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE, pool); while(--sanity && !EVENT_DISPATCH_QUEUE_RUNNING[index]) switch_yield(10000); if (index == 1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index); @@ -616,8 +563,10 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) */ /* don't need any more dispatch threads than we have CPU's*/ - MAX_DISPATCH = switch_core_cpu_count() + 1; - + MAX_DISPATCH = (switch_core_cpu_count() / 2) + 1; + if (MAX_DISPATCH < 2) { + MAX_DISPATCH = 2; + } switch_assert(pool != NULL); THRUNTIME_POOL = RUNTIME_POOL = pool; @@ -648,7 +597,9 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) //switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); //switch_threadattr_priority_increase(thd_attr); - launch_dispatch_threads(1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); + switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, pool); + launch_dispatch_threads(1, RUNTIME_POOL); + //switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL); //switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL); //switch_thread_create(&EVENT_QUEUE_THREADS[2], thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL); @@ -1782,30 +1733,11 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, con (*event)->event_user_data = user_data; } - if (!EVENT_QUEUE_THREADS[(*event)->priority] && (*event)->priority < 3) { - switch_threadattr_t *thd_attr; - - switch_queue_create(&EVENT_QUEUE[(*event)->priority], POOL_COUNT_MAX + 10, THRUNTIME_POOL); - switch_threadattr_create(&thd_attr, THRUNTIME_POOL); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_threadattr_priority_increase(thd_attr); - switch_thread_create(&EVENT_QUEUE_THREADS[(*event)->priority], thd_attr, switch_event_thread, EVENT_QUEUE[(*event)->priority], RUNTIME_POOL); + if (switch_event_queue_dispatch_event(event) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(event); + return SWITCH_STATUS_FALSE; } - for (;;) { - if (switch_queue_trypush(EVENT_QUEUE[(*event)->priority], *event) == SWITCH_STATUS_SUCCESS) { - goto end; - } - - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event queue is full!\n"); - switch_yield(100000); - } - - end: - - *event = NULL; - return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_time.c b/src/switch_time.c index e7256538f3..381d2dc5ad 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -140,7 +140,7 @@ typedef struct timer_matrix timer_matrix_t; static timer_matrix_t TIMER_MATRIX[MAX_ELEMENTS + 1]; -static void os_yield(void) +SWITCH_DECLARE(void) switch_os_yield(void) { #if defined(WIN32) SwitchToThread(); @@ -467,7 +467,7 @@ SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t) SWITCH_DECLARE(void) switch_cond_next(void) { if (runtime.tipping_point && globals.timer_count >= runtime.tipping_point) { - os_yield(); + switch_os_yield(); return; } #ifdef DISABLE_1MS_COND @@ -633,7 +633,7 @@ static switch_status_t timer_next(switch_timer_t *timer) check_roll(); if (runtime.tipping_point && globals.timer_count >= runtime.tipping_point) { - os_yield(); + switch_os_yield(); globals.use_cond_yield = 0; } else { if (globals.use_cond_yield == 1) { @@ -884,7 +884,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) } if (runtime.tipping_point && globals.timer_count >= runtime.tipping_point) { - os_yield(); + switch_os_yield(); } else { if (tfd > -1 && globals.RUNNING == 1) { uint64_t exp; From 718a311a41d2c7e93259fd3014e36a7aa4c3da13 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 18 May 2012 07:52:58 -0500 Subject: [PATCH 0352/1057] FS-4224 --resolve add optional wait param to sofia profile stop [sofia profile foo stop wait] --- src/mod/endpoints/mod_sofia/mod_sofia.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 6f64078509..8d50a221e8 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3640,6 +3640,17 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t if (!strcasecmp(argv[1], "stop")) { sofia_clear_pflag_locked(profile, PFLAG_RUNNING); + if (argv[2] && !strcasecmp(argv[2], "wait")) { + int loops = 20 * 2; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for %s to finish SIP transactions.\n", profile->name); + while (!sofia_test_pflag(profile, PFLAG_SHUTDOWN)) { + switch_yield(500000); + if (!--loops) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timeout Waiting for %s to finish SIP transactions.\n", profile->name); + break; + } + } + } stream->write_function(stream, "stopping: %s", profile->name); } else { sofia_set_pflag_locked(profile, PFLAG_RESPAWN); @@ -4129,7 +4140,7 @@ SWITCH_STANDARD_API(sofia_function) "sofia global siptrace \n" "sofia capture \n" " watchdog \n\n" - "sofia profile [start | stop | restart | rescan]\n" + "sofia profile [start | stop | restart | rescan] [wait]\n" " flush_inbound_reg [ | <[user]@domain>] [reboot]\n" " check_sync [ | <[user]@domain>]\n" " [register | unregister] [ | all]\n" @@ -5555,9 +5566,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); - + switch_console_set_complete("add sofia profile ::sofia::list_profiles start"); - switch_console_set_complete("add sofia profile ::sofia::list_profiles stop"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles stop wait"); switch_console_set_complete("add sofia profile ::sofia::list_profiles rescan"); switch_console_set_complete("add sofia profile ::sofia::list_profiles restart"); From e32b90306edcc1bee2dc5ae3847e234d1206643e Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 18 May 2012 11:08:15 -0500 Subject: [PATCH 0353/1057] build warnings --- src/switch_event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_event.c b/src/switch_event.c index 38ec16bf26..9a0776efd1 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -299,7 +299,7 @@ static switch_status_t switch_event_queue_dispatch_event(switch_event_t **eventp switch_mutex_lock(EVENT_QUEUE_MUTEX); - if (switch_queue_size(EVENT_DISPATCH_QUEUE) > (DISPATCH_QUEUE_LEN * DISPATCH_THREAD_COUNT)) { + if (switch_queue_size(EVENT_DISPATCH_QUEUE) > (unsigned int)(DISPATCH_QUEUE_LEN * DISPATCH_THREAD_COUNT)) { launch++; } @@ -467,7 +467,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch queues\n"); - for(x = 0; x < DISPATCH_THREAD_COUNT; x++) { + for(x = 0; x < (uint32_t)DISPATCH_THREAD_COUNT; x++) { switch_queue_trypush(EVENT_DISPATCH_QUEUE, NULL); } @@ -475,7 +475,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch threads\n"); - for(x = 0; x < DISPATCH_THREAD_COUNT; x++) { + for(x = 0; x < (uint32_t)DISPATCH_THREAD_COUNT; x++) { switch_status_t st; switch_thread_join(&st, EVENT_DISPATCH_QUEUE_THREADS[x]); } From bcd7a1629063889ace9e6607edd92f717f265e3a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 18 May 2012 10:15:08 -0500 Subject: [PATCH 0354/1057] indent --- src/mod/endpoints/mod_sofia/sofia_presence.c | 131 ++++++++++--------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index be360520ea..fd3a106a58 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1257,88 +1257,89 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) switch_str_nil(status), switch_str_nil(rpid), host, dh.status,dh.rpid,dh.presence_id, mod_sofia_globals.hostname, profile->name, call_id); - } + } - helper.profile = profile; - helper.event = event; - SWITCH_STANDARD_STREAM(helper.stream); - switch_assert(helper.stream.data); + helper.profile = profile; + helper.event = event; + SWITCH_STANDARD_STREAM(helper.stream); + switch_assert(helper.stream.data); - if (mod_sofia_globals.debug_presence > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_SQL (%s)\n", - event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name); - } - - if (mod_sofia_globals.debug_presence) { - char *buf; - switch_event_serialize(event, &buf, SWITCH_FALSE); - switch_assert(buf); - if (mod_sofia_globals.debug_presence > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DUMP PRESENCE SQL:\n%s\nEVENT DUMP:\n%s\n", sql, buf); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "EVENT DUMP:\n%s\n", buf); + if (mod_sofia_globals.debug_presence > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_SQL (%s)\n", + event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name); } - free(buf); - } - sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_callback, &helper); - switch_safe_free(sql); + if (mod_sofia_globals.debug_presence) { + char *buf; + switch_event_serialize(event, &buf, SWITCH_FALSE); + switch_assert(buf); + if (mod_sofia_globals.debug_presence > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DUMP PRESENCE SQL:\n%s\nEVENT DUMP:\n%s\n", sql, buf); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "EVENT DUMP:\n%s\n", buf); + } + free(buf); + } + + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_callback, &helper); + switch_safe_free(sql); - if (mod_sofia_globals.debug_presence > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_SQL (%s)\n", - event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name); - } - - - if (hup && dh.hits < 1) { - /* so many phones get confused when whe hangup we have to reprobe to get them all to reset to absolute states so the lights stay correct */ - switch_event_t *s_event; - - if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", euser, host); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", euser, host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence"); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); - switch_event_fire(&s_event); + if (mod_sofia_globals.debug_presence > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_SQL (%s)\n", + event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name); + } + + + if (hup && dh.hits < 1) { + /* so many phones get confused when whe hangup we have to reprobe to get them all to reset to absolute states so the lights stay correct */ + switch_event_t *s_event; + + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", euser, host); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", euser, host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_fire(&s_event); + } } - } - if (!zstr((char *) helper.stream.data)) { - char *this_sql = (char *) helper.stream.data; - char *next = NULL; - char *last = NULL; + if (!zstr((char *) helper.stream.data)) { + char *this_sql = (char *) helper.stream.data; + char *next = NULL; + char *last = NULL; - do { - if ((next = strchr(this_sql, ';'))) { - *next++ = '\0'; - while (*next == '\n' || *next == ' ' || *next == '\r') { + do { + if ((next = strchr(this_sql, ';'))) { *next++ = '\0'; + while (*next == '\n' || *next == ' ' || *next == '\r') { + *next++ = '\0'; + } } - } - if (!zstr(this_sql) && (!last || strcmp(last, this_sql))) { - sofia_glue_execute_sql(profile, &this_sql, SWITCH_FALSE); - last = this_sql; - } - this_sql = next; - } while (this_sql); - } - switch_safe_free(helper.stream.data); - helper.stream.data = NULL; + if (!zstr(this_sql) && (!last || strcmp(last, this_sql))) { + sofia_glue_execute_sql(profile, &this_sql, SWITCH_FALSE); + last = this_sql; + } + this_sql = next; + } while (this_sql); + } + switch_safe_free(helper.stream.data); + helper.stream.data = NULL; - sofia_glue_release_profile(profile); + sofia_glue_release_profile(profile); + } } + switch_console_free_matches(&matches); } - switch_console_free_matches(&matches); -} -done: -switch_safe_free(sql); -switch_safe_free(user); + done: + + switch_safe_free(sql); + switch_safe_free(user); } static int EVENT_THREAD_RUNNING = 0; From b3b2c3752636f67fd5f2da53a199567a4da0b2e7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 18 May 2012 13:41:16 -0500 Subject: [PATCH 0355/1057] FS-3983 --resolve --- src/mod/endpoints/mod_sofia/sofia_presence.c | 39 +++++++++++--------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index fd3a106a58..800ba66cd2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -90,6 +90,9 @@ struct presence_helper { switch_event_t *event; switch_stream_handle_t stream; char last_uuid[512]; + int hup; + int calls_up; + }; switch_status_t sofia_presence_chat_send(switch_event_t *message_event) @@ -1170,11 +1173,6 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) #endif - if (hup && dh.hits > 0) { - goto done; - } - - if (zstr(call_id) && (dh.hits && presence_source && (!strcasecmp(presence_source, "register") || switch_stristr("register", status)))) { goto done; } @@ -1259,7 +1257,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } - + helper.hup = hup; + helper.calls_up = dh.hits; helper.profile = profile; helper.event = event; SWITCH_STANDARD_STREAM(helper.stream); @@ -2437,6 +2436,10 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * is_dialog = !strcmp(event, "dialog"); + if (helper->hup && helper->calls_up > 0 && (!is_dialog || !user_agent || !switch_stristr("polycom", user_agent) || !switch_stristr("snom", user_agent))) { + goto end; + } + if (helper->event) { switch_stream_handle_t stream = { 0 }; const char *direction = switch_str_nil(switch_event_get_header(helper->event, "presence-call-direction")); @@ -2456,6 +2459,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * int force_status = 0; const char *call_state = switch_event_get_header(helper->event, "channel-state"); char *call_info_state = switch_event_get_header(helper->event, "presence-call-info-state"); + int term = 0; if (user_agent && switch_stristr("snom", user_agent) && uuid) { default_dialog = "full" ; @@ -2463,18 +2467,21 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (call_state && !strcasecmp(call_state, "cs_hangup")) { astate = "hangup"; - } + holding = 0; + term = 1; + } else { - if (event_status && !strncasecmp(event_status, "hold", 4)) { - holding = 1; - } + if (event_status && !strncasecmp(event_status, "hold", 4)) { + holding = 1; + } - if (force_event_status && !event_status) { - event_status = force_event_status; - } + if (force_event_status && !event_status) { + event_status = force_event_status; + } - if (event_status && !strncasecmp(event_status, "hold", 4)) { - holding = 1; + if (event_status && !strncasecmp(event_status, "hold", 4)) { + holding = 1; + } } if (!strcasecmp(direction, "inbound")) { @@ -2701,8 +2708,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * open = "open"; if (switch_false(resub)) { - int term; - const char *direction = switch_event_get_header(helper->event, "Caller-Direction"); const char *op, *what = "Ring"; From e120f4b3594df680b63baabc9f70cefe47b20eb1 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Mon, 21 May 2012 09:58:02 -0500 Subject: [PATCH 0356/1057] --resolve FS-4234 --- build/freeswitch.init.suse | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build/freeswitch.init.suse b/build/freeswitch.init.suse index 2859ddc501..29f832d86a 100644 --- a/build/freeswitch.init.suse +++ b/build/freeswitch.init.suse @@ -46,12 +46,7 @@ # Voice Platform ### END INIT INFO # -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance FREESWITCH_BIN=/opt/freeswitch/bin/freeswitch -test -x $FREESWITCH_BIN || { echo "$FREESWITCH_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } # Check for existence of needed config file and read it FREESWITCH_CONFIG=/etc/sysconfig/freeswitch @@ -62,6 +57,12 @@ test -r $FREESWITCH_CONFIG || { echo "$FREESWITCH_CONFIG not existing"; # Read config . $FREESWITCH_CONFIG +# Check for missing binaries (stale symlinks should not happen) +# Note: Special treatment of stop for LSB conformance +test -x $FREESWITCH_BIN || { echo "$FREESWITCH_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + # Source LSB init functions # providing start_daemon, killproc, pidofproc, # log_success_msg, log_failure_msg and log_warning_msg. @@ -202,7 +203,7 @@ case "$1" in ## argument to this init script which is required for a reload. ## Note: probe is not (yet) part of LSB (as of 1.9) - test /opt/freeswitch/conf/freeswitch.xml -nt /opt/freeswitch/run/freeswitch.pid && echo reload + test ${FREESWITCH_HOME}/conf/freeswitch.xml -nt ${FREESWITCH_HOME}/run/freeswitch.pid && echo reload ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" From 34df90196c9746b345ab20725739630d1ddbd139 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 21 May 2012 15:47:30 -0400 Subject: [PATCH 0357/1057] bail out on make mod_modname when core build dies --- Makefile.am | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index c3f3a2fc28..db22184f5d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,11 +20,18 @@ DEFAULT_SOUNDS=en-us-callie-8000 sounds_version=`grep $$base_sound_dir $(switch_srcdir)/build/sounds_version.txt | cut -d ' ' -f2`;\ soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$moh_version.tar.gz`; \ echo $$full_sound_dir | grep music >/dev/null || soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \ - if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \ if test "$$target_prefix" = "sounds"; then \ - if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(soundsdir)/; else $(GETSOUNDS) $$soundfile ; fi; \ + if test "$$target" = "install"; then \ + $(GETSOUNDS) $$soundfile $(DESTDIR)$(soundsdir)/;\ + else \ + $(GETSOUNDS) $$soundfile ; \ + fi; \ else \ - cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\ + if test "$$target" = "install"; then \ + $(MAKE) $(AM_MAKEFLAGS) core_install && cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) core && cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\ + fi; \ fi sounds: sounds-en-us-callie-8000 From 792b004f36d209185ef726dd2882c18bf295f523 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 21 May 2012 13:55:50 -0500 Subject: [PATCH 0358/1057] add mwi-use-reg-callid --- src/mod/endpoints/mod_sofia/mod_sofia.h | 3 ++- src/mod/endpoints/mod_sofia/sofia.c | 14 +++++++++++++- src/mod/endpoints/mod_sofia/sofia_glue.c | 3 ++- src/mod/endpoints/mod_sofia/sofia_presence.c | 11 ++++++++--- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c0fc7dfba4..abbd1c226a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -267,6 +267,7 @@ typedef enum { PFLAG_PRESENCE_DISABLE_EARLY, PFLAG_CONFIRM_BLIND_TRANSFER, PFLAG_THREAD_PER_REG, + PFLAG_MWI_USE_REG_CALLID, /* No new flags below this line */ PFLAG_MAX } PFLAGS; @@ -1139,7 +1140,7 @@ void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port); sofia_destination_t *sofia_glue_get_destination(char *data); void sofia_glue_free_destination(sofia_destination_t *dst); switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, - const char *body, const char *o_contact, const char *network_ip); + const char *body, const char *o_contact, const char *network_ip, const char *call_id); char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix); void sofia_glue_set_extra_headers(switch_core_session_t *session, sip_t const *sip, const char *prefix); char *sofia_glue_get_extra_headers_from_event(switch_event_t *event, const char *prefix); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8eb122b310..549c8cd246 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1415,7 +1415,7 @@ void sofia_msg_thread_start(int idx) mod_sofia_globals.msg_queue_len = idx + 1; if (!mod_sofia_globals.msg_queue) { - switch_queue_create(&mod_sofia_globals.msg_queue, SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.cpu_count, mod_sofia_globals.pool); + switch_queue_create(&mod_sofia_globals.msg_queue, SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.max_msg_queues, mod_sofia_globals.pool); } @@ -3195,6 +3195,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER); } + } else if (!strcasecmp(var, "mwi-use-reg-callid")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_MWI_USE_REG_CALLID); + } else { + sofia_clear_pflag(profile, PFLAG_MWI_USE_REG_CALLID); + } } else if (!strcasecmp(var, "presence-proto-lookup")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_MAP); @@ -3994,6 +4000,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER); } + } else if (!strcasecmp(var, "mwi-use-reg-callid")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_MWI_USE_REG_CALLID); + } else { + sofia_clear_pflag(profile, PFLAG_MWI_USE_REG_CALLID); + } } else if (!strcasecmp(var, "presence-proto-lookup")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_MAP); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2039116b41..85799d6c8a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -6643,7 +6643,7 @@ void sofia_glue_free_destination(sofia_destination_t *dst) } switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, - const char *body, const char *o_contact, const char *network_ip) + const char *body, const char *o_contact, const char *network_ip, const char *call_id) { char *id = NULL; nua_handle_t *nh; @@ -6706,6 +6706,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), TAG_IF(event, SIPTAG_EVENT_STR(event)), + TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), TAG_IF(contenttype, SIPTAG_CONTENT_TYPE_STR(contenttype)), TAG_IF(body, SIPTAG_PAYLOAD_STR(body)), TAG_END()); switch_safe_free(contact); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 800ba66cd2..23ae017531 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -558,11 +558,11 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) } if (for_everyone) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q',call_id " "from sip_registrations where hostname='%q' and profile_name='%q' and mwi_user='%q' and mwi_host='%q'", stream.data, mod_sofia_globals.hostname, profile->name, user, host); } else if (call_id) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q',call_id " "from sip_registrations where hostname='%q' and profile_name='%q' and call_id='%q'", stream.data, mod_sofia_globals.hostname, profile->name, call_id); } @@ -2914,6 +2914,7 @@ static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char const char *body = argv[5]; const char *o_contact = argv[2]; const char *network_ip = argv[4]; + const char *call_id = argv[6]; char *profile_name = argv[3]; struct mwi_helper *h = (struct mwi_helper *) pArg; @@ -2925,7 +2926,11 @@ static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char } } - sofia_glue_send_notify(profile, user, host, event, contenttype, body, o_contact, network_ip); + if (!sofia_test_pflag(profile, PFLAG_MWI_USE_REG_CALLID)) { + call_id = NULL; + } + + sofia_glue_send_notify(profile, user, host, event, contenttype, body, o_contact, network_ip, call_id); if (ext_profile) { sofia_glue_release_profile(ext_profile); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index c5fb57bb4d..a7a384ebe2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -587,7 +587,7 @@ void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const cha event = "reboot"; } - sofia_glue_send_notify(profile, user, host, event, contenttype, body, contact, network_ip); + sofia_glue_send_notify(profile, user, host, event, contenttype, body, contact, network_ip, NULL); } int sofia_sla_dialog_del_callback(void *pArg, int argc, char **argv, char **columnNames) From 10617b6153619a008604c575076d3fb672d0b5c2 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 22 May 2012 00:23:47 -0400 Subject: [PATCH 0359/1057] .gitignore --- .gitignore | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.gitignore b/.gitignore index f31e630473..cbeaaa463e 100644 --- a/.gitignore +++ b/.gitignore @@ -201,3 +201,23 @@ src/mod/formats/mod_shout/*/*/mod_shout.log /src/mod/languages/mod_managed/x64/Release_CLR/FREESWITCH.MANAGED.DLL.metagen /src/mod/languages/mod_managed/x64/Release_CLR/RSAENH.DLL.bi /src/mod/languages/mod_managed/x64/Release_CLR/TZRES.DLL.bi +libs/apr-util/a.out.dSYM/Contents/Info.plist +libs/apr-util/a.out.dSYM/Contents/Resources/DWARF/a.out +libs/apr/a.out.dSYM/Contents/Info.plist +libs/apr/a.out.dSYM/Contents/Resources/DWARF/a.out +libs/iksemel/a.out.dSYM/Contents/Info.plist +libs/iksemel/a.out.dSYM/Contents/Resources/DWARF/a.out +libs/ilbc/a.out.dSYM/Contents/Info.plist +libs/ilbc/a.out.dSYM/Contents/Resources/DWARF/a.out +libs/libedit/a.out.dSYM/Contents/Info.plist +libs/libedit/a.out.dSYM/Contents/Resources/DWARF/a.out +libs/pcre/a.out.dSYM/Contents/Info.plist +libs/pcre/a.out.dSYM/Contents/Resources/DWARF/a.out +libs/sqlite/lemon.dSYM/Contents/Info.plist +libs/sqlite/lemon.dSYM/Contents/Resources/DWARF/lemon +libs/sqlite/mkkeywordhash.dSYM/Contents/Info.plist +libs/sqlite/mkkeywordhash.dSYM/Contents/Resources/DWARF/mkkeywordhash +libs/sqlite/sqlite3.dSYM/Contents/Info.plist +libs/sqlite/sqlite3.dSYM/Contents/Resources/DWARF/sqlite3 +libs/srtp/a.out.dSYM/Contents/Info.plist +libs/srtp/a.out.dSYM/Contents/Resources/DWARF/a.out From a672c99a57952559a02fe5ca245955d6069b269c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 22 May 2012 07:59:16 -0500 Subject: [PATCH 0360/1057] FS-4224 --resolve this was a regression from d6374535 to fix FS-3029, when you find a profile you must release it --- src/mod/endpoints/mod_sofia/sofia_glue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 85799d6c8a..0adcce9606 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5858,6 +5858,7 @@ int sofia_glue_recover(switch_bool_t flush) for (m = matches->head; m; m = m->next) { if ((profile = sofia_glue_find_profile(m->val))) { r += sofia_glue_profile_recover(profile, flush); + sofia_glue_release_profile(profile); } } switch_console_free_matches(&matches); From 059ef54feb61393479225c9ebfd09dd75f6dfde9 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 22 May 2012 10:21:14 -0500 Subject: [PATCH 0361/1057] FS-4243 zrtp addition to vs2010 express try this and verify edited by hand --- Freeswitch.2010.express.sln | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index b0df7d9c35..baea4a0c35 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -320,6 +320,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldn 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 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libs\libzrtp\projects\win\libzrtp.2010.vcxproj", "{C13CC324-0032-4492-9A30-310A6BD64FF5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1989,6 +1991,17 @@ Global {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 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|Win32.ActiveCfg = Release|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|x64.ActiveCfg = Release|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.All|x64.Build.0 = Release|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|Win32.ActiveCfg = Debug|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|Win32.Build.0 = Debug|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|x64.ActiveCfg = Debug|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Debug|x64.Build.0 = Debug|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|Win32.ActiveCfg = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|Win32.Build.0 = Release|Win32 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64.ActiveCfg = Release|x64 + {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2089,6 +2102,7 @@ Global {ABB71A76-42B0-47A4-973A-42E3D920C6FD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {9778F1C0-09BC-4698-8EBC-BD982247209A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {56B91D01-9150-4BBF-AFA1-5B68AB991B76} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {C13CC324-0032-4492-9A30-310A6BD64FF5} = {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} From fb790bc32067e3b83601c63f7987129c7112b4a7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 22 May 2012 10:27:18 -0500 Subject: [PATCH 0362/1057] block any inbound messages when queue is full; add debounce for mwi and pres on register; fix missing detach attr on new mode to process reg in new thread --- src/mod/endpoints/mod_sofia/mod_sofia.c | 18 ++++++------ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 38 +++++++++++++------------ src/mod/endpoints/mod_sofia/sofia_reg.c | 37 ++++++++++++++++++++---- 4 files changed, 63 insertions(+), 31 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8d50a221e8..ebd009a16d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5447,14 +5447,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_queue_create(&mod_sofia_globals.presence_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool); switch_queue_create(&mod_sofia_globals.mwi_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool); - if (config_sofia(0, NULL) != SWITCH_STATUS_SUCCESS) { - mod_sofia_globals.running = 0; - return SWITCH_STATUS_GENERR; - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for profiles to start\n"); - switch_yield(1500000); - mod_sofia_globals.cpu_count = switch_core_cpu_count(); mod_sofia_globals.max_msg_queues = (mod_sofia_globals.cpu_count / 2) + 1; if (mod_sofia_globals.max_msg_queues < 2) { @@ -5465,10 +5457,20 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) mod_sofia_globals.max_msg_queues = SOFIA_MAX_MSG_QUEUE; } + switch_queue_create(&mod_sofia_globals.msg_queue, SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.max_msg_queues, mod_sofia_globals.pool); + /* start one message thread */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Starting initial message thread.\n"); sofia_msg_thread_start(0); + if (config_sofia(0, NULL) != SWITCH_STATUS_SUCCESS) { + mod_sofia_globals.running = 0; + return SWITCH_STATUS_GENERR; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for profiles to start\n"); + switch_yield(1500000); + if (switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL, &mod_sofia_globals.custom_node) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index abbd1c226a..5902cdad93 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -613,6 +613,7 @@ struct sofia_profile { sofia_gateway_t *gateways; //su_home_t *home; switch_hash_t *chat_hash; + switch_hash_t *mwi_debounce_hash; //switch_core_db_t *master_db; switch_thread_rwlock_t *rwlock; switch_mutex_t *flag_mutex; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 549c8cd246..8a1409bb27 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1307,6 +1307,7 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) switch_memory_pool_t *pool; switch_thread_t *thread; sofia_profile_t *profile = (*dep)->profile; + switch_status_t status; switch_core_new_memory_pool(&pool); @@ -1316,14 +1317,19 @@ void sofia_process_dispatch_event_in_thread(sofia_dispatch_event_t **dep) switch_mutex_lock(profile->ireg_mutex); switch_threadattr_create(&thd_attr, de->pool); + switch_threadattr_detach_set(thd_attr, 1); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, - thd_attr, - sofia_msg_thread_run_once, - de, - de->pool); + status = switch_thread_create(&thread, + thd_attr, + sofia_msg_thread_run_once, + de, + de->pool); switch_mutex_unlock(profile->ireg_mutex); - + + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot create threads!\n"); + sofia_process_dispatch_event(&de); + } } void sofia_process_dispatch_event(sofia_dispatch_event_t **dep) @@ -1414,11 +1420,6 @@ void sofia_msg_thread_start(int idx) int i; mod_sofia_globals.msg_queue_len = idx + 1; - if (!mod_sofia_globals.msg_queue) { - switch_queue_create(&mod_sofia_globals.msg_queue, SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.max_msg_queues, mod_sofia_globals.pool); - } - - for (i = 0; i < mod_sofia_globals.msg_queue_len; i++) { if (!mod_sofia_globals.msg_queue_thread[i]) { switch_threadattr_t *thd_attr = NULL; @@ -1477,8 +1478,14 @@ void sofia_event_callback(nua_event_t event, tagi_t tags[]) { sofia_dispatch_event_t *de; + int critical = (((SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.max_msg_queues) * 900) / 1000); + if (switch_queue_size(mod_sofia_globals.msg_queue) > critical) { + nua_respond(nh, 503, "System Busy", SIPTAG_RETRY_AFTER_STR("300"), TAG_END()); + return; + } + if (sofia_test_pflag(profile, PFLAG_STANDBY)) { if (event < nua_r_set_params || event > nua_r_authenticate) { nua_respond(nh, 503, "System Paused", TAG_END()); @@ -1502,13 +1509,6 @@ void sofia_event_callback(nua_event_t event, de->nua = nua_stack_ref(nua); if (event == nua_i_invite && !sofia_private) { - int critical = (((SOFIA_MSG_QUEUE_SIZE * mod_sofia_globals.max_msg_queues) * 900) / 1000); - - if (switch_queue_size(mod_sofia_globals.msg_queue) > critical) { - nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END()); - return; - } - if (!(sofia_private = su_alloc(nh->nh_home, sizeof(*sofia_private)))) { abort(); } @@ -2307,6 +2307,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void sofia_glue_del_profile(profile); switch_core_hash_destroy(&profile->chat_hash); + switch_core_hash_destroy(&profile->mwi_debounce_hash); switch_thread_rwlock_unlock(profile->rwlock); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write unlock %s\n", profile->name); @@ -3910,6 +3911,7 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->dbname = switch_core_strdup(profile->pool, url); switch_core_hash_init(&profile->chat_hash, profile->pool); + switch_core_hash_init(&profile->mwi_debounce_hash, profile->pool); switch_thread_rwlock_create(&profile->rwlock, profile->pool); switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool); profile->dtmf_duration = 100; diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index a7a384ebe2..e358c8f228 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -993,6 +993,30 @@ uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const c return atoi(buf); } +static int debounce_check(sofia_profile_t *profile, const char *user, const char *host) +{ + char key[512] = ""; + int r = 0; + time_t *last, now = switch_epoch_time_now(NULL); + + snprintf(key, sizeof(key), "%s%s", user, host); + + if ((last = switch_core_hash_find(profile->mwi_debounce_hash, key))) { + if (now - *last > 30) { + *last = now; + r = 1; + } + } else { + last = switch_core_alloc(profile->pool, sizeof(*last)); + *last = now; + switch_core_hash_insert(profile->mwi_debounce_hash, key, last); + r = 1; + } + + return r; +} + + uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_dispatch_event_t *de, sofia_regtype_t regtype, char *key, uint32_t keylen, switch_event_t **v_event, const char *is_nat) @@ -1668,11 +1692,14 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (contact) { if (exptime) { + int debounce_ok = debounce_check(profile, mwi_user, mwi_host); + switch_snprintf(exp_param, sizeof(exp_param), "expires=%ld", exptime); sip_contact_add_param(nua_handle_home(nh), sip->sip_contact, exp_param); - - if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) || - (reg_count == 1 && sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER))) { + + if ((sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) || + (reg_count == 1 && sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER))) && debounce_ok) { + if (switch_event_create(&s_mwi_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(s_mwi_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", mwi_user, mwi_host); switch_event_add_header_string(s_mwi_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name); @@ -1680,9 +1707,9 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } } - if (sofia_test_pflag(profile, PFLAG_PRESENCE_ON_REGISTER) || + if ((sofia_test_pflag(profile, PFLAG_PRESENCE_ON_REGISTER) || (reg_count == 1 && sofia_test_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER)) - || send_pres == 1 || (reg_count == 1 && send_pres == 2)) { + || send_pres == 1 || (reg_count == 1 && send_pres == 2)) && debounce_ok) { if (sofia_test_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER)) { if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { From a5cd951c532639e371f0b5a3c9f08a8ca6d5a996 Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Tue, 22 May 2012 14:00:39 -0400 Subject: [PATCH 0363/1057] Update the outgoing channel handler so it passes the "var_event" event down towards rtmp_send_incoming_call since variables passed using originate are not yet in the session before the outgoing channel function returns. --- src/mod/endpoints/mod_rtmp/mod_rtmp.c | 2 +- src/mod/endpoints/mod_rtmp/mod_rtmp.h | 2 +- src/mod/endpoints/mod_rtmp/rtmp.c | 27 +++++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 5247074762..6b5bc862c9 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -625,7 +625,7 @@ switch_call_cause_t rtmp_outgoing_channel(switch_core_session_t *session, switch /*switch_channel_mark_pre_answered(channel);*/ switch_channel_ring_ready(channel); - rtmp_send_incoming_call(*newsession); + rtmp_send_incoming_call(*newsession, var_event); switch_channel_set_state(channel, CS_INIT); switch_set_flag_locked(tech_pvt, TFLAG_IO); diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.h b/src/mod/endpoints/mod_rtmp/mod_rtmp.h index 388afeacb5..6109c8544e 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.h +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.h @@ -616,7 +616,7 @@ switch_status_t rtmp_send_message(rtmp_session_t *rsession, uint8_t amfnumber, u void rtmp_send_event(rtmp_session_t *rsession, switch_event_t *event); void rtmp_notify_call_state(switch_core_session_t *session); void rtmp_send_display_update(switch_core_session_t *session); -void rtmp_send_incoming_call(switch_core_session_t *session); +void rtmp_send_incoming_call(switch_core_session_t *session, switch_event_t *var_event); void rtmp_send_onhangup(switch_core_session_t *session); void rtmp_add_registration(rtmp_session_t *rsession, const char *auth, const char *nickname); void rtmp_clear_registration(rtmp_session_t *rsession, const char *auth, const char *nickname); diff --git a/src/mod/endpoints/mod_rtmp/rtmp.c b/src/mod/endpoints/mod_rtmp/rtmp.c index f28f518383..a5224719e6 100644 --- a/src/mod/endpoints/mod_rtmp/rtmp.c +++ b/src/mod/endpoints/mod_rtmp/rtmp.c @@ -357,6 +357,25 @@ void rtmp_get_user_variables(switch_event_t **event, switch_core_session_t *sess } } + +void rtmp_get_user_variables_event(switch_event_t **event, switch_event_t *var_event) +{ + switch_event_header_t *he; + + if (!*event && switch_event_create(event, SWITCH_EVENT_CLONE) != SWITCH_STATUS_SUCCESS) { + return; + } + + if ((he = var_event->headers)) { + for (; he; he = he->next) { + if (!strncmp(he->name, RTMP_USER_VARIABLE_PREFIX, strlen(RTMP_USER_VARIABLE_PREFIX))) { + switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, he->name, he->value); + } + } + } +} + + void rtmp_session_send_onattach(rtmp_session_t *rsession) { const char *uuid = ""; @@ -386,7 +405,7 @@ void rtmp_send_display_update(switch_core_session_t *session) amf0_str(switch_str_nil(tech_pvt->display_callee_id_number)), NULL); } -void rtmp_send_incoming_call(switch_core_session_t *session) +void rtmp_send_incoming_call(switch_core_session_t *session, switch_event_t *var_event) { rtmp_private_t *tech_pvt = switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); @@ -394,7 +413,11 @@ void rtmp_send_incoming_call(switch_core_session_t *session) switch_event_t *event = NULL; amf0_data *obj = NULL; - rtmp_get_user_variables(&event, session); + if (var_event) { + rtmp_get_user_variables_event(&event, var_event); + } else { + rtmp_get_user_variables(&event, session); + } if (event) { amf_event_to_object(&obj, event); From bb3f72cb666803c99f38b5f0f176b4757b55cf41 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 May 2012 09:37:54 -0500 Subject: [PATCH 0364/1057] add perl wrapper to scgi --- libs/libscgi/FSSCGI.i | 6 + libs/libscgi/Makefile | 26 +- libs/libscgi/perl/FSSCGI.pm | 103 + libs/libscgi/perl/Makefile | 38 + libs/libscgi/perl/esl_wrap.cpp | 4149 +++++++++++++++++++++++++++ libs/libscgi/perl/perlxsi.c | 16 + libs/libscgi/perl/scgi_wrap.cpp | 2459 ++++++++++++++++ libs/libscgi/src/include/scgi.h | 4 +- libs/libscgi/src/include/scgi_oop.h | 72 + libs/libscgi/src/scgi.c | 74 +- libs/libscgi/src/scgi_oop.cpp | 101 + libs/libscgi/testserver.c | 7 +- 12 files changed, 7025 insertions(+), 30 deletions(-) create mode 100644 libs/libscgi/FSSCGI.i create mode 100644 libs/libscgi/perl/FSSCGI.pm create mode 100644 libs/libscgi/perl/Makefile create mode 100644 libs/libscgi/perl/esl_wrap.cpp create mode 100644 libs/libscgi/perl/perlxsi.c create mode 100644 libs/libscgi/perl/scgi_wrap.cpp create mode 100644 libs/libscgi/src/include/scgi_oop.h create mode 100644 libs/libscgi/src/scgi_oop.cpp diff --git a/libs/libscgi/FSSCGI.i b/libs/libscgi/FSSCGI.i new file mode 100644 index 0000000000..186cef6244 --- /dev/null +++ b/libs/libscgi/FSSCGI.i @@ -0,0 +1,6 @@ +%{ +#include "scgi.h" +#include "scgi_oop.h" +%} + +%include "scgi_oop.h" diff --git a/libs/libscgi/Makefile b/libs/libscgi/Makefile index 88b5b4e73c..265834ae69 100644 --- a/libs/libscgi/Makefile +++ b/libs/libscgi/Makefile @@ -8,11 +8,13 @@ CXXFLAGS=$(BASE_FLAGS) MYLIB=libscgi.a LIBS= LDFLAGS=-L. -OBJS=src/scgi.o -SRC=src/scgi.c -HEADERS=src/include/scgi.h +OBJS=src/scgi.o +SRC=src/scgi.c src/scgi_oop.cpp +HEADERS=src/include/scgi.h src/include/scgi_oop.h SOLINK=-shared -Xlinker -x +# comment the next line to disable c++ (no swig mods for you then) +OBJS += src/scgi_oop.o all: $(MYLIB) testclient testserver @@ -23,13 +25,27 @@ $(MYLIB): $(OBJS) $(HEADERS) $(SRC) %.o: %.c $(HEADERS) $(CC) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@ +%.o: %.cpp $(HEADERS) + $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) -c $< -o $@ + testclient: $(MYLIB) testclient.c $(CC) $(CC_CFLAGS) $(CFLAGS) testclient.c -o testclient -lscgi $(LDFLAGS) $(LIBS) testserver: $(MYLIB) testserver.c $(CC) $(CC_CFLAGS) $(CFLAGS) testserver.c -o testserver -lscgi $(LDFLAGS) $(LIBS) - - clean: rm -f *.o src/*.o libscgi.a *~ src/*~ src/include/*~ testclient testserver + $(MAKE) -C perl clean + +reswig: swigclean + $(MAKE) -C perl reswig + +swigclean: clean + $(MAKE) -C perl swigclean + +perlmod: $(MYLIB) + $(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C perl + +perlmod-install: perlmod + $(MAKE) -C perl install diff --git a/libs/libscgi/perl/FSSCGI.pm b/libs/libscgi/perl/FSSCGI.pm new file mode 100644 index 0000000000..7dfd256e05 --- /dev/null +++ b/libs/libscgi/perl/FSSCGI.pm @@ -0,0 +1,103 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 1.3.35 +# +# Don't modify this file, modify the SWIG interface instead. + +package FSSCGI; +require Exporter; +require DynaLoader; +@ISA = qw(Exporter DynaLoader); +package FSSCGIc; +bootstrap FSSCGI; +package FSSCGI; +@EXPORT = qw( ); + +# ---------- BASE METHODS ------------- + +package FSSCGI; + +sub TIEHASH { + my ($classname,$obj) = @_; + return bless $obj, $classname; +} + +sub CLEAR { } + +sub FIRSTKEY { } + +sub NEXTKEY { } + +sub FETCH { + my ($self,$field) = @_; + my $member_func = "swig_${field}_get"; + $self->$member_func(); +} + +sub STORE { + my ($self,$field,$newval) = @_; + my $member_func = "swig_${field}_set"; + $self->$member_func($newval); +} + +sub this { + my $ptr = shift; + return tied(%$ptr); +} + + +# ------- FUNCTION WRAPPERS -------- + +package FSSCGI; + + +############# Class : FSSCGI::SCGIhandle ############## + +package FSSCGI::SCGIhandle; +use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); +@ISA = qw( FSSCGI ); +%OWNER = (); +%ITERATORS = (); +sub new { + my $pkg = shift; + my $self = FSSCGIc::new_SCGIhandle(@_); + bless $self, $pkg if defined($self); +} + +sub DESTROY { + return unless $_[0]->isa('HASH'); + my $self = tied(%{$_[0]}); + return unless defined $self; + delete $ITERATORS{$self}; + if (exists $OWNER{$self}) { + FSSCGIc::delete_SCGIhandle($self); + delete $OWNER{$self}; + } +} + +*connected = *FSSCGIc::SCGIhandle_connected; +*socketDescriptor = *FSSCGIc::SCGIhandle_socketDescriptor; +*disconnect = *FSSCGIc::SCGIhandle_disconnect; +*addParam = *FSSCGIc::SCGIhandle_addParam; +*addBody = *FSSCGIc::SCGIhandle_addBody; +*sendRequest = *FSSCGIc::SCGIhandle_sendRequest; +*recv = *FSSCGIc::SCGIhandle_recv; +*bind = *FSSCGIc::SCGIhandle_bind; +*accept = *FSSCGIc::SCGIhandle_accept; +sub DISOWN { + my $self = shift; + my $ptr = tied(%$self); + delete $OWNER{$ptr}; +} + +sub ACQUIRE { + my $self = shift; + my $ptr = tied(%$self); + $OWNER{$ptr} = 1; +} + + +# ------- VARIABLE STUBS -------- + +package FSSCGI; + +1; diff --git a/libs/libscgi/perl/Makefile b/libs/libscgi/perl/Makefile new file mode 100644 index 0000000000..3bce02368d --- /dev/null +++ b/libs/libscgi/perl/Makefile @@ -0,0 +1,38 @@ +PERL=$(shell which perl) +PERL_SITEDIR=$(shell perl -MConfig -e 'print $$Config{sitelibexp}') +PERL_LIBDIR=-L$(shell perl -MConfig -e 'print $$Config{archlib}')/CORE +PERL_LIBS=$(shell perl -MConfig -e 'print $$Config{libs}') +LOCAL_CFLAGS=-w -DMULTIPLICITY $(shell $(PERL) -MExtUtils::Embed -e ccopts) -DEMBED_PERL +LOCAL_LDFLAGS=$(shell $(PERL) -MExtUtils::Embed -e ldopts) $(shell $(PERL) -MConfig -e 'print $$Config{libs}') +GCC_WARNING_JUNK=-w +PERL_INC=$(shell $(PERL) -MExtUtils::Embed -e perl_inc) +all: FSSCGI.so + +scgi_wrap.cpp: + swig -module FSSCGI -shadow -perl5 -c++ -DMULTIPLICITY -I../src/include -o scgi_wrap.cpp ../FSSCGI.i + +perlxsi.c: + $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c + +perlxsi.o: perlxsi.c + $(CC) $(CC_CFLAGS) $(CFLAGS) $(LOCAL_CFLAGS) -c perlxsi.c -o perlxsi.o + +scgi_wrap.o: scgi_wrap.cpp + $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(GCC_WARNING_JUNK) $(PERL_INC) -c scgi_wrap.cpp -o scgi_wrap.o + +FSSCGI.so: scgi_wrap.o perlxsi.o + $(CXX) $(SOLINK) scgi_wrap.o perlxsi.o $(MYLIB) $(LOCAL_LDFLAGS) -o FSSCGI.so -L. $(LIBS) + +clean: + rm -f *.o *.so *~ + +swigclean: + rm -f scgi_wrap.* FSSCGI.so FSSCGI.pm perlxsi.* + +reswig: swigclean scgi_wrap.cpp perlxsi.c + +install: FSSCGI.so + install -m 755 FSSCGI.so $(PERL_SITEDIR) + install -m 755 FSSCGI.pm $(PERL_SITEDIR) + install -d -m 755 FSSCGI $(PERL_SITEDIR)/FSSCGI + install -m 755 FSSCGI/* $(PERL_SITEDIR)/FSSCGI diff --git a/libs/libscgi/perl/esl_wrap.cpp b/libs/libscgi/perl/esl_wrap.cpp new file mode 100644 index 0000000000..832289f156 --- /dev/null +++ b/libs/libscgi/perl/esl_wrap.cpp @@ -0,0 +1,4149 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGPERL +#define SWIG_CASTRANK_MODE + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic CAPI SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the swig runtime code. + In 99.9% of the cases, swig just needs to declare them as 'static'. + + But only do this if is strictly necessary, ie, if you have problems + with your compiler or so. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The swig conversion methods, as ConvertPtr, return and integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old swig versions, you usually write code as: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit as: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + that seems to be the same, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + requires also to SWIG_ConvertPtr to return new result values, as + + int SWIG_ConvertPtr(obj, ptr,...) { + if () { + if () { + *ptr = ; + return SWIG_NEWOBJ; + } else { + *ptr = ; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + swig errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() + + + */ +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class" == "Class", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like ||... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like ||... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCompare(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + + +/* think of this as a c++ template<> or a scheme macro */ +#define SWIG_TypeCheck_Template(comparison, ty) \ + if (ty) { \ + swig_cast_info *iter = ty->cast; \ + while (iter) { \ + if (comparison) { \ + if (iter == ty->cast) return iter; \ + /* Move iter to the top of the linked list */ \ + iter->prev->next = iter->next; \ + if (iter->next) \ + iter->next->prev = iter->prev; \ + iter->next = ty->cast; \ + iter->prev = 0; \ + if (ty->cast) ty->cast->prev = iter; \ + ty->cast = iter; \ + return iter; \ + } \ + iter = iter->next; \ + } \ + } \ + return 0 + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); +} + +/* Same as previous function, except strcmp is replaced with a pointer comparison */ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { + SWIG_TypeCheck_Template(iter->type == from, into); +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + register size_t l = 0; + register size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + register size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + register int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + register size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + register const unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + register unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register char d = *(c++); + register unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = ((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = ((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +#ifdef __cplusplus +/* Needed on some windows machines---since MS plays funny games with the header files under C++ */ +#include +#include +extern "C" { +#endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */ + +/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */ +#ifndef PERL_REVISION +# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) +# define PERL_PATCHLEVEL_H_IMPLICIT +# include +# endif +# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) +# include +# endif +# ifndef PERL_REVISION +# define PERL_REVISION (5) +# define PERL_VERSION PATCHLEVEL +# define PERL_SUBVERSION SUBVERSION +# endif +#endif + +#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) +#define PerlIO_exportFILE(fh,fl) (FILE*)(fh) +#endif + +#ifndef SvIOK_UV +# define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv))) +#endif + +#ifndef SvUOK +# define SvUOK(sv) SvIOK_UV(sv) +#endif + +#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))) +# define PL_sv_undef sv_undef +# define PL_na na +# define PL_errgv errgv +# define PL_sv_no sv_no +# define PL_sv_yes sv_yes +# define PL_markstack_ptr markstack_ptr +#endif + +#ifndef IVSIZE +# ifdef LONGSIZE +# define IVSIZE LONGSIZE +# else +# define IVSIZE 4 /* A bold guess, but the best we can make. */ +# endif +#endif + +#ifndef INT2PTR +# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) +# define PTRV UV +# define INT2PTR(any,d) (any)(d) +# else +# if PTRSIZE == LONGSIZE +# define PTRV unsigned long +# else +# define PTRV unsigned +# endif +# define INT2PTR(any,d) (any)(PTRV)(d) +# endif + +# define NUM2PTR(any,d) (any)(PTRV)(d) +# define PTR2IV(p) INT2PTR(IV,p) +# define PTR2UV(p) INT2PTR(UV,p) +# define PTR2NV(p) NUM2PTR(NV,p) + +# if PTRSIZE == LONGSIZE +# define PTR2ul(p) (unsigned long)(p) +# else +# define PTR2ul(p) INT2PTR(unsigned long,p) +# endif +#endif /* !INT2PTR */ + +#ifndef SvPV_nolen +# define SvPV_nolen(x) SvPV(x,PL_na) +#endif + +#ifndef get_sv +# define get_sv perl_get_sv +#endif + +#ifndef ERRSV +# define ERRSV get_sv("@",FALSE) +#endif + +#ifndef pTHX_ +#define pTHX_ +#endif + +#include +#ifdef __cplusplus +} +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGINTERN const char* +SWIG_Perl_ErrorType(int code) { + const char* type = 0; + switch(code) { + case SWIG_MemoryError: + type = "MemoryError"; + break; + case SWIG_IOError: + type = "IOError"; + break; + case SWIG_RuntimeError: + type = "RuntimeError"; + break; + case SWIG_IndexError: + type = "IndexError"; + break; + case SWIG_TypeError: + type = "TypeError"; + break; + case SWIG_DivisionByZero: + type = "ZeroDivisionError"; + break; + case SWIG_OverflowError: + type = "OverflowError"; + break; + case SWIG_SyntaxError: + type = "SyntaxError"; + break; + case SWIG_ValueError: + type = "ValueError"; + break; + case SWIG_SystemError: + type = "SystemError"; + break; + case SWIG_AttributeError: + type = "AttributeError"; + break; + default: + type = "RuntimeError"; + } + return type; +} + + + + +/* ----------------------------------------------------------------------------- + * perlrun.swg + * + * This file contains the runtime support for Perl modules + * and includes code for managing global variables and pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +#ifdef PERL_OBJECT +#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl), +#define SWIG_PERL_OBJECT_CALL pPerl, +#else +#define SWIG_PERL_OBJECT_DECL +#define SWIG_PERL_OBJECT_CALL +#endif + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags) +#define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags) + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, p, s, type) SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type) +#define SWIG_NewPackedObj(p, s, type) SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Perl_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) + + +/* Error manipulation */ + +#define SWIG_ErrorType(code) SWIG_Perl_ErrorType(code) +#define SWIG_Error(code, msg) sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + +/* Perl-specific SWIG API */ + +#define SWIG_MakePtr(sv, ptr, type, flags) SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags) +#define SWIG_MakePackedObj(sv, p, s, type) SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type) +#define SWIG_SetError(str) SWIG_Error(SWIG_RuntimeError, str) + + +#define SWIG_PERL_DECL_ARGS_1(arg1) (SWIG_PERL_OBJECT_DECL arg1) +#define SWIG_PERL_CALL_ARGS_1(arg1) (SWIG_PERL_OBJECT_CALL arg1) +#define SWIG_PERL_DECL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_DECL arg1, arg2) +#define SWIG_PERL_CALL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_CALL arg1, arg2) + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +/* For backward compatibility only */ +#define SWIG_POINTER_EXCEPTION 0 + +#ifdef __cplusplus +extern "C" { +#endif + +#define SWIG_OWNER SWIG_POINTER_OWN +#define SWIG_SHADOW SWIG_OWNER << 1 + +#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL + +/* SWIG Perl macros */ + +/* Macro to declare an XS function */ +#ifndef XSPROTO +# define XSPROTO(name) void name(pTHX_ CV* cv) +#endif + +/* Macro to call an XS function */ +#ifdef PERL_OBJECT +# define SWIG_CALLXS(_name) _name(cv,pPerl) +#else +# ifndef MULTIPLICITY +# define SWIG_CALLXS(_name) _name(cv) +# else +# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) +# endif +#endif + +#ifdef PERL_OBJECT +#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; + +#ifdef __cplusplus +extern "C" { +#endif +typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); +#ifdef __cplusplus +} +#endif + +#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) +#define SWIGCLASS_STATIC + +#else /* PERL_OBJECT */ + +#define MAGIC_PPERL +#define SWIGCLASS_STATIC static SWIGUNUSED + +#ifndef MULTIPLICITY +#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) + +#ifdef __cplusplus +extern "C" { +#endif +typedef int (*SwigMagicFunc)(SV *, MAGIC *); +#ifdef __cplusplus +} +#endif + +#else /* MULTIPLICITY */ + +#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) + +#ifdef __cplusplus +extern "C" { +#endif +typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); +#ifdef __cplusplus +} +#endif + +#endif /* MULTIPLICITY */ +#endif /* PERL_OBJECT */ + +/* Workaround for bug in perl 5.6.x croak and earlier */ +#if (PERL_VERSION < 8) +# ifdef PERL_OBJECT +# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl) +static void SWIG_Perl_croak_null(CPerlObj *pPerl) +# else +static void SWIG_croak_null() +# endif +{ + SV *err=ERRSV; +# if (PERL_VERSION < 6) + croak("%_", err); +# else + if (SvOK(err) && !SvROK(err)) croak("%_", err); + croak(Nullch); +# endif +} +#else +# define SWIG_croak_null() croak(Nullch) +#endif + + +/* + Define how strict is the cast between strings and integers/doubles + when overloading between these types occurs. + + The default is making it as strict as possible by using SWIG_AddCast + when needed. + + You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to + disable the SWIG_AddCast, making the casting between string and + numbers less strict. + + In the end, we try to solve the overloading between strings and + numerical types in the more natural way, but if you can avoid it, + well, avoid it using %rename, for example. +*/ +#ifndef SWIG_PERL_NO_STRICT_STR2NUM +# ifndef SWIG_PERL_STRICT_STR2NUM +# define SWIG_PERL_STRICT_STR2NUM +# endif +#endif +#ifdef SWIG_PERL_STRICT_STR2NUM +/* string takes precedence */ +#define SWIG_Str2NumCast(x) SWIG_AddCast(x) +#else +/* number takes precedence */ +#define SWIG_Str2NumCast(x) x +#endif + + + +#include + +SWIGRUNTIME const char * +SWIG_Perl_TypeProxyName(const swig_type_info *type) { + if (!type) return NULL; + if (type->clientdata != NULL) { + return (const char*) type->clientdata; + } + else { + return type->name; + } +} + +SWIGRUNTIME swig_cast_info * +SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) { + SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) + || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty); +} + + +/* Function for getting a pointer value */ + +SWIGRUNTIME int +SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { + swig_cast_info *tc; + void *voidptr = (void *)0; + SV *tsv = 0; + /* If magical, apply more magic */ + if (SvGMAGICAL(sv)) + mg_get(sv); + + /* Check to see if this is an object */ + if (sv_isobject(sv)) { + IV tmp = 0; + tsv = (SV*) SvRV(sv); + if ((SvTYPE(tsv) == SVt_PVHV)) { + MAGIC *mg; + if (SvMAGICAL(tsv)) { + mg = mg_find(tsv,'P'); + if (mg) { + sv = mg->mg_obj; + if (sv_isobject(sv)) { + tsv = (SV*)SvRV(sv); + tmp = SvIV(tsv); + } + } + } else { + return SWIG_ERROR; + } + } else { + tmp = SvIV(tsv); + } + voidptr = INT2PTR(void *,tmp); + } else if (! SvOK(sv)) { /* Check for undef */ + *(ptr) = (void *) 0; + return SWIG_OK; + } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ + if (!SvROK(sv)) { + *(ptr) = (void *) 0; + return SWIG_OK; + } else { + return SWIG_ERROR; + } + } else { /* Don't know what it is */ + return SWIG_ERROR; + } + if (_t) { + /* Now see if the types match */ + char *_c = HvNAME(SvSTASH(SvRV(sv))); + tc = SWIG_TypeProxyCheck(_c,_t); + if (!tc) { + return SWIG_ERROR; + } + { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,voidptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } + } else { + *ptr = voidptr; + } + + /* + * DISOWN implementation: we need a perl guru to check this one. + */ + if (tsv && (flags & SWIG_POINTER_DISOWN)) { + /* + * almost copy paste code from below SWIG_POINTER_OWN setting + */ + SV *obj = sv; + HV *stash = SvSTASH(SvRV(obj)); + GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE); + if (isGV(gv)) { + HV *hv = GvHVn(gv); + /* + * To set ownership (see below), a newSViv(1) entry is added. + * Hence, to remove ownership, we delete the entry. + */ + if (hv_exists_ent(hv, obj, 0)) { + hv_delete_ent(hv, obj, 0, 0); + } + } + } + return SWIG_OK; +} + +SWIGRUNTIME void +SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { + if (ptr && (flags & SWIG_SHADOW)) { + SV *self; + SV *obj=newSV(0); + HV *hash=newHV(); + HV *stash; + sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr); + stash=SvSTASH(SvRV(obj)); + if (flags & SWIG_POINTER_OWN) { + HV *hv; + GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); + if (!isGV(gv)) + gv_init(gv, stash, "OWNER", 5, FALSE); + hv=GvHVn(gv); + hv_store_ent(hv, obj, newSViv(1), 0); + } + sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); + SvREFCNT_dec(obj); + self=newRV_noinc((SV *)hash); + sv_setsv(sv, self); + SvREFCNT_dec((SV *)self); + sv_bless(sv, stash); + } + else { + sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr); + } +} + +SWIGRUNTIMEINLINE SV * +SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { + SV *result = sv_newmortal(); + SWIG_MakePtr(result, ptr, t, flags); + return result; +} + +SWIGRUNTIME void +SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { + char result[1024]; + char *r = result; + if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + strcpy(r,SWIG_Perl_TypeProxyName(type)); + sv_setpv(sv, result); +} + +SWIGRUNTIME SV * +SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) { + SV *result = sv_newmortal(); + SWIG_Perl_MakePackedObj(result, ptr, sz, type); + return result; +} + +/* Convert a packed value value */ +SWIGRUNTIME int +SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) { + swig_cast_info *tc; + const char *c = 0; + + if ((!obj) || (!SvOK(obj))) return SWIG_ERROR; + c = SvPV_nolen(obj); + /* Pointer values must start with leading underscore */ + if (*c != '_') return SWIG_ERROR; + c++; + c = SWIG_UnpackData(c,ptr,sz); + if (ty) { + tc = SWIG_TypeCheck(c,ty); + if (!tc) return SWIG_ERROR; + } + return SWIG_OK; +} + + +/* Macros for low-level exception handling */ +#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; } + + +typedef XSPROTO(SwigPerlWrapper); +typedef SwigPerlWrapper *SwigPerlWrapperPtr; + +/* Structure for command table */ +typedef struct { + const char *name; + SwigPerlWrapperPtr wrapper; +} swig_command_info; + +/* Information for constant table */ + +#define SWIG_INT 1 +#define SWIG_FLOAT 2 +#define SWIG_STRING 3 +#define SWIG_POINTER 4 +#define SWIG_BINARY 5 + +/* Constant information structure */ +typedef struct swig_constant_info { + int type; + const char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_constant_info; + + +/* Structure for variable table */ +typedef struct { + const char *name; + SwigMagicFunc set; + SwigMagicFunc get; + swig_type_info **type; +} swig_variable_info; + +/* Magic variable code */ +#ifndef PERL_OBJECT +#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) + #ifndef MULTIPLICITY + SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) + #else + SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) + #endif +#else +# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) +SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) +#endif +{ + MAGIC *mg; + sv_magic(sv,sv,'U',(char *) name,strlen(name)); + mg = mg_find(sv,'U'); + mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); + mg->mg_virtual->svt_get = (SwigMagicFunc) get; + mg->mg_virtual->svt_set = (SwigMagicFunc) set; + mg->mg_virtual->svt_len = 0; + mg->mg_virtual->svt_clear = 0; + mg->mg_virtual->svt_free = 0; +} + + +SWIGRUNTIME swig_module_info * +SWIG_Perl_GetModule(void) { + static void *type_pointer = (void *)0; + SV *pointer; + + /* first check if pointer already created */ + if (!type_pointer) { + pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI); + if (pointer && SvOK(pointer)) { + type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); + } + } + + return (swig_module_info *) type_pointer; +} + +SWIGRUNTIME void +SWIG_Perl_SetModule(swig_module_info *module) { + SV *pointer; + + /* create a new pointer */ + pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI); + sv_setiv(pointer, PTR2IV(module)); +} + +#ifdef __cplusplus +} +#endif + +/* Workaround perl5 global namespace pollution. Note that undefining library + * functions like fopen will not solve the problem on all platforms as fopen + * might be a macro on Windows but not necessarily on other operating systems. */ +#ifdef do_open + #undef do_open +#endif +#ifdef do_close + #undef do_close +#endif +#ifdef scalar + #undef scalar +#endif +#ifdef list + #undef list +#endif +#ifdef apply + #undef apply +#endif +#ifdef convert + #undef convert +#endif +#ifdef Error + #undef Error +#endif +#ifdef form + #undef form +#endif +#ifdef vform + #undef vform +#endif +#ifdef LABEL + #undef LABEL +#endif +#ifdef METHOD + #undef METHOD +#endif +#ifdef Move + #undef Move +#endif +#ifdef yylex + #undef yylex +#endif +#ifdef yyparse + #undef yyparse +#endif +#ifdef yyerror + #undef yyerror +#endif +#ifdef invert + #undef invert +#endif +#ifdef ref + #undef ref +#endif +#ifdef read + #undef read +#endif +#ifdef write + #undef write +#endif +#ifdef eof + #undef eof +#endif +#ifdef bool + #undef bool +#endif +#ifdef close + #undef close +#endif +#ifdef rewind + #undef rewind +#endif +#ifdef free + #undef free +#endif +#ifdef malloc + #undef malloc +#endif +#ifdef calloc + #undef calloc +#endif +#ifdef Stat + #undef Stat +#endif +#ifdef check + #undef check +#endif +#ifdef seekdir + #undef seekdir +#endif +#ifdef open + #undef open +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_ESLconnection swig_types[0] +#define SWIGTYPE_p_ESLevent swig_types[1] +#define SWIGTYPE_p_char swig_types[2] +#define SWIGTYPE_p_esl_event_t swig_types[3] +#define SWIGTYPE_p_esl_priority_t swig_types[4] +static swig_type_info *swig_types[6]; +static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#define SWIG_init boot_ESL + +#define SWIG_name "ESLc::boot_ESL" +#define SWIG_prefix "ESLc::" + +#define SWIGVERSION 0x010335 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include + + +#ifdef __cplusplus +extern "C" +#endif +#ifndef PERL_OBJECT +#ifndef MULTIPLICITY +SWIGEXPORT void SWIG_init (CV* cv); +#else +SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); +#endif +#else +SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); +#endif + + +#include "esl.h" +#include "esl_oop.h" + + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc) +{ + if (SvPOK(obj)) { + STRLEN len = 0; + char *cstr = SvPV(obj, len); + size_t size = len + 1; + if (cptr) { + if (alloc) { + if (*alloc == SWIG_NEWOBJ) { + *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size))); + } else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } + } + if (psize) *psize = size; + return SWIG_OK; + } else { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + char* vptr = 0; + if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = vptr; + if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + + + + +SWIGINTERNINLINE SV * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + SV *obj = sv_newmortal(); + if (carray) { + sv_setpvn(obj, carray, size); + } else { + sv_setsv(obj, &PL_sv_undef); + } + return obj; +} + + +SWIGINTERNINLINE SV * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + + +#include +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +SWIGINTERN int +SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val) +{ + if (SvNIOK(obj)) { + if (val) *val = SvNV(obj); + return SWIG_OK; + } else if (SvIOK(obj)) { + if (val) *val = (double) SvIV(obj); + return SWIG_AddCast(SWIG_OK); + } else { + const char *nptr = SvPV_nolen(obj); + if (nptr) { + char *endptr; + double v = strtod(nptr, &endptr); + if (errno == ERANGE) { + errno = 0; + return SWIG_OverflowError; + } else { + if (*endptr == '\0') { + if (val) *val = v; + return SWIG_Str2NumCast(SWIG_OK); + } + } + } + } + return SWIG_TypeError; +} + + +#include + + +#include + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val) +{ + if (SvIOK(obj)) { + if (val) *val = SvIV(obj); + return SWIG_OK; + } else { + int dispatch = 0; + const char *nptr = SvPV_nolen(obj); + if (nptr) { + char *endptr; + long v; + errno = 0; + v = strtol(nptr, &endptr,0); + if (errno == ERANGE) { + errno = 0; + return SWIG_OverflowError; + } else { + if (*endptr == '\0') { + if (val) *val = v; + return SWIG_Str2NumCast(SWIG_OK); + } + } + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE SV * +SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value) +{ + SV *obj = sv_newmortal(); + sv_setiv(obj, (IV) value); + return obj; +} + + +SWIGINTERNINLINE SV * +SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value) +{ + return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value); +} + + +SWIGINTERNINLINE SV * +SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value) +{ + SV *obj = sv_newmortal(); + if (value) { + sv_setsv(obj, &PL_sv_yes); + } else { + sv_setsv(obj, &PL_sv_no); + } + return obj; +} + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef PERL_OBJECT +#define MAGIC_CLASS _wrap_ESL_var:: +class _wrap_ESL_var : public CPerlObj { +public: +#else +#define MAGIC_CLASS +#endif +SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) { + MAGIC_PPERL + croak("Value is read-only."); + return 0; +} + + +#ifdef PERL_OBJECT +}; +#endif + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif +XS(_wrap_ESLevent_event_set) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + esl_event_t *arg2 = (esl_event_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLevent_event_set(self,event);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_set" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_esl_event_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_event_set" "', argument " "2"" of type '" "esl_event_t *""'"); + } + arg2 = reinterpret_cast< esl_event_t * >(argp2); + if (arg1) (arg1)->event = arg2; + + + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_event_get) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + esl_event_t *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLevent_event_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_get" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (esl_event_t *) ((arg1)->event); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_esl_event_t, 0 | 0); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_serialized_string_set) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLevent_serialized_string_set(self,serialized_string);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_set" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->serialized_string) delete[] arg1->serialized_string; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->serialized_string = 0; + } + + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_serialized_string_get) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLevent_serialized_string_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_get" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (char *) ((arg1)->serialized_string); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_mine_set) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLevent_mine_set(self,mine);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_set" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLevent_mine_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->mine = arg2; + + + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_mine_get) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLevent_mine_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_get" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (int) ((arg1)->mine); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLevent__SWIG_0) { + { + char *arg1 = (char *) 0 ; + char *arg2 = (char *) NULL ; + ESLevent *result = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 2)) { + SWIG_croak("Usage: new_ESLevent(type,subclass_name);"); + } + res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + if (items > 1) { + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLevent__SWIG_1) { + { + esl_event_t *arg1 = (esl_event_t *) 0 ; + int arg2 = (int) 0 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 2)) { + SWIG_croak("Usage: new_ESLevent(wrap_me,free_me);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_esl_event_t, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "esl_event_t *""'"); + } + arg1 = reinterpret_cast< esl_event_t * >(argp1); + if (items > 1) { + ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + } + result = (ESLevent *)new ESLevent(arg1,arg2); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLevent__SWIG_2) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: new_ESLevent(me);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (ESLevent *)new ESLevent(arg1); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLevent) { + dXSARGS; + + { + unsigned long _index = 0; + SWIG_TypeRank _rank = 0; + if ((items >= 1) && (items <= 2)) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + void *vptr = 0; + int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_esl_event_t, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_1; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (items > 1) { + { + { + int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL); + _v = SWIG_CheckState(res); + } + } + if (!_v) goto check_1; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + } + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 1; + if (_rank == _rankm) goto dispatch; + } + } + check_1: + + if (items == 1) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + void *vptr = 0; + int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_ESLevent, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 2; + if (_rank == _rankm) goto dispatch; + } + } + check_2: + + if ((items >= 1) && (items <= 2)) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_3; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (items > 1) { + { + int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_3; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + } + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 3; + if (_rank == _rankm) goto dispatch; + } + } + check_3: + + dispatch: + switch(_index) { + case 1: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLevent__SWIG_1); return; + case 2: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLevent__SWIG_2); return; + case 3: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLevent__SWIG_0); return; + } + } + + croak("No matching function for overloaded 'new_ESLevent'"); + XSRETURN(0); +} + + +XS(_wrap_delete_ESLevent) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: delete_ESLevent(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + delete arg1; + + + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_serialize) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) NULL ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 2)) { + SWIG_croak("Usage: ESLevent_serialize(self,format);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialize" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + if (items > 1) { + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + } + result = (char *)(arg1)->serialize((char const *)arg2); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_setPriority) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 2)) { + SWIG_croak("Usage: ESLevent_setPriority(self,priority);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_setPriority" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + if (items > 1) { + { + res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_esl_priority_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'"); + } else { + arg2 = *(reinterpret_cast< esl_priority_t * >(argp2)); + } + } + } + result = (bool)(arg1)->setPriority(arg2); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_getHeader) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 = (int) -1 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 3)) { + SWIG_croak("Usage: ESLevent_getHeader(self,header_name,idx);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (items > 2) { + ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ESLevent_getHeader" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + } + result = (char *)(arg1)->getHeader((char const *)arg2,arg3); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_getBody) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLevent_getBody(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getBody" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (char *)(arg1)->getBody(); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_getType) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLevent_getType(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getType" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (char *)(arg1)->getType(); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_addBody) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLevent_addBody(self,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addBody" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (bool)(arg1)->addBody((char const *)arg2); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_addHeader) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: ESLevent_addHeader(self,header_name,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_pushHeader) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: ESLevent_pushHeader(self,header_name,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_pushHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_pushHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_pushHeader" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_unshiftHeader) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: ESLevent_unshiftHeader(self,header_name,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_unshiftHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_unshiftHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_unshiftHeader" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_delHeader) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLevent_delHeader(self,header_name);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_delHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (bool)(arg1)->delHeader((char const *)arg2); + ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_firstHeader) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLevent_firstHeader(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_firstHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (char *)(arg1)->firstHeader(); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLevent_nextHeader) { + { + ESLevent *arg1 = (ESLevent *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLevent_nextHeader(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_nextHeader" "', argument " "1"" of type '" "ESLevent *""'"); + } + arg1 = reinterpret_cast< ESLevent * >(argp1); + result = (char *)(arg1)->nextHeader(); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLconnection__SWIG_0) { + { + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + ESLconnection *result = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 4) || (items > 4)) { + SWIG_croak("Usage: new_ESLconnection(host,port,user,password);"); + } + res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + XSRETURN(argvi); + fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLconnection__SWIG_1) { + { + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + ESLconnection *result = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: new_ESLconnection(host,port,password);"); + } + res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLconnection__SWIG_2) { + { + int arg1 ; + ESLconnection *result = 0 ; + int val1 ; + int ecode1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: new_ESLconnection(socket);"); + } + ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (ESLconnection *)new ESLconnection(arg1); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_new_ESLconnection) { + dXSARGS; + + { + unsigned long _index = 0; + SWIG_TypeRank _rank = 0; + if (items == 1) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + { + int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), NULL); + _v = SWIG_CheckState(res); + } + } + if (!_v) goto check_1; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 1; + if (_rank == _rankm) goto dispatch; + } + } + check_1: + + if (items == 3) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + { + int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + { + int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 2; + if (_rank == _rankm) goto dispatch; + } + } + check_2: + + if (items == 4) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_3; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + { + int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_3; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + { + int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_3; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + { + int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_3; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 3; + if (_rank == _rankm) goto dispatch; + } + } + check_3: + + dispatch: + switch(_index) { + case 1: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_2); return; + case 2: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_1); return; + case 3: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_0); return; + } + } + + croak("No matching function for overloaded 'new_ESLconnection'"); + XSRETURN(0); +} + + +XS(_wrap_delete_ESLconnection) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: delete_ESLconnection(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLconnection" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + delete arg1; + + + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_socketDescriptor) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLconnection_socketDescriptor(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_socketDescriptor" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + result = (int)(arg1)->socketDescriptor(); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_connected) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLconnection_connected(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_connected" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + result = (int)(arg1)->connected(); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_getInfo) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLconnection_getInfo(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_getInfo" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + result = (ESLevent *)(arg1)->getInfo(); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_send) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLconnection_send(self,cmd);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_send" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (int)(arg1)->send((char const *)arg2); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_sendRecv) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLconnection_sendRecv(self,cmd);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendRecv" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (ESLevent *)(arg1)->sendRecv((char const *)arg2); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_api) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 3)) { + SWIG_croak("Usage: ESLconnection_api(self,cmd,arg);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (items > 2) { + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_bgapi) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 4)) { + SWIG_croak("Usage: ESLconnection_bgapi(self,cmd,arg,job_uuid);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (items > 2) { + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (items > 3) { + res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_bgapi" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3,(char const *)arg4); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_sendEvent) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + ESLevent *arg2 = (ESLevent *) 0 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLconnection_sendEvent(self,send_me);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendEvent" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendEvent" "', argument " "2"" of type '" "ESLevent *""'"); + } + arg2 = reinterpret_cast< ESLevent * >(argp2); + result = (ESLevent *)(arg1)->sendEvent(arg2); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_sendMSG) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + ESLevent *arg2 = (ESLevent *) 0 ; + char *arg3 = (char *) NULL ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 3)) { + SWIG_croak("Usage: ESLconnection_sendMSG(self,send_me,uuid);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendMSG" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_ESLevent, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendMSG" "', argument " "2"" of type '" "ESLevent *""'"); + } + arg2 = reinterpret_cast< ESLevent * >(argp2); + if (items > 2) { + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_sendMSG" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + result = (int)(arg1)->sendMSG(arg2,(char const *)arg3); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_recvEvent) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLconnection_recvEvent(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEvent" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + result = (ESLevent *)(arg1)->recvEvent(); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_recvEventTimed) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + int arg2 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLconnection_recvEventTimed(self,ms);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEventTimed" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLconnection_recvEventTimed" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (ESLevent *)(arg1)->recvEventTimed(arg2); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_filter) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: ESLconnection_filter(self,header,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_filter" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_events) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: ESLconnection_events(self,etype,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_events" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (int)(arg1)->events((char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_execute) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 4)) { + SWIG_croak("Usage: ESLconnection_execute(self,app,arg,uuid);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_execute" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (items > 2) { + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (items > 3) { + res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_executeAsync) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) NULL ; + char *arg4 = (char *) NULL ; + ESLevent *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int res4 ; + char *buf4 = 0 ; + int alloc4 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 4)) { + SWIG_croak("Usage: ESLconnection_executeAsync(self,app,arg,uuid);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (items > 2) { + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + } + if (items > 3) { + res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'"); + } + arg4 = reinterpret_cast< char * >(buf4); + } + result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + if (alloc4 == SWIG_NEWOBJ) delete[] buf4; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_setAsyncExecute) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLconnection_setAsyncExecute(self,val);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (int)(arg1)->setAsyncExecute((char const *)arg2); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_setEventLock) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + char *arg2 = (char *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: ESLconnection_setEventLock(self,val);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setEventLock" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (int)(arg1)->setEventLock((char const *)arg2); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_ESLconnection_disconnect) { + { + ESLconnection *arg1 = (ESLconnection *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: ESLconnection_disconnect(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_disconnect" "', argument " "1"" of type '" "ESLconnection *""'"); + } + arg1 = reinterpret_cast< ESLconnection * >(argp1); + result = (int)(arg1)->disconnect(); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_eslSetLogLevel) { + { + int arg1 ; + int val1 ; + int ecode1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: eslSetLogLevel(level);"); + } + ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "eslSetLogLevel" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + eslSetLogLevel(arg1); + + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)"ESL::ESLconnection", 0}; +static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)"ESL::ESLevent", 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_ESLconnection, + &_swigt__p_ESLevent, + &_swigt__p_char, + &_swigt__p_esl_event_t, + &_swigt__p_esl_priority_t, +}; + +static swig_cast_info _swigc__p_ESLconnection[] = { {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ESLevent[] = { {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_esl_event_t[] = { {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_esl_priority_t[] = { {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_ESLconnection, + _swigc__p_ESLevent, + _swigc__p_char, + _swigc__p_esl_event_t, + _swigc__p_esl_priority_t, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_constant_info swig_constants[] = { +{0,0,0,0,0,0} +}; +#ifdef __cplusplus +} +#endif +static swig_variable_info swig_variables[] = { +{0,0,0,0} +}; +static swig_command_info swig_commands[] = { +{"ESLc::ESLevent_event_set", _wrap_ESLevent_event_set}, +{"ESLc::ESLevent_event_get", _wrap_ESLevent_event_get}, +{"ESLc::ESLevent_serialized_string_set", _wrap_ESLevent_serialized_string_set}, +{"ESLc::ESLevent_serialized_string_get", _wrap_ESLevent_serialized_string_get}, +{"ESLc::ESLevent_mine_set", _wrap_ESLevent_mine_set}, +{"ESLc::ESLevent_mine_get", _wrap_ESLevent_mine_get}, +{"ESLc::new_ESLevent", _wrap_new_ESLevent}, +{"ESLc::delete_ESLevent", _wrap_delete_ESLevent}, +{"ESLc::ESLevent_serialize", _wrap_ESLevent_serialize}, +{"ESLc::ESLevent_setPriority", _wrap_ESLevent_setPriority}, +{"ESLc::ESLevent_getHeader", _wrap_ESLevent_getHeader}, +{"ESLc::ESLevent_getBody", _wrap_ESLevent_getBody}, +{"ESLc::ESLevent_getType", _wrap_ESLevent_getType}, +{"ESLc::ESLevent_addBody", _wrap_ESLevent_addBody}, +{"ESLc::ESLevent_addHeader", _wrap_ESLevent_addHeader}, +{"ESLc::ESLevent_pushHeader", _wrap_ESLevent_pushHeader}, +{"ESLc::ESLevent_unshiftHeader", _wrap_ESLevent_unshiftHeader}, +{"ESLc::ESLevent_delHeader", _wrap_ESLevent_delHeader}, +{"ESLc::ESLevent_firstHeader", _wrap_ESLevent_firstHeader}, +{"ESLc::ESLevent_nextHeader", _wrap_ESLevent_nextHeader}, +{"ESLc::new_ESLconnection", _wrap_new_ESLconnection}, +{"ESLc::delete_ESLconnection", _wrap_delete_ESLconnection}, +{"ESLc::ESLconnection_socketDescriptor", _wrap_ESLconnection_socketDescriptor}, +{"ESLc::ESLconnection_connected", _wrap_ESLconnection_connected}, +{"ESLc::ESLconnection_getInfo", _wrap_ESLconnection_getInfo}, +{"ESLc::ESLconnection_send", _wrap_ESLconnection_send}, +{"ESLc::ESLconnection_sendRecv", _wrap_ESLconnection_sendRecv}, +{"ESLc::ESLconnection_api", _wrap_ESLconnection_api}, +{"ESLc::ESLconnection_bgapi", _wrap_ESLconnection_bgapi}, +{"ESLc::ESLconnection_sendEvent", _wrap_ESLconnection_sendEvent}, +{"ESLc::ESLconnection_sendMSG", _wrap_ESLconnection_sendMSG}, +{"ESLc::ESLconnection_recvEvent", _wrap_ESLconnection_recvEvent}, +{"ESLc::ESLconnection_recvEventTimed", _wrap_ESLconnection_recvEventTimed}, +{"ESLc::ESLconnection_filter", _wrap_ESLconnection_filter}, +{"ESLc::ESLconnection_events", _wrap_ESLconnection_events}, +{"ESLc::ESLconnection_execute", _wrap_ESLconnection_execute}, +{"ESLc::ESLconnection_executeAsync", _wrap_ESLconnection_executeAsync}, +{"ESLc::ESLconnection_setAsyncExecute", _wrap_ESLconnection_setAsyncExecute}, +{"ESLc::ESLconnection_setEventLock", _wrap_ESLconnection_setEventLock}, +{"ESLc::ESLconnection_disconnect", _wrap_ESLconnection_disconnect}, +{"ESLc::eslSetLogLevel", _wrap_eslSetLogLevel}, +{0,0} +}; +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned staticly to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int found, init; + + clientdata = clientdata; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + module_head = &swig_module; + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + found=0; + iter=module_head; + do { + if (iter==&swig_module) { + found=1; + break; + } + iter=iter->next; + } while (iter!= module_head); + + /* if the is found in the list, then all is done and we may leave */ + if (found) return; + /* otherwise we must add out module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" +#endif + +XS(SWIG_init) { + dXSARGS; + int i; + + SWIG_InitializeModule(0); + + /* Install commands */ + for (i = 0; swig_commands[i].name; i++) { + newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); + } + + /* Install variables */ + for (i = 0; swig_variables[i].name; i++) { + SV *sv; + sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI); + if (swig_variables[i].type) { + SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); + } else { + sv_setiv(sv,(IV) 0); + } + swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); + } + + /* Install constant */ + for (i = 0; swig_constants[i].type; i++) { + SV *sv; + sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI); + switch(swig_constants[i].type) { + case SWIG_INT: + sv_setiv(sv, (IV) swig_constants[i].lvalue); + break; + case SWIG_FLOAT: + sv_setnv(sv, (double) swig_constants[i].dvalue); + break; + case SWIG_STRING: + sv_setpv(sv, (char *) swig_constants[i].pvalue); + break; + case SWIG_POINTER: + SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); + break; + case SWIG_BINARY: + SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); + break; + default: + break; + } + SvREADONLY_on(sv); + } + + SWIG_TypeClientData(SWIGTYPE_p_ESLevent, (void*) "ESL::ESLevent"); + SWIG_TypeClientData(SWIGTYPE_p_ESLconnection, (void*) "ESL::ESLconnection"); + ST(0) = &PL_sv_yes; + XSRETURN(1); +} + diff --git a/libs/libscgi/perl/perlxsi.c b/libs/libscgi/perl/perlxsi.c new file mode 100644 index 0000000000..9ca8fc1fb1 --- /dev/null +++ b/libs/libscgi/perl/perlxsi.c @@ -0,0 +1,16 @@ +#include +#include + +EXTERN_C void xs_init (pTHX); + +EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); + +EXTERN_C void +xs_init(pTHX) +{ + char *file = __FILE__; + dXSUB_SYS; + + /* DynaLoader is a special case */ + newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); +} diff --git a/libs/libscgi/perl/scgi_wrap.cpp b/libs/libscgi/perl/scgi_wrap.cpp new file mode 100644 index 0000000000..aaa8e40219 --- /dev/null +++ b/libs/libscgi/perl/scgi_wrap.cpp @@ -0,0 +1,2459 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGPERL +#define SWIG_CASTRANK_MODE + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic CAPI SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "4" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the swig runtime code. + In 99.9% of the cases, swig just needs to declare them as 'static'. + + But only do this if is strictly necessary, ie, if you have problems + with your compiler or so. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The swig conversion methods, as ConvertPtr, return and integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old swig versions, you usually write code as: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit as: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + that seems to be the same, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + requires also to SWIG_ConvertPtr to return new result values, as + + int SWIG_ConvertPtr(obj, ptr,...) { + if () { + if () { + *ptr = ; + return SWIG_NEWOBJ; + } else { + *ptr = ; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + swig errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() + + + */ +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *, int *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store information on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class" == "Class", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like ||... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like ||... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCompare(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + + +/* think of this as a c++ template<> or a scheme macro */ +#define SWIG_TypeCheck_Template(comparison, ty) \ + if (ty) { \ + swig_cast_info *iter = ty->cast; \ + while (iter) { \ + if (comparison) { \ + if (iter == ty->cast) return iter; \ + /* Move iter to the top of the linked list */ \ + iter->prev->next = iter->next; \ + if (iter->next) \ + iter->next->prev = iter->prev; \ + iter->next = ty->cast; \ + iter->prev = 0; \ + if (ty->cast) ty->cast->prev = iter; \ + ty->cast = iter; \ + return iter; \ + } \ + iter = iter->next; \ + } \ + } \ + return 0 + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); +} + +/* Same as previous function, except strcmp is replaced with a pointer comparison */ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { + SWIG_TypeCheck_Template(iter->type == from, into); +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + register size_t l = 0; + register size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + register size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + register int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + register size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + register const unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + register unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register char d = *(c++); + register unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = ((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = ((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + +#ifdef __cplusplus +/* Needed on some windows machines---since MS plays funny games with the header files under C++ */ +#include +#include +extern "C" { +#endif +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */ + +/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */ +#ifndef PERL_REVISION +# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) +# define PERL_PATCHLEVEL_H_IMPLICIT +# include +# endif +# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) +# include +# endif +# ifndef PERL_REVISION +# define PERL_REVISION (5) +# define PERL_VERSION PATCHLEVEL +# define PERL_SUBVERSION SUBVERSION +# endif +#endif + +#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE) +#define PerlIO_exportFILE(fh,fl) (FILE*)(fh) +#endif + +#ifndef SvIOK_UV +# define SvIOK_UV(sv) (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv))) +#endif + +#ifndef SvUOK +# define SvUOK(sv) SvIOK_UV(sv) +#endif + +#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))) +# define PL_sv_undef sv_undef +# define PL_na na +# define PL_errgv errgv +# define PL_sv_no sv_no +# define PL_sv_yes sv_yes +# define PL_markstack_ptr markstack_ptr +#endif + +#ifndef IVSIZE +# ifdef LONGSIZE +# define IVSIZE LONGSIZE +# else +# define IVSIZE 4 /* A bold guess, but the best we can make. */ +# endif +#endif + +#ifndef INT2PTR +# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) +# define PTRV UV +# define INT2PTR(any,d) (any)(d) +# else +# if PTRSIZE == LONGSIZE +# define PTRV unsigned long +# else +# define PTRV unsigned +# endif +# define INT2PTR(any,d) (any)(PTRV)(d) +# endif + +# define NUM2PTR(any,d) (any)(PTRV)(d) +# define PTR2IV(p) INT2PTR(IV,p) +# define PTR2UV(p) INT2PTR(UV,p) +# define PTR2NV(p) NUM2PTR(NV,p) + +# if PTRSIZE == LONGSIZE +# define PTR2ul(p) (unsigned long)(p) +# else +# define PTR2ul(p) INT2PTR(unsigned long,p) +# endif +#endif /* !INT2PTR */ + +#ifndef SvPV_nolen +# define SvPV_nolen(x) SvPV(x,PL_na) +#endif + +#ifndef get_sv +# define get_sv perl_get_sv +#endif + +#ifndef ERRSV +# define ERRSV get_sv("@",FALSE) +#endif + +#ifndef pTHX_ +#define pTHX_ +#endif + +#include +#ifdef __cplusplus +} +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGINTERN const char* +SWIG_Perl_ErrorType(int code) { + const char* type = 0; + switch(code) { + case SWIG_MemoryError: + type = "MemoryError"; + break; + case SWIG_IOError: + type = "IOError"; + break; + case SWIG_RuntimeError: + type = "RuntimeError"; + break; + case SWIG_IndexError: + type = "IndexError"; + break; + case SWIG_TypeError: + type = "TypeError"; + break; + case SWIG_DivisionByZero: + type = "ZeroDivisionError"; + break; + case SWIG_OverflowError: + type = "OverflowError"; + break; + case SWIG_SyntaxError: + type = "SyntaxError"; + break; + case SWIG_ValueError: + type = "ValueError"; + break; + case SWIG_SystemError: + type = "SystemError"; + break; + case SWIG_AttributeError: + type = "AttributeError"; + break; + default: + type = "RuntimeError"; + } + return type; +} + + + + +/* ----------------------------------------------------------------------------- + * perlrun.swg + * + * This file contains the runtime support for Perl modules + * and includes code for managing global variables and pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +#ifdef PERL_OBJECT +#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl), +#define SWIG_PERL_OBJECT_CALL pPerl, +#else +#define SWIG_PERL_OBJECT_DECL +#define SWIG_PERL_OBJECT_CALL +#endif + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags) +#define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags) + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, p, s, type) SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type) +#define SWIG_NewPackedObj(p, s, type) SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Perl_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_Perl_SetModule(pointer) + + +/* Error manipulation */ + +#define SWIG_ErrorType(code) SWIG_Perl_ErrorType(code) +#define SWIG_Error(code, msg) sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + +/* Perl-specific SWIG API */ + +#define SWIG_MakePtr(sv, ptr, type, flags) SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags) +#define SWIG_MakePackedObj(sv, p, s, type) SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type) +#define SWIG_SetError(str) SWIG_Error(SWIG_RuntimeError, str) + + +#define SWIG_PERL_DECL_ARGS_1(arg1) (SWIG_PERL_OBJECT_DECL arg1) +#define SWIG_PERL_CALL_ARGS_1(arg1) (SWIG_PERL_OBJECT_CALL arg1) +#define SWIG_PERL_DECL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_DECL arg1, arg2) +#define SWIG_PERL_CALL_ARGS_2(arg1, arg2) (SWIG_PERL_OBJECT_CALL arg1, arg2) + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +/* For backward compatibility only */ +#define SWIG_POINTER_EXCEPTION 0 + +#ifdef __cplusplus +extern "C" { +#endif + +#define SWIG_OWNER SWIG_POINTER_OWN +#define SWIG_SHADOW SWIG_OWNER << 1 + +#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL + +/* SWIG Perl macros */ + +/* Macro to declare an XS function */ +#ifndef XSPROTO +# define XSPROTO(name) void name(pTHX_ CV* cv) +#endif + +/* Macro to call an XS function */ +#ifdef PERL_OBJECT +# define SWIG_CALLXS(_name) _name(cv,pPerl) +#else +# ifndef MULTIPLICITY +# define SWIG_CALLXS(_name) _name(cv) +# else +# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) +# endif +#endif + +#ifdef PERL_OBJECT +#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; + +#ifdef __cplusplus +extern "C" { +#endif +typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); +#ifdef __cplusplus +} +#endif + +#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) +#define SWIGCLASS_STATIC + +#else /* PERL_OBJECT */ + +#define MAGIC_PPERL +#define SWIGCLASS_STATIC static SWIGUNUSED + +#ifndef MULTIPLICITY +#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) + +#ifdef __cplusplus +extern "C" { +#endif +typedef int (*SwigMagicFunc)(SV *, MAGIC *); +#ifdef __cplusplus +} +#endif + +#else /* MULTIPLICITY */ + +#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) + +#ifdef __cplusplus +extern "C" { +#endif +typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); +#ifdef __cplusplus +} +#endif + +#endif /* MULTIPLICITY */ +#endif /* PERL_OBJECT */ + +/* Workaround for bug in perl 5.6.x croak and earlier */ +#if (PERL_VERSION < 8) +# ifdef PERL_OBJECT +# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl) +static void SWIG_Perl_croak_null(CPerlObj *pPerl) +# else +static void SWIG_croak_null() +# endif +{ + SV *err=ERRSV; +# if (PERL_VERSION < 6) + croak("%_", err); +# else + if (SvOK(err) && !SvROK(err)) croak("%_", err); + croak(Nullch); +# endif +} +#else +# define SWIG_croak_null() croak(Nullch) +#endif + + +/* + Define how strict is the cast between strings and integers/doubles + when overloading between these types occurs. + + The default is making it as strict as possible by using SWIG_AddCast + when needed. + + You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to + disable the SWIG_AddCast, making the casting between string and + numbers less strict. + + In the end, we try to solve the overloading between strings and + numerical types in the more natural way, but if you can avoid it, + well, avoid it using %rename, for example. +*/ +#ifndef SWIG_PERL_NO_STRICT_STR2NUM +# ifndef SWIG_PERL_STRICT_STR2NUM +# define SWIG_PERL_STRICT_STR2NUM +# endif +#endif +#ifdef SWIG_PERL_STRICT_STR2NUM +/* string takes precedence */ +#define SWIG_Str2NumCast(x) SWIG_AddCast(x) +#else +/* number takes precedence */ +#define SWIG_Str2NumCast(x) x +#endif + + + +#include + +SWIGRUNTIME const char * +SWIG_Perl_TypeProxyName(const swig_type_info *type) { + if (!type) return NULL; + if (type->clientdata != NULL) { + return (const char*) type->clientdata; + } + else { + return type->name; + } +} + +SWIGRUNTIME swig_cast_info * +SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) { + SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) + || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty); +} + + +/* Function for getting a pointer value */ + +SWIGRUNTIME int +SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) { + swig_cast_info *tc; + void *voidptr = (void *)0; + SV *tsv = 0; + /* If magical, apply more magic */ + if (SvGMAGICAL(sv)) + mg_get(sv); + + /* Check to see if this is an object */ + if (sv_isobject(sv)) { + IV tmp = 0; + tsv = (SV*) SvRV(sv); + if ((SvTYPE(tsv) == SVt_PVHV)) { + MAGIC *mg; + if (SvMAGICAL(tsv)) { + mg = mg_find(tsv,'P'); + if (mg) { + sv = mg->mg_obj; + if (sv_isobject(sv)) { + tsv = (SV*)SvRV(sv); + tmp = SvIV(tsv); + } + } + } else { + return SWIG_ERROR; + } + } else { + tmp = SvIV(tsv); + } + voidptr = INT2PTR(void *,tmp); + } else if (! SvOK(sv)) { /* Check for undef */ + *(ptr) = (void *) 0; + return SWIG_OK; + } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */ + if (!SvROK(sv)) { + *(ptr) = (void *) 0; + return SWIG_OK; + } else { + return SWIG_ERROR; + } + } else { /* Don't know what it is */ + return SWIG_ERROR; + } + if (_t) { + /* Now see if the types match */ + char *_c = HvNAME(SvSTASH(SvRV(sv))); + tc = SWIG_TypeProxyCheck(_c,_t); + if (!tc) { + return SWIG_ERROR; + } + { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,voidptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } + } else { + *ptr = voidptr; + } + + /* + * DISOWN implementation: we need a perl guru to check this one. + */ + if (tsv && (flags & SWIG_POINTER_DISOWN)) { + /* + * almost copy paste code from below SWIG_POINTER_OWN setting + */ + SV *obj = sv; + HV *stash = SvSTASH(SvRV(obj)); + GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE); + if (isGV(gv)) { + HV *hv = GvHVn(gv); + /* + * To set ownership (see below), a newSViv(1) entry is added. + * Hence, to remove ownership, we delete the entry. + */ + if (hv_exists_ent(hv, obj, 0)) { + hv_delete_ent(hv, obj, 0, 0); + } + } + } + return SWIG_OK; +} + +SWIGRUNTIME void +SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) { + if (ptr && (flags & SWIG_SHADOW)) { + SV *self; + SV *obj=newSV(0); + HV *hash=newHV(); + HV *stash; + sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr); + stash=SvSTASH(SvRV(obj)); + if (flags & SWIG_POINTER_OWN) { + HV *hv; + GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE); + if (!isGV(gv)) + gv_init(gv, stash, "OWNER", 5, FALSE); + hv=GvHVn(gv); + hv_store_ent(hv, obj, newSViv(1), 0); + } + sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0); + SvREFCNT_dec(obj); + self=newRV_noinc((SV *)hash); + sv_setsv(sv, self); + SvREFCNT_dec((SV *)self); + sv_bless(sv, stash); + } + else { + sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr); + } +} + +SWIGRUNTIMEINLINE SV * +SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) { + SV *result = sv_newmortal(); + SWIG_MakePtr(result, ptr, t, flags); + return result; +} + +SWIGRUNTIME void +SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) { + char result[1024]; + char *r = result; + if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + strcpy(r,SWIG_Perl_TypeProxyName(type)); + sv_setpv(sv, result); +} + +SWIGRUNTIME SV * +SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) { + SV *result = sv_newmortal(); + SWIG_Perl_MakePackedObj(result, ptr, sz, type); + return result; +} + +/* Convert a packed value value */ +SWIGRUNTIME int +SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) { + swig_cast_info *tc; + const char *c = 0; + + if ((!obj) || (!SvOK(obj))) return SWIG_ERROR; + c = SvPV_nolen(obj); + /* Pointer values must start with leading underscore */ + if (*c != '_') return SWIG_ERROR; + c++; + c = SWIG_UnpackData(c,ptr,sz); + if (ty) { + tc = SWIG_TypeCheck(c,ty); + if (!tc) return SWIG_ERROR; + } + return SWIG_OK; +} + + +/* Macros for low-level exception handling */ +#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; } + + +typedef XSPROTO(SwigPerlWrapper); +typedef SwigPerlWrapper *SwigPerlWrapperPtr; + +/* Structure for command table */ +typedef struct { + const char *name; + SwigPerlWrapperPtr wrapper; +} swig_command_info; + +/* Information for constant table */ + +#define SWIG_INT 1 +#define SWIG_FLOAT 2 +#define SWIG_STRING 3 +#define SWIG_POINTER 4 +#define SWIG_BINARY 5 + +/* Constant information structure */ +typedef struct swig_constant_info { + int type; + const char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_constant_info; + + +/* Structure for variable table */ +typedef struct { + const char *name; + SwigMagicFunc set; + SwigMagicFunc get; + swig_type_info **type; +} swig_variable_info; + +/* Magic variable code */ +#ifndef PERL_OBJECT +#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c) + #ifndef MULTIPLICITY + SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) + #else + SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) + #endif +#else +# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c) +SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) +#endif +{ + MAGIC *mg; + sv_magic(sv,sv,'U',(char *) name,strlen(name)); + mg = mg_find(sv,'U'); + mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); + mg->mg_virtual->svt_get = (SwigMagicFunc) get; + mg->mg_virtual->svt_set = (SwigMagicFunc) set; + mg->mg_virtual->svt_len = 0; + mg->mg_virtual->svt_clear = 0; + mg->mg_virtual->svt_free = 0; +} + + +SWIGRUNTIME swig_module_info * +SWIG_Perl_GetModule(void) { + static void *type_pointer = (void *)0; + SV *pointer; + + /* first check if pointer already created */ + if (!type_pointer) { + pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI); + if (pointer && SvOK(pointer)) { + type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); + } + } + + return (swig_module_info *) type_pointer; +} + +SWIGRUNTIME void +SWIG_Perl_SetModule(swig_module_info *module) { + SV *pointer; + + /* create a new pointer */ + pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI); + sv_setiv(pointer, PTR2IV(module)); +} + +#ifdef __cplusplus +} +#endif + +/* Workaround perl5 global namespace pollution. Note that undefining library + * functions like fopen will not solve the problem on all platforms as fopen + * might be a macro on Windows but not necessarily on other operating systems. */ +#ifdef do_open + #undef do_open +#endif +#ifdef do_close + #undef do_close +#endif +#ifdef scalar + #undef scalar +#endif +#ifdef list + #undef list +#endif +#ifdef apply + #undef apply +#endif +#ifdef convert + #undef convert +#endif +#ifdef Error + #undef Error +#endif +#ifdef form + #undef form +#endif +#ifdef vform + #undef vform +#endif +#ifdef LABEL + #undef LABEL +#endif +#ifdef METHOD + #undef METHOD +#endif +#ifdef Move + #undef Move +#endif +#ifdef yylex + #undef yylex +#endif +#ifdef yyparse + #undef yyparse +#endif +#ifdef yyerror + #undef yyerror +#endif +#ifdef invert + #undef invert +#endif +#ifdef ref + #undef ref +#endif +#ifdef read + #undef read +#endif +#ifdef write + #undef write +#endif +#ifdef eof + #undef eof +#endif +#ifdef bool + #undef bool +#endif +#ifdef close + #undef close +#endif +#ifdef rewind + #undef rewind +#endif +#ifdef free + #undef free +#endif +#ifdef malloc + #undef malloc +#endif +#ifdef calloc + #undef calloc +#endif +#ifdef Stat + #undef Stat +#endif +#ifdef check + #undef check +#endif +#ifdef seekdir + #undef seekdir +#endif +#ifdef open + #undef open +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_SCGIhandle swig_types[0] +#define SWIGTYPE_p_char swig_types[1] +static swig_type_info *swig_types[3]; +static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#define SWIG_init boot_FSSCGI + +#define SWIG_name "FSSCGIc::boot_FSSCGI" +#define SWIG_prefix "FSSCGIc::" + +#define SWIGVERSION 0x010335 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include + + +#ifdef __cplusplus +extern "C" +#endif +#ifndef PERL_OBJECT +#ifndef MULTIPLICITY +SWIGEXPORT void SWIG_init (CV* cv); +#else +SWIGEXPORT void SWIG_init (pTHXo_ CV* cv); +#endif +#else +SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); +#endif + + +#include "scgi.h" +#include "scgi_oop.h" + + +SWIGINTERNINLINE SV * +SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value) +{ + SV *obj = sv_newmortal(); + sv_setiv(obj, (IV) value); + return obj; +} + + +SWIGINTERNINLINE SV * +SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value) +{ + return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value); +} + + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc) +{ + if (SvPOK(obj)) { + STRLEN len = 0; + char *cstr = SvPV(obj, len); + size_t size = len + 1; + if (cptr) { + if (alloc) { + if (*alloc == SWIG_NEWOBJ) { + *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size))); + } else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } + } + if (psize) *psize = size; + return SWIG_OK; + } else { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + char* vptr = 0; + if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = vptr; + if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + + + + +#include +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +SWIGINTERN int +SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val) +{ + if (SvNIOK(obj)) { + if (val) *val = SvNV(obj); + return SWIG_OK; + } else if (SvIOK(obj)) { + if (val) *val = (double) SvIV(obj); + return SWIG_AddCast(SWIG_OK); + } else { + const char *nptr = SvPV_nolen(obj); + if (nptr) { + char *endptr; + double v = strtod(nptr, &endptr); + if (errno == ERANGE) { + errno = 0; + return SWIG_OverflowError; + } else { + if (*endptr == '\0') { + if (val) *val = v; + return SWIG_Str2NumCast(SWIG_OK); + } + } + } + } + return SWIG_TypeError; +} + + +#include + + +#include + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val) +{ + if (SvIOK(obj)) { + if (val) *val = SvIV(obj); + return SWIG_OK; + } else { + int dispatch = 0; + const char *nptr = SvPV_nolen(obj); + if (nptr) { + char *endptr; + long v; + errno = 0; + v = strtol(nptr, &endptr,0); + if (errno == ERANGE) { + errno = 0; + return SWIG_OverflowError; + } else { + if (*endptr == '\0') { + if (val) *val = v; + return SWIG_Str2NumCast(SWIG_OK); + } + } + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + +SWIGINTERNINLINE SV * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + SV *obj = sv_newmortal(); + if (carray) { + sv_setpvn(obj, carray, size); + } else { + sv_setsv(obj, &PL_sv_undef); + } + return obj; +} + + +SWIGINTERNINLINE SV * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef PERL_OBJECT +#define MAGIC_CLASS _wrap_FSSCGI_var:: +class _wrap_FSSCGI_var : public CPerlObj { +public: +#else +#define MAGIC_CLASS +#endif +SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) { + MAGIC_PPERL + croak("Value is read-only."); + return 0; +} + + +#ifdef PERL_OBJECT +}; +#endif + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif +XS(_wrap_new_SCGIhandle) { + { + SCGIhandle *result = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 0) || (items > 0)) { + SWIG_croak("Usage: new_SCGIhandle();"); + } + result = (SCGIhandle *)new SCGIhandle(); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SCGIhandle, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + XSRETURN(argvi); + fail: + SWIG_croak_null(); + } +} + + +XS(_wrap_delete_SCGIhandle) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: delete_SCGIhandle(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SCGIhandle" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + delete arg1; + + + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_connected) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: SCGIhandle_connected(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_connected" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + result = (int)(arg1)->connected(); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_socketDescriptor) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: SCGIhandle_socketDescriptor(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_socketDescriptor" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + result = (int)(arg1)->socketDescriptor(); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_disconnect) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: SCGIhandle_disconnect(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_disconnect" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + result = (int)(arg1)->disconnect(); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_addParam) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: SCGIhandle_addParam(self,name,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_addParam" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SCGIhandle_addParam" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SCGIhandle_addParam" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + result = (int)(arg1)->addParam((char const *)arg2,(char const *)arg3); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_addBody) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + char *arg2 = (char *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: SCGIhandle_addBody(self,value);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_addBody" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SCGIhandle_addBody" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (int)(arg1)->addBody((char const *)arg2); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_sendRequest) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + int arg4 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 4) || (items > 4)) { + SWIG_croak("Usage: SCGIhandle_sendRequest(self,host,port,timeout);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_sendRequest" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SCGIhandle_sendRequest" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SCGIhandle_sendRequest" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SCGIhandle_sendRequest" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + result = (int)(arg1)->sendRequest((char const *)arg2,arg3,arg4); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + + + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_recv) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: SCGIhandle_recv(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_recv" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + result = (char *)(arg1)->recv(); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_bind) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 3) || (items > 3)) { + SWIG_croak("Usage: SCGIhandle_bind(self,host,port);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_bind" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SCGIhandle_bind" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SCGIhandle_bind" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + result = (int)(arg1)->bind((char const *)arg2,arg3); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_accept) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: SCGIhandle_accept(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_accept" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + result = (int)(arg1)->accept(); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static swig_type_info _swigt__p_SCGIhandle = {"_p_SCGIhandle", "SCGIhandle *", 0, 0, (void*)"FSSCGI::SCGIhandle", 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_SCGIhandle, + &_swigt__p_char, +}; + +static swig_cast_info _swigc__p_SCGIhandle[] = { {&_swigt__p_SCGIhandle, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_SCGIhandle, + _swigc__p_char, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_constant_info swig_constants[] = { +{0,0,0,0,0,0} +}; +#ifdef __cplusplus +} +#endif +static swig_variable_info swig_variables[] = { +{0,0,0,0} +}; +static swig_command_info swig_commands[] = { +{"FSSCGIc::new_SCGIhandle", _wrap_new_SCGIhandle}, +{"FSSCGIc::delete_SCGIhandle", _wrap_delete_SCGIhandle}, +{"FSSCGIc::SCGIhandle_connected", _wrap_SCGIhandle_connected}, +{"FSSCGIc::SCGIhandle_socketDescriptor", _wrap_SCGIhandle_socketDescriptor}, +{"FSSCGIc::SCGIhandle_disconnect", _wrap_SCGIhandle_disconnect}, +{"FSSCGIc::SCGIhandle_addParam", _wrap_SCGIhandle_addParam}, +{"FSSCGIc::SCGIhandle_addBody", _wrap_SCGIhandle_addBody}, +{"FSSCGIc::SCGIhandle_sendRequest", _wrap_SCGIhandle_sendRequest}, +{"FSSCGIc::SCGIhandle_recv", _wrap_SCGIhandle_recv}, +{"FSSCGIc::SCGIhandle_bind", _wrap_SCGIhandle_bind}, +{"FSSCGIc::SCGIhandle_accept", _wrap_SCGIhandle_accept}, +{0,0} +}; +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned staticly to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int found, init; + + clientdata = clientdata; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + module_head = &swig_module; + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + found=0; + iter=module_head; + do { + if (iter==&swig_module) { + found=1; + break; + } + iter=iter->next; + } while (iter!= module_head); + + /* if the is found in the list, then all is done and we may leave */ + if (found) return; + /* otherwise we must add out module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" +#endif + +XS(SWIG_init) { + dXSARGS; + int i; + + SWIG_InitializeModule(0); + + /* Install commands */ + for (i = 0; swig_commands[i].name; i++) { + newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__); + } + + /* Install variables */ + for (i = 0; swig_variables[i].name; i++) { + SV *sv; + sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI); + if (swig_variables[i].type) { + SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); + } else { + sv_setiv(sv,(IV) 0); + } + swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); + } + + /* Install constant */ + for (i = 0; swig_constants[i].type; i++) { + SV *sv; + sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI); + switch(swig_constants[i].type) { + case SWIG_INT: + sv_setiv(sv, (IV) swig_constants[i].lvalue); + break; + case SWIG_FLOAT: + sv_setnv(sv, (double) swig_constants[i].dvalue); + break; + case SWIG_STRING: + sv_setpv(sv, (char *) swig_constants[i].pvalue); + break; + case SWIG_POINTER: + SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0); + break; + case SWIG_BINARY: + SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype)); + break; + default: + break; + } + SvREADONLY_on(sv); + } + + SWIG_TypeClientData(SWIGTYPE_p_SCGIhandle, (void*) "FSSCGI::SCGIhandle"); + ST(0) = &PL_sv_yes; + XSRETURN(1); +} + diff --git a/libs/libscgi/src/include/scgi.h b/libs/libscgi/src/include/scgi.h index 29abcf0271..8a789a3a9f 100644 --- a/libs/libscgi/src/include/scgi.h +++ b/libs/libscgi/src/include/scgi.h @@ -179,7 +179,7 @@ typedef enum { SCGI_GENERR } scgi_status_t; -typedef void (*scgi_listen_callback_t)(scgi_socket_t server_sock, scgi_socket_t client_sock, struct sockaddr_in *addr); +typedef void (*scgi_listen_callback_t)(scgi_socket_t server_sock, scgi_socket_t *client_sock, struct sockaddr_in *addr); SCGI_DECLARE(scgi_status_t) scgi_connect(scgi_handle_t *handle, const char *host, scgi_port_t port, uint32_t timeout); SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle); @@ -193,6 +193,8 @@ SCGI_DECLARE(scgi_status_t) scgi_destroy_params(scgi_handle_t *handle); SCGI_DECLARE(scgi_status_t) scgi_listen(const char *host, scgi_port_t port, scgi_listen_callback_t callback); SCGI_DECLARE(const char *) scgi_get_body(scgi_handle_t *handle); SCGI_DECLARE(const char *) scgi_get_param(scgi_handle_t *handle, const char *name); +SCGI_DECLARE(scgi_status_t) scgi_bind(const char *host, scgi_port_t port, scgi_socket_t *socketp); +SCGI_DECLARE(scgi_status_t) scgi_accept(scgi_socket_t server_sock, scgi_socket_t *client_sock_p, struct sockaddr_in *echoClntAddr); #ifdef __cplusplus } diff --git a/libs/libscgi/src/include/scgi_oop.h b/libs/libscgi/src/include/scgi_oop.h new file mode 100644 index 0000000000..a49c96cdd1 --- /dev/null +++ b/libs/libscgi/src/include/scgi_oop.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2007-2012, Anthony Minessale II + * 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. + */ + +#ifndef _SCGI_OOP_H_ +#define _SCGI_OOP_H_ +#include +#ifdef __cplusplus +extern "C" { +#endif + +#define this_check(x) do { if (!this) { scgi_log(SCGI_LOG_ERROR, "object is not initalized\n"); return x;}} while(0) +#define this_check_void() do { if (!this) { scgi_log(SCGI_LOG_ERROR, "object is not initalized\n"); return;}} while(0) + + + +class SCGIhandle { + private: + scgi_handle_t handle; + unsigned char buf[65536]; + public: + SCGIhandle(); + virtual ~SCGIhandle(); + int connected(); + int socketDescriptor(); + int disconnect(void); + int addParam(const char *name, const char *value); + int addBody(const char *value); + int sendRequest(const char *host, int port, int timeout); + char *recv(); + int bind(const char *host, int port); + int accept(void); +}; + + + + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index f50b5b8d88..f33afe30c8 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -548,7 +548,7 @@ static int scgi_socket_reuseaddr(scgi_socket_t socket) #endif } -SCGI_DECLARE(scgi_status_t) scgi_listen(const char *host, scgi_port_t port, scgi_listen_callback_t callback) +SCGI_DECLARE(scgi_status_t) scgi_bind(const char *host, scgi_port_t port, scgi_socket_t *socketp) { scgi_socket_t server_sock = SCGI_SOCK_INVALID; struct sockaddr_in addr; @@ -573,32 +573,64 @@ SCGI_DECLARE(scgi_status_t) scgi_listen(const char *host, scgi_port_t port, scgi if (listen(server_sock, 10000) < 0) { status = SCGI_FAIL; goto end; - } - - for (;;) { - int client_sock; - struct sockaddr_in echoClntAddr; -#ifdef WIN32 - int clntLen; -#else - unsigned int clntLen; -#endif - - clntLen = sizeof(echoClntAddr); - - if ((client_sock = accept(server_sock, (struct sockaddr *) &echoClntAddr, &clntLen)) == SCGI_SOCK_INVALID) { - status = SCGI_FAIL; - goto end; - } - - callback(server_sock, client_sock, &echoClntAddr); - } + } end: if (server_sock != SCGI_SOCK_INVALID) { closesocket(server_sock); server_sock = SCGI_SOCK_INVALID; + } else { + *socketp = server_sock; + } + + return status; +} + +SCGI_DECLARE(scgi_status_t) scgi_accept(scgi_socket_t server_sock, scgi_socket_t *client_sock_p, struct sockaddr_in *echoClntAddr) +{ + scgi_status_t status = SCGI_SUCCESS; + int client_sock; + struct sockaddr_in local_echoClntAddr; +#ifdef WIN32 + int clntLen; +#else + unsigned int clntLen; +#endif + + if (!echoClntAddr) { + echoClntAddr = &local_echoClntAddr; + } + + + clntLen = sizeof(*echoClntAddr); + + if ((client_sock = accept(server_sock, (struct sockaddr *) echoClntAddr, &clntLen)) == SCGI_SOCK_INVALID) { + status = SCGI_FAIL; + } else { + *client_sock_p = client_sock; + } + + return status; +} + +SCGI_DECLARE(scgi_status_t) scgi_listen(const char *host, scgi_port_t port, scgi_listen_callback_t callback) +{ + + scgi_socket_t server_sock = SCGI_SOCK_INVALID, client_sock = SCGI_SOCK_INVALID; + scgi_status_t status = SCGI_FAIL; + struct sockaddr_in echoClntAddr; + + if ((status = scgi_bind(host, port, &server_sock)) == SCGI_SUCCESS) { + + while(scgi_accept(server_sock, &client_sock, &echoClntAddr) == SCGI_SUCCESS) { + callback(server_sock, &client_sock, &echoClntAddr); + + if (client_sock != SCGI_SOCK_INVALID) { + closesocket(client_sock); + client_sock = SCGI_SOCK_INVALID; + } + } } return status; diff --git a/libs/libscgi/src/scgi_oop.cpp b/libs/libscgi/src/scgi_oop.cpp new file mode 100644 index 0000000000..c5b98334b9 --- /dev/null +++ b/libs/libscgi/src/scgi_oop.cpp @@ -0,0 +1,101 @@ +#include +#include + +#define connection_construct_common() memset(&handle, 0, sizeof(handle)) + + + +SCGIhandle::SCGIhandle(void) +{ + connection_construct_common(); +} + +SCGIhandle::~SCGIhandle() +{ + if (handle.connected) { + scgi_disconnect(&handle); + } +} + +int SCGIhandle::socketDescriptor() +{ + if (handle.connected) { + return (int) handle.sock; + } + + return -1; +} + + +int SCGIhandle::disconnect() +{ + if (handle.connected) { + return scgi_disconnect(&handle); + } + + return 0; +} + +int SCGIhandle::connected() +{ + return handle.connected; +} + +int SCGIhandle::addParam(const char *name, const char *value) +{ + return (int) scgi_add_param(&handle, name, value); +} + +int SCGIhandle::addBody(const char *value) +{ + return (int) scgi_add_body(&handle, value); +} + + +int SCGIhandle::sendRequest(const char *host, int port, int timeout) +{ + if (!host) { + return -2; + } + + if (timeout < 1000) { + timeout = 1000; + } + + if (scgi_connect(&handle, host, port, timeout) == SCGI_SUCCESS) { + return (int) scgi_send_request(&handle); + } + + return -2; +} + +char *SCGIhandle::recv(void) +{ + ssize_t len = scgi_recv(&handle, buf, sizeof(buf)); + + if (len > 0) { + return (char *)buf; + } + + return NULL; +} + + +int SCGIhandle::bind(const char *host, int port) +{ + return (int) scgi_bind(host, port, &handle.sock); +} + + +int SCGIhandle::accept(void) +{ + scgi_socket_t client_sock; + + if (scgi_accept(handle.sock, &client_sock, NULL) == SCGI_SUCCESS) { + return (int) client_sock; + } + + return -1; +} + + diff --git a/libs/libscgi/testserver.c b/libs/libscgi/testserver.c index 7cb6e32a03..2a784e83a8 100644 --- a/libs/libscgi/testserver.c +++ b/libs/libscgi/testserver.c @@ -1,12 +1,14 @@ #include -static void callback(scgi_socket_t server_sock, scgi_socket_t client_sock, struct sockaddr_in *addr) +static void callback(scgi_socket_t server_sock, scgi_socket_t *client_sock, struct sockaddr_in *addr) { scgi_handle_t handle = { 0 }; if (scgi_parse(client_sock, &handle) == SCGI_SUCCESS) { scgi_param_t *pp; + *client_sock = SCGI_SOCK_INVALID; + for(pp = handle.params; pp; pp = pp->next) { printf("HEADER: [%s] VALUE: [%s]\n", pp->name, pp->value); } @@ -15,10 +17,9 @@ static void callback(scgi_socket_t server_sock, scgi_socket_t client_sock, struc printf("\n\nBODY:\n%s\n\n", handle.body); } + scgi_disconnect(&handle); } - scgi_disconnect(&handle); - } int main(int argc, char *argv[]) From 4b2e7fc1f20a78909431997392fd355b2eed4a0d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 May 2012 11:31:17 -0500 Subject: [PATCH 0365/1057] perl update --- libs/libscgi/perl/FSSCGI.pm | 4 +- libs/libscgi/perl/scgi_wrap.cpp | 142 ++++++++++++++++++++++------ libs/libscgi/perl/testclient.pl | 19 ++++ libs/libscgi/perl/testserver.pl | 17 ++++ libs/libscgi/src/include/scgi.h | 5 + libs/libscgi/src/include/scgi_oop.h | 10 +- libs/libscgi/src/scgi.c | 31 +++--- libs/libscgi/src/scgi_oop.cpp | 84 ++++++++++------ libs/libscgi/testserver.c | 2 +- 9 files changed, 238 insertions(+), 76 deletions(-) create mode 100644 libs/libscgi/perl/testclient.pl create mode 100644 libs/libscgi/perl/testserver.pl diff --git a/libs/libscgi/perl/FSSCGI.pm b/libs/libscgi/perl/FSSCGI.pm index 7dfd256e05..05370a12a7 100644 --- a/libs/libscgi/perl/FSSCGI.pm +++ b/libs/libscgi/perl/FSSCGI.pm @@ -79,8 +79,10 @@ sub DESTROY { *disconnect = *FSSCGIc::SCGIhandle_disconnect; *addParam = *FSSCGIc::SCGIhandle_addParam; *addBody = *FSSCGIc::SCGIhandle_addBody; +*getBody = *FSSCGIc::SCGIhandle_getBody; +*getParam = *FSSCGIc::SCGIhandle_getParam; *sendRequest = *FSSCGIc::SCGIhandle_sendRequest; -*recv = *FSSCGIc::SCGIhandle_recv; +*respond = *FSSCGIc::SCGIhandle_respond; *bind = *FSSCGIc::SCGIhandle_bind; *accept = *FSSCGIc::SCGIhandle_accept; sub DISOWN { diff --git a/libs/libscgi/perl/scgi_wrap.cpp b/libs/libscgi/perl/scgi_wrap.cpp index aaa8e40219..cc96e9494c 100644 --- a/libs/libscgi/perl/scgi_wrap.cpp +++ b/libs/libscgi/perl/scgi_wrap.cpp @@ -1556,6 +1556,26 @@ SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc) +SWIGINTERNINLINE SV * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + SV *obj = sv_newmortal(); + if (carray) { + sv_setpvn(obj, carray, size); + } else { + sv_setsv(obj, &PL_sv_undef); + } + return obj; +} + + +SWIGINTERNINLINE SV * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + + #include #if !defined(SWIG_NO_LLONG_MAX) # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) @@ -1683,26 +1703,6 @@ SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val) return res; } - -SWIGINTERNINLINE SV * -SWIG_FromCharPtrAndSize(const char* carray, size_t size) -{ - SV *obj = sv_newmortal(); - if (carray) { - sv_setpvn(obj, carray, size); - } else { - sv_setsv(obj, &PL_sv_undef); - } - return obj; -} - - -SWIGINTERNINLINE SV * -SWIG_FromCharPtr(const char *cptr) -{ - return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); -} - #ifdef __cplusplus extern "C" { #endif @@ -1951,13 +1951,80 @@ XS(_wrap_SCGIhandle_addBody) { } +XS(_wrap_SCGIhandle_getBody) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: SCGIhandle_getBody(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_getBody" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + result = (char *)(arg1)->getBody(); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_SCGIhandle_getParam) { + { + SCGIhandle *arg1 = (SCGIhandle *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: SCGIhandle_getParam(self,name);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_getParam" "', argument " "1"" of type '" "SCGIhandle *""'"); + } + arg1 = reinterpret_cast< SCGIhandle * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SCGIhandle_getParam" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (char *)(arg1)->getParam((char const *)arg2); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + XS(_wrap_SCGIhandle_sendRequest) { { SCGIhandle *arg1 = (SCGIhandle *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; int arg4 ; - int result; + char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -1993,8 +2060,8 @@ XS(_wrap_SCGIhandle_sendRequest) { SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SCGIhandle_sendRequest" "', argument " "4"" of type '" "int""'"); } arg4 = static_cast< int >(val4); - result = (int)(arg1)->sendRequest((char const *)arg2,arg3,arg4); - ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + result = (char *)(arg1)->sendRequest((char const *)arg2,arg3,arg4); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; if (alloc2 == SWIG_NEWOBJ) delete[] buf2; @@ -2010,29 +2077,40 @@ XS(_wrap_SCGIhandle_sendRequest) { } -XS(_wrap_SCGIhandle_recv) { +XS(_wrap_SCGIhandle_respond) { { SCGIhandle *arg1 = (SCGIhandle *) 0 ; - char *result = 0 ; + char *arg2 = (char *) 0 ; + int result; void *argp1 = 0 ; int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; int argvi = 0; dXSARGS; - if ((items < 1) || (items > 1)) { - SWIG_croak("Usage: SCGIhandle_recv(self);"); + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: SCGIhandle_respond(self,msg);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SCGIhandle, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_recv" "', argument " "1"" of type '" "SCGIhandle *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SCGIhandle_respond" "', argument " "1"" of type '" "SCGIhandle *""'"); } arg1 = reinterpret_cast< SCGIhandle * >(argp1); - result = (char *)(arg1)->recv(); - ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SCGIhandle_respond" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (int)(arg1)->respond(arg2); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; XSRETURN(argvi); fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; SWIG_croak_null(); } } @@ -2154,8 +2232,10 @@ static swig_command_info swig_commands[] = { {"FSSCGIc::SCGIhandle_disconnect", _wrap_SCGIhandle_disconnect}, {"FSSCGIc::SCGIhandle_addParam", _wrap_SCGIhandle_addParam}, {"FSSCGIc::SCGIhandle_addBody", _wrap_SCGIhandle_addBody}, +{"FSSCGIc::SCGIhandle_getBody", _wrap_SCGIhandle_getBody}, +{"FSSCGIc::SCGIhandle_getParam", _wrap_SCGIhandle_getParam}, {"FSSCGIc::SCGIhandle_sendRequest", _wrap_SCGIhandle_sendRequest}, -{"FSSCGIc::SCGIhandle_recv", _wrap_SCGIhandle_recv}, +{"FSSCGIc::SCGIhandle_respond", _wrap_SCGIhandle_respond}, {"FSSCGIc::SCGIhandle_bind", _wrap_SCGIhandle_bind}, {"FSSCGIc::SCGIhandle_accept", _wrap_SCGIhandle_accept}, {0,0} diff --git a/libs/libscgi/perl/testclient.pl b/libs/libscgi/perl/testclient.pl new file mode 100644 index 0000000000..59415baf72 --- /dev/null +++ b/libs/libscgi/perl/testclient.pl @@ -0,0 +1,19 @@ +use FSSCGI; + + +my $handle = new FSSCGI::SCGIhandle(); + + $handle->addParam( "REQUEST_METHOD", "POST"); + $handle->addParam( "REQUEST_URI", "/deepthought"); + $handle->addParam( "TESTING", "TRUE"); + $handle->addParam( "TESTING", "TRUE"); + $handle->addBody("What is the answer to life?"); + + + +if ((my $response = $handle->sendRequest("127.0.0.1", 7777, 10000))) { + print "RESP[$response]\n"; +} else { + print "ERROR!\n"; +} + diff --git a/libs/libscgi/perl/testserver.pl b/libs/libscgi/perl/testserver.pl new file mode 100644 index 0000000000..6e03d5c5e4 --- /dev/null +++ b/libs/libscgi/perl/testserver.pl @@ -0,0 +1,17 @@ +use FSSCGI; + + +my $handle = new FSSCGI::SCGIhandle(); + +if ($handle->bind("127.0.0.1", 7777)) { + + while($handle->accept()) { + print "REQ: " . $handle->getBody(). "\n\n"; + $handle->respond("W00t!!!!!!\n"); + } + + print "DONE\n"; + +} else { + print "FAIL\n"; +} diff --git a/libs/libscgi/src/include/scgi.h b/libs/libscgi/src/include/scgi.h index 8a789a3a9f..b6a5165858 100644 --- a/libs/libscgi/src/include/scgi.h +++ b/libs/libscgi/src/include/scgi.h @@ -183,6 +183,7 @@ typedef void (*scgi_listen_callback_t)(scgi_socket_t server_sock, scgi_socket_t SCGI_DECLARE(scgi_status_t) scgi_connect(scgi_handle_t *handle, const char *host, scgi_port_t port, uint32_t timeout); SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle); +SCGI_DECLARE(scgi_status_t) scgi_parse(scgi_socket_t sock, scgi_handle_t *handle); SCGI_DECLARE(int) scgi_wait_sock(scgi_socket_t sock, uint32_t ms, scgi_poll_t flags); SCGI_DECLARE(ssize_t) scgi_recv(scgi_handle_t *handle, unsigned char *buf, size_t buflen); SCGI_DECLARE(scgi_status_t) scgi_send_request(scgi_handle_t *handle); @@ -196,6 +197,10 @@ SCGI_DECLARE(const char *) scgi_get_param(scgi_handle_t *handle, const char *nam SCGI_DECLARE(scgi_status_t) scgi_bind(const char *host, scgi_port_t port, scgi_socket_t *socketp); SCGI_DECLARE(scgi_status_t) scgi_accept(scgi_socket_t server_sock, scgi_socket_t *client_sock_p, struct sockaddr_in *echoClntAddr); +#ifndef WIN32 +#define closesocket(x) shutdown(x, 2); close(x) +#endif + #ifdef __cplusplus } #endif /* defined(__cplusplus) */ diff --git a/libs/libscgi/src/include/scgi_oop.h b/libs/libscgi/src/include/scgi_oop.h index a49c96cdd1..64f3267779 100644 --- a/libs/libscgi/src/include/scgi_oop.h +++ b/libs/libscgi/src/include/scgi_oop.h @@ -45,8 +45,12 @@ extern "C" { class SCGIhandle { private: + scgi_socket_t server_sock; scgi_handle_t handle; unsigned char buf[65536]; + char *data_buf; + int buflen; + int bufsize; public: SCGIhandle(); virtual ~SCGIhandle(); @@ -55,8 +59,10 @@ class SCGIhandle { int disconnect(void); int addParam(const char *name, const char *value); int addBody(const char *value); - int sendRequest(const char *host, int port, int timeout); - char *recv(); + char *getBody(); + char *getParam(const char *name); + char *sendRequest(const char *host, int port, int timeout); + int respond(char *msg); int bind(const char *host, int port); int accept(void); }; diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index f33afe30c8..9f8e9956e0 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -34,7 +34,6 @@ #include #ifndef WIN32 -#define closesocket(x) shutdown(x, 2); close(x) #include #include #else @@ -385,11 +384,9 @@ SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle) return SCGI_FAIL; } - handle->destroyed = 1; - handle->connected = 0; - - scgi_destroy_params(handle); - scgi_safe_free(handle->body); + if (!handle->sock) { + abort(); + } if (handle->sock != SCGI_SOCK_INVALID) { closesocket(handle->sock); @@ -397,6 +394,12 @@ SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle) status = SCGI_SUCCESS; } + handle->destroyed = 1; + handle->connected = 0; + + scgi_destroy_params(handle); + scgi_safe_free(handle->body); + return status; } @@ -577,9 +580,11 @@ SCGI_DECLARE(scgi_status_t) scgi_bind(const char *host, scgi_port_t port, scgi_s end: - if (server_sock != SCGI_SOCK_INVALID) { - closesocket(server_sock); - server_sock = SCGI_SOCK_INVALID; + if (status == SCGI_FAIL) { + if (server_sock != SCGI_SOCK_INVALID) { + closesocket(server_sock); + server_sock = SCGI_SOCK_INVALID; + } } else { *socketp = server_sock; } @@ -601,11 +606,11 @@ SCGI_DECLARE(scgi_status_t) scgi_accept(scgi_socket_t server_sock, scgi_socket_t if (!echoClntAddr) { echoClntAddr = &local_echoClntAddr; } - - + clntLen = sizeof(*echoClntAddr); if ((client_sock = accept(server_sock, (struct sockaddr *) echoClntAddr, &clntLen)) == SCGI_SOCK_INVALID) { + printf("FRICK %s\n", strerror(errno)); status = SCGI_FAIL; } else { *client_sock_p = client_sock; @@ -652,10 +657,12 @@ SCGI_DECLARE(scgi_status_t) scgi_parse(scgi_socket_t sock, scgi_handle_t *handle char *body = NULL; char comma = 0; + memset(handle, 0, sizeof(*handle)); + handle->sock = sock; + handle->connected = 1; sock_setup(handle); - for(;;) { diff --git a/libs/libscgi/src/scgi_oop.cpp b/libs/libscgi/src/scgi_oop.cpp index c5b98334b9..4001b748a3 100644 --- a/libs/libscgi/src/scgi_oop.cpp +++ b/libs/libscgi/src/scgi_oop.cpp @@ -12,9 +12,12 @@ SCGIhandle::SCGIhandle(void) SCGIhandle::~SCGIhandle() { - if (handle.connected) { - scgi_disconnect(&handle); - } + + scgi_disconnect(&handle); + scgi_safe_free(data_buf); + buflen = 0; + bufsize = 0; + } int SCGIhandle::socketDescriptor() @@ -29,11 +32,7 @@ int SCGIhandle::socketDescriptor() int SCGIhandle::disconnect() { - if (handle.connected) { - return scgi_disconnect(&handle); - } - - return 0; + return scgi_disconnect(&handle); } int SCGIhandle::connected() @@ -51,11 +50,22 @@ int SCGIhandle::addBody(const char *value) return (int) scgi_add_body(&handle, value); } - -int SCGIhandle::sendRequest(const char *host, int port, int timeout) +char *SCGIhandle::getBody() { + return handle.body; +} + +char *SCGIhandle::getParam(const char *name) +{ + return (char *) scgi_get_param(&handle, name); +} + +char *SCGIhandle::sendRequest(const char *host, int port, int timeout) +{ + ssize_t len; + if (!host) { - return -2; + return 0; } if (timeout < 1000) { @@ -63,27 +73,30 @@ int SCGIhandle::sendRequest(const char *host, int port, int timeout) } if (scgi_connect(&handle, host, port, timeout) == SCGI_SUCCESS) { - return (int) scgi_send_request(&handle); + if (scgi_send_request(&handle) == SCGI_SUCCESS) { + while((len = scgi_recv(&handle, buf, sizeof(buf))) > 0) { + if (buflen + len > bufsize) { + bufsize = buflen + len + 1024; + void *tmp = realloc(data_buf, bufsize); + assert(tmp); + data_buf = (char *)tmp; + + *(data_buf+buflen) = '\0'; + } + snprintf(data_buf+buflen, bufsize-buflen, "%s", buf); + buflen += len; + } + + return data_buf; + } } - return -2; + return (char *) ""; } -char *SCGIhandle::recv(void) -{ - ssize_t len = scgi_recv(&handle, buf, sizeof(buf)); - - if (len > 0) { - return (char *)buf; - } - - return NULL; -} - - int SCGIhandle::bind(const char *host, int port) { - return (int) scgi_bind(host, port, &handle.sock); + return (scgi_bind(host, port, &server_sock) == SCGI_SUCCESS) ? 1 : 0; } @@ -91,11 +104,24 @@ int SCGIhandle::accept(void) { scgi_socket_t client_sock; - if (scgi_accept(handle.sock, &client_sock, NULL) == SCGI_SUCCESS) { - return (int) client_sock; + if (scgi_accept(server_sock, &client_sock, NULL) == SCGI_SUCCESS) { + if (scgi_parse(client_sock, &handle) == SCGI_SUCCESS) { + return 1; + } + + closesocket(client_sock); } - return -1; + return 0; } +int SCGIhandle::respond(char *msg) +{ + int b = write(handle.sock, msg, strlen(msg)); + scgi_disconnect(&handle); + scgi_safe_free(data_buf); + buflen = 0; + bufsize = 0; + return b; +} diff --git a/libs/libscgi/testserver.c b/libs/libscgi/testserver.c index 2a784e83a8..153a215c0e 100644 --- a/libs/libscgi/testserver.c +++ b/libs/libscgi/testserver.c @@ -4,7 +4,7 @@ static void callback(scgi_socket_t server_sock, scgi_socket_t *client_sock, stru { scgi_handle_t handle = { 0 }; - if (scgi_parse(client_sock, &handle) == SCGI_SUCCESS) { + if (scgi_parse(*client_sock, &handle) == SCGI_SUCCESS) { scgi_param_t *pp; *client_sock = SCGI_SOCK_INVALID; From 0a70ea3e09f36f62651b2a9a83e5b8d1847ad8a6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 May 2012 13:12:32 -0500 Subject: [PATCH 0366/1057] scgi updates --- libs/libscgi/src/include/scgi.h | 2 +- libs/libscgi/src/scgi.c | 4 ---- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libs/libscgi/src/include/scgi.h b/libs/libscgi/src/include/scgi.h index b6a5165858..575a45f7f9 100644 --- a/libs/libscgi/src/include/scgi.h +++ b/libs/libscgi/src/include/scgi.h @@ -198,7 +198,7 @@ SCGI_DECLARE(scgi_status_t) scgi_bind(const char *host, scgi_port_t port, scgi_s SCGI_DECLARE(scgi_status_t) scgi_accept(scgi_socket_t server_sock, scgi_socket_t *client_sock_p, struct sockaddr_in *echoClntAddr); #ifndef WIN32 -#define closesocket(x) shutdown(x, 2); close(x) +#define closesocket(x) close(x) #endif #ifdef __cplusplus diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index 9f8e9956e0..df05b5980b 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -384,10 +384,6 @@ SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle) return SCGI_FAIL; } - if (!handle->sock) { - abort(); - } - if (handle->sock != SCGI_SOCK_INVALID) { closesocket(handle->sock); handle->sock = SCGI_SOCK_INVALID; diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 97b6bdcf0a..6ee62d6ac9 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -145,7 +145,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con scgi_disconnect(&handle); - if (len < 0) { + if (len < 0 && (!txt || !strlen(txt))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s Connection Read Failed: [%s]\n", binding->url, handle.err); goto end; } From 6df4d7cdc50531254a40392b23a499cbbe4d137a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 May 2012 13:13:32 -0500 Subject: [PATCH 0367/1057] FS-4245 --resolve --- src/switch_core_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index 3a93632338..38a066b020 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -646,7 +646,7 @@ switch_memory_pool_t *switch_core_memory_init(void) switch_queue_create(&memory_manager.pool_recycle_queue, 50000, memory_manager.memory_pool); switch_threadattr_create(&thd_attr, memory_manager.memory_pool); - switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_detach_set(thd_attr, 0); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_thread_create(&pool_thread_p, thd_attr, pool_thread, NULL, memory_manager.memory_pool); From 11d4658ac4c801f790e606c0993652045075fff9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 23 May 2012 21:28:03 +0000 Subject: [PATCH 0368/1057] debian: package mod_say_fa (Say for Persian) --- debian/control-modules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debian/control-modules b/debian/control-modules index e229b86fc7..5b76bd5d26 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -572,6 +572,10 @@ Module: say/mod_say_es Description: mod_say_es Adds mod_say_es. +Module: say/mod_say_fa +Description: mod_say_fa + Adds mod_say_fa. + Module: say/mod_say_fr Description: mod_say_fr Adds mod_say_fr. From cb58e81c17b2f4c2b3ff0cfad92c0a7c06c81c6a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 23 May 2012 05:20:13 +0000 Subject: [PATCH 0369/1057] add editor variables to mod_sofia.h --- src/mod/endpoints/mod_sofia/mod_sofia.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5902cdad93..f6e4c1122e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1179,3 +1179,15 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool); void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now); void sofia_msg_thread_start(int idx); + + +/* 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: + */ From 16cf43a68d080139d01acba48f6048da185df9fb Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 2 May 2012 07:42:16 +0000 Subject: [PATCH 0370/1057] fix indentation; whitespace --- src/mod/endpoints/mod_sofia/sofia.c | 39 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8a1409bb27..e5d026975d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6409,31 +6409,30 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_core_session_rwunlock(other_session); } } else { - uint8_t match = 0; - int is_ok = 1; + uint8_t match = 0; + int is_ok = 1; + if (tech_pvt->num_codecs) { + match = sofia_glue_negotiate_sdp(session, r_sdp); + } - if (tech_pvt->num_codecs) { - match = sofia_glue_negotiate_sdp(session, r_sdp); - } - - if (match) { - sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE); - if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Error!\n"); - switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RTP ERROR"); + if (match) { + sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE); + if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Error!\n"); + switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RTP ERROR"); + is_ok = 0; + } + sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE); + } else { + switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); is_ok = 0; } - sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE); - } else { - switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); - is_ok = 0; - } - if (!is_ok) { - nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); - switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); - } + if (!is_ok) { + nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); + } } goto done; } From 0c1a95f745dda29d26103575d92bf8bb46a8e19d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 00:44:32 +0000 Subject: [PATCH 0371/1057] fix gcc 4.7.0 warning related to enum type This amends commit 7bd9efc7f52a725b7ef9efb64b65873b4bc4330b. We changed away from using unsigned here because it caused a warning on Windows. Using the more specific type, however, is causing a warning on gcc-4.7 (it notices that the switch statement contains values not present in the specified enum type). So we're switching back to unsigned here while keeping the type casts and hoping that keeps Windows happy. --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index be7f180fcd..4de962a31c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -692,7 +692,7 @@ static int zrtp_send_rtp_callback(const zrtp_stream_t *stream, char *rtp_packet, return status; } -static void zrtp_event_callback(zrtp_stream_t *stream, zrtp_security_event_t event) +static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event) { switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream); zrtp_session_info_t zrtp_session_info; From 236b927780c8ebd05f35381f651c7acc6406b7d8 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 03:50:42 +0000 Subject: [PATCH 0372/1057] lower log level on ZRTP protection drop When a call is being setup, a couple seconds of audio may be sent unencrypted. This seems to trigger the log message here with every such packet. --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 4de962a31c..92c580664e 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3972,7 +3972,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, case zrtp_status_ok: break; case zrtp_status_drop: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error: zRTP protection drop with code %d\n", stat); ret = (int) bytes; goto end; break; From d470ae239cfb5fdf6df81efc2f1b9290690ae070 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 03:52:51 +0000 Subject: [PATCH 0373/1057] don't log ZRTP protection drops At least until we can distinguish the meaningful ones from the noise. --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 92c580664e..c91175a108 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3972,7 +3972,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, case zrtp_status_ok: break; case zrtp_status_drop: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error: zRTP protection drop with code %d\n", stat); + /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error: zRTP protection drop with code %d\n", stat); */ ret = (int) bytes; goto end; break; From f37b1f0c54e8e3e8bb9cc9a276fe743fa95357c9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 03:58:26 +0000 Subject: [PATCH 0374/1057] squelch another source of noise ZRTP protection drops --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c91175a108..1c243e1b80 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2656,7 +2656,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = sbytes; break; case zrtp_status_drop: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); + /* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error: zRTP protection drop with code %d\n", stat); */ *bytes = 0; return SWITCH_STATUS_SUCCESS; case zrtp_status_fail: From fbcb86226581cdcc66fc7b633b505906c207a4cd Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 09:35:23 +0200 Subject: [PATCH 0375/1057] add thread safe hash multi delete function and make callback optional --- src/include/switch_core.h | 22 +++++++++++++++++++++- src/switch_core_hash.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 9803c6708b..6e67989b90 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1277,7 +1277,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_ \brief Delete data from a hash based on desired key \param hash the hash to delete from \param key the key from which to delete the data - \param mutex optional rwlock to wrlock + \param rwlock optional rwlock to wrlock \return SWITCH_STATUS_SUCCESS if the data is deleted */ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_wrlock(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_thread_rwlock_t *rwlock); @@ -1290,6 +1290,26 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_wrlock(_In_ switch_hash_ */ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(_In_ switch_hash_t *hash, _In_ switch_hash_delete_callback_t callback, _In_opt_ void *pData); +/*! + \brief Delete data from a hash based on callback function + \param hash the hash to delete from + \param callback the function to call which returns SWITCH_TRUE to delete, SWITCH_FALSE to preserve + \param rwlock optional rwlock to wrlock + \return SWITCH_STATUS_SUCCESS if any data is deleted +*/ + +SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi_wrlock(_In_ switch_hash_t *hash, _In_ switch_hash_delete_callback_t callback, _In_opt_ void *pData, _In_ switch_thread_rwlock_t *rwlock); + +/*! + \brief Delete data from a hash based on callback function + \param hash the hash to delete from + \param callback the function to call which returns SWITCH_TRUE to delete, SWITCH_FALSE to preserve + \param mutex optional mutex to lock + \return SWITCH_STATUS_SUCCESS if any data is deleted +*/ + +SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi_locked(_In_ switch_hash_t *hash, _In_ switch_hash_delete_callback_t callback, _In_opt_ void *pData, _In_ switch_mutex_t *mutex); + /*! \brief Retrieve data from a given hash \param hash the hash to retrieve from diff --git a/src/switch_core_hash.c b/src/switch_core_hash.c index 4ac3d2620e..ed5c4c2ca4 100644 --- a/src/switch_core_hash.c +++ b/src/switch_core_hash.c @@ -157,7 +157,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *has switch_event_create_subclass(&event, SWITCH_EVENT_CLONE, NULL); switch_assert(event); - /* iterate through the hash, call callback, if callback returns true, put the key on the list (event) + /* iterate through the hash, call callback, if callback is NULL or returns true, put the key on the list (event) When done, iterate through the list deleting hash entries */ @@ -165,7 +165,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *has const void *key; void *val; switch_hash_this(hi, &key, NULL, &val); - if (callback(key, val, pData)) { + if (!callback || callback(key, val, pData)) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delete", (const char *) key); } } @@ -182,6 +182,40 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(switch_hash_t *has return status; } +SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi_wrlock(switch_hash_t *hash, switch_hash_delete_callback_t callback, void *pData, switch_thread_rwlock_t *rwlock) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + if (rwlock) { + switch_thread_rwlock_wrlock(rwlock); + } + + status = switch_core_hash_delete_multi(hash, callback, pData); + + if (rwlock) { + switch_thread_rwlock_unlock(rwlock); + } + + return status; +} + +SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi_locked(switch_hash_t *hash, switch_hash_delete_callback_t callback, void *pData, switch_mutex_t *mutex) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + if (mutex) { + switch_mutex_lock(mutex); + } + + status = switch_core_hash_delete_multi(hash, callback, pData); + + if (mutex) { + switch_mutex_unlock(mutex); + } + + return status; +} + SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t *hash, const char *key) { From 8f4c5bc49240e69c938644a7da4b1632e74d9e95 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 09:37:41 +0200 Subject: [PATCH 0376/1057] add Andrew's patch from FS-3432 as a starting point with todo markers --- .../mod_erlang_event/handle_msg.c | 59 +++--- .../mod_erlang_event/mod_erlang_event.c | 195 +++++++++++++----- .../mod_erlang_event/mod_erlang_event.h | 4 +- 3 files changed, 187 insertions(+), 71 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 46e9e67e85..0b083cd0c0 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -286,6 +286,7 @@ static switch_status_t handle_msg_event(listener_t *listener, int arity, ei_x_bu switch_set_flag_locked(listener, LFLAG_EVENTS); } + /* TODO - listener write lock */ for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { @@ -335,6 +336,7 @@ static switch_status_t handle_msg_session_event(listener_t *listener, erlang_msg for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { + /* TODO session write locking */ if (custom) { switch_core_hash_insert(session->event_hash, atom, MARKER); } else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) { @@ -380,10 +382,12 @@ static switch_status_t handle_msg_nixevent(listener_t *listener, int arity, ei_x int i = 0; switch_event_types_t type; + /* TODO listener write lock */ for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { if (custom) { + switch_core_hash_delete(listener->event_hash, atom); } else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) { uint32_t x = 0; @@ -426,6 +430,7 @@ static switch_status_t handle_msg_session_nixevent(listener_t *listener, erlang_ int i = 0; switch_event_types_t type; + /* TODO session write lock */ for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { @@ -480,6 +485,8 @@ static switch_status_t handle_msg_setevent(listener_t *listener, erlang_msg *msg switch_event_types_t type; int i = 0; + /* TODO listener write lock */ + /* clear any previous event registrations */ for( x = 0; x <= SWITCH_EVENT_ALL; x++){ event_list[x] = 0; @@ -517,6 +524,7 @@ static switch_status_t handle_msg_setevent(listener_t *listener, erlang_msg *msg /* update the event subscriptions with the new ones */ memcpy(listener->event_list, event_list, sizeof(uint8_t) * (SWITCH_EVENT_ALL + 1)); /* wipe the old hash, and point the pointer at the new one */ + /* TODO make thread safe */ switch_core_hash_destroy(&listener->event_hash); listener->event_hash = event_hash; @@ -544,12 +552,14 @@ static switch_status_t handle_msg_session_setevent(listener_t *listener, erlang_ switch_event_types_t type; uint32_t x = 0; + /* TODO session write lock */ /* clear any previous event registrations */ for (x = 0; x <= SWITCH_EVENT_ALL; x++){ event_list[x] = 0; } /* create new hash */ + /* TODO make thread safe*/ switch_core_hash_init(&event_hash, session->pool); for (i = 1; i < arity; i++){ @@ -576,6 +586,7 @@ static switch_status_t handle_msg_session_setevent(listener_t *listener, erlang_ /* update the event subscriptions with the new ones */ memcpy(session->event_list, event_list, sizeof(uint8_t) * (SWITCH_EVENT_ALL + 1)); /* wipe the old hash, and point the pointer at the new one */ + /* TODO make thread safe*/ switch_core_hash_destroy(&session->event_hash); session->event_hash = event_hash; /* TODO - we should flush any non-matching events from the queue */ @@ -601,13 +612,13 @@ static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, in fail = SWITCH_TRUE; } - ei_get_type(buf->buff, &buf->index, &type, &size); + ei_get_type(buf->buff, &buf->index, &type, &size); if ((size > (sizeof(api_cmd) - 1)) || ei_decode_atom(buf->buff, &buf->index, api_cmd)) { fail = SWITCH_TRUE; } - ei_get_type(buf->buff, &buf->index, &type, &size); + ei_get_type(buf->buff, &buf->index, &type, &size); arg = malloc(size + 1); if (ei_decode_string(buf->buff, &buf->index, arg)) { @@ -706,29 +717,29 @@ static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_ while (!ei_decode_tuple_header(buf->buff, &buf->index, &arity) && arity == 2) { i++; - ei_get_type(buf->buff, &buf->index, &type, &size); + ei_get_type(buf->buff, &buf->index, &type, &size); if ((size > (sizeof(key) - 1)) || ei_decode_string(buf->buff, &buf->index, key)) { fail = SWITCH_TRUE; break; } - ei_get_type(buf->buff, &buf->index, &type, &size); - value = malloc(size + 1); + ei_get_type(buf->buff, &buf->index, &type, &size); + value = malloc(size + 1); if (ei_decode_string(buf->buff, &buf->index, value)) { fail = SWITCH_TRUE; break; } - if (!fail && !strcmp(key, "body")) { - switch_safe_free(event->body); - event->body = value; - } else if (!fail) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); - } - - /* Do not free malloc here! The above commands utilize the raw allocated memory and skip any copying/duplication. Faster. */ + if (!fail && !strcmp(key, "body")) { + switch_safe_free(event->body); + event->body = value; + } else if (!fail) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); + } + + /* Do not free malloc here! The above commands utilize the raw allocated memory and skip any copying/duplication. Faster. */ } if (headerlength != i || fail) { @@ -763,22 +774,22 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_ char key[1024]; char *value; - int type; - int size; + int type; + int size; int i = 0; switch_bool_t fail = SWITCH_FALSE; while (!ei_decode_tuple_header(buf->buff, &buf->index, &arity) && arity == 2) { i++; - ei_get_type(buf->buff, &buf->index, &type, &size); + ei_get_type(buf->buff, &buf->index, &type, &size); if ((size > (sizeof(key) - 1)) || ei_decode_string(buf->buff, &buf->index, key)) { fail = SWITCH_TRUE; break; } - - ei_get_type(buf->buff, &buf->index, &type, &size); - value = malloc(size + 1); + + ei_get_type(buf->buff, &buf->index, &type, &size); + value = malloc(size + 1); if (ei_decode_string(buf->buff, &buf->index, value)) { fail = SWITCH_TRUE; @@ -786,7 +797,7 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_ } if (!fail) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); } } @@ -1024,6 +1035,7 @@ static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, e listener->event_list[x] = 0; } /* wipe the hash */ + /* TODO make thread safe*/ switch_core_hash_destroy(&listener->event_hash); switch_core_hash_init(&listener->event_hash, listener->pool); ei_x_encode_atom(rbuf, "ok"); @@ -1044,6 +1056,7 @@ static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, e session->event_list[x] = 0; } /* wipe the hash */ + /* TODO make thread safe*/ switch_core_hash_destroy(&session->event_hash); switch_core_hash_init(&session->event_hash, session->pool); ei_x_encode_atom(rbuf, "ok"); @@ -1240,6 +1253,7 @@ int handle_msg(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buf buf->index = 0; ei_decode_version(buf->buff, &buf->index, &version); ei_get_type(buf->buff, &buf->index, &type, &size); + switch (type) { case ERL_SMALL_TUPLE_EXT: case ERL_LARGE_TUPLE_EXT: @@ -1288,11 +1302,8 @@ int handle_msg(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buf #ifdef EI_DEBUG ei_x_print_msg(rbuf, &msg->from, 1); #endif + return SWITCH_STATUS_SUCCESS != ret; - if (SWITCH_STATUS_SUCCESS == ret) - return 0; - else /* SWITCH_STATUS_TERM */ - return 1; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Empty reply, supressing\n"); return 0; diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 12cf01a650..cfa1d63115 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -59,6 +59,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l switch_thread_rwlock_rdlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { + /* TODO listener read lock */ if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) { switch_log_node_t *dnode = switch_log_node_dup(node); @@ -131,9 +132,10 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t return; } + switch_thread_rwlock_rdlock(listener->session_rwlock); s = (session_elem_t*)switch_core_hash_find(listener->sessions, uuid); - switch_thread_rwlock_unlock(listener->session_rwlock); + /* TODO - we don't need to hold the lock, we need to lock the session */ if (s) { int send = 0; @@ -162,6 +164,7 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t switch_event_name(event->event_id), s->uuid_str); } } + switch_thread_rwlock_unlock(listener->session_rwlock); } static void event_handler(switch_event_t *event) @@ -175,9 +178,10 @@ static void event_handler(switch_event_t *event) return; } + switch_thread_rwlock_rdlock(globals.listener_rwlock); + lp = listen_list.listeners; - switch_thread_rwlock_rdlock(globals.listener_rwlock); while (lp) { uint8_t send = 0; @@ -188,6 +192,8 @@ static void event_handler(switch_event_t *event) one of them should receive the event as well */ + /* TODO need read locking */ + send_event_to_attached_sessions(l, event); if (!switch_test_flag(l, LFLAG_EVENTS)) { @@ -249,21 +255,21 @@ static void close_socket(int *sock) } -static void add_listener(listener_t *listener) -{ +/*static void add_listener(listener_t *listener)*/ +/*{*/ /* add me to the listeners so I get events */ - switch_thread_rwlock_wrlock(globals.listener_rwlock); - listener->next = listen_list.listeners; - listen_list.listeners = listener; - switch_thread_rwlock_unlock(globals.listener_rwlock); -} + /*switch_thread_rwlock_wrlock(globals.listener_rwlock);*/ + /*listener->next = listen_list.listeners;*/ + /*listen_list.listeners = listener;*/ + /*switch_thread_rwlock_unlock(globals.listener_rwlock);*/ +/*}*/ +/* TODO lock */ static void remove_listener(listener_t *listener) { listener_t *l, *last = NULL; - switch_thread_rwlock_wrlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (l == listener) { if (last) { @@ -274,7 +280,6 @@ static void remove_listener(listener_t *listener) } last = l; } - switch_thread_rwlock_unlock(globals.listener_rwlock); } /* Search for a listener already talking to the specified node */ @@ -285,6 +290,7 @@ static listener_t *find_listener(char *nodename) switch_thread_rwlock_rdlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (!strncmp(nodename, l->peer_nodename, MAXNODELEN)) { + /* TODO listener rwlock */ break; } } @@ -301,11 +307,19 @@ static void add_session_elem_to_listener(listener_t *listener, session_elem_t *s } +/* TODO lock */ static void remove_session_elem_from_listener(listener_t *listener, session_elem_t *session_element) { switch_core_hash_delete(listener->sessions, session_element->uuid_str); } +static void remove_session_elem_from_listener_locked(listener_t *listener, session_elem_t *session_element) +{ + switch_thread_rwlock_wrlock(listener->session_rwlock); + remove_session_elem_from_listener(listener, session_element); + switch_thread_rwlock_unlock(listener->session_rwlock); +} + static void destroy_session_elem(session_elem_t *session_element) { switch_core_session_t *session; @@ -315,16 +329,10 @@ static void destroy_session_elem(session_elem_t *session_element) switch_core_session_rwunlock(session); } switch_core_destroy_memory_pool(&session_element->pool); + session_element = NULL; /*switch_safe_free(s); */ } -static void remove_session_elem_from_listener_locked(listener_t *listener, session_elem_t *session_element) -{ - switch_thread_rwlock_wrlock(listener->session_rwlock); - remove_session_elem_from_listener(listener, session_element); - switch_thread_rwlock_unlock(listener->session_rwlock); -} - session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid) { @@ -362,6 +370,7 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c switch_xml_t xml = NULL; ei_x_buff *rep; ei_x_buff buf; + ei_x_new_with_version(&buf); switch_uuid_get(&uuid); @@ -403,6 +412,7 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c /* Create a new fetch object. */ p = malloc(sizeof(*p)); switch_thread_cond_create(&p->ready_or_found, module_pool); + /* TODO module pool */ switch_mutex_init(&p->mutex, SWITCH_MUTEX_UNNESTED, module_pool); p->state = reply_not_ready; p->reply = NULL; @@ -430,8 +440,7 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c /* Tell the threads to be ready, and wait five seconds for a reply. */ switch_mutex_lock(p->mutex); //p->state = reply_waiting; - switch_thread_cond_timedwait(p->ready_or_found, - p->mutex, 5000000); + switch_thread_cond_timedwait(p->ready_or_found, p->mutex, 5000000); if (!p->reply) { p->state = reply_timeout; switch_mutex_unlock(p->mutex); @@ -516,6 +525,7 @@ static switch_status_t notify_new_session(listener_t *listener, session_elem_t * switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event); switch_channel_event_set_data(channel, call_event); switch_core_session_rwunlock(session); + /* TODO reply? sure? */ switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply"); switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n"); @@ -551,6 +561,7 @@ static switch_status_t check_attached_sessions(listener_t *listener) /* event used to track sessions to remove */ switch_event_t *event = NULL; switch_event_header_t *header = NULL; + switch_event_create_subclass(&event, SWITCH_EVENT_CLONE, NULL); switch_assert(event); /* check up on all the attached sessions - @@ -558,6 +569,8 @@ static switch_status_t check_attached_sessions(listener_t *listener) if they have pending events in their queues then send them if the session has finished then clean it up */ + + /* TODO try to minimize critical section */ switch_thread_rwlock_rdlock(listener->session_rwlock); for (iter = switch_hash_first(NULL, listener->sessions); iter; iter = switch_hash_next(iter)) { switch_hash_this(iter, &key, NULL, &value); @@ -643,6 +656,8 @@ static switch_status_t check_attached_sessions(listener_t *listener) /* release the read lock and get a write lock */ switch_thread_rwlock_wrlock(listener->session_rwlock); /* do the deferred remove */ + + /* TODO refactor find_session_elem_by_uuid*/ for (header = event->headers; header; header = header->next) { if ((sp = (session_elem_t*)switch_core_hash_find(listener->sessions, header->value))) { remove_session_elem_from_listener(listener, sp); @@ -762,6 +777,7 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) switch_core_session_rwunlock(session); } /* TODO - if a spawned process that was handling an outbound call fails.. what do we do with the call? */ + /* TODO hangup and let the state handler set the complete flag and destroy as usual*/ } remove_session_elem_from_listener_locked(listener, s); destroy_session_elem(s); @@ -772,6 +788,7 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Log handler process for node %s exited\n", pid->node); /*purge the log queue */ + /* TODO don't we want to clear flag first? */ while (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) { switch_log_node_t *dnode = (switch_log_node_t *) pop; switch_log_node_free(&dnode); @@ -787,6 +804,7 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Event handler process for node %s exited\n", pid->node); /*purge the event queue */ + /* TODO don't we want to clear flag first? */ while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) { switch_event_t *pevent = (switch_event_t *) pop; switch_event_destroy(&pevent); @@ -795,10 +813,13 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) if (switch_test_flag(listener, LFLAG_EVENTS)) { uint8_t x = 0; switch_clear_flag_locked(listener, LFLAG_EVENTS); + for (x = 0; x <= SWITCH_EVENT_ALL; x++) { listener->event_list[x] = 0; } /* wipe the hash */ + /* XXX this needs to be locked */ + /* TODO switch_core_hash_delete_multi_locked */ switch_core_hash_destroy(&listener->event_hash); switch_core_hash_init(&listener->event_hash, listener->pool); } @@ -865,7 +886,16 @@ static void listener_main_loop(listener_t *listener) case ERL_EXIT: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit from %s <%d.%d.%d>\n", msg.from.node, msg.from.creation, msg.from.num, msg.from.serial); - handle_exit(listener, &msg.from); + + switch_thread_rwlock_rdlock(globals.listener_rwlock); + if (listener) { + /* get the listener lock */ + switch_thread_rwlock_wrlock(listener->rwlock); + /* wipe event hash */ + handle_exit(listener, &msg.from); + switch_thread_rwlock_unlock(listener->rwlock); + } + switch_thread_rwlock_unlock(globals.listener_rwlock); break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected msg type %d\n", (int) (msg.msgtype)); @@ -874,7 +904,7 @@ static void listener_main_loop(listener_t *listener) break; case ERL_ERROR: if (erl_errno != ETIMEDOUT && erl_errno != EAGAIN) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_error\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "erl_error: status=%d, erl_errno=%d errno=%d\n", status, erl_errno, errno); } break; default: @@ -892,6 +922,11 @@ static void listener_main_loop(listener_t *listener) return; } } + if (prefs.done) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "shutting down listener\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "listener exit: status=%d, erl_errno=%d errno=%d\n", status, erl_errno, errno); + } } static switch_bool_t check_inbound_acl(listener_t *listener) @@ -941,7 +976,7 @@ static switch_bool_t check_inbound_acl(listener_t *listener) static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) { listener_t *listener = (listener_t *) obj; - session_elem_t *s; + session_elem_t *s = NULL; const void *key; void *value; switch_hash_index_t *iter; @@ -959,24 +994,29 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s\n", listener->remote_ip); /*, listener->remote_port); */ } - add_listener(listener); + /*add_listener(listener);*/ listener_main_loop(listener); } /* clean up */ - remove_listener(listener); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n"); + listener->dead = 1; /* mark it as dead */ + + /* TODO - release write lock */ + switch_thread_rwlock_wrlock(globals.listener_rwlock); + remove_listener(listener); + switch_thread_rwlock_unlock(globals.listener_rwlock); + switch_thread_rwlock_wrlock(listener->rwlock); if (listener->sockfd) { close_socket(&listener->sockfd); } - switch_thread_rwlock_unlock(listener->rwlock); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Closed\n"); + /* TODO make listener destroy function and move there */ switch_core_hash_destroy(&listener->event_hash); /* remove any bindings for this connection */ @@ -987,9 +1027,12 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) for (iter = switch_hash_first(NULL, listener->sessions); iter; iter = switch_hash_next(iter)) { switch_hash_this(iter, &key, NULL, &value); s = (session_elem_t*)value; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Orphaning call %s\n", s->uuid_str); + remove_session_elem_from_listener(listener, s); destroy_session_elem(s); } switch_thread_rwlock_unlock(listener->session_rwlock); + switch_thread_rwlock_unlock(listener->rwlock); if (listener->pool) { switch_memory_pool_t *pool = listener->pool; @@ -1156,30 +1199,31 @@ static int config(void) return 0; } - static listener_t *new_listener(struct ei_cnode_s *ec, int clientfd) { - switch_memory_pool_t *listener_pool = NULL; + switch_memory_pool_t *pool = NULL; listener_t *listener = NULL; - if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) { + if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n"); return NULL; } - if (!(listener = switch_core_alloc(listener_pool, sizeof(*listener)))) { + if (!(listener = switch_core_alloc(pool, sizeof(*listener)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n"); + switch_core_destroy_memory_pool(&pool); return NULL; } memset(listener, 0, sizeof(*listener)); - switch_thread_rwlock_create(&listener->rwlock, listener_pool); - switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, listener_pool); - switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, listener_pool); + switch_thread_rwlock_create(&listener->rwlock, pool); + switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, pool); + switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, pool); + /* TODO remove */ + listener->dead = 0; /* born alive */ listener->sockfd = clientfd; - listener->pool = listener_pool; - listener_pool = NULL; + listener->pool = pool; listener->ec = switch_core_alloc(listener->pool, sizeof(ei_cnode)); memcpy(listener->ec, ec, sizeof(ei_cnode)); listener->level = SWITCH_LOG_DEBUG; @@ -1189,15 +1233,49 @@ static listener_t *new_listener(struct ei_cnode_s *ec, int clientfd) switch_core_hash_init(&listener->event_hash, listener->pool); switch_core_hash_init(&listener->sessions, listener->pool); + /* TODO listener rdlock */ + listener->next = listen_list.listeners; + listen_list.listeners = listener; + return listener; } -static listener_t *new_outbound_listener(char *node) +/*TODO we don't need bottleneck*/ +static listener_t *new_listener_locked(struct ei_cnode_s *ec, int clientfd) +{ + listener_t *res; + switch_thread_rwlock_wrlock(globals.listener_rwlock); + res = new_listener(ec, clientfd); + switch_thread_rwlock_unlock(globals.listener_rwlock); + return res; +} + +/* TODO new session??? */ +static listener_t *new_outbound_listener(char *node, switch_bool_t *new_session) { listener_t *listener = NULL; struct ei_cnode_s ec; int clientfd; + /* TODO find listener func */ + switch_thread_rwlock_wrlock(globals.listener_rwlock); + for (listener = listen_list.listeners; listener; listener = listener->next) { + if (!strncmp(node, listener->peer_nodename, MAXNODELEN)) { + break; + } + } + + if (listener && listener->dead) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "found dead listener for %s\n", node); + remove_listener(listener); /* remove the dead listener and continue adding one */ + } else if (listener) { + switch_thread_rwlock_unlock(globals.listener_rwlock); + + *new_session = SWITCH_FALSE; + return listener; + } + + if (SWITCH_STATUS_SUCCESS == initialise_ei(&ec)) { #ifdef WIN32 WSASetLastError(0); @@ -1206,11 +1284,17 @@ static listener_t *new_outbound_listener(char *node) #endif if ((clientfd = ei_connect(&ec, node)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to node %s (erl_errno=%d, errno=%d)!\n", node, erl_errno, errno); + switch_thread_rwlock_unlock(globals.listener_rwlock); return NULL; } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "new listener for %s\n", node); listener = new_listener(&ec, clientfd); listener->peer_nodename = switch_core_strdup(listener->pool, node); } + + switch_thread_rwlock_unlock(globals.listener_rwlock); + *new_session = SWITCH_TRUE; + return listener; } @@ -1226,6 +1310,7 @@ static switch_status_t state_handler(switch_core_session_t *session) if (state == CS_DESTROY) { /* indicate that once all the events in the event queue are done * we can throw this away */ + /* TODO locked? */ switch_set_flag(session_element, LFLAG_SESSION_COMPLETE); } } else { @@ -1298,6 +1383,7 @@ session_elem_t *attach_call_to_pid(listener_t *listener, erlang_pid * pid, switc memcpy(&session_element->process.pid, pid, sizeof(erlang_pid)); /* attach the session to the listener */ add_session_elem_to_listener(listener, session_element); + /* TODO link before added to listener? */ ei_link(listener, ei_self(listener->ec), pid); return session_element; @@ -1361,8 +1447,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul */ } - switch_thread_cond_timedwait(p->ready_or_found, - p->mutex, 5000000); + switch_thread_cond_timedwait(p->ready_or_found, p->mutex, 5000000); if (!p->pid) { p->state = reply_timeout; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Timed out when waiting for outbound pid %s %s\n", hash, session_element->uuid_str); @@ -1460,13 +1545,23 @@ SWITCH_STANDARD_APP(erlang_outbound_function) /* if there is no listener, then create one */ if (!listener) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new listener for session\n"); - new_session = SWITCH_TRUE; - listener = new_outbound_listener(node); + listener = new_outbound_listener(node, &new_session); + /* XXX new_session isn't accurate now */ } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using existing listener for session\n"); + /* TODO don't we need to connect ? */ } - if (listener) { + /* TODO it's too late */ + switch_thread_rwlock_rdlock(globals.listener_rwlock); + + if (listener && !listener->dead) { + /* prevent the listener_run thread from destroying the listener out from under us */ + /* get the listener lock */ + switch_thread_rwlock_rdlock(listener->rwlock); + /* release the global listener lock, since the listener can't be freed without the listener lock */ + switch_thread_rwlock_unlock(globals.listener_rwlock); + if (new_session == SWITCH_TRUE) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching new listener\n"); launch_listener_thread(listener); @@ -1480,11 +1575,18 @@ SWITCH_STANDARD_APP(erlang_outbound_function) session_element = attach_call_to_registered_process(listener, reg_name, session); } + /* should be safe now */ + switch_thread_rwlock_unlock(listener->rwlock); + + if (session_element) { switch_ivr_park(session, NULL); } + } else { + switch_thread_rwlock_unlock(globals.listener_rwlock); } + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "exit erlang_outbound_function\n"); } @@ -1498,6 +1600,7 @@ SWITCH_STANDARD_APP(erlang_sendmsg_function) char *mydata; ei_x_buff buf; listener_t *listener; + switch_bool_t new_session; ei_x_new_with_version(&buf); @@ -1523,12 +1626,12 @@ SWITCH_STANDARD_APP(erlang_sendmsg_function) listener = find_listener(node); if (!listener) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new listener for sendmsg %s\n", node); - listener = new_outbound_listener(node); + listener = new_outbound_listener(node, &new_session); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using existing listener for sendmsg to %s\n", node); } - if (listener) { + if (listener && !listener->dead) { ei_reg_send(listener->ec, listener->sockfd, reg_name, buf.buff, buf.index); } } @@ -1598,11 +1701,11 @@ SWITCH_STANDARD_API(erlang_cmd) stream->write_function(stream, "Outbound session for %s in state %s\n", sp->uuid_str, switch_channel_state_name(sp->channel_state)); } + switch_thread_rwlock_unlock(l->session_rwlock); if (empty) { stream->write_function(stream, "No active sessions for %s\n", argv[1]); } - switch_thread_rwlock_unlock(l->session_rwlock); break; } } @@ -1824,7 +1927,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime) continue; } - listener = new_listener(&ec, clientfd); + listener = new_listener_locked(&ec, clientfd); if (listener) { /* store the IP and node name we are talking with */ switch_inet_ntop(AF_INET, conn.ipadr, listener->remote_ip, sizeof(listener->remote_ip)); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 1721d496fb..775cdf74f3 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -39,7 +39,8 @@ typedef enum { } session_flag_t; typedef enum { - ERLANG_PID = 0, + NONE = 0, + ERLANG_PID, ERLANG_REG_PROCESS } process_type; @@ -113,6 +114,7 @@ struct listener { #else int sockfd; #endif + uint8_t dead; struct ei_cnode_s *ec; struct erlang_process log_process; struct erlang_process event_process; From 56678528f855d2779fa95c5431be5b8f0ae669ec Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 08:02:00 +0000 Subject: [PATCH 0377/1057] gitignore TAGS anywhere in tree --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cbeaaa463e..f153ad6f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ configure.lineno config.log config.status core.* +TAGS *.2010.log *.Build.CppClean.log *.tlog From 343bdec239f3702aa503990293be420f02f0e2db Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 08:04:49 +0000 Subject: [PATCH 0378/1057] remove .vcxproj.user file in tree --- src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user diff --git a/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user b/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user deleted file mode 100644 index 695b5c78b9..0000000000 --- a/src/mod/say/mod_say_fa/mod_say_fa.2010.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file From eade6572253e3d86ccdb16bc7b23228ecf63aad0 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 10:30:48 +0200 Subject: [PATCH 0379/1057] listener r/w locking FS-3432 --- .../mod_erlang_event/mod_erlang_event.c | 197 +++++++----------- .../mod_erlang_event/mod_erlang_event.h | 1 - 2 files changed, 73 insertions(+), 125 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index cfa1d63115..c2f204ef0a 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -44,6 +44,7 @@ SWITCH_MODULE_DEFINITION(mod_erlang_event, mod_erlang_event_load, mod_erlang_eve static switch_memory_pool_t *module_pool = NULL; static void remove_listener(listener_t *listener); +static void destroy_listener(listener_t *listener); static switch_status_t state_handler(switch_core_session_t *session); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_ip, prefs.ip); @@ -59,7 +60,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l switch_thread_rwlock_rdlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { - /* TODO listener read lock */ + if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) { switch_log_node_t *dnode = switch_log_node_dup(node); @@ -80,6 +81,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l l->lost_logs++; } } + } switch_thread_rwlock_unlock(globals.listener_rwlock); @@ -192,8 +194,6 @@ static void event_handler(switch_event_t *event) one of them should receive the event as well */ - /* TODO need read locking */ - send_event_to_attached_sessions(l, event); if (!switch_test_flag(l, LFLAG_EVENTS)) { @@ -255,21 +255,21 @@ static void close_socket(int *sock) } -/*static void add_listener(listener_t *listener)*/ -/*{*/ - /* add me to the listeners so I get events */ - /*switch_thread_rwlock_wrlock(globals.listener_rwlock);*/ - /*listener->next = listen_list.listeners;*/ - /*listen_list.listeners = listener;*/ - /*switch_thread_rwlock_unlock(globals.listener_rwlock);*/ -/*}*/ +static void add_listener(listener_t *listener) +{ + /* add me to the listeners so I get events */ + switch_thread_rwlock_wrlock(globals.listener_rwlock); + listener->next = listen_list.listeners; + listen_list.listeners = listener; + switch_thread_rwlock_unlock(globals.listener_rwlock); +} -/* TODO lock */ static void remove_listener(listener_t *listener) { listener_t *l, *last = NULL; + switch_thread_rwlock_wrlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (l == listener) { if (last) { @@ -280,17 +280,18 @@ static void remove_listener(listener_t *listener) } last = l; } + switch_thread_rwlock_unlock(globals.listener_rwlock); } -/* Search for a listener already talking to the specified node */ -static listener_t *find_listener(char *nodename) +/* Search for a listener already talking to the specified node and lock for reading*/ +static listener_t *find_listener_locked(char *nodename) { listener_t *l = NULL; switch_thread_rwlock_rdlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (!strncmp(nodename, l->peer_nodename, MAXNODELEN)) { - /* TODO listener rwlock */ + switch_thread_rwlock_rdlock(l->rwlock); break; } } @@ -976,10 +977,6 @@ static switch_bool_t check_inbound_acl(listener_t *listener) static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) { listener_t *listener = (listener_t *) obj; - session_elem_t *s = NULL; - const void *key; - void *value; - switch_hash_index_t *iter; switch_mutex_lock(globals.listener_count_mutex); prefs.threads++; @@ -994,50 +991,14 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s\n", listener->remote_ip); /*, listener->remote_port); */ } - /*add_listener(listener);*/ + add_listener(listener); listener_main_loop(listener); } - /* clean up */ - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n"); - - listener->dead = 1; /* mark it as dead */ - - /* TODO - release write lock */ - switch_thread_rwlock_wrlock(globals.listener_rwlock); - remove_listener(listener); - switch_thread_rwlock_unlock(globals.listener_rwlock); - - switch_thread_rwlock_wrlock(listener->rwlock); - - if (listener->sockfd) { - close_socket(&listener->sockfd); - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Closed\n"); - /* TODO make listener destroy function and move there */ - switch_core_hash_destroy(&listener->event_hash); - /* remove any bindings for this connection */ - remove_binding(listener, NULL); - - /* clean up all the attached sessions */ - switch_thread_rwlock_wrlock(listener->session_rwlock); - for (iter = switch_hash_first(NULL, listener->sessions); iter; iter = switch_hash_next(iter)) { - switch_hash_this(iter, &key, NULL, &value); - s = (session_elem_t*)value; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Orphaning call %s\n", s->uuid_str); - remove_session_elem_from_listener(listener, s); - destroy_session_elem(s); - } - switch_thread_rwlock_unlock(listener->session_rwlock); - switch_thread_rwlock_unlock(listener->rwlock); - - if (listener->pool) { - switch_memory_pool_t *pool = listener->pool; - switch_core_destroy_memory_pool(&pool); - } + remove_listener(listener); + destroy_listener(listener); switch_mutex_lock(globals.listener_count_mutex); prefs.threads--; @@ -1220,8 +1181,6 @@ static listener_t *new_listener(struct ei_cnode_s *ec, int clientfd) switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, pool); switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, pool); - /* TODO remove */ - listener->dead = 0; /* born alive */ listener->sockfd = clientfd; listener->pool = pool; listener->ec = switch_core_alloc(listener->pool, sizeof(ei_cnode)); @@ -1233,49 +1192,16 @@ static listener_t *new_listener(struct ei_cnode_s *ec, int clientfd) switch_core_hash_init(&listener->event_hash, listener->pool); switch_core_hash_init(&listener->sessions, listener->pool); - /* TODO listener rdlock */ - listener->next = listen_list.listeners; - listen_list.listeners = listener; - return listener; } -/*TODO we don't need bottleneck*/ -static listener_t *new_listener_locked(struct ei_cnode_s *ec, int clientfd) -{ - listener_t *res; - switch_thread_rwlock_wrlock(globals.listener_rwlock); - res = new_listener(ec, clientfd); - switch_thread_rwlock_unlock(globals.listener_rwlock); - return res; -} -/* TODO new session??? */ -static listener_t *new_outbound_listener(char *node, switch_bool_t *new_session) +static listener_t *new_outbound_listener_locked(char *node) { listener_t *listener = NULL; struct ei_cnode_s ec; int clientfd; - /* TODO find listener func */ - switch_thread_rwlock_wrlock(globals.listener_rwlock); - for (listener = listen_list.listeners; listener; listener = listener->next) { - if (!strncmp(node, listener->peer_nodename, MAXNODELEN)) { - break; - } - } - - if (listener && listener->dead) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "found dead listener for %s\n", node); - remove_listener(listener); /* remove the dead listener and continue adding one */ - } else if (listener) { - switch_thread_rwlock_unlock(globals.listener_rwlock); - - *new_session = SWITCH_FALSE; - return listener; - } - - if (SWITCH_STATUS_SUCCESS == initialise_ei(&ec)) { #ifdef WIN32 WSASetLastError(0); @@ -1284,7 +1210,7 @@ static listener_t *new_outbound_listener(char *node, switch_bool_t *new_session) #endif if ((clientfd = ei_connect(&ec, node)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to node %s (erl_errno=%d, errno=%d)!\n", node, erl_errno, errno); - switch_thread_rwlock_unlock(globals.listener_rwlock); + return NULL; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "new listener for %s\n", node); @@ -1292,12 +1218,49 @@ static listener_t *new_outbound_listener(char *node, switch_bool_t *new_session) listener->peer_nodename = switch_core_strdup(listener->pool, node); } - switch_thread_rwlock_unlock(globals.listener_rwlock); - *new_session = SWITCH_TRUE; + switch_thread_rwlock_rdlock(listener->rwlock); return listener; } +void destroy_listener(listener_t * listener) +{ + session_elem_t *s = NULL; + const void *key; + void *value; + switch_hash_index_t *iter; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n"); + switch_thread_rwlock_wrlock(listener->rwlock); + + if (listener->sockfd) { + close_socket(&listener->sockfd); + } + + switch_core_hash_destroy(&listener->event_hash); + + /* remove any bindings for this connection */ + remove_binding(listener, NULL); + + /* clean up all the attached sessions */ + switch_thread_rwlock_wrlock(listener->session_rwlock); + for (iter = switch_hash_first(NULL, listener->sessions); iter; iter = switch_hash_next(iter)) { + switch_hash_this(iter, &key, NULL, &value); + s = (session_elem_t*)value; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Orphaning call %s\n", s->uuid_str); + remove_session_elem_from_listener(listener, s); + destroy_session_elem(s); + } + switch_thread_rwlock_unlock(listener->session_rwlock); + switch_thread_rwlock_unlock(listener->rwlock); + + if (listener->pool) { + switch_memory_pool_t *pool = listener->pool; + switch_core_destroy_memory_pool(&pool); + } + +} + static switch_status_t state_handler(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); @@ -1499,7 +1462,6 @@ SWITCH_STANDARD_APP(erlang_outbound_function) char *argv[80] = { 0 }, *argv2[80] = { 0 }; char *mydata, *myarg; char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1]; - switch_bool_t new_session = SWITCH_FALSE; session_elem_t *session_element = NULL; /* process app arguments */ @@ -1541,31 +1503,19 @@ SWITCH_STANDARD_APP(erlang_outbound_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n", argv[0], node); /* first work out if there is a listener already talking to the node we want to talk to */ - listener = find_listener(node); + listener = find_listener_locked(node); /* if there is no listener, then create one */ if (!listener) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new listener for session\n"); - listener = new_outbound_listener(node, &new_session); - /* XXX new_session isn't accurate now */ - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using existing listener for session\n"); - /* TODO don't we need to connect ? */ - } - - /* TODO it's too late */ - switch_thread_rwlock_rdlock(globals.listener_rwlock); - - if (listener && !listener->dead) { - /* prevent the listener_run thread from destroying the listener out from under us */ - /* get the listener lock */ - switch_thread_rwlock_rdlock(listener->rwlock); - /* release the global listener lock, since the listener can't be freed without the listener lock */ - switch_thread_rwlock_unlock(globals.listener_rwlock); - - if (new_session == SWITCH_TRUE) { + if ((listener = new_outbound_listener_locked(node))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching new listener\n"); launch_listener_thread(listener); } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using existing listener for session\n"); + } + + if (listener) { if (module && function) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new spawned session for listener\n"); @@ -1575,10 +1525,8 @@ SWITCH_STANDARD_APP(erlang_outbound_function) session_element = attach_call_to_registered_process(listener, reg_name, session); } - /* should be safe now */ switch_thread_rwlock_unlock(listener->rwlock); - if (session_element) { switch_ivr_park(session, NULL); } @@ -1600,7 +1548,6 @@ SWITCH_STANDARD_APP(erlang_sendmsg_function) char *mydata; ei_x_buff buf; listener_t *listener; - switch_bool_t new_session; ei_x_new_with_version(&buf); @@ -1623,16 +1570,18 @@ SWITCH_STANDARD_APP(erlang_sendmsg_function) ei_x_encode_atom(&buf, "freeswitch_sendmsg"); _ei_x_encode_string(&buf, argv[2]); - listener = find_listener(node); + listener = find_listener_locked(node); if (!listener) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new listener for sendmsg %s\n", node); - listener = new_outbound_listener(node, &new_session); + listener = new_outbound_listener_locked(node); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using existing listener for sendmsg to %s\n", node); } - if (listener && !listener->dead) { + if (listener) { ei_reg_send(listener->ec, listener->sockfd, reg_name, buf.buff, buf.index); + + switch_thread_rwlock_unlock(listener->rwlock); } } @@ -1927,7 +1876,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime) continue; } - listener = new_listener_locked(&ec, clientfd); + listener = new_listener(&ec, clientfd); if (listener) { /* store the IP and node name we are talking with */ switch_inet_ntop(AF_INET, conn.ipadr, listener->remote_ip, sizeof(listener->remote_ip)); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 775cdf74f3..016734dd80 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -114,7 +114,6 @@ struct listener { #else int sockfd; #endif - uint8_t dead; struct ei_cnode_s *ec; struct erlang_process log_process; struct erlang_process event_process; From 4e6b56c53d83c643b2d590da100c70c02dc3f993 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 10:57:28 +0200 Subject: [PATCH 0380/1057] add listener event r/w locking FS-3432 --- .../mod_erlang_event/handle_msg.c | 24 +++++++++++++------ .../mod_erlang_event/mod_erlang_event.c | 17 ++++++++----- .../mod_erlang_event/mod_erlang_event.h | 1 + 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 0b083cd0c0..8e6ba46a62 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -28,6 +28,7 @@ * Rob Charlton * Darren Schreiber * Mike Jerris + * Tamas Cseke * * * handle_msg.c -- handle messages received from erlang nodes @@ -286,7 +287,8 @@ static switch_status_t handle_msg_event(listener_t *listener, int arity, ei_x_bu switch_set_flag_locked(listener, LFLAG_EVENTS); } - /* TODO - listener write lock */ + switch_thread_rwlock_wrlock(listener->event_rwlock); + for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { @@ -312,6 +314,8 @@ static switch_status_t handle_msg_event(listener_t *listener, int arity, ei_x_bu switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enable event %s\n", atom); } } + switch_thread_rwlock_unlock(listener->event_rwlock); + ei_x_encode_atom(rbuf, "ok"); } return SWITCH_STATUS_SUCCESS; @@ -382,7 +386,8 @@ static switch_status_t handle_msg_nixevent(listener_t *listener, int arity, ei_x int i = 0; switch_event_types_t type; - /* TODO listener write lock */ + switch_thread_rwlock_wrlock(listener->event_rwlock); + for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { @@ -410,6 +415,8 @@ static switch_status_t handle_msg_nixevent(listener_t *listener, int arity, ei_x } } } + + switch_thread_rwlock_unlock(listener->event_rwlock); ei_x_encode_atom(rbuf, "ok"); } return SWITCH_STATUS_SUCCESS; @@ -522,11 +529,11 @@ static switch_status_t handle_msg_setevent(listener_t *listener, erlang_msg *msg } } /* update the event subscriptions with the new ones */ + switch_thread_rwlock_wrlock(listener->event_rwlock); memcpy(listener->event_list, event_list, sizeof(uint8_t) * (SWITCH_EVENT_ALL + 1)); - /* wipe the old hash, and point the pointer at the new one */ - /* TODO make thread safe */ switch_core_hash_destroy(&listener->event_hash); listener->event_hash = event_hash; + switch_thread_rwlock_unlock(listener->event_rwlock); /* TODO - we should flush any non-matching events from the queue */ ei_x_encode_atom(rbuf, "ok"); @@ -1031,13 +1038,16 @@ static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, e if (switch_test_flag(listener, LFLAG_EVENTS)) { uint8_t x = 0; switch_clear_flag_locked(listener, LFLAG_EVENTS); + + switch_thread_rwlock_wrlock(listener->event_rwlock); for (x = 0; x <= SWITCH_EVENT_ALL; x++) { listener->event_list[x] = 0; } - /* wipe the hash */ - /* TODO make thread safe*/ - switch_core_hash_destroy(&listener->event_hash); + + switch_core_hash_delete_multi(listener->event_hash, NULL, NULL); switch_core_hash_init(&listener->event_hash, listener->pool); + + switch_thread_rwlock_unlock(listener->event_rwlock); ei_x_encode_atom(rbuf, "ok"); } else { ei_x_encode_tuple_header(rbuf, 2); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index c2f204ef0a..f690fe6453 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -26,6 +26,7 @@ * Anthony Minessale II * Andrew Thompson * Rob Charlton + * Tamas Cseke * * * mod_erlang_event.c -- Erlang Event Handler derived from mod_event_socket @@ -200,6 +201,8 @@ static void event_handler(switch_event_t *event) continue; } + switch_thread_rwlock_rdlock(l->event_rwlock); + if (l->event_list[SWITCH_EVENT_ALL]) { send = 1; } else if ((l->event_list[event->event_id])) { @@ -208,6 +211,7 @@ static void event_handler(switch_event_t *event) } } + switch_thread_rwlock_unlock(l->event_rwlock); if (send) { if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { @@ -815,14 +819,12 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) uint8_t x = 0; switch_clear_flag_locked(listener, LFLAG_EVENTS); + switch_thread_rwlock_wrlock(listener->event_rwlock); for (x = 0; x <= SWITCH_EVENT_ALL; x++) { listener->event_list[x] = 0; } - /* wipe the hash */ - /* XXX this needs to be locked */ - /* TODO switch_core_hash_delete_multi_locked */ - switch_core_hash_destroy(&listener->event_hash); - switch_core_hash_init(&listener->event_hash, listener->pool); + switch_core_hash_delete_multi(listener->event_hash, NULL, NULL); + switch_thread_rwlock_unlock(listener->event_rwlock); } } } @@ -1177,7 +1179,6 @@ static listener_t *new_listener(struct ei_cnode_s *ec, int clientfd) } memset(listener, 0, sizeof(*listener)); - switch_thread_rwlock_create(&listener->rwlock, pool); switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, pool); switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, pool); @@ -1188,7 +1189,11 @@ static listener_t *new_listener(struct ei_cnode_s *ec, int clientfd) listener->level = SWITCH_LOG_DEBUG; switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool); switch_mutex_init(&listener->sock_mutex, SWITCH_MUTEX_NESTED, listener->pool); + + switch_thread_rwlock_create(&listener->rwlock, pool); + switch_thread_rwlock_create(&listener->event_rwlock, pool); switch_thread_rwlock_create(&listener->session_rwlock, listener->pool); + switch_core_hash_init(&listener->event_hash, listener->pool); switch_core_hash_init(&listener->sessions, listener->pool); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 016734dd80..5383922782 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -129,6 +129,7 @@ struct listener { uint8_t event_list[SWITCH_EVENT_ALL + 1]; switch_hash_t *event_hash; switch_thread_rwlock_t *rwlock; + switch_thread_rwlock_t *event_rwlock; switch_thread_rwlock_t *session_rwlock; //session_elem_t *session_list; switch_hash_t *sessions; From fdd3a8d3339145d41310d453ce5f046bc575162c Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 11:16:26 +0200 Subject: [PATCH 0381/1057] set and clear session flags locked FS-3432 --- .../mod_erlang_event/mod_erlang_event.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index f690fe6453..4fc383e4e7 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -592,7 +592,7 @@ static switch_status_t check_attached_sessions(listener_t *listener) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delete", (const char *) key); continue; } - switch_set_flag(sp, LFLAG_OUTBOUND_INIT); + switch_set_flag_locked(sp, LFLAG_OUTBOUND_INIT); } if (switch_test_flag(sp, LFLAG_SESSION_COMPLETE)) { @@ -1278,8 +1278,7 @@ static switch_status_t state_handler(switch_core_session_t *session) if (state == CS_DESTROY) { /* indicate that once all the events in the event queue are done * we can throw this away */ - /* TODO locked? */ - switch_set_flag(session_element, LFLAG_SESSION_COMPLETE); + switch_set_flag_locked(session_element, LFLAG_SESSION_COMPLETE); } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to update channel state for %s to %s\n", switch_core_session_get_uuid(session), @@ -1366,7 +1365,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul spawn_reply_t *p; erlang_ref ref; - switch_set_flag(session_element, LFLAG_WAITING_FOR_PID); + switch_set_flag_locked(session_element, LFLAG_WAITING_FOR_PID); /* attach the session to the listener */ add_session_elem_to_listener(listener, session_element); @@ -1430,8 +1429,8 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid)); session_element->spawn_reply = NULL; - switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT); - switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID); + switch_clear_flag_locked(session_element, LFLAG_OUTBOUND_INIT); + switch_clear_flag_locked(session_element, LFLAG_WAITING_FOR_PID); ei_link(listener, ei_self(listener->ec), &session_element->process.pid); From 87f65f178496200047ba03d506a7289dc442b390 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 11:32:15 +0200 Subject: [PATCH 0382/1057] add session r/w locking FS-3432 --- .../mod_erlang_event/mod_erlang_event.c | 27 +++++++++---------- .../mod_erlang_event/mod_erlang_event.h | 1 + 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 4fc383e4e7..daa31d773a 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -137,8 +137,10 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t switch_thread_rwlock_rdlock(listener->session_rwlock); - s = (session_elem_t*)switch_core_hash_find(listener->sessions, uuid); - /* TODO - we don't need to hold the lock, we need to lock the session */ + if ((s = (session_elem_t*)switch_core_hash_find(listener->sessions, uuid))) { + switch_thread_rwlock_rdlock(s->rwlock); + } + switch_thread_rwlock_unlock(listener->session_rwlock); if (s) { int send = 0; @@ -166,8 +168,9 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t switch_log_printf(SWITCH_CHANNEL_UUID_LOG(s->uuid_str), SWITCH_LOG_DEBUG, "Ignoring event %s for attached session %s\n", switch_event_name(event->event_id), s->uuid_str); } + switch_thread_rwlock_unlock(s->rwlock); } - switch_thread_rwlock_unlock(listener->session_rwlock); + } static void event_handler(switch_event_t *event) @@ -329,13 +332,15 @@ static void destroy_session_elem(session_elem_t *session_element) { switch_core_session_t *session; + /* wait for readers */ + switch_thread_rwlock_wrlock(session_element->rwlock); + switch_thread_rwlock_unlock(session_element->rwlock); + if ((session = switch_core_session_locate(session_element->uuid_str))) { switch_channel_clear_flag(switch_core_session_get_channel(session), CF_CONTROLLED); switch_core_session_rwunlock(session); } switch_core_destroy_memory_pool(&session_element->pool); - session_element = NULL; - /*switch_safe_free(s); */ } @@ -890,15 +895,7 @@ static void listener_main_loop(listener_t *listener) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit from %s <%d.%d.%d>\n", msg.from.node, msg.from.creation, msg.from.num, msg.from.serial); - switch_thread_rwlock_rdlock(globals.listener_rwlock); - if (listener) { - /* get the listener lock */ - switch_thread_rwlock_wrlock(listener->rwlock); - /* wipe event hash */ - handle_exit(listener, &msg.from); - switch_thread_rwlock_unlock(listener->rwlock); - } - switch_thread_rwlock_unlock(globals.listener_rwlock); + handle_exit(listener, &msg.from); break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected msg type %d\n", (int) (msg.msgtype)); @@ -1318,6 +1315,8 @@ session_elem_t *session_elem_create(listener_t *listener, switch_core_session_t session_element->event_list[x] = 0; } + switch_thread_rwlock_create(&session_element->rwlock, session_element->pool); + session_element->event_list[SWITCH_EVENT_ALL] = 1; /* defaults to everything */ switch_channel_set_private(channel, "_erlang_session_", session_element); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 5383922782..2e9fed865f 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -83,6 +83,7 @@ struct session_elem { uint32_t flags; struct erlang_process process; switch_queue_t *event_queue; + switch_thread_rwlock_t *rwlock; switch_channel_state_t channel_state; switch_memory_pool_t *pool; uint8_t event_list[SWITCH_EVENT_ALL + 1]; From 85656c31afa2c2f80700730a64cb3ff71768556a Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 11:44:12 +0200 Subject: [PATCH 0383/1057] add session event r/w locking FS-3432 --- .../mod_erlang_event/handle_msg.c | 25 +++++++++++++------ .../mod_erlang_event/mod_erlang_event.c | 6 +++++ .../mod_erlang_event/mod_erlang_event.h | 1 + 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 8e6ba46a62..944263b2f5 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -337,10 +337,11 @@ static switch_status_t handle_msg_session_event(listener_t *listener, erlang_msg switch_event_types_t type; int i = 0; + switch_thread_rwlock_wrlock(session->event_rwlock); + for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { - /* TODO session write locking */ if (custom) { switch_core_hash_insert(session->event_hash, atom, MARKER); } else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) { @@ -363,6 +364,9 @@ static switch_status_t handle_msg_session_event(listener_t *listener, erlang_msg switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enable event %s for session %s\n", atom, session->uuid_str); } } + + switch_thread_rwlock_unlock(session->event_rwlock); + ei_x_encode_atom(rbuf, "ok"); } else { ei_x_encode_tuple_header(rbuf, 2); @@ -437,7 +441,8 @@ static switch_status_t handle_msg_session_nixevent(listener_t *listener, erlang_ int i = 0; switch_event_types_t type; - /* TODO session write lock */ + switch_thread_rwlock_wrlock(session->event_rwlock); + for (i = 1; i < arity; i++) { if (!ei_decode_atom(buf->buff, &buf->index, atom)) { @@ -464,6 +469,8 @@ static switch_status_t handle_msg_session_nixevent(listener_t *listener, erlang_ } } } + switch_thread_rwlock_unlock(session->event_rwlock); + ei_x_encode_atom(rbuf, "ok"); } else { /* no session for this pid */ ei_x_encode_tuple_header(rbuf, 2); @@ -590,12 +597,15 @@ static switch_status_t handle_msg_session_setevent(listener_t *listener, erlang_ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enable event %s for session %s\n", atom, session->uuid_str); } } + /* update the event subscriptions with the new ones */ + switch_thread_rwlock_wrlock(session->event_rwlock); memcpy(session->event_list, event_list, sizeof(uint8_t) * (SWITCH_EVENT_ALL + 1)); /* wipe the old hash, and point the pointer at the new one */ - /* TODO make thread safe*/ switch_core_hash_destroy(&session->event_hash); session->event_hash = event_hash; + switch_thread_rwlock_unlock(session->event_rwlock); + /* TODO - we should flush any non-matching events from the queue */ ei_x_encode_atom(rbuf, "ok"); } else { /* no session for this pid */ @@ -1045,7 +1055,6 @@ static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, e } switch_core_hash_delete_multi(listener->event_hash, NULL, NULL); - switch_core_hash_init(&listener->event_hash, listener->pool); switch_thread_rwlock_unlock(listener->event_rwlock); ei_x_encode_atom(rbuf, "ok"); @@ -1062,13 +1071,15 @@ static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, e /*purge the event queue */ while (switch_queue_trypop(session->event_queue, &pop) == SWITCH_STATUS_SUCCESS); + + switch_thread_rwlock_wrlock(session->event_rwlock); for (x = 0; x <= SWITCH_EVENT_ALL; x++) { session->event_list[x] = 0; } /* wipe the hash */ - /* TODO make thread safe*/ - switch_core_hash_destroy(&session->event_hash); - switch_core_hash_init(&session->event_hash, session->pool); + switch_core_hash_delete_multi(session->event_hash, NULL, NULL); + switch_thread_rwlock_unlock(session->event_rwlock); + ei_x_encode_atom(rbuf, "ok"); } else { ei_x_encode_tuple_header(rbuf, 2); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index daa31d773a..fa1ea86982 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -144,6 +144,9 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t if (s) { int send = 0; + + switch_thread_rwlock_rdlock(s->event_rwlock); + if (s->event_list[SWITCH_EVENT_ALL]) { send = 1; } else if ((s->event_list[event->event_id])) { @@ -152,6 +155,8 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t } } + switch_thread_rwlock_unlock(s->event_rwlock); + if (send) { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(s->uuid_str), SWITCH_LOG_DEBUG, "Sending event %s to attached session %s\n", switch_event_name(event->event_id), s->uuid_str); @@ -1316,6 +1321,7 @@ session_elem_t *session_elem_create(listener_t *listener, switch_core_session_t } switch_thread_rwlock_create(&session_element->rwlock, session_element->pool); + switch_thread_rwlock_create(&session_element->event_rwlock, session_element->pool); session_element->event_list[SWITCH_EVENT_ALL] = 1; /* defaults to everything */ diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 2e9fed865f..d5f890d0a1 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -84,6 +84,7 @@ struct session_elem { struct erlang_process process; switch_queue_t *event_queue; switch_thread_rwlock_t *rwlock; + switch_thread_rwlock_t *event_rwlock; switch_channel_state_t channel_state; switch_memory_pool_t *pool; uint8_t event_list[SWITCH_EVENT_ALL + 1]; From 78641d4264355872de73817dd06da00593d33f47 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 14:55:29 +0200 Subject: [PATCH 0384/1057] cleanup process spawning, remove mutex lock and add session to listener only if reply state and session flag is set to waiting FS-3432 --- .../mod_erlang_event/handle_msg.c | 3 --- .../mod_erlang_event/mod_erlang_event.c | 17 +++++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 944263b2f5..5ff207e1a1 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -1149,9 +1149,6 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, if (se->spawn_reply && !strncmp(se->spawn_reply->hash, hash, 100)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "found matching session for %s : %s\n", hash, se->uuid_str); switch_mutex_lock(se->spawn_reply->mutex); - if (se->spawn_reply->state == reply_not_ready) { - switch_thread_cond_wait(se->spawn_reply->ready_or_found, se->spawn_reply->mutex); - } if (se->spawn_reply->state == reply_waiting) { se->spawn_reply->pid = pid; diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index fa1ea86982..e24b30bb6d 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1366,30 +1366,28 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul /* create a session list element */ session_elem_t *session_element = session_elem_create(listener, session); char hash[100]; - //void *p = NULL; spawn_reply_t *p; erlang_ref ref; - switch_set_flag_locked(session_element, LFLAG_WAITING_FOR_PID); - - /* attach the session to the listener */ - add_session_elem_to_listener(listener, session_element); ei_init_ref(listener->ec, &ref); ei_hash_ref(&ref, hash); - /* insert the waiting marker */ p = switch_core_alloc(session_element->pool, sizeof(*p)); switch_thread_cond_create(&p->ready_or_found, session_element->pool); switch_mutex_init(&p->mutex, SWITCH_MUTEX_UNNESTED, session_element->pool); - p->state = reply_not_ready; + p->state = reply_waiting; p->hash = hash; p->pid = NULL; session_element->spawn_reply = p; - switch_mutex_lock(p->mutex); - p->state = reply_waiting; + /* insert the waiting marker */ + switch_set_flag(session_element, LFLAG_WAITING_FOR_PID); + + /* attach the session to the listener */ + add_session_elem_to_listener(listener, session_element); + if (!strcmp(function, "!")) { /* send a message to request a pid */ @@ -1434,7 +1432,6 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid)); session_element->spawn_reply = NULL; - switch_clear_flag_locked(session_element, LFLAG_OUTBOUND_INIT); switch_clear_flag_locked(session_element, LFLAG_WAITING_FOR_PID); ei_link(listener, ei_self(listener->ec), &session_element->process.pid); From 2be25c6a5693a8dafc866fb8158fc0c80da413f1 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 15:14:14 +0200 Subject: [PATCH 0385/1057] remove removal while traversing the hash and and lock to elimate race FS-3432 --- .../mod_erlang_event/mod_erlang_event.c | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index e24b30bb6d..a3f3acc08a 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -356,18 +356,16 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid) void *val = NULL; session_elem_t *session = NULL; - switch_thread_rwlock_rdlock(listener->session_rwlock); for (iter = switch_hash_first(NULL, listener->sessions); iter; iter = switch_hash_next(iter)) { switch_hash_this(iter, &key, NULL, &val); - session = (session_elem_t*)val; - if (session->process.type == ERLANG_PID && !ei_compare_pids(pid, &session->process.pid)) { - switch_thread_rwlock_unlock(listener->session_rwlock); - return session; + + if (((session_elem_t*)val)->process.type == ERLANG_PID && !ei_compare_pids(pid, &((session_elem_t*)val)->process.pid)) { + session = (session_elem_t*)val; + break; } } - switch_thread_rwlock_unlock(listener->session_rwlock); - return NULL; + return session; } @@ -779,6 +777,9 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) session_elem_t *s; remove_binding(NULL, pid); /* TODO - why don't we pass the listener as the first argument? */ + + /* TODO - eliminate session destroy races and we shouldn't lock the session hash */ + switch_thread_rwlock_wrlock(listener->session_rwlock); if ((s = find_session_elem_by_pid(listener, pid))) { if (s->channel_state < CS_HANGUP) { switch_core_session_t *session; @@ -794,9 +795,12 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) /* TODO - if a spawned process that was handling an outbound call fails.. what do we do with the call? */ /* TODO hangup and let the state handler set the complete flag and destroy as usual*/ } - remove_session_elem_from_listener_locked(listener, s); - destroy_session_elem(s); + if (remove_session_elem_from_listener(listener, s) == SWITCH_STATUS_SUCCESS) { + destroy_session_elem(s); + } } + switch_thread_rwlock_wrlock(listener->session_rwlock); + if (listener->log_process.type == ERLANG_PID && !ei_compare_pids(&listener->log_process.pid, pid)) { void *pop; @@ -1255,7 +1259,6 @@ void destroy_listener(listener_t * listener) switch_hash_this(iter, &key, NULL, &value); s = (session_elem_t*)value; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Orphaning call %s\n", s->uuid_str); - remove_session_elem_from_listener(listener, s); destroy_session_elem(s); } switch_thread_rwlock_unlock(listener->session_rwlock); @@ -1275,6 +1278,7 @@ static switch_status_t state_handler(switch_core_session_t *session) session_elem_t *session_element = switch_channel_get_private(channel, "_erlang_session_"); /*listener_t* listener = switch_channel_get_private(channel, "_erlang_listener_"); */ + /* TODO make thread safe */ if (session_element) { session_element->channel_state = state; if (state == CS_DESTROY) { From 377f6a9ef6906e1be7bb589d44340c3ab32b79e3 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 16:12:55 +0200 Subject: [PATCH 0386/1057] remove channel private, state handler and clear controlled flag on destroy FS-3432 --- .../mod_erlang_event/mod_erlang_event.c | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index a3f3acc08a..dd84d8de11 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -342,7 +342,15 @@ static void destroy_session_elem(session_elem_t *session_element) switch_thread_rwlock_unlock(session_element->rwlock); if ((session = switch_core_session_locate(session_element->uuid_str))) { - switch_channel_clear_flag(switch_core_session_get_channel(session), CF_CONTROLLED); + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (switch_channel_get_state(channel) < CS_HANGUP) { + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_WARNING, "Outbound session for %s exited unexpectedly!\n", session_element->uuid_str); + } + + switch_channel_set_private(channel, "_erlang_session_", NULL); + switch_core_event_hook_remove_state_change(session, state_handler); + switch_channel_clear_flag(channel, CF_CONTROLLED); switch_core_session_rwunlock(session); } switch_core_destroy_memory_pool(&session_element->pool); @@ -781,20 +789,6 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) /* TODO - eliminate session destroy races and we shouldn't lock the session hash */ switch_thread_rwlock_wrlock(listener->session_rwlock); if ((s = find_session_elem_by_pid(listener, pid))) { - if (s->channel_state < CS_HANGUP) { - switch_core_session_t *session; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(s->uuid_str), SWITCH_LOG_WARNING, "Outbound session for %s exited unexpectedly!\n", s->uuid_str); - - if ((session = switch_core_session_locate(s->uuid_str))) { - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_channel_set_private(channel, "_erlang_session_", NULL); - switch_channel_set_private(channel, "_erlang_listener_", NULL); - switch_core_event_hook_remove_state_change(session, state_handler); - switch_core_session_rwunlock(session); - } - /* TODO - if a spawned process that was handling an outbound call fails.. what do we do with the call? */ - /* TODO hangup and let the state handler set the complete flag and destroy as usual*/ - } if (remove_session_elem_from_listener(listener, s) == SWITCH_STATUS_SUCCESS) { destroy_session_elem(s); } @@ -1276,9 +1270,7 @@ static switch_status_t state_handler(switch_core_session_t *session) switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_state_t state = switch_channel_get_state(channel); session_elem_t *session_element = switch_channel_get_private(channel, "_erlang_session_"); - /*listener_t* listener = switch_channel_get_private(channel, "_erlang_listener_"); */ - /* TODO make thread safe */ if (session_element) { session_element->channel_state = state; if (state == CS_DESTROY) { @@ -1330,7 +1322,6 @@ session_elem_t *session_elem_create(listener_t *listener, switch_core_session_t session_element->event_list[SWITCH_EVENT_ALL] = 1; /* defaults to everything */ switch_channel_set_private(channel, "_erlang_session_", session_element); - switch_channel_set_private(channel, "_erlang_listener_", listener); switch_core_event_hook_add_state_change(session, state_handler); From 9dc9ee974c3de9246daff6551c46a14ffeefa61c Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 24 May 2012 16:19:01 +0200 Subject: [PATCH 0387/1057] doh FS-3423 --- src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index dd84d8de11..fc38f9e2b2 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -320,7 +320,6 @@ static void add_session_elem_to_listener(listener_t *listener, session_elem_t *s } -/* TODO lock */ static void remove_session_elem_from_listener(listener_t *listener, session_elem_t *session_element) { switch_core_hash_delete(listener->sessions, session_element->uuid_str); @@ -789,9 +788,8 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) /* TODO - eliminate session destroy races and we shouldn't lock the session hash */ switch_thread_rwlock_wrlock(listener->session_rwlock); if ((s = find_session_elem_by_pid(listener, pid))) { - if (remove_session_elem_from_listener(listener, s) == SWITCH_STATUS_SUCCESS) { - destroy_session_elem(s); - } + remove_session_elem_from_listener(listener, s); + destroy_session_elem(s); } switch_thread_rwlock_wrlock(listener->session_rwlock); From 7b5a9193aad24e37ab1001f71f9e3e30008c05b8 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 15:13:11 +0000 Subject: [PATCH 0388/1057] debian: remove support for building sounds and music The various sounds and music have their own source packages now as they have their own conventions and version numbers which fortunately update less frequently than FreeSWITCH itself. --- debian/README.source | 4 +- debian/bootstrap.sh | 117 +------------------------------------------ debian/rules | 13 +---- 3 files changed, 4 insertions(+), 130 deletions(-) diff --git a/debian/README.source b/debian/README.source index 3ecd6e1294..a51994be31 100644 --- a/debian/README.source +++ b/debian/README.source @@ -48,10 +48,8 @@ The format of debian/modules.conf is: To build this package, I recommend running the following from the root directory of your FS git working tree: - mkdir ../sounds - export FS_SOUNDS_DIR=$(pwd)/../sounds git clean -fdx && git reset --hard HEAD (cd debian && ./bootstrap.sh) schedtool -B -e git-buildpackage --git-verbose -us -uc - -- Travis Cross , Sat, 5 May 2012 23:32:53 +0000 + -- Travis Cross , Thu, 24 May 2012 16:28:46 +0000 diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 0c2ee5d10a..113675c3e8 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -408,27 +408,13 @@ Description: FreeSWITCH systemd configuration Package: freeswitch-music Architecture: all Depends: \${misc:Depends}, - freeswitch-music-default (= \${binary:Version}) + freeswitch-music-default (>= 1.0.8) Description: Music on hold audio for FreeSWITCH $(debian_wrap "${fs_description}") . This is a metapackage which depends on the default music on hold packages for FreeSWITCH. -Package: freeswitch-music-default -Architecture: all -Depends: \${misc:Depends}, - freeswitch-music-default-8k (= \${binary:Version}) -Recommends: - freeswitch-music-default-16k (= \${binary:Version}), - freeswitch-music-default-32k (= \${binary:Version}), - freeswitch-music-default-48k (= \${binary:Version}) -Description: Music on hold audio for FreeSWITCH - $(debian_wrap "${fs_description}") - . - This is a metapackage which depends on the default music on hold - packages for FreeSWITCH at various sampling rates. - Package: freeswitch-sounds Architecture: all Depends: \${misc:Depends}, @@ -452,27 +438,13 @@ Description: English sounds for FreeSWITCH Package: freeswitch-sounds-en-us Architecture: all Depends: \${misc:Depends}, - freeswitch-sounds-en-us-callie (= \${binary:Version}) + freeswitch-sounds-en-us-callie (>= 1.0.18) Description: US English sounds for FreeSWITCH $(debian_wrap "${fs_description}") . This is a metapackage which depends on the default US/English sound packages for FreeSWITCH. -Package: freeswitch-sounds-en-us-callie -Architecture: all -Depends: \${misc:Depends}, - freeswitch-sounds-en-us-callie-8k (= \${binary:Version}) -Recommends: - freeswitch-sounds-en-us-callie-16k (= \${binary:Version}), - freeswitch-sounds-en-us-callie-32k (= \${binary:Version}), - freeswitch-sounds-en-us-callie-48k (= \${binary:Version}) -Description: US English sounds for FreeSWITCH - $(debian_wrap "${fs_description}") - . - This is a metapackage which depends on the US/English Callie sound - packages for FreeSWITCH at various sampling rates. - EOF } @@ -557,14 +529,6 @@ print_conf_overrides () { print_common_overrides "$1" } -print_sound_overrides () { - print_common_overrides "$1" -} - -print_music_overrides () { - print_common_overrides "$1" -} - print_conf_control () { cat <> $f } -genmusic () { - rate="$1" rate_k="${rate%%000}k" - print_music_control >> control - local p=freeswitch-music-default-${rate_k} - local f=$p.install - (print_edit_warning; print_music_install) > $f - test -f $f.tmpl && cat $f.tmpl >> $f - local f=$p.lintian-overrides - (print_edit_warning; print_music_overrides "$p") > $f - test -f $f.tmpl && cat $f.tmpl >> $f - unset rate rate_k -} - -gensound () { - rate="$1" rate_k="${rate%%000}k" sound_path="$2" sound="${2,,}" - language=$(echo $sound | cut -d/ -f1) - country=$(echo $sound | cut -d/ -f2) - speaker=$(echo $sound | cut -d/ -f3) - print_sound_control >> control - local p=freeswitch-sounds-${sound//\//-}-${rate_k} - local f=$p.install - (print_edit_warning; print_sound_install) > $f - test -f $f.tmpl && cat $f.tmpl >> $f - local f=$p.lintian-overrides - (print_edit_warning; print_sound_overrides "$p") > $f - test -f $f.tmpl && cat $f.tmpl >> $f - unset rate rate_k sound sound_path language country speaker -} - accumulate_build_depends () { local x="" if [ -n "$(eval echo \$build_depends_$codename)" ]; then @@ -865,14 +760,6 @@ map_modules 'mod_filter' '' 'accumulate_build_depends' echo "Generating debian/..." >&2 > control (print_edit_warning; print_source_control; print_core_control) >> control -echo "Generating debian/ (music)..." >&2 -for r in 8000 16000 32000 48000; do genmusic $r; done -echo "Generating debian/ (sounds)..." >&2 -for x in 'en/us/callie'; do - for r in 8000 16000 32000 48000; do - gensound $r $x - done -done echo "Generating debian/ (conf)..." >&2 (echo "### conf"; echo) >> control map_confs 'genconf' diff --git a/debian/rules b/debian/rules index 60c5210940..0e864c398d 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,6 @@ FS_CFLAGS?=-ggdb3 -O2 FS_CPPFLAGS?= FS_CXXFLAGS?=$(FS_CFLAGS) -FS_INSTALL_SOUNDS?=true export PATH?=/usr/lib/ccache:/usr/sbin:/usr/bin:/sbin:/bin export CFLAGS=$(FS_CFLAGS) export CPPFLAGS=$(FS_CPPFLAGS) @@ -20,7 +19,6 @@ show_vars= \ echo "CFLAGS='$(CFLAGS)'"; \ echo "CXXFLAGS='$(CXXFLAGS)'"; \ echo "CCACHE_DIR='$(CCACHE_DIR)'"; \ - echo "FS_INSTALL_SOUNDS='$(FS_INSTALL_SOUNDS)'"; \ echo; binary: @@ -90,7 +88,6 @@ override_dh_strip: override_dh_auto_install: dh_auto_install - -$(FS_INSTALL_SOUNDS) && DESTDIR=debian/tmp make cd-sounds-install cd-moh-install mkdir -p debian/tmp/lib/systemd/system install -m0644 debian/freeswitch-systemd.freeswitch.service debian/tmp/lib/systemd/system/freeswitch.service rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING @@ -118,13 +115,5 @@ binary-quicktest: @$(call show_vars) echo "applications/mod_commands" > debian/modules.conf (cd debian && ./bootstrap.sh) - env FS_INSTALL_SOUNDS=false dh binary \ - -Nfreeswitch-sounds-music-8k \ - -Nfreeswitch-sounds-music-16k \ - -Nfreeswitch-sounds-music-32k \ - -Nfreeswitch-sounds-music-48k \ - -Nfreeswitch-sounds-en-us-callie-8k \ - -Nfreeswitch-sounds-en-us-callie-16k \ - -Nfreeswitch-sounds-en-us-callie-32k \ - -Nfreeswitch-sounds-en-us-callie-48k + dh binary From 1050a2a9f91fec8fd0beba99bf09dcab4059d9d8 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 15:16:13 +0000 Subject: [PATCH 0389/1057] debian: version bump --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3df3c52971..9d901307ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +freeswitch (1.2~rc2-1) unstable; urgency=low + + * Bump version. + * Sounds and music have been moved to their own source packaging. + + -- Travis Cross Thu, 24 May 2012 15:15:10 +0000 + freeswitch (1.2~alpha1-1) unstable; urgency=low * Initial release of FreeSWITCH in new debian packaging. From 879a798ef3fc4ebd270b5dc305135f4237dc9d21 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 16:36:31 +0000 Subject: [PATCH 0390/1057] debian: document a better way to build packaging --- debian/README.source | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/README.source b/debian/README.source index a51994be31..ab31d9b711 100644 --- a/debian/README.source +++ b/debian/README.source @@ -48,8 +48,17 @@ The format of debian/modules.conf is: To build this package, I recommend running the following from the root directory of your FS git working tree: + distro=sid + ver="$(cat build/next-release.txt | sed -e 's/-/~/g')~n$(date +%Y%m%dT%H%M%SZ)-1~${distro}+1" git clean -fdx && git reset --hard HEAD - (cd debian && ./bootstrap.sh) - schedtool -B -e git-buildpackage --git-verbose -us -uc + ./build/set-fs-version.sh "$ver" + git add configure.in && git commit -m "bump to custom v$ver" + (cd debian && ./bootstrap.sh -c $distro) + dch -b -m -v "$ver" --force-distribution -D "$suite" "Custom build." + git-buildpackage -b -us -uc \ + --git-verbose \ + --git-pbuilder --git-dist=$distro \ + --git-compression-level=1v --git-compression=xz + git reset --hard HEAD^ - -- Travis Cross , Thu, 24 May 2012 16:28:46 +0000 + -- Travis Cross , Thu, 24 May 2012 16:35:57 +0000 From 2a257a56a223ad15525caa9062e8aac909fa039d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 May 2012 13:06:32 -0500 Subject: [PATCH 0391/1057] default to forking system on non-windows --- src/switch_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_core.c b/src/switch_core.c index f89aeb5ee2..8f1543e028 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1431,8 +1431,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_set_flag((&runtime.dummy_cng_frame), SFF_CNG); switch_set_flag((&runtime), SCF_AUTO_SCHEMAS); switch_set_flag((&runtime), SCF_CLEAR_SQL); +#ifdef WIN32 switch_set_flag((&runtime), SCF_THREADED_SYSTEM_EXEC); - +#endif switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS); runtime.hard_log_level = SWITCH_LOG_DEBUG; runtime.mailer_app = "sendmail"; From 1cfd145c171968bd7b184206e281f773d6feebdf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 May 2012 13:07:26 -0500 Subject: [PATCH 0392/1057] add support for variable expander to recognize 717 vars as specificly globals --- src/switch_channel.c | 18 ++++++++++++++---- src/switch_event.c | 17 +++++++++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 7afe342103..e06706cbc3 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3411,12 +3411,16 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c memset(data, 0, olen); c = data; for (p = indup; p && p < endof_indup && *p; p++) { + int global = 0; vtype = 0; if (*p == '\\') { if (*(p + 1) == '$') { nv = 1; p++; + if (*(p + 1) == '$') { + p++; + } } else if (*(p + 1) == '\'') { p++; continue; @@ -3428,9 +3432,15 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c } if (*p == '$' && !nv) { + + if (*(p + 1) == '$') { + p++; + global++; + } + if (*(p + 1)) { if (*(p + 1) == '{') { - vtype = 1; + vtype = global ? 3 : 1; } else { nv = 1; } @@ -3452,7 +3462,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c s++; - if (vtype == 1 && *s == '{') { + if ((vtype == 1 || vtype == 3) && *s == '{') { br = 1; s++; } @@ -3513,7 +3523,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c vtype = 2; } - if (vtype == 1) { + if (vtype == 1 || vtype == 3) { char *expanded = NULL; int offset = 0; int ooffset = 0; @@ -3540,7 +3550,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c idx = atoi(ptr); } - if ((sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) { + if (vtype == 3 || (sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) { if (var_list && !switch_event_check_permission_list(var_list, vname)) { sub_val = "INVALID"; } diff --git a/src/switch_event.c b/src/switch_event.c index 9a0776efd1..defae3586c 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1957,12 +1957,16 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, memset(data, 0, olen); c = data; for (p = indup; p && p < endof_indup && *p; p++) { + int global = 0; vtype = 0; if (*p == '\\') { if (*(p + 1) == '$') { nv = 1; p++; + if (*(p + 1) == '$') { + p++; + } } else if (*(p + 1) == '\'') { p++; continue; @@ -1974,9 +1978,14 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, } if (*p == '$' && !nv) { + if (*(p + 1) == '$') { + p++; + global++; + } + if (*(p + 1)) { if (*(p + 1) == '{') { - vtype = 1; + vtype = global ? 3 : 1; } else { nv = 1; } @@ -1998,7 +2007,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, s++; - if (vtype == 1 && *s == '{') { + if ((vtype == 1 || vtype == 3) && *s == '{') { br = 1; s++; } @@ -2060,7 +2069,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, vtype = 2; } - if (vtype == 1) { + if (vtype == 1 || vtype == 3) { char *expanded = NULL; int offset = 0; int ooffset = 0; @@ -2086,7 +2095,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, idx = atoi(ptr); } - if (!(sub_val = switch_event_get_header_idx(event, vname, idx))) { + if (vtype == 3 || !(sub_val = switch_event_get_header_idx(event, vname, idx))) { switch_safe_free(gvar); if ((gvar = switch_core_get_variable_dup(vname))) { sub_val = gvar; From 8c889aa3a758e16437ad38ad96852c6b1c6e1aa6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 May 2012 13:07:46 -0500 Subject: [PATCH 0393/1057] add param for scgi to monitor its own server process --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 100 +++++++++++++++++++- 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 6ee62d6ac9..1ac74ebbdf 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -46,6 +46,9 @@ struct xml_binding { switch_hash_t *vars_map; char *bindings; + char *server; + switch_thread_t *thread; + struct xml_binding *next; }; static int GLOBAL_DEBUG = 0; @@ -63,6 +66,8 @@ static struct { switch_memory_pool_t *pool; hash_node_t *hash_root; hash_node_t *hash_tail; + int running; + xml_binding_t *bindings; } globals; #define XML_SCGI_SYNTAX "[debug_on|debug_off]" @@ -92,6 +97,38 @@ SWITCH_STANDARD_API(xml_scgi_function) return SWITCH_STATUS_SUCCESS; } +void *SWITCH_THREAD_FUNC monitor_thread_run(switch_thread_t *thread, void *obj) +{ + xml_binding_t *binding = (xml_binding_t *) obj; + time_t st; + int diff; + + while(globals.running) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Running server command: %s\n", binding->server); + st = switch_epoch_time_now(NULL); + switch_system(binding->server, SWITCH_TRUE); + diff = (int) switch_epoch_time_now(NULL) - st; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Server command complete: %s\n", binding->server); + + if (globals.running && diff < 5) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Server command had short run duration, sleeping: %s\n", binding->server); + switch_yield(10000000); + } + } + + return NULL; +} + +static void launch_monitor_thread(xml_binding_t *binding) +{ + switch_threadattr_t *thd_attr = NULL; + + switch_threadattr_create(&thd_attr, globals.pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(thd_attr); + switch_thread_create(&binding->thread, thd_attr, monitor_thread_run, binding, globals.pool); +} + static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data) @@ -130,6 +167,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con txt = (char *) stream.data; while((len = scgi_recv(&handle, buf, sizeof(buf))) > 0) { + char *expanded = switch_event_expand_headers(params, (char *)buf); bytes += len; @@ -139,8 +177,14 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con break; } - stream.write_function(&stream, "%s", buf); + stream.write_function(&stream, "%s", expanded); txt = (char *) stream.data; + + if (expanded != (char *)buf) { + free(expanded); + } + + memset(buf, 0, sizeof(buf)); } scgi_disconnect(&handle); @@ -210,7 +254,8 @@ static switch_status_t do_config(void) char *port = "8080"; char *bind_mask = NULL; int timeout = 0; - + char *server = NULL; + hash_node_t *hash_node; need_vars_map = 0; vars_map = NULL; @@ -248,6 +293,8 @@ static switch_status_t do_config(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't add %s to params hash!\n", val); } } + } else if (!strcasecmp(var, "server")) { + server = val; } } @@ -273,6 +320,10 @@ static switch_status_t do_config(void) binding->vars_map = vars_map; binding->url = switch_mprintf("scgi://%s:%s/%s", host, port, bname); + if (server) { + binding->server = switch_core_strdup(globals.pool, server); + } + if (bind_mask) { binding->bindings = switch_core_strdup(globals.pool, bind_mask); } @@ -297,6 +348,15 @@ static switch_status_t do_config(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n", zstr(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all"); switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding); + + if (binding->server) { + launch_monitor_thread(binding); + } + + binding->next = globals.bindings; + globals.bindings = binding; + + x++; binding = NULL; } @@ -315,6 +375,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_scgi_load) *module_interface = switch_loadable_module_create_module_interface(pool, modname); memset(&globals, 0, sizeof(globals)); + globals.running = 1; globals.pool = pool; globals.hash_root = NULL; globals.hash_tail = NULL; @@ -334,6 +395,41 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_scgi_load) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_scgi_shutdown) { hash_node_t *ptr = NULL; + xml_binding_t *bp; + + globals.running = 0; + + for(bp = globals.bindings; bp; bp = bp->next) { + if (bp->thread) { + switch_status_t st; + scgi_handle_t handle = { 0 }; + unsigned char buf[16336] = ""; + int x = 3; + + scgi_add_param(&handle, "REQUEST_METHOD", "POST"); + scgi_add_param(&handle, "REQUEST_URI", bp->url); + scgi_add_body(&handle, "SHUTDOWN"); + + while(x--) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sending shutdown message to server for %s\n", bp->url); + + if (scgi_connect(&handle, bp->host, bp->port, bp->timeout * 1000) == SCGI_SUCCESS) { + while(0 && scgi_recv(&handle, buf, sizeof(buf)) > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s\n", (char *) buf); + memset(buf, 0, sizeof(buf)); + } + break; + } + + switch_yield(5000000); + } + + scgi_disconnect(&handle); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for server to stop.\n"); + switch_thread_join(&st, bp->thread); + } + } + while (globals.hash_root) { ptr = globals.hash_root; From 23f8967c32e63050af93b43c66ec94e7b404b063 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 24 May 2012 20:39:03 +0000 Subject: [PATCH 0394/1057] add enhanced zrtp passthrough (zrtp passthru) mode ZRTP passthrough mode allows two ZRTP-capable clients to negotiate an end-to-end security association through FreeSWITCH. The clients are therefore able to be certain that the FreeSWITCH instance mediating the call cannot eavesdrop on their conversation. Importantly, this capability is maintained across multiple FreeSWITCH hops. If widely deployed, this enables a global network architecture where two people can speak securely with strong cryptographically protected authentication and confidentiality. With this commit we implement a zrtp-passthru mode that handles all the details of the negotiation intelligently. This mode can be selected by setting the boolean parameter inbound-zrtp-passthru in the sofia profile. This will also force late-negotiation as it is essential for correctly negotiating an end-to-end ZRTP security association. When an incoming call with a zrtp-hash is received and this mode is enabled, we find the first audio and the first video zrtp-hash in the SDP and store them as remote values on this channel. Once a b-leg is available, we set the local zrtp-hash values on that channel to the remote zrtp-hash values collected from the a-leg. Because zrtp-passthru absolutely requires that the channels negotiate the same codec, we offer to the b-leg only codecs that the a-leg can speak. Once the b-leg accepts a codec, we will force that choice onto the a-leg. If the b-leg sends us zrtp-hash values in the signaling, we store those as remote values on the b-leg and copy them to the local values on the a-leg. At this point, each leg has the zrtp-hash values from the other, and we know we can do ZRTP passthrough mode on the call. We send the b-leg's zrtp-hash back to the a-leg in the 200 OK. We then enable UDPTL mode on the rtp streams for both the audio and the video so that we don't interfere in the ZRTP negotiation. If the b-leg fails to return a zrtp-hash in the signaling, we set up a ZRTP security association with the a-leg ourselves, if we are so equipped. Likewise, if the a-leg fails to send a zrtp-hash in the signaling, we attempt to set up a ZRTP security association ourselves with the b-leg. The zrtp-passthru mode can also be enabled in the dialplan by setting the boolean channel variable zrtp_passthru. If enabled in this manner, we can't force late-negotiation, so the user would need to be sure this is configured. If ZRTP passthrough mode is not enabled in either manner, this change should have no effect. Channel variables for each of the various zrtp-hash values are set, though it is anticipated that there is no good reason to use them, so they may be removed without warning. For checking whether zrtp passthrough mode was successful, we provide the channel variable zrtp_passthru_active which is set on both legs. Though not implemented by this commit, the changes here should make it more straightforward to add correct zrtp-hash values to the signaling and verify that correct hello hash values are received when FreeSWITCH is acting as a terminating leg of the ZRTP security association. A historical note... This commit replaces the recently-added sdp_zrtp_hash_string method, commit 2ab1605a8887adc62be1b75f6ef67af87ff080de. This prior method sets a channel variable from the a-leg's zrtp-hash, then relies on the dialplan to export this channel variable to the b-leg, where it is put into the SDP. While it was a great start and wonderful for testing, this approach has some drawbacks that motivated the present work: * There's no good way to pass the zrtp-hash from the b-leg back to the a-leg. In fact, the implementation seems to send the a-leg's zrtp-hash back to the originating client in the 200 OK. This is not correct. * To support video, we'd need to have a separate dialplan variable, and the dialplan author would need to deal with that explicitly. * The API is problematic as it requires the dialplan author to understand intricate details of how ZRTP works to implement a correct dialplan. Further, by providing too fine-grained control (but at the same time, not enough control) it would limit our ability to make the behavior smarter once people started relying on this. --- src/include/switch_types.h | 4 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 13 +++ src/mod/endpoints/mod_sofia/mod_sofia.h | 8 ++ src/mod/endpoints/mod_sofia/sofia.c | 20 ++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 139 +++++++++++++++++++---- src/switch_channel.c | 18 ++- src/switch_core_session.c | 4 + src/switch_ivr_originate.c | 11 +- 8 files changed, 186 insertions(+), 31 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 477aa3b877..4699cd238f 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -170,6 +170,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__" #define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media" #define SWITCH_PROXY_MEDIA_VARIABLE "proxy_media" +#define SWITCH_ZRTP_PASSTHRU_VARIABLE "zrtp_passthru" #define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition" #define SWITCH_HOLD_MUSIC_VARIABLE "hold_music" #define SWITCH_TEMP_HOLD_MUSIC_VARIABLE "temp_hold_music" @@ -1213,8 +1214,9 @@ typedef enum { CF_VIDEO_REFRESH_REQ, CF_SERVICE_AUDIO, CF_SERVICE_VIDEO, + CF_ZRTP_PASSTHRU_REQ, + CF_ZRTP_PASSTHRU, CF_ZRTP_HASH, - CF_ZRTP_PASS, CF_CHANNEL_SWAP, CF_PICKUP, CF_CONFIRM_BLIND_TRANSFER, diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ebd009a16d..92a27fd0f2 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2997,6 +2997,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t stream->write_function(stream, "NOMEDIA \t%s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false"); stream->write_function(stream, "LATE-NEG \t%s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false"); stream->write_function(stream, "PROXY-MEDIA \t%s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false"); + stream->write_function(stream, "ZRTP-PASSTHRU \t%s\n", sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) ? "true" : "false"); stream->write_function(stream, "AGGRESSIVENAT \t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false"); stream->write_function(stream, "STUN-ENABLED \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false"); @@ -3275,6 +3276,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl stream->write_function(stream, " %s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false"); stream->write_function(stream, " %s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false"); stream->write_function(stream, " %s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false"); + stream->write_function(stream, " %s\n", sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) ? "true" : "false"); stream->write_function(stream, " %s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false"); stream->write_function(stream, " %s\n", @@ -4785,6 +4787,17 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session sofia_clear_flag(ctech_pvt, TFLAG_ENABLE_SOA); } + if (switch_channel_test_flag(o_channel, CF_ZRTP_PASSTHRU_REQ)) { + const char *x = NULL; + sofia_glue_pass_zrtp_hash2(session, nsession); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[zrtp_passthru] Setting a-leg inherit_codec=true\n"); + switch_channel_set_variable(o_channel, "inherit_codec", "true"); + if ((x = switch_channel_get_variable(o_channel, "ep_codec_string"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[zrtp_passthru] Setting b-leg absolute_codec_string='%s'\n", x); + switch_channel_set_variable(nchannel, "absolute_codec_string", x); + } + } + /* SNARK: lets copy this across so we can see if we're the other leg of 3PCC + bypass_media... */ if (sofia_test_flag(ctech_pvt, TFLAG_3PCC) && (switch_channel_test_flag(o_channel, CF_PROXY_MODE) || switch_channel_test_flag(o_channel, CF_PROXY_MEDIA))) { sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index f6e4c1122e..67d513cf27 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -317,6 +317,7 @@ typedef enum { TFLAG_TPORT_LOG, TFLAG_SENT_UPDATE, TFLAG_PROXY_MEDIA, + TFLAG_ZRTP_PASSTHRU, TFLAG_HOLD_LOCK, TFLAG_3PCC_HAS_ACK, TFLAG_PASS_RFC2833, @@ -825,6 +826,11 @@ struct private_object { switch_payload_t ianacodes[SWITCH_MAX_CODECS]; uint32_t session_timeout; enum nua_session_refresher session_refresher; + /** ZRTP **/ + char *local_sdp_audio_zrtp_hash; + char *local_sdp_video_zrtp_hash; + char *remote_sdp_audio_zrtp_hash; + char *remote_sdp_video_zrtp_hash; }; struct callback_t { @@ -932,6 +938,8 @@ void launch_sofia_profile_thread(sofia_profile_t *profile); switch_status_t sofia_presence_chat_send(switch_event_t *message_event); void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt); +void sofia_glue_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session); +void sofia_glue_pass_zrtp_hash(switch_core_session_t *session); /* * \brief Sets the "ep_codec_string" channel variable, parsing r_sdp and taing codec_string in consideration diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e5d026975d..0621b3b84d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3321,6 +3321,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_flag(profile, TFLAG_PROXY_MEDIA); } + } else if (!strcasecmp(var, "inbound-zrtp-passthru")) { + if (switch_true(val)) { + sofia_set_flag(profile, TFLAG_ZRTP_PASSTHRU); + } else { + sofia_clear_flag(profile, TFLAG_ZRTP_PASSTHRU); + } } else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID); @@ -3695,6 +3701,10 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } } + if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU)) { + sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); + } + if ((gateways_tag = switch_xml_child(xprofile, "gateways"))) { parse_gateways(profile, gateways_tag); } @@ -4171,6 +4181,8 @@ switch_status_t config_sofia(int reload, char *profile_name) } } else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) { sofia_set_flag(profile, TFLAG_PROXY_MEDIA); + } else if (!strcasecmp(var, "inbound-zrtp-passthru") && switch_true(val)) { + sofia_set_flag(profile, TFLAG_ZRTP_PASSTHRU); } else if (!strcasecmp(var, "force-subscription-expires")) { int tmp = atoi(val); if (tmp > 0) { @@ -4801,6 +4813,10 @@ switch_status_t config_sofia(int reload, char *profile_name) } } + if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU)) { + sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); + } + if ((!profile->cng_pt) && (!sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG))) { profile->cng_pt = SWITCH_RTP_CNG_PAYLOAD; } @@ -8264,6 +8280,10 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ switch_channel_set_flag(channel, CF_PROXY_MEDIA); } + if (sofia_test_flag(tech_pvt, TFLAG_ZRTP_PASSTHRU)) { + switch_channel_set_flag(channel, CF_ZRTP_PASSTHRU_REQ); + } + if (!tech_pvt->call_id && sip->sip_call_id && sip->sip_call_id->i_id) { tech_pvt->call_id = switch_core_session_strdup(session, sip->sip_call_id->i_id); switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 0adcce9606..6bb7d3ee5f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -184,7 +184,6 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, int rate; int already_did[128] = { 0 }; int ptime = 0, noptime = 0; - const char *zrtp; switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d RTP/%sAVP", port, secure ? "S" : ""); @@ -344,8 +343,11 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=ptime:%d\n", cur_ptime); } - if ((zrtp = switch_channel_get_variable(tech_pvt->channel, "sdp_zrtp_hash_string"))) { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=zrtp-hash:%s\n", zrtp); + if (tech_pvt->local_sdp_audio_zrtp_hash) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Adding audio a=zrtp-hash:%s\n", + tech_pvt->local_sdp_audio_zrtp_hash); + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=zrtp-hash:%s\n", + tech_pvt->local_sdp_audio_zrtp_hash); } if (sr) { @@ -391,7 +393,6 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch switch_event_t *map = NULL, *ptmap = NULL; const char *b_sdp = NULL; int verbose_sdp = 0; - const char *zrtp; sofia_glue_check_dtmf_type(tech_pvt); @@ -545,8 +546,12 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime); } - if ((zrtp = switch_channel_get_variable(tech_pvt->channel, "sdp_zrtp_hash_string"))) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=zrtp-hash:%s\n", zrtp); + + if (tech_pvt->local_sdp_audio_zrtp_hash) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Adding audio a=zrtp-hash:%s\n", + tech_pvt->local_sdp_audio_zrtp_hash); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=zrtp-hash:%s\n", + tech_pvt->local_sdp_audio_zrtp_hash); } if (sr) { @@ -747,6 +752,13 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } } + + if (tech_pvt->local_sdp_video_zrtp_hash) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Adding video a=zrtp-hash:%s\n", + tech_pvt->local_sdp_video_zrtp_hash); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=zrtp-hash:%s\n", + tech_pvt->local_sdp_video_zrtp_hash); + } } } @@ -3563,9 +3575,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp); - if (switch_channel_test_flag(tech_pvt->channel, CF_ZRTP_PASS)) { + if (switch_channel_test_flag(tech_pvt->channel, CF_ZRTP_PASSTHRU)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_INFO, "Activating ZRTP PROXY MODE\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Disable NOTIMER_DURING_BRIDGE\n"); sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Activating audio UDPTL mode\n"); switch_rtp_udptl_mode(tech_pvt->rtp_session); } @@ -3752,7 +3766,10 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f } } } - + if (switch_channel_test_flag(tech_pvt->channel, CF_ZRTP_PASSTHRU)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Activating video UDPTL mode\n"); + switch_rtp_udptl_mode(tech_pvt->video_rtp_session); + } } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err)); @@ -3837,7 +3854,93 @@ static void add_audio_codec(sdp_rtpmap_t *map, int ptime, char *buf, switch_size } +void sofia_glue_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session) +{ + switch_channel_t *aleg_channel = switch_core_session_get_channel(aleg_session); + private_object_t *aleg_tech_pvt = switch_core_session_get_private(aleg_session); + switch_channel_t *bleg_channel = switch_core_session_get_channel(bleg_session); + private_object_t *bleg_tech_pvt = switch_core_session_get_private(bleg_session); + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "Deciding whether to pass zrtp-hash between a-leg and b-leg\n"); + if (!(switch_channel_test_flag(aleg_tech_pvt->channel, CF_ZRTP_PASSTHRU_REQ))) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "CF_ZRTP_PASSTHRU_REQ not set on a-leg, so not propagating zrtp-hash\n"); + return; + } + if (aleg_tech_pvt->remote_sdp_audio_zrtp_hash) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "Passing a-leg remote zrtp-hash (audio) to b-leg\n"); + bleg_tech_pvt->local_sdp_audio_zrtp_hash = switch_core_session_strdup(bleg_tech_pvt->session, aleg_tech_pvt->remote_sdp_audio_zrtp_hash); + switch_channel_set_variable(bleg_channel, "l_sdp_audio_zrtp_hash", bleg_tech_pvt->local_sdp_audio_zrtp_hash); + } + if (aleg_tech_pvt->remote_sdp_video_zrtp_hash) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "Passing a-leg remote zrtp-hash (video) to b-leg\n"); + bleg_tech_pvt->local_sdp_video_zrtp_hash = switch_core_session_strdup(bleg_tech_pvt->session, aleg_tech_pvt->remote_sdp_video_zrtp_hash); + switch_channel_set_variable(bleg_channel, "l_sdp_video_zrtp_hash", bleg_tech_pvt->local_sdp_video_zrtp_hash); + } + if (bleg_tech_pvt->remote_sdp_audio_zrtp_hash) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "Passing b-leg remote zrtp-hash (audio) to a-leg\n"); + aleg_tech_pvt->local_sdp_audio_zrtp_hash = switch_core_session_strdup(aleg_tech_pvt->session, bleg_tech_pvt->remote_sdp_audio_zrtp_hash); + switch_channel_set_variable(aleg_channel, "l_sdp_audio_zrtp_hash", aleg_tech_pvt->local_sdp_audio_zrtp_hash); + } + if (bleg_tech_pvt->remote_sdp_video_zrtp_hash) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "Passing b-leg remote zrtp-hash (video) to a-leg\n"); + aleg_tech_pvt->local_sdp_video_zrtp_hash = switch_core_session_strdup(aleg_tech_pvt->session, bleg_tech_pvt->remote_sdp_video_zrtp_hash); + switch_channel_set_variable(aleg_channel, "l_sdp_video_zrtp_hash", aleg_tech_pvt->local_sdp_video_zrtp_hash); + } +} +void sofia_glue_pass_zrtp_hash(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + private_object_t *tech_pvt = switch_core_session_get_private(session); + switch_core_session_t *other_session; + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Deciding whether to pass zrtp-hash between legs\n"); + if (!(switch_channel_test_flag(tech_pvt->channel, CF_ZRTP_PASSTHRU_REQ))) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "CF_ZRTP_PASSTHRU_REQ not set, so not propagating zrtp-hash\n"); + return; + } else if (!(switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS)) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "No partner channel found, so not propagating zrtp-hash\n"); + return; + } else { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Found peer channel; propagating zrtp-hash if set\n"); + sofia_glue_pass_zrtp_hash2(session, other_session); + switch_core_session_rwunlock(other_session); + } +} + +static void find_zrtp_hash(switch_core_session_t *session, sdp_session_t *sdp) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + private_object_t *tech_pvt = switch_core_session_get_private(session); + sdp_media_t *m; + sdp_attribute_t *attr; + int got_audio = 0, got_video = 0; + + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Looking for zrtp-hash\n"); + for (m = sdp->sdp_media; m; m = m->m_next) { + if (got_audio && got_video) break; + if (m->m_port && ((m->m_type == sdp_media_audio && !got_audio) + || (m->m_type == sdp_media_video && !got_video))) { + for (attr = m->m_attributes; attr; attr = attr->a_next) { + if (zstr(attr->a_name)) continue; + if (strcasecmp(attr->a_name, "zrtp-hash") || !(attr->a_value)) continue; + if (m->m_type == sdp_media_audio) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, + "Found audio zrtp-hash; setting r_sdp_audio_zrtp_hash=%s\n", attr->a_value); + switch_channel_set_variable(channel, "r_sdp_audio_zrtp_hash", attr->a_value); + tech_pvt->remote_sdp_audio_zrtp_hash = switch_core_session_strdup(tech_pvt->session, attr->a_value); + got_audio++; + } else if (m->m_type == sdp_media_video) { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, + "Found video zrtp-hash; setting r_sdp_video_zrtp_hash=%s\n", attr->a_value); + switch_channel_set_variable(channel, "r_sdp_video_zrtp_hash", attr->a_value); + tech_pvt->remote_sdp_video_zrtp_hash = switch_core_session_strdup(tech_pvt->session, attr->a_value); + got_video++; + } + switch_channel_set_flag(channel, CF_ZRTP_HASH); + break; + } + } + } +} void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp) { @@ -3887,18 +3990,8 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha } } - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Looking for zrtp-hash to set sdp_zrtp_hash_string\n"); - for (m = sdp->sdp_media; m; m = m->m_next) { - for (attr = m->m_attributes; attr; attr = attr->a_next) { - if (zstr(attr->a_name)) continue; - if (!strcasecmp(attr->a_name, "zrtp-hash") && attr->a_value) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Found zrtp-hash, setting sdp_zrtp_hash_string=%s\n", attr->a_value); - switch_channel_set_variable(channel, "sdp_zrtp_hash_string", attr->a_value); - switch_channel_set_flag(channel, CF_ZRTP_HASH); - break; - } - } - } + find_zrtp_hash(session, sdp); + sofia_glue_pass_zrtp_hash(session); for (m = sdp->sdp_media; m; m = m->m_next) { ptime = dptime; @@ -4578,6 +4671,9 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s switch_channel_set_variable(tech_pvt->channel, "t38_broken_boolean", "true"); } + find_zrtp_hash(session, sdp); + sofia_glue_pass_zrtp_hash(session); + for (m = sdp->sdp_media; m; m = m->m_next) { sdp_connection_t *connection; switch_core_session_t *other_session; @@ -4699,9 +4795,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s ptime = atoi(attr->a_value); } else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) { maxptime = atoi(attr->a_value); - } else if (!strcasecmp(attr->a_name, "zrtp-hash") && attr->a_value) { - switch_channel_set_variable(tech_pvt->channel, "sdp_zrtp_hash_string", attr->a_value); - switch_channel_set_flag(tech_pvt->channel, CF_ZRTP_HASH); } else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) { int crypto_tag; diff --git a/src/switch_channel.c b/src/switch_channel.c index e06706cbc3..dc983c78cd 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2955,7 +2955,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) { - if (switch_channel_test_flag(channel, CF_ZRTP_HASH) && !switch_channel_test_flag(channel, CF_ZRTP_PASS)) { + if (!switch_channel_test_flag(channel, CF_ZRTP_PASSTHRU) + && switch_channel_test_flag(channel, CF_ZRTP_PASSTHRU_REQ) + && switch_channel_test_flag(channel, CF_ZRTP_HASH)) { switch_core_session_t *other_session; switch_channel_t *other_channel; int doit = 1; @@ -2963,14 +2965,16 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) if (switch_core_session_get_partner(channel->session, &other_session) == SWITCH_STATUS_SUCCESS) { other_channel = switch_core_session_get_channel(other_session); - if (switch_channel_test_flag(other_channel, CF_ZRTP_HASH) && !switch_channel_test_flag(other_channel, CF_ZRTP_PASS)) { + if (switch_channel_test_flag(other_channel, CF_ZRTP_HASH) && !switch_channel_test_flag(other_channel, CF_ZRTP_PASSTHRU)) { - switch_channel_set_flag(channel, CF_ZRTP_PASS); - switch_channel_set_flag(other_channel, CF_ZRTP_PASS); + switch_channel_set_flag(channel, CF_ZRTP_PASSTHRU); + switch_channel_set_flag(other_channel, CF_ZRTP_PASSTHRU); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s Activating ZRTP passthru mode.\n", switch_channel_get_name(channel)); + switch_channel_set_variable(channel, "zrtp_passthru_active", "true"); + switch_channel_set_variable(other_channel, "zrtp_passthru_active", "true"); switch_channel_set_variable(channel, "zrtp_secure_media", "false"); switch_channel_set_variable(other_channel, "zrtp_secure_media", "false"); doit = 0; @@ -2980,18 +2984,20 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) } if (doit) { + switch_channel_set_variable(channel, "zrtp_passthru_active", "false"); switch_channel_set_variable(channel, "zrtp_secure_media", "true"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s ZRTP not negotiated on both sides; disabling ZRTP passthru mode.\n", switch_channel_get_name(channel)); - switch_channel_clear_flag(channel, CF_ZRTP_PASS); + switch_channel_clear_flag(channel, CF_ZRTP_PASSTHRU); switch_channel_clear_flag(channel, CF_ZRTP_HASH); if (switch_core_session_get_partner(channel->session, &other_session) == SWITCH_STATUS_SUCCESS) { other_channel = switch_core_session_get_channel(other_session); + switch_channel_set_variable(other_channel, "zrtp_passthru_active", "false"); switch_channel_set_variable(other_channel, "zrtp_secure_media", "true"); - switch_channel_clear_flag(other_channel, CF_ZRTP_PASS); + switch_channel_clear_flag(other_channel, CF_ZRTP_PASSTHRU); switch_channel_clear_flag(other_channel, CF_ZRTP_HASH); switch_core_session_rwunlock(other_session); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 56c6e0b3a4..4e43987ecf 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -577,6 +577,10 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } } + if (switch_channel_test_flag(channel, CF_ZRTP_PASSTHRU_REQ)) { + switch_channel_set_flag(peer_channel, CF_ZRTP_PASSTHRU_REQ); + } + if (profile) { if ((cloned_profile = switch_caller_profile_clone(*new_session, profile)) != 0) { switch_channel_set_originator_caller_profile(peer_channel, cloned_profile); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 87ff02ec8c..98fed62b34 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1820,7 +1820,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } if (session) { - const char *to_var, *bypass_media = NULL, *proxy_media = NULL; + const char *to_var, *bypass_media = NULL, *proxy_media = NULL, *zrtp_passthru = NULL; caller_channel = switch_core_session_get_channel(session); switch_channel_set_flag(caller_channel, CF_ORIGINATOR); oglobals.session = session; @@ -1833,6 +1833,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess proxy_media = switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE); bypass_media = switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE); + zrtp_passthru = switch_channel_get_variable(caller_channel, SWITCH_ZRTP_PASSTHRU_VARIABLE); if (!zstr(proxy_media)) { if (switch_true(proxy_media)) { @@ -1842,6 +1843,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + if (!zstr(zrtp_passthru)) { + if (switch_true(zrtp_passthru)) { + switch_channel_set_flag(caller_channel, CF_ZRTP_PASSTHRU_REQ); + } else if (switch_channel_test_flag(caller_channel, CF_ZRTP_PASSTHRU_REQ)) { + switch_channel_clear_flag(caller_channel, CF_ZRTP_PASSTHRU_REQ); + } + } + if (bypass_media && switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(caller_channel, CF_ANSWERED)) { switch_core_session_message_t msg = { 0 }; From 9daf595443bb369b1859e64c7337aa429a39fa17 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 May 2012 13:52:47 -0500 Subject: [PATCH 0395/1057] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 251 +++++++++++++++++- src/mod/languages/mod_managed/managed/swig.cs | 210 ++++++++++++++- 2 files changed, 453 insertions(+), 8 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 557cb05f76..5884b42cf5 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1113,6 +1113,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_READ_RESULT_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ATT_XFER_RESULT_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "att_xfer_result"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1124,6 +1135,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_JSON_CDR_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "copy_json_cdr"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -6732,6 +6754,54 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_disable_heartbeat(void * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_pop(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_media_bug_t **arg3 = (switch_media_bug_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_media_bug_t **)jarg3; + result = (switch_status_t)switch_core_media_bug_pop(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_exec_all(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_media_bug_exec_cb_t arg3 = (switch_media_bug_exec_cb_t) 0 ; + void *arg4 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_media_bug_exec_cb_t)jarg3; + arg4 = (void *)jarg4; + result = (switch_status_t)switch_core_media_bug_exec_all(arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_count(void * jarg1, char * jarg2) { + unsigned long jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + uint32_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + result = (uint32_t)switch_core_media_bug_count(arg1,(char const *)arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_add(void * jarg1, char * jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6, unsigned long jarg7, void * jarg8) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -6838,6 +6908,16 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_read_replace_fram } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_read_demux_frame(void * jarg1, void * jarg2) { + switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ; + switch_frame_t *arg2 = (switch_frame_t *) 0 ; + + arg1 = (switch_media_bug_t *)jarg1; + arg2 = (switch_frame_t *)jarg2; + switch_core_media_bug_set_read_demux_frame(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_session(void * jarg1) { void * jresult ; switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ; @@ -6964,13 +7044,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_close(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all_function(void * jarg1, char * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; switch_status_t result; arg1 = (switch_core_session_t *)jarg1; - result = (switch_status_t)switch_core_media_bug_remove_all(arg1); + arg2 = (char *)jarg2; + result = (switch_status_t)switch_core_media_bug_remove_all_function(arg1,(char const *)arg2); jresult = result; return jresult; } @@ -9303,6 +9385,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_read_impl(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_real_read_impl(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_codec_implementation_t *)jarg2; + result = (switch_status_t)switch_core_session_get_real_read_impl(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_write_impl(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -11467,6 +11563,23 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_close_extra_files(void * jarg1, int ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_thread_set_cpu_affinity(int jarg1) { + int jresult ; + int arg1 ; + switch_status_t result; + + arg1 = (int)jarg1; + result = (switch_status_t)switch_core_thread_set_cpu_affinity(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_os_yield() { + switch_os_yield(); +} + + 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 ; @@ -11970,6 +12083,24 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_codec_interface( } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_parse_codec_buf(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { + char * jresult ; + char *arg1 = (char *) 0 ; + uint32_t *arg2 = (uint32_t *) 0 ; + uint32_t *arg3 = (uint32_t *) 0 ; + uint32_t *arg4 = (uint32_t *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + arg2 = (uint32_t *)jarg2; + arg3 = (uint32_t *)jarg3; + arg4 = (uint32_t *)jarg4; + result = (char *)switch_parse_codec_buf(arg1,arg2,arg3,arg4); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_dialplan_interface(char * jarg1) { void * jresult ; char *arg1 = (char *) 0 ; @@ -27723,6 +27854,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_check_permission_list(void * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_add_presence_data_cols(void * jarg1, void * jarg2, char * jarg3) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_event_t *arg2 = (switch_event_t *) 0 ; + char *arg3 = (char *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_event_t *)jarg2; + arg3 = (char *)jarg3; + switch_event_add_presence_data_cols(arg1,arg2,(char const *)arg3); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RESAMPLE_QUALITY_get() { int jresult ; int result; @@ -28123,6 +28266,24 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_merge_sln(void * jarg1, unsig } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_unmerge_sln(void * jarg1, unsigned long jarg2, void * jarg3, unsigned long jarg4) { + unsigned long jresult ; + int16_t *arg1 = (int16_t *) 0 ; + uint32_t arg2 ; + int16_t *arg3 = (int16_t *) 0 ; + uint32_t arg4 ; + uint32_t result; + + arg1 = (int16_t *)jarg1; + arg2 = (uint32_t)jarg2; + arg3 = (int16_t *)jarg3; + arg4 = (uint32_t)jarg4; + result = (uint32_t)switch_unmerge_sln(arg1,arg2,arg3,arg4); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_mux_channels(void * jarg1, void * jarg2, unsigned long jarg3) { int16_t *arg1 = (int16_t *) 0 ; switch_size_t arg2 ; @@ -28581,6 +28742,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_activate_unicast(void * jarg1, char } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_generate_json_cdr(void * jarg1, void * jarg2, int jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + cJSON **arg2 = (cJSON **) 0 ; + switch_bool_t arg3 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (cJSON **)jarg2; + arg3 = (switch_bool_t)jarg3; + result = (switch_status_t)switch_ivr_generate_json_cdr(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_generate_xml_cdr(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -28991,6 +29168,52 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_session(void * jarg1, char * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_pop_eavesdropper(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_core_session_t **arg2 = (switch_core_session_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_core_session_t **)jarg2; + result = (switch_status_t)switch_ivr_eavesdrop_pop_eavesdropper(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_exec_all(void * jarg1, char * jarg2, char * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + result = (switch_status_t)switch_ivr_eavesdrop_exec_all(arg1,(char const *)arg2,(char const *)arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_update_display(void * jarg1, char * jarg2, char * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + result = (switch_status_t)switch_ivr_eavesdrop_update_display(arg1,(char const *)arg2,(char const *)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_session(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -30703,6 +30926,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_kill_uuid(char * jarg1, int jarg2) } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_blind_transfer_ack(void * jarg1, int jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_bool_t arg2 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + result = (switch_status_t)switch_ivr_blind_transfer_ack(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; @@ -31771,6 +32008,16 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_check_auto_adj(void * jar } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_interdigit_delay(void * jarg1, unsigned long jarg2) { + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_rtp_set_interdigit_delay(arg1,arg2); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_data_set(void * jarg1, char * jarg2) { switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 94fecfa933..b16a97ed95 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1054,6 +1054,21 @@ public class freeswitch { freeswitchPINVOKE.switch_core_session_disable_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session)); } + public static switch_status_t switch_core_media_bug_pop(SWIGTYPE_p_switch_core_session orig_session, string function, SWIGTYPE_p_p_switch_media_bug pop) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_pop(SWIGTYPE_p_switch_core_session.getCPtr(orig_session), function, SWIGTYPE_p_p_switch_media_bug.getCPtr(pop)); + return ret; + } + + public static switch_status_t switch_core_media_bug_exec_all(SWIGTYPE_p_switch_core_session orig_session, string function, SWIGTYPE_p_f_p_switch_media_bug_p_void__void cb, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_exec_all(SWIGTYPE_p_switch_core_session.getCPtr(orig_session), function, SWIGTYPE_p_f_p_switch_media_bug_p_void__void.getCPtr(cb), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static uint switch_core_media_bug_count(SWIGTYPE_p_switch_core_session orig_session, string function) { + uint ret = freeswitchPINVOKE.switch_core_media_bug_count(SWIGTYPE_p_switch_core_session.getCPtr(orig_session), function); + return ret; + } + public static switch_status_t switch_core_media_bug_add(SWIGTYPE_p_switch_core_session session, string function, string target, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_time_t stop_time, uint flags, SWIGTYPE_p_p_switch_media_bug new_bug) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_add(SWIGTYPE_p_switch_core_session.getCPtr(session), function, target, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_time_t.getCPtr(stop_time), flags, SWIGTYPE_p_p_switch_media_bug.getCPtr(new_bug)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -1094,6 +1109,10 @@ public class freeswitch { return ret; } + public static void switch_core_media_bug_set_read_demux_frame(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) { + freeswitchPINVOKE.switch_core_media_bug_set_read_demux_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame)); + } + public static SWIGTYPE_p_switch_core_session switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug bug) { IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug.getCPtr(bug)); SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); @@ -1144,8 +1163,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session session) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session.getCPtr(session)); + public static switch_status_t switch_core_media_bug_remove_all_function(SWIGTYPE_p_switch_core_session session, string function) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_all_function(SWIGTYPE_p_switch_core_session.getCPtr(session), function); return ret; } @@ -1988,6 +2007,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_session_get_real_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_real_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp)); + return ret; + } + public static switch_status_t switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp)); return ret; @@ -2687,6 +2711,15 @@ public class freeswitch { freeswitchPINVOKE.switch_close_extra_files(SWIGTYPE_p_int.getCPtr(keep), keep_ttl); } + public static switch_status_t switch_core_thread_set_cpu_affinity(int cpu) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_thread_set_cpu_affinity(cpu); + return ret; + } + + public static void switch_os_yield() { + freeswitchPINVOKE.switch_os_yield(); + } + 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; @@ -2708,6 +2741,11 @@ public class freeswitch { return ret; } + public static string switch_parse_codec_buf(string buf, SWIGTYPE_p_unsigned_long interval, SWIGTYPE_p_unsigned_long rate, SWIGTYPE_p_unsigned_long bit) { + string ret = freeswitchPINVOKE.switch_parse_codec_buf(buf, SWIGTYPE_p_unsigned_long.getCPtr(interval), SWIGTYPE_p_unsigned_long.getCPtr(rate), SWIGTYPE_p_unsigned_long.getCPtr(bit)); + return ret; + } + public static switch_dialplan_interface switch_loadable_module_get_dialplan_interface(string name) { IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_dialplan_interface(name); switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false); @@ -4358,6 +4396,10 @@ public class freeswitch { return ret; } + public static void switch_event_add_presence_data_cols(SWIGTYPE_p_switch_channel channel, switch_event arg1, string prefix) { + freeswitchPINVOKE.switch_event_add_presence_data_cols(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1), prefix); + } + public static switch_status_t switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, uint from_rate, uint to_rate, uint to_size, int quality, uint channels, string file, string func, int line) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, to_rate, to_size, quality, channels, file, func, line); return ret; @@ -4414,6 +4456,11 @@ public class freeswitch { return ret; } + public static uint switch_unmerge_sln(SWIGTYPE_p_short data, uint samples, SWIGTYPE_p_short other_data, uint other_samples) { + uint ret = freeswitchPINVOKE.switch_unmerge_sln(SWIGTYPE_p_short.getCPtr(data), samples, SWIGTYPE_p_short.getCPtr(other_data), other_samples); + return ret; + } + public static void switch_mux_channels(SWIGTYPE_p_short data, SWIGTYPE_p_switch_size_t samples, uint channels) { freeswitchPINVOKE.switch_mux_channels(SWIGTYPE_p_short.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(samples), channels); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -4429,6 +4476,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_generate_json_cdr(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_cJSON json_cdr, switch_bool_t urlencode) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_generate_json_cdr(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_cJSON.getCPtr(json_cdr), (int)urlencode); + return ret; + } + public static switch_status_t switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_xml xml_cdr) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_xml.getCPtr(xml_cdr)); return ret; @@ -4560,6 +4612,21 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_eavesdrop_pop_eavesdropper(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session sessionp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_pop_eavesdropper(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(sessionp)); + return ret; + } + + public static switch_status_t switch_ivr_eavesdrop_exec_all(SWIGTYPE_p_switch_core_session session, string app, string arg) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_exec_all(SWIGTYPE_p_switch_core_session.getCPtr(session), app, arg); + return ret; + } + + public static switch_status_t switch_ivr_eavesdrop_update_display(SWIGTYPE_p_switch_core_session session, string name, string number) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_update_display(SWIGTYPE_p_switch_core_session.getCPtr(session), name, number); + return ret; + } + public static switch_status_t switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session session, string uuid, string require_group, uint flags) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, require_group, flags); return ret; @@ -5076,6 +5143,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_blind_transfer_ack(SWIGTYPE_p_switch_core_session session, switch_bool_t success) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_blind_transfer_ack(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)success); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5375,6 +5447,10 @@ public class freeswitch { return ret; } + public static void switch_rtp_set_interdigit_delay(SWIGTYPE_p_switch_rtp rtp_session, uint delay) { + freeswitchPINVOKE.switch_rtp_set_interdigit_delay(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), delay); + } + public static switch_status_t switch_log_init(SWIGTYPE_p_apr_pool_t pool, switch_bool_t colorize) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)colorize); return ret; @@ -5992,7 +6068,9 @@ public class freeswitch { public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get(); + public static readonly string SWITCH_ATT_XFER_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_ATT_XFER_RESULT_VARIABLE_get(); public static readonly string SWITCH_COPY_XML_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_COPY_XML_CDR_VARIABLE_get(); + public static readonly string SWITCH_COPY_JSON_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_COPY_JSON_CDR_VARIABLE_get(); public static readonly string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get(); public static readonly string SWITCH_TRANSFER_HISTORY_VARIABLE = freeswitchPINVOKE.SWITCH_TRANSFER_HISTORY_VARIABLE_get(); public static readonly string SWITCH_TRANSFER_SOURCE_VARIABLE = freeswitchPINVOKE.SWITCH_TRANSFER_SOURCE_VARIABLE_get(); @@ -6535,9 +6613,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_READ_RESULT_VARIABLE_get")] public static extern string SWITCH_READ_RESULT_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ATT_XFER_RESULT_VARIABLE_get")] + public static extern string SWITCH_ATT_XFER_RESULT_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get")] public static extern string SWITCH_COPY_XML_CDR_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_COPY_JSON_CDR_VARIABLE_get")] + public static extern string SWITCH_COPY_JSON_CDR_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get")] public static extern string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get(); @@ -7936,6 +8020,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_disable_heartbeat")] public static extern void switch_core_session_disable_heartbeat(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_pop")] + public static extern int switch_core_media_bug_pop(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_exec_all")] + public static extern int switch_core_media_bug_exec_all(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_count")] + public static extern uint switch_core_media_bug_count(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_add")] public static extern int switch_core_media_bug_add(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, uint jarg7, HandleRef jarg8); @@ -7960,6 +8053,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_read_replace_frame")] public static extern IntPtr switch_core_media_bug_get_read_replace_frame(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_demux_frame")] + public static extern void switch_core_media_bug_set_read_demux_frame(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_session")] public static extern IntPtr switch_core_media_bug_get_session(HandleRef jarg1); @@ -7990,8 +8086,8 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_close")] public static extern int switch_core_media_bug_close(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all")] - public static extern int switch_core_media_bug_remove_all(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all_function")] + public static extern int switch_core_media_bug_remove_all_function(HandleRef jarg1, string jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_enumerate")] public static extern int switch_core_media_bug_enumerate(HandleRef jarg1, HandleRef jarg2); @@ -8503,6 +8599,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_read_impl")] public static extern int switch_core_session_get_read_impl(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_real_read_impl")] + public static extern int switch_core_session_get_real_read_impl(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_write_impl")] public static extern int switch_core_session_get_write_impl(HandleRef jarg1, HandleRef jarg2); @@ -9007,6 +9106,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_close_extra_files")] public static extern void switch_close_extra_files(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_set_cpu_affinity")] + public static extern int switch_core_thread_set_cpu_affinity(int jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_os_yield")] + public static extern void switch_os_yield(); + [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); @@ -9139,6 +9244,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codec_interface")] public static extern IntPtr switch_loadable_module_get_codec_interface(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_parse_codec_buf")] + public static extern string switch_parse_codec_buf(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_dialplan_interface")] public static extern IntPtr switch_loadable_module_get_dialplan_interface(string jarg1); @@ -12871,6 +12979,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_event_check_permission_list")] public static extern int switch_event_check_permission_list(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_add_presence_data_cols")] + public static extern void switch_event_add_presence_data_cols(HandleRef jarg1, HandleRef jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RESAMPLE_QUALITY_get")] public static extern int SWITCH_RESAMPLE_QUALITY_get(); @@ -12964,6 +13075,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_merge_sln")] public static extern uint switch_merge_sln(HandleRef jarg1, uint jarg2, HandleRef jarg3, uint jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_unmerge_sln")] + public static extern uint switch_unmerge_sln(HandleRef jarg1, uint jarg2, HandleRef jarg3, uint jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_mux_channels")] public static extern void switch_mux_channels(HandleRef jarg1, HandleRef jarg2, uint jarg3); @@ -13075,6 +13189,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_activate_unicast")] public static extern int switch_ivr_activate_unicast(HandleRef jarg1, string jarg2, ushort jarg3, string jarg4, ushort jarg5, string jarg6, string jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_generate_json_cdr")] + public static extern int switch_ivr_generate_json_cdr(HandleRef jarg1, HandleRef jarg2, int jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_generate_xml_cdr")] public static extern int switch_ivr_generate_xml_cdr(HandleRef jarg1, HandleRef jarg2); @@ -13153,6 +13270,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_session")] public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_pop_eavesdropper")] + public static extern int switch_ivr_eavesdrop_pop_eavesdropper(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_exec_all")] + public static extern int switch_ivr_eavesdrop_exec_all(HandleRef jarg1, string jarg2, string jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_update_display")] + public static extern int switch_ivr_eavesdrop_update_display(HandleRef jarg1, string jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_session")] public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, uint jarg4); @@ -13465,6 +13591,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_kill_uuid")] public static extern int switch_ivr_kill_uuid(string jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_blind_transfer_ack")] + public static extern int switch_ivr_blind_transfer_ack(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -13708,6 +13837,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_check_auto_adj")] public static extern byte switch_rtp_check_auto_adj(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_interdigit_delay")] + public static extern void switch_rtp_set_interdigit_delay(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_set")] public static extern void switch_log_node_t_data_set(HandleRef jarg1, string jarg2); @@ -17362,6 +17494,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_media_bug_p_void__void { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_media_bug_p_void__void(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_media_bug_p_void__void() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_media_bug_p_void__void 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_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void { private HandleRef swigCPtr; @@ -18142,6 +18304,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_cJSON { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_cJSON(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_cJSON() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_cJSON 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_p_char { private HandleRef swigCPtr; @@ -22998,6 +23190,9 @@ public enum switch_channel_flag_t { CF_SERVICE_VIDEO, CF_ZRTP_HASH, CF_ZRTP_PASS, + CF_CHANNEL_SWAP, + CF_PICKUP, + CF_CONFIRM_BLIND_TRANSFER, CF_FLAG_MAX } @@ -24891,6 +25086,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_SIGNAL_DATA, SWITCH_MESSAGE_INDICATE_INFO, SWITCH_MESSAGE_INDICATE_AUDIO_DATA, + SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, SWITCH_MESSAGE_INVALID } @@ -25836,7 +26032,8 @@ namespace FreeSWITCH.Native { ED_NONE = 0, ED_MUX_READ = (1 << 0), ED_MUX_WRITE = (1 << 1), - ED_DTMF = (1 << 2) + ED_DTMF = (1 << 2), + ED_COPY_DISPLAY = (1 << 3) } } @@ -29776,7 +29973,8 @@ namespace FreeSWITCH.Native { SMBF_THREAD_LOCK = (1 << 7), SMBF_PRUNE = (1 << 8), SMBF_NO_PAUSE = (1 << 9), - SMBF_STEREO_SWAP = (1 << 10) + SMBF_STEREO_SWAP = (1 << 10), + SMBF_LOCK = (1 << 11) } } From 9b6702da67e63a06f44c36fcea0c6004150c9684 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 May 2012 13:53:23 -0500 Subject: [PATCH 0396/1057] swigall --- src/mod/languages/mod_managed/freeswitch_wrap.cxx | 11 +++++++++++ src/mod/languages/mod_managed/managed/swig.cs | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 5884b42cf5..33feeaee11 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1520,6 +1520,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ZRTP_PASSTHRU_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "zrtp_passthru"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get() { char * jresult ; char *result = 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index b16a97ed95..62dea3d5c5 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -6105,6 +6105,7 @@ public class freeswitch { public static readonly string SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME = freeswitchPINVOKE.SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get(); public static readonly string SWITCH_BYPASS_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_VARIABLE_get(); public static readonly string SWITCH_PROXY_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_PROXY_MEDIA_VARIABLE_get(); + public static readonly string SWITCH_ZRTP_PASSTHRU_VARIABLE = freeswitchPINVOKE.SWITCH_ZRTP_PASSTHRU_VARIABLE_get(); public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_TEMP_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get(); @@ -6724,6 +6725,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get")] public static extern string SWITCH_PROXY_MEDIA_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ZRTP_PASSTHRU_VARIABLE_get")] + public static extern string SWITCH_ZRTP_PASSTHRU_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get")] public static extern string SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); @@ -23188,8 +23192,9 @@ public enum switch_channel_flag_t { CF_VIDEO_REFRESH_REQ, CF_SERVICE_AUDIO, CF_SERVICE_VIDEO, + CF_ZRTP_PASSTHRU_REQ, + CF_ZRTP_PASSTHRU, CF_ZRTP_HASH, - CF_ZRTP_PASS, CF_CHANNEL_SWAP, CF_PICKUP, CF_CONFIRM_BLIND_TRANSFER, From b0e95fdad65029b3f763ce2b0a795a6b1f4f02b1 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 24 May 2012 16:03:56 -0500 Subject: [PATCH 0397/1057] vs2010 reswig mod_managed --- .../mod_managed/freeswitch_wrap.2010.cxx | 259 +++++++++++++++++- .../mod_managed/managed/swig.2010.cs | 217 ++++++++++++++- 2 files changed, 467 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 27cc9fb600..65b4eedf3c 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1050,6 +1050,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_READ_RESULT_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ATT_XFER_RESULT_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("att_xfer_result"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1060,6 +1070,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_JSON_CDR_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("copy_json_cdr"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1400,6 +1420,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ZRTP_PASSTHRU_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("zrtp_passthru"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -6425,6 +6455,54 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_disable_heartbeat(void * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_pop(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_media_bug_t **arg3 = (switch_media_bug_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_media_bug_t **)jarg3; + result = (switch_status_t)switch_core_media_bug_pop(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_exec_all(void * jarg1, char * jarg2, void * jarg3, void * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_media_bug_exec_cb_t arg3 = (switch_media_bug_exec_cb_t) 0 ; + void *arg4 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_media_bug_exec_cb_t)jarg3; + arg4 = (void *)jarg4; + result = (switch_status_t)switch_core_media_bug_exec_all(arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_count(void * jarg1, char * jarg2) { + unsigned long jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + uint32_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + result = (uint32_t)switch_core_media_bug_count(arg1,(char const *)arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_add(void * jarg1, char * jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6, unsigned long jarg7, void * jarg8) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -6531,6 +6609,16 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_read_replace_fram } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_read_demux_frame(void * jarg1, void * jarg2) { + switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ; + switch_frame_t *arg2 = (switch_frame_t *) 0 ; + + arg1 = (switch_media_bug_t *)jarg1; + arg2 = (switch_frame_t *)jarg2; + switch_core_media_bug_set_read_demux_frame(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_session(void * jarg1) { void * jresult ; switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ; @@ -6657,13 +6745,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_close(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all_function(void * jarg1, char * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; switch_status_t result; arg1 = (switch_core_session_t *)jarg1; - result = (switch_status_t)switch_core_media_bug_remove_all(arg1); + arg2 = (char *)jarg2; + result = (switch_status_t)switch_core_media_bug_remove_all_function(arg1,(char const *)arg2); jresult = result; return jresult; } @@ -8996,6 +9086,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_read_impl(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_real_read_impl(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_codec_implementation_t *)jarg2; + result = (switch_status_t)switch_core_session_get_real_read_impl(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_write_impl(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -11151,6 +11255,23 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_close_extra_files(void * jarg1, int ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_thread_set_cpu_affinity(int jarg1) { + int jresult ; + int arg1 ; + switch_status_t result; + + arg1 = (int)jarg1; + result = (switch_status_t)switch_core_thread_set_cpu_affinity(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_os_yield() { + switch_os_yield(); +} + + 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 ; @@ -11635,6 +11756,24 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_codec_interface( } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_parse_codec_buf(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { + char * jresult ; + char *arg1 = (char *) 0 ; + uint32_t *arg2 = (uint32_t *) 0 ; + uint32_t *arg3 = (uint32_t *) 0 ; + uint32_t *arg4 = (uint32_t *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + arg2 = (uint32_t *)jarg2; + arg3 = (uint32_t *)jarg3; + arg4 = (uint32_t *)jarg4; + result = (char *)switch_parse_codec_buf(arg1,arg2,arg3,arg4); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_dialplan_interface(char * jarg1) { void * jresult ; char *arg1 = (char *) 0 ; @@ -27013,6 +27152,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_check_permission_list(void * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_add_presence_data_cols(void * jarg1, void * jarg2, char * jarg3) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_event_t *arg2 = (switch_event_t *) 0 ; + char *arg3 = (char *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_event_t *)jarg2; + arg3 = (char *)jarg3; + switch_event_add_presence_data_cols(arg1,arg2,(char const *)arg3); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RESAMPLE_QUALITY_get() { int jresult ; int result; @@ -27403,6 +27554,24 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_merge_sln(void * jarg1, unsig } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_unmerge_sln(void * jarg1, unsigned long jarg2, void * jarg3, unsigned long jarg4) { + unsigned long jresult ; + int16_t *arg1 = (int16_t *) 0 ; + uint32_t arg2 ; + int16_t *arg3 = (int16_t *) 0 ; + uint32_t arg4 ; + uint32_t result; + + arg1 = (int16_t *)jarg1; + arg2 = (uint32_t)jarg2; + arg3 = (int16_t *)jarg3; + arg4 = (uint32_t)jarg4; + result = (uint32_t)switch_unmerge_sln(arg1,arg2,arg3,arg4); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_mux_channels(void * jarg1, void * jarg2, unsigned long jarg3) { int16_t *arg1 = (int16_t *) 0 ; switch_size_t arg2 ; @@ -27847,6 +28016,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_activate_unicast(void * jarg1, char } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_generate_json_cdr(void * jarg1, void * jarg2, int jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + cJSON **arg2 = (cJSON **) 0 ; + switch_bool_t arg3 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (cJSON **)jarg2; + arg3 = (switch_bool_t)jarg3; + result = (switch_status_t)switch_ivr_generate_json_cdr(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_generate_xml_cdr(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -28257,6 +28442,52 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_session(void * jarg1, char * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_pop_eavesdropper(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_core_session_t **arg2 = (switch_core_session_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_core_session_t **)jarg2; + result = (switch_status_t)switch_ivr_eavesdrop_pop_eavesdropper(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_exec_all(void * jarg1, char * jarg2, char * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + result = (switch_status_t)switch_ivr_eavesdrop_exec_all(arg1,(char const *)arg2,(char const *)arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_update_display(void * jarg1, char * jarg2, char * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + result = (switch_status_t)switch_ivr_eavesdrop_update_display(arg1,(char const *)arg2,(char const *)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_session(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -29969,6 +30200,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_kill_uuid(char * jarg1, int jarg2) } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_blind_transfer_ack(void * jarg1, int jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_bool_t arg2 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + result = (switch_status_t)switch_ivr_blind_transfer_ack(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; @@ -31026,6 +31271,16 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_check_auto_adj(void * jar } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_interdigit_delay(void * jarg1, unsigned long jarg2) { + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_rtp_set_interdigit_delay(arg1,arg2); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_data_set(void * jarg1, char * jarg2) { switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index d814ce15b9..0654085a50 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1066,6 +1066,21 @@ public class freeswitch { freeswitchPINVOKE.switch_core_session_disable_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session)); } + public static switch_status_t switch_core_media_bug_pop(SWIGTYPE_p_switch_core_session orig_session, string function, SWIGTYPE_p_p_switch_media_bug pop) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_pop(SWIGTYPE_p_switch_core_session.getCPtr(orig_session), function, SWIGTYPE_p_p_switch_media_bug.getCPtr(pop)); + return ret; + } + + public static switch_status_t switch_core_media_bug_exec_all(SWIGTYPE_p_switch_core_session orig_session, string function, SWIGTYPE_p_f_p_switch_media_bug_p_void__void cb, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_exec_all(SWIGTYPE_p_switch_core_session.getCPtr(orig_session), function, SWIGTYPE_p_f_p_switch_media_bug_p_void__void.getCPtr(cb), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static uint switch_core_media_bug_count(SWIGTYPE_p_switch_core_session orig_session, string function) { + uint ret = freeswitchPINVOKE.switch_core_media_bug_count(SWIGTYPE_p_switch_core_session.getCPtr(orig_session), function); + return ret; + } + public static switch_status_t switch_core_media_bug_add(SWIGTYPE_p_switch_core_session session, string function, string target, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_time_t stop_time, uint flags, SWIGTYPE_p_p_switch_media_bug new_bug) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_add(SWIGTYPE_p_switch_core_session.getCPtr(session), function, target, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_time_t.getCPtr(stop_time), flags, SWIGTYPE_p_p_switch_media_bug.getCPtr(new_bug)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -1106,6 +1121,10 @@ public class freeswitch { return ret; } + public static void switch_core_media_bug_set_read_demux_frame(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) { + freeswitchPINVOKE.switch_core_media_bug_set_read_demux_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame)); + } + public static SWIGTYPE_p_switch_core_session switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug bug) { IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug.getCPtr(bug)); SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); @@ -1156,8 +1175,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session session) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session.getCPtr(session)); + public static switch_status_t switch_core_media_bug_remove_all_function(SWIGTYPE_p_switch_core_session session, string function) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_all_function(SWIGTYPE_p_switch_core_session.getCPtr(session), function); return ret; } @@ -2000,6 +2019,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_session_get_real_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_real_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp)); + return ret; + } + public static switch_status_t switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp)); return ret; @@ -2699,6 +2723,15 @@ public class freeswitch { freeswitchPINVOKE.switch_close_extra_files(SWIGTYPE_p_int.getCPtr(keep), keep_ttl); } + public static switch_status_t switch_core_thread_set_cpu_affinity(int cpu) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_thread_set_cpu_affinity(cpu); + return ret; + } + + public static void switch_os_yield() { + freeswitchPINVOKE.switch_os_yield(); + } + 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; @@ -2720,6 +2753,11 @@ public class freeswitch { return ret; } + public static string switch_parse_codec_buf(string buf, SWIGTYPE_p_unsigned_long interval, SWIGTYPE_p_unsigned_long rate, SWIGTYPE_p_unsigned_long bit) { + string ret = freeswitchPINVOKE.switch_parse_codec_buf(buf, SWIGTYPE_p_unsigned_long.getCPtr(interval), SWIGTYPE_p_unsigned_long.getCPtr(rate), SWIGTYPE_p_unsigned_long.getCPtr(bit)); + return ret; + } + public static switch_dialplan_interface switch_loadable_module_get_dialplan_interface(string name) { IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_dialplan_interface(name); switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false); @@ -4370,6 +4408,10 @@ public class freeswitch { return ret; } + public static void switch_event_add_presence_data_cols(SWIGTYPE_p_switch_channel channel, switch_event arg1, string prefix) { + freeswitchPINVOKE.switch_event_add_presence_data_cols(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1), prefix); + } + public static switch_status_t switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, uint from_rate, uint to_rate, uint to_size, int quality, uint channels, string file, string func, int line) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, to_rate, to_size, quality, channels, file, func, line); return ret; @@ -4426,6 +4468,11 @@ public class freeswitch { return ret; } + public static uint switch_unmerge_sln(SWIGTYPE_p_short data, uint samples, SWIGTYPE_p_short other_data, uint other_samples) { + uint ret = freeswitchPINVOKE.switch_unmerge_sln(SWIGTYPE_p_short.getCPtr(data), samples, SWIGTYPE_p_short.getCPtr(other_data), other_samples); + return ret; + } + public static void switch_mux_channels(SWIGTYPE_p_short data, SWIGTYPE_p_switch_size_t samples, uint channels) { freeswitchPINVOKE.switch_mux_channels(SWIGTYPE_p_short.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(samples), channels); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -4441,6 +4488,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_generate_json_cdr(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_cJSON json_cdr, switch_bool_t urlencode) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_generate_json_cdr(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_cJSON.getCPtr(json_cdr), (int)urlencode); + return ret; + } + public static switch_status_t switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_xml xml_cdr) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_xml.getCPtr(xml_cdr)); return ret; @@ -4572,6 +4624,21 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_eavesdrop_pop_eavesdropper(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session sessionp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_pop_eavesdropper(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(sessionp)); + return ret; + } + + public static switch_status_t switch_ivr_eavesdrop_exec_all(SWIGTYPE_p_switch_core_session session, string app, string arg) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_exec_all(SWIGTYPE_p_switch_core_session.getCPtr(session), app, arg); + return ret; + } + + public static switch_status_t switch_ivr_eavesdrop_update_display(SWIGTYPE_p_switch_core_session session, string name, string number) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_update_display(SWIGTYPE_p_switch_core_session.getCPtr(session), name, number); + return ret; + } + public static switch_status_t switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session session, string uuid, string require_group, uint flags) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, require_group, flags); return ret; @@ -5088,6 +5155,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_blind_transfer_ack(SWIGTYPE_p_switch_core_session session, switch_bool_t success) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_blind_transfer_ack(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)success); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5387,6 +5459,10 @@ public class freeswitch { return ret; } + public static void switch_rtp_set_interdigit_delay(SWIGTYPE_p_switch_rtp rtp_session, uint delay) { + freeswitchPINVOKE.switch_rtp_set_interdigit_delay(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), delay); + } + public static switch_status_t switch_log_init(SWIGTYPE_p_apr_pool_t pool, switch_bool_t colorize) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)colorize); return ret; @@ -6004,7 +6080,9 @@ public class freeswitch { public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get(); + public static readonly string SWITCH_ATT_XFER_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_ATT_XFER_RESULT_VARIABLE_get(); public static readonly string SWITCH_COPY_XML_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_COPY_XML_CDR_VARIABLE_get(); + public static readonly string SWITCH_COPY_JSON_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_COPY_JSON_CDR_VARIABLE_get(); public static readonly string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get(); public static readonly string SWITCH_TRANSFER_HISTORY_VARIABLE = freeswitchPINVOKE.SWITCH_TRANSFER_HISTORY_VARIABLE_get(); public static readonly string SWITCH_TRANSFER_SOURCE_VARIABLE = freeswitchPINVOKE.SWITCH_TRANSFER_SOURCE_VARIABLE_get(); @@ -6039,6 +6117,7 @@ public class freeswitch { public static readonly string SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME = freeswitchPINVOKE.SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get(); public static readonly string SWITCH_BYPASS_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_VARIABLE_get(); public static readonly string SWITCH_PROXY_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_PROXY_MEDIA_VARIABLE_get(); + public static readonly string SWITCH_ZRTP_PASSTHRU_VARIABLE = freeswitchPINVOKE.SWITCH_ZRTP_PASSTHRU_VARIABLE_get(); public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_TEMP_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get(); @@ -6551,9 +6630,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_READ_RESULT_VARIABLE_get")] public static extern string SWITCH_READ_RESULT_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ATT_XFER_RESULT_VARIABLE_get")] + public static extern string SWITCH_ATT_XFER_RESULT_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get")] public static extern string SWITCH_COPY_XML_CDR_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_COPY_JSON_CDR_VARIABLE_get")] + public static extern string SWITCH_COPY_JSON_CDR_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get")] public static extern string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get(); @@ -6656,6 +6741,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get")] public static extern string SWITCH_PROXY_MEDIA_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ZRTP_PASSTHRU_VARIABLE_get")] + public static extern string SWITCH_ZRTP_PASSTHRU_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get")] public static extern string SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); @@ -7952,6 +8040,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_disable_heartbeat")] public static extern void switch_core_session_disable_heartbeat(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_pop")] + public static extern int switch_core_media_bug_pop(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_exec_all")] + public static extern int switch_core_media_bug_exec_all(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_count")] + public static extern uint switch_core_media_bug_count(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_add")] public static extern int switch_core_media_bug_add(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, uint jarg7, HandleRef jarg8); @@ -7976,6 +8073,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_read_replace_frame")] public static extern IntPtr switch_core_media_bug_get_read_replace_frame(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_demux_frame")] + public static extern void switch_core_media_bug_set_read_demux_frame(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_session")] public static extern IntPtr switch_core_media_bug_get_session(HandleRef jarg1); @@ -8006,8 +8106,8 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_close")] public static extern int switch_core_media_bug_close(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all")] - public static extern int switch_core_media_bug_remove_all(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all_function")] + public static extern int switch_core_media_bug_remove_all_function(HandleRef jarg1, string jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_enumerate")] public static extern int switch_core_media_bug_enumerate(HandleRef jarg1, HandleRef jarg2); @@ -8519,6 +8619,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_read_impl")] public static extern int switch_core_session_get_read_impl(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_real_read_impl")] + public static extern int switch_core_session_get_real_read_impl(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_write_impl")] public static extern int switch_core_session_get_write_impl(HandleRef jarg1, HandleRef jarg2); @@ -9023,6 +9126,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_close_extra_files")] public static extern void switch_close_extra_files(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_set_cpu_affinity")] + public static extern int switch_core_thread_set_cpu_affinity(int jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_os_yield")] + public static extern void switch_os_yield(); + [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); @@ -9155,6 +9264,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codec_interface")] public static extern IntPtr switch_loadable_module_get_codec_interface(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_parse_codec_buf")] + public static extern string switch_parse_codec_buf(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_dialplan_interface")] public static extern IntPtr switch_loadable_module_get_dialplan_interface(string jarg1); @@ -12887,6 +12999,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_event_check_permission_list")] public static extern int switch_event_check_permission_list(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_add_presence_data_cols")] + public static extern void switch_event_add_presence_data_cols(HandleRef jarg1, HandleRef jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RESAMPLE_QUALITY_get")] public static extern int SWITCH_RESAMPLE_QUALITY_get(); @@ -12980,6 +13095,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_merge_sln")] public static extern uint switch_merge_sln(HandleRef jarg1, uint jarg2, HandleRef jarg3, uint jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_unmerge_sln")] + public static extern uint switch_unmerge_sln(HandleRef jarg1, uint jarg2, HandleRef jarg3, uint jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_mux_channels")] public static extern void switch_mux_channels(HandleRef jarg1, HandleRef jarg2, uint jarg3); @@ -13091,6 +13209,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_activate_unicast")] public static extern int switch_ivr_activate_unicast(HandleRef jarg1, string jarg2, ushort jarg3, string jarg4, ushort jarg5, string jarg6, string jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_generate_json_cdr")] + public static extern int switch_ivr_generate_json_cdr(HandleRef jarg1, HandleRef jarg2, int jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_generate_xml_cdr")] public static extern int switch_ivr_generate_xml_cdr(HandleRef jarg1, HandleRef jarg2); @@ -13169,6 +13290,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_session")] public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_pop_eavesdropper")] + public static extern int switch_ivr_eavesdrop_pop_eavesdropper(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_exec_all")] + public static extern int switch_ivr_eavesdrop_exec_all(HandleRef jarg1, string jarg2, string jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_update_display")] + public static extern int switch_ivr_eavesdrop_update_display(HandleRef jarg1, string jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_session")] public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, uint jarg4); @@ -13481,6 +13611,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_kill_uuid")] public static extern int switch_ivr_kill_uuid(string jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_blind_transfer_ack")] + public static extern int switch_ivr_blind_transfer_ack(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -13724,6 +13857,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_check_auto_adj")] public static extern byte switch_rtp_check_auto_adj(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_interdigit_delay")] + public static extern void switch_rtp_set_interdigit_delay(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_set")] public static extern void switch_log_node_t_data_set(HandleRef jarg1, string jarg2); @@ -17420,6 +17556,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_media_bug_p_void__void { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_media_bug_p_void__void(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_media_bug_p_void__void() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_media_bug_p_void__void 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_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void { private HandleRef swigCPtr; @@ -18200,6 +18366,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_cJSON { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_cJSON(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_cJSON() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_cJSON 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_p_char { private HandleRef swigCPtr; @@ -23052,8 +23248,12 @@ public enum switch_channel_flag_t { CF_VIDEO_REFRESH_REQ, CF_SERVICE_AUDIO, CF_SERVICE_VIDEO, + CF_ZRTP_PASSTHRU_REQ, + CF_ZRTP_PASSTHRU, CF_ZRTP_HASH, - CF_ZRTP_PASS, + CF_CHANNEL_SWAP, + CF_PICKUP, + CF_CONFIRM_BLIND_TRANSFER, CF_FLAG_MAX } @@ -24971,6 +25171,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_SIGNAL_DATA, SWITCH_MESSAGE_INDICATE_INFO, SWITCH_MESSAGE_INDICATE_AUDIO_DATA, + SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, SWITCH_MESSAGE_INVALID } @@ -25930,7 +26131,8 @@ namespace FreeSWITCH.Native { ED_NONE = 0, ED_MUX_READ = (1 << 0), ED_MUX_WRITE = (1 << 1), - ED_DTMF = (1 << 2) + ED_DTMF = (1 << 2), + ED_COPY_DISPLAY = (1 << 3) } } @@ -29926,7 +30128,8 @@ namespace FreeSWITCH.Native { SMBF_THREAD_LOCK = (1 << 7), SMBF_PRUNE = (1 << 8), SMBF_NO_PAUSE = (1 << 9), - SMBF_STEREO_SWAP = (1 << 10) + SMBF_STEREO_SWAP = (1 << 10), + SMBF_LOCK = (1 << 11) } } From 409ff21cc4de738c8468a846c998e8f19080b865 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 25 May 2012 02:40:34 +0000 Subject: [PATCH 0398/1057] debian: improve policy compliance on debian/copyright --- debian/copyright | 984 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 966 insertions(+), 18 deletions(-) diff --git a/debian/copyright b/debian/copyright index 732b2b7d0c..4312f4bb88 100644 --- a/debian/copyright +++ b/debian/copyright @@ -2,29 +2,482 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: freeswitch Source: http://freeswitch.org/ -Files: debian/* -Copyright: 2012, Travis Cross -License: MPL or GPL2+ (at your option) - This packaging may be distributed under either (at your option) the - terms of the MPLv1.1 as described in docs/COPYING in the FreeSWITCH - source tree, or under the terms of the GNU GPL, version 2 or later, - as found on Debian systems in /usr/share/common-licenses/GPL-2. - Files: * -Copyright: 2012, Anthony Minessale II and many other contributors -License: MPL - The contents of these files are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use these files except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ +Copyright: 2012 Anthony Minessale II and many other contributors +License: MPL-1.1 + MOZILLA PUBLIC LICENSE + Version 1.1 . - 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. + --------------- + . + 1. Definitions. + . + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + . + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + . + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + . + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + . + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + . + 1.5. "Executable" means Covered Code in any form other than Source + Code. + . + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + . + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + . + 1.8. "License" means this document. + . + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + . + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + . + B. Any new file that contains any part of the Original Code or + previous Modifications. + . + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + . + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + . + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + . + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + . + 2. Source Code License. + . + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + . + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + . + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + . + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + . + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + . + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + . + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + . + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + . + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + . + 3. Distribution Obligations. + . + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + . + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + . + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + . + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + . + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + . + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + . + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + . + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + . + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + . + 4. Inability to Comply Due to Statute or Regulation. + . + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + . + 5. Application of this License. + . + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + . + 6. Versions of the License. + . + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + . + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + . + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + . + 7. DISCLAIMER OF WARRANTY. + . + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + . + 8. TERMINATION. + . + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + . + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + . + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + . + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + . + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + . + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + . + 9. LIMITATION OF LIABILITY. + . + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + . + 10. U.S. GOVERNMENT END USERS. + . + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + . + 11. MISCELLANEOUS. + . + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + . + 12. RESPONSIBILITY FOR CLAIMS. + . + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + . + 13. MULTIPLE-LICENSED CODE. + . + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + . + EXHIBIT A -Mozilla Public License. + . + ``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 ______________________________________. + . + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + . + Contributor(s): ______________________________________. + . + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + . + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] Files: libs/pocketsphinx* Copyright: 2010 Carnegie Mellon University +License: BSD-2-clause /* ==================================================================== * Copyright (c) 1999-2010 Carnegie Mellon University. All rights * reserved. @@ -61,3 +514,498 @@ Copyright: 2010 Carnegie Mellon University * */ +Files: debian/* +Copyright: 2012 Travis Cross +License: MPL-1.1 or GPL-2+ + This program is free software, and you may redistribute it and/or + modify it under either (at your option) the terms of the Mozilla + Public License Version 1.1 (MPLv1.1) or 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). Both licenses are described below. + . + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + USA + . + On Debian systems, the full text of the GNU General Public License + version 2 can be found in the file + `/usr/share/common-licenses/GPL-2'. + . + ---- + . + MOZILLA PUBLIC LICENSE + Version 1.1 + . + --------------- + . + 1. Definitions. + . + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + . + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + . + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + . + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + . + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + . + 1.5. "Executable" means Covered Code in any form other than Source + Code. + . + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + . + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + . + 1.8. "License" means this document. + . + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + . + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + . + B. Any new file that contains any part of the Original Code or + previous Modifications. + . + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + . + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + . + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + . + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + . + 2. Source Code License. + . + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + . + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + . + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + . + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + . + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + . + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + . + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + . + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + . + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + . + 3. Distribution Obligations. + . + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + . + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + . + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + . + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + . + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + . + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + . + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + . + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + . + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + . + 4. Inability to Comply Due to Statute or Regulation. + . + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + . + 5. Application of this License. + . + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + . + 6. Versions of the License. + . + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + . + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + . + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + . + 7. DISCLAIMER OF WARRANTY. + . + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + . + 8. TERMINATION. + . + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + . + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + . + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + . + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + . + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + . + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + . + 9. LIMITATION OF LIABILITY. + . + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + . + 10. U.S. GOVERNMENT END USERS. + . + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + . + 11. MISCELLANEOUS. + . + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + . + 12. RESPONSIBILITY FOR CLAIMS. + . + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + . + 13. MULTIPLE-LICENSED CODE. + . + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + . + EXHIBIT A -Mozilla Public License. + . + ``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 ______________________________________. + . + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + . + Contributor(s): ______________________________________. + . + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + . + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] From 771819c4307d72d116114dff315343b265845068 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 25 May 2012 04:46:08 +0000 Subject: [PATCH 0399/1057] setup-git.sh: set pull.rebase=true git-pull learned about pull.rebase in git-1.7.9. This value is used as a fallback if branch..rebase isn't found. --- scripts/setup-git.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/setup-git.sh b/scripts/setup-git.sh index f9f709ff7f..df3cd73b6c 100755 --- a/scripts/setup-git.sh +++ b/scripts/setup-git.sh @@ -34,13 +34,14 @@ if ! git config user.email >/dev/null 2>&1; then git config --global user.email "$email" fi +git config pull.rebase true git config branch.master.rebase true cat 1>&2 < Date: Fri, 25 May 2012 07:18:55 -0400 Subject: [PATCH 0400/1057] mod_voicemail: Make sure vm_fsdb api create the user directory before trying to move file into it --- src/mod/applications/mod_voicemail/mod_voicemail.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 2ed70ce05d..0bbea275d5 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -4895,6 +4895,8 @@ SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function) 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); + switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, pool); + if (file_path) { if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Filename doesn't exist\n"); @@ -4989,6 +4991,8 @@ SWITCH_STANDARD_API(vm_fsdb_pref_recname_set_function) 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); + switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, pool); + if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Filename doesn't exist\n"); profile_rwunlock(profile); @@ -4996,6 +5000,7 @@ SWITCH_STANDARD_API(vm_fsdb_pref_recname_set_function) } switch_file_rename(file_path, final_file_path, pool); + if (atoi(res) == 0) { sql = switch_mprintf("INSERT INTO voicemail_prefs (username, domain, name_path) VALUES('%q', '%q', '%q')", id, domain, final_file_path); } else { From 452e1d82712becfacdd87b30b1fe7ec622c13f00 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 May 2012 07:54:11 -0500 Subject: [PATCH 0401/1057] FS-4249 --resolve --- libs/stfu/stfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 5c31133aa8..787fd9c3d9 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -461,7 +461,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void i->sync_in = 0; } else { - if ((ts && ts == i->last_rd_ts + i->samples_per_packet) || (i->last_rd_ts > 4294900000 && ts < 5000)) { + if ((ts && ts == i->last_rd_ts + i->samples_per_packet) || (i->last_rd_ts > 4294900000u && ts < 5000)) { good_ts = 1; } From 09bef08b8368b5af17e2205bde9df10502b66efa Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 25 May 2012 13:45:02 -0400 Subject: [PATCH 0402/1057] FS-4254 --resolve I've changed the variable name from cc_export to cc_export_vars to be more consistant from the original patch --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 30bdf9c2b3..99ece2ff39 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1466,6 +1466,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "origination_uuid", "%s", agent_uuid_str); + switch_channel_process_export(member_channel, NULL, ovars, "cc_export_vars"); + 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, cid_name ? cid_name : h->member_cid_name, h->member_cid_number, NULL, ovars, SOF_NONE, NULL); From 03b92c9ba186c9ec1a01dbff9698f909d98d524a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 May 2012 11:02:51 -0500 Subject: [PATCH 0403/1057] FS-4251 --resolve just a silly oversight in the code specific to this use case, thanks --- src/switch_core_io.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index f20fa7bff9..83f8ae6d26 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1469,6 +1469,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core switch_assert(session != NULL); + if (zstr(dtmf_string)) { + return SWITCH_STATUS_FALSE; + } + if (*dtmf_string == '~') { dtmf_string++; dtmf.flags = 0; @@ -1478,9 +1482,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core return SWITCH_STATUS_FALSE; } - if (zstr(dtmf_string)) { - return SWITCH_STATUS_FALSE; - } if (strlen(dtmf_string) > 99) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Attempt to send very large dtmf string ignored!\n"); From 9b569ec875795052e068c244d880cf96deb65a3a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 05:22:17 +0000 Subject: [PATCH 0404/1057] cleanup and consolidate mod_sofia configuration example --- .../mod_sofia/conf/sip_profiles/external.xml | 95 ---- .../conf/sip_profiles/external/example.xml | 38 -- .../conf/sip_profiles/internal-ipv6.xml | 130 ----- .../mod_sofia/conf/sip_profiles/internal.xml | 385 -------------- .../conf/sip_profiles/internal/example.xml | 37 -- .../endpoints/mod_sofia/conf/sofia.conf.xml | 473 ++++++++++++++++++ 6 files changed, 473 insertions(+), 685 deletions(-) delete mode 100644 src/mod/endpoints/mod_sofia/conf/sip_profiles/external.xml delete mode 100644 src/mod/endpoints/mod_sofia/conf/sip_profiles/external/example.xml delete mode 100644 src/mod/endpoints/mod_sofia/conf/sip_profiles/internal-ipv6.xml delete mode 100644 src/mod/endpoints/mod_sofia/conf/sip_profiles/internal.xml delete mode 100644 src/mod/endpoints/mod_sofia/conf/sip_profiles/internal/example.xml create mode 100644 src/mod/endpoints/mod_sofia/conf/sofia.conf.xml diff --git a/src/mod/endpoints/mod_sofia/conf/sip_profiles/external.xml b/src/mod/endpoints/mod_sofia/conf/sip_profiles/external.xml deleted file mode 100644 index a709cbb94c..0000000000 --- a/src/mod/endpoints/mod_sofia/conf/sip_profiles/external.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/endpoints/mod_sofia/conf/sip_profiles/external/example.xml b/src/mod/endpoints/mod_sofia/conf/sip_profiles/external/example.xml deleted file mode 100644 index 70668a9ce5..0000000000 --- a/src/mod/endpoints/mod_sofia/conf/sip_profiles/external/example.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal-ipv6.xml b/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal-ipv6.xml deleted file mode 100644 index ee27a241a0..0000000000 --- a/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal-ipv6.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal.xml b/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal.xml deleted file mode 100644 index b8390c7934..0000000000 --- a/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal.xml +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal/example.xml b/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal/example.xml deleted file mode 100644 index fc061f96d1..0000000000 --- a/src/mod/endpoints/mod_sofia/conf/sip_profiles/internal/example.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml new file mode 100644 index 0000000000..2649a24ae8 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -0,0 +1,473 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 73614127fcb04a9370b968438f1ffb01637b4d1a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 05:44:14 +0000 Subject: [PATCH 0405/1057] whitespace cleanup --- conf/insideout/sip_profiles/external.xml | 12 +- .../sip_profiles/external/example.xml | 2 +- conf/insideout/sip_profiles/internal-ipv6.xml | 17 +- conf/insideout/sip_profiles/internal.xml | 63 +++--- .../sip_profiles/internal/example.xml | 2 +- conf/sbc/sbc_profiles/external.xml | 14 +- conf/sbc/sbc_profiles/external/example.xml | 2 +- conf/sbc/sbc_profiles/internal-ipv6.xml | 17 +- conf/sbc/sbc_profiles/internal.xml | 61 +++-- conf/sbc/sbc_profiles/internal/example.xml | 2 +- conf/vanilla/sip_profiles/external.xml | 27 ++- .../vanilla/sip_profiles/external/example.xml | 2 +- conf/vanilla/sip_profiles/internal-ipv6.xml | 27 ++- conf/vanilla/sip_profiles/internal.xml | 212 +++++++++--------- .../vanilla/sip_profiles/internal/example.xml | 2 +- 15 files changed, 227 insertions(+), 235 deletions(-) diff --git a/conf/insideout/sip_profiles/external.xml b/conf/insideout/sip_profiles/external.xml index 6f6045255d..3fcb969f7f 100644 --- a/conf/insideout/sip_profiles/external.xml +++ b/conf/insideout/sip_profiles/external.xml @@ -1,4 +1,4 @@ - + @@ -29,10 +29,10 @@ - @@ -48,7 +48,7 @@ diff --git a/conf/insideout/sip_profiles/external/example.xml b/conf/insideout/sip_profiles/external/example.xml index 7ac8db1186..c6b79e8fe3 100644 --- a/conf/insideout/sip_profiles/external/example.xml +++ b/conf/insideout/sip_profiles/external/example.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml index 856ac4905d..649246ad36 100644 --- a/conf/insideout/sip_profiles/internal-ipv6.xml +++ b/conf/insideout/sip_profiles/internal-ipv6.xml @@ -53,36 +53,36 @@ - + - + - + - + - + - + - + @@ -128,4 +128,3 @@ - diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml index a6010b2945..3ea2ef155c 100644 --- a/conf/insideout/sip_profiles/internal.xml +++ b/conf/insideout/sip_profiles/internal.xml @@ -1,7 +1,7 @@ @@ -16,24 +16,24 @@ - + - + - + @@ -63,7 +63,7 @@ - + @@ -88,36 +88,36 @@ - + - + - + - + - + - + - + @@ -138,7 +138,7 @@ - + @@ -158,24 +158,24 @@ - + - + @@ -186,4 +186,3 @@ - diff --git a/conf/insideout/sip_profiles/internal/example.xml b/conf/insideout/sip_profiles/internal/example.xml index 7ac8db1186..c6b79e8fe3 100644 --- a/conf/insideout/sip_profiles/internal/example.xml +++ b/conf/insideout/sip_profiles/internal/example.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/sbc/sbc_profiles/external.xml b/conf/sbc/sbc_profiles/external.xml index d16813960f..9a5686bd91 100644 --- a/conf/sbc/sbc_profiles/external.xml +++ b/conf/sbc/sbc_profiles/external.xml @@ -1,4 +1,4 @@ - + @@ -7,7 +7,7 @@ - + @@ -30,10 +30,10 @@ - @@ -49,7 +49,7 @@ diff --git a/conf/sbc/sbc_profiles/external/example.xml b/conf/sbc/sbc_profiles/external/example.xml index 7ac8db1186..c6b79e8fe3 100644 --- a/conf/sbc/sbc_profiles/external/example.xml +++ b/conf/sbc/sbc_profiles/external/example.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/sbc/sbc_profiles/internal-ipv6.xml b/conf/sbc/sbc_profiles/internal-ipv6.xml index 856ac4905d..649246ad36 100644 --- a/conf/sbc/sbc_profiles/internal-ipv6.xml +++ b/conf/sbc/sbc_profiles/internal-ipv6.xml @@ -53,36 +53,36 @@ - + - + - + - + - + - + - + @@ -128,4 +128,3 @@ - diff --git a/conf/sbc/sbc_profiles/internal.xml b/conf/sbc/sbc_profiles/internal.xml index d06e3a76cd..7e1ceeb9df 100644 --- a/conf/sbc/sbc_profiles/internal.xml +++ b/conf/sbc/sbc_profiles/internal.xml @@ -1,7 +1,7 @@ @@ -15,24 +15,24 @@ - + - + - + @@ -69,7 +69,7 @@ - + @@ -94,36 +94,36 @@ - + - + - + - + - + - + - + @@ -154,24 +154,24 @@ - + - + @@ -182,4 +182,3 @@ - diff --git a/conf/sbc/sbc_profiles/internal/example.xml b/conf/sbc/sbc_profiles/internal/example.xml index 7ac8db1186..c6b79e8fe3 100644 --- a/conf/sbc/sbc_profiles/internal/example.xml +++ b/conf/sbc/sbc_profiles/internal/example.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/vanilla/sip_profiles/external.xml b/conf/vanilla/sip_profiles/external.xml index a709cbb94c..39965e9421 100644 --- a/conf/vanilla/sip_profiles/external.xml +++ b/conf/vanilla/sip_profiles/external.xml @@ -1,14 +1,14 @@ - + - @@ -18,10 +18,10 @@ - - + + - + @@ -34,15 +34,15 @@ - + - @@ -57,7 +57,7 @@ @@ -90,6 +90,5 @@ - diff --git a/conf/vanilla/sip_profiles/external/example.xml b/conf/vanilla/sip_profiles/external/example.xml index 70668a9ce5..2a4df31aaf 100644 --- a/conf/vanilla/sip_profiles/external/example.xml +++ b/conf/vanilla/sip_profiles/external/example.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index ee27a241a0..5a97f0cd60 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -54,36 +54,36 @@ - + - + - + - + - + - + - + @@ -103,8 +103,8 @@ @@ -121,10 +121,9 @@ - - - + + + - diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index b9605a192c..afb12ab94c 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -2,30 +2,30 @@ - + - + - + - + @@ -33,31 +33,31 @@ - - + + - + - @@ -106,26 +106,26 @@ - - - + + + @@ -134,10 +134,10 @@ - + - + @@ -164,7 +164,7 @@ - + @@ -203,39 +203,39 @@ - + - + - + - + - + - + - + - + @@ -252,16 +252,16 @@ - + + Used as the public IP address for SDP. + Can be an one of: + ip address - "12.34.56.78" + a stun server lookup - "stun:stun.server.com" + a DNS name - "host:host.server.com" + auto - Use guessed ip. + auto-nat - Use ip learned from NAT-PMP or UPNP + --> @@ -274,8 +274,8 @@ @@ -297,28 +297,27 @@ - - + @@ -332,59 +331,58 @@ - - - - + + + - - - - - - - - - - - - - - + - - + + + + + - - - + + + + + + + + + + + + + - diff --git a/conf/vanilla/sip_profiles/internal/example.xml b/conf/vanilla/sip_profiles/internal/example.xml index fc061f96d1..10263b05a5 100644 --- a/conf/vanilla/sip_profiles/internal/example.xml +++ b/conf/vanilla/sip_profiles/internal/example.xml @@ -9,7 +9,7 @@ - + From 8513be49de33d2832941b5837239e6c9318daf5b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 05:50:47 +0000 Subject: [PATCH 0406/1057] enable inbound-late-negotiation in sample configs We often tell people to enable this for various reasons; it likely makes a sensible default. --- conf/insideout/sip_profiles/external.xml | 1 + conf/insideout/sip_profiles/internal-ipv6.xml | 4 ++-- conf/insideout/sip_profiles/internal.xml | 4 ++-- conf/sbc/sbc_profiles/external.xml | 1 + conf/sbc/sbc_profiles/internal-ipv6.xml | 4 ++-- conf/sbc/sbc_profiles/internal.xml | 4 ++-- conf/vanilla/sip_profiles/external.xml | 1 + conf/vanilla/sip_profiles/internal-ipv6.xml | 4 ++-- conf/vanilla/sip_profiles/internal.xml | 4 ++-- src/mod/endpoints/mod_sofia/conf/sofia.conf.xml | 5 ++--- 10 files changed, 17 insertions(+), 15 deletions(-) diff --git a/conf/insideout/sip_profiles/external.xml b/conf/insideout/sip_profiles/external.xml index 3fcb969f7f..be38318432 100644 --- a/conf/insideout/sip_profiles/external.xml +++ b/conf/insideout/sip_profiles/external.xml @@ -47,6 +47,7 @@ + diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml index 649246ad36..e433da1425 100644 --- a/conf/insideout/sip_profiles/internal-ipv6.xml +++ b/conf/insideout/sip_profiles/internal-ipv6.xml @@ -66,8 +66,8 @@ - - + + diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml index 3ea2ef155c..61263f03dc 100644 --- a/conf/insideout/sip_profiles/internal.xml +++ b/conf/insideout/sip_profiles/internal.xml @@ -101,8 +101,8 @@ - - + + diff --git a/conf/sbc/sbc_profiles/external.xml b/conf/sbc/sbc_profiles/external.xml index 9a5686bd91..1cb91e8dab 100644 --- a/conf/sbc/sbc_profiles/external.xml +++ b/conf/sbc/sbc_profiles/external.xml @@ -48,6 +48,7 @@ + diff --git a/conf/sbc/sbc_profiles/internal-ipv6.xml b/conf/sbc/sbc_profiles/internal-ipv6.xml index 649246ad36..e433da1425 100644 --- a/conf/sbc/sbc_profiles/internal-ipv6.xml +++ b/conf/sbc/sbc_profiles/internal-ipv6.xml @@ -66,8 +66,8 @@ - - + + diff --git a/conf/sbc/sbc_profiles/internal.xml b/conf/sbc/sbc_profiles/internal.xml index 7e1ceeb9df..8263a82668 100644 --- a/conf/sbc/sbc_profiles/internal.xml +++ b/conf/sbc/sbc_profiles/internal.xml @@ -107,8 +107,8 @@ - - + + diff --git a/conf/vanilla/sip_profiles/external.xml b/conf/vanilla/sip_profiles/external.xml index 39965e9421..8176d9b23f 100644 --- a/conf/vanilla/sip_profiles/external.xml +++ b/conf/vanilla/sip_profiles/external.xml @@ -56,6 +56,7 @@ + diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index 5a97f0cd60..2dd3842649 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -67,8 +67,8 @@ - - + + diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index afb12ab94c..1ba2c57427 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -219,8 +219,8 @@ - - + + diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 2649a24ae8..9acbe6d916 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -263,9 +263,8 @@ - - + + diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml index e433da1425..b9907a78ad 100644 --- a/conf/insideout/sip_profiles/internal-ipv6.xml +++ b/conf/insideout/sip_profiles/internal-ipv6.xml @@ -69,6 +69,9 @@ + + + diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml index 61263f03dc..e406cd5e72 100644 --- a/conf/insideout/sip_profiles/internal.xml +++ b/conf/insideout/sip_profiles/internal.xml @@ -104,6 +104,9 @@ + + + diff --git a/conf/sbc/sbc_profiles/external.xml b/conf/sbc/sbc_profiles/external.xml index 1cb91e8dab..0f15159f58 100644 --- a/conf/sbc/sbc_profiles/external.xml +++ b/conf/sbc/sbc_profiles/external.xml @@ -49,6 +49,7 @@ + diff --git a/conf/sbc/sbc_profiles/internal-ipv6.xml b/conf/sbc/sbc_profiles/internal-ipv6.xml index e433da1425..b9907a78ad 100644 --- a/conf/sbc/sbc_profiles/internal-ipv6.xml +++ b/conf/sbc/sbc_profiles/internal-ipv6.xml @@ -69,6 +69,9 @@ + + + diff --git a/conf/sbc/sbc_profiles/internal.xml b/conf/sbc/sbc_profiles/internal.xml index 8263a82668..3081052c88 100644 --- a/conf/sbc/sbc_profiles/internal.xml +++ b/conf/sbc/sbc_profiles/internal.xml @@ -110,6 +110,9 @@ + + + diff --git a/conf/vanilla/sip_profiles/external.xml b/conf/vanilla/sip_profiles/external.xml index 8176d9b23f..4f18e84be7 100644 --- a/conf/vanilla/sip_profiles/external.xml +++ b/conf/vanilla/sip_profiles/external.xml @@ -57,6 +57,7 @@ + diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index 2dd3842649..18274faa4f 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -70,6 +70,9 @@ + + + diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index 1ba2c57427..0f4cabe32d 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -222,6 +222,9 @@ + + + diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 9acbe6d916..30d8063a67 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -266,6 +266,9 @@ + + + From 890a89b6e39f1410fbaad5226b030861de0b300e Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 06:17:58 +0000 Subject: [PATCH 0408/1057] debian: suggest rather than depend on problematic codecs --- debian/bootstrap.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 113675c3e8..d5c533c080 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -322,13 +322,14 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-g723-1 (= \${binary:Version}), freeswitch-mod-g729 (= \${binary:Version}), freeswitch-mod-h26x (= \${binary:Version}), - freeswitch-mod-ilbc (= \${binary:Version}), freeswitch-mod-mp4v (= \${binary:Version}), freeswitch-mod-opus (= \${binary:Version}), freeswitch-mod-silk (= \${binary:Version}), - freeswitch-mod-siren (= \${binary:Version}), freeswitch-mod-speex (= \${binary:Version}), freeswitch-mod-theora (= \${binary:Version}) +Suggests: + freeswitch-mod-ilbc (= \${binary:Version}), + freeswitch-mod-siren (= \${binary:Version}) Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") . From 219831edf3cac97e5aa043a75e2e8f212c2e5c8c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 06:34:52 +0000 Subject: [PATCH 0409/1057] debian: pull in mod_spandsp with other codecs --- debian/bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index d5c533c080..cf27d67934 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -325,6 +325,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-mp4v (= \${binary:Version}), freeswitch-mod-opus (= \${binary:Version}), freeswitch-mod-silk (= \${binary:Version}), + freeswitch-mod-spandsp (= \${binary:Version}), freeswitch-mod-speex (= \${binary:Version}), freeswitch-mod-theora (= \${binary:Version}) Suggests: From 44e6dd26800d6524345918b64e0e18610d97a35e Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 27 May 2012 14:36:15 +0200 Subject: [PATCH 0410/1057] FreeSWITCH: Make libzrtp library paths absolute (or relative to top srcdir), fixes FS-4260. Reference-URL: http://jira.freeswitch.org/browse/FS-4260 Tested-by: Stefan Knoblich Signed-off-by: Stefan Knoblich --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index db22184f5d..31d22f7754 100644 --- a/Makefile.am +++ b/Makefile.am @@ -157,8 +157,8 @@ if ENABLE_ZRTP CORE_CFLAGS += -I$(switch_srcdir)/libs/libzrtp/third_party/bgaes CORE_CFLAGS += -I$(switch_srcdir)/libs/libzrtp/third_party/bnlib CORE_CFLAGS += -isystem $(switch_srcdir)/libs/libzrtp/include -ZRTP_LDFLAGS = -Llibs/libzrtp/third_party/bnlib -ZRTP_LDFLAGS += -Llibs/libzrtp/projects/gnu/build +ZRTP_LDFLAGS = -L$(switch_srcdir)/libs/libzrtp/third_party/bnlib +ZRTP_LDFLAGS += -L$(switch_srcdir)/libs/libzrtp/projects/gnu/build ZRTP_LIBS = -lbn -lzrtp libfreeswitch_la_LDFLAGS += $(ZRTP_LDFLAGS) libfreeswitch_la_LIBADD += $(ZRTP_LIBS) From be3ee2404c4f7f5bd4b0c1def723cfad82c57043 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 09:18:28 +0000 Subject: [PATCH 0411/1057] reindent --- build/getlib.sh.in | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/build/getlib.sh.in b/build/getlib.sh.in index bbfe696f79..f18ec1da2d 100755 --- a/build/getlib.sh.in +++ b/build/getlib.sh.in @@ -1,4 +1,5 @@ #!/bin/sh +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- TAR=@TAR@ ZCAT=@ZCAT@ @@ -8,39 +9,39 @@ WGET=@WGET@ CURL=@CURL@ if [ -f "$WGET" ]; then - DOWNLOAD_CMD=$WGET + DOWNLOAD_CMD=$WGET elif [ -f "$CURL" ]; then - DOWNLOAD_CMD="$CURL -O" + DOWNLOAD_CMD="$CURL -O" fi if [ -n "`echo $1 | grep '://'`" ]; then - base=$1/ - tarfile=$2 + base=$1/ + tarfile=$2 else - base=http://files.freeswitch.org/downloads/libs/ - tarfile=$1 + base=http://files.freeswitch.org/downloads/libs/ + tarfile=$1 fi uncompressed=`echo $tarfile | sed 's/\(\(\.tar\.gz\|\.tar\.bz2\|\.tar\.xz\)\|\(\.tgz\|\.tbz2\)\)$//'` case `echo $tarfile | sed 's/^.*\.//'` in - bz2|tbz2) UNZIPPER=$BZIP ;; - xz) UNZIPPER=$XZ ;; - gz|tgz|*) UNZIPPER=$ZCAT ;; + bz2|tbz2) UNZIPPER=$BZIP ;; + xz) UNZIPPER=$XZ ;; + gz|tgz|*) UNZIPPER=$ZCAT ;; esac if [ ! -d $tarfile ]; then + if [ ! -f $tarfile ]; then + rm -fr $uncompressed + $DOWNLOAD_CMD $base$tarfile if [ ! -f $tarfile ]; then - rm -fr $uncompressed - $DOWNLOAD_CMD $base$tarfile - if [ ! -f $tarfile ]; then - echo cannot find $tarfile - exit 1 - fi - fi - if [ ! -d $uncompressed ]; then - $UNZIPPER -c -d $tarfile | $TAR -xf - + echo cannot find $tarfile + exit 1 fi + fi + if [ ! -d $uncompressed ]; then + $UNZIPPER -c -d $tarfile | $TAR -xf - + fi fi exit 0 From dfddd3ec108d446cee59380ea482f758044c5ad6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 09:12:09 +0000 Subject: [PATCH 0412/1057] debian: remove utilities that duplicate debian tools install-build-depends is inferior to: mk-build-deps -i --- debian/util.sh | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index be7f2f1cc0..3f25023d6d 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -32,46 +32,6 @@ create_dbg_pkgs () { done } -list_build_depends () { - test -f $ddir/.stamp-bootstrap || (cd $ddir && ./bootstrap.sh) - local deps="" found=false - while xread l; do - if [ "${l%%:*}" = "Build-Depends" ]; then - deps="${l#*:}" - found=true - continue - elif $found; then - if [ -z "$l" ]; then - # is newline - break - elif [ -z "${l##\#*}" ]; then - # is comment - continue - elif [ -z "${l## *}" ]; then - # is continuation line - deps="$deps $(echo "$l" | sed -e 's/^ *//' -e 's/ *([^)]*)//g' -e 's/,//g')" - else - # is a new header - break - fi - fi - done < $ddir/control - echo "${deps# }" -} - -install_build_depends () { - local apt="" - if [ -n "$(which aptitude)" ]; then - apt=$(which aptitude) - elif [ -n "$(which apt-get)" ]; then - apt=$(which apt-get) - else - err "Can't find apt-get or aptitude; are you running on debian?" - fi - $apt install -y $(list_build_depends) - touch $ddir/.stamp-build-depends -} - cwget () { local url="$1" f="${1##*/}" echo "fetching: $url to $f" >&2 @@ -208,7 +168,5 @@ case "$cmd" in create-dbg-pkgs) create_dbg_pkgs ;; create-dsc) create_dsc "$@" ;; create-orig) create_orig "$@" ;; - list-build-depends) list_build_depends ;; - install-build-depends) install_build_depends ;; esac From fa0de2efd3f66d3e56152974e6962d01a30a7d3b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 09:17:59 +0000 Subject: [PATCH 0413/1057] add .gitattributes Add some attributes that are useful for packaging. --- .gitattributes | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..06c92d07df --- /dev/null +++ b/.gitattributes @@ -0,0 +1,15 @@ +# gitattributes +*.exe -diff binary executable windows dfsg-nonfree debian-ignore +*.wav -diff binary sound +*.gif -diff binary image +*.jpg -diff binary image +*.jpeg -diff binary image +*.pbm -diff binary image +/clients/flex* dfsg-nonfree +/debian* debian-ignore +/freeswitch.xcodeproj debian-ignore +/libs/ilbc* dfsg-nonfree +/libs/libg722_1* dfsg-nonfree +/libs/win32* windows debian-ignore +/htdocs* dfsg-nonfree debian-ignore +/w32* windows debian-ignore From 7d5062f9c9677b8c5ea59f64454e92f5452e602d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 09:51:18 +0000 Subject: [PATCH 0414/1057] debian: don't force-create the orig tarball --- debian/gbp.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/gbp.conf b/debian/gbp.conf index 3889b7e9ee..cd1c5ad37e 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -7,7 +7,6 @@ upstream-branch=master debian-branch=master upstream-tree=branch tag=False -force-create=True compression=xz compression-level=9ev builder=debuild --prepend-path=/usr/lib/ccache -eFS_* -eCCACHE_* -i\.git -I.git -Zxz -z9 From 870ef6f83f191610cad0546a45be28c2abc8cf3c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 09:31:03 +0000 Subject: [PATCH 0415/1057] debian: don't bundle sounds in orig tarball We've moved the sounds to a separate source package. --- debian/util.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 3f25023d6d..f303d10608 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -54,12 +54,6 @@ getlib () { && mkdir -p $f) } -getsound () { - local sd="$1" url="$2" f="${2##*/}" - (cd $sd \ - && cwget "$url") -} - getlibs () { local sd="$1" # get pinned libraries @@ -80,11 +74,6 @@ getlibs () { getlib $sd http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz getlib $sd http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz getlib $sd http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz - # get sounds and music - for x in 8000 16000 32000 48000; do - getsound $sd http://files.freeswitch.org/freeswitch-sounds-en-us-callie-$x-1.0.18.tar.gz - getsound $sd http://files.freeswitch.org/freeswitch-sounds-music-$x-1.0.8.tar.gz - done # cleanup mongo ( cd $sd/libs/mongo-cxx-driver-v1.8 From 15a67097d804ae4143e63d2c7a3475ff06943481 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 27 May 2012 06:54:31 +0000 Subject: [PATCH 0416/1057] debian: add utility for rolling nightly builds --- debian/util.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index f303d10608..133457b983 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -12,6 +12,16 @@ err () { exit 1 } +announce () { + cat >&2 < Date: Mon, 28 May 2012 12:11:41 +0000 Subject: [PATCH 0417/1057] debian: refactor and improve build utilities --- debian/util.sh | 278 ++++++++++++++++++++++++++----------------------- 1 file changed, 148 insertions(+), 130 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 133457b983..326e8f6156 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -6,6 +6,9 @@ set -e ddir="." [ -n "${0%/*}" ] && ddir="${0%/*}" +cd $ddir/../ + +#### lib err () { echo "$0 error: $1" >&2 @@ -31,6 +34,35 @@ xread () { return $ret } +mk_dver () { echo "$1" | sed -e 's/-/~/g'; } +mk_uver () { echo "$1" | sed -e 's/-.*$//' -e 's/~/-/'; } +dsc_source () { dpkg-parsechangelog | grep '^Source:' | awk '{print $2}'; } +dsc_ver () { dpkg-parsechangelog | grep '^Version:' | awk '{print $2}'; } +up_ver () { mk_uver "$(dsc_ver)"; } +dsc_base () { echo "$(dsc_source)_$(dsc_ver)"; } +up_base () { echo "$(dsc_source)-$(up_ver)"; } + +find_distro () { + case "$1" in + experimental) echo "sid";; + unstable) echo "sid";; + testing) echo "wheezy";; + stable) echo "squeeze";; + *) echo "$1";; + esac +} + +find_suite () { + case "$1" in + sid) echo "unstable";; + wheezy) echo "testing";; + squeeze) echo "stable";; + *) echo "$1";; + esac +} + +#### debian/rules helpers + create_dbg_pkgs () { for x in $ddir/*; do test ! -d $x && continue @@ -56,166 +88,152 @@ cwget () { } getlib () { - local sd="$1" url="$2" f="${2##*/}" - (cd $sd/libs \ - && cwget "$url" \ - && tar -xv --no-same-owner --no-same-permissions -f "$f" \ - && rm -f "$f" \ - && mkdir -p $f) + local url="$1" f="${1##*/}" + cwget "$url" + tar -xv --no-same-owner --no-same-permissions -f "$f" + rm -f "$f" && mkdir -p $f && touch $f/.download-stamp } getlibs () { - local sd="$1" # get pinned libraries - getlib $sd http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v1.8-latest.tgz - getlib $sd http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2 - getlib $sd http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/openldap-2.4.19.tar.gz - getlib $sd http://download.zeromq.org/zeromq-2.1.9.tar.gz \ - || getlib $sd http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.6.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz - getlib $sd http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz + getlib http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v1.8-latest.tgz + getlib http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz + getlib http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz + getlib http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz + getlib http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2 + getlib http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz + getlib http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz + getlib http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz + getlib http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz + getlib http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz + getlib http://files.freeswitch.org/downloads/libs/openldap-2.4.19.tar.gz + getlib http://download.zeromq.org/zeromq-2.1.9.tar.gz \ + || getlib http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz + getlib http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.6.tar.gz + getlib http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz + getlib http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz + getlib http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz # cleanup mongo ( - cd $sd/libs/mongo-cxx-driver-v1.8 + cd mongo-cxx-driver-v1.8 rm -rf config.log .sconf_temp *Test *Example find . -name "*.o" -exec rm -f {} \; ) } -get_current_version () { - cat $ddir/changelog \ - | grep -e '^freeswitch ' \ - | awk '{print $2}' \ - | sed -e 's/[()]//g' -e 's/-.*//' -} - -_create_orig () { - . $ddir/../scripts/ci/common.sh - eval $(parse_version "$(get_current_version)") - local destdir="$1" xz_level="$2" n=freeswitch - local d=${n}-${dver} f=${n}_${dver} - local sd=${ddir}/sdeb/$d - [ -n "$destdir" ] || destdir=$ddir/../../ - mkdir -p $sd - tar -c -C $ddir/../ \ - --exclude=.git \ - --exclude=debian \ - --exclude=freeswitch.xcodeproj \ - --exclude=fscomm \ - --exclude=htdocs \ - --exclude=w32 \ - --exclude=web \ - -vf - . | tar -x -C $sd -vf - - (cd $sd && set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev") - getlibs $sd - tar -c -C $ddir/sdeb -vf $ddir/sdeb/$f.orig.tar $d - xz -${xz_level}v $ddir/sdeb/$f.orig.tar - mv $ddir/sdeb/$f.orig.tar.xz $destdir - rm -rf $ddir/sdeb +check_repo_clean () { + git diff-index --quiet --cached HEAD \ + || err "uncommitted changes present" + git diff-files --quiet \ + || err "unclean working tree" + git diff-index --quiet HEAD \ + || err "unclean repository" + ! git ls-files --other --error-unmatch . >/dev/null 2>&1 \ + || err "untracked files or build products present" } create_orig () { - local xz_level="6" - while getopts 'dz:' o; do + local OPTIND OPTARG + local uver="" bundle_deps=false zl=9e + while getopts 'bnv:z:' o "$@"; do case "$o" in - d) set -vx;; - z) xz_level="$OPTARG";; + b) bundle_deps=true;; + n) uver="nightly";; + v) uver="$OPTARG";; + z) zl="$OPTARG";; esac done shift $(($OPTIND-1)) - _create_orig "$1" "$xz_level" + [ -z "$uver" ] || [ "$uver" = "nightly" ] \ + && uver="$(cat build/next-release.txt)-n$(date +%Y%m%dT%H%M%SZ)" + local treeish="$1" dver="$(mk_dver "$uver")" + local orig="../freeswitch_$dver.orig.tar.xz" + [ -n "$treeish" ] || treeish="HEAD" + check_repo_clean + git reset --hard "$treeish" + mv .gitattributes .gitattributes.orig + grep .gitattributes.orig \ + -e '\bdebian-ignore\b' \ + -e '\bdfsg-nonfree\b' \ + | while xread l; do + echo "$l export-ignore" >> .gitattributes + done + if $bundle_deps; then + (cd libs && getlibs) + git add -f libs + fi + ./build/set-fs-version.sh "$uver" && git add configure.in + git commit --allow-empty -m "nightly v$uver" + git archive -v \ + --worktree-attributes \ + --format=tar \ + --prefix=freeswitch-$uver/ \ + HEAD \ + | xz -c -${zl}v > $orig + mv .gitattributes.orig .gitattributes + git reset --hard HEAD^ && git clean -fdx + echo $orig } create_dsc () { - . $ddir/../scripts/ci/common.sh - local xz_level="6" - while getopts 'dz:' o; do - case "$o" in - d) set -vx;; - z) xz_level="$OPTARG";; - esac - done - shift $(($OPTIND-1)) - eval $(parse_version "$(get_current_version)") - local destdir="$1" n=freeswitch - local d=${n}-${dver} f=${n}_${dver} - [ -n "$destdir" ] || destdir=$ddir/../../ - [ -f $destdir/$f.orig.tar.xz ] \ - || _create_orig "$1" "${xz_level}" - ( - ddir=$(pwd)/$ddir - cd $destdir - mkdir -p $f - cp -a $ddir $f - dpkg-source -b -i.* -Zxz -z9 $f - ) -} - -build_nightly_for () { - set -e - local branch="$1" - local distro="$2" suite="" - case $distro in - experimental) distro="sid" suite="experimental";; - sid) suite="unstable";; - wheezy) suite="testing" ;; - squeeze) suite="stable" ;; - esac - [ -x "$(which cowbuilder)" ] \ - || err "Error: package cowbuilder isn't installed" + local distro="$(find_distro $1)" orig="$2" + local suite="$(find_suite $distro)" + local orig_ver="$(echo "$orig" | sed -e 's/^.*_//' -e 's/\.orig\.tar.*$//')" + local dver="${orig_ver}-1~${distro}+1" [ -x "$(which dch)" ] \ - || err "Error: package devscripts isn't installed" - [ -x "$(which git-buildpackage)" ] \ - || err "Error: package git-buildpackage isn't installed" - ulimit -n 200000 || true - if ! [ -d /var/cache/pbuilder/base-$distro.cow ]; then - announce "Creating base $distro image..." - cowbuilder --create \ - --distribution $distro \ - --basepath /var/cache/pbuilder/base-$distro.cow - fi - announce "Updating base $distro image..." - cowbuilder --update \ - --distribution $distro \ - --basepath /var/cache/pbuilder/base-$distro.cow - local ver="$(cat build/next-release.txt | sed -e 's/-/~/g')~n$(date +%Y%m%dT%H%M%SZ)-1~${distro}+1" - echo "Building v$ver for $distro based on $branch" - cd $ddir/../ - announce "Building v$ver..." - git clean -fdx - git reset --hard $branch - ./build/set-fs-version.sh "$ver" - git add configure.in && git commit --allow-empty -m "nightly v$ver" + || err "package devscripts isn't installed" (cd debian && ./bootstrap.sh -c $distro) - dch -b -m -v "$ver" --force-distribution -D "$suite" "Nightly build." - git-buildpackage -us -uc \ - --git-verbose \ - --git-pbuilder --git-dist=$distro \ - --git-compression=xz --git-compression-level=9ev - git reset --hard HEAD^ + dch -b -m -v "$dver" --force-distribution -D "$suite" "Nightly build." + git add debian/changelog && git commit -m "nightly v$orig_ver" + dpkg-source -i.* -Zxz -z9 -b . + dpkg-genchanges -S > ../$(dsc_base)_source.changes + local dsc="../$(dsc_base).dsc" + git reset --hard HEAD^ && git clean -fdx + echo $dsc } -build_nightly () { - local branch="$1"; shift - for distro in "$@"; do - build_nightly_for "$branch" "$distro" - done +build_debs () { + local distro="$(find_distro $1)" dsc="$2" arch="$3" + if [ -z "$distro" ] || [ "$distro" = "auto" ]; then + if ! (echo "$dsc" | grep -e '-[0-9]*~[a-z]*+[0-9]*'); then + err "no distro specified or found" + fi + local x="$(echo $dsc | sed -e 's/^[^-]*-[0-9]*~//' -e 's/+[^+]*$//')" + distro="$(find_distro $x)" + fi + [ -n "$arch" ] || arch="$(dpkg-architecture | grep '^DEB_BUILD_ARCH=' | cut -d'=' -f2)" + [ -x "$(which cowbuilder)" ] \ + || err "package cowbuilder isn't installed" + local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow + cow () { + cowbuilder "$@" \ + --distribution $distro \ + --architecture $arch \ + --basepath $cow_img + } + if ! [ -d $cow_img ]; then + announce "Creating base $distro-$arch image..." + cow --create + fi + announce "Updating base $distro-$arch image..." + cow --update + announce "Building $distro-$arch DEBs from $dsc..." + cow --build $dsc + echo ${dsc}_${arch}.changes } +while getopts 'd' o "$@"; do + case "$o" in + d) set -vx;; + esac +done +shift $(($OPTIND-1)) + cmd="$1" shift case "$cmd" in - build-nightly) build_nightly "$@" ;; + archive-orig) archive_orig "$@" ;; + build-debs) build_debs "$@" ;; create-dbg-pkgs) create_dbg_pkgs ;; create-dsc) create_dsc "$@" ;; create-orig) create_orig "$@" ;; From 139485855d3469e5cec4d14884f9f920d8ec1b28 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 13:35:00 +0000 Subject: [PATCH 0418/1057] debian: don't try to build non-dfsg modules --- debian/bootstrap.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index cf27d67934..62edf42668 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -17,7 +17,9 @@ avoid_mods=( applications/mod_skel asr_tts/mod_cepstral codecs/mod_com_g729 + codecs/mod_ilbc codecs/mod_sangoma_codec + codecs/mod_siren codecs/mod_skel_codec codecs/mod_voipcodecs endpoints/mod_gsmopen From 8fb3f54c15045e699bd43c5df118589df439b179 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 13:37:34 +0000 Subject: [PATCH 0419/1057] debian: add option to create pbuilder debug hook --- debian/util.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 326e8f6156..08827f3e07 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -192,7 +192,23 @@ create_dsc () { echo $dsc } +fmt_debug_hook () { + cat <<'EOF' +#!/bin/bash +export debian_chroot="cow" +cd /tmp/buildd/*/debian/.. +/bin/bash < /dev/tty > /dev/tty 2> /dev/tty +EOF +} + build_debs () { + local OPTIND OPTARG debug_hook=false hookdir="" + while getopts 'd' o "$@"; do + case "$o" in + d) debug_hook=true;; + esac + done + shift $(($OPTIND-1)) local distro="$(find_distro $1)" dsc="$2" arch="$3" if [ -z "$distro" ] || [ "$distro" = "auto" ]; then if ! (echo "$dsc" | grep -e '-[0-9]*~[a-z]*+[0-9]*'); then @@ -218,7 +234,13 @@ build_debs () { announce "Updating base $distro-$arch image..." cow --update announce "Building $distro-$arch DEBs from $dsc..." - cow --build $dsc + if $debug_hook; then + mkdir -p .hooks + fmt_debug_hook > .hooks/C10shell + chmod +x .hooks/C10shell + hookdir=$(pwd)/.hooks + fi + cow --build $dsc --hookdir "$hookdir" echo ${dsc}_${arch}.changes } From 40a98d4b49f8b986a4bb5ae87f94de1ee297546b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 13:11:21 +0000 Subject: [PATCH 0420/1057] debian: disable modules that break the build --- debian/bootstrap.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 62edf42668..bd5547dbc5 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -15,7 +15,9 @@ avoid_mods=( applications/mod_osp applications/mod_rad_auth applications/mod_skel + applications/mod_soundtouch asr_tts/mod_cepstral + asr_tts/mod_flite codecs/mod_com_g729 codecs/mod_ilbc codecs/mod_sangoma_codec @@ -33,6 +35,14 @@ avoid_mods=( sdk/autotools xml_int/mod_xml_ldap ) +avoid_mods_sid=( + endpoints/mod_portaudio + formats/mod_portaudio_stream +) +avoid_mods_wheezy=( + endpoints/mod_portaudio + formats/mod_portaudio_stream +) avoid_mods_squeeze=( formats/mod_vlc languages/mod_managed From 496b9a9c785bab98554df4625facf7ac510afee9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 14:55:44 +0000 Subject: [PATCH 0421/1057] debian: add utility for building all distros and architectures --- debian/util.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index 08827f3e07..181bf04702 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -244,6 +244,42 @@ build_debs () { echo ${dsc}_${arch}.changes } +build_all () { + local OPTIND OPTARG + local orig_opts="" deb_opts="" + local archs="" distros="" + while getopts 'a:bc:dnv:z:' o "$@"; do + case "$o" in + a) archs="$archs $OPTARG";; + b) orig_opts="$orig_opts -b";; + c) distros="$distros $OPTARG";; + d) deb_opts="$deb_opts -d";; + n) orig_opts="$orig_opts -n";; + v) orig_opts="$orig_opts -v$OPTARG";; + z) orig_opts="$orig_opts -z$OPTARG";; + esac + done + shift $(($OPTIND-1)) + [ -n "$archs" ] || archs="amd64 i386" + [ -n "$distros" ] || distros="sid wheezy squeeze" + local acc_changes="" + local orig="$(create_orig $orig_opts HEAD | tail -n1)" + if [ "${orig:0:2}" = ".." ]; then + for distro in $distros; do + local dsc="$(create_dsc $distro $orig | tail -n1)" + if [ "${dsc:0:2}" = ".." ]; then + for arch in $archs; do + local changes="$(build_debs $deb_opts $distro $dsc $arch | tail -n1)" + if [ "${changes:0:2}" = ".." ]; then + acc_changes="$acc_changes $changes" + fi + done + fi + done + fi + echo "${acc_changes:1}" +} + while getopts 'd' o "$@"; do case "$o" in d) set -vx;; @@ -255,6 +291,7 @@ cmd="$1" shift case "$cmd" in archive-orig) archive_orig "$@" ;; + build-all) build_all "$@" ;; build-debs) build_debs "$@" ;; create-dbg-pkgs) create_dbg_pkgs ;; create-dsc) create_dsc "$@" ;; From d3cb7036977c5e59f908f003e5cfce176a9059eb Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 17:03:23 +0000 Subject: [PATCH 0422/1057] debian: force build output to stderr Because we're capturing the string return value of these functions, we can't see any output that goes to stdout. --- debian/util.sh | 186 +++++++++++++++++++++++++------------------------ 1 file changed, 96 insertions(+), 90 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 181bf04702..829eeba3aa 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -133,62 +133,66 @@ check_repo_clean () { } create_orig () { - local OPTIND OPTARG - local uver="" bundle_deps=false zl=9e - while getopts 'bnv:z:' o "$@"; do - case "$o" in - b) bundle_deps=true;; - n) uver="nightly";; - v) uver="$OPTARG";; - z) zl="$OPTARG";; - esac - done - shift $(($OPTIND-1)) - [ -z "$uver" ] || [ "$uver" = "nightly" ] \ - && uver="$(cat build/next-release.txt)-n$(date +%Y%m%dT%H%M%SZ)" - local treeish="$1" dver="$(mk_dver "$uver")" - local orig="../freeswitch_$dver.orig.tar.xz" - [ -n "$treeish" ] || treeish="HEAD" - check_repo_clean - git reset --hard "$treeish" - mv .gitattributes .gitattributes.orig - grep .gitattributes.orig \ - -e '\bdebian-ignore\b' \ - -e '\bdfsg-nonfree\b' \ - | while xread l; do - echo "$l export-ignore" >> .gitattributes - done - if $bundle_deps; then - (cd libs && getlibs) - git add -f libs - fi - ./build/set-fs-version.sh "$uver" && git add configure.in - git commit --allow-empty -m "nightly v$uver" - git archive -v \ - --worktree-attributes \ - --format=tar \ - --prefix=freeswitch-$uver/ \ - HEAD \ - | xz -c -${zl}v > $orig - mv .gitattributes.orig .gitattributes - git reset --hard HEAD^ && git clean -fdx + { + local OPTIND OPTARG + local uver="" bundle_deps=false zl=9e + while getopts 'bnv:z:' o "$@"; do + case "$o" in + b) bundle_deps=true;; + n) uver="nightly";; + v) uver="$OPTARG";; + z) zl="$OPTARG";; + esac + done + shift $(($OPTIND-1)) + [ -z "$uver" ] || [ "$uver" = "nightly" ] \ + && uver="$(cat build/next-release.txt)-n$(date +%Y%m%dT%H%M%SZ)" + local treeish="$1" dver="$(mk_dver "$uver")" + local orig="../freeswitch_$dver.orig.tar.xz" + [ -n "$treeish" ] || treeish="HEAD" + check_repo_clean + git reset --hard "$treeish" + mv .gitattributes .gitattributes.orig + grep .gitattributes.orig \ + -e '\bdebian-ignore\b' \ + -e '\bdfsg-nonfree\b' \ + | while xread l; do + echo "$l export-ignore" >> .gitattributes + done + if $bundle_deps; then + (cd libs && getlibs) + git add -f libs + fi + ./build/set-fs-version.sh "$uver" && git add configure.in + git commit --allow-empty -m "nightly v$uver" + git archive -v \ + --worktree-attributes \ + --format=tar \ + --prefix=freeswitch-$uver/ \ + HEAD \ + | xz -c -${zl}v > $orig + mv .gitattributes.orig .gitattributes + git reset --hard HEAD^ && git clean -fdx + } 1>&2 echo $orig } create_dsc () { - local distro="$(find_distro $1)" orig="$2" - local suite="$(find_suite $distro)" - local orig_ver="$(echo "$orig" | sed -e 's/^.*_//' -e 's/\.orig\.tar.*$//')" - local dver="${orig_ver}-1~${distro}+1" - [ -x "$(which dch)" ] \ - || err "package devscripts isn't installed" - (cd debian && ./bootstrap.sh -c $distro) - dch -b -m -v "$dver" --force-distribution -D "$suite" "Nightly build." - git add debian/changelog && git commit -m "nightly v$orig_ver" - dpkg-source -i.* -Zxz -z9 -b . - dpkg-genchanges -S > ../$(dsc_base)_source.changes - local dsc="../$(dsc_base).dsc" - git reset --hard HEAD^ && git clean -fdx + { + local distro="$(find_distro $1)" orig="$2" + local suite="$(find_suite $distro)" + local orig_ver="$(echo "$orig" | sed -e 's/^.*_//' -e 's/\.orig\.tar.*$//')" + local dver="${orig_ver}-1~${distro}+1" + [ -x "$(which dch)" ] \ + || err "package devscripts isn't installed" + (cd debian && ./bootstrap.sh -c $distro) + dch -b -m -v "$dver" --force-distribution -D "$suite" "Nightly build." + git add debian/changelog && git commit -m "nightly v$orig_ver" + dpkg-source -i.* -Zxz -z9 -b . + dpkg-genchanges -S > ../$(dsc_base)_source.changes + local dsc="../$(dsc_base).dsc" + git reset --hard HEAD^ && git clean -fdx + } 1>&2 echo $dsc } @@ -202,45 +206,47 @@ EOF } build_debs () { - local OPTIND OPTARG debug_hook=false hookdir="" - while getopts 'd' o "$@"; do - case "$o" in - d) debug_hook=true;; - esac - done - shift $(($OPTIND-1)) - local distro="$(find_distro $1)" dsc="$2" arch="$3" - if [ -z "$distro" ] || [ "$distro" = "auto" ]; then - if ! (echo "$dsc" | grep -e '-[0-9]*~[a-z]*+[0-9]*'); then - err "no distro specified or found" + { + local OPTIND OPTARG debug_hook=false hookdir="" + while getopts 'd' o "$@"; do + case "$o" in + d) debug_hook=true;; + esac + done + shift $(($OPTIND-1)) + local distro="$(find_distro $1)" dsc="$2" arch="$3" + if [ -z "$distro" ] || [ "$distro" = "auto" ]; then + if ! (echo "$dsc" | grep -e '-[0-9]*~[a-z]*+[0-9]*'); then + err "no distro specified or found" + fi + local x="$(echo $dsc | sed -e 's/^[^-]*-[0-9]*~//' -e 's/+[^+]*$//')" + distro="$(find_distro $x)" fi - local x="$(echo $dsc | sed -e 's/^[^-]*-[0-9]*~//' -e 's/+[^+]*$//')" - distro="$(find_distro $x)" - fi - [ -n "$arch" ] || arch="$(dpkg-architecture | grep '^DEB_BUILD_ARCH=' | cut -d'=' -f2)" - [ -x "$(which cowbuilder)" ] \ - || err "package cowbuilder isn't installed" - local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow - cow () { - cowbuilder "$@" \ - --distribution $distro \ - --architecture $arch \ - --basepath $cow_img - } - if ! [ -d $cow_img ]; then - announce "Creating base $distro-$arch image..." - cow --create - fi - announce "Updating base $distro-$arch image..." - cow --update - announce "Building $distro-$arch DEBs from $dsc..." - if $debug_hook; then - mkdir -p .hooks - fmt_debug_hook > .hooks/C10shell - chmod +x .hooks/C10shell - hookdir=$(pwd)/.hooks - fi - cow --build $dsc --hookdir "$hookdir" + [ -n "$arch" ] || arch="$(dpkg-architecture | grep '^DEB_BUILD_ARCH=' | cut -d'=' -f2)" + [ -x "$(which cowbuilder)" ] \ + || err "package cowbuilder isn't installed" + local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow + cow () { + cowbuilder "$@" \ + --distribution $distro \ + --architecture $arch \ + --basepath $cow_img + } + if ! [ -d $cow_img ]; then + announce "Creating base $distro-$arch image..." + cow --create + fi + announce "Updating base $distro-$arch image..." + cow --update + announce "Building $distro-$arch DEBs from $dsc..." + if $debug_hook; then + mkdir -p .hooks + fmt_debug_hook > .hooks/C10shell + chmod +x .hooks/C10shell + hookdir=$(pwd)/.hooks + fi + cow --build $dsc --hookdir "$hookdir" + } 1>&2 echo ${dsc}_${arch}.changes } From 2365f41fdc1a7a04248b864aa1a22305a55274d5 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 17:26:32 +0000 Subject: [PATCH 0423/1057] debian: add a build quicktest feature --- debian/util.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 829eeba3aa..0331913210 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -177,14 +177,30 @@ create_orig () { echo $orig } +set_modules_quicktest () { + cat > debian/modules.conf < Date: Mon, 28 May 2012 17:42:51 +0000 Subject: [PATCH 0424/1057] debian: ensure set -e behavior when run under build-all build_all call each of these subroutines under a sub-shell, so the set -e gets wiped out. --- debian/util.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index 0331913210..c6220e96a0 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -134,6 +134,7 @@ check_repo_clean () { create_orig () { { + set -e local OPTIND OPTARG local uver="" bundle_deps=false zl=9e while getopts 'bnv:z:' o "$@"; do @@ -185,6 +186,7 @@ EOF create_dsc () { { + set -e local OPTIND OPTARG modules_list="" while getopts 'm:' o "$@"; do case "$o" in @@ -223,6 +225,7 @@ EOF build_debs () { { + set -e local OPTIND OPTARG debug_hook=false hookdir="" while getopts 'd' o "$@"; do case "$o" in From b4816ae952828144b59f0b20771f4e5487f67ed9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 18:24:11 +0000 Subject: [PATCH 0425/1057] debian: place build results in ../ --- debian/util.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index c6220e96a0..0b6320d21e 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -264,7 +264,9 @@ build_debs () { chmod +x .hooks/C10shell hookdir=$(pwd)/.hooks fi - cow --build $dsc --hookdir "$hookdir" + cow --build $dsc \ + --hookdir "$hookdir" \ + --buildresult ../ } 1>&2 echo ${dsc}_${arch}.changes } From 9f578ca440276fd6f5ed3b48d07ceca4e735d673 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 18:28:17 +0000 Subject: [PATCH 0426/1057] debian: use bootstrap.sh -j We believe it to be safe now. In test run on multi-core machines it is producing bit-for-bit identical result compared to the non-parallel invocation. --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 0e864c398d..1460ee8962 100755 --- a/debian/rules +++ b/debian/rules @@ -47,7 +47,7 @@ override_dh_auto_clean: .stamp-bootstrap: @$(call show_vars) - ./bootstrap.sh + ./bootstrap.sh -j touch $@ .stamp-configure: .stamp-bootstrap From 25287f3828c7445ae673aba64c5e17695c06bfd2 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 19:15:20 +0000 Subject: [PATCH 0427/1057] debian: add option to control make/bootstrap -j settings --- debian/util.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 0b6320d21e..87eca55efe 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -187,10 +187,11 @@ EOF create_dsc () { { set -e - local OPTIND OPTARG modules_list="" - while getopts 'm:' o "$@"; do + local OPTIND OPTARG modules_list="" speed="normal" + while getopts 'm:s:' o "$@"; do case "$o" in m) modules_list="$OPTARG";; + s) speed="$OPTARG";; esac done shift $(($OPTIND-1)) @@ -204,6 +205,13 @@ create_dsc () { set_modules_${modules_list} fi (cd debian && ./bootstrap.sh -c $distro) + case "$speed" in + paranoid) sed -i ./debian/rules \ + -e '/\.stamp-bootstrap:/{:l2 n; /\.\/bootstrap.sh -j/{s/ -j//; :l3 n; b l3}; b l2};' ;; + reckless) sed -i ./debian/rules \ + -e '/\.stamp-build:/{:l2 n; /make/{s/$/ -j/; :l3 n; b l3}; b l2};' ;; + esac + git add debian/rules dch -b -m -v "$dver" --force-distribution -D "$suite" "Nightly build." git add debian/changelog && git commit -m "nightly v$orig_ver" dpkg-source -i.* -Zxz -z9 -b . @@ -275,7 +283,7 @@ build_all () { local OPTIND OPTARG local orig_opts="" dsc_opts="" deb_opts="" local archs="" distros="" - while getopts 'a:bc:dnm:v:z:' o "$@"; do + while getopts 'a:bc:dnm:s:v:z:' o "$@"; do case "$o" in a) archs="$archs $OPTARG";; b) orig_opts="$orig_opts -b";; @@ -283,6 +291,7 @@ build_all () { d) deb_opts="$deb_opts -d";; n) orig_opts="$orig_opts -n";; m) dsc_opts="$dsc_opts -m$OPTARG";; + s) dsc_opts="$dsc_opts -s$OPTARG";; v) orig_opts="$orig_opts -v$OPTARG";; z) orig_opts="$orig_opts -z$OPTARG";; esac From baf5bbd565bcdc3dc35106485dc58c4dddd2baad Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 May 2012 08:42:51 -0500 Subject: [PATCH 0428/1057] FS-4266 --resolve --- src/mod/endpoints/mod_sofia/sofia_glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6bb7d3ee5f..577c36668e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1751,7 +1751,7 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt) } - } else if ((!strncmp("m=audio ", p, 8) && *(p + 9) != '0') || (!strncmp("m=image ", p, 8) && *(p + 9) != '0')) { + } else if ((!strncmp("m=audio ", p, 8) && *(p + 8) != '0') || (!strncmp("m=image ", p, 8) && *(p + 8) != '0')) { strncpy(q, p, 8); p += 8; @@ -1787,7 +1787,7 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt) has_audio++; - } else if (!strncmp("m=video ", p, 8) && *(p + 9) != '0') { + } else if (!strncmp("m=video ", p, 8) && *(p + 8) != '0') { if (!has_video) { sofia_glue_tech_choose_video_port(tech_pvt, 1); tech_pvt->video_rm_encoding = "PROXY-VID"; From 6679e3f5892e299c6c15b904f4fb707386700429 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 28 May 2012 20:48:04 +0000 Subject: [PATCH 0429/1057] debian: add option to run builds in parallel --- debian/util.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 87eca55efe..de1496a950 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -282,13 +282,14 @@ build_debs () { build_all () { local OPTIND OPTARG local orig_opts="" dsc_opts="" deb_opts="" - local archs="" distros="" - while getopts 'a:bc:dnm:s:v:z:' o "$@"; do + local archs="" distros="" par=false + while getopts 'a:bc:djnm:s:v:z:' o "$@"; do case "$o" in a) archs="$archs $OPTARG";; b) orig_opts="$orig_opts -b";; c) distros="$distros $OPTARG";; d) deb_opts="$deb_opts -d";; + j) par=true;; n) orig_opts="$orig_opts -n";; m) dsc_opts="$dsc_opts -m$OPTARG";; s) dsc_opts="$dsc_opts -s$OPTARG";; @@ -299,22 +300,32 @@ build_all () { shift $(($OPTIND-1)) [ -n "$archs" ] || archs="amd64 i386" [ -n "$distros" ] || distros="sid wheezy squeeze" - local acc_changes="" local orig="$(create_orig $orig_opts HEAD | tail -n1)" + mkdir -p ../log + > ../log/changes + echo; echo; echo; echo if [ "${orig:0:2}" = ".." ]; then for distro in $distros; do - local dsc="$(create_dsc $dsc_opts $distro $orig | tail -n1)" + echo "Creating $distro dsc..." >&2 + local dsc="$(create_dsc $dsc_opts $distro $orig 2>../log/$distro | tail -n1)" + echo "Done creating $distro dsc." >&2 if [ "${dsc:0:2}" = ".." ]; then for arch in $archs; do - local changes="$(build_debs $deb_opts $distro $dsc $arch | tail -n1)" - if [ "${changes:0:2}" = ".." ]; then - acc_changes="$acc_changes $changes" - fi + { + echo "Building $distro-$arch debs..." >&2 + local changes="$(build_debs $deb_opts $distro $dsc $arch 2>../log/$distro-$arch | tail -n1)" + echo "Done building $distro-$arch debs." >&2 + if [ "${changes:0:2}" = ".." ]; then + echo "$changes" >> ../log/changes + fi + } & + $par || wait done fi done + ! $par || wait fi - echo "${acc_changes:1}" + cat ../log/changes } while getopts 'd' o "$@"; do From 226851e8b091f0832f97bde1afe3e7bd2ff829ba Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 29 May 2012 18:41:17 +0000 Subject: [PATCH 0430/1057] don't use Siren or iLBC by default in example configs These codecs are non-free which creates issues for distributions, so let's not require these by default to run our example configs. We can add back in iLBC once we resolve the licensing situation with our in-tree implementation. --- conf/insideout/autoload_configs/modules.conf.xml | 2 +- conf/sbc/autoload_configs/modules.conf.xml | 2 +- conf/softphone/freeswitch.xml | 4 +--- conf/vanilla/autoload_configs/modules.conf.xml | 4 ++-- conf/vanilla/vars.xml | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/conf/insideout/autoload_configs/modules.conf.xml b/conf/insideout/autoload_configs/modules.conf.xml index 8793a003ba..3c864aec1c 100644 --- a/conf/insideout/autoload_configs/modules.conf.xml +++ b/conf/insideout/autoload_configs/modules.conf.xml @@ -60,7 +60,7 @@ - + diff --git a/conf/sbc/autoload_configs/modules.conf.xml b/conf/sbc/autoload_configs/modules.conf.xml index 31b96dd27a..fb59b386be 100644 --- a/conf/sbc/autoload_configs/modules.conf.xml +++ b/conf/sbc/autoload_configs/modules.conf.xml @@ -39,7 +39,7 @@ - + diff --git a/conf/softphone/freeswitch.xml b/conf/softphone/freeswitch.xml index 00a2bc31cb..66e7c2a923 100644 --- a/conf/softphone/freeswitch.xml +++ b/conf/softphone/freeswitch.xml @@ -3,7 +3,7 @@ - + @@ -86,10 +86,8 @@ - - diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index 266b32204a..f88bb7b7c0 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -82,10 +82,10 @@ - + - + diff --git a/conf/vanilla/vars.xml b/conf/vanilla/vars.xml index 4f13a61fbb..907c6f1015 100644 --- a/conf/vanilla/vars.xml +++ b/conf/vanilla/vars.xml @@ -123,7 +123,7 @@ 127 - BV32 --> - + switch_rtp_udptl_mode\n"); switch_rtp_udptl_mode(tech_pvt->rtp_session); diff --git a/src/mod/endpoints/mod_khomp/include/applications.h b/src/mod/endpoints/mod_khomp/include/applications.h index 21b66b2b0a..14ba1d3323 100644 --- a/src/mod/endpoints/mod_khomp/include/applications.h +++ b/src/mod/endpoints/mod_khomp/include/applications.h @@ -599,7 +599,7 @@ struct Transfer return SWITCH_STATUS_FALSE; } - switch_core_session_t *peer_session = switch_core_session_locate(switch_channel_get_variable(chan,SWITCH_SIGNAL_BOND_VARIABLE)); + switch_core_session_t *peer_session = switch_core_session_locate(switch_channel_get_partner_uuid(chan)); if(!peer_session) { @@ -662,7 +662,7 @@ struct Transfer switch_channel_t * peer = switch_core_session_get_channel(peer_session); /* put the channel in hold */ - //switch_core_session_t *session = switch_core_session_locate(switch_channel_get_variable(chan,SWITCH_SIGNAL_BOND_VARIABLE)); + //switch_core_session_t *session = switch_core_session_locate(switch_channel_get_partner_uuid(chan)); //switch_channel_t *chan_core = switch_core_session_get_channel(session); const char *stream; @@ -709,7 +709,7 @@ struct Transfer switch_core_session_rwunlock(pvt->session()); switch_core_session_rwunlock(peer_session); - //switch_ivr_unhold_uuid(switch_channel_get_variable(chan,SWITCH_SIGNAL_BOND_VARIABLE)); + //switch_ivr_unhold_uuid(switch_channel_get_partner_uuid(chan)); } catch (ScopedLockFailed & err) { diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 200d6e5b71..e2a2c3daab 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -659,13 +659,13 @@ static switch_status_t find_non_loopback_bridge(switch_core_session_t *session, *br_session = NULL; *br_uuid = NULL; - a_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + a_uuid = switch_channel_get_partner_uuid(channel); while (a_uuid && (sp = switch_core_session_locate(a_uuid))) { if (switch_core_session_check_interface(sp, loopback_endpoint_interface)) { private_t *tech_pvt = switch_core_session_get_private(sp); - a_uuid = switch_channel_get_variable(tech_pvt->other_channel, SWITCH_SIGNAL_BOND_VARIABLE); + a_uuid = switch_channel_get_partner_uuid(tech_pvt->other_channel); switch_core_session_rwunlock(sp); sp = NULL; } else { @@ -919,7 +919,7 @@ static switch_status_t loopback_bowout_on_execute_state_handler(switch_core_sess /* Wait for b_channel to be fully bridged */ switch_channel_wait_for_flag(b_channel, CF_BRIDGED, SWITCH_TRUE, 5000, NULL); - uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE); + uuid = switch_channel_get_partner_uuid(b_channel); if (uuid && (other_session = switch_core_session_locate(uuid))) { switch_channel_t *other_channel = switch_core_session_get_channel(other_session); diff --git a/src/mod/endpoints/mod_rtmp/rtmp_sig.c b/src/mod/endpoints/mod_rtmp/rtmp_sig.c index 5f57eb04c7..a29465ecc0 100644 --- a/src/mod/endpoints/mod_rtmp/rtmp_sig.c +++ b/src/mod/endpoints/mod_rtmp/rtmp_sig.c @@ -539,7 +539,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_transfer) } if ((tech_pvt = rtmp_locate_private(rsession, uuid))) { - const char *other_uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *other_uuid = switch_channel_get_partner_uuid(tech_pvt->channel); switch_core_session_t *session; if (!zstr(other_uuid) && (session = switch_core_session_locate(other_uuid))) { @@ -570,8 +570,8 @@ RTMP_INVOKE_FUNCTION(rtmp_i_join) return SWITCH_STATUS_FALSE; } - if ((other_uuid[0] = switch_channel_get_variable(tech_pvt[0]->channel, SWITCH_SIGNAL_BOND_VARIABLE)) && - (other_uuid[1] = switch_channel_get_variable(tech_pvt[1]->channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + if ((other_uuid[0] = switch_channel_get_partner_uuid(tech_pvt[0]->channel)) && + (other_uuid[1] = switch_channel_get_partner_uuid(tech_pvt[1]->channel))) { #ifndef RTMP_DONT_HOLD if (switch_test_flag(tech_pvt[0], TFLAG_DETACHED)) { @@ -725,8 +725,8 @@ RTMP_INVOKE_FUNCTION(rtmp_i_three_way) return SWITCH_STATUS_FALSE; } - if (!(other_uuid[0] = switch_channel_get_variable(tech_pvt[0]->channel, SWITCH_SIGNAL_BOND_VARIABLE)) || - !(other_uuid[1] = switch_channel_get_variable(tech_pvt[1]->channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + if (!(other_uuid[0] = switch_channel_get_partner_uuid(tech_pvt[0]->channel)) || + !(other_uuid[1] = switch_channel_get_partner_uuid(tech_pvt[1]->channel))) { return SWITCH_STATUS_FALSE; /* Both calls aren't bridged */ } diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 8e47691c36..0957739455 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -784,12 +784,12 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener tech_pvt = switch_core_session_get_private(session); channel = switch_core_session_get_channel(session); - remote_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + remote_uuid = switch_channel_get_partner_uuid(channel); if (tech_pvt->transfer_from_call_id) { if((session2 = skinny_profile_find_session(listener->profile, listener, &line_instance, tech_pvt->transfer_from_call_id))) { switch_channel_t *channel2 = switch_core_session_get_channel(session2); - const char *remote_uuid2 = switch_channel_get_variable(channel2, SWITCH_SIGNAL_BOND_VARIABLE); + const char *remote_uuid2 = switch_channel_get_partner_uuid(channel2); if (switch_ivr_uuid_bridge(remote_uuid, remote_uuid2) == SWITCH_STATUS_SUCCESS) { switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); switch_channel_hangup(channel2, SWITCH_CAUSE_NORMAL_CLEARING); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 92a27fd0f2..2b44018665 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -172,7 +172,7 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session) const char *uuid = switch_core_session_get_uuid(session); if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { - const char *other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *other_uuid = switch_channel_get_partner_uuid(channel); int x = 0; if (other_uuid) { @@ -1824,7 +1824,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) + if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) { other_channel = switch_core_session_get_channel(other_session); ip = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE); @@ -2061,7 +2061,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi const char *uuid; const char *call_id = NULL, *to_user = NULL, *to_host = NULL, *to_tag = NULL, *from_tag = NULL, *from_user = NULL, *from_host = NULL; - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *rsession; if ((rsession = switch_core_session_locate(uuid))) { switch_channel_t *rchannel = switch_core_session_get_channel(rsession); @@ -2191,7 +2191,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) { - const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(channel); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "SEND"); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0621b3b84d..dc4fcfb0f0 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -618,7 +618,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, if (sofia_test_flag(tech_pvt, TFLAG_SLA_BARGE)) { switch_core_session_t *new_session, *other_session; - const char *other_uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *other_uuid = switch_channel_get_partner_uuid(tech_pvt->channel); char *cmd = NULL; if (!zstr(other_uuid) && (other_session = switch_core_session_locate(other_uuid))) { @@ -783,7 +783,7 @@ void sofia_send_callee_id(switch_core_session_t *session, const char *name, cons number = caller_profile->destination_number; } - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) { + if ((uuid = switch_channel_get_partner_uuid(channel)) && (session_b = switch_core_session_locate(uuid))) { switch_core_session_message_t *msg; //switch_channel_t *channel_b = switch_core_session_get_channel(session_b); @@ -906,7 +906,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro 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))) { + if (lazy || (att && !switch_channel_get_partner_uuid(channel))) { switch_channel_flip_cid(channel); } } @@ -914,7 +914,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro if (send) { if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) { - const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(channel); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV"); if (uuid) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid); @@ -5211,7 +5211,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status goto end; } - if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + if ((br = switch_channel_get_partner_uuid(channel))) { switch_xml_t root = NULL, domain = NULL; switch_core_session_t *a_session; switch_channel_t *a_channel; @@ -5370,7 +5370,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) { sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { + if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) { const char *r_sdp = NULL; switch_core_session_message_t *msg; private_object_t *other_tech_pvt = switch_core_session_get_private(other_session); @@ -5602,7 +5602,7 @@ void *SWITCH_THREAD_FUNC media_on_hold_thread_run(switch_thread_t *thread, void switch_channel_t *channel = switch_core_session_get_channel(session); private_object_t *tech_pvt = switch_core_session_get_private(session); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { + if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) { if (switch_core_session_compare(session, other_session)) { sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK); switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE); @@ -6057,7 +6057,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } if ((b_private = nua_handle_magic(bnh))) { - const char *br_b = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *br_b = switch_channel_get_partner_uuid(channel); char *br_a = b_private->uuid; @@ -6859,8 +6859,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t b_tech_pvt = (private_object_t *) switch_core_session_get_private(b_session); channel_b = switch_core_session_get_channel(b_session); - br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE); - br_b = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE); + br_a = switch_channel_get_partner_uuid(channel_a); + br_b = switch_channel_get_partner_uuid(channel_b); if (!switch_ivr_uuid_exists(br_a)) { br_a = NULL; @@ -7109,7 +7109,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } nua_handle_unref(bnh); } else { /* the other channel is on a different box, we have to go find them */ - if (exten && (br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE))) { + if (exten && (br_a = switch_channel_get_partner_uuid(channel_a))) { switch_core_session_t *a_session; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -7232,7 +7232,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t const char *br; switch_core_session_t *b_session; - if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(br))) { + if ((br = switch_channel_get_partner_uuid(channel)) && (b_session = switch_core_session_locate(br))) { const char *var; switch_channel_t *b_channel = switch_core_session_get_channel(b_session); @@ -7554,7 +7554,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t const char *uuid; switch_core_session_t *session_b; - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) { + if ((uuid = switch_channel_get_partner_uuid(channel)) && (session_b = switch_core_session_locate(uuid))) { while (switch_channel_has_dtmf(channel)) { switch_dtmf_t idtmf = { 0, 0 }; if (switch_channel_dequeue_dtmf(channel, &idtmf) == SWITCH_STATUS_SUCCESS) { @@ -8575,7 +8575,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ tech_pvt->caller_profile->dialplan = "inline"; - bridge_uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE); + bridge_uuid = switch_channel_get_partner_uuid(b_channel); if (call_info) { const char *olu; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 577c36668e..cb091daf8e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -688,7 +688,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch pass_fmtp = NULL; - if (switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) { + if (switch_channel_get_partner_uuid(tech_pvt->channel)) { if ((of = switch_channel_get_variable_partner(tech_pvt->channel, "sip_video_fmtp"))) { pass_fmtp = of; } @@ -4189,9 +4189,9 @@ int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly) if (!strcasecmp(stream, "indicate_hold")) { switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND); switch_channel_set_flag(tech_pvt->channel, CF_HOLD); - switch_ivr_hold_uuid(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), NULL, 0); + switch_ivr_hold_uuid(switch_channel_get_partner_uuid(tech_pvt->channel), NULL, 0); } else { - switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream, + switch_ivr_broadcast(switch_channel_get_partner_uuid(tech_pvt->channel), stream, SMF_ECHO_ALEG | SMF_LOOP | SMF_PRIORITY); switch_yield(250000); } @@ -4217,7 +4217,7 @@ int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly) switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets); } - if ((uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(uuid))) { + if ((uuid = switch_channel_get_partner_uuid(tech_pvt->channel)) && (b_session = switch_core_session_locate(uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); if (switch_channel_test_flag(tech_pvt->channel, CF_HOLD)) { @@ -5330,7 +5330,7 @@ void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp) switch_core_session_t *other_session; switch_channel_t *other_channel; - if ((val = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) + if ((val = switch_channel_get_partner_uuid(tech_pvt->channel)) && (other_session = switch_core_session_locate(val))) { other_channel = switch_core_session_get_channel(other_session); switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp); @@ -5904,7 +5904,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName } - if (switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) { + if (switch_channel_get_partner_uuid(channel)) { sofia_set_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE); } else { switch_xml_t callflow, param, x_extension; @@ -6826,7 +6826,7 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt) - if ((uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) + if ((uuid = switch_channel_get_partner_uuid(tech_pvt->channel)) && (other_session = switch_core_session_locate(uuid))) { other_channel = switch_core_session_get_channel(other_session); 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 9f3eaf1cb6..77a0438cca 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 @@ -213,7 +213,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 ((signal_bond = switch_channel_get_partner_uuid(channel)) && !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_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s\n", uuid_str); rc_destroy(rad_config); diff --git a/src/switch_channel.c b/src/switch_channel.c index dc983c78cd..138123f3eb 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -831,7 +831,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_ switch_assert(channel != NULL); if (!zstr(varname)) { - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { switch_channel_t *tchannel = switch_core_session_get_channel(session); @@ -896,7 +896,7 @@ SWITCH_DECLARE(void *) switch_channel_get_private_partner(switch_channel_t *chan switch_assert(channel != NULL); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { val = switch_core_hash_find_locked(channel->private_hash, key, channel->profile_mutex); @@ -1324,7 +1324,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner_var_check(sw switch_assert(channel != NULL); if (!zstr(varname)) { - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { switch_channel_t *tchannel = switch_core_session_get_channel(session); @@ -1357,7 +1357,7 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t * switch_assert(channel != NULL); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { switch_channel_set_flag(switch_core_session_get_channel(session), flag); @@ -1376,7 +1376,7 @@ SWITCH_DECLARE(uint32_t) switch_channel_test_flag_partner(switch_channel_t *chan switch_assert(channel != NULL); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { r = switch_channel_test_flag(switch_core_session_get_channel(session), flag); @@ -1393,7 +1393,7 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t switch_assert(channel != NULL); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { switch_channel_clear_flag(switch_core_session_get_channel(session), flag); @@ -1513,7 +1513,7 @@ SWITCH_DECLARE(uint32_t) switch_channel_test_cap_partner(switch_channel_t *chann switch_assert(channel != NULL); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(channel))) { switch_core_session_t *session; if ((session = switch_core_session_locate(uuid))) { r = switch_channel_test_cap(switch_core_session_get_channel(session), cap); @@ -2730,7 +2730,7 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel) if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) { - const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(channel); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV"); if (uuid) { @@ -4150,6 +4150,17 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * return status; } +SWITCH_DECLARE(const char *) switch_channel_get_partner_uuid(switch_channel_t *channel) +{ + const char *uuid = NULL; + + if (!(uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + uuid = switch_channel_get_variable(channel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE); + } + + return uuid; +} + /* For Emacs: * Local Variables: * mode:c diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 83f8ae6d26..0a3db343ed 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -288,7 +288,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (switch_test_flag(session, SSF_READ_TRANSCODE) && !need_codec && switch_core_codec_ready(session->read_codec)) { switch_core_session_t *other_session; - const char *uuid = switch_channel_get_variable(switch_core_session_get_channel(session), SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(switch_core_session_get_channel(session)); switch_clear_flag(session, SSF_READ_TRANSCODE); if (uuid && (other_session = switch_core_session_locate(uuid))) { @@ -866,7 +866,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (switch_test_flag(session, SSF_WRITE_TRANSCODE) && !need_codec && switch_core_codec_ready(session->write_codec)) { switch_core_session_t *other_session; - const char *uuid = switch_channel_get_variable(switch_core_session_get_channel(session), SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(switch_core_session_get_channel(session)); if (uuid && (other_session = switch_core_session_locate(uuid))) { switch_set_flag(other_session, SSF_READ_CODEC_RESET); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 4e43987ecf..2cdbeaa81b 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -184,7 +184,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_partner(switch_core_sess { const char *uuid; - if ((uuid = switch_channel_get_variable(session->channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(session->channel, "originate_signal_bond"))) { + if ((uuid = switch_channel_get_partner_uuid(session->channel))) { if ((*partner = switch_core_session_locate(uuid))) { return SWITCH_STATUS_SUCCESS; } @@ -544,7 +544,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VARIABLE, switch_core_session_get_uuid(session)); switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session)); // Needed by 3PCC proxy so that aleg can find bleg to pass SDP to, when final ACK arrives. - switch_channel_set_variable(channel, "originate_signal_bond", switch_core_session_get_uuid(*new_session)); + switch_channel_set_variable(channel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(*new_session)); if ((val = switch_channel_get_variable(channel, SWITCH_PROCESS_CDR_VARIABLE))) { switch_channel_set_variable(peer_channel, SWITCH_PROCESS_CDR_VARIABLE, val); @@ -797,7 +797,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_ switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status = SWITCH_STATUS_SUCCESS; - if (((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) && (other_session = switch_core_session_locate(uuid))) { + if (((uuid = switch_channel_get_partner_uuid(channel))) && (other_session = switch_core_session_locate(uuid))) { msg.message_id = indication; msg.from = __FILE__; status = switch_core_session_receive_message(other_session, &msg); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index e4fc807596..08d1fcd5a4 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -559,7 +559,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_set_flag(channel, CF_BROADCAST); } if (hold_bleg && switch_true(hold_bleg)) { - if ((b_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + if ((b_uuid = switch_channel_get_partner_uuid(channel))) { const char *stream; b_uuid = switch_core_session_strdup(session, b_uuid); @@ -1384,7 +1384,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, switch_core_session_receive_message(session, &msg); if (moh && (stream = switch_channel_get_hold_music(channel))) { - if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + if ((other_uuid = switch_channel_get_partner_uuid(channel))) { switch_ivr_broadcast(other_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP); } } @@ -1421,7 +1421,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session switch_core_session_receive_message(session, &msg); - if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(other_uuid))) { + if ((other_uuid = switch_channel_get_partner_uuid(channel)) && (b_session = switch_core_session_locate(other_uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); switch_channel_stop_broadcast(b_channel); switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 5000, NULL); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 5d6127d054..37da4f0486 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -4068,7 +4068,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha } } - if ((flags & SMF_ECHO_BLEG) && (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) + if ((flags & SMF_ECHO_BLEG) && (other_uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(other_uuid))) { if ((flags & SMF_EXEC_INLINE)) { switch_core_session_execute_application_get_flags(other_session, app, path, &app_flags); diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index d8b548b048..4af0dbb8ff 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1704,7 +1704,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, c const char *brto; if ((brto = switch_channel_get_variable(rchannel, "orignate_signal_bond")) || - (brto = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE))) { + (brto = switch_channel_get_partner_uuid(rchannel))) { switch_copy_string(b_uuid, brto, blen); status = SWITCH_STATUS_SUCCESS; } @@ -1738,7 +1738,7 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session channel = switch_core_session_get_channel(session); rchannel = switch_core_session_get_channel(rsession); - buuid = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE); + buuid = switch_channel_get_partner_uuid(rchannel); if ((var = switch_channel_get_variable(channel, "intercept_unbridged_only")) && switch_true(var)) { if ((switch_channel_test_flag(rchannel, CF_BRIDGED))) { diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 98fed62b34..c18da450a6 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3592,7 +3592,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(*bleg)); // Now main SWITCH_SIGNAL_BOND_VARIABLE is populated, don't need this one anymore... - switch_channel_set_variable(caller_channel, "originate_signal_bond", NULL); + switch_channel_set_variable(caller_channel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE, NULL); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index f435c87026..8738071cb4 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2570,7 +2570,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *sess channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); - if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + if ((other_uuid = switch_channel_get_partner_uuid(channel))) { if ((other_session = switch_core_session_locate(other_uuid))) { other_channel = switch_core_session_get_channel(other_session); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1c243e1b80..039cad9eb6 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3048,7 +3048,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); switch_channel_t *channel = switch_core_session_get_channel(session); - const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(channel); if (uuid) { switch_core_session_t *other_session; switch_rtp_t *other_rtp_session = NULL; @@ -3626,7 +3626,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); switch_channel_t *channel = switch_core_session_get_channel(session); - const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(channel); if (uuid) { switch_core_session_t *other_session; @@ -4257,7 +4257,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); switch_channel_t *channel = switch_core_session_get_channel(session); - const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + const char *uuid = switch_channel_get_partner_uuid(channel); if (uuid) { switch_core_session_t *other_session; From 76c3580e83e70ebe592169b3d8e9cb2847f62951 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 29 May 2012 22:13:46 +0000 Subject: [PATCH 0433/1057] fix build test for revision number The test was backward. If the revision is in switch_version.h.in then we have the version already. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 31d22f7754..12dc3fa05a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -418,7 +418,7 @@ $(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool src/include/switch_version.h: src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS) @have_version=1 ; \ force=0 ; \ - grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null && have_version=0 ; \ + grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null || have_version=0 ; \ test ! -f src/include/switch_version.h || grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \ if test $$have_version = 1 ; then \ cat src/include/switch_version.h.in > src/include/switch_version.h ; \ From 82b00ecbc8bfb9e9e389b7a2bf8fe43a2e390520 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 30 May 2012 15:10:00 +0000 Subject: [PATCH 0434/1057] don't build mod_ilbc or mod_siren by default Our default build probably shouldn't include non-free software. With mod_ilbc, the licensing situation is merely ambiguous. With mod_siren, the user can't use this code without getting explicit permission from Polycom (though it is apparently easily given). --- build/modules.conf.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/modules.conf.in b/build/modules.conf.in index 534c1f0ec2..fdb631927a 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -58,12 +58,12 @@ codecs/mod_bv codecs/mod_g723_1 codecs/mod_g729 codecs/mod_h26x -codecs/mod_ilbc +#codecs/mod_ilbc #codecs/mod_isac #codecs/mod_opus #codecs/mod_sangoma_codec #codecs/mod_silk -codecs/mod_siren +#codecs/mod_siren codecs/mod_speex dialplans/mod_dialplan_asterisk #dialplans/mod_dialplan_directory From 192030c57898bce8b3df805ea1b21ad436c015b9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 May 2012 13:05:05 -0500 Subject: [PATCH 0435/1057] add metadata col to internal registrations table --- src/include/switch_core.h | 4 +- src/mod/endpoints/mod_skinny/skinny_server.c | 3 +- src/mod/endpoints/mod_sofia/sofia_reg.c | 7 ++- src/switch_core_sqldb.c | 50 ++++++++++++++------ 4 files changed, 46 insertions(+), 18 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 9803c6708b..05d6e0aa48 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2300,10 +2300,12 @@ SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number) \param [in] network_ip \param [in] network_port \param [in] network_proto - one of tls, tcp, udp + \param [in] metadata - generic metadata supplied by module \param [out] err - Error if it exists */ 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); + const char *network_ip, const char *network_port, const char *network_proto, + const char *metadata); /*! \brief Delete user registration \param [in] user diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 0957739455..95f7e6c83e 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1007,6 +1007,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r const char *value = switch_xml_attr_soft(xbutton, "value"); if(type == SKINNY_BUTTON_LINE) { const char *caller_name = switch_xml_attr_soft(xbutton, "caller-name"); + const char *reg_metadata = switch_xml_attr_soft(xbutton, "registration-metadata"); uint32_t ring_on_idle = atoi(switch_xml_attr_soft(xbutton, "ring-on-idle")); uint32_t ring_on_active = atoi(switch_xml_attr_soft(xbutton, "ring-on-active")); uint32_t busy_trigger = atoi(switch_xml_attr_soft(xbutton, "busy-trigger")); @@ -1030,7 +1031,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r switch_safe_free(sql); token = switch_mprintf("skinny/%q/%q/%q:%d", profile->name, value, request->data.reg.device_name, request->data.reg.instance); url = switch_mprintf("skinny/%q/%q", profile->name, value); - switch_core_add_registration(value, profile->domain, token, url, 0, network_ip, network_port_c, "tcp"); + switch_core_add_registration(value, profile->domain, token, url, 0, network_ip, network_port_c, "tcp", reg_metadata); switch_safe_free(token); switch_safe_free(url); } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index e358c8f228..7ec9f1f93a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1028,6 +1028,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sip_contact_t const *contact = NULL; char *sql; switch_event_t *s_event; + const char *reg_meta = NULL; const char *to_user = NULL; const char *to_host = NULL; char *mwi_account = NULL; @@ -1485,6 +1486,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand to_user = var; } + if (v_event && *v_event && (var = switch_event_get_header(*v_event, "registration_metadata"))) { + reg_meta = var; + } + if (v_event && *v_event && (mwi_account = switch_event_get_header(*v_event, "mwi-account"))) { dup_mwi_account = strdup(mwi_account); switch_assert(dup_mwi_account != NULL); @@ -1559,7 +1564,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand url = switch_mprintf("sofia/%q/sip:%q", profile->name, sofia_glue_strip_proto(contact)); switch_core_add_registration(to_user, reg_host, call_id, url, (long) switch_epoch_time_now(NULL) + (long) exptime + 60, - network_ip, network_port_c, is_tls ? "tls" : is_tcp ? "tcp" : "udp"); + network_ip, network_port_c, is_tls ? "tls" : is_tcp ? "tcp" : "udp", reg_meta); switch_safe_free(url); switch_safe_free(contact); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 85d38160ed..9b40674065 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1713,7 +1713,8 @@ static char create_registrations_sql[] = " network_ip VARCHAR(256),\n" " network_port VARCHAR(256),\n" " network_proto VARCHAR(256),\n" - " hostname VARCHAR(256)\n" + " hostname VARCHAR(256),\n" + " metadata VARCHAR(256)\n" ");\n"; @@ -1843,7 +1844,8 @@ static char basic_calls_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) + const char *network_ip, const char *network_port, const char *network_proto, + const char *metadata) { char *sql; @@ -1860,19 +1862,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c } 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), - switch_str_nil(realm), - switch_str_nil(token), - switch_str_nil(url), - expires, - switch_str_nil(network_ip), - switch_str_nil(network_port), - switch_str_nil(network_proto), - switch_core_get_switchname() - ); + + if ( !zstr(metadata) ) { + sql = switch_mprintf("insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname,metadata) " + "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%q')", + switch_str_nil(user), + switch_str_nil(realm), + switch_str_nil(token), + switch_str_nil(url), + expires, + switch_str_nil(network_ip), + switch_str_nil(network_port), + switch_str_nil(network_proto), + switch_core_get_switchname(), + metadata + ); + } else { + 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), + switch_str_nil(realm), + switch_str_nil(token), + switch_str_nil(url), + expires, + switch_str_nil(network_ip), + switch_str_nil(network_port), + switch_str_nil(network_proto), + switch_core_get_switchname() + ); + } switch_queue_push(sql_manager.sql_queue[0], sql); @@ -2007,6 +2025,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_cache_db_test_reactive(dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", "DROP TABLE registrations", create_registrations_sql); + switch_cache_db_test_reactive(dbh, "select metadata from registrations", NULL, "ALTER TABLE registrations ADD COLUMN metadata VARCHAR(256)"); + switch (dbh->type) { case SCDB_TYPE_ODBC: From 3e1d68b0a6900b582154bbb72a8149ea1a357c9b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 May 2012 13:08:31 -0500 Subject: [PATCH 0436/1057] FS-4250 --resolve erase replaces header after using it --- src/mod/endpoints/mod_sofia/sofia_glue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index cb091daf8e..2cb2fdd551 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2087,7 +2087,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } - rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER); + if ((rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER))) { + switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, NULL); + } switch_assert(tech_pvt != NULL); From 39bad5b13ef8a85608a6783a9ebdaed3713da04d Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 30 May 2012 15:58:48 -0500 Subject: [PATCH 0437/1057] vs2010 reswig for last commit --- .../mod_managed/freeswitch_wrap.2010.cxx | 28 +++++++++++++++++-- .../mod_managed/managed/swig.2010.cs | 18 ++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 65b4eedf3c..a11d584f49 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1550,6 +1550,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SIGNAL_BOND_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("originate_signal_bond"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -11108,7 +11118,7 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, u } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_add_registration(char * jarg1, char * jarg2, char * jarg3, char * jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_add_registration(char * jarg1, char * jarg2, char * jarg3, char * jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9) { int jresult ; char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; @@ -11118,6 +11128,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_add_registration(char * jarg1, cha char *arg6 = (char *) 0 ; char *arg7 = (char *) 0 ; char *arg8 = (char *) 0 ; + char *arg9 = (char *) 0 ; switch_status_t result; arg1 = (char *)jarg1; @@ -11128,7 +11139,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_add_registration(char * jarg1, cha arg6 = (char *)jarg6; arg7 = (char *)jarg7; arg8 = (char *)jarg8; - result = (switch_status_t)switch_core_add_registration((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8); + arg9 = (char *)jarg9; + result = (switch_status_t)switch_core_add_registration((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9); jresult = result; return jresult; } @@ -25772,6 +25784,18 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_transfer_to_extension(void * j } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_partner_uuid(void * jarg1) { + char * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + result = (char *)switch_channel_get_partner_uuid(arg1); + jresult = SWIG_csharp_string_callback((const char *)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 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 0654085a50..3a1cc13d6b 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2671,8 +2671,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_core_add_registration(string user, string realm, string token, string url, uint expires, string network_ip, string network_port, string network_proto) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_add_registration(user, realm, token, url, expires, network_ip, network_port, network_proto); + public static switch_status_t switch_core_add_registration(string user, string realm, string token, string url, uint expires, string network_ip, string network_port, string network_proto, string metadata) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_add_registration(user, realm, token, url, expires, network_ip, network_port, network_proto, metadata); return ret; } @@ -4118,6 +4118,11 @@ public class freeswitch { freeswitchPINVOKE.switch_channel_transfer_to_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension)); } + public static string switch_channel_get_partner_uuid(SWIGTYPE_p_switch_channel channel) { + string ret = freeswitchPINVOKE.switch_channel_get_partner_uuid(SWIGTYPE_p_switch_channel.getCPtr(channel)); + 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(); @@ -6130,6 +6135,7 @@ public class freeswitch { public static readonly string SWITCH_LAST_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_LAST_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_SIGNAL_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_SIGNAL_BOND_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BOND_VARIABLE_get(); + public static readonly string SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE_get(); public static readonly string SWITCH_ORIGINATOR_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VARIABLE_get(); public static readonly string SWITCH_ORIGINATOR_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_CODEC_VARIABLE_get(); public static readonly string SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get(); @@ -6780,6 +6786,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SIGNAL_BOND_VARIABLE_get")] public static extern string SWITCH_SIGNAL_BOND_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE_get")] + public static extern string SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_VARIABLE_get")] public static extern string SWITCH_ORIGINATOR_VARIABLE_get(); @@ -9094,7 +9103,7 @@ class freeswitchPINVOKE { public static extern uint switch_default_ptime(string jarg1, uint jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_add_registration")] - public static extern int switch_core_add_registration(string jarg1, string jarg2, string jarg3, string jarg4, uint jarg5, string jarg6, string jarg7, string jarg8); + public static extern int switch_core_add_registration(string jarg1, string jarg2, string jarg3, string jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_del_registration")] public static extern int switch_core_del_registration(string jarg1, string jarg2, string jarg3); @@ -12705,6 +12714,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_transfer_to_extension")] public static extern void switch_channel_transfer_to_extension(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_partner_uuid")] + public static extern string switch_channel_get_partner_uuid(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")] public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); From 07bc7ba7639726985daa571ea20490c7d3dc75ce Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 31 May 2012 07:40:59 +0200 Subject: [PATCH 0438/1057] gsmopen and skypopen: updated License headers --- src/mod/endpoints/mod_gsmopen/gsmopen.h | 12 +++---- .../mod_gsmopen/gsmopen_protocol.cpp | 36 +++++++++++++++++++ src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 11 +++--- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 12 +++---- src/mod/endpoints/mod_skypopen/skypopen.h | 11 +++--- .../mod_skypopen/skypopen_protocol.c | 34 ++++++++++++++++++ 6 files changed, 89 insertions(+), 27 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index 2b4c619783..fd56fd4963 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2012, Anthony Minessale II + * Copyright (C) 2005-2011, Anthony Minessale II * * Version: MPL 1.1 * @@ -23,17 +23,15 @@ * * This module (mod_gsmopen) has been contributed by: * - * Giovanni Maruzzelli (gmaruzz@gmail.com) + * Giovanni Maruzzelli * + * Maintainer: Giovanni Maruzzelli * - * Further Contributors: - * - * - * - * mod_gsmopen.c -- GSM compatible Endpoint Module + * mod_gsmopen.cpp -- GSM Modem compatible Endpoint Module * */ + #define __STDC_LIMIT_MACROS #ifdef WIN32 diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 391dade93a..ffa4e3d014 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1,3 +1,39 @@ +/* + * 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. + * + * This module (mod_gsmopen) has been contributed by: + * + * Giovanni Maruzzelli + * + * Maintainer: Giovanni Maruzzelli + * + * gsmopen_protocol.cpp -- Low Level Interface for mod_gamopen + * + */ + + + + #include "gsmopen.h" #ifdef WIN32 #include "win_iconv.c" diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index f48d299e0a..837d20ed30 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2012, Anthony Minessale II + * Copyright (C) 2005-2011, Anthony Minessale II * * Version: MPL 1.1 * @@ -23,14 +23,11 @@ * * This module (mod_gsmopen) has been contributed by: * - * Giovanni Maruzzelli (gmaruzz@gmail.com) + * Giovanni Maruzzelli * + * Maintainer: Giovanni Maruzzelli * - * Further Contributors: - * - * - * - * mod_gsmopen.c -- GSM compatible Endpoint Module + * mod_gsmopen.cpp -- GSM Modem compatible Endpoint Module * */ diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 25539fa81e..ce89211b83 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2012, Anthony Minessale II + * Copyright (C) 2005-2011, Anthony Minessale II * * Version: MPL 1.1 * @@ -21,19 +21,17 @@ * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * - * This module (mod_skypopen) has been contributed by: - * - * Giovanni Maruzzelli (gmaruzz@gmail.com) - * - * - * Further Contributors: + * This module (mod_gsmopen) has been contributed by: * + * Giovanni Maruzzelli * + * Maintainer: Giovanni Maruzzelli * * mod_skypopen.c -- Skype compatible Endpoint Module * */ + #include "skypopen.h" #define SKYPE_CHAT_PROTO "skype" diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index d2dd51bd37..864a22c3e4 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2012, Anthony Minessale II + * Copyright (C) 2005-2011, Anthony Minessale II * * Version: MPL 1.1 * @@ -21,18 +21,17 @@ * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * - * This module (mod_skypopen) has been contributed by: + * This module (mod_gsmopen) has been contributed by: * - * Giovanni Maruzzelli (gmaruzz@gmail.com) - * - * - * Further Contributors: + * Giovanni Maruzzelli * + * Maintainer: Giovanni Maruzzelli * * mod_skypopen.c -- Skype compatible Endpoint Module * */ + #include #include diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 5aa113c3bf..2126955452 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -1,3 +1,37 @@ +/* + * 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. + * + * This module (mod_gsmopen) has been contributed by: + * + * Giovanni Maruzzelli + * + * Maintainer: Giovanni Maruzzelli + * + * skypopen_protocol.c -- Low Level Interface for mod_skypopen + * + */ + + #include "skypopen.h" #ifdef ASTERISK From be2ec2928214718978551b1419759e6fa13709da Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Thu, 31 May 2012 13:24:24 +0000 Subject: [PATCH 0439/1057] Add Maintainer to mod_posix_timer, mod_unimrcp, mod_http_cache --- src/mod/applications/mod_http_cache/mod_http_cache.c | 4 +++- src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 2 ++ src/mod/timers/mod_posix_timer/mod_posix_timer.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 1e40ce2e15..fb2b4e09a2 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -23,7 +23,9 @@ * * Contributor(s): * - * Chris Rienzo + * Christopher M. Rienzo + * + * Maintainer: Christopher M. Rienzo * * mod_http_cache.c -- HTTP GET with caching * -- designed for downloading audio files from a webserver for playback diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 80fa3f2001..e53964277c 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -28,6 +28,8 @@ * Christopher M. Rienzo * Luke Dashjr (OpenMethods, LLC) * + * Maintainer: Christopher M. Rienzo + * * mod_unimrcp.c -- UniMRCP module (MRCP client) * */ diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index 04d694b5f7..cfb6584701 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -22,9 +22,11 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Chris Rienzo + * Christopher M. Rienzo * Timo Teräs (based on mod_timerfd.c) * + * Maintainer: Christopher M. Rienzo + * * mod_posix_timer.c -- soft timer implemented with POSIX timers (timer_create/timer_settime/timer_getoverrun) * */ From 5be9857af249705b96c1235d778b317cc0b99afa Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 31 May 2012 10:25:49 -0500 Subject: [PATCH 0440/1057] remove mod_fax. this has been deprecated for quite a while --- src/mod/applications/mod_fax/Makefile.am | 24 - .../applications/mod_fax/mod_fax.2008.vcproj | 299 --- src/mod/applications/mod_fax/mod_fax.c | 1945 ----------------- src/mod/applications/mod_fax/udptl.c | 563 ----- src/mod/applications/mod_fax/udptl.h | 153 -- 5 files changed, 2984 deletions(-) delete mode 100644 src/mod/applications/mod_fax/Makefile.am delete mode 100644 src/mod/applications/mod_fax/mod_fax.2008.vcproj delete mode 100644 src/mod/applications/mod_fax/mod_fax.c delete mode 100644 src/mod/applications/mod_fax/udptl.c delete mode 100644 src/mod/applications/mod_fax/udptl.h diff --git a/src/mod/applications/mod_fax/Makefile.am b/src/mod/applications/mod_fax/Makefile.am deleted file mode 100644 index c71c5b9da5..0000000000 --- a/src/mod/applications/mod_fax/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -include $(top_srcdir)/build/modmake.rulesam -MODNAME=mod_fax - -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_fax.la -mod_fax_la_SOURCES = mod_fax.c udptl.c -mod_fax_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -mod_fax_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA) -mod_fax_la_LDFLAGS = -avoid-version -module -no-undefined -shared -ljpeg - -$(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) diff --git a/src/mod/applications/mod_fax/mod_fax.2008.vcproj b/src/mod/applications/mod_fax/mod_fax.2008.vcproj deleted file mode 100644 index dd10ca8a93..0000000000 --- a/src/mod/applications/mod_fax/mod_fax.2008.vcproj +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/applications/mod_fax/mod_fax.c b/src/mod/applications/mod_fax/mod_fax.c deleted file mode 100644 index 7eac2520b3..0000000000 --- a/src/mod/applications/mod_fax/mod_fax.c +++ /dev/null @@ -1,1945 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2012, 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 mod_fax. - * - * The Initial Developer of the Original Code is - * Massimo Cetra - * - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Brian West - * Anthony Minessale II - * Steve Underwood - * Antonio Gallo - * mod_fax.c -- Fax applications provided by SpanDSP - * - */ - -#include -#ifdef WIN32 -#define FAX_INVALID_SOCKET INVALID_HANDLE_VALUE -typedef HANDLE zap_socket_t; -#else -#define FAX_INVALID_SOCKET -1 -typedef int zap_socket_t; -#endif - -#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES -#include -#include - -#include "udptl.h" - -#define LOCAL_FAX_MAX_DATAGRAM 400 -#define MAX_FEC_ENTRIES 4 -#define MAX_FEC_SPAN 4 - -/***************************************************************************** - OUR DEFINES AND STRUCTS -*****************************************************************************/ - -typedef enum { - FUNCTION_TX, - FUNCTION_RX, - FUNCTION_GW -} application_mode_t; - -typedef enum { - T38_MODE, - AUDIO_MODE, - T38_GATEWAY_MODE -} transport_mode_t; - -typedef enum { - T38_MODE_UNKNOWN = 0, - T38_MODE_NEGOTIATED = 1, - T38_MODE_REQUESTED = 2, - T38_MODE_REFUSED = -1, -} t38_mode_t; - -/* The global stuff */ -static struct { - switch_memory_pool_t *pool; - switch_mutex_t *mutex; - - uint32_t total_sessions; - - short int use_ecm; - short int verbose; - short int disable_v17; - short int enable_t38; - short int enable_t38_request; - short int enable_t38_insist; - char ident[20]; - char header[50]; - char *prepend_string; - char *spool; -} globals; - -struct pvt_s { - switch_core_session_t *session; - - application_mode_t app_mode; - - fax_state_t *fax_state; - t38_terminal_state_t *t38_state; - t38_gateway_state_t *t38_gateway_state; - t38_core_state_t *t38_core; - - udptl_state_t *udptl_state; - - char *filename; - char *ident; - char *header; - - int use_ecm; - int disable_v17; - int verbose; - int caller; - - int tx_page_start; - int tx_page_end; - - int done; - - t38_mode_t t38_mode; - - struct pvt_s *next; -}; - -typedef struct pvt_s pvt_t; - -static void launch_timer_thread(void); - -static struct { - pvt_t *head; - switch_mutex_t *mutex; - switch_thread_t *thread; - int thread_running; -} t38_state_list; - -static int add_pvt(pvt_t *pvt) -{ - int r = 0; - uint32_t sanity = 50; - - switch_mutex_lock(t38_state_list.mutex); - if (!t38_state_list.thread_running) { - - launch_timer_thread(); - - while(--sanity && !t38_state_list.thread_running) { - switch_yield(10000); - } - } - switch_mutex_unlock(t38_state_list.mutex); - - if (t38_state_list.thread_running) { - switch_mutex_lock(t38_state_list.mutex); - pvt->next = t38_state_list.head; - t38_state_list.head = pvt; - switch_mutex_unlock(t38_state_list.mutex); - } - - return r; - -} - - -static int del_pvt(pvt_t *del_pvt) -{ - pvt_t *p, *l = NULL; - int r = 0; - - if (!t38_state_list.thread_running) goto end; - - switch_mutex_lock(t38_state_list.mutex); - for (p = t38_state_list.head; p; p = p->next) { - if (p == del_pvt) { - if (l) { - l->next = p->next; - } else { - t38_state_list.head = p->next; - } - p->next = NULL; - r = 1; - goto end; - } - - l = p; - } - - end: - - switch_mutex_unlock(t38_state_list.mutex); - - return r; - -} - -static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void *obj) -{ - switch_timer_t timer = { 0 }; - pvt_t *pvt; - int samples = 240; - int ms = 30; - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "timer thread started.\n"); - - if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { - return NULL; - } - - t38_state_list.thread_running = 1; - - while(t38_state_list.thread_running) { - - switch_mutex_lock(t38_state_list.mutex); - - if (!t38_state_list.head) { - switch_mutex_unlock(t38_state_list.mutex); - goto end; - } - - for (pvt = t38_state_list.head; pvt; pvt = pvt->next) { - if (pvt->udptl_state) { - t38_terminal_send_timeout(pvt->t38_state, samples); - } - } - - switch_mutex_unlock(t38_state_list.mutex); - - switch_core_timer_next(&timer); - } - - end: - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "timer thread ended.\n"); - - t38_state_list.thread_running = 0; - switch_core_timer_destroy(&timer); - - return NULL; -} - -static void launch_timer_thread(void) -{ - - switch_threadattr_t *thd_attr = NULL; - - switch_threadattr_create(&thd_attr, globals.pool); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&t38_state_list.thread, thd_attr, timer_thread_run, NULL, globals.pool); -} - - -/***************************************************************************** - LOGGING AND HELPER FUNCTIONS -*****************************************************************************/ - -static void counter_increment(void) -{ - switch_mutex_lock(globals.mutex); - globals.total_sessions++; - switch_mutex_unlock(globals.mutex); -} - -static void spanfax_log_message(int level, const char *msg) -{ - int fs_log_level; - - switch (level) { - case SPAN_LOG_NONE: - return; - case SPAN_LOG_ERROR: - case SPAN_LOG_PROTOCOL_ERROR: - fs_log_level = SWITCH_LOG_ERROR; - break; - case SPAN_LOG_WARNING: - case SPAN_LOG_PROTOCOL_WARNING: - fs_log_level = SWITCH_LOG_WARNING; - break; - case SPAN_LOG_FLOW: - case SPAN_LOG_FLOW_2: - case SPAN_LOG_FLOW_3: - default: /* SPAN_LOG_DEBUG, SPAN_LOG_DEBUG_2, SPAN_LOG_DEBUG_3 */ - fs_log_level = SWITCH_LOG_DEBUG; - break; - } - - if (!zstr(msg)) { - switch_log_printf(SWITCH_CHANNEL_LOG, fs_log_level, "%s", msg); - } -} - -/* - * Called at the end of the document - */ -static void phase_e_handler(t30_state_t *s, void *user_data, int result) -{ - t30_stats_t t; - const char *local_ident; - const char *far_ident; - switch_core_session_t *session; - switch_channel_t *channel; - pvt_t *pvt; - char *tmp; - - pvt = (pvt_t *) user_data; - switch_assert(pvt); - - session = pvt->session; - switch_assert(session); - - channel = switch_core_session_get_channel(session); - switch_assert(channel); - - t30_get_transfer_statistics(s, &t); - local_ident = switch_str_nil(t30_get_tx_ident(s)); - far_ident = switch_str_nil(t30_get_rx_ident(s)); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "==============================================================================\n"); - - if (result == T30_ERR_OK) { - if (pvt->app_mode == FUNCTION_TX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax successfully sent.\n"); - } else if (pvt->app_mode == FUNCTION_RX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax successfully received.\n"); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax successfully managed. How ?\n"); - } - switch_channel_set_variable(channel, "fax_success", "1"); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax processing not successful - result (%d) %s.\n", result, - t30_completion_code_to_str(result)); - switch_channel_set_variable(channel, "fax_success", "0"); - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote station id: %s\n", far_ident); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local station id: %s\n", local_ident); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Pages transferred: %i\n", - pvt->app_mode == FUNCTION_TX ? t.pages_tx : t.pages_rx); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Total fax pages: %i\n", t.pages_in_file); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image resolution: %ix%i\n", t.x_resolution, t.y_resolution); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer Rate: %i\n", t.bit_rate); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ECM status %s\n", (t.error_correcting_mode) ? "on" : "off"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote country: %s\n", switch_str_nil(t30_get_rx_country(s))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(s))); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(s))); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n"); - - /* - Set our channel variables - */ - - tmp = switch_mprintf("%i", result); - if (tmp) { - switch_channel_set_variable(channel, "fax_result_code", tmp); - switch_safe_free(tmp); - } - - switch_channel_set_variable(channel, "fax_result_text", t30_completion_code_to_str(result)); - - switch_channel_set_variable(channel, "fax_ecm_used", (t.error_correcting_mode) ? "on" : "off"); - switch_channel_set_variable(channel, "fax_local_station_id", local_ident); - switch_channel_set_variable(channel, "fax_remote_station_id", far_ident); - - tmp = switch_mprintf("%i", pvt->app_mode == FUNCTION_TX ? t.pages_tx : t.pages_rx); - if (tmp) { - switch_channel_set_variable(channel, "fax_document_transferred_pages", tmp); - switch_safe_free(tmp); - } - - tmp = switch_mprintf("%i", t.pages_in_file); - if (tmp) { - switch_channel_set_variable(channel, "fax_document_total_pages", tmp); - switch_safe_free(tmp); - } - - tmp = switch_mprintf("%ix%i", t.x_resolution, t.y_resolution); - if (tmp) { - switch_channel_set_variable(channel, "fax_image_resolution", tmp); - switch_safe_free(tmp); - } - - tmp = switch_mprintf("%d", t.image_size); - if (tmp) { - switch_channel_set_variable(channel, "fax_image_size", tmp); - switch_safe_free(tmp); - } - - tmp = switch_mprintf("%d", t.bad_rows); - if (tmp) { - switch_channel_set_variable(channel, "fax_bad_rows", tmp); - switch_safe_free(tmp); - } - - tmp = switch_mprintf("%i", t.bit_rate); - if (tmp) { - switch_channel_set_variable(channel, "fax_transfer_rate", tmp); - switch_safe_free(tmp); - } - - /* switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); */ - - pvt->done = 1; - - /* - TODO Fire events - */ -} - -static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) -{ - 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; - int r = 0; - - 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; - 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); - - 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; - } - } - - return r; -} - -static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) -{ - - switch_core_session_t *session; - switch_channel_t *channel; - fax_state_t *fax; - t38_terminal_state_t *t38; - t30_state_t *t30; - - - session = (switch_core_session_t *) pvt->session; - switch_assert(session); - - channel = switch_core_session_get_channel(session); - switch_assert(channel); - - - switch (trans_mode) { - case AUDIO_MODE: - if (pvt->fax_state == NULL) { - pvt->fax_state = (fax_state_t *) switch_core_session_alloc(pvt->session, sizeof(fax_state_t)); - } - if (pvt->fax_state == NULL) { - return SWITCH_STATUS_FALSE; - } - - fax = pvt->fax_state; - t30 = fax_get_t30_state(fax); - - memset(fax, 0, sizeof(fax_state_t)); - if (fax_init(fax, pvt->caller) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my fax structs\n"); - return SWITCH_STATUS_FALSE; - } - - fax_set_transmit_on_idle(fax, TRUE); - - span_log_set_message_handler(&fax->logging, spanfax_log_message); - span_log_set_message_handler(&t30->logging, spanfax_log_message); - - if (pvt->verbose) { - span_log_set_level(&fax->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - } - break; - case T38_MODE: - if (pvt->t38_state == NULL) { - pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); - } - if (pvt->t38_state == NULL) { - return SWITCH_STATUS_FALSE; - } - if (pvt->udptl_state == NULL) { - pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); - } - if (pvt->udptl_state == NULL) { - t38_terminal_free(pvt->t38_state); - pvt->t38_state = NULL; - return SWITCH_STATUS_FALSE; - } - - /* add to timer thread processing */ - add_pvt(pvt); - - t38 = pvt->t38_state; - t30 = t38_terminal_get_t30_state(t38); - - memset(t38, 0, sizeof(t38_terminal_state_t)); - - if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); - return SWITCH_STATUS_FALSE; - } - - pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); - - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, - (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); - return SWITCH_STATUS_FALSE; - } - - span_log_set_message_handler(&t38->logging, spanfax_log_message); - span_log_set_message_handler(&t30->logging, spanfax_log_message); - - if (pvt->verbose) { - span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - } - break; - case T38_GATEWAY_MODE: - if (pvt->t38_gateway_state == NULL) { - pvt->t38_gateway_state = (t38_gateway_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_gateway_state_t)); - } - - if (pvt->udptl_state == NULL) { - pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); - } - - if (t38_gateway_init(pvt->t38_gateway_state, t38_tx_packet_handler, pvt) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); - t38_gateway_free(pvt->t38_gateway_state); - pvt->t38_gateway_state = NULL; - - return SWITCH_STATUS_FALSE; - } - - pvt->t38_core = t38_gateway_get_t38_core_state(pvt->t38_gateway_state); - - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, - (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); - t38_gateway_free(pvt->t38_gateway_state); - udptl_release(pvt->udptl_state); - pvt->udptl_state = NULL; - return SWITCH_STATUS_FALSE; - } - - t38_gateway_set_transmit_on_idle(pvt->t38_gateway_state, TRUE); - - if (switch_true(switch_channel_get_variable(channel, "fax_v17_disabled"))) { - t38_gateway_set_supported_modems(pvt->t38_gateway_state, T30_SUPPORT_V29 | T30_SUPPORT_V27TER); - } else { - t38_gateway_set_supported_modems(pvt->t38_gateway_state, T30_SUPPORT_V17 | T30_SUPPORT_V29 | T30_SUPPORT_V27TER); - } - - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, pvt->use_ecm); - switch_channel_set_variable(channel, "fax_ecm_requested", pvt->use_ecm ? "true" : "false"); - - if (switch_true(switch_channel_get_variable(channel, "FAX_DISABLE_ECM"))) { - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, FALSE); - } else { - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, TRUE); - } - - - span_log_set_message_handler(&pvt->t38_gateway_state->logging, spanfax_log_message); - span_log_set_message_handler(&pvt->t38_core->logging, spanfax_log_message); - - if (pvt->verbose) { - span_log_set_level(&pvt->t38_gateway_state->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_level(&pvt->t38_core->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - } - - t38_set_t38_version(pvt->t38_core, 0); - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, 1); - - return SWITCH_STATUS_SUCCESS; - - default: - assert(0); /* What? */ - return SWITCH_STATUS_SUCCESS; - } /* Switch trans mode */ - - /* All the things which are common to audio and T.38 FAX setup */ - t30_set_tx_ident(t30, pvt->ident); - t30_set_tx_page_header_info(t30, pvt->header); - - t30_set_phase_e_handler(t30, phase_e_handler, pvt); - - t30_set_supported_image_sizes(t30, - T30_SUPPORT_US_LETTER_LENGTH | T30_SUPPORT_US_LEGAL_LENGTH | T30_SUPPORT_UNLIMITED_LENGTH - | T30_SUPPORT_215MM_WIDTH | T30_SUPPORT_255MM_WIDTH | T30_SUPPORT_303MM_WIDTH); - t30_set_supported_resolutions(t30, - T30_SUPPORT_STANDARD_RESOLUTION | T30_SUPPORT_FINE_RESOLUTION | T30_SUPPORT_SUPERFINE_RESOLUTION - | T30_SUPPORT_R8_RESOLUTION | T30_SUPPORT_R16_RESOLUTION); - - if (pvt->disable_v17) { - t30_set_supported_modems(t30, T30_SUPPORT_V29 | T30_SUPPORT_V27TER); - switch_channel_set_variable(channel, "fax_v17_disabled", "1"); - } else { - t30_set_supported_modems(t30, T30_SUPPORT_V29 | T30_SUPPORT_V27TER | T30_SUPPORT_V17); - switch_channel_set_variable(channel, "fax_v17_disabled", "0"); - } - - if (pvt->use_ecm) { - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); - t30_set_ecm_capability(t30, TRUE); - switch_channel_set_variable(channel, "fax_ecm_requested", "1"); - } else { - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION); - switch_channel_set_variable(channel, "fax_ecm_requested", "0"); - } - - if (pvt->app_mode == FUNCTION_TX) { - t30_set_tx_file(t30, pvt->filename, pvt->tx_page_start, pvt->tx_page_end); - } else { - t30_set_rx_file(t30, pvt->filename, -1); - } - switch_channel_set_variable(channel, "fax_filename", pvt->filename); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t spanfax_destroy(pvt_t *pvt) -{ - int terminate; - t30_state_t *t30; - - if (!pvt) return SWITCH_STATUS_FALSE; - - if (pvt->fax_state) { - if (pvt->t38_state) { - terminate = 0; - } else { - terminate = 1; - } - - t30 = fax_get_t30_state(pvt->fax_state); - if (terminate && t30) { - t30_terminate(t30); - } - - fax_release(pvt->fax_state); - } - - if (pvt->t38_state) { - - /* remove from timer thread processing */ - del_pvt(pvt); - - if (pvt->t38_state) { - terminate = 1; - } else { - terminate = 0; - } - - t30 = t38_terminal_get_t30_state(pvt->t38_state); - - if (terminate && t30) { - t30_terminate(t30); - } - - t38_terminal_release(pvt->t38_state); - } - - if (pvt->t38_gateway_state) { - t38_gateway_release(pvt->t38_gateway_state); - } - - if (pvt->udptl_state) { - udptl_release(pvt->udptl_state); - } - return SWITCH_STATUS_SUCCESS; -} - -static t38_mode_t configure_t38(pvt_t *pvt) -{ - switch_core_session_t *session = pvt->session; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_t38_options_t *t38_options = switch_channel_get_private(channel, "t38_options"); - int method = 2; - - if (!t38_options || !pvt || !pvt->t38_core) { - pvt->t38_mode = T38_MODE_REFUSED; - return pvt->t38_mode; - } - - t38_set_t38_version(pvt->t38_core, t38_options->T38FaxVersion); - t38_set_max_buffer_size(pvt->t38_core, t38_options->T38FaxMaxBuffer); - t38_set_fastest_image_data_rate(pvt->t38_core, t38_options->T38MaxBitRate); - t38_set_fill_bit_removal(pvt->t38_core, t38_options->T38FaxFillBitRemoval); - t38_set_mmr_transcoding(pvt->t38_core, t38_options->T38FaxTranscodingMMR); - t38_set_jbig_transcoding(pvt->t38_core, t38_options->T38FaxTranscodingJBIG); - t38_set_max_datagram_size(pvt->t38_core, t38_options->T38FaxMaxDatagram); - - if (t38_options->T38FaxRateManagement) { - if (!strcasecmp(t38_options->T38FaxRateManagement, "transferredTCF")) { - method = 2; - } else { - method = 1; - } - } - - t38_set_data_rate_management_method(pvt->t38_core, method); - - - //t38_set_data_transport_protocol(pvt->t38_core, int data_transport_protocol); - //t38_set_redundancy_control(pvt->t38_core, int category, int setting); - - return pvt->t38_mode; -} - -static t38_mode_t negotiate_t38(pvt_t *pvt) -{ - switch_core_session_t *session = pvt->session; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_core_session_message_t msg = { 0 }; - switch_t38_options_t *t38_options = switch_channel_get_private(channel, "t38_options"); - int enabled = 0, insist = 0; - const char *v; - - pvt->t38_mode = T38_MODE_REFUSED; - - if (pvt->app_mode == FUNCTION_GW) { - enabled = 1; - } else if ((v = switch_channel_get_variable(channel, "fax_enable_t38"))) { - enabled = switch_true(v); - } else { - enabled = globals.enable_t38; - } - - if (!(enabled && t38_options)) { - /* if there is no t38_options the endpoint will refuse the transition */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s NO T38 options detected.\n", switch_channel_get_name(channel)); - switch_channel_set_private(channel, "t38_options", NULL); - } else { - pvt->t38_mode = T38_MODE_NEGOTIATED; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxVersion = %d\n", t38_options->T38FaxVersion); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38MaxBitRate = %d\n", t38_options->T38MaxBitRate); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxFillBitRemoval = %d\n", t38_options->T38FaxFillBitRemoval); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingMMR = %d\n", t38_options->T38FaxTranscodingMMR); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingJBIG = %d\n", t38_options->T38FaxTranscodingJBIG); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxRateManagement = '%s'\n", t38_options->T38FaxRateManagement); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxBuffer = %d\n", t38_options->T38FaxMaxBuffer); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxDatagram = %d\n", t38_options->T38FaxMaxDatagram); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxUdpEC = '%s'\n", t38_options->T38FaxUdpEC); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38VendorInfo = '%s'\n", switch_str_nil(t38_options->T38VendorInfo)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ip = '%s'\n", t38_options->remote_ip ? t38_options->remote_ip : "Not specified"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "port = %d\n", t38_options->remote_port); - - /* Time to practice our negotiating skills, by editing the t38_options */ - - if (t38_options->T38FaxVersion > 3) { - t38_options->T38FaxVersion = 3; - } - t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400; - t38_options->T38FaxFillBitRemoval = 1; - t38_options->T38FaxTranscodingMMR = 0; - t38_options->T38FaxTranscodingJBIG = 0; - t38_options->T38FaxRateManagement = "transferredTCF"; - t38_options->T38FaxMaxBuffer = 2000; - t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; - if (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 - || - strcasecmp(t38_options->T38FaxUdpEC, "t38UDPFEC") == 0) { - t38_options->T38FaxUdpEC = "t38UDPRedundancy"; - } else { - t38_options->T38FaxUdpEC = NULL; - } - t38_options->T38VendorInfo = "0 0 0"; - } - - if ((v = switch_channel_get_variable(channel, "fax_enable_t38_insist"))) { - insist = switch_true(v); - } else { - insist = globals.enable_t38_insist; - } - - /* This will send the options back in a response */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION; - msg.numeric_arg = insist; - switch_core_session_receive_message(session, &msg); - - return pvt->t38_mode; -} - - - -static t38_mode_t request_t38(pvt_t *pvt) -{ - switch_core_session_t *session = pvt->session; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_core_session_message_t msg = { 0 }; - switch_t38_options_t *t38_options = NULL; - int enabled = 0, insist = 0; - const char *v; - - pvt->t38_mode = T38_MODE_UNKNOWN; - - if (pvt->app_mode == FUNCTION_GW) { - enabled = 1; - } else if ((v = switch_channel_get_variable(channel, "fax_enable_t38"))) { - enabled = switch_true(v); - } else { - enabled = globals.enable_t38; - } - - if (enabled) { - if ((v = switch_channel_get_variable(channel, "fax_enable_t38_request"))) { - enabled = switch_true(v); - } else { - enabled = globals.enable_t38_request; - } - } - - - if ((v = switch_channel_get_variable(channel, "fax_enable_t38_insist"))) { - insist = switch_true(v); - } else { - insist = globals.enable_t38_insist; - } - - if (enabled) { - t38_options = switch_core_session_alloc(session, sizeof(*t38_options)); - - t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400; - t38_options->T38FaxVersion = 0; - t38_options->T38FaxFillBitRemoval = 1; - t38_options->T38FaxTranscodingMMR = 0; - t38_options->T38FaxTranscodingJBIG = 0; - t38_options->T38FaxRateManagement = "transferredTCF"; - t38_options->T38FaxMaxBuffer = 2000; - t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; - t38_options->T38FaxUdpEC = "t38UDPRedundancy"; - t38_options->T38VendorInfo = "0 0 0"; - - switch_channel_set_private(channel, "t38_options", t38_options); - pvt->t38_mode = T38_MODE_REQUESTED; - - /* This will send a request for t.38 mode */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA; - msg.numeric_arg = insist; - switch_core_session_receive_message(session, &msg); - } - - return pvt->t38_mode; -} - -/***************************************************************************** - MAIN FAX PROCESSING -*****************************************************************************/ - -static pvt_t *pvt_init(switch_core_session_t *session, application_mode_t app_mode) -{ - switch_channel_t *channel; - pvt_t *pvt = NULL; - const char *tmp; - - /* Make sure we have a valid channel when starting the FAX application */ - channel = switch_core_session_get_channel(session); - switch_assert(channel != NULL); - - if (!switch_channel_media_ready(channel)) { - switch_channel_answer(channel); - } - - /* Allocate our structs */ - pvt = switch_core_session_alloc(session, sizeof(pvt_t)); - pvt->session = session; - - pvt->app_mode = app_mode; - - pvt->tx_page_start = -1; - pvt->tx_page_end = -1; - - - switch(pvt->app_mode) { - - case FUNCTION_TX: - pvt->caller = 1; - break; - case FUNCTION_RX: - pvt->caller = 0; - break; - case FUNCTION_GW: - break; - } - - /* Retrieving our settings from the channel variables */ - - if ((tmp = switch_channel_get_variable(channel, "fax_use_ecm"))) { - pvt->use_ecm = switch_true(tmp); - } else { - pvt->use_ecm = globals.use_ecm; - } - - if ((tmp = switch_channel_get_variable(channel, "fax_disable_v17"))) { - pvt->disable_v17 = switch_true(tmp); - } else { - pvt->disable_v17 = globals.disable_v17; - } - - if ((tmp = switch_channel_get_variable(channel, "fax_verbose"))) { - pvt->verbose = switch_true(tmp); - } else { - pvt->verbose = globals.verbose; - } - - if ((tmp = switch_channel_get_variable(channel, "fax_force_caller"))) { - if (switch_true(tmp)) { - pvt->caller = 1; - } else { - pvt->caller = 0; - } - } - - if ((tmp = switch_channel_get_variable(channel, "fax_ident"))) { - pvt->ident = switch_core_session_strdup(session, tmp); - } else { - pvt->ident = switch_core_session_strdup(session, globals.ident); - } - - if ((tmp = switch_channel_get_variable(channel, "fax_header"))) { - pvt->header = switch_core_session_strdup(session, tmp); - } else { - pvt->header = switch_core_session_strdup(session, globals.header); - } - - if (pvt->app_mode == FUNCTION_TX) { - if ((tmp = switch_channel_get_variable(channel, "fax_start_page"))) { - pvt->tx_page_start = atoi(tmp); - } - - if ((tmp = switch_channel_get_variable(channel, "fax_end_page"))) { - pvt->tx_page_end = atoi(tmp); - } - - if (pvt->tx_page_end < -1) { - pvt->tx_page_end = -1; - } - - if (pvt->tx_page_start < -1) { - pvt->tx_page_start = -1; - } - - if ((pvt->tx_page_end < pvt->tx_page_start) && (pvt->tx_page_end != -1)) { - pvt->tx_page_end = pvt->tx_page_start; - } - } - - return pvt; -} - -void process_fax(switch_core_session_t *session, const char *data, application_mode_t app_mode) -{ - pvt_t *pvt; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_codec_t read_codec = { 0 }; - switch_codec_t write_codec = { 0 }; - switch_frame_t *read_frame = { 0 }; - switch_frame_t write_frame = { 0 }; - switch_codec_implementation_t read_impl = { 0 }; - int16_t *buf = NULL; - - switch_core_session_get_read_impl(session, &read_impl); - - counter_increment(); - - - pvt = pvt_init(session, app_mode); - - - buf = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); - - if (!zstr(data)) { - pvt->filename = switch_core_session_strdup(session, data); - if (pvt->app_mode == FUNCTION_TX) { - if ((switch_file_exists(pvt->filename, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot send inexistant fax file [%s]\n", - switch_str_nil(pvt->filename)); - goto done; - } - } - } else { - if (pvt->app_mode == FUNCTION_TX) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Fax TX filename not set.\n"); - goto done; - } else if (pvt->app_mode == FUNCTION_RX) { - char *fname; - const char *prefix; - switch_time_t time; - - time = switch_time_now(); - - if (!(prefix = switch_channel_get_variable(channel, "fax_prefix"))) { - prefix = globals.prepend_string; - } - - fname = switch_mprintf("%s/%s-%ld-%ld.tif", globals.spool, prefix, globals.total_sessions, time); - if (fname) { - pvt->filename = switch_core_session_strdup(session, fname); - switch_safe_free(fname); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot automatically set fax RX destination file\n"); - goto done; - } - } else { - assert(0); /* UH ?? */ - } - } - - /* - *** Initialize the SpanDSP elements *** - - Note: we could analyze if a fax was already detected in previous stages - and if so, when T.38 will be supported, send a reinvite in T38_MODE, - bypassing AUDIO_MODE. - */ - - if ((spanfax_init(pvt, AUDIO_MODE) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize Fax engine\n"); - return; - } - - /* - Note: Disable echocan on the channel, remember to call app "disable_ec" in the dialplan - before invoking fax applications - */ - - /* - Note: we are disabling the Jitterbuffer, here, before we answer. - If you have set it to something else and the channel is pre-answered, - it will have no effect. Make sure that if you want more reliable - faxes, it is disabled. - */ - switch_channel_set_variable(channel, "jitterbuffer_msec", "0"); - - - /* We store the original channel codec before switching both - * legs of the calls to a linear 16 bit codec that is the one - * used internally by spandsp and FS will do the transcoding - * from G.711 or any other original codec - */ - if (switch_core_codec_init(&read_codec, - "L16", - NULL, - read_impl.samples_per_second, - read_impl.microseconds_per_packet / 1000, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw read codec activation Success L16 %u\n", - read_codec.implementation->microseconds_per_packet); - switch_core_session_set_read_codec(session, &read_codec); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Raw read codec activation Failed L16\n"); - goto done; - } - - if (switch_core_codec_init(&write_codec, - "L16", - NULL, - read_impl.samples_per_second, - read_impl.microseconds_per_packet / 1000, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw write codec activation Success L16\n"); - write_frame.codec = &write_codec; - write_frame.data = buf; - write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Raw write codec activation Failed L16\n"); - goto done; - } - - switch_ivr_sleep(session, 250, SWITCH_TRUE, NULL); - - - /* If you have the means, I highly recommend picking one up. ...*/ - request_t38(pvt); - - - while (switch_channel_ready(channel)) { - int tx = 0; - switch_status_t status; - - /* - if we are in T.38 mode, we should: 1- initialize the ptv->t38_state stuff, if not done - and then set some callbacks when reading frames. - The only thing we need, then, in this loop, is: - - read a frame without blocking - - eventually feed that frame in spandsp, - - call t38_terminal_send_timeout(), sleep for a while - - The T.38 stuff can be placed here (and the audio stuff can be skipped) - */ - - /* read new audio frame from the channel */ - status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - - if (!SWITCH_READ_ACCEPTABLE(status) || pvt->done) { - /* Our duty is over */ - goto done; - } - - switch (pvt->t38_mode) { - case T38_MODE_REQUESTED: - { - if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - switch_core_session_message_t msg = { 0 }; - pvt->t38_mode = T38_MODE_NEGOTIATED; - spanfax_init(pvt, T38_MODE); - configure_t38(pvt); - - /* This will change the rtp stack to udptl mode */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; - switch_core_session_receive_message(session, &msg); - } - continue; - } - break; - case T38_MODE_UNKNOWN: - { - if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - if (negotiate_t38(pvt) == T38_MODE_NEGOTIATED) { - /* is is safe to call this again, it was already called above in AUDIO_MODE */ - /* but this is the only way to set up the t38 stuff */ - spanfax_init(pvt, T38_MODE); - continue; - } - } - } - break; - case T38_MODE_NEGOTIATED: - { - /* do what we need to do when we are in t38 mode */ - if (switch_test_flag(read_frame, SFF_CNG)) { - /* dunno what to do, most likely you will not get too many of these since we turn off the timer in udptl mode */ - continue; - } - - if (switch_test_flag(read_frame, SFF_UDPTL_PACKET)) { - /* now we know we can cast frame->packet to a udptl structure */ - //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "READ %d udptl bytes\n", read_frame->packetlen); - - udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); - - - } - } - continue; - default: - break; - } - - /* Skip CNG frames (auto-generated by FreeSWITCH, usually) */ - if (switch_test_flag(read_frame, SFF_CNG)) { - /* We have no real signal data for the FAX software, but we have a space in time if we have a CNG indication. - Do a fill-in operation in the FAX machine, to keep things rolling along. */ - if (fax_rx_fillin(pvt->fax_state, read_frame->samples)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx_fillin reported an error\n"); - goto done; - } - } else { - /* Pass the new incoming audio frame to the fax_rx function */ - if (fax_rx(pvt->fax_state, (int16_t *) read_frame->data, read_frame->samples)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx reported an error\n"); - goto done; - } - } - - if ((tx = fax_tx(pvt->fax_state, buf, write_codec.implementation->samples_per_packet)) < 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_tx reported an error\n"); - goto done; - } - - if (!tx) { - /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No audio samples to send\n"); */ - continue; - } else { - /* Set our write_frame data */ - write_frame.datalen = tx * sizeof(int16_t); - write_frame.samples = tx; - } - - if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - goto done; - } - - } - - done: - /* Destroy the SpanDSP structures */ - spanfax_destroy(pvt); - - /* restore the original codecs over the channel */ - - switch_core_session_set_read_codec(session, NULL); - - if (switch_core_codec_ready(&read_codec)) { - switch_core_codec_destroy(&read_codec); - } - - if (switch_core_codec_ready(&write_codec)) { - switch_core_codec_destroy(&write_codec); - } -} - -/* ************************************************************************** - CONFIGURATION - ************************************************************************* */ - -void load_configuration(switch_bool_t reload) -{ - switch_xml_t xml = NULL, x_lists = NULL, x_list = NULL, cfg = NULL; - - if ((xml = switch_xml_open_cfg("fax.conf", &cfg, NULL))) { - if ((x_lists = switch_xml_child(cfg, "settings"))) { - for (x_list = switch_xml_child(x_lists, "param"); x_list; x_list = x_list->next) { - const char *name = switch_xml_attr(x_list, "name"); - const char *value = switch_xml_attr(x_list, "value"); - - if (zstr(name)) { - continue; - } - - if (zstr(value)) { - continue; - } - - if (!strcmp(name, "use-ecm")) { - if (switch_true(value)) - globals.use_ecm = 1; - else - globals.use_ecm = 0; - } else if (!strcmp(name, "verbose")) { - if (switch_true(value)) - globals.verbose = 1; - else - globals.verbose = 0; - } else if (!strcmp(name, "disable-v17")) { - if (switch_true(value)) - globals.disable_v17 = 1; - else - globals.disable_v17 = 0; - } else if (!strcmp(name, "enable-t38")) { - if (switch_true(value)) { - globals.enable_t38= 1; - } else { - globals.enable_t38 = 0; - } - } else if (!strcmp(name, "enable-t38-request")) { - if (switch_true(value)) { - globals.enable_t38_request = 1; - } else { - globals.enable_t38_request = 0; - } - } else if (!strcmp(name, "ident")) { - strncpy(globals.ident, value, sizeof(globals.ident) - 1); - } else if (!strcmp(name, "header")) { - strncpy(globals.header, value, sizeof(globals.header) - 1); - } else if (!strcmp(name, "spool-dir")) { - globals.spool = switch_core_strdup(globals.pool, value); - } else if (!strcmp(name, "file-prefix")) { - globals.prepend_string = switch_core_strdup(globals.pool, value); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown parameter %s\n", name); - } - - } - } - - switch_xml_free(xml); - } -} - -static void event_handler(switch_event_t *event) -{ - load_configuration(1); -} - - - - - - -typedef struct { - switch_core_session_t *session; - dtmf_rx_state_t *dtmf_detect; -} switch_inband_dtmf_t; - -static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) -{ - switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *) user_data; - switch_frame_t *frame = NULL; - char digit_str[80]; - switch_channel_t *channel = switch_core_session_get_channel(pvt->session); - - switch (type) { - case SWITCH_ABC_TYPE_INIT: - pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL); - break; - case SWITCH_ABC_TYPE_CLOSE: - if (pvt->dtmf_detect) { - dtmf_rx_free(pvt->dtmf_detect); - } - break; - case SWITCH_ABC_TYPE_READ_REPLACE: - if ((frame = switch_core_media_bug_get_read_replace_frame(bug))) { - dtmf_rx(pvt->dtmf_detect, frame->data, frame->samples); - dtmf_rx_get(pvt->dtmf_detect, digit_str, sizeof(digit_str)); - if (digit_str[0]) { - char *p = digit_str; - while (p && *p) { - switch_dtmf_t dtmf = {0}; - dtmf.digit = *p; - dtmf.duration = switch_core_default_dtmf_duration(0); - switch_channel_queue_dtmf(channel, &dtmf); - p++; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", - digit_str); - } - switch_core_media_bug_set_read_replace_frame(bug, frame); - } - break; - case SWITCH_ABC_TYPE_WRITE: - default: - break; - } - - return SWITCH_TRUE; -} - -switch_status_t spandsp_stop_inband_dtmf_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, "dtmf"))) { - switch_channel_set_private(channel, "dtmf", NULL); - switch_core_media_bug_remove(session, &bug); - return SWITCH_STATUS_SUCCESS; - } - return SWITCH_STATUS_FALSE; -} - -switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_media_bug_t *bug; - switch_status_t status; - switch_inband_dtmf_t *pvt; - switch_codec_implementation_t read_impl = { 0 }; - - switch_core_session_get_read_impl(session, &read_impl); - - if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) { - return SWITCH_STATUS_MEMERR; - } - - - pvt->session = session; - - - if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - - if ((status = switch_core_media_bug_add(session, "spandsp_dtmf_detect", NULL, - inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) { - return status; - } - - switch_channel_set_private(channel, "dtmf", bug); - - return SWITCH_STATUS_SUCCESS; -} - -/* ************************************************************************** - FREESWITCH MODULE DEFINITIONS - ************************************************************************* */ - -#define SPANFAX_RX_USAGE "" -#define SPANFAX_TX_USAGE "" - -SWITCH_MODULE_LOAD_FUNCTION(mod_fax_init); -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fax_shutdown); -SWITCH_MODULE_DEFINITION(mod_fax, mod_fax_init, mod_fax_shutdown, NULL); - -static switch_event_node_t *NODE = NULL; - -SWITCH_STANDARD_APP(spanfax_tx_function) -{ - process_fax(session, data, FUNCTION_TX); -} - -SWITCH_STANDARD_APP(spanfax_rx_function) -{ - process_fax(session, data, FUNCTION_RX); -} - - -SWITCH_STANDARD_APP(dtmf_session_function) -{ - spandsp_inband_dtmf_session(session); -} - -SWITCH_STANDARD_APP(stop_dtmf_session_function) -{ - spandsp_stop_inband_dtmf_session(session); -} - -static const switch_state_handler_table_t t38_gateway_state_handlers; - -static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *session) -{ - switch_core_session_t *other_session; - - switch_channel_t *other_channel, *channel = switch_core_session_get_channel(session); - pvt_t *pvt; - const char *peer_uuid = switch_channel_get_variable(channel, "t38_peer"); - switch_core_session_message_t msg = { 0 }; - switch_status_t status; - switch_frame_t *read_frame = { 0 }; - - if (!(other_session = switch_core_session_locate(peer_uuid))) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot locate channel with uuid %s", - switch_channel_get_name(channel), peer_uuid); - goto end; - } - - other_channel = switch_core_session_get_channel(other_session); - - pvt = pvt_init(session, FUNCTION_GW); - request_t38(pvt); - - msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); - - while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - - if (!SWITCH_READ_ACCEPTABLE(status) || pvt->done) { - /* Our duty is over */ - goto end_unlock; - } - - if (switch_test_flag(read_frame, SFF_CNG)) { - continue; - } - - if (switch_core_session_write_frame(other_session, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - goto end_unlock; - } - } - - if (!(switch_channel_ready(channel) && switch_channel_up(other_channel))) { - goto end_unlock; - } - - if (!switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel)); - goto end_unlock; - } - - if (pvt->t38_mode == T38_MODE_REQUESTED) { - spanfax_init(pvt, T38_GATEWAY_MODE); - configure_t38(pvt); - pvt->t38_mode = T38_MODE_NEGOTIATED; - } else { - if (negotiate_t38(pvt) != T38_MODE_NEGOTIATED) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel)); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end_unlock; - } - - spanfax_init(pvt, T38_GATEWAY_MODE); - } - - /* This will change the rtp stack to udptl mode */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; - switch_core_session_receive_message(session, &msg); - - - /* wake up the audio side */ - switch_channel_set_private(channel, "_t38_pvt", pvt); - switch_channel_set_app_flag_key("T38", other_channel, CF_APP_T38); - - - while (switch_channel_ready(channel) && switch_channel_up(other_channel)) { - - status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - - if (!SWITCH_READ_ACCEPTABLE(status) || pvt->done) { - /* Our duty is over */ - goto end_unlock; - } - - if (switch_test_flag(read_frame, SFF_CNG)) { - continue; - } - - if (switch_test_flag(read_frame, SFF_UDPTL_PACKET)) { - udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); - } - } - - end_unlock: - - - msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); - - switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(other_session); - - end: - - switch_channel_clear_state_handler(channel, &t38_gateway_state_handlers); - switch_channel_set_variable(channel, "t38_peer", NULL); - - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *session) -{ - switch_core_session_t *other_session; - switch_channel_t *other_channel, *channel = switch_core_session_get_channel(session); - const char *peer_uuid = switch_channel_get_variable(channel, "t38_peer"); - pvt_t *pvt = NULL; - switch_codec_t read_codec = { 0 }; - switch_codec_t write_codec = { 0 }; - switch_frame_t *read_frame = { 0 }; - switch_frame_t write_frame = { 0 }; - switch_codec_implementation_t read_impl = { 0 }; - int16_t *buf = NULL; - switch_status_t status; - switch_size_t tx; - const char *t38_trace = switch_channel_get_variable(channel, "t38_trace"); - char *trace_read, *trace_write; - zap_socket_t read_fd = FAX_INVALID_SOCKET, write_fd = FAX_INVALID_SOCKET; - switch_core_session_message_t msg = { 0 }; - switch_event_t *event; - - switch_core_session_get_read_impl(session, &read_impl); - - buf = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); - - if (!(other_session = switch_core_session_locate(peer_uuid))) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end; - } - - other_channel = switch_core_session_get_channel(other_session); - - msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); - - if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); - } - - while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - - if (!SWITCH_READ_ACCEPTABLE(status)) { - /* Our duty is over */ - goto end_unlock; - } - - if (switch_test_flag(read_frame, SFF_CNG)) { - continue; - } - - if (switch_core_session_write_frame(other_session, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - goto end_unlock; - } - } - - if (!(switch_channel_ready(channel) && switch_channel_up(other_channel))) { - goto end_unlock; - } - - if (!switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end_unlock; - } - - if (!(pvt = switch_channel_get_private(other_channel, "_t38_pvt"))) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end_unlock; - } - - if (switch_core_codec_init(&read_codec, - "L16", - NULL, - read_impl.samples_per_second, - read_impl.microseconds_per_packet / 1000, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw read codec activation Success L16 %u\n", - read_codec.implementation->microseconds_per_packet); - switch_core_session_set_read_codec(session, &read_codec); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Raw read codec activation Failed L16\n"); - goto end_unlock; - } - - if (switch_core_codec_init(&write_codec, - "L16", - NULL, - read_impl.samples_per_second, - read_impl.microseconds_per_packet / 1000, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw write codec activation Success L16\n"); - write_frame.codec = &write_codec; - write_frame.data = buf; - write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Raw write codec activation Failed L16\n"); - goto end_unlock; - } - - switch_ivr_sleep(session, 0, SWITCH_TRUE, NULL); - - if (switch_true(t38_trace)) { - trace_read = switch_core_session_sprintf(session, "%s%s%s_read.raw", SWITCH_GLOBAL_dirs.temp_dir, - SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing inbound audio to %s\n", trace_read); - switch_channel_set_variable(channel, "t38_trace_read", trace_read); - - trace_write = switch_core_session_sprintf(session, "%s%s%s_write.raw", SWITCH_GLOBAL_dirs.temp_dir, - SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing outbound audio to %s\n", trace_write); - switch_channel_set_variable(channel, "t38_trace_read", trace_write); - - - if ((write_fd = open(trace_read, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) != FAX_INVALID_SOCKET) { - if ((read_fd = open(trace_write, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == FAX_INVALID_SOCKET) { - close(write_fd); - write_fd = FAX_INVALID_SOCKET; - } - } - } - - while (switch_channel_ready(channel) && switch_channel_up(other_channel)) { - status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - - if (!SWITCH_READ_ACCEPTABLE(status) || pvt->done) { - /* Our duty is over */ - goto end_unlock; - } - - - /* Skip CNG frames (auto-generated by FreeSWITCH, usually) */ - if (!switch_test_flag(read_frame, SFF_CNG)) { - - if (read_fd != FAX_INVALID_SOCKET) { - int w = write(read_fd, read_frame->data, read_frame->datalen); - if (w <= 0) { - close(read_fd); - read_fd = FAX_INVALID_SOCKET; - } - } - if (t38_gateway_rx(pvt->t38_gateway_state, (int16_t *) read_frame->data, read_frame->samples)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx reported an error\n"); - goto end_unlock; - } - } - - if ((tx = t38_gateway_tx(pvt->t38_gateway_state, buf, write_codec.implementation->samples_per_packet)) < 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_tx reported an error\n"); - goto end_unlock; - } - - if (!tx) { - /* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No audio samples to send\n"); */ - continue; - } else { - /* Set our write_frame data */ - write_frame.datalen = tx * sizeof(int16_t); - write_frame.samples = tx; - } - - if (write_fd != FAX_INVALID_SOCKET) { - int w = write(write_fd, write_frame.data, write_frame.datalen); - if (w <= 0) { - close(write_fd); - write_fd = FAX_INVALID_SOCKET; - } - } - - if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - goto end_unlock; - } - } - - end_unlock: - - msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); - - - if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); - } - - if (read_fd != FAX_INVALID_SOCKET) { - close(read_fd); - read_fd = FAX_INVALID_SOCKET; - } - - if (write_fd != FAX_INVALID_SOCKET) { - close(write_fd); - write_fd = FAX_INVALID_SOCKET; - } - - - switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(other_session); - - switch_core_session_set_read_codec(session, NULL); - - if (switch_core_codec_ready(&read_codec)) { - switch_core_codec_destroy(&read_codec); - } - - if (switch_core_codec_ready(&write_codec)) { - switch_core_codec_destroy(&write_codec); - } - - - end: - - switch_channel_clear_state_handler(channel, &t38_gateway_state_handlers); - switch_channel_set_variable(channel, "t38_peer", NULL); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t t38_gateway_on_reset(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - - switch_channel_set_variable(channel, "rtp_autoflush_during_bridge", "false"); - - switch_channel_clear_flag(channel, CF_REDIRECT); - - if (switch_channel_test_app_flag(channel, CF_APP_TAGGED)) { - switch_channel_clear_app_flag(channel, CF_APP_TAGGED); - switch_channel_set_state(channel, CS_CONSUME_MEDIA); - } else { - switch_channel_set_state(channel, CS_SOFT_EXECUTE); - } - - return SWITCH_STATUS_SUCCESS; -} - -static const switch_state_handler_table_t t38_gateway_state_handlers = { - /*.on_init */ NULL, - /*.on_routing */ NULL, - /*.on_execute */ NULL, - /*.on_hangup */ NULL, - /*.on_exchange_media */ NULL, - /*.on_soft_execute */ t38_gateway_on_soft_execute, - /*.on_consume_media */ t38_gateway_on_consume_media, - /*.on_hibernate */ NULL, - /*.on_reset */ t38_gateway_on_reset, - /*.on_park */ NULL, - /*.on_reporting */ NULL, - /*.on_destroy */ NULL, - SSH_FLAG_STICKY -}; - -static switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, const char *data) -{ - switch_channel_t *other_channel = NULL, *channel = switch_core_session_get_channel(session); - switch_core_session_t *other_session = NULL; - int peer = app && !strcasecmp(app, "peer"); - - if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { - other_channel = switch_core_session_get_channel(other_session); - - 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_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s starting gateway mode to %s\n", - switch_channel_get_name(peer ? channel : other_channel), - switch_channel_get_name(peer ? other_channel : channel)); - - - switch_channel_clear_state_handler(channel, NULL); - switch_channel_clear_state_handler(other_channel, NULL); - - switch_channel_add_state_handler(channel, &t38_gateway_state_handlers); - switch_channel_add_state_handler(other_channel, &t38_gateway_state_handlers); - - switch_channel_set_app_flag(peer ? channel : other_channel, CF_APP_TAGGED); - switch_channel_clear_app_flag(peer ? other_channel : channel, CF_APP_TAGGED); - - switch_channel_set_flag(channel, CF_REDIRECT); - switch_channel_set_state(channel, CS_RESET); - - switch_channel_set_flag(other_channel, CF_REDIRECT); - switch_channel_set_state(other_channel, CS_RESET); - - switch_core_session_rwunlock(other_session); - - } - - return SWITCH_FALSE; -} - - -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; - - 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)); - } - } - - switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, data, NULL, t38_gateway_start); -} - - -SWITCH_MODULE_LOAD_FUNCTION(mod_fax_init) -{ - switch_application_interface_t *app_interface; - - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - - SWITCH_ADD_APP(app_interface, "t38_gateway", "Convert to T38 Gateway if tones are heard", "Convert to T38 Gateway if tones are heard", - t38_gateway_function, "", SAF_MEDIA_TAP); - - SWITCH_ADD_APP(app_interface, "rxfax", "FAX Receive Application", "FAX Receive Application", spanfax_rx_function, SPANFAX_RX_USAGE, - SAF_SUPPORT_NOMEDIA); - SWITCH_ADD_APP(app_interface, "txfax", "FAX Transmit Application", "FAX Transmit Application", spanfax_tx_function, SPANFAX_TX_USAGE, - SAF_SUPPORT_NOMEDIA); - - 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); - - memset(&globals, 0, sizeof(globals)); - memset(&t38_state_list, 0, sizeof(t38_state_list)); - switch_core_new_memory_pool(&globals.pool); - switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); - switch_mutex_init(&t38_state_list.mutex, SWITCH_MUTEX_NESTED, globals.pool); - - globals.enable_t38 = 1; - globals.total_sessions = 0; - globals.verbose = 1; - globals.use_ecm = 1; - globals.disable_v17 = 0; - globals.prepend_string = switch_core_strdup(globals.pool, "fax"); - globals.spool = switch_core_strdup(globals.pool, "/tmp"); - strncpy(globals.ident, "SpanDSP Fax Ident", sizeof(globals.ident) - 1); - strncpy(globals.header, "SpanDSP Fax Header", sizeof(globals.header) - 1); - - load_configuration(0); - - if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our reloadxml handler!\n"); - /* Not such severe to prevent loading */ - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_fax loaded, using spandsp library version [%s]\n", SPANDSP_RELEASE_DATETIME_STRING); - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fax_shutdown) -{ - switch_memory_pool_t *pool = globals.pool; - - switch_event_unbind(&NODE); - - switch_core_destroy_memory_pool(&pool); - memset(&globals, 0, sizeof(globals)); - - return SWITCH_STATUS_UNLOAD; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:nil - * 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_fax/udptl.c b/src/mod/applications/mod_fax/udptl.c deleted file mode 100644 index a2651513f0..0000000000 --- a/src/mod/applications/mod_fax/udptl.c +++ /dev/null @@ -1,563 +0,0 @@ -//#define UDPTL_DEBUG -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009, Steve Underwood - * - * 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. - * - * Contributor(s): - * - * Steve Underwood - * - * udptl.c -- UDPTL handling for T.38 - * - */ - -#include -#include -#include -#include -#include - -#include "udptl.h" - -#define FALSE 0 -#define TRUE (!FALSE) - -static int decode_length(const uint8_t *buf, int limit, int *len, int *pvalue) -{ - if (*len >= limit) - return -1; - if ((buf[*len] & 0x80) == 0) { - *pvalue = buf[(*len)++]; - return 0; - } - if ((buf[*len] & 0x40) == 0) { - if (*len >= limit - 1) - return -1; - *pvalue = (buf[(*len)++] & 0x3F) << 8; - *pvalue |= buf[(*len)++]; - return 0; - } - *pvalue = (buf[(*len)++] & 0x3F) << 14; - /* Indicate we have a fragment */ - return 1; -} - -/*- End of function --------------------------------------------------------*/ - -static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8_t ** p_object, int *p_num_octets) -{ - 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) { - if ((stat = decode_length(buf, limit, len, &octet_cnt)) < 0) - return -1; - if (octet_cnt > 0) { - *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; - - *pbuf = &buf[*len]; - *len += octet_cnt; - } - if (stat == 0) - break; - } - return 0; -} - -/*- End of function --------------------------------------------------------*/ - -static int encode_length(uint8_t *buf, int *len, int value) -{ - int multiplier; - - if (value < 0x80) { - /* 1 octet */ - buf[(*len)++] = value; - return value; - } - if (value < 0x4000) { - /* 2 octets */ - /* Set the first bit of the first octet */ - buf[(*len)++] = ((0x8000 | value) >> 8) & 0xFF; - buf[(*len)++] = value & 0xFF; - return value; - } - /* Fragmentation */ - multiplier = (value < 0x10000) ? (value >> 14) : 4; - /* Set the first 2 bits of the octet */ - buf[(*len)++] = 0xC0 | multiplier; - return multiplier << 14; -} - -/*- End of function --------------------------------------------------------*/ - -static int encode_open_type(uint8_t *buf, int *len, const uint8_t *data, int num_octets) -{ - int enclen; - int octet_idx; - uint8_t zero_byte; - - /* If open type is of zero length, add a single zero byte (10.1) */ - if (num_octets == 0) { - zero_byte = 0; - data = &zero_byte; - num_octets = 1; - } - /* Encode the open type */ - for (octet_idx = 0;; num_octets -= enclen, octet_idx += enclen) { - if ((enclen = encode_length(buf, len, num_octets)) < 0) - return -1; - if (enclen > 0) { - memcpy(&buf[*len], &data[octet_idx], enclen); - *len += enclen; - } - if (enclen >= num_octets) - break; - } - - return 0; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len) -{ - int stat; - int stat2; - int i; - int j; - int k; - int l; - int m; - int x; - int limit; - int which; - int ptr; - int count; - int total_count; - int seq_no; - const uint8_t *msg; - const uint8_t *data; - int msg_len; - int repaired[16]; - const uint8_t *bufs[16]; - int lengths[16]; - int span; - int entries; - - ptr = 0; - /* Decode seq_number */ - if (ptr + 2 > len) - return -1; - seq_no = (buf[0] << 8) | buf[1]; - ptr += 2; - /* Break out the primary packet */ - if ((stat = decode_open_type(buf, len, &ptr, &msg, &msg_len)) != 0) - return -1; - /* Decode error_recovery */ - if (ptr + 1 > len) - return -1; - /* Our buffers cannot tolerate overlength packets */ - if (msg_len > LOCAL_FAX_MAX_DATAGRAM) - return -1; - /* Update any missed slots in the buffer */ - for (i = s->rx_seq_no; seq_no > i; i++) { - x = i & UDPTL_BUF_MASK; - s->rx[x].buf_len = -1; - s->rx[x].fec_len[0] = 0; - s->rx[x].fec_span = 0; - s->rx[x].fec_entries = 0; - } - /* Save the new packet. Pure redundancy mode won't use this, but some systems will switch - into FEC mode after sending some redundant packets. */ - x = seq_no & UDPTL_BUF_MASK; - memcpy(s->rx[x].buf, msg, msg_len); - s->rx[x].buf_len = msg_len; - s->rx[x].fec_len[0] = 0; - s->rx[x].fec_span = 0; - s->rx[x].fec_entries = 0; - if ((buf[ptr++] & 0x80) == 0) { - /* Secondary packet mode for error recovery */ - /* We might have the packet we want, but we need to check through - the redundant stuff, and verify the integrity of the UDPTL. - This greatly reduces our chances of accepting garbage. */ - total_count = 0; - do { - if ((stat2 = decode_length(buf, len, &ptr, &count)) < 0) - return -1; - for (i = 0; i < count; i++) { - if ((stat = decode_open_type(buf, len, &ptr, &bufs[total_count + i], &lengths[total_count + i])) != 0) - return -1; - } - total_count += count; - } - while (stat2 > 0); - /* We should now be exactly at the end of the packet. If not, this is a fault. */ - if (ptr != len) - return -1; - if (seq_no > s->rx_seq_no) { - /* We received a later packet than we expected, so we need to check if we can fill in the gap from the - secondary packets. */ - /* Step through in reverse order, so we go oldest to newest */ - for (i = total_count; i > 0; i--) { - if (seq_no - i >= s->rx_seq_no) { - /* This one wasn't seen before */ - /* Decode the secondary packet */ -#if defined(UDPTL_DEBUG) - fprintf(stderr, "Secondary %d, len %d\n", seq_no - i, lengths[i - 1]); -#endif - /* Save the new packet. Redundancy mode won't use this, but some systems will switch into - FEC mode after sending some redundant packets, and this may then be important. */ - x = (seq_no - i) & UDPTL_BUF_MASK; - memcpy(s->rx[x].buf, bufs[i - 1], lengths[i - 1]); - s->rx[x].buf_len = lengths[i - 1]; - s->rx[x].fec_len[0] = 0; - s->rx[x].fec_span = 0; - s->rx[x].fec_entries = 0; - if (s->rx_packet_handler(s->user_data, bufs[i - 1], lengths[i - 1], seq_no - i) < 0) - fprintf(stderr, "Bad IFP\n"); - } - } - } - } else { - /* FEC mode for error recovery */ - - /* Decode the FEC packets */ - /* The span is defined as an unconstrained integer, but will never be more - than a small value. */ - if (ptr + 2 > len) - return -1; - if (buf[ptr++] != 1) - return -1; - span = buf[ptr++]; - - x = seq_no & UDPTL_BUF_MASK; - - s->rx[x].fec_span = span; - - memset(repaired, 0, sizeof(repaired)); - repaired[x] = TRUE; - - /* The number of entries is defined as a length, but will only ever be a small - value. Treat it as such. */ - if (ptr + 1 > len) - return -1; - entries = buf[ptr++]; - s->rx[x].fec_entries = entries; - - /* Decode the elements */ - for (i = 0; i < entries; i++) { - if ((stat = decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i])) != 0) - return -1; - if (s->rx[x].fec_len[i] > LOCAL_FAX_MAX_DATAGRAM) - return -1; - - /* Save the new FEC data */ - memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]); -#if 0 - fprintf(stderr, "FEC: "); - for (j = 0; j < s->rx[x].fec_len[i]; j++) - fprintf(stderr, "%02X ", data[j]); - fprintf(stderr, "\n"); -#endif - } - /* We should now be exactly at the end of the packet. If not, this is a fault. */ - if (ptr != len) - return -1; - /* See if we can reconstruct anything which is missing */ - /* TODO: this does not comprehensively hunt back and repair everything that is possible */ - for (l = x; l != ((x - (16 - span * entries)) & UDPTL_BUF_MASK); l = (l - 1) & UDPTL_BUF_MASK) { - if (s->rx[l].fec_len[0] <= 0) - continue; - for (m = 0; m < s->rx[l].fec_entries; m++) { - limit = (l + m) & UDPTL_BUF_MASK; - for (which = -1, k = (limit - s->rx[l].fec_span * s->rx[l].fec_entries) & UDPTL_BUF_MASK; k != limit; - k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK) { - if (s->rx[k].buf_len <= 0) - which = (which == -1) ? k : -2; - } - if (which >= 0) { - /* Repairable */ - for (j = 0; j < s->rx[l].fec_len[m]; j++) { - s->rx[which].buf[j] = s->rx[l].fec[m][j]; - for (k = (limit - s->rx[l].fec_span * s->rx[l].fec_entries) & UDPTL_BUF_MASK; k != limit; - k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK) - s->rx[which].buf[j] ^= (s->rx[k].buf_len > j) ? s->rx[k].buf[j] : 0; - } - s->rx[which].buf_len = s->rx[l].fec_len[m]; - repaired[which] = TRUE; - } - } - } - /* Now play any new packets forwards in time */ - for (l = (x + 1) & UDPTL_BUF_MASK, j = seq_no - UDPTL_BUF_MASK; l != x; l = (l + 1) & UDPTL_BUF_MASK, j++) { - if (repaired[l]) { -#if defined(UDPTL_DEBUG) - fprintf(stderr, "Fixed packet %d, len %d\n", j, l); -#endif - if (s->rx_packet_handler(s->user_data, s->rx[l].buf, s->rx[l].buf_len, j) < 0) - fprintf(stderr, "Bad IFP\n"); - } - } - } - /* If packets are received out of sequence, we may have already processed this packet from the error - recovery information in a packet already received. */ - if (seq_no >= s->rx_seq_no) { - /* Decode the primary packet */ -#if defined(UDPTL_DEBUG) - fprintf(stderr, "Primary packet %d, len %d\n", seq_no, msg_len); -#endif - if (s->rx_packet_handler(s->user_data, msg, msg_len, seq_no) < 0) - fprintf(stderr, "Bad IFP\n"); - } - - s->rx_seq_no = (seq_no + 1) & 0xFFFF; - return 0; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len) -{ - uint8_t fec[LOCAL_FAX_MAX_DATAGRAM]; - int i; - int j; - int seq; - int entry; - int entries; - int span; - int m; - int len; - int limit; - int high_tide; - - /* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their - maximum length. */ - if (msg_len < 1 || msg_len > LOCAL_FAX_MAX_DATAGRAM) - return -1; - seq = s->tx_seq_no & 0xFFFF; - - /* Map the sequence number to an entry in the circular buffer */ - entry = seq & UDPTL_BUF_MASK; - - /* We save the message in a circular buffer, for generating FEC or - redundancy sets later on. */ - s->tx[entry].buf_len = msg_len; - memcpy(s->tx[entry].buf, msg, msg_len); - - /* Build the UDPTL packet */ - - len = 0; - /* Encode the sequence number */ - buf[len++] = (seq >> 8) & 0xFF; - buf[len++] = seq & 0xFF; - - /* Encode the primary packet */ - if (encode_open_type(buf, &len, msg, msg_len) < 0) - return -1; - - /* Encode the appropriate type of error recovery information */ - switch (s->error_correction_scheme) { - case UDPTL_ERROR_CORRECTION_NONE: - /* Encode the error recovery type */ - buf[len++] = 0x00; - /* The number of entries will always be zero, so it is pointless allowing - for the fragmented case here. */ - if (encode_length(buf, &len, 0) < 0) - return -1; - break; - case UDPTL_ERROR_CORRECTION_REDUNDANCY: - /* Encode the error recovery type */ - buf[len++] = 0x00; - if (s->tx_seq_no > s->error_correction_entries) - entries = s->error_correction_entries; - else - entries = s->tx_seq_no; - /* The number of entries will always be small, so it is pointless allowing - for the fragmented case here. */ - if (encode_length(buf, &len, entries) < 0) - return -1; - /* Encode the elements */ - for (i = 0; i < entries; i++) { - j = (entry - i - 1) & UDPTL_BUF_MASK; - if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0) - return -1; - } - break; - case UDPTL_ERROR_CORRECTION_FEC: - span = s->error_correction_span; - entries = s->error_correction_entries; - if (seq < s->error_correction_span * s->error_correction_entries) { - /* In the initial stages, wind up the FEC smoothly */ - entries = seq / s->error_correction_span; - if (seq < s->error_correction_span) - span = 0; - } - /* Encode the error recovery type */ - buf[len++] = 0x80; - /* Span is defined as an inconstrained integer, which it dumb. It will only - ever be a small value. Treat it as such. */ - buf[len++] = 1; - buf[len++] = span; - /* The number of entries is defined as a length, but will only ever be a small - value. Treat it as such. */ - buf[len++] = entries; - for (m = 0; m < entries; m++) { - /* Make an XOR'ed entry the maximum length */ - limit = (entry + m) & UDPTL_BUF_MASK; - high_tide = 0; - for (i = (limit - span * entries) & UDPTL_BUF_MASK; i != limit; i = (i + entries) & UDPTL_BUF_MASK) { - if (high_tide < s->tx[i].buf_len) { - for (j = 0; j < high_tide; j++) - fec[j] ^= s->tx[i].buf[j]; - for (; j < s->tx[i].buf_len; j++) - fec[j] = s->tx[i].buf[j]; - high_tide = s->tx[i].buf_len; - } else { - for (j = 0; j < s->tx[i].buf_len; j++) - fec[j] ^= s->tx[i].buf[j]; - } - } - if (encode_open_type(buf, &len, fec, high_tide) < 0) - return -1; - } - break; - } - - if (s->verbose) - fprintf(stderr, "\n"); - s->tx_seq_no++; - return len; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_set_error_correction(udptl_state_t *s, int ec_scheme, int span, int entries) -{ - switch (ec_scheme) { - case UDPTL_ERROR_CORRECTION_FEC: - case UDPTL_ERROR_CORRECTION_REDUNDANCY: - case UDPTL_ERROR_CORRECTION_NONE: - s->error_correction_scheme = ec_scheme; - break; - case -1: - /* Just don't change the scheme */ - break; - default: - return -1; - } - if (span >= 0) - s->error_correction_span = span; - if (entries >= 0) - s->error_correction_entries = entries; - return 0; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_get_error_correction(udptl_state_t *s, int *ec_scheme, int *span, int *entries) -{ - if (ec_scheme) - *ec_scheme = s->error_correction_scheme; - if (span) - *span = s->error_correction_span; - if (entries) - *entries = s->error_correction_entries; - return 0; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram) -{ - s->local_max_datagram_size = max_datagram; - return 0; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_get_local_max_datagram(udptl_state_t *s) -{ - return s->local_max_datagram_size; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram) -{ - s->far_max_datagram_size = max_datagram; - return 0; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_get_far_max_datagram(udptl_state_t *s) -{ - return s->far_max_datagram_size; -} - -/*- End of function --------------------------------------------------------*/ - -udptl_state_t *udptl_init(udptl_state_t *s, int ec_scheme, int span, int entries, udptl_rx_packet_handler_t rx_packet_handler, void *user_data) -{ - int i; - - if (rx_packet_handler == NULL) - return NULL; - - if (s == NULL) { - if ((s = (udptl_state_t *) malloc(sizeof(*s))) == NULL) - return NULL; - } - memset(s, 0, sizeof(*s)); - - s->error_correction_scheme = ec_scheme; - s->error_correction_span = span; - s->error_correction_entries = entries; - - s->far_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM; - s->local_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM; - - memset(&s->rx, 0, sizeof(s->rx)); - memset(&s->tx, 0, sizeof(s->tx)); - for (i = 0; i <= UDPTL_BUF_MASK; i++) { - s->rx[i].buf_len = -1; - s->tx[i].buf_len = -1; - } - - s->rx_packet_handler = rx_packet_handler; - s->user_data = user_data; - - return s; -} - -/*- End of function --------------------------------------------------------*/ - -int udptl_release(udptl_state_t *s) -{ - return 0; -} - -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ diff --git a/src/mod/applications/mod_fax/udptl.h b/src/mod/applications/mod_fax/udptl.h deleted file mode 100644 index 39740353d1..0000000000 --- a/src/mod/applications/mod_fax/udptl.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009, Steve Underwood - * - * 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. - * - * Contributor(s): - * - * Steve Underwood - * - * udptl.h -- UDPTL handling for T.38 - * - */ - -#if !defined(FREESWITCH_UDPTL_H) -#define FREESWITCH_UDPTL_H - -#define LOCAL_FAX_MAX_DATAGRAM 400 -#define LOCAL_FAX_MAX_FEC_PACKETS 5 - -#define UDPTL_BUF_MASK 15 - -typedef int (udptl_rx_packet_handler_t) (void *user_data, const uint8_t msg[], int len, int seq_no); - -typedef struct { - int buf_len; - uint8_t buf[LOCAL_FAX_MAX_DATAGRAM]; -} udptl_fec_tx_buffer_t; - -typedef struct { - int buf_len; - uint8_t buf[LOCAL_FAX_MAX_DATAGRAM]; - int fec_len[LOCAL_FAX_MAX_FEC_PACKETS]; - uint8_t fec[LOCAL_FAX_MAX_FEC_PACKETS][LOCAL_FAX_MAX_DATAGRAM]; - int fec_span; - int fec_entries; -} udptl_fec_rx_buffer_t; - -struct udptl_state_s { - udptl_rx_packet_handler_t *rx_packet_handler; - void *user_data; - - /*! This option indicates the error correction scheme used in transmitted UDPTL - packets. */ - int error_correction_scheme; - - /*! This option indicates the number of error correction entries transmitted in - UDPTL packets. */ - int error_correction_entries; - - /*! This option indicates the span of the error correction entries in transmitted - UDPTL packets (FEC only). */ - int error_correction_span; - - /*! This option indicates the maximum size of a datagram that can be accepted by - the remote device. */ - int far_max_datagram_size; - - /*! This option indicates the maximum size of a datagram that we are prepared to - accept. */ - int local_max_datagram_size; - - int verbose; - - int tx_seq_no; - int rx_seq_no; - int rx_expected_seq_no; - - udptl_fec_tx_buffer_t tx[UDPTL_BUF_MASK + 1]; - udptl_fec_rx_buffer_t rx[UDPTL_BUF_MASK + 1]; -}; - -enum { - UDPTL_ERROR_CORRECTION_NONE, - UDPTL_ERROR_CORRECTION_FEC, - UDPTL_ERROR_CORRECTION_REDUNDANCY -}; - -typedef struct udptl_state_s udptl_state_t; - -#if defined(__cplusplus) -extern "C" { -#endif - -/*! \brief Process an arriving UDPTL packet. - \param s The UDPTL context. - \param buf The UDPTL packet buffer. - \param len The length of the packet. - \return 0 for OK. */ - int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len); - -/*! \brief Construct a UDPTL packet, ready for transmission. - \param s The UDPTL context. - \param buf The UDPTL packet buffer. - \param msg The primary packet. - \param len The length of the primary packet. - \return The length of the constructed UDPTL packet. */ - int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len); - -/*! \brief Change the error correction settings of a UDPTL context. - \param s The UDPTL context. - \param ec_scheme One of the optional error correction schemes. - \param span The packet span over which error correction should be applied. - \param entries The number of error correction entries to include in packets. - \return 0 for OK. */ - int udptl_set_error_correction(udptl_state_t *s, int ec_scheme, int span, int entries); - -/*! \brief Check the error correction settings of a UDPTL context. - \param s The UDPTL context. - \param ec_scheme One of the optional error correction schemes. - \param span The packet span over which error correction is being applied. - \param entries The number of error correction being included in packets. - \return 0 for OK. */ - int udptl_get_error_correction(udptl_state_t *s, int *ec_scheme, int *span, int *entries); - - int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram); - - int udptl_get_local_max_datagram(udptl_state_t *s); - - int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram); - - int udptl_get_far_max_datagram(udptl_state_t *s); - -/*! \brief Initialise a UDPTL context. - \param s The UDPTL context. - \param ec_scheme One of the optional error correction schemes. - \param span The packet span over which error correction should be applied. - \param entries The number of error correction entries to include in packets. - \param rx_packet_handler The callback function, used to report arriving IFP packets. - \param user_data An opaque pointer supplied to rx_packet_handler. - \return A pointer to the UDPTL context, or NULL if there was a problem. */ - udptl_state_t *udptl_init(udptl_state_t *s, int ec_scheme, int span, int entries, udptl_rx_packet_handler_t rx_packet_handler, void *user_data); - -/*! \brief Release a UDPTL context. - \param s The UDPTL context. - \return 0 for OK. */ - int udptl_release(udptl_state_t *s); - -#if defined(__cplusplus) -} -#endif -#endif -/*- End of file ------------------------------------------------------------*/ From 693e04a7dedf6dbae14fd65ecfbaf77bb96879f6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 May 2012 09:04:08 -0500 Subject: [PATCH 0441/1057] FS-4250 please post a new log if this does not work --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 ++ src/mod/endpoints/mod_sofia/sofia.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 2b44018665..6d28bc01f9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1587,6 +1587,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi case SWITCH_MESSAGE_INDICATE_BRIDGE: { + + switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, NULL); sofia_glue_tech_track(tech_pvt->profile, session); sofia_set_flag(tech_pvt, TFLAG_SIMPLIFY); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index dc4fcfb0f0..281aa511da 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6797,6 +6797,9 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_EXPIRES_STR("60"), TAG_END()); + + switch_channel_set_variable(tech_pvt->channel, SOFIA_REPLACES_HEADER, NULL); + if (sip->sip_referred_by) { full_ref_by = sip_header_as_string(home, (void *) sip->sip_referred_by); } From 24f6c4056b1bfec94020eeb9611b3fcb0f4f72b4 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 31 May 2012 11:25:28 -0500 Subject: [PATCH 0442/1057] missed a spot removing mod_fax --- configure.in | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.in b/configure.in index 5dbe6d9e12..83cb4144eb 100644 --- a/configure.in +++ b/configure.in @@ -993,7 +993,6 @@ AC_CONFIG_FILES([Makefile src/Makefile src/mod/Makefile src/mod/applications/mod_expr/Makefile - src/mod/applications/mod_fax/Makefile src/mod/applications/mod_spandsp/Makefile src/mod/applications/mod_osp/Makefile src/mod/applications/mod_stress/Makefile From afeb7f327c88ab166f656ce59839ed18e61eb1c6 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 31 May 2012 14:18:58 -0500 Subject: [PATCH 0443/1057] OpenCNAM frontend so you can feed it 10 or 11 digits and cache the results. --- scripts/perl/cnam.cgi | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 scripts/perl/cnam.cgi diff --git a/scripts/perl/cnam.cgi b/scripts/perl/cnam.cgi new file mode 100755 index 0000000000..d7acaa9b49 --- /dev/null +++ b/scripts/perl/cnam.cgi @@ -0,0 +1,63 @@ +#!/usr/bin/perl +# +# OpenCNAM front end because they only take 10 digits and can't filter 11 on their side. +# + +use Data::Dumper; +use CGI qw/:standard/; +use LWP::UserAgent; +use SDBM_File; +use Fcntl; + +my %params = map { $_ => get_data( $_ ) } param; + +$ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); + +sub get_data { + my $name = shift; + my @values = param( $name ); + return @values > 1 + ? \@values + : $values[0]; +} + +print "Content-Type: text/plain\n\n"; + +tie (my %cache, 'SDBM_File', 'cnam.dbm', O_RDWR|O_CREAT, 0640) || die $!; + +my $number = $params{number}; + + +if($number =~ m/1?\d{10}/) { + + + if($number =~ m/^1(\d{10})$/) { + $number = $1; + } + + if($cache{"$number"}) { + print $cache{"$number"}; + untie %cache; + exit; + } + + my $url = "https://api.opencnam.com/v1/phone/$number?format=text"; + + + my $res = $ua->get( $url ); + + if ($res->is_success) { + my $content = $res->decoded_content; + if ($content =~ m/^Invalid/) { + # API shouldn't return this crap. + print "UNKNOWN"; + } else { + # Cache the entry. + $cache{"$number"} = $content; + # print the entry. + print $content; + } + } +} + +untie %cache; From 5165e4071ee4d32c3990e681417caae6b7408efa Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 31 May 2012 23:59:45 +0200 Subject: [PATCH 0444/1057] FreeSWITCH: Remove -arch i386/x86_64 from PYTHON_CFLAGS Speculative fix for a mod_python build issue on OSX, which is caused by '-arch i386 -arch x86_64' in the final PYTHON_CFLAGS. Filter both flags and hope OSX's universal binary toolchain is smart enough to choose a sane default. Reported-by: neilp9 in #freeswitch @ irc.freenode.net Signed-off-by: Stefan Knoblich --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 83cb4144eb..d609c4eef5 100644 --- a/configure.in +++ b/configure.in @@ -925,7 +925,7 @@ then # # python distutils found, get settings from python directly # - PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));'`" + PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's:-arch \(i386\|x86_64\)\+::g'`" PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print(\" \".join(libs));'`" PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print(\"python\" + sysconfig.get_config_var(\"VERSION\"));'`" PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`" From ba4a210ced2922e0bb6be1a58eb2c27c9a0ed7ea Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 1 Jun 2012 00:24:43 +0200 Subject: [PATCH 0445/1057] FreeSWITCH: Fix copy&paste error in last commit Signed-off-by: Stefan Knoblich --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index d609c4eef5..f37ba4c8bc 100644 --- a/configure.in +++ b/configure.in @@ -925,7 +925,7 @@ then # # python distutils found, get settings from python directly # - PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's:-arch \(i386\|x86_64\)\+::g'`" + PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's:-arch \(i386\|x86_64\)::g'`" PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print(\" \".join(libs));'`" PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print(\"python\" + sysconfig.get_config_var(\"VERSION\"));'`" PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`" From b2d183099f23a70655bfee7f0ea33e1166b64e4a Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 31 May 2012 23:36:37 -0400 Subject: [PATCH 0446/1057] mod_voicemail: Remove the Goodbye prompt when voicemail is disabled when trying to leave a message --- 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 0bbea275d5..d3438aacfc 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3489,7 +3489,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p switch_safe_free(file_path); - if (switch_channel_ready(channel)) { + if (switch_channel_ready(channel) && vm_enabled) { status = switch_ivr_phrase_macro(session, VM_GOODBYE_MACRO, NULL, NULL, NULL); } From f685e4c5049f92d76f55f272c2754c45ac7f4fb9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Jun 2012 10:06:28 -0500 Subject: [PATCH 0447/1057] allow ep_codec_string to draw from absolute_codec_string before the profile prefs --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- src/mod/endpoints/mod_sofia/sofia_glue.c | 26 ++++++++++++++---------- src/switch_ivr_originate.c | 6 ++++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 281aa511da..d865be6ee7 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5815,7 +5815,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp); switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp); - if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) { + if ((sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) { if ((sdp = sdp_session(parser))) { sofia_glue_set_r_sdp_codec_string(session, sofia_glue_get_codec_string(tech_pvt), sdp); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2cb2fdd551..e96f1e1802 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -776,19 +776,23 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch const char *sofia_glue_get_codec_string(private_object_t *tech_pvt) { - const char *codec_string = NULL, *preferred = NULL, *fallback = NULL; - - if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - preferred = tech_pvt->profile->outbound_codec_string; - fallback = tech_pvt->profile->inbound_codec_string; - } else { - preferred = tech_pvt->profile->inbound_codec_string; - fallback = tech_pvt->profile->outbound_codec_string; + const char *preferred = NULL, *fallback = NULL; + + if (!(preferred = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) { + preferred = switch_channel_get_variable(tech_pvt->channel, "codec_string"); + } + + if (!preferred) { + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + preferred = tech_pvt->profile->outbound_codec_string; + fallback = tech_pvt->profile->inbound_codec_string; + } else { + preferred = tech_pvt->profile->inbound_codec_string; + fallback = tech_pvt->profile->outbound_codec_string; + } } - codec_string = !zstr(preferred) ? preferred : fallback; - - return codec_string; + return !zstr(preferred) ? preferred : fallback; } void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c18da450a6..72d0ab0393 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -384,8 +384,10 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_ { const char *var = switch_channel_get_variable(caller_channel, "inherit_codec"); switch_channel_t *channel = switch_core_session_get_channel(session); - - if (switch_true(var)) { + + if (!zstr(var) && !strcasecmp(var, "passthru")) { + switch_channel_set_variable(caller_channel, "absolute_codec_string", switch_channel_get_variable(channel, "ep_codec_string")); + } else if (switch_true(var)) { switch_codec_implementation_t impl = { 0 }; switch_codec_implementation_t video_impl = { 0 }; char tmp[128] = ""; From 75aab0ee6cda0c63177fca2a99d313894d068438 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Jun 2012 13:21:12 -0500 Subject: [PATCH 0448/1057] put presence data in state events --- src/switch_channel.c | 17 +++++++++++++++++ src/switch_core_sqldb.c | 14 ++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/switch_channel.c b/src/switch_channel.c index 138123f3eb..94c9a35cfe 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1928,6 +1928,8 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state( if (state == CS_ROUTING) { switch_channel_event_set_data(channel, event); } else { + const char *v; + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State", switch_channel_state_name(state)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Call-State", switch_channel_callstate2str(channel->callstate)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%d", state); @@ -1951,6 +1953,21 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state( } else { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "ringing"); } + + + if ((v = switch_channel_get_variable(channel, "presence_id"))) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Presence-ID", v); + } + + if ((v = switch_channel_get_variable(channel, "presence_data"))) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Presence-Data", v); + } + + if ((v = switch_channel_get_variable(channel, "presence_data_cols"))) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Data-Cols", v); + switch_event_add_presence_data_cols(channel, event, "PD-"); + } + } switch_event_fire(&event); } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 9b40674065..eea6a4372d 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1407,6 +1407,20 @@ static void core_event_handler(switch_event_t *event) case CS_DESTROY: case CS_REPORTING: break; + case CS_EXECUTE: + if ((extra_cols = parse_presence_data_cols(event))) { + new_sql() = switch_mprintf("update channels set state='%s',%s where uuid='%q'", + switch_event_get_header_nil(event, "channel-state"), + extra_cols, + switch_event_get_header_nil(event, "unique-id")); + free(extra_cols); + + } else { + new_sql() = switch_mprintf("update channels set state='%s' where uuid='%s'", + switch_event_get_header_nil(event, "channel-state"), + switch_event_get_header_nil(event, "unique-id")); + } + break; case CS_ROUTING: if ((extra_cols = parse_presence_data_cols(event))) { new_sql() = switch_mprintf("update channels set state='%s',cid_name='%q',cid_num='%q',callee_name='%q',callee_num='%q'," From 6d02716ac595302bc8e683ab59ecb3c162bcd600 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Jun 2012 13:28:30 -0500 Subject: [PATCH 0449/1057] last commit part 2 --- 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 eea6a4372d..50ba871e7b 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1193,7 +1193,7 @@ static char *parse_presence_data_cols(switch_event_t *event) for (i = 0; i < col_count; i++) { const char *val = NULL; - switch_snprintfv(col_name, sizeof(col_name), "variable_%q", cols[i]); + switch_snprintfv(col_name, sizeof(col_name), "PD-%q", cols[i]); val = switch_event_get_header_nil(event, col_name); if (zstr(val)) { stream.write_function(&stream, "%q=NULL,", cols[i]); From 241bdf4166aafb46bb87824d0f8109b1804c5305 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Jun 2012 13:56:55 -0500 Subject: [PATCH 0450/1057] FS-4279 FS-3279 --resolve --- src/mod/endpoints/mod_sofia/sofia_glue.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index e96f1e1802..65a6caf1e6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4703,10 +4703,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s goto done; } - if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38)) { - sofia_set_flag(tech_pvt, TFLAG_NOREPLY); - } - if (switch_true(switch_channel_get_variable(channel, "refuse_t38"))) { switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38); match = 0; @@ -4715,6 +4711,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s const char *var = switch_channel_get_variable(channel, "t38_passthru"); int pass = sofia_test_pflag(tech_pvt->profile, PFLAG_T38_PASSTHRU); + + if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38)) { + sofia_set_flag(tech_pvt, TFLAG_NOREPLY); + } + if (var) { if (!(pass = switch_true(var))) { if (!strcasecmp(var, "once")) { From 410040218aea5d3a423f5ebf30b878ff8335cce6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Jun 2012 14:11:21 -0500 Subject: [PATCH 0451/1057] add warning so users know inbound-zrtp-passthru will enable late negotiation --- src/mod/endpoints/mod_sofia/sofia.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d865be6ee7..c6ab7dd76a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4814,6 +4814,7 @@ switch_status_t config_sofia(int reload, char *profile_name) } if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ZRTP Passthru implictly sets inbound-late-negotiation to true.\n"); sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); } From c6aa2f14ece4367f445df3f6fc4567fb5f78b6f3 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 1 Jun 2012 21:25:55 +0000 Subject: [PATCH 0452/1057] add config comments about zrtp-passthru and late negotiation --- conf/insideout/sip_profiles/external.xml | 2 +- conf/insideout/sip_profiles/internal-ipv6.xml | 2 +- conf/insideout/sip_profiles/internal.xml | 2 +- conf/sbc/sbc_profiles/external.xml | 2 +- conf/sbc/sbc_profiles/internal-ipv6.xml | 2 +- conf/sbc/sbc_profiles/internal.xml | 2 +- conf/vanilla/sip_profiles/external.xml | 2 +- conf/vanilla/sip_profiles/internal-ipv6.xml | 2 +- conf/vanilla/sip_profiles/internal.xml | 2 +- src/mod/endpoints/mod_sofia/conf/sofia.conf.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/conf/insideout/sip_profiles/external.xml b/conf/insideout/sip_profiles/external.xml index f021a4c3c6..22fd155434 100644 --- a/conf/insideout/sip_profiles/external.xml +++ b/conf/insideout/sip_profiles/external.xml @@ -48,7 +48,7 @@ - + diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml index b9907a78ad..525554f4b8 100644 --- a/conf/insideout/sip_profiles/internal-ipv6.xml +++ b/conf/insideout/sip_profiles/internal-ipv6.xml @@ -69,7 +69,7 @@ - + diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml index e406cd5e72..666f7de5ab 100644 --- a/conf/insideout/sip_profiles/internal.xml +++ b/conf/insideout/sip_profiles/internal.xml @@ -104,7 +104,7 @@ - + diff --git a/conf/sbc/sbc_profiles/external.xml b/conf/sbc/sbc_profiles/external.xml index 0f15159f58..7bf024658b 100644 --- a/conf/sbc/sbc_profiles/external.xml +++ b/conf/sbc/sbc_profiles/external.xml @@ -49,7 +49,7 @@ - + diff --git a/conf/sbc/sbc_profiles/internal-ipv6.xml b/conf/sbc/sbc_profiles/internal-ipv6.xml index b9907a78ad..525554f4b8 100644 --- a/conf/sbc/sbc_profiles/internal-ipv6.xml +++ b/conf/sbc/sbc_profiles/internal-ipv6.xml @@ -69,7 +69,7 @@ - + diff --git a/conf/sbc/sbc_profiles/internal.xml b/conf/sbc/sbc_profiles/internal.xml index 3081052c88..d4b2efd37b 100644 --- a/conf/sbc/sbc_profiles/internal.xml +++ b/conf/sbc/sbc_profiles/internal.xml @@ -110,7 +110,7 @@ - + diff --git a/conf/vanilla/sip_profiles/external.xml b/conf/vanilla/sip_profiles/external.xml index 4f18e84be7..5070c87913 100644 --- a/conf/vanilla/sip_profiles/external.xml +++ b/conf/vanilla/sip_profiles/external.xml @@ -57,7 +57,7 @@ - + diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index 18274faa4f..62b9708e8b 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -70,7 +70,7 @@ - + diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index 0f4cabe32d..7d37da863e 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -222,7 +222,7 @@ - + diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 30d8063a67..2e66602f1b 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -266,7 +266,7 @@ - + From 879830f61c220b517dda4c74be56e8ef3930cbe0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Jun 2012 14:33:02 -0500 Subject: [PATCH 0453/1057] FS-4167 --resolve --- .../mod_conference/mod_conference.c | 104 +++++++++++++++++- 1 file changed, 99 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 8b4be69b2c..c5a05c7fa7 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -48,9 +48,23 @@ typedef struct conference_cdr_node_s { char *record_path; switch_time_t join_time; switch_time_t leave_time; + uint32_t flags; struct conference_cdr_node_s *next; } conference_cdr_node_t; +typedef enum { + CDRR_LOCKED = 1, + CDRR_PIN, + CDRR_MAXMEMBERS +} cdr_reject_reason_t; + +typedef struct conference_cdr_reject_s { + switch_caller_profile_t *cp; + switch_time_t reject_time; + cdr_reject_reason_t reason; + struct conference_cdr_reject_s *next; +} conference_cdr_reject_t; + typedef enum { @@ -175,7 +189,8 @@ typedef enum { CFLAG_EXIT_SOUND = (1 << 12), CFLAG_ENTER_SOUND = (1 << 13), CFLAG_VIDEO_BRIDGE = (1 << 14), - CFLAG_AUDIO_ALWAYS = (1 << 15) + CFLAG_AUDIO_ALWAYS = (1 << 15), + CFLAG_ENDCONF_FORCED = (1 << 16) } conf_flag_t; typedef enum { @@ -332,6 +347,7 @@ typedef struct conference_obj { uint32_t originating; switch_call_cause_t cancel_cause; conference_cdr_node_t *cdr_nodes; + conference_cdr_reject_t *cdr_rejected; switch_time_t start_time; switch_time_t end_time; char *log_dir; @@ -505,6 +521,7 @@ static switch_status_t conference_add_event_member_data(conference_member_t *mem static void conference_cdr_del(conference_member_t *member) { member->cdr_node->leave_time = switch_epoch_time_now(NULL); + member->cdr_node->flags = member->flags; } static void conference_cdr_add(conference_member_t *member) @@ -533,10 +550,30 @@ static void conference_cdr_add(conference_member_t *member) member->cdr_node->cp = switch_caller_profile_dup(member->conference->pool, cp); } +static void conference_cdr_rejected(conference_obj_t *conference, switch_channel_t *channel, cdr_reject_reason_t reason) +{ + conference_cdr_reject_t *rp; + switch_caller_profile_t *cp; + + rp = switch_core_alloc(conference->pool, sizeof(*rp)); + + rp->next = conference->cdr_rejected; + conference->cdr_rejected = rp; + rp->reason = reason; + rp->reject_time = switch_epoch_time_now(NULL); + + if (!(cp = switch_channel_get_caller_profile(channel))) { + return; + } + + rp->cp = switch_caller_profile_dup(conference->pool, cp); +} + static void conference_cdr_render(conference_obj_t *conference) { - switch_xml_t cdr, x_ptr, x_member, x_members, x_conference, x_cp; + switch_xml_t cdr, x_ptr, x_member, x_members, x_conference, x_cp, x_flags, x_tag, x_rejected, x_attempt; conference_cdr_node_t *np; + conference_cdr_reject_t *rp; int cdr_off = 0, conf_off = 0; char str[512]; char *path, *xml_text; @@ -544,7 +581,7 @@ static void conference_cdr_render(conference_obj_t *conference) if (zstr(conference->log_dir)) return; - if (!conference->cdr_nodes) return; + if (!conference->cdr_nodes && !conference->cdr_rejected) return; if (!(cdr = switch_xml_new("cdr"))) { abort(); @@ -583,18 +620,20 @@ static void conference_cdr_render(conference_obj_t *conference) if (!(x_ptr = switch_xml_add_child_d(x_conference, "end_time", conf_off++))) { abort(); } + switch_xml_set_attr_d(x_ptr, "endconf_forced", switch_test_flag(conference, CFLAG_ENDCONF_FORCED) ? "true" : "false"); switch_xml_set_attr_d(x_ptr, "type", "UNIX-epoch"); switch_snprintf(str, sizeof(str), "%ld", (long)conference->end_time); switch_xml_set_txt_d(x_ptr, str); + if (!(x_members = switch_xml_add_child_d(x_conference, "members", conf_off++))) { abort(); } - for (np = conference->cdr_nodes; np; np = np->next) { int member_off = 0; + int flag_off = 0; if (!(x_member = switch_xml_add_child_d(x_members, "member", conf_off++))) { @@ -619,6 +658,18 @@ static void conference_cdr_render(conference_obj_t *conference) switch_xml_set_txt_d(x_ptr, str); if (np->cp) { + x_flags = switch_xml_add_child_d(x_member, "flags", member_off++); + switch_assert(x_flags); + + x_tag = switch_xml_add_child_d(x_flags, "is_moderator", flag_off++); + switch_xml_set_txt_d(x_tag, switch_test_flag(np, MFLAG_MOD) ? "true" : "false"); + + x_tag = switch_xml_add_child_d(x_flags, "end_conference", flag_off++); + switch_xml_set_txt_d(x_tag, switch_test_flag(np, MFLAG_ENDCONF) ? "true" : "false"); + + x_tag = switch_xml_add_child_d(x_flags, "was_kicked", flag_off++); + switch_xml_set_txt_d(x_tag, switch_test_flag(np, MFLAG_KICKED) ? "true" : "false"); + if (!(x_cp = switch_xml_add_child_d(x_member, "caller_profile", member_off++))) { abort(); } @@ -631,8 +682,47 @@ static void conference_cdr_render(conference_obj_t *conference) } switch_xml_set_txt_d(x_ptr, np->record_path); } + + } + if (!(x_rejected = switch_xml_add_child_d(x_conference, "rejected", conf_off++))) { + abort(); + } + + for (rp = conference->cdr_rejected; rp; rp = rp->next) { + int attempt_off = 0; + int tag_off = 0; + + if (!(x_attempt = switch_xml_add_child_d(x_rejected, "attempt", attempt_off++))) { + abort(); + } + + if (!(x_ptr = switch_xml_add_child_d(x_attempt, "reason", tag_off++))) { + abort(); + } + if (rp->reason == CDRR_LOCKED) { + switch_xml_set_txt_d(x_ptr, "conference_locked"); + } else if (rp->reason == CDRR_MAXMEMBERS) { + switch_xml_set_txt_d(x_ptr, "max_members_reached"); + } else if (rp->reason == CDRR_PIN) { + switch_xml_set_txt_d(x_ptr, "invalid_pin"); + } + + if (!(x_ptr = switch_xml_add_child_d(x_attempt, "reject_time", tag_off++))) { + abort(); + } + switch_xml_set_attr_d(x_ptr, "type", "UNIX-epoch"); + switch_snprintf(str, sizeof(str), "%ld", (long) rp->reject_time); + switch_xml_set_txt_d(x_ptr, str); + + if (rp->cp) { + if (!(x_cp = switch_xml_add_child_d(x_attempt, "caller_profile", attempt_off++))) { + abort(); + } + switch_ivr_set_xml_profile_data(x_cp, rp->cp, 0); + } + } xml_text = switch_xml_toxml(cdr, SWITCH_TRUE); @@ -1835,7 +1925,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v switch_epoch_time_now(NULL) - conference->endconf_time > conference->endconf_grace_time) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Conference %s: endconf grace time exceeded (%u)\n", conference->name, conference->endconf_grace_time); - switch_set_flag(conference, CFLAG_DESTRUCT); + switch_set_flag(conference, CFLAG_DESTRUCT | CFLAG_ENDCONF_FORCED); } switch_mutex_unlock(conference->mutex); @@ -4595,6 +4685,7 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer x_member = switch_xml_add_child_d(x_members, "member", moff++); switch_assert(x_member); + switch_xml_set_attr_d(x_member, "type", "caller"); switch_snprintf(i, sizeof(i), "%d", member->id); @@ -6616,6 +6707,7 @@ SWITCH_STANDARD_APP(conference_function) } if (!pin_valid) { + conference_cdr_rejected(conference, channel, CDRR_PIN); goto done; } } @@ -6627,6 +6719,7 @@ SWITCH_STANDARD_APP(conference_function) /* don't allow more callers if the conference is locked, unless we invited them */ if (switch_test_flag(conference, CFLAG_LOCKED) && enforce_security) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name); + conference_cdr_rejected(conference, channel, CDRR_LOCKED); if (conference->locked_sound) { /* Answer the channel */ switch_channel_answer(channel); @@ -6641,6 +6734,7 @@ SWITCH_STANDARD_APP(conference_function) */ if ((conference->max_members > 0) && (conference->count >= conference->max_members)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Conference %s is full.\n", conf_name); + conference_cdr_rejected(conference, channel, CDRR_MAXMEMBERS); if (conference->maxmember_sound) { /* Answer the channel */ switch_channel_answer(channel); From c98cdb4e0414b512f75c4ae5d56c4b3991653da9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 1 Jun 2012 21:43:41 +0000 Subject: [PATCH 0454/1057] avoid warning if late negotiation is enabled anyway --- src/mod/endpoints/mod_sofia/sofia.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c6ab7dd76a..658a7f0b0b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4813,8 +4813,8 @@ switch_status_t config_sofia(int reload, char *profile_name) } } - if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ZRTP Passthru implictly sets inbound-late-negotiation to true.\n"); + if (sofia_test_flag(profile, TFLAG_ZRTP_PASSTHRU) && !sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ZRTP passthrough implictly enables inbound-late-negotiation\n"); sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); } From 93129e32d3849f232d3317dbbb85e39a9ac0cfb6 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sat, 2 Jun 2012 00:12:34 +0200 Subject: [PATCH 0455/1057] FreeSWITCH: FS-4276 - Use a POSIX compatible set of regexes to filter -arch flags in PYTHON_CFLAGS. POSIX sed doesn't support grouping, so split the regex in two. Reference-URL: http://jira.freeswitch.org/browse/FS-4276 Signed-off-by: Stefan Knoblich --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index f37ba4c8bc..0599a0c6b7 100644 --- a/configure.in +++ b/configure.in @@ -925,7 +925,7 @@ then # # python distutils found, get settings from python directly # - PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's:-arch \(i386\|x86_64\)::g'`" + PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`" PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print(\" \".join(libs));'`" PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print(\"python\" + sysconfig.get_config_var(\"VERSION\"));'`" PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`" From c1b2472781753a1f78967c0cbe2e987a48297ac6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 1 Jun 2012 22:11:22 +0000 Subject: [PATCH 0456/1057] SWITCH_VERSION_REVISION includes the dash or dot itself --- src/include/switch_version.h.cmake | 2 +- src/include/switch_version.h.template | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/switch_version.h.cmake b/src/include/switch_version.h.cmake index 6e36b0b1da..7cec6489b3 100644 --- a/src/include/switch_version.h.cmake +++ b/src/include/switch_version.h.cmake @@ -41,7 +41,7 @@ extern "C" { #define SWITCH_VERSION_MINOR "@freeswitch_MINOR_VERSION@" #define SWITCH_VERSION_MICRO "@freeswitch_PATCH_LEVEL@" #define SWITCH_VERSION_REVISION "@Project_WC_REVISION@" -#define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO " (" SWITCH_VERSION_REVISION ")" +#define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION #ifdef __cplusplus } diff --git a/src/include/switch_version.h.template b/src/include/switch_version.h.template index 2f75d75266..e0c13811d8 100644 --- a/src/include/switch_version.h.template +++ b/src/include/switch_version.h.template @@ -41,7 +41,7 @@ extern "C" { #define SWITCH_VERSION_MINOR "@SWITCH_VERSION_MINOR@" #define SWITCH_VERSION_MICRO "@SWITCH_VERSION_MICRO@" #define SWITCH_VERSION_REVISION "@SWITCH_VERSION_REVISION@" -#define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO " (" SWITCH_VERSION_REVISION ")" +#define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION #ifdef __cplusplus } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 67d513cf27..4a8fb5b890 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -92,7 +92,7 @@ typedef struct private_object private_object_t; #define MULTICAST_EVENT "multicast::event" #define SOFIA_REPLACES_HEADER "_sofia_replaces_" -#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO "-" SWITCH_VERSION_REVISION +#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION #define SOFIA_CHAT_PROTO "sip" #define SOFIA_MULTIPART_PREFIX "sip_mp_" #define SOFIA_MULTIPART_PREFIX_T "~sip_mp_" From 49ac9090654fa5ee0814b539a8b69d687bd86b2f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 1 Jun 2012 22:16:30 +0000 Subject: [PATCH 0457/1057] skypopen/gsmopen should use SWITCH_VERSION_FULL here --- .../mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h | 2 +- src/mod/endpoints/mod_gsmopen/gsmopen.h | 2 +- src/mod/endpoints/mod_skypopen/skypopen.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h index 03c14283b4..01388575b0 100644 --- a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h @@ -132,7 +132,7 @@ //#define SAMPLES_PER_FRAME SAMPLERATE_GSMOPEN/50 #ifndef GSMOPEN_SVN_VERSION -#define GSMOPEN_SVN_VERSION SWITCH_VERSION_REVISION +#define GSMOPEN_SVN_VERSION SWITCH_VERSION_FULL #endif /* GSMOPEN_SVN_VERSION */ typedef enum { diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index fd56fd4963..b5404ae6a9 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -113,7 +113,7 @@ #endif #ifndef GSMOPEN_SVN_VERSION -#define GSMOPEN_SVN_VERSION SWITCH_VERSION_REVISION +#define GSMOPEN_SVN_VERSION SWITCH_VERSION_FULL #endif /* GSMOPEN_SVN_VERSION */ #include "ctb-0.16/ctb.h" diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 864a22c3e4..d5f01f85e6 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -85,7 +85,7 @@ #endif #ifndef SKYPOPEN_SVN_VERSION -#define SKYPOPEN_SVN_VERSION SWITCH_VERSION_REVISION +#define SKYPOPEN_SVN_VERSION SWITCH_VERSION_FULL #endif /* SKYPOPEN_SVN_VERSION */ typedef enum { From 00e32e4ec2d3f762772464f2919ff11956114164 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 1 Jun 2012 22:21:48 +0000 Subject: [PATCH 0458/1057] use SWITCH_VERSION_FULL for the sofia user agent --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 4a8fb5b890..247616d41c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -92,7 +92,7 @@ typedef struct private_object private_object_t; #define MULTICAST_EVENT "multicast::event" #define SOFIA_REPLACES_HEADER "_sofia_replaces_" -#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION +#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_FULL #define SOFIA_CHAT_PROTO "sip" #define SOFIA_MULTIPART_PREFIX "sip_mp_" #define SOFIA_MULTIPART_PREFIX_T "~sip_mp_" From f3c2180c529bd2dc1cf1c5184c79fe8254edf758 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 01:10:11 +0000 Subject: [PATCH 0459/1057] add usage help to debian/util.sh --- debian/util.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index de1496a950..1692fcadab 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -328,14 +328,66 @@ build_all () { cat ../log/changes } -while getopts 'd' o "$@"; do +usage () { + cat >&2 < + + -d Enable cowbuilder debug hook + + create-dbg-pkgs + + create-dsc + + -m [ quicktest ] + Choose custom list of modules to build + -s [ paranoid | reckless ] + Set FS bootstrap/build -j flags + + create-orig + + -b Bundle downloaded libraries in source package + -n Nightly build + -v Set version + -z Set compression level + +EOF + exit 1 +} + +while getopts 'dh' o "$@"; do case "$o" in d) set -vx;; + h) usage;; esac done shift $(($OPTIND-1)) -cmd="$1" +cmd="$1"; [ -n "$cmd" ] || usage shift case "$cmd" in archive-orig) archive_orig "$@" ;; @@ -344,5 +396,6 @@ case "$cmd" in create-dbg-pkgs) create_dbg_pkgs ;; create-dsc) create_dsc "$@" ;; create-orig) create_orig "$@" ;; + *) usage ;; esac From ad2da59a6d850dae38a9cf82a8491bdec0e137dc Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 03:07:12 +0000 Subject: [PATCH 0460/1057] debian: don't build mod_managed It's broken too many of my recent builds. We can add it back in when things stabilize or perhaps after we get it to swig with a recent version of swig that we can make part of the clean bootstrap/build process. --- debian/bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index deed9f5c07..a724948577 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -31,6 +31,7 @@ avoid_mods=( endpoints/mod_reference endpoints/mod_unicall formats/mod_shout + languages/mod_managed languages/mod_spidermonkey sdk/autotools xml_int/mod_xml_ldap From cf68dc731a15f805fcb810c3eaf20cbc49eb400f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 04:20:52 +0000 Subject: [PATCH 0461/1057] debian: only build binary-indep packages once for each distro --- debian/util.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 1692fcadab..850558b1f4 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -234,9 +234,10 @@ EOF build_debs () { { set -e - local OPTIND OPTARG debug_hook=false hookdir="" - while getopts 'd' o "$@"; do + local OPTIND OPTARG debug_hook=false hookdir="" cow_build_opts="" + while getopts 'Bd' o "$@"; do case "$o" in + B) cow_build_opts="--debbuildopts '-B'";; d) debug_hook=true;; esac done @@ -261,7 +262,7 @@ build_debs () { } if ! [ -d $cow_img ]; then announce "Creating base $distro-$arch image..." - cow --create + cow --create $cow_build_opts fi announce "Updating base $distro-$arch image..." cow --update @@ -310,10 +311,12 @@ build_all () { local dsc="$(create_dsc $dsc_opts $distro $orig 2>../log/$distro | tail -n1)" echo "Done creating $distro dsc." >&2 if [ "${dsc:0:2}" = ".." ]; then + local lopts="" for arch in $archs; do { echo "Building $distro-$arch debs..." >&2 - local changes="$(build_debs $deb_opts $distro $dsc $arch 2>../log/$distro-$arch | tail -n1)" + local changes="$(build_debs $lopts $deb_opts $distro $dsc $arch 2>../log/$distro-$arch | tail -n1)" + lopts="-B" echo "Done building $distro-$arch debs." >&2 if [ "${changes:0:2}" = ".." ]; then echo "$changes" >> ../log/changes @@ -357,6 +360,7 @@ commands: build-debs + -B Binary architecture-dependent build -d Enable cowbuilder debug hook create-dbg-pkgs From 73b34cb373f94ec083bda2a5d4a96f486f3dfebe Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 04:33:16 +0000 Subject: [PATCH 0462/1057] debian: kill children if we exit unexpectedly --- debian/util.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index 850558b1f4..2f7362a26c 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -305,6 +305,7 @@ build_all () { mkdir -p ../log > ../log/changes echo; echo; echo; echo + trap 'echo "Killing children...">&2; for x in $(jobs -p); do kill $x; done' EXIT if [ "${orig:0:2}" = ".." ]; then for distro in $distros; do echo "Creating $distro dsc..." >&2 @@ -328,6 +329,7 @@ build_all () { done ! $par || wait fi + trap - EXIT cat ../log/changes } From 337c9d43653a01667a53ec911dd262f7cffc96b9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 15:17:10 +0000 Subject: [PATCH 0463/1057] debian: output the correct name of the .changes file --- debian/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 2f7362a26c..ec041be4bd 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -277,7 +277,7 @@ build_debs () { --hookdir "$hookdir" \ --buildresult ../ } 1>&2 - echo ${dsc}_${arch}.changes + echo ${dsc%.dsc}_${arch}.changes } build_all () { From c15613e0657285641fb6d550eed5065938b9258d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 16:09:39 +0000 Subject: [PATCH 0464/1057] debian: set variable outside fork --- debian/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index ec041be4bd..7844ff0de1 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -317,13 +317,13 @@ build_all () { { echo "Building $distro-$arch debs..." >&2 local changes="$(build_debs $lopts $deb_opts $distro $dsc $arch 2>../log/$distro-$arch | tail -n1)" - lopts="-B" echo "Done building $distro-$arch debs." >&2 if [ "${changes:0:2}" = ".." ]; then echo "$changes" >> ../log/changes fi } & $par || wait + lopts="-B" done fi done From ed9ff6e3755e607037ef8b8dd33cd19524ea1aad Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 16:18:53 +0000 Subject: [PATCH 0465/1057] debian: don't rebuild dsc files --- debian/util.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 7844ff0de1..9d87cde130 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -235,9 +235,10 @@ build_debs () { { set -e local OPTIND OPTARG debug_hook=false hookdir="" cow_build_opts="" - while getopts 'Bd' o "$@"; do + while getopts 'Bbd' o "$@"; do case "$o" in B) cow_build_opts="--debbuildopts '-B'";; + b) cow_build_opts="--debbuildopts '-b'";; d) debug_hook=true;; esac done @@ -312,7 +313,7 @@ build_all () { local dsc="$(create_dsc $dsc_opts $distro $orig 2>../log/$distro | tail -n1)" echo "Done creating $distro dsc." >&2 if [ "${dsc:0:2}" = ".." ]; then - local lopts="" + local lopts="-b" for arch in $archs; do { echo "Building $distro-$arch debs..." >&2 @@ -363,6 +364,7 @@ commands: build-debs -B Binary architecture-dependent build + -b Binary-only build -d Enable cowbuilder debug hook create-dbg-pkgs From 992e05667cbf72251504d93625f0c01ef20ac792 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 2 Jun 2012 17:30:48 +0000 Subject: [PATCH 0466/1057] debian: put the build options in the right place --- debian/util.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 9d87cde130..3f4fea312d 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -263,7 +263,7 @@ build_debs () { } if ! [ -d $cow_img ]; then announce "Creating base $distro-$arch image..." - cow --create $cow_build_opts + cow --create fi announce "Updating base $distro-$arch image..." cow --update @@ -276,7 +276,8 @@ build_debs () { fi cow --build $dsc \ --hookdir "$hookdir" \ - --buildresult ../ + --buildresult ../ \ + $cow_build_opts } 1>&2 echo ${dsc%.dsc}_${arch}.changes } From 6a7fe5411f6906cb4298af7cc445f2860450ea67 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Jun 2012 09:24:42 -0500 Subject: [PATCH 0467/1057] FS-4285 --resolve --- src/switch_json.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/switch_json.c b/src/switch_json.c index 83b34704e6..4bef601f8e 100644 --- a/src/switch_json.c +++ b/src/switch_json.c @@ -50,10 +50,11 @@ static char* cJSON_strdup(const char* str) { size_t len; char* copy; + const char *s = str ? str : ""; - len = strlen(str) + 1; + len = strlen(s) + 1; if (!(copy = (char*)cJSON_malloc(len))) return 0; - memcpy(copy,str,len); + memcpy(copy,s,len); return copy; } From d2bc9a2b12261d6b63174f3a09a61115b8fcd52e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Jun 2012 09:41:46 -0500 Subject: [PATCH 0468/1057] FS-4137 --- src/mod/endpoints/mod_sofia/sofia_glue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 65a6caf1e6..35e7ddf149 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4161,6 +4161,7 @@ int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly) int changed = 0; if (sofia_test_flag(tech_pvt, TFLAG_SLA_BARGE) || sofia_test_flag(tech_pvt, TFLAG_SLA_BARGING)) { + switch_channel_mark_hold(tech_pvt->channel, sendonly); return 0; } From 9b488fbffd6a3cd8ff370abe1404b93cd0ac21ec Mon Sep 17 00:00:00 2001 From: Raymond Chandler Date: Mon, 4 Jun 2012 15:16:30 -0400 Subject: [PATCH 0469/1057] pnp --- src/mod/endpoints/mod_sofia/mod_sofia.h | 6 +++- src/mod/endpoints/mod_sofia/sofia.c | 24 +++++++++++++ src/mod/endpoints/mod_sofia/sofia_presence.c | 38 ++++++++++++++++++-- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 247616d41c..8379c4bf93 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -28,6 +28,7 @@ * Paul D. Tinsley * Bret McDanel * Marcel Barbulescu + * Raymond Chandler * * * mod_sofia.h -- SOFIA SIP Endpoint @@ -517,7 +518,8 @@ struct sofia_gateway { typedef enum { PRES_TYPE_NONE = 0, PRES_TYPE_FULL = 1, - PRES_TYPE_PASSIVE = 2 + PRES_TYPE_PASSIVE = 2, + PRES_TYPE_PNP = 3 } sofia_presence_type_t; typedef enum { @@ -586,6 +588,8 @@ struct sofia_profile { char *rtcp_audio_interval_msec; char *rtcp_video_interval_msec; char *jb_msec; + char *pnp_prov_url; + char *pnp_notify_profile; sofia_cid_type_t cid_type; sofia_dtmf_t dtmf_type; int auto_restart; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 658a7f0b0b..1317963647 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2138,6 +2138,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("include-session-description")), TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")), TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")), + TAG_IF(profile->pres_type == PRES_TYPE_PNP, NUTAG_ALLOW_EVENTS("ua-profile")), NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name); @@ -4417,10 +4418,16 @@ switch_status_t config_sofia(int reload, char *profile_name) } else if (!strcasecmp(val, "bypass-media-after-att-xfer")) { profile->media_options |= MEDIA_OPT_BYPASS_AFTER_ATT_XFER; } + } else if (!strcasecmp(var, "pnp-provision-url")) { + profile->pnp_prov_url = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "pnp-notify-profile")) { + profile->pnp_notify_profile = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "manage-presence")) { if (!strcasecmp(val, "passive")) { profile->pres_type = PRES_TYPE_PASSIVE; + } else if (!strcasecmp(val, "pnp")) { + profile->pres_type = PRES_TYPE_PNP; } else if (switch_true(val)) { profile->pres_type = PRES_TYPE_FULL; } @@ -4875,6 +4882,23 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip); } + if (profile->pres_type == PRES_TYPE_PNP) { + if (!profile->pnp_prov_url) { + profile->pnp_prov_url = switch_core_sprintf(profile->pool, "http://%s/provision/", mod_sofia_globals.guess_ip); + } + + if (!profile->pnp_notify_profile) { + profile->pnp_notify_profile = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip); + } + + if (!profile->extsipip) { + profile->extsipip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "we're configured to provision to [%s] on profile [%s]\n", + profile->pnp_prov_url, profile->pnp_notify_profile); + } + config_sofia_profile_urls(profile); if (sofia_test_pflag(profile, PFLAG_TLS) && !profile->tls_cert_dir) { diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 23ae017531..c6ade27e1b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -27,6 +27,7 @@ * Ken Rice * Paul D. Tinsley * Bret McDanel + * Raymond Chandler * * * sofia_presence.c -- SOFIA SIP Endpoint (presence code) @@ -3273,7 +3274,9 @@ void sofia_presence_handle_sip_i_subscribe(int status, int sent_reply = 0; sip_contact_t const *contact; const char *ipv6; - const char *contact_user; + const char *contact_user = NULL; + const char *contact_host = NULL; + const char *contact_port = NULL; sofia_nat_parse_t np = { { 0 } }; int found_proto = 0; char to_tag[13] = ""; @@ -3295,8 +3298,11 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_stun_random_string(to_tag, 12, NULL); - //contact_host = sip->sip_contact->m_url->url_host; - contact_user = sip->sip_contact->m_url->url_user; + if ( sip->sip_contact && sip->sip_contact->m_url ) { + contact_host = sip->sip_contact->m_url->url_host; + contact_port = sip->sip_contact->m_url->url_port; + contact_user = sip->sip_contact->m_url->url_user; + } //tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); @@ -3645,6 +3651,32 @@ void sofia_presence_handle_sip_i_subscribe(int status, } } + if ( sip->sip_event && sip->sip_event->o_type && !strcasecmp(sip->sip_event->o_type, "ua-profile") && contact_host ) { + switch_event_t *params; + char *uri = NULL; + + if ( contact_port ) { + uri = switch_mprintf("sip:%s:%s", contact_host, contact_port); + } else { + uri = switch_mprintf("sip:%s", contact_host); + } + + if ( uri ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending pnp NOTIFY to %s\n", uri); + + switch_event_create(¶ms, SWITCH_EVENT_NOTIFY); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile", profile->pnp_notify_profile); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "event-string", sip->sip_event->o_type); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "to-uri", uri); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "from-uri", uri); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "content-type", "application/url"); + switch_event_add_body(params, profile->pnp_prov_url); + switch_event_fire(¶ms); + + switch_safe_free(uri); + } + } + end: if (strcasecmp(event, "call-info") && strcasecmp(event, "line-seize")) { From e4caea6ffd75b8674c9c5f96555c08ed7eea506b Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 4 Jun 2012 16:40:32 -0400 Subject: [PATCH 0470/1057] fix build error --- src/mod/endpoints/mod_sofia/sofia_presence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index c6ade27e1b..25daa18f8c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3670,7 +3670,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "to-uri", uri); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "from-uri", uri); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "content-type", "application/url"); - switch_event_add_body(params, profile->pnp_prov_url); + switch_event_add_body(params, "%s", profile->pnp_prov_url); switch_event_fire(¶ms); switch_safe_free(uri); From a065cf8631c9fe5b6d4350c061b6e5dcd671fa9f Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 5 Jun 2012 08:44:22 -0500 Subject: [PATCH 0471/1057] FS-4219 --resolve correct windows version --- libs/win32/util.vbs | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/libs/win32/util.vbs b/libs/win32/util.vbs index 29a7be5715..cbaf96a7b0 100644 --- a/libs/win32/util.vbs +++ b/libs/win32/util.vbs @@ -271,36 +271,38 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) strVerRev = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION") 'Set version to the one reported by configure.in - if strVerRev <> "" Then + If strVerRev <> "" Then VERSION = strVerRev End If Dim sLastFile Const ForReading = 1 - 'Try To read revision from git, if it's found, use this instead of strVerRev found above - If FSO.FolderExists(VersionDir & ".git") Then - VersionCmd="git log --format=" & quote & "%%h %%ci" & quote & " -1 HEAD" - Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) - MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) - MyFile.WriteLine("@" & VersionCmd) - MyFile.Close - Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote) - Do - strFromProc = Trim(OExec.StdOut.ReadLine()) - VERSION="git-" & strFromProc - Loop While Not OExec.StdOut.atEndOfStream - sLastVersion = "" - Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) - If Not sLastFile.atEndOfStream Then - sLastVersion = sLastFile.ReadLine() + 'Try To read revision from git, if it was not found in "configure.in" already + If strVerRev = "" Then + If FSO.FolderExists(VersionDir & ".git") Then + VersionCmd="git log --format=" & quote & "%%h %%ci" & quote & " -1 HEAD" + Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) + MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) + MyFile.WriteLine("@" & VersionCmd) + MyFile.Close + Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote) + Do + strFromProc = Trim(OExec.StdOut.ReadLine()) + VERSION="git-" & strFromProc + Loop While Not OExec.StdOut.atEndOfStream + sLastVersion = "" + Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) + If Not sLastFile.atEndOfStream Then + sLastVersion = sLastFile.ReadLine() + End If + sLastFile.Close + VERSION = Replace(VERSION, ":", "-") End If - sLastFile.Close - VERSION = Replace(VERSION, ":", "-") End If If VERSION = "" Then - VERSION = "UNKNOWN" + VERSION = "-UNKNOWN" End If If VERSION <> sLastVersion Then From 2983003f95bc7d2f3949ef4146b0c809a70d5fdd Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 5 Jun 2012 13:19:34 -0400 Subject: [PATCH 0472/1057] do update to state on channels table at hangup --- src/switch_core_sqldb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 50ba871e7b..ee726500ac 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1403,7 +1403,6 @@ static void core_event_handler(switch_event_t *event) switch (state_i) { case CS_NEW: - case CS_HANGUP: case CS_DESTROY: case CS_REPORTING: break; From b4bd30816e25be750f4b199d9cd3df2254c197db Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 5 Jun 2012 12:29:53 -0500 Subject: [PATCH 0473/1057] FS-4290 --resolve --- src/switch_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_time.c b/src/switch_time.c index 381d2dc5ad..d4f5454d3b 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -941,7 +941,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) runtime.timestamp = ts; current_ms += (runtime.microseconds_per_tick / 1000); - tick += (runtime.microseconds_per_tick / 1000); + tick++; if (time_sync < runtime.time_sync) { time_sync++; /* Only step once for each loop, we want to make sure to keep this thread safe */ From 2c9e1454fe421de5fa2668ac1dfcc43a9f369909 Mon Sep 17 00:00:00 2001 From: Viktor Krykun Date: Tue, 5 Jun 2012 23:24:37 +0300 Subject: [PATCH 0474/1057] various bug fixes in libzrtp * fixed bug with remote hello-hash buffer being too small * removed unused hello-hash storage in zrtp stream context * fixed bug with libzrtp rendered "empty" SAS hash from incoming SasRelay packet * incremented libzrtp version number to 1.15 Signed-off-by: Travis Cross --- libs/libzrtp/include/zrtp_types.h | 16 ++++------ libs/libzrtp/include/zrtp_version.h | 6 ++-- libs/libzrtp/projects/gnu/configure.in | 2 +- libs/libzrtp/src/zrtp.c | 8 ++--- libs/libzrtp/src/zrtp_pbx.c | 44 ++++++++++++++++++-------- libs/libzrtp/src/zrtp_utils.c | 2 +- 6 files changed, 46 insertions(+), 32 deletions(-) diff --git a/libs/libzrtp/include/zrtp_types.h b/libs/libzrtp/include/zrtp_types.h index a38d118591..c5c7654d68 100644 --- a/libs/libzrtp/include/zrtp_types.h +++ b/libs/libzrtp/include/zrtp_types.h @@ -527,7 +527,12 @@ typedef struct zrtp_stream_mescache_t zrtp_retry_task_t errorack_task; zrtp_retry_task_t sasrelay_task; - zrtp_string16_t signaling_hash; + /*! + * Hash pre-image of the remote party Hello retrieved from Signaling. When + * user calls zrtp_signaling_hash_set() libzrtp stores hash value in this + * variable and checks all incoming Hello-s to prevent DOS attacks. + */ + zrtp_string64_t signaling_hash; } zrtp_stream_mescache_t; @@ -722,14 +727,7 @@ struct zrtp_stream_t * crypto sources and performs traffic encryption/decryption. */ zrtp_protocol_t *protocol; - - /*! - * Hash pre-image of the remote party Hello retrieved from Signaling. When - * user calls zrtp_signaling_hash_set() libzrtp stores hash value in this - * variable and checks all incoming Hellos to prevent DOS attacks. - */ - zrtp_string128_t signaling_hash; - + /*!< Holder for RTP/ZRTP media stream options. */ zrtp_media_context_t media_ctx; diff --git a/libs/libzrtp/include/zrtp_version.h b/libs/libzrtp/include/zrtp_version.h index 5afc3b76af..e666e42cb9 100644 --- a/libs/libzrtp/include/zrtp_version.h +++ b/libs/libzrtp/include/zrtp_version.h @@ -12,8 +12,8 @@ #define LIBZRTP_VERSION_MAJOR 1 -#define LIBZRTP_VERSION_MINOR 13 -#define LIBZRTP_VERSION_BUILD 604 -#define LIBZRTP_VERSION_STR "v1.13 604" +#define LIBZRTP_VERSION_MINOR 15 +#define LIBZRTP_VERSION_BUILD 607 +#define LIBZRTP_VERSION_STR "v1.15 607" #endif /*__ZRTP_VERSION_H__*/ diff --git a/libs/libzrtp/projects/gnu/configure.in b/libs/libzrtp/projects/gnu/configure.in index d25d41771a..7d97319a76 100644 --- a/libs/libzrtp/projects/gnu/configure.in +++ b/libs/libzrtp/projects/gnu/configure.in @@ -32,7 +32,7 @@ case $target_os in esac -AM_INIT_AUTOMAKE([libzrtp], [1.14]) +AM_INIT_AUTOMAKE([libzrtp], [1.15]) AX_PREFIX_CONFIG_H(../../include/zrtp_config_unix.h,ZRTP,config/config.h) CFLAGS="$CFLAGS -Wno-unused-parameter -fno-strict-aliasing -fPIC -DZRTP_AUTOMAKE=1" diff --git a/libs/libzrtp/src/zrtp.c b/libs/libzrtp/src/zrtp.c index d0002a7d3d..c69b5e9692 100644 --- a/libs/libzrtp/src/zrtp.c +++ b/libs/libzrtp/src/zrtp.c @@ -418,8 +418,6 @@ zrtp_status_t zrtp_stream_attach(zrtp_session_t *session, zrtp_stream_t** stream return zrtp_status_alloc_fail; } - ZSTR_SET_EMPTY(new_stream->signaling_hash); - /* * Initialize the private data stream with default initial values */ @@ -437,6 +435,8 @@ zrtp_status_t zrtp_stream_attach(zrtp_session_t *session, zrtp_stream_t** stream ZSTR_SET_EMPTY(new_stream->cc.zrtp_key); ZSTR_SET_EMPTY(new_stream->cc.peer_zrtp_key); + ZSTR_SET_EMPTY(new_stream->messages.signaling_hash); + new_stream->dh_cc.initialized_with = ZRTP_COMP_UNKN; bnBegin(&new_stream->dh_cc.peer_pv); ZSTR_SET_EMPTY(new_stream->dh_cc.dhss); @@ -638,8 +638,8 @@ zrtp_status_t zrtp_signaling_hash_set( zrtp_stream_t* ctx, ctx->messages.signaling_hash.length = ZRTP_MESSAGE_HASH_SIZE; { - char buff[66]; - ZRTP_LOG(3, (_ZTU_,"SIGNALLING HAS was ADDED for the comparing. ID=%u\n", ctx->id)); + char buff[64]; + ZRTP_LOG(3, (_ZTU_,"SIGNALLING HAS was ADDED for the comparision. ID=%u\n", ctx->id)); ZRTP_LOG(3, (_ZTU_,"Hash=%s.\n", hex2str(hash_buff, hash_buff_length, buff, sizeof(buff)))); } diff --git a/libs/libzrtp/src/zrtp_pbx.c b/libs/libzrtp/src/zrtp_pbx.c index 3567d4a47b..cc25c46b3e 100644 --- a/libs/libzrtp/src/zrtp_pbx.c +++ b/libs/libzrtp/src/zrtp_pbx.c @@ -128,13 +128,15 @@ zrtp_status_t _zrtp_machine_process_sasrelay(zrtp_stream_t *stream, zrtp_rtp_inf zrtp_status_t s = zrtp_status_fail; zrtp_string128_t hmac = ZSTR_INIT_EMPTY(hmac); char zerosashash[32]; + unsigned sas_scheme_did_change = 0; + unsigned sas_hash_did_change = 0; /* (padding + sig_len + flags) + SAS scheme and SAS hash */ const uint8_t encrypted_body_size = (2 + 1 + 1) + 4 + 32; zrtp_memset(zerosashash, 0, sizeof(zerosashash)); - /* Check if the remote endpoint is assiggneed to relay the SAS values */ + /* Check if the remote endpoint is assigned to relay the SAS values */ if (!stream->peer_mitm_flag) { ZRTP_LOG(2,(_ZTU_, ZRTP_RELAYED_SAS_FROM_NONMITM_STR)); return zrtp_status_fail; @@ -157,7 +159,7 @@ zrtp_status_t _zrtp_machine_process_sasrelay(zrtp_stream_t *stream, zrtp_rtp_inf return zrtp_status_fail; } - ZRTP_LOG(3,(_ZTU_, "\tHMAC value for the SASRELAY is correct - decryptiong...\n")); + ZRTP_LOG(3,(_ZTU_, "\tHMAC value for the SASRELAY is correct - decrypting...\n")); /* Then we need to decrypt Confirm body */ do @@ -217,9 +219,14 @@ zrtp_status_t _zrtp_machine_process_sasrelay(zrtp_stream_t *stream, zrtp_rtp_inf _zrtp_machine_enter_initiatingerror(stream, zrtp_error_invalid_packet, 1); return zrtp_status_fail; } - session->sasscheme = zrtp_comp_find(ZRTP_CC_SAS, rendering_id, session->zrtp ); - ZRTP_LOG(3,(_ZTU_,"\tSasrelay: New Rendering scheme %.4s.\n", session->sasscheme->base.type)); + /* Check is SAS rendering did change */ + if (rendering_id != session->sasscheme->base.id) { + session->sasscheme = zrtp_comp_find(ZRTP_CC_SAS, rendering_id, session->zrtp ); + + sas_scheme_did_change = 1; + ZRTP_LOG(3,(_ZTU_,"\tSasrelay: Rendering scheme was updated to %.4s.\n", session->sasscheme->base.type)); + } if (session->secrets.matches & ZRTP_BIT_PBX) { if ( ( ((uint32_t) *sasrelay->sas_scheme) != (uint32_t)0x0L ) && @@ -231,7 +238,8 @@ zrtp_status_t _zrtp_machine_process_sasrelay(zrtp_stream_t *stream, zrtp_rtp_inf zrtp_memcpy(session->sasbin.buffer, sasrelay->sashash, session->sasbin.length); stream->mitm_mode = ZRTP_MITM_MODE_RECONFIRM_CLIENT; - ZRTP_LOG(3,(_ZTU_,"\tSasRelay: SAS value was updated bin=%s.\n", + sas_hash_did_change = 1; + ZRTP_LOG(3,(_ZTU_,"\tSasRelay: SAS value was updated to bin=%s.\n", hex2str(buff, sizeof(buff), session->sasbin.buffer, session->sasbin.length))); } } else if (0 != zrtp_memcmp(sasrelay->sashash, zerosashash, sizeof(sasrelay->sashash))) { @@ -242,16 +250,24 @@ zrtp_status_t _zrtp_machine_process_sasrelay(zrtp_stream_t *stream, zrtp_rtp_inf ZRTP_LOG(1,(_ZTU_, "\rERROR! For SasRelay Other secret doesn't match. ID=%u\n", stream->id)); } - s = session->sasscheme->compute(session->sasscheme, stream, session->hash, 1); - if (zrtp_status_ok != s) { - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - return s; - } - ZRTP_LOG(3,(_ZTU_,"\tSasRelay: Updated SAS is <%s> <%s>.\n", session->sas1.buffer, session->sas2.buffer)); + /* Generate new SAS if hash or rendering scheme did change. + * Note: latest libzrtp may send "empty" SasRelay with the same SAS rendering + * scheme and empty Hello hash for consistency reasons, we should ignore + * such packets. + */ + if (sas_scheme_did_change || sas_hash_did_change) { + s = session->sasscheme->compute(session->sasscheme, stream, session->hash, 1); + if (zrtp_status_ok != s) { + _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); + return s; + } - if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { - session->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_LOCAL_SAS_UPDATED); + ZRTP_LOG(3,(_ZTU_,"\tSasRelay: Updated SAS is <%s> <%s>.\n", session->sas1.buffer, session->sas2.buffer)); + + if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { + session->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_LOCAL_SAS_UPDATED); + } } return zrtp_status_ok; @@ -492,7 +508,7 @@ zrtp_status_t zrtp_update_remote_options( zrtp_stream_t* stream, return zrtp_status_bad_param; } - /* Don't allow to transfer the SAS if the library wasn't initalized as MiTM endpoint */ + /* Don't allow to transfer the SAS if the library wasn't initialized as MiTM endpoint */ if (!stream->zrtp->is_mitm) { ZRTP_LOG(3,(_ZTU_,"\tERROR! The endpoint can't transfer SAS values to other endpoints" " without introducing itself by M-flag in Hello. see zrtp_init().\n")); diff --git a/libs/libzrtp/src/zrtp_utils.c b/libs/libzrtp/src/zrtp_utils.c index 7b61aac146..45b5290d85 100644 --- a/libs/libzrtp/src/zrtp_utils.c +++ b/libs/libzrtp/src/zrtp_utils.c @@ -488,7 +488,7 @@ zrtp_status_t _zrtp_packet_preparse( zrtp_stream_t* stream, (const char*) info->message, zrtp_ntoh16(((zrtp_packet_Hello_t*) info->message)->hdr.length)*4, ZSTR_GV(hash_str) ); - if (!zrtp_memcmp(stream->messages.signaling_hash.buffer, hash_str.buffer, ZRTP_MESSAGE_HASH_SIZE)) { + if (zrtp_memcmp(stream->messages.signaling_hash.buffer, hash_str.buffer, ZRTP_MESSAGE_HASH_SIZE)) { if (stream->zrtp->cb.event_cb.on_zrtp_security_event) { stream->zrtp->cb.event_cb.on_zrtp_security_event(stream, ZRTP_EVENT_WRONG_SIGNALING_HASH); } From 20f20c8a5ce75ba0c6c1fcf6fa2d274144762fb4 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 7 Jun 2012 10:06:09 -0500 Subject: [PATCH 0475/1057] FS-4248 prevent seg for unsupported say method --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 08d1fcd5a4..8f50fe1257 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2976,7 +2976,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *ses } } - if ((si = switch_loadable_module_get_say_interface(module_name))) { + if ((si = switch_loadable_module_get_say_interface(module_name)) && si->say_string_function) { /* should go back and proto all the say mods to const.... */ switch_say_args_t say_args = {0}; From a6bb4545ebf7ffc773e6bc7ab399a3863ca09246 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 7 Jun 2012 13:00:52 -0500 Subject: [PATCH 0476/1057] FS-4293 --- src/mod/endpoints/mod_sofia/sofia_glue.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 35e7ddf149..105262977c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -350,7 +350,7 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, tech_pvt->local_sdp_audio_zrtp_hash); } - if (sr) { + if (!zsttr(sr)) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=%s\n", sr); } } @@ -434,7 +434,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch verbose_sdp = 1; } - if (!force && !ip && !sr + if (!force && !ip && zstr(sr) && (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) { return; } @@ -465,7 +465,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch sofia_glue_sdp_map(b_sdp, &map, &ptmap); } - if (!sr) { + if (zstr(sr)) { if ((var_val = switch_channel_get_variable(tech_pvt->channel, "media_audio_mode"))) { sr = var_val; } else { @@ -485,7 +485,9 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch if ((tech_pvt->profile->ndlb & PFLAG_NDLB_SENDRECV_IN_SESSION) || ((var_val = switch_channel_get_variable(tech_pvt->channel, "ndlb_sendrecv_in_session")) && switch_true(var_val))) { - switch_snprintf(srbuf, sizeof(srbuf), "a=%s\n", sr); + if (!zstr(sr)) { + switch_snprintf(srbuf, sizeof(srbuf), "a=%s\n", sr); + } sr = NULL; } @@ -554,7 +556,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch tech_pvt->local_sdp_audio_zrtp_hash); } - if (sr) { + if (!zstr(sr)) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr); } From 49666cee8d537929f5432da6bc080f4c94a55abd Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 7 Jun 2012 19:49:30 +0000 Subject: [PATCH 0477/1057] add some sofia debugging for the local SDP Related to issue FS-4293. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 105262977c..c0f4001da6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2598,6 +2598,11 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) tech_pvt->session_refresher = nua_no_refresher; } + if (tech_pvt->local_sdp_str) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, + "Local SDP:\n%s\n", tech_pvt->local_sdp_str); + } + if (sofia_use_soa(tech_pvt)) { nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), From 9c463fdbdc7ceac84d7fc28cfcebeb4c15e87c14 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 7 Jun 2012 20:12:04 +0000 Subject: [PATCH 0478/1057] fix typo This amends commit a6bb4545ebf7ffc773e6bc7ab399a3863ca09246. --- 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 c0f4001da6..3a215c3529 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -350,7 +350,7 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, tech_pvt->local_sdp_audio_zrtp_hash); } - if (!zsttr(sr)) { + if (!zstr(sr)) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=%s\n", sr); } } From 19db96d2ba9053558ac1d21362f5270b9383e097 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Fri, 8 Jun 2012 17:23:07 +0200 Subject: [PATCH 0479/1057] channel private is already removed we don't need to remove the state handler FS-3432 --- src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index fc38f9e2b2..5d2c516e2c 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -348,7 +348,6 @@ static void destroy_session_elem(session_elem_t *session_element) } switch_channel_set_private(channel, "_erlang_session_", NULL); - switch_core_event_hook_remove_state_change(session, state_handler); switch_channel_clear_flag(channel, CF_CONTROLLED); switch_core_session_rwunlock(session); } From ae4d3acbb38fa481467a63526a90fdea7f211a84 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Fri, 8 Jun 2012 17:24:23 +0200 Subject: [PATCH 0480/1057] cleanup FS-3432 --- src/mod/event_handlers/mod_erlang_event/handle_msg.c | 6 +----- src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 5ff207e1a1..c1c682c867 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -499,10 +499,8 @@ static switch_status_t handle_msg_setevent(listener_t *listener, erlang_msg *msg switch_event_types_t type; int i = 0; - /* TODO listener write lock */ - /* clear any previous event registrations */ - for( x = 0; x <= SWITCH_EVENT_ALL; x++){ + for(x = 0; x <= SWITCH_EVENT_ALL; x++) { event_list[x] = 0; } @@ -566,14 +564,12 @@ static switch_status_t handle_msg_session_setevent(listener_t *listener, erlang_ switch_event_types_t type; uint32_t x = 0; - /* TODO session write lock */ /* clear any previous event registrations */ for (x = 0; x <= SWITCH_EVENT_ALL; x++){ event_list[x] = 0; } /* create new hash */ - /* TODO make thread safe*/ switch_core_hash_init(&event_hash, session->pool); for (i = 1; i < arity; i++){ diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 5d2c516e2c..b1caa67e3a 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -676,7 +676,6 @@ static switch_status_t check_attached_sessions(listener_t *listener) switch_thread_rwlock_wrlock(listener->session_rwlock); /* do the deferred remove */ - /* TODO refactor find_session_elem_by_uuid*/ for (header = event->headers; header; header = header->next) { if ((sp = (session_elem_t*)switch_core_hash_find(listener->sessions, header->value))) { remove_session_elem_from_listener(listener, sp); From dc30013360d28bcdb73a287f4420dcc13dd4ea1c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 8 Jun 2012 16:09:26 +0000 Subject: [PATCH 0481/1057] fix buffer length calculation in call to generate_m This error was causing us to call generate_m with a buffer length that was less than the strlen of the buffer we were passing. The result was truncated local SDP which would cause sofia to fail if the truncation was in a particularly bad place. Thanks to Anthony Minessale for the fix and working with me to diagnose the issue. FS-4293 --resolve --- 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 3a215c3529..9bc9ae02ff 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -621,7 +621,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch 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); + generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1); bp = (buf + strlen(buf)); /* asterisk can't handle AVP and SAVP in sep streams, way to blow off the spec....*/ From 086f6174422b68ea180e5db8880f5f1a6882f2af Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 8 Jun 2012 16:13:50 +0000 Subject: [PATCH 0482/1057] increase buffer size for local SDP There are a lot of codecs these days, and some clients offer all of them. If we run out of space in this buffer our local SDP will get silently truncated, which will cause a difficult to diagnose error in Sofia-SIP. Thanks to Anthony Minessale. FS-4293 --resolve --- 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 9bc9ae02ff..6376e86149 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -375,7 +375,7 @@ void sofia_glue_check_dtmf_type(private_object_t *tech_pvt) void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch_port_t port, const char *sr, int force) { - char buf[2048]; + char buf[65536]; int ptime = 0; uint32_t rate = 0; uint32_t v_port; From 9c94ac312e62b201b6af1cd86bab0c7f891009d5 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Fri, 8 Jun 2012 18:12:33 +0000 Subject: [PATCH 0483/1057] Fix Ubuntu 11.10 compiler error on unchecked write() return value. --- src/mod/timers/mod_posix_timer/mod_posix_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index cfb6584701..3d33b864db 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -113,7 +113,9 @@ static void timer_signal_handler(int sig, siginfo_t *si, void *cu) if (val >= 0 && val <= MAX_ACTIVE_TIMERS) { uint8_t active_id = (uint8_t)val; /* notify runtime thread that timer identified by active_id has ticked */ - write(globals.timer_tick_pipe[1], &active_id, 1); + if (write(globals.timer_tick_pipe[1], &active_id, 1) == -1) { + /* don't actually care about this error- this is only to make the compiler happy */ + } } } } From a17027959dc84748a5fdc38ce9a6e3ed51992c41 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Jun 2012 12:06:35 -0500 Subject: [PATCH 0484/1057] use a dummy event here --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d71a6fa70e..c2862d8ab2 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 @@ -1185,7 +1185,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, } count++; if (count == 1) { - switch_event_create(event, SWITCH_EVENT_SOCKET_DATA); + switch_event_create(event, SWITCH_EVENT_CLONE); switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Command", mbuf); } else if (cur) { char *var, *val; From fc2bb00eb19edc245ae6e9bcdff814c07f1e603b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Jun 2012 12:43:50 -0500 Subject: [PATCH 0485/1057] FS-4298 --resolve var is called execute_on_sip_reinvite --- src/mod/endpoints/mod_sofia/sofia.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 1317963647..78036c1895 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7669,6 +7669,11 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session, tagi_t tags[]) { char *call_info = NULL; + switch_channel_t *channel = NULL; + + if (session) { + channel = switch_core_session_get_channel(session); + } if (session && profile && sip && sofia_test_pflag(profile, PFLAG_TRACK_CALLS)) { switch_channel_t *channel = switch_core_session_get_channel(session); @@ -7693,7 +7698,6 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session, } if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { - switch_channel_t *channel = switch_core_session_get_channel(session); if (channel && sip->sip_call_info) { char *p; if ((call_info = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_call_info))) { @@ -7707,6 +7711,11 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session, } } } + + if (channel) { + switch_channel_execute_on(channel, "execute_on_sip_reinvite"); + } + } void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, From 83f230cce6e0d9a54631ee29c91c7661120eaf34 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Mon, 11 Jun 2012 15:00:32 +0200 Subject: [PATCH 0486/1057] fix possible memory leak FS-3432 --- src/mod/event_handlers/mod_erlang_event/handle_msg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index c1c682c867..527828f1f7 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -805,7 +805,7 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_ value = malloc(size + 1); if (ei_decode_string(buf->buff, &buf->index, value)) { - fail = SWITCH_TRUE; + fail = SWITCH_TRUE; break; } @@ -818,6 +818,7 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_ ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "badarg"); + switch_event_destroy(&event); } else { if (switch_core_session_queue_private_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { ei_x_encode_atom(rbuf, "ok"); @@ -825,6 +826,7 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_ ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "badmem"); + switch_event_destroy(&event); } } From d2e9e46eb6fd1a603c52727d1a77df9638899e7c Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Mon, 11 Jun 2012 15:03:58 +0200 Subject: [PATCH 0487/1057] move session destroy to one place and hangup in others to eliminate races and minimize session hash wrlocks FS-3432 --- .../mod_erlang_event/mod_erlang_event.c | 80 +++++++++++-------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index b1caa67e3a..9960e2499d 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -55,6 +55,8 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_nodename, prefs.nodename); static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj); static void launch_listener_thread(listener_t *listener); +session_elem_t *find_session_elem_by_uuid(listener_t *listener, const char *uuid); + static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level) { listener_t *l; @@ -135,14 +137,7 @@ static void send_event_to_attached_sessions(listener_t *listener, switch_event_t return; } - - switch_thread_rwlock_rdlock(listener->session_rwlock); - if ((s = (session_elem_t*)switch_core_hash_find(listener->sessions, uuid))) { - switch_thread_rwlock_rdlock(s->rwlock); - } - switch_thread_rwlock_unlock(listener->session_rwlock); - - if (s) { + if ((s = (session_elem_t*)find_session_elem_by_uuid(listener, uuid))) { int send = 0; switch_thread_rwlock_rdlock(s->event_rwlock); @@ -296,7 +291,7 @@ static void remove_listener(listener_t *listener) } /* Search for a listener already talking to the specified node and lock for reading*/ -static listener_t *find_listener_locked(char *nodename) +static listener_t *find_listener(char *nodename) { listener_t *l = NULL; @@ -321,14 +316,9 @@ static void add_session_elem_to_listener(listener_t *listener, session_elem_t *s static void remove_session_elem_from_listener(listener_t *listener, session_elem_t *session_element) -{ - switch_core_hash_delete(listener->sessions, session_element->uuid_str); -} - -static void remove_session_elem_from_listener_locked(listener_t *listener, session_elem_t *session_element) { switch_thread_rwlock_wrlock(listener->session_rwlock); - remove_session_elem_from_listener(listener, session_element); + switch_core_hash_delete(listener->sessions, session_element->uuid_str); switch_thread_rwlock_unlock(listener->session_rwlock); } @@ -343,10 +333,6 @@ static void destroy_session_elem(session_elem_t *session_element) if ((session = switch_core_session_locate(session_element->uuid_str))) { switch_channel_t *channel = switch_core_session_get_channel(session); - if (switch_channel_get_state(channel) < CS_HANGUP) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_WARNING, "Outbound session for %s exited unexpectedly!\n", session_element->uuid_str); - } - switch_channel_set_private(channel, "_erlang_session_", NULL); switch_channel_clear_flag(channel, CF_CONTROLLED); switch_core_session_rwunlock(session); @@ -354,6 +340,19 @@ static void destroy_session_elem(session_elem_t *session_element) switch_core_destroy_memory_pool(&session_element->pool); } +session_elem_t *find_session_elem_by_uuid(listener_t *listener, const char *uuid) +{ + session_elem_t *session = NULL; + + switch_thread_rwlock_rdlock(listener->session_rwlock); + if ((session = (session_elem_t*)switch_core_hash_find(listener->sessions, uuid))) { + switch_thread_rwlock_rdlock(session->rwlock); + } + + switch_thread_rwlock_unlock(listener->session_rwlock); + + return session; + } session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid) { @@ -362,14 +361,17 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid) void *val = NULL; session_elem_t *session = NULL; + switch_thread_rwlock_rdlock(listener->session_rwlock); for (iter = switch_hash_first(NULL, listener->sessions); iter; iter = switch_hash_next(iter)) { switch_hash_this(iter, &key, NULL, &val); if (((session_elem_t*)val)->process.type == ERLANG_PID && !ei_compare_pids(pid, &((session_elem_t*)val)->process.pid)) { session = (session_elem_t*)val; + switch_thread_rwlock_rdlock(session->rwlock); break; } } + switch_thread_rwlock_unlock(listener->session_rwlock); return session; } @@ -536,6 +538,7 @@ static switch_status_t notify_new_session(listener_t *listener, session_elem_t * if (!(session = switch_core_session_locate(session_element->uuid_str))) { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_WARNING, "Can't locate session %s\n", session_element->uuid_str); + switch_event_destroy(&call_event); return SWITCH_STATUS_FALSE; } @@ -672,19 +675,16 @@ static switch_status_t check_attached_sessions(listener_t *listener) } } switch_thread_rwlock_unlock(listener->session_rwlock); - /* release the read lock and get a write lock */ - switch_thread_rwlock_wrlock(listener->session_rwlock); - /* do the deferred remove */ + /* do the deferred remove */ for (header = event->headers; header; header = header->next) { - if ((sp = (session_elem_t*)switch_core_hash_find(listener->sessions, header->value))) { + if ((sp = (session_elem_t*)find_session_elem_by_uuid(listener, header->value))) { remove_session_elem_from_listener(listener, sp); + switch_thread_rwlock_unlock(sp->rwlock); destroy_session_elem(sp); } } - switch_thread_rwlock_unlock(listener->session_rwlock); - /* remove the temporary event */ switch_event_destroy(&event); @@ -783,13 +783,23 @@ static void handle_exit(listener_t *listener, erlang_pid * pid) remove_binding(NULL, pid); /* TODO - why don't we pass the listener as the first argument? */ - /* TODO - eliminate session destroy races and we shouldn't lock the session hash */ - switch_thread_rwlock_wrlock(listener->session_rwlock); if ((s = find_session_elem_by_pid(listener, pid))) { - remove_session_elem_from_listener(listener, s); - destroy_session_elem(s); + switch_core_session_t *session = NULL; + + if ((session = switch_core_session_locate(s->uuid_str))) { + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (switch_channel_get_state(channel) < CS_HANGUP) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Outbound session exited unexpectedly %s!\n", s->uuid_str); + } + + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_core_session_rwunlock(session); + } + + switch_thread_rwlock_unlock(s->rwlock); + } - switch_thread_rwlock_wrlock(listener->session_rwlock); if (listener->log_process.type == ERLANG_PID && !ei_compare_pids(&listener->log_process.pid, pid)) { @@ -1214,7 +1224,6 @@ static listener_t *new_outbound_listener_locked(char *node) return NULL; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "new listener for %s\n", node); listener = new_listener(&ec, clientfd); listener->peer_nodename = switch_core_strdup(listener->pool, node); } @@ -1410,10 +1419,11 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul switch_thread_cond_timedwait(p->ready_or_found, p->mutex, 5000000); if (!p->pid) { + switch_channel_t *channel = switch_core_session_get_channel(session); + p->state = reply_timeout; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Timed out when waiting for outbound pid %s %s\n", hash, session_element->uuid_str); - remove_session_elem_from_listener_locked(listener, session_element); - destroy_session_elem(session_element); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return NULL; } @@ -1500,7 +1510,7 @@ SWITCH_STANDARD_APP(erlang_outbound_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n", argv[0], node); /* first work out if there is a listener already talking to the node we want to talk to */ - listener = find_listener_locked(node); + listener = find_listener(node); /* if there is no listener, then create one */ if (!listener) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new listener for session\n"); @@ -1567,7 +1577,7 @@ SWITCH_STANDARD_APP(erlang_sendmsg_function) ei_x_encode_atom(&buf, "freeswitch_sendmsg"); _ei_x_encode_string(&buf, argv[2]); - listener = find_listener_locked(node); + listener = find_listener(node); if (!listener) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new listener for sendmsg %s\n", node); listener = new_outbound_listener_locked(node); From 187fe4e14e651d52dd9f0866ac6a2246fb6f9086 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Mon, 11 Jun 2012 13:05:29 +0000 Subject: [PATCH 0488/1057] update name/e-mail address --- src/mod/applications/mod_dptools/mod_dptools.c | 2 +- src/mod/applications/mod_http_cache/mod_http_cache.c | 4 ++-- src/mod/applications/mod_spandsp/mod_spandsp.c | 2 +- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 2 +- src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 6 +++--- src/mod/codecs/mod_speex/mod_speex.c | 2 +- src/mod/timers/mod_posix_timer/mod_posix_timer.c | 4 ++-- src/switch_core_asr.c | 2 +- src/switch_core_codec.c | 2 +- src/switch_core_speech.c | 2 +- src/switch_ivr_async.c | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 009088e9f9..12cab2cf66 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -30,7 +30,7 @@ * Bret McDanel * Luke Dashjr (OpenMethods, LLC) * Cesar Cepeda - * Chris Rienzo + * Christopher M. Rienzo * * mod_dptools.c -- Raw Audio File Streaming Application Module * diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index fb2b4e09a2..381b30bddd 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -23,9 +23,9 @@ * * Contributor(s): * - * Christopher M. Rienzo + * Christopher M. Rienzo * - * Maintainer: Christopher M. Rienzo + * Maintainer: Christopher M. Rienzo * * mod_http_cache.c -- HTTP GET with caching * -- designed for downloading audio files from a webserver for playback diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index c210e02c0e..8cfe9d1e24 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -29,7 +29,7 @@ * Brian West * Steve Underwood * Antonio Gallo - * Christopher M. Rienzo + * Christopher M. Rienzo * mod_spandsp.c -- Module implementing spandsp fax, dsp, and codec functionality * */ diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 144d02ef8d..cc4d4964e2 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -28,7 +28,7 @@ * Anthony Minessale II * Steve Underwood * Antonio Gallo - * Christopher M. Rienzo + * Christopher M. Rienzo * mod_spandsp_dsp.c -- dsp applications provided by SpanDSP * */ diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index e53964277c..aaf8f8764a 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH mod_unimrcp * * The Initial Developer of the Original Code is - * Christopher M. Rienzo + * Christopher M. Rienzo * * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. @@ -25,10 +25,10 @@ * Contributor(s): * * Brian West - * Christopher M. Rienzo + * Christopher M. Rienzo * Luke Dashjr (OpenMethods, LLC) * - * Maintainer: Christopher M. Rienzo + * Maintainer: Christopher M. Rienzo * * mod_unimrcp.c -- UniMRCP module (MRCP client) * diff --git a/src/mod/codecs/mod_speex/mod_speex.c b/src/mod/codecs/mod_speex/mod_speex.c index ab9a044b53..8416686373 100644 --- a/src/mod/codecs/mod_speex/mod_speex.c +++ b/src/mod/codecs/mod_speex/mod_speex.c @@ -24,7 +24,7 @@ * Contributor(s): * * Anthony Minessale II - * Chris Rienzo + * Christopher M. Rienzo * * * mod_speex.c -- Speex Codec Module diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index 3d33b864db..1cd4586cdc 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -22,10 +22,10 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Christopher M. Rienzo + * Christopher M. Rienzo * Timo Teräs (based on mod_timerfd.c) * - * Maintainer: Christopher M. Rienzo + * Maintainer: Christopher M. Rienzo * * mod_posix_timer.c -- soft timer implemented with POSIX timers (timer_create/timer_settime/timer_getoverrun) * diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index 4db889929c..e10928f29d 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -26,7 +26,7 @@ * Anthony Minessale II * Michael Jerris * Paul D. Tinsley - * Christopher M. Rienzo + * Christopher M. Rienzo * Luke Dashjr (OpenMethods, LLC) * * diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index e7fa3f3fe7..1a529501ad 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -26,7 +26,7 @@ * Anthony Minessale II * Michael Jerris * Paul D. Tinsley - * Chris Rienzo + * Christopher M. Rienzo * * * switch_core_codec.c -- Main Core Library (codec functions) diff --git a/src/switch_core_speech.c b/src/switch_core_speech.c index f0e97f8b28..b75c9f843b 100644 --- a/src/switch_core_speech.c +++ b/src/switch_core_speech.c @@ -26,7 +26,7 @@ * Anthony Minessale II * Michael Jerris * Paul D. Tinsley - * Christopher M. Rienzo + * Christopher M. Rienzo * * * switch_core_speech.c -- Main Core Library (speech functions) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 37da4f0486..c684c8f14c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -27,7 +27,7 @@ * Michael Jerris * Bret McDanel * Luke Dashjr (OpenMethods, LLC) - * Chris Rienzo + * Christopher M. Rienzo * * switch_ivr_async.c -- IVR Library (async operations) * From ec27618fc8821af1446540d4963869a1f9be6572 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 11 Jun 2012 10:43:42 -0400 Subject: [PATCH 0489/1057] don't segfault after starting sofia, upon xml_open_config lookup failure for the profile from launch_sofia_worker_thread --- src/mod/endpoints/mod_sofia/sofia.c | 6 +++++- src/switch_apr.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 78036c1895..13e632af9f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2252,7 +2252,11 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void sofia_clear_pflag_locked(profile, PFLAG_SHUTDOWN); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); - switch_thread_join(&st, worker_thread); + if ( worker_thread ) { + switch_thread_join(&st, worker_thread); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Sofia worker thead failed to start\n"); + } sanity = 4; while (profile->inuse) { diff --git a/src/switch_apr.c b/src/switch_apr.c index 426bed59f5..5936c7223e 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -1169,6 +1169,11 @@ SWITCH_DECLARE(switch_status_t) switch_thread_exit(switch_thread_t *thd, switch_ */ SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, switch_thread_t *thd) { + if ( !thd ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Attempting to join thread that does not exist\n"); + return SWITCH_STATUS_FALSE; + } + return apr_thread_join((apr_status_t *) retval, (apr_thread_t *) thd); } From 3f6b5a5c013f6f80544c5b35ec5032c53cad5738 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Mon, 11 Jun 2012 17:25:28 +0200 Subject: [PATCH 0490/1057] fix reply timeout: move hash and pid to session pool FS-3432 --- .../mod_erlang_event/handle_msg.c | 18 +++++------------- .../mod_erlang_event/mod_erlang_event.c | 4 +--- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 527828f1f7..0e8d472585 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -1108,7 +1108,7 @@ static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, e static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf) { erlang_ref ref; - erlang_pid *pid; + erlang_pid pid; char hash[100]; int arity; const void *key; @@ -1123,15 +1123,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, return SWITCH_STATUS_FALSE; } - if (!(pid = malloc(sizeof(erlang_pid)))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n"); - ei_x_encode_tuple_header(rbuf, 2); - ei_x_encode_atom(rbuf, "error"); - ei_x_encode_atom(rbuf, "badmem"); - return SWITCH_STATUS_SUCCESS; - } - - if (ei_decode_pid(buf->buff, &buf->index, pid)) { + if (ei_decode_pid(buf->buff, &buf->index, &pid)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid pid in a reference/pid tuple\n"); return SWITCH_STATUS_FALSE; } @@ -1149,7 +1141,9 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, switch_mutex_lock(se->spawn_reply->mutex); if (se->spawn_reply->state == reply_waiting) { - se->spawn_reply->pid = pid; + se->spawn_reply->pid = switch_core_alloc(se->pool, sizeof(erlang_pid)); + switch_assert(se->spawn_reply->pid != NULL); + memcpy(se->spawn_reply->pid, &pid, sizeof(erlang_pid)); switch_thread_cond_signal(se->spawn_reply->ready_or_found); ei_x_encode_atom(rbuf, "ok"); switch_thread_rwlock_unlock(listener->session_rwlock); @@ -1167,8 +1161,6 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "notfound"); - switch_safe_free(pid); /* don't need it */ - return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 9960e2499d..4b3eaa7ecd 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1377,7 +1377,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul switch_thread_cond_create(&p->ready_or_found, session_element->pool); switch_mutex_init(&p->mutex, SWITCH_MUTEX_UNNESTED, session_element->pool); p->state = reply_waiting; - p->hash = hash; + p->hash = switch_core_strdup(session_element->pool, hash); p->pid = NULL; session_element->spawn_reply = p; @@ -1437,8 +1437,6 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul ei_link(listener, ei_self(listener->ec), &session_element->process.pid); - switch_safe_free(p->pid); - return session_element; } From 034d4153c401dc77b38db6aff73c1d6c5654f4ad Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 11 Jun 2012 16:16:50 +0000 Subject: [PATCH 0491/1057] Improve SWITCH_VERSION_REVISION generation The revision was no longer picking up the last git commit. Instead, it was showing the last release. This commit appends the last git commit hash to the last release if a git repository is available. Further, it checks whether there are uncommitted changes in the git repository and adds an unclean tag to the version if this is the case. Note that currently this will append the git commit hash even on a tagged release if built directly from a git repository. Perhaps this isn't such a bad thing, but if it turns out not to be desired, I have an idea on how to squelch this without making unwarranted assumptions about the remote layout of someone's local repository. --- .version.in | 1 - Makefile.am | 37 +++++++++++++------------------------ configure.in | 1 - 3 files changed, 13 insertions(+), 26 deletions(-) delete mode 100644 .version.in diff --git a/.version.in b/.version.in deleted file mode 100644 index 449460b02e..0000000000 --- a/.version.in +++ /dev/null @@ -1 +0,0 @@ -@SWITCH_VERSION_REVISION@ diff --git a/Makefile.am b/Makefile.am index 12dc3fa05a..ca539ec6ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -415,29 +415,19 @@ $(OUR_MODULES): $(switch_builddir)/modules.conf libfreeswitch.la $(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool @cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > $(switch_builddir)/quiet_libtool -src/include/switch_version.h: src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS) - @have_version=1 ; \ - force=0 ; \ - grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null || have_version=0 ; \ - test ! -f src/include/switch_version.h || grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \ - if test $$have_version = 1 ; then \ - cat src/include/switch_version.h.in > src/include/switch_version.h ; \ - touch .version ; \ - else \ - if [ -d .git ] ; then \ - version=`git log --pretty=format:"%h %ci" -1 HEAD | head -1 | sed -e 's|:|-|g' || echo hacked` ; \ - if [ "x$$version" = "xhacked" ] ; then \ - version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \ - else \ - version="git-$$version" ; \ - fi ;\ - fi ; \ - oldversion=`cat .version 2>/dev/null || echo "0"` ; \ - if test "$$oldversion" != "$$version" || test $$force = 1 ; then \ - cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \ - echo $$version > .version ; \ - fi ; \ - fi ; +src/include/switch_version.h: src/include/switch_version.h.in Makefile $(libfreeswitch_la_SOURCES) $(library_include_HEADERS) + @cat $< > $@; \ + if [ -d .git ]; then \ + xdate="$$(date -d "$$(git log -n1 --format='%ci' HEAD)" -u '+%Y%m%dT%H%M%SZ')"; \ + xcommit="$$(git rev-list -n1 --abbrev=10 --abbrev-commit HEAD)"; \ + xver="+git~$$xdate~$$xcommit"; \ + if ! git diff-index --quiet HEAD; then \ + xver="$$xver+unclean~$$(date -u +%Y%m%dT%H%M%SZ)"; \ + fi; \ + sed \ + -e "/#define *SWITCH_VERSION_REVISION/{s/\"\([^\"]*\)\"/\"\1$$xver\"/; :l n; b l}" \ + $< > $@; \ + fi; ## ## Dependency targets @@ -544,7 +534,6 @@ is-scm: update: is-scm @if test -d .git ; then \ - test ! -f .version || rm -f .version ; \ echo "Pulling updates..." ; \ git pull ; \ else \ diff --git a/configure.in b/configure.in index 0599a0c6b7..514a9151e4 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,6 @@ AC_SUBST(SWITCH_VERSION_MICRO, [0]) AC_SUBST(SWITCH_VERSION_REVISION, [-rc2]) AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template]) -AC_CONFIG_FILES([.version:.version.in]) AC_CONFIG_AUX_DIR(build/config) AM_INIT_AUTOMAKE(libfreeswitch,0.1) From b735735ea18cb129053a9093349b767b7391b9b6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 11 Jun 2012 18:06:00 +0000 Subject: [PATCH 0492/1057] gitignore a symlink we're creating in ldns --- libs/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/.gitignore b/libs/.gitignore index e39b1f4bf1..48bfc1f814 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -225,6 +225,7 @@ missing /ldns/doc/ldns_manpages /ldns/include/ /ldns/ldns/config.h +/ldns/ldns/ldns /ldns/ldns/net.h /ldns/ldns/util.h /ldns/lib From 56325e8c710f12233b156ec912636410b5ff8cf3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 11 Jun 2012 11:13:19 -0500 Subject: [PATCH 0493/1057] FS-4079 possible fix --- src/mod/endpoints/mod_sofia/mod_sofia.c | 292 +++++++++++++----------- 1 file changed, 153 insertions(+), 139 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 6d28bc01f9..5766eff62d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2339,151 +2339,165 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi break; case SWITCH_MESSAGE_INDICATE_RESPOND: - if (msg->numeric_arg || msg->string_arg) { - int code = msg->numeric_arg; - const char *reason = NULL; + { + int status = 0; - if (code) { - reason = msg->string_arg; - } else { - if (!zstr(msg->string_arg)) { - if ((code = atoi(msg->string_arg))) { - if ((reason = strchr(msg->string_arg, ' '))) { - reason++; - } - } - } + if (tech_pvt->nh && tech_pvt->nh->nh_ds && tech_pvt->nh->nh_ds->ds_sr && nua_server_request_is_pending(tech_pvt->nh->nh_ds->ds_sr)) { + status = tech_pvt->nh->nh_ds->ds_sr->sr_status; } - if (!code) { - code = 488; - } - - if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) { - if (sofia_test_flag(tech_pvt, TFLAG_BYE)) { - goto end_lock; - } - } - - if (zstr(reason) && code != 407 && code != 302) { - reason = sip_status_phrase(code); - if (zstr(reason)) { - reason = "Because"; - } - } - - if (code == 407 && !msg->numeric_arg) { - const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri"); - const char *to_host = reason; - - if (zstr(to_host)) { - to_host = switch_channel_get_variable(channel, "sip_to_host"); - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri); - sofia_reg_auth_challenge(tech_pvt->profile, tech_pvt->nh, NULL, REG_INVITE, to_host, 0); - switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE); - } else if (code == 484 && msg->numeric_arg) { - const char *to = switch_channel_get_variable(channel, "sip_to_uri"); - const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE); - char *cid = generate_pai_str(tech_pvt); - char *to_uri = NULL; - - if (to) { - char *p; - to_uri = switch_core_session_sprintf(session, "sip:%s", to); - if ((p = strstr(to_uri, ":5060"))) { - *p = '\0'; - } - } - - if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) { - char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason); - - nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)), - SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL), - TAG_IF(cid, SIPTAG_HEADER_STR(cid)), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), - TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END()); - - sofia_set_flag_locked(tech_pvt, TFLAG_BYE); - switch_safe_free(extra_headers); - } - } else if (code == 302 && !zstr(msg->string_arg)) { - char *p; - - if ((p = strchr(msg->string_arg, ' '))) { - *p = '\0'; - msg->string_arg = p; - } - - msg->message_id = SWITCH_MESSAGE_INDICATE_REDIRECT; - switch_core_session_receive_message(session, msg); + if (status == 0 || status > 199 || tech_pvt->nh->nh_destroyed) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot call respond on handle at status %d\n", + switch_channel_get_name(channel), status); goto end_lock; - } else { - if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { - char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); - char *sdp = (char *) msg->pointer_arg; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason); - sofia_clear_flag(tech_pvt, TFLAG_REINVITED); - - if (!zstr((sdp))) { - if (!strcasecmp(sdp, "t38")) { - switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options"); - if (t38_options) { - sofia_glue_set_image_sdp(tech_pvt, t38_options, 0); - if (switch_rtp_ready(tech_pvt->rtp_session)) { - sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE); - switch_rtp_udptl_mode(tech_pvt->rtp_session); - } - } - } else { - sofia_glue_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE); - } - - if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { - sofia_glue_tech_patch_sdp(tech_pvt); - sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL); - } - if (sofia_use_soa(tech_pvt)) { - nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), - SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), - SOATAG_REUSE_REJECTED(1), - SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); - } else { - nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), - NUTAG_MEDIA_ENABLE(0), - SIPTAG_CONTENT_TYPE_STR("application/sdp"), - SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); - } - if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) { - /* Unlock the session signal to allow the ack to make it in */ - // Maybe we should timeout? - switch_mutex_unlock(tech_pvt->sofia_mutex); - - while (switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) { - switch_cond_next(); - } - - /* Regain lock on sofia */ - switch_mutex_lock(tech_pvt->sofia_mutex); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n"); - sofia_clear_flag(tech_pvt, TFLAG_3PCC); - sofia_clear_flag(tech_pvt, TFLAG_3PCC_HAS_ACK); - switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_ANSWER); - } - } else { - nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); - } - switch_safe_free(extra_headers); - } } + if (msg->numeric_arg || msg->string_arg) { + int code = msg->numeric_arg; + const char *reason = NULL; + + if (code) { + reason = msg->string_arg; + } else { + if (!zstr(msg->string_arg)) { + if ((code = atoi(msg->string_arg))) { + if ((reason = strchr(msg->string_arg, ' '))) { + reason++; + } + } + } + } + + if (!code) { + code = 488; + } + + if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) { + if (sofia_test_flag(tech_pvt, TFLAG_BYE)) { + goto end_lock; + } + } + + if (zstr(reason) && code != 407 && code != 302) { + reason = sip_status_phrase(code); + if (zstr(reason)) { + reason = "Because"; + } + } + + if (code == 407 && !msg->numeric_arg) { + const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri"); + const char *to_host = reason; + + if (zstr(to_host)) { + to_host = switch_channel_get_variable(channel, "sip_to_host"); + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri); + sofia_reg_auth_challenge(tech_pvt->profile, tech_pvt->nh, NULL, REG_INVITE, to_host, 0); + switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE); + } else if (code == 484 && msg->numeric_arg) { + const char *to = switch_channel_get_variable(channel, "sip_to_uri"); + const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE); + char *cid = generate_pai_str(tech_pvt); + char *to_uri = NULL; + + if (to) { + char *p; + to_uri = switch_core_session_sprintf(session, "sip:%s", to); + if ((p = strstr(to_uri, ":5060"))) { + *p = '\0'; + } + } + + if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) { + char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason); + + nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)), + SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL), + TAG_IF(cid, SIPTAG_HEADER_STR(cid)), + TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), + TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END()); + + sofia_set_flag_locked(tech_pvt, TFLAG_BYE); + switch_safe_free(extra_headers); + } + } else if (code == 302 && !zstr(msg->string_arg)) { + char *p; + + if ((p = strchr(msg->string_arg, ' '))) { + *p = '\0'; + msg->string_arg = p; + } + + msg->message_id = SWITCH_MESSAGE_INDICATE_REDIRECT; + switch_core_session_receive_message(session, msg); + goto end_lock; + } else { + if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { + char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); + char *sdp = (char *) msg->pointer_arg; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason); + sofia_clear_flag(tech_pvt, TFLAG_REINVITED); + + if (!zstr((sdp))) { + if (!strcasecmp(sdp, "t38")) { + switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options"); + if (t38_options) { + sofia_glue_set_image_sdp(tech_pvt, t38_options, 0); + if (switch_rtp_ready(tech_pvt->rtp_session)) { + sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE); + switch_rtp_udptl_mode(tech_pvt->rtp_session); + } + } + } else { + sofia_glue_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE); + } + + if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { + sofia_glue_tech_patch_sdp(tech_pvt); + sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL); + } + if (sofia_use_soa(tech_pvt)) { + nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), + SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), + SOATAG_REUSE_REJECTED(1), + SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), + TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); + } else { + nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), + NUTAG_MEDIA_ENABLE(0), + SIPTAG_CONTENT_TYPE_STR("application/sdp"), + SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), + TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); + } + if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) { + /* Unlock the session signal to allow the ack to make it in */ + // Maybe we should timeout? + switch_mutex_unlock(tech_pvt->sofia_mutex); + + while (switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) { + switch_cond_next(); + } + + /* Regain lock on sofia */ + switch_mutex_lock(tech_pvt->sofia_mutex); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n"); + sofia_clear_flag(tech_pvt, TFLAG_3PCC); + sofia_clear_flag(tech_pvt, TFLAG_3PCC_HAS_ACK); + switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_ANSWER); + } + } else { + nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), + TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); + } + switch_safe_free(extra_headers); + } + } + + } } break; case SWITCH_MESSAGE_INDICATE_RINGING: From a10ec2b991f83bb28b2a927796cc494c5d9b0d63 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 11 Jun 2012 13:30:00 -0500 Subject: [PATCH 0494/1057] FS-4299 --resolve regression from 23f8967c the code was not making sure both endpoints were type 'sofia' and dereferencing dingaling channel into sofia and causing memory corruption --- src/mod/endpoints/mod_sofia/sofia_glue.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6376e86149..b08d7efc17 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3869,10 +3869,21 @@ static void add_audio_codec(sdp_rtpmap_t *map, int ptime, char *buf, switch_size void sofia_glue_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session) { - switch_channel_t *aleg_channel = switch_core_session_get_channel(aleg_session); - private_object_t *aleg_tech_pvt = switch_core_session_get_private(aleg_session); - switch_channel_t *bleg_channel = switch_core_session_get_channel(bleg_session); - private_object_t *bleg_tech_pvt = switch_core_session_get_private(bleg_session); + switch_channel_t *aleg_channel; + private_object_t *aleg_tech_pvt; + switch_channel_t *bleg_channel; + private_object_t *bleg_tech_pvt; + + if (!switch_core_session_compare(aleg_session, bleg_session)) { + /* since this digs into channel internals its only compatible with sofia sessions*/ + return; + } + + aleg_channel = switch_core_session_get_channel(aleg_session); + aleg_tech_pvt = switch_core_session_get_private(aleg_session); + bleg_channel = switch_core_session_get_channel(bleg_session); + bleg_tech_pvt = switch_core_session_get_private(bleg_session); + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "Deciding whether to pass zrtp-hash between a-leg and b-leg\n"); if (!(switch_channel_test_flag(aleg_tech_pvt->channel, CF_ZRTP_PASSTHRU_REQ))) { switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "CF_ZRTP_PASSTHRU_REQ not set on a-leg, so not propagating zrtp-hash\n"); From 45fdf0db193f59417b0df76d6faadc5101ac0f59 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 11 Jun 2012 21:25:05 +0000 Subject: [PATCH 0495/1057] Add a .version file to nightly tarballs --- scripts/ci/debsrcbuilder.sh | 1 + scripts/ci/src_tarball.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index e64093d120..1b81566fe8 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -28,6 +28,7 @@ mkdir -p $ddir git clone . $bdir cd $bdir set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" +echo "$gver" > .version cd libs getlib () { f="${1##*/}" diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 0cab5f5d58..1c79f2fca1 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -22,6 +22,7 @@ cp -r . $dst_dir cd $dst_dir set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" +echo "$gver" > .version gnuize cd .. ls From c85c8d7bbd7602e6ae6e35d74224e31e3533a771 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 8 Jun 2012 22:06:55 +0000 Subject: [PATCH 0496/1057] Add mechanism to set OpenSSL session timeout In a sofia profile, you can now set the parameter tls-timeout to a positive integer value which represents the maximum time in seconds that OpenSSL will keep a TLS session (and its ephemeral keys) alive. This value is passed to OpenSSL's SSL_CTX_set_timeout(3). OpenSSL's default value is 300 seconds, but the relevant standard (RFC 2246) suggests that much longer session lifetimes are acceptable (it recommends values less than 24 hours). Longer values can be useful for extending battery life on mobile devices. Signed-off-by: Travis Cross --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/tport/sofia-sip/tport_tag.h | 6 ++++++ libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c | 13 +++++++++++++ libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c | 2 ++ libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h | 1 + .../libsofia-sip-ua/tport/tport_type_tls.c | 3 +++ src/mod/endpoints/mod_sofia/conf/sofia.conf.xml | 2 ++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 6 ++++++ 9 files changed, 35 insertions(+), 1 deletion(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index ade22984f2..cfded9d9e2 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu May 3 16:30:20 CDT 2012 +Sat Jun 9 03:24:47 UTC 2012 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h b/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h index 6745cff1af..3abbbcbac4 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h @@ -198,6 +198,12 @@ enum tport_tls_verify_policy { TPTLS_VERIFY_SUBJECTS_ALL = 0xF, }; +TPORT_DLL extern tag_typedef_t tptag_tls_timeout; +#define TPTAG_TLS_TIMEOUT(x) tptag_tls_timeout, tag_uint_v((x)) + +TPORT_DLL extern tag_typedef_t tptag_tls_timeout_ref; +#define TPTAG_TLS_TIMEOUT_REF(x) tptag_tls_timeout_ref, tag_uint_vr(&(x)) + TPORT_DLL extern tag_typedef_t tptag_tls_passphrase; #define TPTAG_TLS_PASSPHRASE(x) tptag_tls_passphrase, tag_str_v(x) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c index c10958a41f..495eaaf997 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c @@ -280,6 +280,19 @@ tag_typedef_t tptag_compartment = PTRTAG_TYPEDEF(compartment); */ tag_typedef_t tptag_tls_version = UINTTAG_TYPEDEF(tls_version); +/**@def TPTAG_TLS_TIMEOUT(x) + * + * Sets the maximum TLS session lifetime in seconds. + * + * The default value is 300 seconds. + * + * Use with tport_tbind(), nua_create(), nta_agent_create(), + * nta_agent_add_tport(), nth_engine_create(), or initial nth_site_create(). + * + * @NEW_UNRELEASED. + */ +tag_typedef_t tptag_tls_timeout = UINTTAG_TYPEDEF(tls_timeout); + /**@def TPTAG_TLS_VERIFY_PEER(x) * @par Depreciated: * Alias for TPTAG_TLS_VERIFY_POLICY(TPTLS_VERIFY_IN|TPTLS_VERIFY_OUT) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c index 2fffbde110..2facb30d0d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c @@ -311,6 +311,8 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti) return -1; } + SSL_CTX_set_timeout(tls->ctx, ti->timeout); + /* Set callback if we have a passphrase */ if (ti->passphrase != NULL) { SSL_CTX_set_default_passwd_cb(tls->ctx, passwd_cb); diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h index dbf6517196..702dcc9040 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.h @@ -65,6 +65,7 @@ typedef struct tls_issues_s { */ int version; /* For tls1, version is 1. When ssl3/ssl2 is * used, it is 0. */ + unsigned timeout; /* Maximum session lifetime in seconds */ } tls_issues_t; typedef struct tport_tls_s { diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c index 24f5d1b0fb..cd2ac9a9b6 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c @@ -181,6 +181,7 @@ static int tport_tls_init_master(tport_primary_t *pri, char *tbf = NULL; char const *path = NULL; unsigned tls_version = 1; + unsigned tls_timeout = 300; unsigned tls_verify = 0; char const *passphrase = NULL; unsigned tls_policy = TPTLS_VERIFY_NONE; @@ -198,6 +199,7 @@ static int tport_tls_init_master(tport_primary_t *pri, tl_gets(tags, TPTAG_CERTIFICATE_REF(path), TPTAG_TLS_VERSION_REF(tls_version), + TPTAG_TLS_TIMEOUT_REF(tls_timeout), TPTAG_TLS_VERIFY_PEER_REF(tls_verify), TPTAG_TLS_PASSPHRASE_REF(passphrase), TPTAG_TLS_VERIFY_POLICY_REF(tls_policy), @@ -224,6 +226,7 @@ static int tport_tls_init_master(tport_primary_t *pri, ti.cert = ti.key; ti.CAfile = su_sprintf(autohome, "%s/%s", path, "cafile.pem"); ti.version = tls_version; + ti.timeout = tls_timeout; ti.CApath = su_strdup(autohome, path); SU_DEBUG_9(("%s(%p): tls key = %s\n", __func__, (void *)pri, ti.key)); diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 2e66602f1b..39c53d56d4 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -242,6 +242,8 @@ + + + + + + diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 0b11411ffd..e2b32a0637 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -27,8 +27,11 @@ * * libdingaling.c -- Main Library Code * + * QMOD: XMPP Video Signaling + Presentation (video-v1 & camera-v1) + * */ + #ifndef _MSC_VER #include #include @@ -157,8 +160,10 @@ struct ldl_session { char *login; ldl_payload_t payloads[LDL_MAX_PAYLOADS]; unsigned int payload_len; - ldl_candidate_t candidates[LDL_MAX_CANDIDATES]; - unsigned int candidate_len; + /*! \brief Transport candidates, organized per type */ + ldl_candidate_t candidates[LDL_TPORT_MAX][LDL_MAX_CANDIDATES]; + /*! \brief Length of the candidate list, per transport type */ + unsigned int candidate_len[LDL_TPORT_MAX]; apr_pool_t *pool; apr_hash_t *variables; apr_time_t created; @@ -181,6 +186,8 @@ typedef struct ldl_feature ldl_feature_t; #define FEATURE_VERSION "jabber:iq:version" #define FEATURE_VCARD "vcard-temp" #define FEATURE_VOICE "http://www.google.com/xmpp/protocol/voice/v1" +#define FEATURE_VIDEO "http://www.google.com/xmpp/protocol/video/v1" +#define FEATURE_CAMERA "http://www.google.com/xmpp/protocol/camera/v1" #define FEATURE_LAST "jabber:iq:last" static ldl_feature_t FEATURES[] = { @@ -189,6 +196,8 @@ static ldl_feature_t FEATURES[] = { { FEATURE_VERSION, on_disco_default }, { FEATURE_VCARD, on_vcard}, { FEATURE_VOICE, on_disco_default }, + { FEATURE_VIDEO, on_disco_default }, + { FEATURE_CAMERA, on_disco_default }, { FEATURE_LAST, on_disco_default }, { NULL, NULL} }; @@ -253,7 +262,6 @@ static unsigned int next_id(void) return globals.id++; } - static char *iks_name_nons(iks *x) { char *r = iks_name(x); @@ -296,7 +304,7 @@ ldl_status ldl_session_destroy(ldl_session_t **session_p) apr_hash_t *hash = session->handle->sessions; if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Destroyed Session %s\n", session->id); + globals.logger(DL_LOG_CRIT, "Destroyed Session %s\n", session->id); } if (session->id) { @@ -322,7 +330,7 @@ ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, c ldl_session_t *session = NULL; if (!(session = apr_palloc(handle->pool, sizeof(ldl_session_t)))) { - globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n"); + globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); *session_p = NULL; return LDL_STATUS_MEMERR; } @@ -352,7 +360,7 @@ ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, c if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Created Session %s\n", id); + globals.logger(DL_LOG_CRIT, "Created Session %s\n", id); } return LDL_STATUS_SUCCESS; @@ -374,21 +382,22 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, if (!session) { if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Non-Existent Session %s!\n", id); + globals.logger(DL_LOG_CRIT, "Non-Existent Session %s!\n", id); } return LDL_STATUS_MEMERR; } if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Message for Session %s\n", id); + globals.logger(DL_LOG_CRIT, "Message for Session %s\n", id); } while(xml) { char *type = NULL; iks *tag; - if (iks_type(xml)!=IKS_CDATA) + if (iks_type(xml) != IKS_CDATA) { type = xtype ? xtype : iks_find_attrib(xml, "type"); + } if (type) { @@ -429,18 +438,28 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, char *name = iks_find_attrib(itag, "name"); char *id = iks_find_attrib(itag, "id"); char *rate = iks_find_attrib(itag, "clockrate"); + char *ptime = iks_find_attrib(itag, "ptime"); if (name && id) { session->payloads[session->payload_len].name = apr_pstrdup(session->pool, name); session->payloads[session->payload_len].id = atoi(id); + if (ptime) { + session->payloads[session->payload_len].ptime = atoi(ptime); + } else { + session->payloads[session->payload_len].ptime = 20; + } if (rate) { session->payloads[session->payload_len].rate = atoi(rate); } else { - session->payloads[session->payload_len].rate = 8000; + if (!strncasecmp(iks_name(itag), "vid", 3)) { + session->payloads[session->payload_len].rate = 90000; + } else { + session->payloads[session->payload_len].rate = 8000; + } } session->payload_len++; if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Add Payload [%s] id='%s'\n", name, id); + globals.logger(DL_LOG_CRIT, "Add Payload [%s] id='%s'\n", name, id); } } } @@ -462,27 +481,46 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, tag = iks_child(tag); } - while(tag) { + for (;tag;tag = iks_next_tag(tag)) { if (!strcasecmp(iks_name_nons(tag), "info_element")) { char *name = iks_find_attrib(tag, "name"); char *value = iks_find_attrib(tag, "value"); if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Info Element [%s]=[%s]\n", name, value); + globals.logger(DL_LOG_CRIT, "Info Element [%s]=[%s]\n", name, value); } ldl_session_set_value(session, name, value); - } else if (!strcasecmp(iks_name_nons(tag), "candidate") && session->candidate_len < LDL_MAX_CANDIDATES) { + } else if (!strcasecmp(iks_name_nons(tag), "candidate") /*&& session->candidate_len < LDL_MAX_CANDIDATES*/) { char *key; double pref = 0.0; int index = -1; + ldl_transport_type_t tport; + unsigned int *candidate_len = NULL; + ldl_candidate_t (*candidates)[LDL_MAX_CANDIDATES] = NULL; + if ((key = iks_find_attrib(tag, "preference"))) { unsigned int x; + pref = strtod(key, NULL); - for (x = 0; x < session->candidate_len; x++) { - if (session->candidates[x].pref == pref) { + /* Check what kind of candidate this is */ + if ((key = iks_find_attrib(tag, "name")) && ((tport = ldl_transport_type_parse(key)) != LDL_TPORT_MAX)) { + candidates = &(session->candidates[tport]); + candidate_len = &(session->candidate_len[tport]); + } else { + globals.logger(DL_LOG_WARNING, "No such transport type: %s\n", key); + continue; + } + + if (*candidate_len >= LDL_MAX_CANDIDATES) { + globals.logger(DL_LOG_WARNING, "Too many %s candidates\n", key); + continue; + } + + for (x = 0; x < *candidate_len; x++) { + if ((*candidates)[x].pref == pref) { if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Duplicate Pref!\n"); + globals.logger(DL_LOG_CRIT, "Duplicate Pref! Updating...\n"); } index = x; break; @@ -491,44 +529,44 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, } if (index < 0) { - index = session->candidate_len++; + index = (*candidate_len)++; } - session->candidates[index].pref = pref; + (*candidates)[index].pref = pref; if (tid) { - session->candidates[index].tid = apr_pstrdup(session->pool, tid); + (*candidates)[index].tid = apr_pstrdup(session->pool, tid); } if ((key = iks_find_attrib(tag, "name"))) { - session->candidates[index].name = apr_pstrdup(session->pool, key); + (*candidates)[index].name = apr_pstrdup(session->pool, key); } if ((key = iks_find_attrib(tag, "type"))) { - session->candidates[index].type = apr_pstrdup(session->pool, key); + (*candidates)[index].type = apr_pstrdup(session->pool, key); } if ((key = iks_find_attrib(tag, "protocol"))) { - session->candidates[index].protocol = apr_pstrdup(session->pool, key); + (*candidates)[index].protocol = apr_pstrdup(session->pool, key); } if ((key = iks_find_attrib(tag, "username"))) { - session->candidates[index].username = apr_pstrdup(session->pool, key); + (*candidates)[index].username = apr_pstrdup(session->pool, key); } if ((key = iks_find_attrib(tag, "password"))) { - session->candidates[index].password = apr_pstrdup(session->pool, key); + (*candidates)[index].password = apr_pstrdup(session->pool, key); } if ((key = iks_find_attrib(tag, "address"))) { - session->candidates[index].address = apr_pstrdup(session->pool, key); + (*candidates)[index].address = apr_pstrdup(session->pool, key); } if ((key = iks_find_attrib(tag, "port"))) { - session->candidates[index].port = (uint16_t)atoi(key); + (*candidates)[index].port = (uint16_t)atoi(key); } - if (!session->candidates[index].type) { - session->candidates[index].type = apr_pstrdup(session->pool, "stun"); + if (!(*candidates)[index].type) { + (*candidates)[index].type = apr_pstrdup(session->pool, "stun"); } if (globals.debug) { - globals.logger(DL_LOG_DEBUG, + globals.logger(DL_LOG_CRIT, "New Candidate %d\n" "name=%s\n" "type=%s\n" @@ -538,19 +576,18 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, "address=%s\n" "port=%d\n" "pref=%0.2f\n", - session->candidate_len, - session->candidates[index].name, - session->candidates[index].type, - session->candidates[index].protocol, - session->candidates[index].username, - session->candidates[index].password, - session->candidates[index].address, - session->candidates[index].port, - session->candidates[index].pref + *candidate_len, + (*candidates)[index].name, + (*candidates)[index].type, + (*candidates)[index].protocol, + (*candidates)[index].username, + (*candidates)[index].password, + (*candidates)[index].address, + (*candidates)[index].port, + (*candidates)[index].pref ); } } - tag = iks_next_tag(tag); } } else if (!strcasecmp(type, "terminate")) { dl_signal = LDL_SIGNAL_TERMINATE; @@ -569,6 +606,301 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, return LDL_STATUS_SUCCESS; } + +static ldl_status parse_jingle_code(ldl_handle_t *handle, iks *xml, char *to, char *from, char *type) +{ + ldl_session_t *session = NULL; + ldl_signal_t dl_signal = LDL_SIGNAL_NONE; + char *initiator = iks_find_attrib(xml, "initiator"); + char *msg = NULL; + char *id = iks_find_attrib(xml, "sid"); + char *action = iks_find_attrib(xml, "action"); + iks *tag; + + + if (!strcasecmp(type, "error")) { + action = type; + } + + + if (!(id && action)) { + globals.logger(DL_LOG_CRIT, "missing required params\n"); + return LDL_STATUS_FALSE; + } + + if (!(session = apr_hash_get(handle->sessions, id, APR_HASH_KEY_STRING))) { + ldl_session_create(&session, handle, id, from, to, LDL_FLAG_NONE); + if (!session) { + return LDL_STATUS_MEMERR; + } + } + + if (!session) { + if (globals.debug) { + globals.logger(DL_LOG_CRIT, "Non-Existent Session %s!\n", id); + } + return LDL_STATUS_MEMERR; + } + + if (globals.debug) { + globals.logger(DL_LOG_CRIT, "Message for Session %s\n", id); + } + + + if (action) { + + if (!strcasecmp(action, "redirect")) { + apr_hash_t *hash = session->handle->sessions; + char *p = to; + if ((p = strchr(to, ':'))) { + p++; + } else { + p = to; + } + + + apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); + apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); + session->them = apr_pstrdup(session->pool, p); + apr_hash_set(handle->sessions, session->them, APR_HASH_KEY_STRING, session); + apr_hash_set(handle->sessions, session->id, APR_HASH_KEY_STRING, session); + + dl_signal = LDL_SIGNAL_REDIRECT; + } else if (!strcasecmp(action, "session-initiate") || !strcasecmp(action, "session-accept")) { + + dl_signal = LDL_SIGNAL_INITIATE; + + if (!strcasecmp(action, "session-accept")) { + msg = "accept"; + } + + if (!session->initiator && initiator) { + session->initiator = apr_pstrdup(session->pool, initiator); + } + tag = iks_child (xml); + + while(tag) { + + if (!strcasecmp(iks_name_nons(tag), "content")) { + iks *dtag = iks_child (tag); + char key[512]; + + if (!strcasecmp(iks_name_nons(dtag), "description")) { + iks *itag = iks_child (dtag); + char *name = iks_find_attrib(tag, "name"); + char *media = iks_find_attrib(dtag, "media"); + + if (globals.debug) { + globals.logger(DL_LOG_CRIT, "Found description of type '%s' media type '%s'\n", name, media); + + } + + while(itag) { + if (!strcasecmp(iks_name_nons(itag), "rtcp-mux")) { + snprintf(key, sizeof(key), "%s:rtcp-mux", media); + ldl_session_set_value(session, key, "true"); + } + + if (!strcasecmp(iks_name_nons(itag), "encryption")) { + iks *etag = iks_child (itag); + + while(etag) { + char *suite = iks_find_attrib(etag, "crypto-suite"); + char *params = iks_find_attrib(etag, "key-params"); + char *tag = iks_find_attrib(etag, "tag"); + char val[512]; + + if (suite && params && tag) { + snprintf(key, sizeof(key), "%s:crypto:%s", media, tag); + snprintf(val, sizeof(val), "%s %s %s", tag, suite, params); + + ldl_session_set_value(session, key, val); + } + + etag = iks_next_tag(etag); + } + } + + + if (!strcasecmp(iks_name_nons(itag), "payload-type") && session->payload_len < LDL_MAX_PAYLOADS) { + char *name = iks_find_attrib(itag, "name"); + char *id = iks_find_attrib(itag, "id"); + char *rate = iks_find_attrib(itag, "clockrate"); + + if (name && id) { + session->payloads[session->payload_len].name = apr_pstrdup(session->pool, name); + session->payloads[session->payload_len].id = atoi(id); + if (rate) { + session->payloads[session->payload_len].rate = atoi(rate); + } else { + if (!strcasecmp(media, "video")) { + session->payloads[session->payload_len].rate = 90000; + } else { + session->payloads[session->payload_len].rate = 8000; + } + } + session->payload_len++; + + if (globals.debug) { + globals.logger(DL_LOG_CRIT, "Add Payload [%s] id='%s'\n", name, id); + } + } + } + itag = iks_next_tag(itag); + } + + } + } + + tag = iks_next_tag(tag); + } + } else if (!strcasecmp(action, "transport-accept")) { + dl_signal = LDL_SIGNAL_TRANSPORT_ACCEPT; + } else if (!strcasecmp(action, "reject")) { + dl_signal = LDL_SIGNAL_REJECT; + } else if (!strcasecmp(action, "transport-info")) { + + tag = iks_child (xml); + + while(tag) { + + if (!strcasecmp(iks_name_nons(tag), "content")) { + iks *ttag = iks_child (tag); + + dl_signal = LDL_SIGNAL_CANDIDATES; + + id = action; + + if (ttag && !strcasecmp(iks_name_nons(ttag), "transport")) { + ttag = iks_child(ttag); + } + + for (;ttag;ttag = iks_next_tag(ttag)) { + if (!strcasecmp(iks_name_nons(ttag), "info_element")) { + char *name = iks_find_attrib(ttag, "name"); + char *value = iks_find_attrib(ttag, "value"); + if (globals.debug) { + globals.logger(DL_LOG_CRIT, "Info Element [%s]=[%s]\n", name, value); + } + ldl_session_set_value(session, name, value); + + } else if (!strcasecmp(iks_name_nons(ttag), "candidate")) { + char *key; + double pref = 0.0; + int index = -1; + ldl_transport_type_t tport; + unsigned int *candidate_len = NULL; + ldl_candidate_t (*candidates)[LDL_MAX_CANDIDATES] = NULL; + + if ((key = iks_find_attrib(ttag, "preference"))) { + unsigned int x; + + pref = strtod(key, NULL); + + /* Check what kind of candidate this is */ + if ((key = iks_find_attrib(ttag, "name")) && ((tport = ldl_transport_type_parse(key)) != LDL_TPORT_MAX)) { + candidates = &(session->candidates[tport]); + candidate_len = &(session->candidate_len[tport]); + } else { + globals.logger(DL_LOG_WARNING, "No such transport type: %s\n", key); + continue; + } + + if (*candidate_len >= LDL_MAX_CANDIDATES) { + globals.logger(DL_LOG_WARNING, "Too many %s candidates\n", key); + continue; + } + + for (x = 0; x < *candidate_len; x++) { + if ((*candidates)[x].pref == pref) { + if (globals.debug) { + globals.logger(DL_LOG_CRIT, "Duplicate Pref!\n"); + } + index = x; + break; + } + } + } + + if (index < 0) { + index = (*candidate_len)++; + } + + (*candidates)[index].pref = pref; + + if ((key = iks_find_attrib(ttag, "name"))) { + (*candidates)[index].name = apr_pstrdup(session->pool, key); + } + if ((key = iks_find_attrib(ttag, "type"))) { + (*candidates)[index].type = apr_pstrdup(session->pool, key); + } + if ((key = iks_find_attrib(ttag, "protocol"))) { + (*candidates)[index].protocol = apr_pstrdup(session->pool, key); + } + if ((key = iks_find_attrib(ttag, "username"))) { + (*candidates)[index].username = apr_pstrdup(session->pool, key); + } + if ((key = iks_find_attrib(ttag, "password"))) { + (*candidates)[index].password = apr_pstrdup(session->pool, key); + } + if ((key = iks_find_attrib(ttag, "address"))) { + (*candidates)[index].address = apr_pstrdup(session->pool, key); + } + if ((key = iks_find_attrib(ttag, "port"))) { + (*candidates)[index].port = (uint16_t)atoi(key); + } + + if (!(*candidates)[index].type) { + (*candidates)[index].type = apr_pstrdup(session->pool, "stun"); + } + + + if (globals.debug) { + globals.logger(DL_LOG_CRIT, + "New Candidate %d\n" + "name=%s\n" + "type=%s\n" + "protocol=%s\n" + "username=%s\n" + "password=%s\n" + "address=%s\n" + "port=%d\n" + "pref=%0.2f\n", + *candidate_len, + (*candidates)[index].name, + (*candidates)[index].type, + (*candidates)[index].protocol, + (*candidates)[index].username, + (*candidates)[index].password, + (*candidates)[index].address, + (*candidates)[index].port, + (*candidates)[index].pref + ); + } + } + } + } + + tag = iks_next_tag(tag); + } + } else if (!strcasecmp(action, "session-terminate")) { + dl_signal = LDL_SIGNAL_TERMINATE; + } else if (!strcasecmp(action, "error")) { + dl_signal = LDL_SIGNAL_ERROR; + } + } + + + + if (handle->session_callback && dl_signal) { + handle->session_callback(handle, session, dl_signal, to, from, id, msg); + } + + return LDL_STATUS_SUCCESS; +} + + + const char *marker = "TRUE"; @@ -601,12 +933,12 @@ static int on_disco_default(void *user_data, ikspak *pak) } if (pak->subtype == IKS_TYPE_RESULT) { - globals.logger(DL_LOG_DEBUG, "FixME!!! node=[%s]\n", node?node:""); + globals.logger(DL_LOG_CRIT, "FixME!!! node=[%s]\n", node?node:""); } else if (pak->subtype == IKS_TYPE_GET) { if ((iq = iks_new("iq"))) { int all = 0; - iks_insert_attrib(iq, "from", iks_find_attrib(pak->x, "to")); + iks_insert_attrib(iq, "from", handle->login); if (pak->from) { iks_insert_attrib(iq, "to", pak->from->full); } @@ -673,7 +1005,7 @@ static int on_disco_default(void *user_data, ikspak *pak) } if (!send) { - globals.logger(DL_LOG_DEBUG, "Memory Error!\n"); + globals.logger(DL_LOG_CRIT, "Memory Error!\n"); } } @@ -838,12 +1170,12 @@ static void do_presence(ldl_handle_t *handle, char *from, char *to, char *type, char buf[512]; iks *tag; - if (from && !strchr(from, '/')) { + if (!strchr(from, '/')) { snprintf(buf, sizeof(buf), "%s/talk", from); from = buf; } - if (ldl_test_flag(handle, LDL_FLAG_COMPONENT) && from && to && ldl_jid_domcmp(from, to)) { + if (ldl_test_flag(handle, LDL_FLAG_COMPONENT) && ldl_jid_domcmp(from, to)) { globals.logger(DL_LOG_ERR, "Refusal to send presence from and to the same domain in component mode [%s][%s]\n", from, to); return; } @@ -890,7 +1222,7 @@ static void do_presence(ldl_handle_t *handle, char *from, char *to, char *type, if ((tag = iks_insert(pres, "c"))) { iks_insert_attrib(tag, "node", "http://www.freeswitch.org/xmpp/client/caps"); iks_insert_attrib(tag, "ver", LDL_CAPS_VER); - iks_insert_attrib(tag, "ext", "sidebar voice-v1"); + iks_insert_attrib(tag, "ext", "sidebar voice-v1 video-v1 camera-v1"); iks_insert_attrib(tag, "client", "libdingaling"); iks_insert_attrib(tag, "xmlns", "http://jabber.org/protocol/caps"); } @@ -970,7 +1302,7 @@ static void cancel_retry(ldl_handle_t *handle, char *id) apr_thread_mutex_lock(handle->lock); if ((packet_node = apr_hash_get(handle->retry_hash, id, APR_HASH_KEY_STRING))) { if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Cancel packet %s\n", packet_node->id); + globals.logger(DL_LOG_CRIT, "Cancel packet %s\n", packet_node->id); } packet_node->retries = 0; } @@ -989,6 +1321,30 @@ static iks* working_find(iks *tag, const char *name) return NULL; } +static iks* working_find_nons(iks *tag, const char *name) +{ + while(tag) { + char *a = iks_name(tag); + char *b = (char *)name; + char *p; + + if ((p = strchr(a, ':'))) { + a = p+1; + } + + if ((p = strchr(b, ':'))) { + b = p+1; + } + + if (!strcasecmp(a,b)) { + return tag; + } + tag = iks_next_tag(tag); + } + + return NULL; +} + static int on_commands(void *user_data, ikspak *pak) { ldl_handle_t *handle = user_data; @@ -999,6 +1355,8 @@ 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; + iks *xjingle; + xml = iks_child (pak->x); @@ -1062,8 +1420,21 @@ static int on_commands(void *user_data, ikspak *pak) } } - - if ((xsession = working_find(xml, "ses:session")) || (xsession = working_find(xml, "session"))) { + + + if ((handle->flags & LDL_FLAG_JINGLE) && (xjingle = working_find_nons(xml, "jin:jingle"))) { + if (parse_jingle_code(handle, xjingle, to, from, type) == LDL_STATUS_SUCCESS) { + iks *reply; + if ((reply = iks_make_iq(IKS_TYPE_RESULT, NULL))) { + iks_insert_attrib(reply, "to", from); + iks_insert_attrib(reply, "from", to); + iks_insert_attrib(reply, "id", iqid); + apr_queue_push(handle->queue, reply); + reply = NULL; + } + } + + } else if ((xsession = working_find_nons(xml, "ses:session"))) { char *id; id = iks_find_attrib(xsession, "id"); @@ -1102,7 +1473,7 @@ static int on_result(void *user_data, ikspak *pak) ctag = iks_insert(msg, "c"); iks_insert_attrib(ctag, "node", "http://www.freeswitch.org/xmpp/client/caps"); iks_insert_attrib(ctag, "ver", "1.0.0.1"); - iks_insert_attrib(ctag, "ext", "sidebar voice-v1"); + iks_insert_attrib(ctag, "ext", "sidebar voice-v1 video-v1"); iks_insert_attrib(ctag, "client", "libdingaling"); iks_insert_attrib(ctag, "xmlns", "http://jabber.org/protocol/caps"); @@ -1239,7 +1610,7 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node) if (iks_has_tls()) { iks_start_tls(handle->parser); } else { - globals.logger(DL_LOG_DEBUG, "TLS NOT SUPPORTED IN THIS BUILD!\n"); + globals.logger(DL_LOG_WARNING, "TLS NOT SUPPORTED IN THIS BUILD!\n"); } } break; @@ -1284,19 +1655,19 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node) apr_queue_push(handle->queue, x); x = NULL; } else { - globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n"); + globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); break; } } } } else if (node && strcmp("failure", iks_name_nons(node)) == 0) { - globals.logger(DL_LOG_DEBUG, "sasl authentication failed\n"); + globals.logger(DL_LOG_CRIT, "sasl authentication failed\n"); if (handle->session_callback) { handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_FAILURE, "user", "core", "Login Failure", handle->login); } } else if (node && strcmp("success", iks_name_nons(node)) == 0) { - globals.logger(DL_LOG_DEBUG, "XMPP server connected\n"); + globals.logger(DL_LOG_NOTICE, "XMPP server connected\n"); iks_send_header(handle->parser, handle->acc->server); ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED); if (handle->session_callback) { @@ -1308,7 +1679,7 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node) if (handle->session_callback) { handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_SUCCESS, "user", "core", "Login Success", handle->login); } - globals.logger(DL_LOG_DEBUG, "XMPP authenticated\n"); + globals.logger(DL_LOG_NOTICE, "XMPP authenticated\n"); ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED); } if (node) { @@ -1360,18 +1731,20 @@ static int on_msg(void *user_data, ikspak *pak) static int on_error(void *user_data, ikspak * pak) { - globals.logger(DL_LOG_DEBUG, "authorization failed\n"); + globals.logger(DL_LOG_ERR, "authorization failed\n"); return IKS_FILTER_EAT; } static void on_log(ldl_handle_t *handle, const char *data, size_t size, int is_incoming) { + if (globals.debug) { if (is_incoming) { globals.logger(DL_LOG_INFO, "+xml:%s%s:%s", iks_is_secure(handle->parser) ? "Sec" : "", is_incoming ? "RECV" : "SEND", data); } else { globals.logger(DL_LOG_NOTICE, "+xml:%s%s:%s", iks_is_secure(handle->parser) ? "Sec" : "", is_incoming ? "RECV" : "SEND", data); } + } } @@ -1443,11 +1816,7 @@ static ldl_queue_t ldl_flush_queue(ldl_handle_t *handle, int done) while(apr_queue_trypop(handle->queue, &pop) == APR_SUCCESS) { if (pop) { msg = (iks *) pop; - if (!done) { - if (iks_send(handle->parser, msg) != IKS_OK) { - globals.logger(DL_LOG_DEBUG, "Failed sending data!\n"); - }; - }; + if (!done) iks_send(handle->parser, msg); iks_delete(msg); pop = NULL; sent_data = LDL_QUEUE_SENT; @@ -1458,7 +1827,7 @@ static ldl_queue_t ldl_flush_queue(ldl_handle_t *handle, int done) len = apr_queue_size(handle->retry_queue); if (globals.debug && len) { - globals.logger(DL_LOG_DEBUG, "Processing %u packets in retry queue\n", len); + globals.logger(DL_LOG_CRIT, "Processing %u packets in retry queue\n", len); } pop = NULL; @@ -1475,18 +1844,16 @@ static ldl_queue_t ldl_flush_queue(ldl_handle_t *handle, int done) if (packet_node->retries > 0) { packet_node->retries--; if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Sending packet %s (%d left)\n", packet_node->id, packet_node->retries); + globals.logger(DL_LOG_CRIT, "Sending packet %s (%d left)\n", packet_node->id, packet_node->retries); } - if (iks_send(handle->parser, packet_node->xml) != IKS_OK) { - globals.logger(DL_LOG_DEBUG, "Failed trying re-sending data!\n"); - }; + iks_send(handle->parser, packet_node->xml); packet_node->next = now + 5000000; sent_data = LDL_QUEUE_SENT; } } if (packet_node->retries == 0 || done) { if (globals.debug) { - globals.logger(DL_LOG_DEBUG, "Discarding packet %s\n", packet_node->id); + globals.logger(DL_LOG_CRIT, "Discarding packet %s\n", packet_node->id); } apr_hash_set(handle->retry_hash, packet_node->id, APR_HASH_KEY_STRING, NULL); iks_delete(packet_node->xml); @@ -1505,8 +1872,8 @@ static ldl_queue_t ldl_flush_queue(ldl_handle_t *handle, int done) static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass) { - int count_ka = LDL_KEEPALIVE_TIMEOUT; - time_t tstart, tnow; + int timeout_ka = LDL_KEEPALIVE_TIMEOUT; + int count_ka = timeout_ka; while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) { int e; @@ -1537,8 +1904,6 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass) j_setup_filter(handle); - globals.logger(DL_LOG_DEBUG, "xmpp connecting\n"); - e = iks_connect_via(handle->parser, handle->server ? handle->server : handle->acc->server, handle->port ? handle->port : IKS_JABBER_PORT, @@ -1548,27 +1913,31 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass) case IKS_OK: break; case IKS_NET_NODNS: - globals.logger(DL_LOG_DEBUG, "hostname lookup failed\n"); + globals.logger(DL_LOG_CRIT, "hostname lookup failed\n"); microsleep(1000); goto fail; case IKS_NET_NOCONN: - globals.logger(DL_LOG_DEBUG, "connection failed\n"); + globals.logger(DL_LOG_CRIT, "connection failed\n"); microsleep(1000); goto fail; default: - globals.logger(DL_LOG_DEBUG, "io error 1 %d\n", e); + globals.logger(DL_LOG_CRIT, "io error 1 %d\n", e); microsleep(1000); goto fail; } handle->counter = opt_timeout; - if ((tstart = time(NULL)) == -1) { - globals.logger(DL_LOG_DEBUG, "error determining connection time"); - } while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) { e = iks_recv(handle->parser, 1); + if (count_ka-- <= 0) { + if( iks_send_raw(handle->parser, " ") == IKS_OK) { + count_ka = timeout_ka; + globals.logger(DL_LOG_DEBUG, "Sent keep alive signal\n"); + } + } + if (handle->loop_callback) { if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) { ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); @@ -1585,51 +1954,31 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass) } if (IKS_OK != e || ldl_test_flag(handle, LDL_FLAG_BREAK)) { - globals.logger(DL_LOG_DEBUG, "io error 2 %d retry in %d second(s)", e, ++handle->fail_count); - if ((tnow = time(NULL)) == -1) { - globals.logger(DL_LOG_DEBUG, "error deterniming io error time"); - } - if (difftime(tnow, tstart) > 30) { - /* this is a new error situation: reset counter */ - globals.logger(DL_LOG_DEBUG, "resetting fail count"); - handle->fail_count = 1; - } + globals.logger(DL_LOG_DEBUG, "io error 2 %d retry in %d second(s)\n", e, ++handle->fail_count); microsleep(1000 * handle->fail_count); goto fail; } if (ldl_test_flag(handle, LDL_FLAG_RUNNING)) { - if (ldl_flush_queue(handle, 0) == LDL_QUEUE_SENT) { - count_ka = LDL_KEEPALIVE_TIMEOUT; - } - } + ldl_flush_queue(handle, 0); + } handle->counter--; if (!ldl_test_flag(handle, LDL_FLAG_CONNECTED)) { if (IKS_NET_TLSFAIL == e) { - globals.logger(DL_LOG_DEBUG, "tls handshake failed\n"); + globals.logger(DL_LOG_CRIT, "tls handshake failed\n"); microsleep(500); break; } if (handle->counter == 0) { - globals.logger(DL_LOG_DEBUG, "network timeout\n"); - microsleep(500); - break; - } - } - - if (count_ka-- <= 0) { - if( iks_send_raw(handle->parser, " ") == IKS_OK) { - globals.logger(DL_LOG_DEBUG, "Sent keep alive signal"); - count_ka = LDL_KEEPALIVE_TIMEOUT; - } else { - globals.logger(DL_LOG_DEBUG, "Failed sending keep alive signal"); + globals.logger(DL_LOG_CRIT, "network timeout\n"); microsleep(500); break; } } + microsleep(100); } fail: @@ -1657,7 +2006,7 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass) static void add_elements(ldl_session_t *session, iks *tag) { apr_hash_index_t *hi; - + return; for (hi = apr_hash_first(session->pool, session->variables); hi; hi = apr_hash_next(hi)) { void *val = NULL; const void *key = NULL; @@ -1672,6 +2021,42 @@ static void add_elements(ldl_session_t *session, iks *tag) } } + +static iks *ldl_set_jingle_tag(ldl_session_t *session, iks *iq, char *action) +{ + iks *jin = iks_insert (iq, "jin:jingle"); + iks_insert_attrib(jin, "xmlns:jin", "urn:xmpp:jingle:1"); + iks_insert_attrib(jin, "action", action); + iks_insert_attrib(jin, "sid", session->id); + //iks_insert_attrib(jin, "initiator", session->initiator ? session->initiator : session->them); + + return jin; +} + +static ldl_status new_jingle_iq(ldl_session_t *session, iks **iqp, iks **jinp, unsigned int *id, char *action) +{ + iks *iq , *jin; + unsigned int myid; + char idbuf[80]; + + myid = next_id(); + snprintf(idbuf, sizeof(idbuf), "%u", myid); + iq = iks_new("iq"); + iks_insert_attrib(iq, "xmlns", "jabber:client"); + iks_insert_attrib(iq, "from", session->login); + iks_insert_attrib(iq, "to", session->them); + iks_insert_attrib(iq, "type", "set"); + iks_insert_attrib(iq, "id", idbuf); + + jin = ldl_set_jingle_tag(session, iq, action); + + *jinp = jin; + *iqp = iq; + *id = myid; + return LDL_STATUS_SUCCESS; +} + + static ldl_status new_session_iq(ldl_session_t *session, iks **iqp, iks **sessp, unsigned int *id, char *type) { iks *iq, *sess; @@ -1973,6 +2358,11 @@ unsigned int ldl_session_terminate(ldl_session_t *session) apr_hash_t *hash = session->handle->sessions; new_session_iq(session, &iq, &sess, &id, "terminate"); + + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + ldl_set_jingle_tag(session, iq, "session-terminate"); + } + schedule_packet(session->handle, id, iq, LDL_RETRY); if (session->id) { @@ -1998,6 +2388,12 @@ unsigned int ldl_session_transport(ldl_session_t *session, unsigned int x, id = 0; + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + return ldl_session_candidates(session, candidates, clen); + } + + + for (x = 0; x < clen; x++) { char buf[512]; iq = NULL; @@ -2005,13 +2401,13 @@ unsigned int ldl_session_transport(ldl_session_t *session, id = 0; new_session_iq(session, &iq, &sess, &id, "transport-info"); - //tag = iks_insert(sess, "transport"); - //iks_insert_attrib(tag, "xmlns", "http://www.google.com/transport/p2p"); + tag = sess; - if (0) add_elements(session, tag); + //if (0) add_elements(session, tag); tag = iks_insert(tag, "transport"); iks_insert_attrib(tag, "xmlns", "http://www.google.com/transport/p2p"); + //iks_insert_attrib(tag, "xmlns", "urn:xmpp:jingle:transports:raw-udp:1"); tag = iks_insert(tag, "candidate"); @@ -2047,7 +2443,6 @@ unsigned int ldl_session_transport(ldl_session_t *session, schedule_packet(session->handle, id, iq, LDL_RETRY); } - return id; } @@ -2056,23 +2451,103 @@ unsigned int ldl_session_candidates(ldl_session_t *session, unsigned int clen) { - iks *iq, *sess, *tag; - unsigned int x, id = 0; + iks *iq = NULL, *sess = NULL, *tag = NULL; + unsigned int x = 0, id = 0; + unsigned int pass = 0; + iks *jingle = NULL, *jin_content = NULL, *p_trans = NULL; + const char *tname = ""; + const char *type = ""; + + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + + + new_jingle_iq(session, &iq, &jingle, &id, "transport-info"); + + for (pass = 0; pass < 2; pass++) { + + if (pass == 0) { + type = "rtp"; + tname = "audio"; + } else { + type = "video_rtp"; + tname = "video"; + } + + jin_content = iks_insert(jingle, "jin:content"); + iks_insert_attrib(jin_content, "name", tname); + iks_insert_attrib(jin_content, "creator", "initiator"); + + for (x = 0; x < clen; x++) { + char buf[512]; + + if (strcasecmp(candidates[x].name, type)) { + continue; + } + + p_trans = iks_insert(jin_content, "p:transport"); + iks_insert_attrib(p_trans, "xmlns:p", "http://www.google.com/transport/p2p"); + + + + tag = iks_insert(p_trans, "candidate"); + + if (candidates[x].name) { + iks_insert_attrib(tag, "name", candidates[x].name); + } + if (candidates[x].address) { + iks_insert_attrib(tag, "address", candidates[x].address); + } + if (candidates[x].port) { + snprintf(buf, sizeof(buf), "%u", candidates[x].port); + iks_insert_attrib(tag, "port", buf); + } + if (candidates[x].username) { + iks_insert_attrib(tag, "username", candidates[x].username); + } + if (candidates[x].password) { + iks_insert_attrib(tag, "password", candidates[x].password); + } + if (candidates[x].pref) { + snprintf(buf, sizeof(buf), "%0.1f", candidates[x].pref); + iks_insert_attrib(tag, "preference", buf); + } + if (candidates[x].protocol) { + iks_insert_attrib(tag, "protocol", candidates[x].protocol); + } + if (candidates[x].type) { + iks_insert_attrib(tag, "type", candidates[x].type); + } + + iks_insert_attrib(tag, "network", "0"); + iks_insert_attrib(tag, "generation", "0"); + } + } + + + schedule_packet(session->handle, id, iq, LDL_RETRY); + + iq = NULL; + sess = NULL; + tag = NULL; + x = 0; + id = 0; + } + + + new_session_iq(session, &iq, &sess, &id, "candidates"); + add_elements(session, sess); + for (x = 0; x < clen; x++) { char buf[512]; - iq = NULL; - sess = NULL; - id = 0; + //iq = NULL; + //sess = NULL; + //id = 0; - new_session_iq(session, &iq, &sess, &id, "candidates"); - //tag = iks_insert(sess, "transport"); - //iks_insert_attrib(tag, "xmlns", "http://www.google.com/transport/p2p"); - tag = sess; + tag = iks_insert(sess, "ses:candidate"); + - add_elements(session, tag); - tag = iks_insert(tag, "ses:candidate"); if (candidates[x].name) { iks_insert_attrib(tag, "name", candidates[x].name); @@ -2103,9 +2578,10 @@ unsigned int ldl_session_candidates(ldl_session_t *session, iks_insert_attrib(tag, "network", "0"); iks_insert_attrib(tag, "generation", "0"); - schedule_packet(session->handle, id, iq, LDL_RETRY); + } + schedule_packet(session->handle, id, iq, LDL_RETRY); return id; } @@ -2192,11 +2668,11 @@ char *ldl_handle_disco(ldl_handle_t *handle, char *id, char *from, char *buf, un iks_insert_attrib(query, "xmlns", "http://jabber.org/protocol/disco#info"); } else { iks_delete(iq); - globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n"); + globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); return NULL; } } else { - globals.logger(DL_LOG_DEBUG, "Memory ERROR!\n"); + globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); return NULL; } @@ -2236,42 +2712,274 @@ char *ldl_handle_disco(ldl_handle_t *handle, char *id, char *from, char *buf, un } + unsigned int ldl_session_describe(ldl_session_t *session, - ldl_payload_t *payloads, - unsigned int plen, - ldl_description_t description) + ldl_payload_t *payloads, + unsigned int plen, + ldl_description_t description, unsigned int *audio_ssrc, unsigned int *video_ssrc, + ldl_crypto_data_t *audio_crypto_data, ldl_crypto_data_t *video_crypto_data) { - iks *iq, *sess, *tag, *payload, *tp; + iks *iq; + iks *sess, *payload = NULL, *tag = NULL;//, *u = NULL; + unsigned int x, id; - + int video_call = 0; + int compat = 1; + //char *vid_mux = ldl_session_get_value(session, "video:rtcp-mux"); + //char *aud_mux = ldl_session_get_value(session, "audio:rtcp-mux"); + char tmp[80]; + iks *jpayload = NULL, *tp = NULL; + iks *jingle, *jin_audio, *jin_audio_desc = NULL, *jin_video = NULL, *jin_video_desc = NULL, *crypto; - new_session_iq(session, &iq, &sess, &id, description == LDL_DESCRIPTION_ACCEPT ? "accept" : "initiate"); - tag = iks_insert(sess, "pho:description"); - iks_insert_attrib(tag, "xmlns:pho", "http://www.google.com/session/phone"); - iks_insert_attrib(tag, "xml:lang", "en"); - for (x = 0; x < plen; x++) { - char idbuf[80]; - payload = iks_insert(tag, "pho:payload-type"); - iks_insert_attrib(payload, "xmlns:pho", "http://www.google.com/session/phone"); - sprintf(idbuf, "%d", payloads[x].id); - iks_insert_attrib(payload, "id", idbuf); - iks_insert_attrib(payload, "name", payloads[x].name); - if (payloads[x].rate) { - sprintf(idbuf, "%d", payloads[x].rate); - iks_insert_attrib(payload, "clockrate", idbuf); + if (!*audio_ssrc) { + *audio_ssrc = (uint32_t) ((intptr_t) session + (uint32_t) time(NULL)); + } + + if (!*video_ssrc) { + *video_ssrc = (uint32_t) ((intptr_t) payloads + (uint32_t) time(NULL)); + } + + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + new_jingle_iq(session, &iq, &jingle, &id, description == LDL_DESCRIPTION_ACCEPT ? "session-accept" : "session-initiate"); + iks_insert_attrib(jingle, "initiator", session->initiator ? session->initiator : session->them); + + if (compat) { + sess = iks_insert (iq, "ses:session"); + iks_insert_attrib(sess, "xmlns:ses", "http://www.google.com/session"); + + iks_insert_attrib(sess, "type", description == LDL_DESCRIPTION_ACCEPT ? "accept" : "initiate"); + iks_insert_attrib(sess, "id", session->id); + iks_insert_attrib(sess, "initiator", session->initiator ? session->initiator : session->them); } - if (payloads[x].bps) { - sprintf(idbuf, "%d", payloads[x].bps); - iks_insert_attrib(payload, "bitrate", idbuf); + + } else { + new_session_iq(session, &iq, &sess, &id, description == LDL_DESCRIPTION_ACCEPT ? "accept" : "initiate"); + } + + + /* Check if this is a video call */ + for (x = 0; x < plen; x++) { + if (payloads[x].type == LDL_PAYLOAD_VIDEO) { + video_call = 1; + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + jin_video = iks_insert(jingle, "jin:content"); + iks_insert_attrib(jin_video, "name", "video"); + iks_insert_attrib(jin_video, "creator", "initiator"); + //iks_insert_attrib(jin_video, "senders", "both"); + jin_video_desc = iks_insert(jin_video, "rtp:description"); + iks_insert_attrib(jin_video_desc, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); + iks_insert_attrib(jin_video_desc, "media", "video"); + snprintf(tmp, sizeof(tmp), "%u", *video_ssrc); + iks_insert_attrib(jin_video_desc, "ssrc", tmp); + tp = iks_insert(jin_video, "p:transport"); + iks_insert_attrib(tp, "xmlns:p", "http://www.google.com/transport/p2p"); + + } + + break; } } + + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + jin_audio = iks_insert(jingle, "jin:content"); + iks_insert_attrib(jin_audio, "name", "audio"); + iks_insert_attrib(jin_audio, "creator", "initiator"); + //iks_insert_attrib(jin_audio, "senders", "both"); + jin_audio_desc = iks_insert(jin_audio, "rtp:description"); + iks_insert_attrib(jin_audio_desc, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); + iks_insert_attrib(jin_audio_desc, "media", "audio"); + snprintf(tmp, sizeof(tmp), "%u", *audio_ssrc); + iks_insert_attrib(jin_audio_desc, "ssrc", tmp); + tp = iks_insert(jin_audio, "p:transport"); + iks_insert_attrib(tp, "xmlns:p", "http://www.google.com/transport/p2p"); + } + + if (compat) { + + if (video_call) { + tag = iks_insert(sess, "vid:description"); + iks_insert_attrib(tag, "xmlns:vid", "http://www.google.com/session/video"); + } else { + tag = iks_insert(sess, "pho:description"); + iks_insert_attrib(tag, "xmlns:pho", "http://www.google.com/session/phone"); + } + + if (video_call) { + + for (x = 0; x < plen; x++) { + char idbuf[80]; + + if (payloads[x].type != LDL_PAYLOAD_VIDEO) { + continue; + } + + sprintf(idbuf, "%d", payloads[x].id); + + + payload = iks_insert(tag, "vid:payload-type"); + + iks_insert_attrib(payload, "id", idbuf); + iks_insert_attrib(payload, "name", payloads[x].name); + + if (payloads[x].type == LDL_PAYLOAD_VIDEO && video_call) { + if (payloads[x].width) { + sprintf(idbuf, "%d", payloads[x].width); + iks_insert_attrib(payload, "width", idbuf); + } + if (payloads[x].height) { + sprintf(idbuf, "%d", payloads[x].height); + iks_insert_attrib(payload, "height", idbuf); + } + if (payloads[x].framerate) { + sprintf(idbuf, "%d", payloads[x].framerate); + iks_insert_attrib(payload, "framerate", idbuf); + } + } + + } + + + //if (vid_mux) { + // iks_insert(tag, "rtcp-mux"); + //} + + //payload = iks_insert(tag, "vid:src-id"); + //iks_insert_cdata(payload, "123456789", 0); + + + //iks_insert_attrib(payload, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); + //iks_insert(payload, "vid:usage"); + } + } + + for (x = 0; x < plen; x++) { + char idbuf[80]; + + if (payloads[x].type == LDL_PAYLOAD_VIDEO && !video_call) { + continue; + } + + sprintf(idbuf, "%d", payloads[x].id); + + if (payloads[x].type == LDL_PAYLOAD_AUDIO) { + + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + char ratebuf[80]; + char buf[80]; + iks *param; + + jpayload = iks_insert(jin_audio_desc, "rtp:payload-type"); + iks_insert_attrib(jpayload, "id", idbuf); + sprintf(ratebuf, "%d", payloads[x].rate); + iks_insert_attrib(jpayload, "name", payloads[x].name); + iks_insert_attrib(jpayload, "clockrate", ratebuf); + param = iks_insert(jpayload, "rtp:parameter"); + iks_insert_attrib(param, "name", "bitrate"); + sprintf(buf, "%d", payloads[x].bps); + iks_insert_attrib(param, "value", buf); + + sprintf(buf, "%d", payloads[x].ptime); + iks_insert_attrib(jpayload, "ptime", ratebuf); + iks_insert_attrib(jpayload, "maxptime", ratebuf); + + } + + } else if (payloads[x].type == LDL_PAYLOAD_VIDEO && video_call) { + + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + char buf[80]; + iks *param; + + jpayload = iks_insert(jin_video_desc, "rtp:payload-type"); + iks_insert_attrib(jpayload, "id", idbuf); + iks_insert_attrib(jpayload, "name", payloads[x].name); + param = iks_insert(jpayload, "rtp:parameter"); + iks_insert_attrib(param, "name", "width"); + sprintf(buf, "%d", payloads[x].width); + iks_insert_attrib(param, "value", buf); + + + param = iks_insert(jpayload, "rtp:parameter"); + iks_insert_attrib(param, "name", "height"); + sprintf(buf, "%d", payloads[x].height); + iks_insert_attrib(param, "value", buf); + + param = iks_insert(jpayload, "rtp:parameter"); + iks_insert_attrib(param, "name", "framerate"); + sprintf(buf, "%d", payloads[x].framerate); + iks_insert_attrib(param, "value", buf); + + } + } + + if (compat) { + + if (payloads[x].type == LDL_PAYLOAD_AUDIO) { + + payload = iks_insert(tag, "pho:payload-type"); + + iks_insert_attrib(payload, "id", idbuf); + iks_insert_attrib(payload, "name", payloads[x].name); + + if (payloads[x].rate) { + sprintf(idbuf, "%d", payloads[x].rate); + iks_insert_attrib(payload, "clockrate", idbuf); + } + + if (payloads[x].bps) { + sprintf(idbuf, "%d", payloads[x].bps); + iks_insert_attrib(payload, "bitrate", idbuf); + } + + iks_insert_attrib(payload, "xmlns:pho", "http://www.google.com/session/phone"); + } + } + //if (payloads[x].id == 34) payloads[x].id = 98; /* XXX */ + + } + + if ((session->handle->flags & LDL_FLAG_JINGLE)) { + if (jin_video_desc && video_crypto_data) { + payload = iks_insert(jin_video_desc, "rtp:encryption"); + crypto = iks_insert(payload, "rtp:crypto"); + iks_insert_attrib(crypto, "crypto-suite", video_crypto_data->suite); + iks_insert_attrib(crypto, "key-params", video_crypto_data->key); + iks_insert_attrib(crypto, "tag", video_crypto_data->tag); + } + + + if (jin_audio_desc && audio_crypto_data) { + payload = iks_insert(jin_audio_desc, "rtp:encryption"); + crypto = iks_insert(payload, "rtp:crypto"); + iks_insert_attrib(crypto, "crypto-suite", audio_crypto_data->suite); + iks_insert_attrib(crypto, "key-params", audio_crypto_data->key); + iks_insert_attrib(crypto, "tag", audio_crypto_data->tag); + } + } + + //if (aud_mux) { + // iks_insert(tag, "rtcp-mux"); + //} + + //payload = iks_insert(tag, "pho:src-id"); + //iks_insert_cdata(payload, "987654321", 0); + //iks_insert_attrib(payload, "xmlns:pho", "http://www.google.com/session/phone"); + + //payload = iks_insert(tag, "rtp:encryption"); + //iks_insert_attrib(payload, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); + //u = iks_insert(payload, "pho:usage"); + //iks_insert_attrib(u, "xmlns:pho", "http://www.google.com/session/phone"); + +#if 0 if (description == LDL_DESCRIPTION_INITIATE) { tp = iks_insert (sess, "transport"); iks_insert_attrib(tp, "xmlns", "http://www.google.com/transport/p2p"); } - +#endif + + schedule_packet(session->handle, id, iq, LDL_RETRY); return id; @@ -2282,11 +2990,13 @@ ldl_state_t ldl_session_get_state(ldl_session_t *session) return session->state; } -ldl_status ldl_session_get_candidates(ldl_session_t *session, ldl_candidate_t **candidates, unsigned int *len) +ldl_status ldl_session_get_candidates(ldl_session_t *session, ldl_transport_type_t tport, ldl_candidate_t **candidates, unsigned int *len) { + assert(tport < LDL_TPORT_MAX); + if (session->candidate_len) { - *candidates = session->candidates; - *len = session->candidate_len; + *candidates = session->candidates[tport]; + *len = session->candidate_len[tport]; return LDL_STATUS_SUCCESS; } else { *candidates = NULL; @@ -2332,7 +3042,7 @@ ldl_status ldl_global_init(int debug) memset(&globals, 0, sizeof(globals)); if (apr_pool_create(&globals.memory_pool, NULL) != LDL_STATUS_SUCCESS) { - globals.logger(DL_LOG_DEBUG, "Could not allocate memory pool\n"); + globals.logger(DL_LOG_CRIT, "Could not allocate memory pool\n"); return LDL_STATUS_MEMERR; } diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h index 6cf8bd846b..e76be86ecf 100644 --- a/libs/libdingaling/src/libdingaling.h +++ b/libs/libdingaling/src/libdingaling.h @@ -28,6 +28,7 @@ * libdingaling.h -- Main Header File * */ + /*! \file libdingaling.h \brief Main Header File */ @@ -60,12 +61,18 @@ extern "C" { #endif #define LDL_HANDLE_QLEN 2000 -#define LDL_MAX_CANDIDATES 10 +#define LDL_MAX_CANDIDATES 25 #define LDL_MAX_PAYLOADS 50 #define LDL_RETRY 3 #define IKS_NS_COMPONENT "jabber:component:accept" -/* period between keep alive signals in 1sec units*/ -#define LDL_KEEPALIVE_TIMEOUT 300 +/* period between keep alive signals in 0.1sec units*/ +#define LDL_KEEPALIVE_TIMEOUT 6000 + +typedef struct ldl_crypto_data_s { + char *tag; + char *suite; + char *key; +} ldl_crypto_data_t; /*! \brief A structure to store a jingle candidate */ struct ldl_candidate { @@ -90,19 +97,89 @@ struct ldl_candidate { }; typedef struct ldl_candidate ldl_candidate_t; -/*! \brief A structure to store a jingle payload */ +typedef enum { + LDL_PAYLOAD_AUDIO, + LDL_PAYLOAD_VIDEO +} ldl_payload_type_t; + +/*! \brief A structure to store a jingle audio payload */ struct ldl_payload { + /*! the type of the payload */ + ldl_payload_type_t type; /*! the iana name of the payload type */ char *name; /*! the iana id of the payload type */ unsigned int id; + + /* Audio */ + /*! the transfer rate of the payload type */ unsigned int rate; /*! the bits per second of the payload type */ unsigned int bps; + + /* Video */ + + /*! the width of the video payload type */ + unsigned int width; + /*! the width of the video payload type */ + unsigned int height; + /*! the framerate of the video payload type */ + unsigned int framerate; + + unsigned int ptime; }; typedef struct ldl_payload ldl_payload_t; + +enum ldl_transport_type { + LDL_TPORT_RTP, + LDL_TPORT_VIDEO_RTP, + LDL_TPORT_RTCP, + LDL_TPORT_VIDEO_RTCP, + + /* Nothing below that line */ + LDL_TPORT_MAX +}; +typedef enum ldl_transport_type ldl_transport_type_t; + +static inline const char *ldl_transport_type_str(ldl_transport_type_t type) +{ + static const char *name[] = { "rtp", "video_rtp", "rtcp", "video_rtcp" }; + return type >= LDL_TPORT_MAX ? NULL : name[type]; +} + +static inline ldl_transport_type_t ldl_transport_type_parse(const char *type) { + if (!strcasecmp(type, "rtp")) { + return LDL_TPORT_RTP; + } else if (!strcasecmp(type, "rtcp")) { + return LDL_TPORT_RTCP; + } else if (!strcasecmp(type, "video_rtp")) { + return LDL_TPORT_VIDEO_RTP; + } else if (!strcasecmp(type, "video_rtcp")) { + return LDL_TPORT_VIDEO_RTCP; + } else { + return LDL_TPORT_MAX; + } +} + +#if 0 +/*! \brief A structure to store a jingle video payload */ +struct ldl_vpayload { + /*! the iana name of the video payload type */ + char *name; + /*! the iana id of the video payload type */ + unsigned int id; + /*! the width of the video payload type */ + unsigned int width; + /*! the width of the video payload type */ + unsigned int height; + /*! the framerate of the video payload type */ + unsigned int framerate; +}; +typedef struct ldl_vpayload ldl_vpayload_t; +#endif + struct ldl_handle; typedef struct ldl_handle ldl_handle_t; @@ -132,7 +209,8 @@ typedef enum { LDL_FLAG_SASL_MD5 = (1 << 12), LDL_FLAG_COMPONENT = (1 << 13), LDL_FLAG_OUTBOUND = (1 << 14), - LDL_FLAG_GATEWAY = (1 << 15) + LDL_FLAG_GATEWAY = (1 << 15), + LDL_FLAG_JINGLE = (1 << 16) } ldl_user_flag_t; typedef enum { @@ -514,9 +592,10 @@ unsigned int ldl_session_transport(ldl_session_t *session, \return the message_id of the generated xmpp request */ unsigned int ldl_session_describe(ldl_session_t *session, - ldl_payload_t *payloads, - unsigned int plen, - ldl_description_t description); + ldl_payload_t *payloads, + unsigned int plen, + ldl_description_t description, unsigned int *audio_ssrc, unsigned int *video_ssrc, + ldl_crypto_data_t *audio_crypto_data, ldl_crypto_data_t *video_crypto_data); /*! @@ -530,11 +609,12 @@ ldl_state_t ldl_session_get_state(ldl_session_t *session); /*! \brief get the candidates \param session the session + \param tport type of transport (rtp,rtcp,video_rtp,video_rtcp,etc.) \param candidates pointer to point at array of the candidates \param len the resulting len of the array pointer \return success or failure */ -ldl_status ldl_session_get_candidates(ldl_session_t *session, ldl_candidate_t **candidates, unsigned int *len); +ldl_status ldl_session_get_candidates(ldl_session_t *session, ldl_transport_type_t tport, ldl_candidate_t **candidates, unsigned int *len); /*! \brief get the payloads diff --git a/src/mod/endpoints/mod_dingaling/Makefile b/src/mod/endpoints/mod_dingaling/Makefile index f2ac13bb7a..c56dc228cb 100644 --- a/src/mod/endpoints/mod_dingaling/Makefile +++ b/src/mod/endpoints/mod_dingaling/Makefile @@ -9,7 +9,7 @@ IKS_LA=$(IKS_DIR)/src/libiksemel.la 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_SOURCES=$(DING_DIR)/src/libdingaling.c $(DING_DIR)/src/sha1.c $(DING_DIR)/src/libdingaling.h LOCAL_LDFLAGS=$(LIBGNUTLS_LIBS) include $(BASE)/build/modmake.rules diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 735a68efc7..6bf84be1f2 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -33,8 +33,11 @@ #include #include +#define MDL_RTCP_DUR 5000 #define DL_CAND_WAIT 10000000 #define DL_CAND_INITIAL_WAIT 2000000 +//#define DL_CAND_WAIT 2000000 +//#define DL_CAND_INITIAL_WAIT 5000000 #define DL_EVENT_LOGIN_SUCCESS "dingaling::login_success" #define DL_EVENT_LOGIN_FAILURE "dingaling::login_failure" @@ -79,7 +82,8 @@ typedef enum { TFLAG_TERM = (1 << 21), TFLAG_TRANSPORT_ACCEPT = (1 << 22), TFLAG_READY = (1 << 23), - TFLAG_NAT_MAP = (1 << 24) + TFLAG_NAT_MAP = (1 << 24), + TFLAG_SECURE = (1 << 25) } TFLAGS; typedef enum { @@ -144,47 +148,103 @@ struct mdl_profile { }; typedef struct mdl_profile mdl_profile_t; -struct private_object { - unsigned int flags; +/*! \brief The required components to setup a jingle transport */ +typedef struct mdl_transport { + char *remote_ip; + switch_port_t remote_port; + + switch_port_t local_port; /*!< The real local port */ + switch_port_t adv_local_port; + unsigned int ssrc; + + char local_user[17]; + char local_pass[17]; + char *remote_user; + char *remote_pass; + int ptime; + int payload_count; + int restart_rtp; + switch_codec_t read_codec; switch_codec_t write_codec; + switch_frame_t read_frame; + + uint32_t codec_rate; + char *codec_name; + + switch_payload_t codec_num; + switch_payload_t r_codec_num; + + char *stun_ip; + uint16_t stun_port; + + switch_rtp_t *rtp_session; + ldl_transport_type_t type; + + int total; + int accepted; + + int ready; + + int codec_index; + + int vid_width; + int vid_height; + int vid_rate; + + switch_byte_t has_crypto; + int crypto_tag; + unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]; + unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]; + switch_rtp_crypto_key_type_t crypto_send_type; + switch_rtp_crypto_key_type_t crypto_recv_type; + switch_rtp_crypto_key_type_t crypto_type; + + char *local_crypto_key; + char *remote_crypto_key; + + ldl_crypto_data_t *local_crypto_data; + +} mdl_transport_t; + + +struct private_object { + unsigned int flags; mdl_profile_t *profile; switch_core_session_t *session; + switch_channel_t *channel; + switch_caller_profile_t *caller_profile; unsigned short samprate; switch_mutex_t *mutex; const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS]; unsigned int num_codecs; - int codec_index; - switch_rtp_t *rtp_session; + + mdl_transport_t transports[LDL_TPORT_MAX+1]; + ldl_session_t *dlsession; - char *remote_ip; - switch_port_t local_port; - switch_port_t adv_local_port; - switch_port_t remote_port; - char local_user[17]; - char local_pass[17]; - char *remote_user; + char *us; char *them; unsigned int cand_id; unsigned int desc_id; unsigned int dc; + uint32_t timestamp_send; int32_t timestamp_recv; uint32_t last_read; - char *codec_name; - switch_payload_t codec_num; - switch_payload_t r_codec_num; - uint32_t codec_rate; + switch_time_t next_desc; switch_time_t next_cand; - char *stun_ip; + char *recip; char *dnis; - uint16_t stun_port; switch_mutex_t *flag_mutex; + + int read_count; + + }; struct rfc2833_digit { @@ -744,8 +804,12 @@ static void terminate_session(switch_core_session_t **session, int line, switch_ tech_pvt = switch_core_session_get_private(*session); - if (tech_pvt && tech_pvt->profile && tech_pvt->profile->ip && tech_pvt->local_port) { - switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->local_port); + if (tech_pvt && tech_pvt->profile && tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_RTP].local_port) { + switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_RTP].local_port); + } + + if (tech_pvt && tech_pvt->profile && tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { + switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); } if (!switch_core_session_running(*session) && (!tech_pvt || !switch_test_flag(tech_pvt, TFLAG_READY))) { @@ -811,16 +875,35 @@ static void dl_logger(char *file, const char *func, int line, int level, char *f static int get_codecs(struct private_object *tech_pvt) { + char *codec_string = NULL; + const char *var; + char *codec_order[SWITCH_MAX_CODECS]; + int codec_order_last; + char **codec_order_p = NULL; + + switch_assert(tech_pvt != NULL); switch_assert(tech_pvt->session != NULL); if (!tech_pvt->num_codecs) { - if (globals.codec_string) { + + if ((var = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) { + codec_string = (char *)var; + codec_order_last = switch_separate_string(codec_string, ',', codec_order, SWITCH_MAX_CODECS); + codec_order_p = codec_order; + } else { + codec_string = globals.codec_string; + codec_order_last = globals.codec_order_last; + codec_order_p = globals.codec_order; + } + + if (codec_string) { if ((tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, - SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last)) <= 0) { + SWITCH_MAX_CODECS, codec_order_p, codec_order_last)) <= 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n"); return 0; } + } else if (((tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n"); return 0; @@ -864,76 +947,246 @@ static void handle_thread_launch(ldl_handle_t *handle) } -static int activate_rtp(struct private_object *tech_pvt) +switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_type_t ttype, + int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction) +{ + unsigned char b64_key[512] = ""; + const char *type_str; + unsigned char *key; + char *p; + + + if (!switch_test_flag(tech_pvt, TFLAG_SECURE)) { + return SWITCH_STATUS_SUCCESS; + } + + + if (type == AES_CM_128_HMAC_SHA1_80) { + type_str = SWITCH_RTP_CRYPTO_KEY_80; + } else { + type_str = SWITCH_RTP_CRYPTO_KEY_32; + } + + if (direction == SWITCH_RTP_CRYPTO_SEND) { + key = tech_pvt->transports[ttype].local_raw_key; + } else { + key = tech_pvt->transports[ttype].remote_raw_key; + + } + + switch_rtp_get_random(key, SWITCH_RTP_KEY_LEN); + switch_b64_encode(key, SWITCH_RTP_KEY_LEN, b64_key, sizeof(b64_key)); + p = strrchr((char *) b64_key, '='); + + while (p && *p && *p == '=') { + *p-- = '\0'; + } + + tech_pvt->transports[ttype].local_crypto_key = switch_core_session_sprintf(tech_pvt->session, "%d %s inline:%s", index, type_str, b64_key); + tech_pvt->transports[ttype].local_crypto_data = switch_core_session_alloc(tech_pvt->session, sizeof(ldl_crypto_data_t)); + tech_pvt->transports[ttype].local_crypto_data->tag = switch_core_session_sprintf(tech_pvt->session, "%d", index); + tech_pvt->transports[ttype].local_crypto_data->suite = switch_core_session_strdup(tech_pvt->session, type_str); + tech_pvt->transports[ttype].local_crypto_data->key = switch_core_session_sprintf(tech_pvt->session, "inline:%s", (char *)b64_key); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Local Key [%s]\n", tech_pvt->transports[ttype].local_crypto_key); + + tech_pvt->transports[ttype].crypto_type = AES_CM_128_NULL_AUTH; + + + return SWITCH_STATUS_SUCCESS; +} + + +static switch_status_t mdl_add_crypto(struct private_object *tech_pvt, + ldl_transport_type_t ttype, const char *key_str, switch_rtp_crypto_direction_t direction) +{ + unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN]; + switch_rtp_crypto_key_type_t type; + char *p; + + + p = strchr(key_str, ' '); + + if (p && *p && *(p + 1)) { + p++; + if (!strncasecmp(p, SWITCH_RTP_CRYPTO_KEY_32, strlen(SWITCH_RTP_CRYPTO_KEY_32))) { + type = AES_CM_128_HMAC_SHA1_32; + } else if (!strncasecmp(p, SWITCH_RTP_CRYPTO_KEY_80, strlen(SWITCH_RTP_CRYPTO_KEY_80))) { + type = AES_CM_128_HMAC_SHA1_80; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Parse Error near [%s]\n", p); + goto bad; + } + + p = strchr(p, ' '); + if (p && *p && *(p + 1)) { + p++; + if (strncasecmp(p, "inline:", 7)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Parse Error near [%s]\n", p); + goto bad; + } + + p += 7; + switch_b64_decode(p, (char *) key, sizeof(key)); + + if (direction == SWITCH_RTP_CRYPTO_SEND) { + tech_pvt->transports[ttype].crypto_send_type = type; + memcpy(tech_pvt->transports[ttype].local_raw_key, key, SWITCH_RTP_KEY_LEN); + } else { + tech_pvt->transports[ttype].crypto_recv_type = type; + memcpy(tech_pvt->transports[ttype].remote_raw_key, key, SWITCH_RTP_KEY_LEN); + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, + "%s Setting %s crypto key\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session)); + tech_pvt->transports[ttype].has_crypto++; + + + return SWITCH_STATUS_SUCCESS; + } + + } + + bad: + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Error!\n"); + return SWITCH_STATUS_FALSE; + +} + +static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t ttype) +{ + + if (!switch_test_flag(tech_pvt, TFLAG_SECURE)) { + return; + } + + + //if (tech_pvt->transports[ttype].crypto_type) { + switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, + SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->transports[ttype].crypto_type, + tech_pvt->transports[ttype].local_raw_key, SWITCH_RTP_KEY_LEN); + + + switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, + SWITCH_RTP_CRYPTO_RECV, tech_pvt->transports[ttype].crypto_tag, + tech_pvt->transports[ttype].crypto_type, + tech_pvt->transports[ttype].remote_raw_key, SWITCH_RTP_KEY_LEN); + + switch_channel_set_variable(tech_pvt->channel, "jingle_secure_audio_confirmed", "true"); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, + "%s %s crypto confirmed\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session)); + + //} + +} + + + +static int activate_audio_rtp(struct private_object *tech_pvt) { switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); const char *err; - int ms = 0; + int ms = tech_pvt->transports[LDL_TPORT_RTP].ptime; switch_rtp_flag_t flags; + int locked = 0; + int r = 1; - if (switch_rtp_ready(tech_pvt->rtp_session)) { + + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { return 1; } - if (!(tech_pvt->remote_ip && tech_pvt->remote_port)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid candidates received!\n"); + if (!(tech_pvt->transports[LDL_TPORT_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_RTP].remote_port)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid rtp candidates received!\n"); return 0; } - if (switch_core_codec_init(&tech_pvt->read_codec, - tech_pvt->codec_name, - NULL, - tech_pvt->codec_rate, - ms, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; + if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].read_codec)) { + locked = 1; + switch_mutex_lock(tech_pvt->transports[LDL_TPORT_RTP].read_codec.mutex); + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { + switch_rtp_kill_socket(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); + switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_RTP].rtp_session); + } + + + } else { + if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_RTP].read_codec, + tech_pvt->transports[LDL_TPORT_RTP].codec_name, + NULL, + tech_pvt->transports[LDL_TPORT_RTP].codec_rate, + ms, + 1, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + r = 0; + goto end; + } + tech_pvt->transports[LDL_TPORT_RTP].read_frame.rate = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_second; + tech_pvt->transports[LDL_TPORT_RTP].read_frame.codec = &tech_pvt->transports[LDL_TPORT_RTP].read_codec; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Read Codec to %s@%d\n", + tech_pvt->transports[LDL_TPORT_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_second); + + if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_RTP].write_codec, + tech_pvt->transports[LDL_TPORT_RTP].codec_name, + NULL, + tech_pvt->transports[LDL_TPORT_RTP].codec_rate, + ms, + 1, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + r = 0; + goto end; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n", + tech_pvt->transports[LDL_TPORT_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_RTP].write_codec.implementation->samples_per_second); + + switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec); + switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].write_codec); } - tech_pvt->read_frame.rate = tech_pvt->read_codec.implementation->samples_per_second; - tech_pvt->read_frame.codec = &tech_pvt->read_codec; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Read Codec to %s@%d\n", - tech_pvt->codec_name, (int) tech_pvt->read_codec.implementation->samples_per_second); - - if (switch_core_codec_init(&tech_pvt->write_codec, - tech_pvt->codec_name, - NULL, - tech_pvt->codec_rate, - ms, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n", - tech_pvt->codec_name, (int) tech_pvt->write_codec.implementation->samples_per_second); - - switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec); - switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec); - - if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->transports[LDL_TPORT_RTP].remote_ip, tech_pvt->profile->local_network)) { switch_port_t external_port = 0; - switch_nat_add_mapping((switch_port_t) tech_pvt->local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE); + switch_nat_add_mapping((switch_port_t) tech_pvt->transports[LDL_TPORT_RTP].local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE); if (external_port) { - tech_pvt->adv_local_port = external_port; + tech_pvt->transports[LDL_TPORT_RTP].adv_local_port = external_port; switch_set_flag(tech_pvt, TFLAG_NAT_MAP); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NAT mapping returned 0. Run freeswitch with -nonat since it's not working right.\n"); } } - if (tech_pvt->adv_local_port != tech_pvt->local_port) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP RTP %s:%d(%d) -> %s:%d\n", tech_pvt->profile->ip, - tech_pvt->local_port, tech_pvt->adv_local_port, tech_pvt->remote_ip, tech_pvt->remote_port); + if (tech_pvt->transports[LDL_TPORT_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_RTP].local_port) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", + tech_pvt->profile->ip, + tech_pvt->transports[LDL_TPORT_RTP].local_port, + tech_pvt->transports[LDL_TPORT_RTP].adv_local_port, + tech_pvt->transports[LDL_TPORT_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_RTP].remote_port, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet + + ); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip, - tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", + tech_pvt->profile->ip, + tech_pvt->transports[LDL_TPORT_RTP].local_port, + tech_pvt->transports[LDL_TPORT_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_RTP].remote_port, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet + ); } flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG; @@ -947,128 +1200,390 @@ static int activate_rtp(struct private_object *tech_pvt) flags &= ~SWITCH_RTP_FLAG_AUTOADJ; } - if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip, - tech_pvt->local_port, - tech_pvt->remote_ip, - tech_pvt->remote_port, - tech_pvt->codec_num, - tech_pvt->read_codec.implementation->samples_per_packet, - tech_pvt->read_codec.implementation->microseconds_per_packet, - flags, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session)))) { + if (!(tech_pvt->transports[LDL_TPORT_RTP].rtp_session = switch_rtp_new(tech_pvt->profile->ip, + tech_pvt->transports[LDL_TPORT_RTP].local_port, + tech_pvt->transports[LDL_TPORT_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_RTP].remote_port, + tech_pvt->transports[LDL_TPORT_RTP].codec_num, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet, + tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet, + flags, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session)))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; + r = 0; + goto end; } else { uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0; uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0; uint8_t inb = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1; - switch_rtp_activate_ice(tech_pvt->rtp_session, tech_pvt->remote_user, tech_pvt->local_user); + + switch_rtp_set_ssrc(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_RTP].ssrc); + + if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) { + switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, MDL_RTCP_DUR, + tech_pvt->transports[LDL_TPORT_RTCP].remote_port); + + } + + try_secure(tech_pvt, LDL_TPORT_RTP); + + switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_RTP].remote_user, + tech_pvt->transports[LDL_TPORT_RTP].local_user, + tech_pvt->transports[LDL_TPORT_RTP].remote_pass); + if ((vad_in && inb) || (vad_out && !inb)) { - if (switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING) != SWITCH_STATUS_SUCCESS) { + if (switch_rtp_enable_vad(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec, SWITCH_VAD_FLAG_TALKING) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VAD ERROR %s\n", err); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; + r = 0; + goto end; } switch_set_flag_locked(tech_pvt, TFLAG_VAD); } - switch_rtp_set_cng_pt(tech_pvt->rtp_session, 13); - switch_rtp_set_telephony_event(tech_pvt->rtp_session, 101); + //switch_rtp_set_cng_pt(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 13); + switch_rtp_set_telephony_event(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 101); + + if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) { + switch_rtp_activate_rtcp_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_RTCP].remote_user, + tech_pvt->transports[LDL_TPORT_RTCP].local_user, + tech_pvt->transports[LDL_TPORT_RTCP].remote_pass); + + } + + + } - return 1; + end: + + if (locked) { + switch_mutex_unlock(tech_pvt->transports[LDL_TPORT_RTP].read_codec.mutex); + } + + return r; +} + + +static int activate_video_rtp(struct private_object *tech_pvt) +{ + switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); + const char *err; + int ms = 0; + switch_rtp_flag_t flags; + int r = 1, locked = 0; + + + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { + r = 1; goto end; + } + + if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid video_rtp candidates received!\n"); + r = 0; goto end; + } + + if (zstr(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid video_rtp codecs received!\n"); + r = 0; goto end; + } + + if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec)) { + locked = 1; + switch_mutex_lock(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.mutex); + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { + switch_rtp_kill_socket(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); + switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); + } + + + + + + } else { + if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, + NULL, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate, + ms, + 1, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + r = 0; goto end; + } + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.rate = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_second; + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.codec = &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Read Codec to %s@%d\n", + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_second); + + if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].write_codec, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, + NULL, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate, + ms, + 1, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + r = 0; goto end; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n", + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_VIDEO_RTP].write_codec.implementation->samples_per_second); + + switch_core_session_set_video_read_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec); + switch_core_session_set_video_write_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].write_codec); + } + + if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, tech_pvt->profile->local_network)) { + switch_port_t external_port = 0; + switch_nat_add_mapping((switch_port_t) tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE); + + if (external_port) { + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port = external_port; + switch_set_flag(tech_pvt, TFLAG_NAT_MAP); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NAT mapping returned 0. Run freeswitch with -nonat since it's not working right.\n"); + } + } + + + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", + tech_pvt->profile->ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_packet, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->microseconds_per_packet + + ); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", + tech_pvt->profile->ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_packet, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->microseconds_per_packet + ); + } + + + flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_VIDEO; + + + if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) { + flags &= ~SWITCH_RTP_FLAG_AUTOADJ; + } + + if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session = switch_rtp_new(tech_pvt->profile->ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num, + 1, + 90000, + flags, NULL, &err, switch_core_session_get_pool(tech_pvt->session)))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + r = 0; goto end; + } else { + switch_rtp_set_ssrc(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc); + + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) { + switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, MDL_RTCP_DUR, + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port); + } + try_secure(tech_pvt, LDL_TPORT_VIDEO_RTP); + + + switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_user, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_user, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_pass); + switch_channel_set_flag(channel, CF_VIDEO); + //switch_rtp_set_default_payload(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].r_codec_num); + + + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) { + + switch_rtp_activate_rtcp_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_user, + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].local_user, + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_pass); + } + + + + } + + end: + if (locked) { + switch_mutex_unlock(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.mutex); + } + + return r; } -static int do_candidates(struct private_object *tech_pvt, int force) +static int activate_rtp(struct private_object *tech_pvt) +{ + int r = 0; + + if (tech_pvt->transports[LDL_TPORT_RTP].ready) { + r += activate_audio_rtp(tech_pvt); + } + + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) { + r += activate_video_rtp(tech_pvt); + } + + return r; +} + + +static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_type_t ttype, ldl_candidate_t *cand, int force) { switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); + char *advip = tech_pvt->profile->extip ? tech_pvt->profile->extip : tech_pvt->profile->ip; + char *err = NULL, *address = NULL; + + if (!force && tech_pvt->transports[ttype].ready) { + return 0; + } + + if (switch_test_flag(tech_pvt, TFLAG_LANADDR)) { + advip = tech_pvt->profile->ip; + } + address = advip; + + if(address && !strncasecmp(address, "host:", 5)) { + address = address + 5; + } + + memset(cand, 0, sizeof(*cand)); + switch_stun_random_string(tech_pvt->transports[ttype].local_user, 16, NULL); + switch_stun_random_string(tech_pvt->transports[ttype].local_pass, 16, NULL); + + cand->port = tech_pvt->transports[ttype].adv_local_port; + cand->address = address; + + if (!strncasecmp(advip, "stun:", 5)) { + char *stun_ip = advip + 5; + + if (tech_pvt->transports[ttype].stun_ip) { + cand->address = tech_pvt->transports[ttype].stun_ip; + cand->port = tech_pvt->transports[ttype].stun_port; + } else { + if (!stun_ip) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! NO STUN SERVER!\n"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return 0; + } + + cand->address = tech_pvt->profile->ip; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Stun Lookup Local %s:%d\n", cand->address, + cand->port); + if (switch_stun_lookup + (&cand->address, &cand->port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &err, + switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, + SWITCH_STUN_DEFAULT_PORT, err); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return 0; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_INFO, "Stun Success %s:%d\n", cand->address, cand->port); + } + cand->type = "stun"; + tech_pvt->transports[ttype].stun_ip = switch_core_session_strdup(tech_pvt->session, cand->address); + tech_pvt->transports[ttype].stun_port = cand->port; + } else { + cand->type = "local"; + } + + cand->name = (char *)ldl_transport_type_str(ttype); + cand->username = tech_pvt->transports[ttype].local_user; + cand->password = tech_pvt->transports[ttype].local_pass; + cand->pref = 1; + cand->protocol = "udp"; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, + "Send %s Candidate %s:%d [%s]\n", ldl_transport_type_str(ttype), cand->address, cand->port, + cand->username); + + + + tech_pvt->transports[ttype].ready = 1; + + return 1; +} + + +static int do_candidates(struct private_object *tech_pvt, int force) +{ + ldl_candidate_t cand[4] = {{0}}; + int idx = 0; if (switch_test_flag(tech_pvt, TFLAG_DO_CAND)) { return 1; } tech_pvt->next_cand += DL_CAND_WAIT; - if (switch_test_flag(tech_pvt, TFLAG_BYE)) { + if (switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->dlsession) { return 0; } switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND); - 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, *address = NULL; - - memset(cand, 0, sizeof(cand)); - switch_stun_random_string(tech_pvt->local_user, 16, NULL); - switch_stun_random_string(tech_pvt->local_pass, 16, NULL); - - 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 = address; - - if (!strncasecmp(advip, "stun:", 5)) { - char *stun_ip = advip + 5; - - if (tech_pvt->stun_ip) { - cand[0].address = tech_pvt->stun_ip; - cand[0].port = tech_pvt->stun_port; - } else { - if (!stun_ip) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! NO STUN SERVER!\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; - } - - cand[0].address = tech_pvt->profile->ip; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Stun Lookup Local %s:%d\n", cand[0].address, - cand[0].port); - if (switch_stun_lookup - (&cand[0].address, &cand[0].port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &err, - switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, - SWITCH_STUN_DEFAULT_PORT, err); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_INFO, "Stun Success %s:%d\n", cand[0].address, cand[0].port); - } - cand[0].type = "stun"; - tech_pvt->stun_ip = switch_core_session_strdup(tech_pvt->session, cand[0].address); - tech_pvt->stun_port = cand[0].port; - } else { - cand[0].type = "local"; - } - - cand[0].name = "rtp"; - cand[0].username = tech_pvt->local_user; - cand[0].password = tech_pvt->local_pass; - cand[0].pref = 1; - cand[0].protocol = "udp"; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port, - cand[0].username); + idx += do_tport_candidates(tech_pvt, LDL_TPORT_RTP, &cand[idx], force); + idx += do_tport_candidates(tech_pvt, LDL_TPORT_RTCP, &cand[idx], force); + idx += do_tport_candidates(tech_pvt, LDL_TPORT_VIDEO_RTP, &cand[idx], force); + idx += do_tport_candidates(tech_pvt, LDL_TPORT_VIDEO_RTCP, &cand[idx], force); + if (idx && cand[0].name) { if (ldl_session_gateway(tech_pvt->dlsession) && switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - tech_pvt->cand_id = ldl_session_transport(tech_pvt->dlsession, cand, 1); + tech_pvt->cand_id = ldl_session_transport(tech_pvt->dlsession, cand, idx); } else { - tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1); + tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, idx); } + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtp candidates.\n", + tech_pvt->transports[LDL_TPORT_RTP].accepted, tech_pvt->transports[LDL_TPORT_RTP].total); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtcp candidates.\n", + tech_pvt->transports[LDL_TPORT_RTCP].accepted, tech_pvt->transports[LDL_TPORT_RTCP].total); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rtp candidates\n", + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].total); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rctp candidates\n", + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].total); + + + + if ((tech_pvt->transports[LDL_TPORT_RTP].ready && tech_pvt->transports[LDL_TPORT_RTCP].ready)) { switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT); switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY); } + + switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND); return 1; + } + + + static char *lame(char *in) { if (!strncasecmp(in, "ilbc", 4)) { @@ -1078,25 +1593,124 @@ static char *lame(char *in) } } + +static void setup_codecs(struct private_object *tech_pvt) +{ + ldl_payload_t payloads[LDL_MAX_PAYLOADS] = { {0} }; + int idx = 0, i = 0; + int dft_audio = -1, dft_video = -1; + + memset(payloads, 0, sizeof(payloads)); + + for (idx = 0; idx < tech_pvt->num_codecs && (dft_audio == -1 || dft_video == -1); idx++) { + if (dft_audio < 0 && tech_pvt->codecs[idx]->codec_type == SWITCH_CODEC_TYPE_AUDIO) { + dft_audio = idx; + } + if (dft_video < 0 && tech_pvt->codecs[idx]->codec_type == SWITCH_CODEC_TYPE_VIDEO) { + dft_video = idx; + } + } + + if (dft_audio == -1 && dft_video == -1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Cannot find a codec.\n"); + return; + } + + idx = 0; + + payloads[0].type = LDL_TPORT_RTP; + if (tech_pvt->transports[LDL_TPORT_RTP].codec_index < 0) { + if (dft_audio > -1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have my audio codec yet here's one\n"); + tech_pvt->transports[LDL_TPORT_RTP].codec_name = lame(tech_pvt->codecs[dft_audio]->iananame); + tech_pvt->transports[LDL_TPORT_RTP].codec_num = tech_pvt->codecs[dft_audio]->ianacode; + tech_pvt->transports[LDL_TPORT_RTP].codec_rate = tech_pvt->codecs[dft_audio]->samples_per_second; + tech_pvt->transports[LDL_TPORT_RTP].r_codec_num = tech_pvt->codecs[dft_audio]->ianacode; + tech_pvt->transports[LDL_TPORT_RTP].codec_index = dft_audio; + + payloads[0].name = lame(tech_pvt->codecs[dft_audio]->iananame); + payloads[0].id = tech_pvt->codecs[dft_audio]->ianacode; + payloads[0].rate = tech_pvt->codecs[dft_audio]->samples_per_second; + payloads[0].bps = tech_pvt->codecs[dft_audio]->bits_per_second; + payloads[0].ptime = tech_pvt->codecs[dft_audio]->microseconds_per_packet / 1000; + idx++; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have an audio codec.\n"); + } + } else { + payloads[0].name = lame(tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->iananame); + payloads[0].id = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->ianacode; + payloads[0].rate = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->samples_per_second; + payloads[0].bps = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->bits_per_second; + payloads[0].ptime = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->microseconds_per_packet / 1000; + idx++; + } + + + payloads[1].type = LDL_TPORT_VIDEO_RTP; + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index < 0) { + if (dft_video > -1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have my video codec yet here's one\n"); + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name = lame(tech_pvt->codecs[dft_video]->iananame); + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num = tech_pvt->codecs[dft_video]->ianacode; + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate = tech_pvt->codecs[dft_video]->samples_per_second; + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].r_codec_num = tech_pvt->codecs[dft_video]->ianacode; + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index = dft_video; + + payloads[1].name = lame(tech_pvt->codecs[dft_video]->iananame); + payloads[1].id = tech_pvt->codecs[dft_video]->ianacode; + payloads[1].rate = tech_pvt->codecs[dft_video]->samples_per_second; + payloads[1].bps = tech_pvt->codecs[dft_video]->bits_per_second; + payloads[1].width = 600; + payloads[1].height = 400; + payloads[1].framerate = 30; + + idx++; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have video codec.\n"); + } + } else { + payloads[1].name = lame(tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->iananame); + payloads[1].id = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->ianacode; + payloads[1].rate = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->samples_per_second; + payloads[1].bps = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->bits_per_second; + idx++; + } + + for(i = 0; i < idx; i++) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Describe [%s@%d]\n", payloads[i].name, payloads[i].rate); + } + + + if (!payloads[1].id) { + switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = 0; + } + + + tech_pvt->desc_id = ldl_session_describe(tech_pvt->dlsession, payloads, idx, + switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT, + &tech_pvt->transports[LDL_TPORT_RTP].ssrc, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc, + tech_pvt->transports[LDL_TPORT_RTP].local_crypto_data, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_crypto_data); + + +} + static int do_describe(struct private_object *tech_pvt, int force) { - ldl_payload_t payloads[5]; if (!tech_pvt->session) { return 0; } - if (switch_test_flag(tech_pvt, TFLAG_DO_DESC)) { - return 1; - } - tech_pvt->next_desc += DL_CAND_WAIT; if (switch_test_flag(tech_pvt, TFLAG_BYE)) { return 0; } - memset(payloads, 0, sizeof(payloads)); + switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND); if (!get_codecs(tech_pvt)) { terminate_session(&tech_pvt->session, __LINE__, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); @@ -1107,31 +1721,7 @@ static int do_describe(struct private_object *tech_pvt, int force) if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) { - if (tech_pvt->codec_index < 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have my codec yet here's one\n"); - tech_pvt->codec_name = lame(tech_pvt->codecs[0]->iananame); - tech_pvt->codec_num = tech_pvt->codecs[0]->ianacode; - tech_pvt->codec_rate = tech_pvt->codecs[0]->samples_per_second; - tech_pvt->r_codec_num = tech_pvt->codecs[0]->ianacode; - tech_pvt->codec_index = 0; - - payloads[0].name = lame(tech_pvt->codecs[0]->iananame); - payloads[0].id = tech_pvt->codecs[0]->ianacode; - payloads[0].rate = tech_pvt->codecs[0]->samples_per_second; - payloads[0].bps = tech_pvt->codecs[0]->bits_per_second; - - } else { - payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->iananame); - payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->ianacode; - payloads[0].rate = tech_pvt->codecs[tech_pvt->codec_index]->samples_per_second; - payloads[0].bps = tech_pvt->codecs[tech_pvt->codec_index]->bits_per_second; - } - - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Describe [%s@%d]\n", payloads[0].name, payloads[0].rate); - tech_pvt->desc_id = - ldl_session_describe(tech_pvt->dlsession, payloads, 1, - switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT); + setup_codecs(tech_pvt); switch_set_flag_locked(tech_pvt, TFLAG_CODEC_READY); } switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND); @@ -1167,8 +1757,8 @@ static switch_status_t negotiate_media(switch_core_session_t *session) while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && switch_test_flag(tech_pvt, TFLAG_RTP_READY) && - switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && - tech_pvt->remote_ip && tech_pvt->remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) { + switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && //tech_pvt->read_count && + tech_pvt->transports[LDL_TPORT_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_RTP].remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) { now = switch_micro_time_now(); elapsed = (unsigned int) ((now - started) / 1000); @@ -1195,10 +1785,20 @@ static switch_status_t negotiate_media(switch_core_session_t *session) switch_clear_flag_locked(tech_pvt, TFLAG_IO); goto done; } + if (switch_test_flag(tech_pvt, TFLAG_BYE) || !switch_test_flag(tech_pvt, TFLAG_IO)) { goto done; } - switch_cond_next(); + + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { + switch_rtp_ping(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); + } + + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { + switch_rtp_ping(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); + } + + switch_yield(20000); } if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) { @@ -1219,6 +1819,9 @@ static switch_status_t negotiate_media(switch_core_session_t *session) } ret = SWITCH_STATUS_SUCCESS; + switch_channel_audio_sync(channel); + + goto done; out: @@ -1241,7 +1844,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN; + tech_pvt->transports[LDL_TPORT_RTP].read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN; switch_set_flag(tech_pvt, TFLAG_READY); @@ -1295,23 +1898,37 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); if (tech_pvt) { - if (tech_pvt->rtp_session) { - switch_rtp_destroy(&tech_pvt->rtp_session); + if (tech_pvt->transports[LDL_TPORT_RTP].rtp_session) { + switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_RTP].rtp_session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "NUKE RTP\n"); - tech_pvt->rtp_session = NULL; + tech_pvt->transports[LDL_TPORT_RTP].rtp_session = NULL; + } + + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session) { + switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "NUKE RTP\n"); + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session = NULL; } if (switch_test_flag(tech_pvt, TFLAG_NAT_MAP)) { - switch_nat_del_mapping((switch_port_t) tech_pvt->adv_local_port, SWITCH_NAT_UDP); + switch_nat_del_mapping((switch_port_t) tech_pvt->transports[LDL_TPORT_RTP].adv_local_port, SWITCH_NAT_UDP); switch_clear_flag(tech_pvt, TFLAG_NAT_MAP); } - if (switch_core_codec_ready(&tech_pvt->read_codec)) { - switch_core_codec_destroy(&tech_pvt->read_codec); + if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].read_codec)) { + switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_RTP].read_codec); } - if (switch_core_codec_ready(&tech_pvt->write_codec)) { - switch_core_codec_destroy(&tech_pvt->write_codec); + if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].write_codec)) { + switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_RTP].write_codec); + } + + if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec)) { + switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec); + } + + if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].write_codec)) { + switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_RTP].write_codec); } if (tech_pvt->dlsession) { @@ -1340,8 +1957,12 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - if (tech_pvt->profile->ip && tech_pvt->local_port) { - switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->local_port); + if (tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_RTP].local_port) { + switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_RTP].local_port); + } + + if (tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { + switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); } switch_clear_flag_locked(tech_pvt, TFLAG_IO); @@ -1382,13 +2003,13 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); switch_set_flag_locked(tech_pvt, TFLAG_BYE); - if (switch_rtp_ready(tech_pvt->rtp_session)) { - switch_rtp_kill_socket(tech_pvt->rtp_session); + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { + switch_rtp_kill_socket(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); } break; case SWITCH_SIG_BREAK: - if (switch_rtp_ready(tech_pvt->rtp_session)) { - switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK); + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { + switch_rtp_set_flag(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, SWITCH_RTP_FLAG_BREAK); } break; } @@ -1421,7 +2042,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "DTMF [%c]\n", dtmf->digit); - return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf); + return switch_rtp_queue_rfc2833(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, dtmf); } @@ -1434,7 +2055,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch tech_pvt = (struct private_object *) switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) { + while (!(tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session))) { if (switch_channel_ready(channel)) { switch_yield(10000); } else { @@ -1443,7 +2064,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } - tech_pvt->read_frame.datalen = 0; + tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 0; switch_set_flag_locked(tech_pvt, TFLAG_READING); #if 0 @@ -1457,23 +2078,25 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch if (switch_test_flag(tech_pvt, TFLAG_IO)) { - switch_status_t status; - - switch_assert(tech_pvt->rtp_session != NULL); - tech_pvt->read_frame.datalen = 0; + //switch_status_t status; + + switch_assert(tech_pvt->transports[LDL_TPORT_RTP].rtp_session != NULL); + tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 0; - while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) { - tech_pvt->read_frame.flags = SFF_NONE; + while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen == 0) { + tech_pvt->transports[LDL_TPORT_RTP].read_frame.flags = SFF_NONE; - status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags); - if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { - return SWITCH_STATUS_FALSE; + switch_rtp_zerocopy_read_frame(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, &tech_pvt->transports[LDL_TPORT_RTP].read_frame, flags); + + tech_pvt->read_count++; +#if 0 + if (tech_pvt->read_count == 1 && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { + setup_codecs(tech_pvt); } +#endif - - - //payload = tech_pvt->read_frame.payload; + //payload = tech_pvt->transports[LDL_TPORT_RTP].read_frame.payload; #if 0 elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000); @@ -1489,22 +2112,22 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch return SWITCH_STATUS_BREAK; } #endif - if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) { + if (switch_rtp_has_dtmf(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { switch_dtmf_t dtmf = { 0 }; - switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf); + switch_rtp_dequeue_dtmf(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, &dtmf); switch_channel_queue_dtmf(channel, &dtmf); } - if (tech_pvt->read_frame.datalen > 0) { + if (tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen > 0) { size_t bytes = 0; int frames = 1; - if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) { - if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet)) { - frames = (tech_pvt->read_frame.datalen / bytes); + if (!switch_test_flag((&tech_pvt->transports[LDL_TPORT_RTP].read_frame), SFF_CNG)) { + if ((bytes = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->encoded_bytes_per_packet)) { + frames = (tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen / bytes); } - tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_packet); + tech_pvt->transports[LDL_TPORT_RTP].read_frame.samples = (int) (frames * tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet); } break; } @@ -1513,12 +2136,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch switch_clear_flag_locked(tech_pvt, TFLAG_READING); - if (tech_pvt->read_frame.datalen == 0) { - *frame = NULL; - return SWITCH_STATUS_GENERR; + if (tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen == 0) { + switch_set_flag((&tech_pvt->transports[LDL_TPORT_RTP].read_frame), SFF_CNG); + tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 2; } - *frame = &tech_pvt->read_frame; + *frame = &tech_pvt->transports[LDL_TPORT_RTP].read_frame; return SWITCH_STATUS_SUCCESS; } @@ -1533,7 +2156,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc tech_pvt = (struct private_object *) switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) { + while (!(tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session))) { if (switch_channel_ready(channel)) { switch_yield(10000); } else { @@ -1541,7 +2164,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc } } - if (!switch_core_codec_ready(&tech_pvt->read_codec) || !tech_pvt->read_codec.implementation) { + if (!switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].read_codec) || !tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation) { return SWITCH_STATUS_GENERR; } @@ -1552,13 +2175,13 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_set_flag_locked(tech_pvt, TFLAG_WRITING); if (!switch_test_flag(frame, SFF_CNG)) { - if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) { - bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet; + if (tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->encoded_bytes_per_packet) { + bytes = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->encoded_bytes_per_packet; frames = ((int) frame->datalen / bytes); } else frames = 1; - samples = frames * tech_pvt->read_codec.implementation->samples_per_packet; + samples = frames * tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet; } #if 0 printf("%s %s->%s send %d bytes %d samples in %d frames ts=%d\n", @@ -1567,8 +2190,8 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc #endif tech_pvt->timestamp_send += samples; - //switch_rtp_write_frame(tech_pvt->rtp_session, frame, tech_pvt->timestamp_send); - if (switch_rtp_write_frame(tech_pvt->rtp_session, frame) < 0) { + //switch_rtp_write_frame(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, frame, tech_pvt->timestamp_send); + if (switch_rtp_write_frame(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, frame) < 0) { status = SWITCH_STATUS_GENERR; } @@ -1576,6 +2199,74 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc return status; } + +static switch_status_t channel_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) +{ + struct private_object *tech_pvt = NULL; + switch_channel_t *channel = switch_core_session_get_channel(session); + //int payload = 0; + //switch_status_t status; + + tech_pvt = (struct private_object *) switch_core_session_get_private(session); + switch_assert(tech_pvt != NULL); + + if (!switch_test_flag(tech_pvt, TFLAG_IO)) { + return SWITCH_STATUS_GENERR; + } + + while (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session))) { + if (switch_channel_ready(channel)) { + switch_yield(10000); + } else { + return SWITCH_STATUS_GENERR; + } + } + + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen = 0; + + while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen == 0) { + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.flags = SFF_NONE; + switch_rtp_zerocopy_read_frame(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame, flags); + } + + + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen == 0) { + switch_set_flag((&tech_pvt->transports[LDL_TPORT_RTP].read_frame), SFF_CNG); + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen = 2; + } + + *frame = &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame; + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t channel_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) +{ + struct private_object *tech_pvt = (struct private_object *)switch_core_session_get_private(session); + switch_channel_t *channel = switch_core_session_get_channel(session); + int wrote = 0; + + switch_assert(tech_pvt != NULL); + + while (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session))) { + if (switch_channel_ready(channel)) { + switch_yield(10000); + } else { + return SWITCH_STATUS_GENERR; + } + } + + if (!switch_test_flag(tech_pvt, TFLAG_IO)) { + return SWITCH_STATUS_SUCCESS; + } + + if (!switch_test_flag(frame, SFF_CNG)) { + wrote = switch_rtp_write_frame(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, frame); + } + + return wrote > 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_GENERR; +} + static switch_status_t channel_answer_channel(switch_core_session_t *session) { struct private_object *tech_pvt; @@ -1603,10 +2294,13 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s channel_answer_channel(session); break; case SWITCH_MESSAGE_INDICATE_BRIDGE: - rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK); + rtp_flush_read_buffer(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, SWITCH_RTP_FLUSH_STICK); break; case SWITCH_MESSAGE_INDICATE_UNBRIDGE: - rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_UNSTICK); + rtp_flush_read_buffer(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, SWITCH_RTP_FLUSH_UNSTICK); + break; + case SWITCH_MESSAGE_INDICATE_STUN_ERROR: + //switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_NORMAL_CLEARING); break; default: break; @@ -1654,12 +2348,15 @@ switch_state_handler_table_t dingaling_event_handlers = { switch_io_routines_t dingaling_io_routines = { /*.outgoing_channel */ channel_outgoing_channel, - /*.read_frame */ channel_read_frame, + /*.transports[LDL_TPORT_RTP].read_frame */ channel_read_frame, /*.write_frame */ channel_write_frame, /*.kill_channel */ channel_kill_channel, /*.send_dtmf */ channel_send_dtmf, /*.receive_message */ channel_receive_message, - /*.receive_event */ channel_receive_event + /*.receive_event */ channel_receive_event, + /*.state_change */ NULL, + /*.read_video_frame */ channel_read_video_frame, + /*.write_video_frame */ channel_write_video_frame }; @@ -1688,6 +2385,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi char *p, *u, ubuf[512] = "", *user = NULL, *f_cid_msg = NULL; const char *cid_msg = NULL; ldl_user_flag_t flags = LDL_FLAG_OUTBOUND; + const char *var; switch_copy_string(workspace, outbound_profile->destination_number, sizeof(workspace)); profile_name = workspace; @@ -1781,13 +2479,30 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi channel = switch_core_session_get_channel(*new_session); switch_core_session_set_private(*new_session, tech_pvt); tech_pvt->session = *new_session; - tech_pvt->codec_index = -1; - if (!(tech_pvt->local_port = switch_rtp_request_port(mdl_profile->ip))) { + tech_pvt->channel = switch_core_session_get_channel(tech_pvt->session); + tech_pvt->transports[LDL_TPORT_RTP].codec_index = -1; + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index = -1; + + mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); + mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); + + if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(mdl_profile->ip))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "No RTP port available!\n"); terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } - tech_pvt->adv_local_port = tech_pvt->local_port; + tech_pvt->transports[LDL_TPORT_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port; + tech_pvt->transports[LDL_TPORT_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port + 1; + if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = switch_rtp_request_port(mdl_profile->ip))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "No RTP port available!\n"); + terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + } + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port; + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port + 1; + + + tech_pvt->recip = switch_core_session_strdup(*new_session, full_id); if (dnis) { tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis); @@ -1854,6 +2569,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ldl_session_set_value(dlsession, "caller_id_name", outbound_profile->caller_id_name); ldl_session_set_value(dlsession, "caller_id_number", outbound_profile->caller_id_number); tech_pvt->dlsession = dlsession; + + if ((var = switch_event_get_header(var_event, "absolute_codec_string"))) { + switch_channel_set_variable(channel, "absolute_codec_string", var); + } + if (!get_codecs(tech_pvt)) { terminate_session(new_session, __LINE__, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL); return SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL; @@ -2117,6 +2837,8 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val) } else if (val && !strcasecmp(val, "md5")) { profile->user_flags |= LDL_FLAG_SASL_MD5; } + } else if (!strcasecmp(var, "use-jingle") && !zstr(val)) { + profile->user_flags |= LDL_FLAG_JINGLE; } else if (!strcasecmp(var, "exten") && !zstr(val)) { profile->exten = switch_core_strdup(module_pool, val); } else if (!strcasecmp(var, "context") && !zstr(val)) { @@ -2757,6 +3479,308 @@ static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id) switch_safe_free(xmlstr); } +static switch_status_t parse_candidates(ldl_session_t *dlsession, switch_core_session_t *session, ldl_transport_type_t ttype, const char *subject) +{ + + ldl_candidate_t *candidates; + unsigned int len = 0; + unsigned int x, choice = 0, ok = 0; + uint8_t lanaddr = 0; + struct private_object *tech_pvt = NULL; + switch_status_t status = LDL_STATUS_SUCCESS; + + if (!(tech_pvt = switch_core_session_get_private(session))) { + return SWITCH_STATUS_FALSE; + } + + if (ldl_session_get_candidates(dlsession, ttype, &candidates, &len) != LDL_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Candidate Error!\n"); + switch_set_flag(tech_pvt, TFLAG_BYE); + switch_clear_flag(tech_pvt, TFLAG_IO); + status = LDL_STATUS_FALSE; + goto end; + } + + + tech_pvt->transports[ttype].total = len; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u %s candidates\n", len, ldl_transport_type_str(ttype)); + + if (tech_pvt->profile->acl_count) { + for (x = 0; x < len; x++) { + uint32_t y = 0; + + if (strcasecmp(candidates[x].protocol, "udp")) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d has an unsupported protocol!\n", + candidates[x].address, candidates[x].port); + continue; + } + + for (y = 0; y < tech_pvt->profile->acl_count; y++) { + + if (switch_check_network_list_ip(candidates[x].address, tech_pvt->profile->acl[y])) { + choice = x; + ok = 1; + } + + if (ok) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n", + candidates[x].address, candidates[x].port, tech_pvt->profile->acl[y]); + goto end_candidates; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n", + candidates[x].address, candidates[x].port, tech_pvt->profile->acl[y]); + } + } + } + } else { + for (x = 0; x < len; x++) { + + + if (tech_pvt->profile->lanaddr) { + lanaddr = strncasecmp(candidates[x].address, tech_pvt->profile->lanaddr, strlen(tech_pvt->profile->lanaddr)) ? 0 : 1; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s candidates %s:%d\n", + ldl_transport_type_str(ttype), candidates[x].address, + candidates[x].port); + + + // 192.0.0.0 - 192.0.127.255 is marked as reserved, should we filter all of them? + if (!strcasecmp(candidates[x].protocol, "udp") && + (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun") || !strcasecmp(candidates[x].type, "drelay")) && + ((tech_pvt->profile->lanaddr && + lanaddr) || (strncasecmp(candidates[x].address, "10.", 3) && + strncasecmp(candidates[x].address, "192.168.", 8) && + strncasecmp(candidates[x].address, "127.", 4) && + strncasecmp(candidates[x].address, "255.", 4) && + strncasecmp(candidates[x].address, "0.", 2) && + strncasecmp(candidates[x].address, "1.", 2) && + strncasecmp(candidates[x].address, "2.", 2) && + strncasecmp(candidates[x].address, "172.16.", 7) && + strncasecmp(candidates[x].address, "172.17.", 7) && + strncasecmp(candidates[x].address, "172.18.", 7) && + strncasecmp(candidates[x].address, "172.19.", 7) && + strncasecmp(candidates[x].address, "172.2", 5) && + strncasecmp(candidates[x].address, "172.30.", 7) && + strncasecmp(candidates[x].address, "172.31.", 7) && + strncasecmp(candidates[x].address, "192.0.2.", 8) && strncasecmp(candidates[x].address, "169.254.", 8) + ))) { + choice = x; + ok = 1; + } + } + } + + + end_candidates: + + if (ok) { + ldl_payload_t payloads[5]; + char *key; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "Acceptable %s Candidate %s:%d\n", ldl_transport_type_str(ttype), candidates[choice].address, candidates[choice].port); + + + if (tech_pvt->transports[ttype].accepted) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already Accepted [%s:%d]\n", + tech_pvt->transports[ttype].remote_ip, tech_pvt->transports[ttype].remote_port); + goto end; + } + + + if (tech_pvt->transports[ttype].remote_ip) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already picked an IP [%s]\n", tech_pvt->transports[ttype].remote_ip); + goto end; + } + + + memset(payloads, 0, sizeof(payloads)); + + tech_pvt->transports[ttype].accepted++; + + if (ttype == LDL_TPORT_VIDEO_RTP) { + if ((key = ldl_session_get_value(dlsession, "video:crypto:1"))) { + mdl_add_crypto(tech_pvt, ttype, key, SWITCH_RTP_CRYPTO_RECV); + } else { + tech_pvt->transports[ttype].crypto_type = 0; + } + } else if (ttype == LDL_TPORT_RTP) { + if ((key = ldl_session_get_value(dlsession, "audio:crypto:1"))) { + mdl_add_crypto(tech_pvt, ttype, key, SWITCH_RTP_CRYPTO_RECV); + } else { + tech_pvt->transports[ttype].crypto_type = 0; + } + } + + if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { + switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); + //ldl_session_accept_candidate(dlsession, &candidates[choice]); + } + + if (!strcasecmp(subject, "candidates")) { + //switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); + switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); + } + + if (lanaddr) { + switch_set_flag_locked(tech_pvt, TFLAG_LANADDR); + } + + if (!get_codecs(tech_pvt)) { + terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + status = LDL_STATUS_FALSE; + goto end; + } + + + tech_pvt->transports[ttype].remote_ip = switch_core_session_strdup(session, candidates[choice].address); + ldl_session_set_ip(dlsession, tech_pvt->transports[ttype].remote_ip); + tech_pvt->transports[ttype].remote_port = candidates[choice].port; + tech_pvt->transports[ttype].remote_user = switch_core_session_strdup(session, candidates[choice].username); + tech_pvt->transports[ttype].remote_pass = switch_core_session_strdup(session, candidates[choice].password); + + if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { + if (!do_candidates(tech_pvt, 0)) { + terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + status = LDL_STATUS_FALSE; + + goto end; + } + } + + if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && (ttype == LDL_TPORT_VIDEO_RTP || ttype == LDL_TPORT_VIDEO_RTP) && + tech_pvt->transports[ttype].accepted == 1 && (1||switch_test_flag(tech_pvt, TFLAG_RTP_READY))) { + + if (ttype == LDL_TPORT_VIDEO_RTP) { + activate_video_rtp(tech_pvt); + } + + if (ttype == LDL_TPORT_VIDEO_RTP) { + activate_audio_rtp(tech_pvt); + } + + tech_pvt->transports[ttype].restart_rtp++; + } + + + status = LDL_STATUS_SUCCESS; + } + + end: + + return status; + +} + + +static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_session_t *session, + ldl_transport_type_t ttype, ldl_payload_t *payloads, unsigned int len) +{ + struct private_object *tech_pvt = NULL; + switch_status_t status = LDL_STATUS_SUCCESS; + unsigned int x, y; + int match = 0; + + tech_pvt = switch_core_session_get_private(session); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u payloads\n", len); + for (x = 0; x < len; x++) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, + payloads[x].id); + for (y = 0; y < tech_pvt->num_codecs; y++) { + char *name = tech_pvt->codecs[y]->iananame; + + if ((ttype == LDL_TPORT_VIDEO_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_VIDEO) || + (ttype == LDL_TPORT_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_AUDIO)) { + continue; + } + + if (!strncasecmp(name, "ilbc", 4)) { + name = "ilbc"; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "compare %s %d/%d to %s %d/%d\n", + payloads[x].name, payloads[x].id, payloads[x].rate, + name, tech_pvt->codecs[y]->ianacode, tech_pvt->codecs[y]->samples_per_second); + + if (tech_pvt->codecs[y]->ianacode > 95) { + match = strcasecmp(name, payloads[x].name) ? 0 : 1; + } else { + match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0; + } + + if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) { + tech_pvt->transports[ttype].codec_index = y; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing %s Payload index %u %s %u\n", + ldl_transport_type_str(ttype), + y, + payloads[x].name, payloads[x].id); + tech_pvt->transports[ttype].codec_name = tech_pvt->codecs[y]->iananame; + tech_pvt->transports[ttype].codec_num = tech_pvt->codecs[y]->ianacode; + tech_pvt->transports[ttype].r_codec_num = (switch_payload_t) (payloads[x].id); + tech_pvt->transports[ttype].codec_rate = payloads[x].rate; + tech_pvt->transports[ttype].ptime = payloads[x].ptime; + tech_pvt->transports[ttype].payload_count++; + + if (ttype == LDL_TPORT_VIDEO_RTP) { + tech_pvt->transports[ttype].vid_width = payloads[x].width; + tech_pvt->transports[ttype].vid_height = payloads[x].height; + tech_pvt->transports[ttype].vid_rate = payloads[x].framerate; + } + + if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { + + + if (!do_describe(tech_pvt, 0)) { + terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + status = LDL_STATUS_FALSE; + goto done; + } + } + status = LDL_STATUS_SUCCESS; + goto done; + } + } + } + + done: + + return status; + +} + +static ldl_status parse_payloads(ldl_session_t *dlsession, switch_core_session_t *session, ldl_payload_t *payloads, unsigned int len) +{ + int match = 0; + struct private_object *tech_pvt = NULL; + ldl_status status; + + tech_pvt = switch_core_session_get_private(session); + + + if ((status = parse_payloads_type(dlsession, session, LDL_TPORT_RTP, payloads, len)) == LDL_STATUS_SUCCESS) { + match++; + } + + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) { + if ((status = parse_payloads_type(dlsession, session, LDL_TPORT_VIDEO_RTP, payloads, len)) == LDL_STATUS_SUCCESS) { + match++; + } + } + + if (!match && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { + if (!do_describe(tech_pvt, 0)) { + terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + status = LDL_STATUS_FALSE; + } + } + + + return status; + +} + + static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject, char *msg) { @@ -3060,15 +4084,35 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi tech_pvt->dlsession = dlsession; tech_pvt->session = session; - tech_pvt->codec_index = -1; + tech_pvt->channel = switch_core_session_get_channel(session); + tech_pvt->transports[LDL_TPORT_RTP].codec_index = -1; + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index = -1; tech_pvt->profile = profile; - if (!(tech_pvt->local_port = switch_rtp_request_port(profile->ip))) { + + + mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); + mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); + + if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(profile->ip))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "No RTP port available!\n"); terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); status = LDL_STATUS_FALSE; goto done; } - tech_pvt->adv_local_port = tech_pvt->local_port; + tech_pvt->transports[LDL_TPORT_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port; + tech_pvt->transports[LDL_TPORT_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port + 1; + + if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = switch_rtp_request_port(profile->ip))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "No RTP port available!\n"); + terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + status = LDL_STATUS_FALSE; + goto done; + } + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port; + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port + 1; + + + switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); tech_pvt->recip = switch_core_session_strdup(session, from); if (!(exten = ldl_session_get_value(dlsession, "dnis"))) { @@ -3205,8 +4249,8 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi p++; } switch_set_flag_locked(tech_pvt, TFLAG_DTMF); - if (switch_rtp_ready(tech_pvt->rtp_session)) { - switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK); + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { + switch_rtp_set_flag(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, SWITCH_RTP_FLAG_BREAK); } } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SESSION MSG [%s]\n", msg); @@ -3252,10 +4296,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi if (dl_signal) { ldl_payload_t *payloads; unsigned int len = 0; - int match = 0; - + if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!strcasecmp(msg, "accept")) { + if (msg && !strcasecmp(msg, "accept")) { switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); if (!do_candidates(tech_pvt, 0)) { @@ -3266,7 +4309,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi } } - if (tech_pvt->codec_index > -1) { + if (tech_pvt->transports[LDL_TPORT_RTP].codec_index > -1) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already decided on a codec\n"); break; } @@ -3278,55 +4321,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi goto done; } - if (ldl_session_get_payloads(dlsession, &payloads, &len) == LDL_STATUS_SUCCESS) { - unsigned int x, y; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u payloads\n", len); - for (x = 0; x < len; x++) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, - payloads[x].id); - for (y = 0; y < tech_pvt->num_codecs; y++) { - char *name = tech_pvt->codecs[y]->iananame; - - if (!strncasecmp(name, "ilbc", 4)) { - name = "ilbc"; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "compare %s %d/%d to %s %d/%d\n", - payloads[x].name, payloads[x].id, payloads[x].rate, - name, tech_pvt->codecs[y]->ianacode, tech_pvt->codecs[y]->samples_per_second); - if (tech_pvt->codecs[y]->ianacode > 95) { - match = strcasecmp(name, payloads[x].name) ? 0 : 1; - } else { - match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0; - } - - if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) { - tech_pvt->codec_index = y; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, - payloads[x].name, payloads[x].id); - tech_pvt->codec_name = tech_pvt->codecs[y]->iananame; - tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode; - tech_pvt->r_codec_num = (switch_payload_t) (payloads[x].id); - tech_pvt->codec_rate = payloads[x].rate; - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!do_describe(tech_pvt, 0)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } - status = LDL_STATUS_SUCCESS; - goto done; - } - } - } - if (!match && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!do_describe(tech_pvt, 0)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } + status = parse_payloads(dlsession, session, payloads, len); + goto done; } } @@ -3334,141 +4331,14 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi break; case LDL_SIGNAL_CANDIDATES: if (dl_signal) { - ldl_candidate_t *candidates; - unsigned int len = 0; - unsigned int x, choice = 0, ok = 0; - uint8_t lanaddr = 0; - - if (ldl_session_get_candidates(dlsession, &candidates, &len) != LDL_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Candidate Error!\n"); - switch_set_flag(tech_pvt, TFLAG_BYE); - switch_clear_flag(tech_pvt, TFLAG_IO); - status = LDL_STATUS_FALSE; - goto done; - } - - - if (tech_pvt->remote_ip) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already picked an IP [%s]\n", tech_pvt->remote_ip); - break; - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u candidates\n", len); - - if (profile->acl_count) { - for (x = 0; x < len; x++) { - uint32_t y = 0; - - if (strcasecmp(candidates[x].protocol, "udp")) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d has an unsupported protocol!\n", - candidates[x].address, candidates[x].port); - continue; - } - - for (y = 0; y < profile->acl_count; y++) { - - if (switch_check_network_list_ip(candidates[x].address, profile->acl[y])) { - choice = x; - ok = 1; - } - - if (ok) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n", - candidates[x].address, candidates[x].port, profile->acl[y]); - goto end_candidates; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n", - candidates[x].address, candidates[x].port, profile->acl[y]); - } - } - } - } else { - for (x = 0; x < len; x++) { - - if (profile->lanaddr) { - lanaddr = strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr)) ? 0 : 1; - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address, - candidates[x].port); - - // 192.0.0.0 - 192.0.127.255 is marked as reserved, should we filter all of them? - if (!strcasecmp(candidates[x].protocol, "udp") && - (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun")) && - ((profile->lanaddr && - lanaddr) || (strncasecmp(candidates[x].address, "10.", 3) && - strncasecmp(candidates[x].address, "192.168.", 8) && - strncasecmp(candidates[x].address, "127.", 4) && - strncasecmp(candidates[x].address, "255.", 4) && - strncasecmp(candidates[x].address, "0.", 2) && - strncasecmp(candidates[x].address, "1.", 2) && - strncasecmp(candidates[x].address, "2.", 2) && - strncasecmp(candidates[x].address, "172.16.", 7) && - strncasecmp(candidates[x].address, "172.17.", 7) && - strncasecmp(candidates[x].address, "172.18.", 7) && - strncasecmp(candidates[x].address, "172.19.", 7) && - strncasecmp(candidates[x].address, "172.2", 5) && - strncasecmp(candidates[x].address, "172.30.", 7) && - strncasecmp(candidates[x].address, "172.31.", 7) && - strncasecmp(candidates[x].address, "192.0.2.", 8) && strncasecmp(candidates[x].address, "169.254.", 8) - ))) { - choice = x; - ok = 1; - } - } - } - - end_candidates: - - if (ok) { - ldl_payload_t payloads[5]; - - memset(payloads, 0, sizeof(payloads)); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, - "Acceptable Candidate %s:%d\n", candidates[choice].address, candidates[choice].port); - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - //ldl_session_accept_candidate(dlsession, &candidates[choice]); - } - - if (!strcasecmp(subject, "candidates")) { - //switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); - } - - if (lanaddr) { - switch_set_flag_locked(tech_pvt, TFLAG_LANADDR); - } - - if (!get_codecs(tech_pvt)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - - - tech_pvt->remote_ip = switch_core_session_strdup(session, candidates[choice].address); - ldl_session_set_ip(dlsession, tech_pvt->remote_ip); - tech_pvt->remote_port = candidates[choice].port; - tech_pvt->remote_user = switch_core_session_strdup(session, candidates[choice].username); - - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!do_candidates(tech_pvt, 0)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } - - status = LDL_STATUS_SUCCESS; - } - - goto done; + status = SWITCH_STATUS_SUCCESS; + status = parse_candidates(dlsession, session, LDL_TPORT_RTP, subject); + status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject); + status = parse_candidates(dlsession, session, LDL_TPORT_RTCP, subject); + status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTCP, subject); } + break; case LDL_SIGNAL_REJECT: if (channel) { From cfe435c667dfca64c48cf93c1593bbd7ca53d5e4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 06:18:09 -0500 Subject: [PATCH 0532/1057] fix typo --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 6bf84be1f2..6136ed47ce 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -3548,7 +3548,7 @@ static switch_status_t parse_candidates(ldl_session_t *dlsession, switch_core_se // 192.0.0.0 - 192.0.127.255 is marked as reserved, should we filter all of them? if (!strcasecmp(candidates[x].protocol, "udp") && - (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun") || !strcasecmp(candidates[x].type, "drelay")) && + (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun") || !strcasecmp(candidates[x].type, "relay")) && ((tech_pvt->profile->lanaddr && lanaddr) || (strncasecmp(candidates[x].address, "10.", 3) && strncasecmp(candidates[x].address, "192.168.", 8) && From a5021fa3846f2eeb705ec0c009a1280b44200ed0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 14:03:06 -0500 Subject: [PATCH 0533/1057] FS-4337 --resolve this actually uncovered a bug cos it was supposed to be rtcp_bytes not bytes --- src/switch_rtp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index dcb261e644..60ba0010e1 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1030,7 +1030,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) #ifdef ENABLE_ZRTP /* ZRTP Send */ if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) { - unsigned int sbytes = (int) bytes; + unsigned int sbytes = (int) rtcp_bytes; zrtp_status_t stat = zrtp_status_fail; stat = zrtp_process_rtcp(rtp_session->zrtp_stream, (void *) &rtp_session->rtcp_send_msg, &sbytes); @@ -1040,7 +1040,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) break; case zrtp_status_drop: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); - ret = (int) bytes; + ret = (int)rtcp_bytes; goto end; break; case zrtp_status_fail: @@ -1050,7 +1050,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) break; } - bytes = sbytes; + rtcp_bytes = sbytes; } #endif if (switch_socket_sendto(rtp_session->rtcp_sock_output, rtp_session->rtcp_remote_addr, 0, From 398c84b671121079deafd5813f201e758b9879ce Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 16:40:42 -0500 Subject: [PATCH 0534/1057] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 84 ++++++++++++++++++- src/mod/languages/mod_managed/managed/swig.cs | 56 ++++++++++++- 2 files changed, 135 insertions(+), 5 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 46fcf757e6..9e0843a0e8 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -3014,6 +3014,35 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_get(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_period_packet_count_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)->period_packet_count = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_period_packet_count_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)->period_packet_count); + jresult = new switch_size_t((switch_size_t &)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_set(void * jarg1, void * jarg2) { switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ; switch_size_t arg2 ; @@ -3370,6 +3399,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_rtcp_get(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_read_count_set(void * jarg1, unsigned long jarg2) { + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtp_stats_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->read_count = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_stats_t_read_count_get(void * jarg1) { + unsigned long jresult ; + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + uint32_t result; + + arg1 = (switch_rtp_stats_t *)jarg1; + result = (uint32_t) ((arg1)->read_count); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_stats_t() { void * jresult ; switch_rtp_stats_t *result = 0 ; @@ -31524,17 +31576,37 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_destroy(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_ice(void * jarg1, char * jarg2, char * jarg3) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_ice(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; switch_status_t result; arg1 = (switch_rtp_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - result = (switch_status_t)switch_rtp_activate_ice(arg1,arg2,arg3); + arg4 = (char *)jarg4; + result = (switch_status_t)switch_rtp_activate_ice(arg1,arg2,arg3,(char const *)arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_rtcp_ice(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + result = (switch_status_t)switch_rtp_activate_rtcp_ice(arg1,arg2,arg3,(char const *)arg4); jresult = result; return jresult; } @@ -31664,6 +31736,14 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_rtp_socket(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_ping(void * jarg1) { + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + + arg1 = (switch_rtp_t *)jarg1; + switch_rtp_ping(arg1); +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_default_samples_per_interval(void * jarg1) { unsigned long jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index e2b486669d..131260294c 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -5270,8 +5270,13 @@ public class freeswitch { freeswitchPINVOKE.switch_rtp_destroy(SWIGTYPE_p_p_switch_rtp.getCPtr(rtp_session)); } - public static switch_status_t switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin); + public static switch_status_t switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin, string password) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin, password); + return ret; + } + + public static switch_status_t switch_rtp_activate_rtcp_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin, string password) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_rtcp_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin, password); return ret; } @@ -5319,6 +5324,10 @@ public class freeswitch { return ret; } + public static void switch_rtp_ping(SWIGTYPE_p_switch_rtp rtp_session) { + freeswitchPINVOKE.switch_rtp_ping(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); + } + public static uint switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp rtp_session) { uint ret = freeswitchPINVOKE.switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; @@ -7103,6 +7112,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_get")] public static extern IntPtr switch_rtp_numbers_t_packet_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_period_packet_count_set")] + public static extern void switch_rtp_numbers_t_period_packet_count_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_period_packet_count_get")] + public static extern IntPtr switch_rtp_numbers_t_period_packet_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_set")] public static extern void switch_rtp_numbers_t_media_packet_count_set(HandleRef jarg1, HandleRef jarg2); @@ -7187,6 +7202,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_rtcp_get")] public static extern IntPtr switch_rtp_stats_t_rtcp_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_read_count_set")] + public static extern void switch_rtp_stats_t_read_count_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_read_count_get")] + public static extern uint switch_rtp_stats_t_read_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")] public static extern IntPtr new_switch_rtp_stats_t(); @@ -13740,7 +13761,10 @@ class freeswitchPINVOKE { public static extern void switch_rtp_destroy(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_ice")] - public static extern int switch_rtp_activate_ice(HandleRef jarg1, string jarg2, string jarg3); + public static extern int switch_rtp_activate_ice(HandleRef jarg1, string jarg2, string jarg3, string jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_rtcp_ice")] + public static extern int switch_rtp_activate_rtcp_ice(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_rtcp")] public static extern int switch_rtp_activate_rtcp(HandleRef jarg1, int jarg2, ushort jarg3); @@ -13769,6 +13793,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_rtp_socket")] public static extern IntPtr switch_rtp_get_rtp_socket(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ping")] + public static extern void switch_rtp_ping(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_default_samples_per_interval")] public static extern uint switch_rtp_get_default_samples_per_interval(HandleRef jarg1); @@ -25104,6 +25131,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_INFO, SWITCH_MESSAGE_INDICATE_AUDIO_DATA, SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, + SWITCH_MESSAGE_INDICATE_STUN_ERROR, SWITCH_MESSAGE_INVALID } @@ -30735,6 +30763,18 @@ public class switch_rtp_numbers_t : IDisposable { } } + public SWIGTYPE_p_switch_size_t period_packet_count { + set { + freeswitchPINVOKE.switch_rtp_numbers_t_period_packet_count_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_period_packet_count_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public SWIGTYPE_p_switch_size_t media_packet_count { set { freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value)); @@ -30899,6 +30939,16 @@ public class switch_rtp_stats_t : IDisposable { } } + public uint read_count { + set { + freeswitchPINVOKE.switch_rtp_stats_t_read_count_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_rtp_stats_t_read_count_get(swigCPtr); + return ret; + } + } + public switch_rtp_stats_t() : this(freeswitchPINVOKE.new_switch_rtp_stats_t(), true) { } From 2171e5830d0a8154535104b53cd3178ecb132aa6 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 23 Jun 2012 16:58:44 -0500 Subject: [PATCH 0535/1057] vs2010 reswig --- .../mod_managed/freeswitch_wrap.2010.cxx | 88 ++++++++++++++++++- .../mod_managed/managed/swig.2010.cs | 60 +++++++++++-- 2 files changed, 139 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 a11d584f49..e60919b028 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -2840,6 +2840,34 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_get(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_period_packet_count_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)->period_packet_count = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_period_packet_count_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)->period_packet_count); + jresult = new switch_size_t((const switch_size_t &)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_set(void * jarg1, void * jarg2) { switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ; switch_size_t arg2 ; @@ -3182,6 +3210,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_rtcp_get(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_read_count_set(void * jarg1, unsigned long jarg2) { + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtp_stats_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->read_count = arg2; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_stats_t_read_count_get(void * jarg1) { + unsigned long jresult ; + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + uint32_t result; + + arg1 = (switch_rtp_stats_t *)jarg1; + result = (uint32_t) ((arg1)->read_count); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_stats_t() { void * jresult ; switch_rtp_stats_t *result = 0 ; @@ -30775,17 +30825,37 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_destroy(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_ice(void * jarg1, char * jarg2, char * jarg3) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_ice(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; switch_status_t result; arg1 = (switch_rtp_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - result = (switch_status_t)switch_rtp_activate_ice(arg1,arg2,arg3); + arg4 = (char *)jarg4; + result = (switch_status_t)switch_rtp_activate_ice(arg1,arg2,arg3,(char const *)arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_rtcp_ice(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + result = (switch_status_t)switch_rtp_activate_rtcp_ice(arg1,arg2,arg3,(char const *)arg4); jresult = result; return jresult; } @@ -30915,6 +30985,14 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_rtp_socket(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_ping(void * jarg1) { + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + + arg1 = (switch_rtp_t *)jarg1; + switch_rtp_ping(arg1); +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_default_samples_per_interval(void * jarg1) { unsigned long jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; @@ -35656,15 +35734,17 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_EventConsumer_node_index_get(void * } -SWIGEXPORT void * SWIGSTDCALL CSharp_new_EventConsumer(char * jarg1, char * jarg2) { +SWIGEXPORT void * SWIGSTDCALL CSharp_new_EventConsumer(char * jarg1, char * jarg2, int jarg3) { void * jresult ; char *arg1 = (char *) NULL ; char *arg2 = (char *) "" ; + int arg3 = (int) 5000 ; EventConsumer *result = 0 ; arg1 = (char *)jarg1; arg2 = (char *)jarg2; - result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2); + arg3 = (int)jarg3; + result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2,arg3); jresult = (void *)result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 3a1cc13d6b..3b447ca5d2 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -857,7 +857,7 @@ public class EventConsumer : IDisposable { } } - public EventConsumer(string event_name, string subclass_name) : this(freeswitchPINVOKE.new_EventConsumer(event_name, subclass_name), true) { + public EventConsumer(string event_name, string subclass_name, int len) : this(freeswitchPINVOKE.new_EventConsumer(event_name, subclass_name, len), true) { } public int bind(string event_name, string subclass_name) { @@ -5282,8 +5282,13 @@ public class freeswitch { freeswitchPINVOKE.switch_rtp_destroy(SWIGTYPE_p_p_switch_rtp.getCPtr(rtp_session)); } - public static switch_status_t switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin); + public static switch_status_t switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin, string password) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin, password); + return ret; + } + + public static switch_status_t switch_rtp_activate_rtcp_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin, string password) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_rtcp_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin, password); return ret; } @@ -5331,6 +5336,10 @@ public class freeswitch { return ret; } + public static void switch_rtp_ping(SWIGTYPE_p_switch_rtp rtp_session) { + freeswitchPINVOKE.switch_rtp_ping(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); + } + public static uint switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp rtp_session) { uint ret = freeswitchPINVOKE.switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; @@ -7119,6 +7128,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_get")] public static extern IntPtr switch_rtp_numbers_t_packet_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_period_packet_count_set")] + public static extern void switch_rtp_numbers_t_period_packet_count_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_period_packet_count_get")] + public static extern IntPtr switch_rtp_numbers_t_period_packet_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_set")] public static extern void switch_rtp_numbers_t_media_packet_count_set(HandleRef jarg1, HandleRef jarg2); @@ -7203,6 +7218,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_rtcp_get")] public static extern IntPtr switch_rtp_stats_t_rtcp_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_read_count_set")] + public static extern void switch_rtp_stats_t_read_count_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_read_count_get")] + public static extern uint switch_rtp_stats_t_read_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")] public static extern IntPtr new_switch_rtp_stats_t(); @@ -13756,7 +13777,10 @@ class freeswitchPINVOKE { public static extern void switch_rtp_destroy(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_ice")] - public static extern int switch_rtp_activate_ice(HandleRef jarg1, string jarg2, string jarg3); + public static extern int switch_rtp_activate_ice(HandleRef jarg1, string jarg2, string jarg3, string jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_rtcp_ice")] + public static extern int switch_rtp_activate_rtcp_ice(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_rtcp")] public static extern int switch_rtp_activate_rtcp(HandleRef jarg1, int jarg2, ushort jarg3); @@ -13785,6 +13809,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_rtp_socket")] public static extern IntPtr switch_rtp_get_rtp_socket(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ping")] + public static extern void switch_rtp_ping(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_default_samples_per_interval")] public static extern uint switch_rtp_get_default_samples_per_interval(HandleRef jarg1); @@ -14932,7 +14959,7 @@ class freeswitchPINVOKE { public static extern uint EventConsumer_node_index_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_new_EventConsumer")] - public static extern IntPtr new_EventConsumer(string jarg1, string jarg2); + public static extern IntPtr new_EventConsumer(string jarg1, string jarg2, int jarg3); [DllImport("mod_managed", EntryPoint="CSharp_delete_EventConsumer")] public static extern void delete_EventConsumer(HandleRef jarg1); @@ -25184,6 +25211,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_INFO, SWITCH_MESSAGE_INDICATE_AUDIO_DATA, SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, + SWITCH_MESSAGE_INDICATE_STUN_ERROR, SWITCH_MESSAGE_INVALID } @@ -30895,6 +30923,18 @@ public class switch_rtp_numbers_t : IDisposable { } } + public SWIGTYPE_p_switch_size_t period_packet_count { + set { + freeswitchPINVOKE.switch_rtp_numbers_t_period_packet_count_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_period_packet_count_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public SWIGTYPE_p_switch_size_t media_packet_count { set { freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value)); @@ -31061,6 +31101,16 @@ public class switch_rtp_stats_t : IDisposable { } } + public uint read_count { + set { + freeswitchPINVOKE.switch_rtp_stats_t_read_count_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_rtp_stats_t_read_count_get(swigCPtr); + return ret; + } + } + public switch_rtp_stats_t() : this(freeswitchPINVOKE.new_switch_rtp_stats_t(), true) { } From ecb84bd12614f712d52610488be92d63425c0071 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 14:55:06 -0500 Subject: [PATCH 0536/1057] FS-4336 --resolve --- src/mod/applications/mod_sms/mod_sms.c | 10 ++++++++++ src/switch_loadable_module.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_sms/mod_sms.c b/src/mod/applications/mod_sms/mod_sms.c index f70282f8c6..ee13481c03 100644 --- a/src/mod/applications/mod_sms/mod_sms.c +++ b/src/mod/applications/mod_sms/mod_sms.c @@ -42,7 +42,17 @@ SWITCH_MODULE_DEFINITION(mod_sms, mod_sms_load, mod_sms_shutdown, NULL); static void event_handler(switch_event_t *event) { const char *dest_proto = switch_event_get_header(event, "dest_proto"); + const char *check_failure = switch_event_get_header(event, "Delivery-Failure"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "skip_global_process", "true"); + + if (switch_true(check_failure)) { + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Delivery Failure\n"); + DUMP_EVENT(event); + + return; + } + switch_core_chat_send(dest_proto, event); } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 51f343a70e..739f20f566 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -563,7 +563,6 @@ static switch_status_t do_chat_send(switch_event_t *message_event) if ((ci = (switch_chat_interface_t *) val)) { if (ci->chat_send && !strncasecmp(ci->interface_name, "GLOBAL_", 7)) { status = ci->chat_send(message_event); - if (status == SWITCH_STATUS_BREAK) { do_skip = 1; } @@ -581,6 +580,8 @@ static switch_status_t do_chat_send(switch_event_t *message_event) if (!do_skip && !switch_stristr("GLOBAL", dest_proto)) { if ((ci = switch_loadable_module_get_chat_interface(dest_proto)) && ci->chat_send) { status = ci->chat_send(message_event); + printf("FRICK\n"); + UNPROTECT_INTERFACE(ci); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid chat interface [%s]!\n", dest_proto); From ad53499b42892322f7cb6da7d0abb6be3acc64ad Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 22 Jun 2012 13:25:40 +0000 Subject: [PATCH 0537/1057] Always set the ZRTP SAS verified flag on our side When we're terminating ZRTP to an IVR or to a leg which is not ZRTP-capable, there's no way for us to make an intelligent decision about whether this flag should be set. For a client to consider the SAS as verified, however, both sides need to set this flag. By always setting this flag on our side, we leave the decision completely in the hands of the client where we hope there is a careful human. Signed-off-by: Travis Cross --- src/switch_rtp.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 60ba0010e1..27e6e83a26 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -772,9 +772,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event) switch_channel_set_variable_name_printf(channel, "true", "zrtp_secure_media_confirmed_%s", type); switch_channel_set_variable_name_printf(channel, stream->session->sas1.buffer, "zrtp_sas1_string_%s", type); switch_channel_set_variable_name_printf(channel, stream->session->sas2.buffer, "zrtp_sas2_string", type); - - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); - + zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)1); } } @@ -832,12 +830,6 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "User already enrolled!\n"); switch_channel_set_variable_name_printf(channel, "true", "zrtp_already_enrolled_%s", type); - - if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { - if (zrtp_session_info.sas_is_ready) { - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); - } - } } break; @@ -845,12 +837,6 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "New user enrolled!\n"); switch_channel_set_variable_name_printf(channel, "true", "zrtp_new_user_enrolled_%s", type); - - if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { - if (zrtp_session_info.sas_is_ready) { - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); - } - } } break; @@ -858,12 +844,6 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "User unenrolled!\n"); switch_channel_set_variable_name_printf(channel, "true", "zrtp_user_unenrolled_%s", type); - - if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) { - if (zrtp_session_info.sas_is_ready) { - zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); - } - } } break; @@ -3939,8 +3919,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, - &rtp_session->zrtp_session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); rtp_session->zrtp_mitm_tries++; } } @@ -4509,8 +4487,6 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, - &rtp_session->zrtp_session->peer_zid, (uint8_t)(zrtp_session_info.sas_is_verified ^ 1)); rtp_session->zrtp_mitm_tries++; } rtp_session->zrtp_mitm_tries++; From b16821944e92d6fb3da0b9a18f5922c6df18be5f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 22 Jun 2012 16:10:47 +0000 Subject: [PATCH 0538/1057] Harmonize debian nightly version with print_git_revision Debian nightlies created with debian/util.sh now have the version set in the same format as Makefile.am produces. Unlike Makefile.am, however, we show the orig packaging date rather than the date of the latest commit, as the latter could legitimately regress and we need this to always increment. --- debian/util.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 3f4fea312d..69a0ee6387 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -132,6 +132,17 @@ check_repo_clean () { || err "untracked files or build products present" } +get_last_release_ver () { + grep -m1 -e '^AC_INIT' configure.in \ + | cut -d, -f2 \ + | sed -e 's/\[//' -e 's/\]//' -e 's/ //g' +} + +get_nightly_version () { + local commit="$(git rev-list -n1 --abbrev=10 --abbrev-commit HEAD)" + echo "$(get_last_release_ver)+git~$(date +%Y%m%dT%H%M%SZ)~$commit" +} + create_orig () { { set -e @@ -147,7 +158,7 @@ create_orig () { done shift $(($OPTIND-1)) [ -z "$uver" ] || [ "$uver" = "nightly" ] \ - && uver="$(cat build/next-release.txt)-n$(date +%Y%m%dT%H%M%SZ)" + && uver="$(get_nightly_version)" local treeish="$1" dver="$(mk_dver "$uver")" local orig="../freeswitch_$dver.orig.tar.xz" [ -n "$treeish" ] || treeish="HEAD" From d18a7ffa2684085793f88df788222b7b5b25c860 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 22 Jun 2012 16:11:47 +0000 Subject: [PATCH 0539/1057] Bundle .version file with debian nightlies This adds the .version file to nightlies produced with debian/util.sh. --- debian/util.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/util.sh b/debian/util.sh index 69a0ee6387..e1f60e247c 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -176,6 +176,7 @@ create_orig () { git add -f libs fi ./build/set-fs-version.sh "$uver" && git add configure.in + echo "$uver" > .version && git add -f .version git commit --allow-empty -m "nightly v$uver" git archive -v \ --worktree-attributes \ From f79a37a3632d3ae97695f4645e1e718d7054bcc6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 22 Jun 2012 18:03:42 +0000 Subject: [PATCH 0540/1057] debian: Add option to use existing .orig.* file --- debian/util.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index e1f60e247c..2f80b70127 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -297,8 +297,8 @@ build_debs () { build_all () { local OPTIND OPTARG local orig_opts="" dsc_opts="" deb_opts="" - local archs="" distros="" par=false - while getopts 'a:bc:djnm:s:v:z:' o "$@"; do + local archs="" distros="" orig="" par=false + while getopts 'a:bc:djnmo:s:v:z:' o "$@"; do case "$o" in a) archs="$archs $OPTARG";; b) orig_opts="$orig_opts -b";; @@ -307,6 +307,7 @@ build_all () { j) par=true;; n) orig_opts="$orig_opts -n";; m) dsc_opts="$dsc_opts -m$OPTARG";; + o) orig="$OPTARG";; s) dsc_opts="$dsc_opts -s$OPTARG";; v) orig_opts="$orig_opts -v$OPTARG";; z) orig_opts="$orig_opts -z$OPTARG";; @@ -315,7 +316,7 @@ build_all () { shift $(($OPTIND-1)) [ -n "$archs" ] || archs="amd64 i386" [ -n "$distros" ] || distros="sid wheezy squeeze" - local orig="$(create_orig $orig_opts HEAD | tail -n1)" + [ -n "$orig" ] || orig="$(create_orig $orig_opts HEAD | tail -n1)" mkdir -p ../log > ../log/changes echo; echo; echo; echo @@ -369,6 +370,8 @@ commands: -n Nightly build -m [ quicktest ] Choose custom list of modules to build + -o + Specify existing .orig.tar.xz file -s [ paranoid | reckless ] Set FS bootstrap/build -j flags -v Set version From e38f0a1b02c0f68055cea8369fa29d2fbe73f088 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 22 Jun 2012 18:04:35 +0000 Subject: [PATCH 0541/1057] debian: Correct alphabetization --- debian/util.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 2f80b70127..f6617c951d 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -298,15 +298,15 @@ build_all () { local OPTIND OPTARG local orig_opts="" dsc_opts="" deb_opts="" local archs="" distros="" orig="" par=false - while getopts 'a:bc:djnmo:s:v:z:' o "$@"; do + while getopts 'a:bc:djmno:s:v:z:' o "$@"; do case "$o" in a) archs="$archs $OPTARG";; b) orig_opts="$orig_opts -b";; c) distros="$distros $OPTARG";; d) deb_opts="$deb_opts -d";; j) par=true;; - n) orig_opts="$orig_opts -n";; m) dsc_opts="$dsc_opts -m$OPTARG";; + n) orig_opts="$orig_opts -n";; o) orig="$OPTARG";; s) dsc_opts="$dsc_opts -s$OPTARG";; v) orig_opts="$orig_opts -v$OPTARG";; @@ -367,9 +367,9 @@ commands: -c Specify distributions -d Enable cowbuilder debug hook -j Build debs in parallel - -n Nightly build -m [ quicktest ] Choose custom list of modules to build + -n Nightly build -o Specify existing .orig.tar.xz file -s [ paranoid | reckless ] From 0f6647d278fdcb4f80e8f962eeae172015e98818 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 18:48:20 -0500 Subject: [PATCH 0542/1057] add some inital v18 interface points --- .../applications/mod_spandsp/mod_spandsp.c | 97 +++++- .../applications/mod_spandsp/mod_spandsp.h | 8 + .../mod_spandsp/mod_spandsp_dsp.c | 279 ++++++++++++++++++ 3 files changed, 380 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 8cfe9d1e24..f72708e9a0 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -34,6 +34,8 @@ * */ + +#define MY_EVENT_TDD_SEND_MESSAGE "TDD::SEND_MESSAGE" #include "mod_spandsp.h" #include #include "mod_spandsp_modem.h" @@ -51,7 +53,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown); SWITCH_MODULE_DEFINITION(mod_spandsp, mod_spandsp_init, mod_spandsp_shutdown, NULL); -static switch_event_node_t *NODE = NULL; SWITCH_STANDARD_APP(spanfax_tx_function) { @@ -74,6 +75,47 @@ SWITCH_STANDARD_APP(stop_dtmf_session_function) } +SWITCH_STANDARD_APP(tdd_encode_function) +{ + char *text = (char *) data; + + if (!zstr(text)) { + spandsp_tdd_encode_session(session, text); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing text data\n"); + } +} + +SWITCH_STANDARD_APP(tdd_send_function) +{ + char *text = (char *) data; + + if (!zstr(text)) { + spandsp_tdd_send_session(session, text); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing text data\n"); + } +} + +SWITCH_STANDARD_APP(stop_tdd_encode_function) +{ + spandsp_stop_tdd_encode_session(session); +} + + + + +SWITCH_STANDARD_APP(tdd_decode_function) +{ + spandsp_tdd_decode_session(session); +} + +SWITCH_STANDARD_APP(stop_tdd_decode_function) +{ + spandsp_stop_tdd_decode_session(session); +} + + SWITCH_STANDARD_APP(spandsp_fax_detect_session_function) { int argc = 0; @@ -117,6 +159,36 @@ SWITCH_STANDARD_APP(spandsp_stop_fax_detect_session_function) spandsp_fax_stop_detect_session(session); } +static void tdd_event_handler(switch_event_t *event) +{ + const char *uuid = switch_event_get_header(event, "tdd-uuid"); + const char *message = switch_event_get_body(event); + switch_core_session_t *session; + + if (zstr(message)) { + message = switch_event_get_header(event, "tdd-message"); + } + + if (zstr(message)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No message for tdd handler\n"); + return; + } + + if (zstr(uuid)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No uuid for tdd handler\n"); + return; + } + + if ((session = switch_core_session_locate(uuid))) { + + spandsp_tdd_encode_session(session, message); + + switch_core_session_rwunlock(session); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No session for supplied uuid.\n"); + } +} + static void event_handler(switch_event_t *event) { load_configuration(1); @@ -543,6 +615,16 @@ 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_stop_send_tdd", "stop sending tdd", "", stop_tdd_encode_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "spandsp_send_tdd", "Send TDD data", "Send TDD data", tdd_encode_function, "", SAF_MEDIA_TAP); + + SWITCH_ADD_APP(app_interface, "spandsp_stop_detect_tdd", "stop sending tdd", "", stop_tdd_decode_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "spandsp_detect_tdd", "Detect TDD data", "Detect TDD data", tdd_decode_function, "", SAF_MEDIA_TAP); + + + SWITCH_ADD_APP(app_interface, "spandsp_send_tdd", "Send TDD data", "Send TDD data", tdd_send_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "spandsp_start_fax_detect", "start fax detect", "start fax detect", spandsp_fax_detect_session_function, "[ ][ ][ ]", SAF_NONE); @@ -562,13 +644,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, "[name]"); SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, ""); } - - if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) { + + if ((switch_event_bind(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL) != SWITCH_STATUS_SUCCESS)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our reloadxml handler!\n"); /* Not such severe to prevent loading */ } + if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, MY_EVENT_TDD_SEND_MESSAGE, tdd_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); + } + + modem_global_init(module_interface, pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_spandsp loaded, using spandsp library version [%s]\n", SPANDSP_RELEASE_DATETIME_STRING); @@ -578,7 +665,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown) { - switch_event_unbind(&NODE); + switch_event_unbind_callback(event_handler); + switch_event_unbind_callback(tdd_event_handler); + mod_spandsp_fax_shutdown(); mod_spandsp_dsp_shutdown(); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index d4f388dd36..7e1eb49fa8 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -140,3 +140,11 @@ switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session); void spanfax_log_message(void *user_data, int level, const char *msg); switch_status_t load_configuration(switch_bool_t reload); void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on); + +switch_status_t spandsp_stop_tdd_encode_session(switch_core_session_t *session); +switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const char *text); + + +switch_status_t spandsp_stop_tdd_decode_session(switch_core_session_t *session); +switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session); +switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const char *text); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index cc4d4964e2..57ba4547f9 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -35,6 +35,285 @@ #include "mod_spandsp.h" +#define TDD_LEAD 10 + +typedef struct { + switch_core_session_t *session; + v18_state_t *tdd_state; + int head_lead; + int tail_lead; +} switch_tdd_t; + +static switch_bool_t tdd_encode_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) +{ + switch_tdd_t *pvt = (switch_tdd_t *) user_data; + switch_frame_t *frame = NULL; + switch_bool_t r = SWITCH_TRUE; + + switch (type) { + case SWITCH_ABC_TYPE_INIT: { + break; + } + case SWITCH_ABC_TYPE_CLOSE: + if (pvt->tdd_state) { + v18_free(pvt->tdd_state); + } + break; + case SWITCH_ABC_TYPE_WRITE_REPLACE: + if ((frame = switch_core_media_bug_get_write_replace_frame(bug))) { + int len; + + if (pvt->tail_lead) { + if (!--pvt->tail_lead) { + r = SWITCH_FALSE; + } + memset(frame->data, 0, frame->datalen); + + } else if (pvt->head_lead) { + pvt->head_lead--; + memset(frame->data, 0, frame->datalen); + } else { + len = v18_tx(pvt->tdd_state, frame->data, frame->samples); + + if (!len) { + pvt->tail_lead = TDD_LEAD; + } + } + + switch_core_media_bug_set_write_replace_frame(bug, frame); + } + break; + case SWITCH_ABC_TYPE_WRITE: + default: + break; + } + + return r; +} + +switch_status_t spandsp_stop_tdd_encode_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, "tdd_encode"))) { + switch_channel_set_private(channel, "tdd_encode", NULL); + switch_core_media_bug_remove(session, &bug); + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + +static void put_text_msg(void *user_data, const uint8_t *msg, int len) +{ + switch_tdd_t *pvt = (switch_tdd_t *) user_data; + switch_event_t *event, *clone; + switch_channel_t *channel = switch_core_session_get_channel(pvt->session); + switch_core_session_t *other_session; + + + switch_channel_add_variable_var_check(channel, "tdd_messages", (char *)msg, SWITCH_FALSE, SWITCH_STACK_PUSH); + + if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", "mod_spandsp"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "TDD MESSAGE"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(pvt->session)); + switch_event_add_body(event, (char *)msg); + + if (switch_core_session_get_partner(pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) { + + if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { + switch_core_session_receive_event(other_session, &clone); + } + + if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { + switch_core_session_queue_event(other_session, &clone); + } + + switch_core_session_rwunlock(other_session); + } + + switch_event_fire(&event); + + + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s got TDD Message [%s]\n", switch_channel_get_name(channel), (char *)msg); + +} + +switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const char *text) +{ + v18_state_t *tdd_state; + switch_frame_t *read_frame, write_frame = { 0 }; + uint8_t write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_codec_implementation_t read_impl = { 0 }; + switch_codec_t write_codec = { 0 }; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status; + + switch_core_session_get_read_impl(session, &read_impl); + + if (switch_core_codec_init(&write_codec, + "L16", + NULL, + read_impl.actual_samples_per_second, + read_impl.microseconds_per_packet / 1000, + read_impl.number_of_channels, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, + switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + write_frame.data = write_buf; + write_frame.buflen = sizeof(write_buf); + write_frame.datalen = read_impl.decoded_bytes_per_packet; + write_frame.samples = write_frame.datalen / 2; + write_frame.codec = &write_codec; + switch_core_session_set_read_codec(session, &write_codec); + } else { + return SWITCH_STATUS_FALSE; + } + + tdd_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, put_text_msg, NULL); + + + v18_put(tdd_state, text, -1); + + while(switch_channel_ready(channel)) { + status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + + if (!v18_tx(tdd_state, (void *)write_buf, write_frame.samples)) { + break; + } + + if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + break; + } + + } + + switch_core_codec_destroy(&write_codec); + switch_core_session_set_read_codec(session, NULL); + + v18_free(tdd_state); + + return SWITCH_STATUS_SUCCESS; +} + + +switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const char *text) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_media_bug_t *bug; + switch_status_t status; + switch_tdd_t *pvt; + //switch_codec_implementation_t read_impl = { 0 }; + + //switch_core_session_get_read_impl(session, &read_impl); + + if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) { + return SWITCH_STATUS_MEMERR; + } + + pvt->session = session; + pvt->tdd_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, put_text_msg, NULL); + pvt->head_lead = TDD_LEAD; + + v18_put(pvt->tdd_state, text, -1); + + if ((status = switch_core_media_bug_add(session, "spandsp_tdd_encode", NULL, + tdd_encode_callback, pvt, 0, SMBF_WRITE_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { + v18_free(pvt->tdd_state); + return status; + } + + switch_channel_set_private(channel, "tdd_encode", bug); + + return SWITCH_STATUS_SUCCESS; +} + + + +///XXX +static switch_bool_t tdd_decode_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) +{ + switch_tdd_t *pvt = (switch_tdd_t *) user_data; + switch_frame_t *frame = NULL; + switch_bool_t r = SWITCH_TRUE; + + switch (type) { + case SWITCH_ABC_TYPE_INIT: { + break; + } + case SWITCH_ABC_TYPE_CLOSE: + if (pvt->tdd_state) { + v18_free(pvt->tdd_state); + } + break; + case SWITCH_ABC_TYPE_READ_REPLACE: + if ((frame = switch_core_media_bug_get_read_replace_frame(bug))) { + + v18_rx(pvt->tdd_state, frame->data, frame->samples); + + switch_core_media_bug_set_read_replace_frame(bug, frame); + } + break; + case SWITCH_ABC_TYPE_WRITE: + default: + break; + } + + return r; +} + +switch_status_t spandsp_stop_tdd_decode_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, "tdd_decode"))) { + switch_channel_set_private(channel, "tdd_decode", NULL); + switch_core_media_bug_remove(session, &bug); + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + +switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_media_bug_t *bug; + switch_status_t status; + switch_tdd_t *pvt; + //switch_codec_implementation_t read_impl = { 0 }; + + //switch_core_session_get_read_impl(session, &read_impl); + + if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) { + return SWITCH_STATUS_MEMERR; + } + + pvt->session = session; + pvt->tdd_state = v18_init(NULL, FALSE, V18_MODE_5BIT_45, put_text_msg, pvt); + + if ((status = switch_core_media_bug_add(session, "spandsp_tdd_decode", NULL, + tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { + v18_free(pvt->tdd_state); + return status; + } + + switch_channel_set_private(channel, "tdd_decode", bug); + + return SWITCH_STATUS_SUCCESS; +} + +///XXX + typedef struct { switch_core_session_t *session; dtmf_rx_state_t *dtmf_detect; From 93a8445f1c4ed062cc56c2285d225de8eee7e83d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 18:53:29 -0500 Subject: [PATCH 0543/1057] change name --- src/mod/applications/mod_spandsp/mod_spandsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index f72708e9a0..ae0ecd9c85 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -616,8 +616,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) 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_stop_send_tdd", "stop sending tdd", "", stop_tdd_encode_function, "", SAF_NONE); - SWITCH_ADD_APP(app_interface, "spandsp_send_tdd", "Send TDD data", "Send TDD data", tdd_encode_function, "", SAF_MEDIA_TAP); + SWITCH_ADD_APP(app_interface, "spandsp_stop_inject_tdd", "stop sending tdd", "", stop_tdd_encode_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "spandsp_inject_tdd", "Send TDD data", "Send TDD data", tdd_encode_function, "", SAF_MEDIA_TAP); SWITCH_ADD_APP(app_interface, "spandsp_stop_detect_tdd", "stop sending tdd", "", stop_tdd_decode_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "spandsp_detect_tdd", "Detect TDD data", "Detect TDD data", tdd_decode_function, "", SAF_MEDIA_TAP); From 1465ba90e60ee745bddf0212383bf91381e58084 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 19:00:53 -0500 Subject: [PATCH 0544/1057] tweaks --- src/mod/applications/mod_spandsp/mod_spandsp.c | 2 +- src/mod/applications/mod_spandsp/mod_spandsp.h | 3 +++ src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index ae0ecd9c85..cf76422db6 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -35,7 +35,7 @@ */ -#define MY_EVENT_TDD_SEND_MESSAGE "TDD::SEND_MESSAGE" + #include "mod_spandsp.h" #include #include "mod_spandsp_modem.h" diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 7e1eb49fa8..68152ffdf9 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -42,6 +42,9 @@ typedef HANDLE zap_socket_t; typedef int zap_socket_t; #endif +#define MY_EVENT_TDD_SEND_MESSAGE "TDD::SEND_MESSAGE" +#define MY_EVENT_TDD_RECV_MESSAGE "TDD::RECV_MESSAGE" + #define MAX_MODEMS 1024 #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES #include diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 57ba4547f9..8eb8092c1e 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -114,7 +114,8 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len) switch_channel_add_variable_var_check(channel, "tdd_messages", (char *)msg, SWITCH_FALSE, SWITCH_STACK_PUSH); - if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { + + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TDD_RECV_MESSAGE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", "mod_spandsp"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd"); From 86df8b338e7c155d144e19b256d7e9e37ef695db Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Jun 2012 19:33:26 -0500 Subject: [PATCH 0545/1057] more v18 changes --- .../applications/mod_spandsp/mod_spandsp.c | 99 ++++++++++++++++++- 1 file changed, 96 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index cf76422db6..25a180ef84 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -261,9 +261,7 @@ SWITCH_STANDARD_APP(start_tone_detect_app) } } -/** - * Start tone detector API - */ + SWITCH_STANDARD_API(start_tone_detect_api) { switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -293,6 +291,8 @@ SWITCH_STANDARD_API(start_tone_detect_api) return status; } + + /** * Stop tone detector application * @@ -336,6 +336,91 @@ SWITCH_STANDARD_API(stop_tone_detect_api) } + +SWITCH_STANDARD_API(start_tdd_detect_api) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_core_session_t *psession = NULL; + + if (!(psession = switch_core_session_locate(cmd))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + return SWITCH_STATUS_SUCCESS; + } + + spandsp_tdd_decode_session(psession); + + if (status == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK started\n"); + } else { + stream->write_function(stream, "-ERR failed to start tdd detector\n"); + } + + switch_core_session_rwunlock(psession); + + return status; +} + + +SWITCH_STANDARD_API(stop_tdd_detect_api) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_core_session_t *psession = NULL; + + + if (!(psession = switch_core_session_locate(cmd))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + return SWITCH_STATUS_SUCCESS; + } + + spandsp_stop_tdd_decode_session(psession); + + stream->write_function(stream, "+OK stopped\n"); + switch_core_session_rwunlock(psession); + + return status; +} + + +SWITCH_STANDARD_API(start_send_tdd_api) +{ + switch_core_session_t *psession = NULL; + char *puuid = NULL, *text = NULL; + + if (zstr(cmd)) { + stream->write_function(stream, "-ERR missing uuid\n"); + return SWITCH_STATUS_SUCCESS; + } + + puuid = strdup((char *)cmd); + + if ((text = strchr(puuid, ' '))) { + *text++ = '\0'; + } + + if (zstr(text)) { + stream->write_function(stream, "-ERR missing text\n"); + goto end; + } + + + if (!(psession = switch_core_session_locate(cmd))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + goto end; + } + + + spandsp_tdd_encode_session(psession, text); + + stream->write_function(stream, "+OK\n"); + switch_core_session_rwunlock(psession); + + end: + + switch_safe_free(puuid); + + return SWITCH_STATUS_SUCCESS; +} + void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on) { switch_core_session_t *target_session = NULL; @@ -645,6 +730,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, ""); } + + SWITCH_ADD_API(api_interface, "start_tdd_detect", "Start background tdd detection", start_tdd_detect_api, ""); + SWITCH_ADD_API(api_interface, "stop_tdd_detect", "Stop background tdd detection", stop_tdd_detect_api, ""); + + SWITCH_ADD_API(api_interface, "uuid_send_tdd", "send tdd data to a uuid", start_send_tdd_api, " "); + + + if ((switch_event_bind(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL) != SWITCH_STATUS_SUCCESS)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our reloadxml handler!\n"); /* Not such severe to prevent loading */ From 453b42e30171e72e5373ead44a163bde7842ebb8 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 24 Jun 2012 07:36:14 +0000 Subject: [PATCH 0546/1057] Remove extraneous parenthesis This causes a warning that breaks the build with clang. --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 27e6e83a26..05dd7ef0c5 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -702,7 +702,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d bytes = switch_stun_packet_length(rpacket); switch_socket_sendto(sock_output, from_addr, 0, (void *) rpacket, &bytes); - } else if ((packet->header.type == SWITCH_STUN_BINDING_ERROR_RESPONSE)) { + } else if (packet->header.type == SWITCH_STUN_BINDING_ERROR_RESPONSE) { switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); ice_out(rtp_session, ice); From f1183ef97049c5757ae545cf4464c58238a99616 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 24 Jun 2012 07:34:48 +0000 Subject: [PATCH 0547/1057] Fix use of switch_event_add_body On some compilers this fixes the build. gcc reports: error: format not a string literal and no format arguments clang reports: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] --- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 8eb8092c1e..b01a4638a3 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -121,7 +121,7 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "TDD MESSAGE"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(pvt->session)); - switch_event_add_body(event, (char *)msg); + switch_event_add_body(event, "%s", (char *)msg); if (switch_core_session_get_partner(pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) { From a973fb63470d61b62dac13fe294bd2147f9360e7 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 24 Jun 2012 08:05:25 +0000 Subject: [PATCH 0548/1057] Fix memset calls in APR sha2 implementation The implementation clears the context / state data from memory when it is finished with it. Prior to this commit, however, it was actually only clearing the first 4 bytes on x86 or 8 bytes on x86_64. clang warns: warning: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess] --- libs/apr/random/unix/sha2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/apr/random/unix/sha2.c b/libs/apr/random/unix/sha2.c index 7f55dac959..169afd5a78 100644 --- a/libs/apr/random/unix/sha2.c +++ b/libs/apr/random/unix/sha2.c @@ -557,7 +557,7 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { } /* Clean up state data: */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); usedspace = 0; } @@ -578,7 +578,7 @@ char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) { } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH); return buffer; @@ -889,7 +889,7 @@ void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) { @@ -909,7 +909,7 @@ char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) { } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH); return buffer; @@ -964,7 +964,7 @@ void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) { @@ -984,7 +984,7 @@ char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) { } *buffer = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH); return buffer; From 932dccd475937cb1e8bcd6a787893d8fefa4ddbc Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 24 Jun 2012 08:11:23 +0000 Subject: [PATCH 0549/1057] Return const char* from apr_pool_tag clang warns: warning: returning 'const char *' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types] --- libs/apr/include/apr_pools.h | 2 +- libs/apr/memory/unix/apr_pools.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/apr/include/apr_pools.h b/libs/apr/include/apr_pools.h index 74ed59e35b..886323fa66 100644 --- a/libs/apr/include/apr_pools.h +++ b/libs/apr/include/apr_pools.h @@ -409,7 +409,7 @@ APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b); * @param pool The pool to tag * @param tag The tag */ -APR_DECLARE(char *) apr_pool_tag(apr_pool_t *pool, const char *tag); +APR_DECLARE(const char *) apr_pool_tag(apr_pool_t *pool, const char *tag); #if APR_HAS_THREADS /** diff --git a/libs/apr/memory/unix/apr_pools.c b/libs/apr/memory/unix/apr_pools.c index 99e1888b1f..7ddc5e2af8 100644 --- a/libs/apr/memory/unix/apr_pools.c +++ b/libs/apr/memory/unix/apr_pools.c @@ -1895,7 +1895,7 @@ APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b) return 0; } -APR_DECLARE(char *) apr_pool_tag(apr_pool_t *pool, const char *tag) +APR_DECLARE(const char *) apr_pool_tag(apr_pool_t *pool, const char *tag) { if (tag) { pool->tag = tag; From 3c2f914617949ab3755fed2a1ce822d6138ae9b2 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 24 Jun 2012 08:34:52 +0000 Subject: [PATCH 0550/1057] Fix warnings in sqlite --- libs/sqlite/src/shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/sqlite/src/shell.c b/libs/sqlite/src/shell.c index b78b426ecb..f8fc854d82 100644 --- a/libs/sqlite/src/shell.c +++ b/libs/sqlite/src/shell.c @@ -414,7 +414,7 @@ static void output_csv(struct callback_data *p, const char *z, int bSep){ } } if( bSep ){ - fprintf(p->out, p->separator); + fprintf(p->out, "%s", p->separator); } } @@ -1085,7 +1085,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ }else if( c=='h' && strncmp(azArg[0], "help", n)==0 ){ - fprintf(stderr,zHelp); + fprintf(stderr,"%s",zHelp); }else if( c=='i' && strncmp(azArg[0], "import", n)==0 && nArg>=3 ){ From 12efacb3c604a36ea3966fee30e375875dadfc0b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 24 Jun 2012 08:46:00 +0000 Subject: [PATCH 0551/1057] debian: Add mechanism to set C/C++ compiler --- debian/rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/rules b/debian/rules index 1460ee8962..cd7934e439 100755 --- a/debian/rules +++ b/debian/rules @@ -4,10 +4,14 @@ #export DH_VERBOSE=1 +FS_CC?=gcc +FS_CXX?=g++ FS_CFLAGS?=-ggdb3 -O2 FS_CPPFLAGS?= FS_CXXFLAGS?=$(FS_CFLAGS) export PATH?=/usr/lib/ccache:/usr/sbin:/usr/bin:/sbin:/bin +export CC=$(FS_CC) +export CXX=$(FS_CXX) export CFLAGS=$(FS_CFLAGS) export CPPFLAGS=$(FS_CPPFLAGS) export CXXFLAGS=$(FS_CXXFLAGS) @@ -16,6 +20,8 @@ show_vars= \ echo; \ echo "Making target $@"; \ echo "PATH='$(PATH)'"; \ + echo "CC='$(CC)'"; \ + echo "CXX='$(CXX)'"; \ echo "CFLAGS='$(CFLAGS)'"; \ echo "CXXFLAGS='$(CXXFLAGS)'"; \ echo "CCACHE_DIR='$(CCACHE_DIR)'"; \ From ee8c9e869ba0da3d4f620769c1e241be71d99e6f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 24 Jun 2012 09:13:21 +0000 Subject: [PATCH 0552/1057] Fix clang warnings in mod_lua --- src/mod/languages/mod_lua/mod_lua.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index adb13a43dd..0df0d8f11d 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -260,7 +260,7 @@ static switch_xml_t lua_fetch(const char *section, mod_lua_conjure_event(L, params, "params", 1); } - if( error = lua_parse_and_execute(L, mycmd) ){ + if((error = lua_parse_and_execute(L, mycmd))){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LUA script parse/execute error!\n"); return NULL; } @@ -331,7 +331,7 @@ static switch_status_t do_config(void) if (cpath_stream.data_len) { char *lua_cpath = NULL; - if (lua_cpath = getenv("LUA_CPATH")) { + if ((lua_cpath = getenv("LUA_CPATH"))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending LUA_CPATH: '%s'\n", lua_cpath); cpath_stream.write_function(&cpath_stream, ";%s", lua_cpath); } @@ -349,7 +349,7 @@ static switch_status_t do_config(void) if (path_stream.data_len) { char *lua_path = NULL; - if (lua_path = getenv("LUA_PATH")) { + if ((lua_path = getenv("LUA_PATH"))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending LUA_PATH: '%s'\n", lua_path); path_stream.write_function(&path_stream, ";%s", lua_path); } From 7086a92f9b1be3d72add3247b42a54f0b8f4a8e9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 24 Jun 2012 15:05:59 -0500 Subject: [PATCH 0553/1057] FS-4318 try this, success is 0 so that original patch was wrong --- 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 f46b8d935f..15d927fed1 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1436,7 +1436,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr switch_core_session_t *isession = imember->session; switch_channel_t *ichannel; - if (!isession || !switch_core_session_read_lock(isession)) { + if (!isession || switch_core_session_read_lock(isession) != SWITCH_STATUS_SUCCESS) { continue; } From 43f2c89a08dcf5fe1c4610c668bab56982febcbf Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 05:25:21 +0000 Subject: [PATCH 0554/1057] Fix memset calls in sofia-sip These calls were zeroing only a pointer's worth of memory rather than the actual size of the objects. --- libs/sofia-sip/libsofia-sip-ua/msg/msg.c | 4 ++-- libs/sofia-sip/libsofia-sip-ua/su/su_root.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg.c b/libs/sofia-sip/libsofia-sip-ua/msg/msg.c index 264ca267f8..385188835d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg.c +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg.c @@ -242,8 +242,8 @@ msg_mclass_t const *msg_mclass(msg_t const *msg) */ void msg_addr_zero(msg_t *msg) { - memset(&msg->m_addr, 0, sizeof(&msg->m_addr)); - memset(&msg->m_addrinfo, 0, sizeof(&msg->m_addrinfo)); + memset(&msg->m_addr, 0, sizeof(msg->m_addr)); + memset(&msg->m_addrinfo, 0, sizeof(msg->m_addrinfo)); msg->m_addrinfo.ai_addrlen = sizeof(msg->m_addr); msg->m_addrinfo.ai_addr = &msg->m_addr->su_sa; diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_root.c b/libs/sofia-sip/libsofia-sip-ua/su/su_root.c index e2179714e0..47198948f3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_root.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_root.c @@ -152,7 +152,7 @@ _su_task_r su_task_init(su_task_r task) { assert(task); - memset(task, 0, sizeof(task)); + memset(task, 0, sizeof(su_task_r)); return task; } From c01a1426653f7424e883794a94caa086f23372ed Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 05:29:39 +0000 Subject: [PATCH 0555/1057] Implement su_errno and su_seterrno as functions This avoid warnings about expressions with unused values. These warnings break the build with clang. An optimizing compiler should still inline these calls. If that turns out not to happen on some platform, we could rename the functions used internally and declare them static inline. --- libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h | 5 ----- libs/sofia-sip/libsofia-sip-ua/su/su_errno.c | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h b/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h index c11570c4eb..223f7cf018 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h +++ b/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h @@ -53,11 +53,6 @@ SOFIAPUBFUN int su_errno(void); /** Set the su error. */ SOFIAPUBFUN int su_seterrno(int); -#if !SU_HAVE_WINSOCK -#define su_errno() (errno) -#define su_seterrno(n) ((errno = (n)), -1) -#endif - #if defined(__APPLE_CC__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) #ifndef EBADMSG #define EBADMSG EFAULT diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_errno.c b/libs/sofia-sip/libsofia-sip-ua/su/su_errno.c index 7b888bbacc..3ab183edc0 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_errno.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_errno.c @@ -157,4 +157,7 @@ const char *su_strerror(int errcode) return strerror(errcode); } +int su_errno(void) { return errno; } +int su_seterrno(int n) { errno = n; return -1; } + #endif /* SU_HAVE_WINSOCK */ From 9e52f33d916258f54ea514a3d335a6cc034ce99a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 05:33:24 +0000 Subject: [PATCH 0556/1057] Implement MEMLOCK and UNLOCK as functions Converting these macros to functions declared static inline allow the C type-checker to work and avoid warnings about unused expression values. These warnings break the build with clang. --- libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 cc0b9603f5..0369e08b5c 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c @@ -209,9 +209,14 @@ void (*_su_home_destroy_mutexes)(void *mutex); su_inline void safefree(void *b) { b ? free(b) : (void)0; } #endif -#define MEMLOCK(h) \ - ((void)((h) && (h)->suh_lock ? _su_home_locker((h)->suh_lock) : 0), (h)->suh_blocks) -#define UNLOCK(h) ((void)((h) && (h)->suh_lock ? _su_home_unlocker((h)->suh_lock) : 0), NULL) +static inline su_block_t* MEMLOCK(const su_home_t *h) { + if (h && h->suh_lock) _su_home_locker(h->suh_lock); + return h->suh_blocks; +} +static inline void* UNLOCK(const su_home_t *h) { + if (h && h->suh_lock) _su_home_unlocker(h->suh_lock); + return NULL; +} #ifdef NDEBUG #define MEMCHECK 0 From 76a26648d41b17750b5168328e80e69da6f1d30a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 05:47:27 +0000 Subject: [PATCH 0557/1057] Remove a tautological conditional SU_LOG->log_level is declared as unsigned, hence it will always be >= 0. --- libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c index 5dfbc3098f..3d74f66644 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c @@ -1625,7 +1625,7 @@ sres_sip_append_result(sres_sip_t *srs, break; } - if ((srs->srs_canonname && srs->srs_numeric) || (SU_LOG->log_level >= 0)) { + { unsigned port = 0; char const *lb = "", *rb = ""; From 5077384c5bdbc0571bcedb482112c1a0d40f495f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 05:53:55 +0000 Subject: [PATCH 0558/1057] Remove a contradiction base64_d returns a value of size_t, which is unsigned. The value therefore cannot be less than zero. The second check testing whether it is >= INT_MAX is not a contradiction, but it doesn't make any sense to check for this (as far as I can tell). --- libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c index 830603f169..0814c8c780 100644 --- a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c +++ b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c @@ -535,8 +535,6 @@ void auth_method_basic(auth_mod_t *am, if (!au->au_params) continue; n = base64_d(userpass, upsize - 1, au->au_params[0]); - if (n < 0 || n >= INT_MAX) - continue; if (n >= upsize) { void *b = realloc(userpass == buffer ? NULL : userpass, upsize = n + 1); if (b == NULL) From e6629ab5f606c799aa12204dbc307cba1b3a0648 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 05:57:01 +0000 Subject: [PATCH 0559/1057] Add missing return statement sres_cached_answers_sockaddr is supposed to return ENOENT if no cached records are found. Because of the missing return statement, however, it would never do this and would instead return something very likely to be garbage. --- libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c index ceb7d0f601..009ba80695 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c @@ -1372,7 +1372,7 @@ sres_cached_answers_sockaddr(sres_resolver_t *res, return NULL; if (!sres_cache_get(res->res_cache, type, name, &result)) - su_seterrno(ENOENT), (void *)NULL; + return su_seterrno(ENOENT), (void *)NULL; return result; } From cbde2faab2d7ec245b4b84475abdc8bdbba01c74 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 06:01:37 +0000 Subject: [PATCH 0560/1057] Fix confusion between size_t and ssize_t readfile returns a value of type ssize_t (signed) and returns -1 if an error occurs. In auth_readdb_internal, however, we were assigning the return value of readfile to a variable of type size_t (unsigned), but then testing this unsigned value to see if it was < 0, a contradiction. We would thus simultaneously fail to report the error in readfile and would end up with a corrupted length value. --- libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c index 0814c8c780..087810ebc7 100644 --- a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c +++ b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c @@ -961,6 +961,7 @@ int auth_readdb_internal(auth_mod_t *am, int always) FILE *f; char *data, *s; size_t len, i, n, N; + ssize_t slen; auth_passwd_t *apw; if (!am->am_stat) @@ -1002,7 +1003,7 @@ int auth_readdb_internal(auth_mod_t *am, int always) if (am->am_stat) stat(am->am_db, am->am_stat); /* too bad if this fails */ - len = readfile(am->am_home, f, &buffer, 1); + slen = readfile(am->am_home, f, &buffer, 1); #if HAVE_FLOCK /* Release shared lock on the database file */ @@ -1016,8 +1017,9 @@ int auth_readdb_internal(auth_mod_t *am, int always) fclose(f); - if (len < 0) + if (slen < 0) return -1; + len = (size_t)slen; /* Count number of entries in new buffer */ for (i = am->am_anonymous, s = data = buffer; @@ -1208,7 +1210,7 @@ ssize_t readfile(su_home_t *home, buffer[len] = '\0'; *contents = buffer; - return len; + return (ssize_t)len; } /* ====================================================================== */ From 3f24ef16b1fc662fd5f59bd391ec39e98d5f9e56 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 06:20:16 +0000 Subject: [PATCH 0561/1057] Avoid -Wunused-value warning Don't use the SET_STATUS1 macro as it will always produce this warning. It's a rather 'interesting' macro that's probably best avoided anyway. --- libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c | 6 +++--- libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c index 96a8059c21..0ddecd95f3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c @@ -199,7 +199,7 @@ void authorize_watcher(nea_server_t *nes, int substate = sn->sn_state; int status; char const *phrase; - SET_STATUS1(SIP_200_OK); + SET_STATUS(200, sip_200_OK); /* OK. In nhp (nua_handle_preferences_t) structure we have the current default action (or state) for incoming @@ -218,10 +218,10 @@ void authorize_watcher(nea_server_t *nes, substate = nua_substate_pending; if (substate == nua_substate_terminated) { - what = "rejected"; SET_STATUS1(SIP_403_FORBIDDEN); + what = "rejected"; SET_STATUS(403, sip_403_Forbidden); } else if (substate == nua_substate_pending) { - what = "pending"; SET_STATUS1(SIP_202_ACCEPTED); + what = "pending"; SET_STATUS(202, sip_202_Accepted); } else { what = "active"; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c index dbe588cc8e..2a55c345a7 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c @@ -413,7 +413,7 @@ static int nua_publish_client_response(nua_client_request_t *cr, if (!ex || ex->ex_delta == 0) SET_STATUS(900, "Received Invalid Expiration Time"); else - SET_STATUS1(NUA_ERROR_AT(__FILE__, __LINE__)); + SET_STATUS(900, _NUA_INTERNAL_ERROR_AT(__FILE__, __LINE__)); } else nua_dialog_usage_set_refresh(du, ex->ex_delta); From f840eecdb80758808b4288cc861460ada18dd4c9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 07:09:20 +0000 Subject: [PATCH 0562/1057] debian: Add mechanism to specify modules.conf --- debian/util.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index f6617c951d..7c33056a93 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -199,9 +199,10 @@ EOF create_dsc () { { set -e - local OPTIND OPTARG modules_list="" speed="normal" - while getopts 'm:s:' o "$@"; do + local OPTIND OPTARG modules_conf="" modules_list="" speed="normal" + while getopts 'f:m:s:' o "$@"; do case "$o" in + f) modules_conf="$OPTARG";; m) modules_list="$OPTARG";; s) speed="$OPTARG";; esac @@ -213,6 +214,9 @@ create_dsc () { local dver="${orig_ver}-1~${distro}+1" [ -x "$(which dch)" ] \ || err "package devscripts isn't installed" + if [ -n "$modules_conf" ]; then + cp $modules_conf debian/modules.conf + fi if [ -n "$modules_list" ]; then set_modules_${modules_list} fi @@ -298,12 +302,13 @@ build_all () { local OPTIND OPTARG local orig_opts="" dsc_opts="" deb_opts="" local archs="" distros="" orig="" par=false - while getopts 'a:bc:djmno:s:v:z:' o "$@"; do + while getopts 'a:bc:df:jmno:s:v:z:' o "$@"; do case "$o" in a) archs="$archs $OPTARG";; b) orig_opts="$orig_opts -b";; c) distros="$distros $OPTARG";; d) deb_opts="$deb_opts -d";; + f) dsc_opts="$dsc_opts -f$OPTARG";; j) par=true;; m) dsc_opts="$dsc_opts -m$OPTARG";; n) orig_opts="$orig_opts -n";; @@ -366,6 +371,8 @@ commands: -b Bundle downloaded libraries in source package -c Specify distributions -d Enable cowbuilder debug hook + -f + Build only modules listed in this file -j Build debs in parallel -m [ quicktest ] Choose custom list of modules to build @@ -387,6 +394,8 @@ commands: create-dsc + -f + Build only modules listed in this file -m [ quicktest ] Choose custom list of modules to build -s [ paranoid | reckless ] From 95c26f9a6b45fc3f24c32080f04e7e5ce54781f2 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 23 Jun 2012 00:02:49 +0000 Subject: [PATCH 0563/1057] Remove outdated autoconf tests in bnlib --- .../third_party/bnlib/bignum-ARM/bntest16.c | 6 -- .../third_party/bnlib/bignum-ARM/config.h | 15 ----- .../third_party/bnlib/bignum-ARM/kludge.h | 55 ------------------- .../third_party/bnlib/bignum-ARM/lbn16.c | 6 -- .../third_party/bnlib/bignum-ARM/lbnmem.c | 6 -- libs/libzrtp/third_party/bnlib/bn16.c | 6 -- libs/libzrtp/third_party/bnlib/bn32.c | 6 -- libs/libzrtp/third_party/bnlib/bn64.c | 6 -- libs/libzrtp/third_party/bnlib/bnconfig.hin | 15 ----- libs/libzrtp/third_party/bnlib/bnconfig.win | 15 ----- libs/libzrtp/third_party/bnlib/bntest16.c | 6 -- libs/libzrtp/third_party/bnlib/bntest32.c | 6 -- libs/libzrtp/third_party/bnlib/bntest64.c | 6 -- libs/libzrtp/third_party/bnlib/configure.in | 55 ------------------- libs/libzrtp/third_party/bnlib/germtest.c | 3 - libs/libzrtp/third_party/bnlib/kludge.h | 55 ------------------- libs/libzrtp/third_party/bnlib/lbn16.c | 6 -- libs/libzrtp/third_party/bnlib/lbn32.c | 6 -- libs/libzrtp/third_party/bnlib/lbn64.c | 6 -- libs/libzrtp/third_party/bnlib/lbnmem.c | 6 -- libs/libzrtp/third_party/bnlib/sieve.c | 6 -- libs/libzrtp/third_party/bnlib/test/kludge.h | 34 ------------ 22 files changed, 331 deletions(-) diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c b/libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c index ccb5f2504e..c220d6e683 100644 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c +++ b/libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c @@ -31,9 +31,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #include @@ -48,9 +45,6 @@ long strtol(const char *, char **, int); #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "cputime.h" #include "lbn16.h" diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/config.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/config.h index 671be5c7fc..27e128c8d9 100644 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/config.h +++ b/libs/libzrtp/third_party/bnlib/bignum-ARM/config.h @@ -27,7 +27,6 @@ #define NO_STRING_H !HAVE_STRING_H #define HAVE_STRINGS_H 0 -#define NEED_MEMORY_H 0 /* We go to some trouble to find accurate times... */ @@ -51,20 +50,6 @@ /* Defines for various kinds of library brokenness */ -/* Define if is missing prototypes (= lots of warnings!) */ -#define NO_STDIO_PROTOS 0 - -/* Define if depends on and breaks without it */ -#define ASSERT_NEEDS_STDIO 0 -/* Define if depends on and complains without it */ -#define ASSERT_NEEDS_STDLIB 0 - -/* - * Define if delcares the mem* functions to take char * - * instead of void * parameters (= lots of warnings) - */ -#define MEM_PROTOS_BROKEN 0 - /* If not available, bcopy() is substituted */ #define HAVE_MEMMOVE 1 #define NO_MEMMOVE !HAVE_MEMMOVE diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h b/libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h index 023c8905d7..6c5340e789 100644 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h +++ b/libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h @@ -11,28 +11,10 @@ * Some compilers complain about #if FOO if FOO isn't defined, * so do the ANSI-mandated thing explicitly... */ -#ifndef ASSERT_NEEDS_STDIO -#define ASSERT_NEEDS_STDIO 0 -#endif -#ifndef ASSERT_NEEDS_STDLIB -#define ASSERT_NEEDS_STDLIB 0 -#endif #ifndef NO_STDLIB_H #define NO_STDLIB_H 0 #endif -/* SunOS 4.1.x needs "stderr" defined, and "exit" declared... */ -#ifdef assert -#if ASSERT_NEEDS_STDIO -#include -#endif -#if ASSERT_NEEDS_STDLIB -#if !NO_STDLIB_H -#include -#endif -#endif -#endif - #ifndef NO_MEMMOVE #define NO_MEMMOVE 0 #endif @@ -47,43 +29,6 @@ #define memcpy(dest,src,len) bcopy(src,dest,len) #endif -#ifndef MEM_PROTOS_BROKEN -#define MEM_PROTOS_BROKEN 0 -#endif -#if MEM_PROTOS_BROKEN -#define memcpy(d,s,l) memcpy((void *)(d), (void const *)(s), l) -#define memmove(d,s,l) memmove((void *)(d), (void const *)(s), l) -#define memcmp(d,s,l) memcmp((void const *)(d), (void const *)(s), l) -#define memset(d,v,l) memset((void *)(d), v, l) -#endif - -/* - * If there are no prototypes for the stdio functions, use these to - * reduce compiler warnings. Uses EOF as a giveaway to indicate - * that was #included. - */ -#ifndef NO_STDIO_PROTOS -#define NO_STDIO_PROTOS 0 -#endif -#if NO_STDIO_PROTOS /* Missing prototypes for "simple" functions */ -#ifdef EOF -#ifdef __cplusplus -extern "C" { -#endif -int (puts)(char const *); -int (fputs)(char const *, FILE *); -int (fflush)(FILE *); -int (printf)(char const *, ...); -int (fprintf)(FILE *, char const *, ...); -/* If we have a sufficiently old-fashioned stdio, it probably uses these... */ -int (_flsbuf)(int, FILE *); -int (_filbuf)(FILE *); -#ifdef __cplusplus -} -#endif -#endif /* EOF */ -#endif /* NO_STDIO_PROTOS */ - /* * Borland C seems to think that it's a bad idea to decleare a * structure tag and not declare the contents. I happen to think diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c index c28e9f2fc0..0b8d52e021 100644 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c +++ b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c @@ -84,9 +84,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -99,9 +96,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "lbn.h" #include "lbn16.h" diff --git a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c index a25844c4c7..70094d5f31 100644 --- a/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c +++ b/libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c @@ -31,9 +31,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_STDLIB_H #include /* For malloc() & co. */ @@ -48,9 +45,6 @@ void free(); #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #ifndef DBMALLOC #define DBMALLOC 0 diff --git a/libs/libzrtp/third_party/bnlib/bn16.c b/libs/libzrtp/third_party/bnlib/bn16.c index c783827b08..d81ac6acaa 100644 --- a/libs/libzrtp/third_party/bnlib/bn16.c +++ b/libs/libzrtp/third_party/bnlib/bn16.c @@ -29,9 +29,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -44,9 +41,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif /* * This was useful during debugging, so it's left in here. diff --git a/libs/libzrtp/third_party/bnlib/bn32.c b/libs/libzrtp/third_party/bnlib/bn32.c index d7fd51ea2e..d9daca0c97 100644 --- a/libs/libzrtp/third_party/bnlib/bn32.c +++ b/libs/libzrtp/third_party/bnlib/bn32.c @@ -29,9 +29,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -44,9 +41,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif /* * This was useful during debugging, so it's left in here. diff --git a/libs/libzrtp/third_party/bnlib/bn64.c b/libs/libzrtp/third_party/bnlib/bn64.c index 2c98b4b07d..841a277a48 100644 --- a/libs/libzrtp/third_party/bnlib/bn64.c +++ b/libs/libzrtp/third_party/bnlib/bn64.c @@ -29,9 +29,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -44,9 +41,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif /* * This was useful during debugging, so it's left in here. diff --git a/libs/libzrtp/third_party/bnlib/bnconfig.hin b/libs/libzrtp/third_party/bnlib/bnconfig.hin index c526b8e359..1b5e5986f9 100644 --- a/libs/libzrtp/third_party/bnlib/bnconfig.hin +++ b/libs/libzrtp/third_party/bnlib/bnconfig.hin @@ -29,7 +29,6 @@ #define NO_STRING_H !HAVE_STRING_H #define HAVE_STRINGS_H 0 -#define NEED_MEMORY_H 0 /* We go to some trouble to find accurate times... */ @@ -53,20 +52,6 @@ /* Defines for various kinds of library brokenness */ -/* Define if is missing prototypes (= lots of warnings!) */ -#define NO_STDIO_PROTOS 0 - -/* Define if depends on and breaks without it */ -#define ASSERT_NEEDS_STDIO 0 -/* Define if depends on and complains without it */ -#define ASSERT_NEEDS_STDLIB 0 - -/* - * Define if delcares the mem* functions to take char * - * instead of void * parameters (= lots of warnings) - */ -#define MEM_PROTOS_BROKEN 0 - /* If not available, bcopy() is substituted */ #define HAVE_MEMMOVE 0 #define NO_MEMMOVE !HAVE_MEMMOVE diff --git a/libs/libzrtp/third_party/bnlib/bnconfig.win b/libs/libzrtp/third_party/bnlib/bnconfig.win index 303a25b689..2e36938835 100644 --- a/libs/libzrtp/third_party/bnlib/bnconfig.win +++ b/libs/libzrtp/third_party/bnlib/bnconfig.win @@ -29,7 +29,6 @@ #define NO_STRING_H !HAVE_STRING_H #define HAVE_STRINGS_H 0 -#define NEED_MEMORY_H 0 /* We go to some trouble to find accurate times... */ @@ -53,20 +52,6 @@ /* Defines for various kinds of library brokenness */ -/* Define if is missing prototypes (= lots of warnings!) */ -#define NO_STDIO_PROTOS 0 - -/* Define if depends on and breaks without it */ -#define ASSERT_NEEDS_STDIO 0 -/* Define if depends on and complains without it */ -#define ASSERT_NEEDS_STDLIB 0 - -/* - * Define if delcares the mem* functions to take char * - * instead of void * parameters (= lots of warnings) - */ -#define MEM_PROTOS_BROKEN 0 - /* If not available, bcopy() is substituted */ #define HAVE_MEMMOVE 1 #define NO_MEMMOVE !HAVE_MEMMOVE diff --git a/libs/libzrtp/third_party/bnlib/bntest16.c b/libs/libzrtp/third_party/bnlib/bntest16.c index 9068f0fbb9..19ccbd0ac9 100644 --- a/libs/libzrtp/third_party/bnlib/bntest16.c +++ b/libs/libzrtp/third_party/bnlib/bntest16.c @@ -38,9 +38,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #include @@ -55,9 +52,6 @@ long strtol(const char *, char **, int); #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "lbn16.h" #include "kludge.h" diff --git a/libs/libzrtp/third_party/bnlib/bntest32.c b/libs/libzrtp/third_party/bnlib/bntest32.c index 987dc77f34..6cc9ff27c5 100644 --- a/libs/libzrtp/third_party/bnlib/bntest32.c +++ b/libs/libzrtp/third_party/bnlib/bntest32.c @@ -38,9 +38,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #include @@ -55,9 +52,6 @@ long strtol(const char *, char **, int); #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "lbn32.h" #include "kludge.h" diff --git a/libs/libzrtp/third_party/bnlib/bntest64.c b/libs/libzrtp/third_party/bnlib/bntest64.c index 01fda81891..dbc4fd6c0d 100644 --- a/libs/libzrtp/third_party/bnlib/bntest64.c +++ b/libs/libzrtp/third_party/bnlib/bntest64.c @@ -38,9 +38,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #include @@ -55,9 +52,6 @@ long strtol(const char *, char **, int); #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "lbn64.h" #include "kludge.h" diff --git a/libs/libzrtp/third_party/bnlib/configure.in b/libs/libzrtp/third_party/bnlib/configure.in index 917762ec4e..0520be70a4 100644 --- a/libs/libzrtp/third_party/bnlib/configure.in +++ b/libs/libzrtp/third_party/bnlib/configure.in @@ -219,64 +219,9 @@ else # If non-ANSI, check for other brokenness. AC_CHECK_HEADERS(assert.h limits.h stdlib.h string.h) -# Do we want to include memory.h? -if test $ac_cv_header_string_h = no; then -AC_CHECK_HEADERS(strings.h) -ac_found=no -else -AC_MSG_CHECKING(whether string.h declares mem functions) -AC_EGREP_HEADER(memset, string.h, ac_found=yes, ac_found=no) -AC_MSG_RESULT($ac_found) -fi -# ac_found is now "yes" if string.h exists and declares the mem* -# functions. If not, see if memory.h exists and include that -# as well. -if test $ac_found = no; then -AC_CHECK_HEADER(memory,h. [AC_DEFINE(NEED_MEMORY_H)]) -fi - -AC_CACHE_CHECK(whether provides prototypes, -bn_cv_header_stdio_protos, -[AC_EGREP_HEADER(printf, stdio.h, bn_cv_header_stdio_protos=yes, bn_cv_header_stdio_protos=no) -]) -if test $bn_cv_header_stdio_protos = no; then - AC_DEFINE(NO_STDIO_PROTOS) -fi - fi # ^^ End of non-ANSI header brokenness tests (first part) -AC_CACHE_CHECK(whether declares mem* wrong., -bn_cv_header_mem_broken, -[AC_EGREP_HEADER(memcpy.*char, string.h, bn_cv_header_mem_broken=yes, bn_cv_header_mem_broken=no) -]) -if test $bn_cv_header_mem_broken = yes; then - AC_DEFINE(MEM_PROTOS_BROKEN) -fi - -# SunOS 4.1.x acc's is broken -AC_CACHE_CHECK(whether is broken and needs , -bn_cv_header_assert_needs_stdio, -[AC_EGREP_CPP(stderr, -[#include -assert(foo) -], bn_cv_header_assert_needs_stdio=yes, bn_cv_header_assert_needs_stdio=no) -]) -if test $bn_cv_header_assert_needs_stdio = yes; then - AC_DEFINE(ASSERT_NEEDS_STDIO) -fi - -AC_CACHE_CHECK(whether is broken and needs , -bn_cv_header_assert_needs_stdlib, -[AC_EGREP_CPP(exit, -[#include -assert(foo) -], bn_cv_header_assert_needs_stdlib=yes, bn_cv_header_assert_needs_stdlib=no) -]) -if test $bn_cv_header_assert_needs_stdlib = yes; then - AC_DEFINE(ASSERT_NEEDS_STDLIB) -fi - # Check that we have explicitly. AC_CHECK_HEADERS(sys/time.h) AC_HEADER_TIME diff --git a/libs/libzrtp/third_party/bnlib/germtest.c b/libs/libzrtp/third_party/bnlib/germtest.c index 71873a1a22..826de77174 100644 --- a/libs/libzrtp/third_party/bnlib/germtest.c +++ b/libs/libzrtp/third_party/bnlib/germtest.c @@ -22,9 +22,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include /* For malloc() */ diff --git a/libs/libzrtp/third_party/bnlib/kludge.h b/libs/libzrtp/third_party/bnlib/kludge.h index 184a24eef5..3d84a1f346 100644 --- a/libs/libzrtp/third_party/bnlib/kludge.h +++ b/libs/libzrtp/third_party/bnlib/kludge.h @@ -15,28 +15,10 @@ * Some compilers complain about #if FOO if FOO isn't defined, * so do the ANSI-mandated thing explicitly... */ -#ifndef ASSERT_NEEDS_STDIO -#define ASSERT_NEEDS_STDIO 0 -#endif -#ifndef ASSERT_NEEDS_STDLIB -#define ASSERT_NEEDS_STDLIB 0 -#endif #ifndef NO_STDLIB_H #define NO_STDLIB_H 0 #endif -/* SunOS 4.1.x needs "stderr" defined, and "exit" declared... */ -#ifdef assert -#if ASSERT_NEEDS_STDIO -#include -#endif -#if ASSERT_NEEDS_STDLIB -#if !NO_STDLIB_H -#include -#endif -#endif -#endif - #ifndef NO_MEMMOVE #define NO_MEMMOVE 0 #endif @@ -51,43 +33,6 @@ #define memcpy(dest,src,len) bcopy(src,dest,len) #endif -#ifndef MEM_PROTOS_BROKEN -#define MEM_PROTOS_BROKEN 0 -#endif -#if MEM_PROTOS_BROKEN -#define memcpy(d,s,l) memcpy((void *)(d), (void const *)(s), l) -#define memmove(d,s,l) memmove((void *)(d), (void const *)(s), l) -#define memcmp(d,s,l) memcmp((void const *)(d), (void const *)(s), l) -#define memset(d,v,l) memset((void *)(d), v, l) -#endif - -/* - * If there are no prototypes for the stdio functions, use these to - * reduce compiler warnings. Uses EOF as a giveaway to indicate - * that was #included. - */ -#ifndef NO_STDIO_PROTOS -#define NO_STDIO_PROTOS 0 -#endif -#if NO_STDIO_PROTOS /* Missing prototypes for "simple" functions */ -#ifdef EOF -#ifdef __cplusplus -extern "C" { -#endif -int (puts)(char const *); -int (fputs)(char const *, FILE *); -int (fflush)(FILE *); -int (printf)(char const *, ...); -int (fprintf)(FILE *, char const *, ...); -/* If we have a sufficiently old-fashioned stdio, it probably uses these... */ -int (_flsbuf)(int, FILE *); -int (_filbuf)(FILE *); -#ifdef __cplusplus -} -#endif -#endif /* EOF */ -#endif /* NO_STDIO_PROTOS */ - /* * Borland C seems to think that it's a bad idea to decleare a * structure tag and not declare the contents. I happen to think diff --git a/libs/libzrtp/third_party/bnlib/lbn16.c b/libs/libzrtp/third_party/bnlib/lbn16.c index 36c98b8e73..6e00a020e8 100644 --- a/libs/libzrtp/third_party/bnlib/lbn16.c +++ b/libs/libzrtp/third_party/bnlib/lbn16.c @@ -85,9 +85,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -100,9 +97,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "lbn.h" #include "lbn16.h" diff --git a/libs/libzrtp/third_party/bnlib/lbn32.c b/libs/libzrtp/third_party/bnlib/lbn32.c index 6d3cd35454..996cccdc61 100644 --- a/libs/libzrtp/third_party/bnlib/lbn32.c +++ b/libs/libzrtp/third_party/bnlib/lbn32.c @@ -85,9 +85,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -100,9 +97,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "lbn.h" #include "lbn32.h" diff --git a/libs/libzrtp/third_party/bnlib/lbn64.c b/libs/libzrtp/third_party/bnlib/lbn64.c index 3eb3cee596..c0f659ee3c 100644 --- a/libs/libzrtp/third_party/bnlib/lbn64.c +++ b/libs/libzrtp/third_party/bnlib/lbn64.c @@ -85,9 +85,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -100,9 +97,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "lbn.h" #include "lbn64.h" diff --git a/libs/libzrtp/third_party/bnlib/lbnmem.c b/libs/libzrtp/third_party/bnlib/lbnmem.c index a2194c09ae..06ab8a2ce5 100644 --- a/libs/libzrtp/third_party/bnlib/lbnmem.c +++ b/libs/libzrtp/third_party/bnlib/lbnmem.c @@ -32,9 +32,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_STDLIB_H #include /* For malloc() & co. */ @@ -49,9 +46,6 @@ void free(); #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #ifndef DBMALLOC #define DBMALLOC 0 diff --git a/libs/libzrtp/third_party/bnlib/sieve.c b/libs/libzrtp/third_party/bnlib/sieve.c index 033cb117df..697e62652f 100644 --- a/libs/libzrtp/third_party/bnlib/sieve.c +++ b/libs/libzrtp/third_party/bnlib/sieve.c @@ -108,9 +108,6 @@ #ifndef HAVE_STRINGS_H #define HAVE_STRINGS_H 0 #endif -#ifndef NEED_MEMORY_H -#define NEED_MEMORY_H 0 -#endif #if !NO_ASSERT_H #include @@ -127,9 +124,6 @@ #elif HAVE_STRINGS_H #include #endif -#if NEED_MEMORY_H -#include -#endif #include "bn.h" #include "sieve.h" diff --git a/libs/libzrtp/third_party/bnlib/test/kludge.h b/libs/libzrtp/third_party/bnlib/test/kludge.h index 779e5aa1fe..695db0b653 100644 --- a/libs/libzrtp/third_party/bnlib/test/kludge.h +++ b/libs/libzrtp/third_party/bnlib/test/kludge.h @@ -24,40 +24,6 @@ #define raise(sig) kill(getpid(),sig) #endif -/* - * If there are no prototypes for the stdio functions, to reduce - * compiler warnings include these... conditional on EOF being - * defined (a giveaway that was #included). - */ -#if defined(EOF) - -#if NO_STDIO_PROTOS /* Missing prototypes for "simple" functions */ -int (puts)(char const *); -int (fputs)(char const *, FILE *); -void (rewind)(FILE *); -int (fflush)(FILE *); -int (fclose)(FILE *); -int (printf)(char const *, ...); -int (fprintf)(FILE *, char const *, ...); -int (fseek)(FILE *, long, int); -int (remove)(char const *); -int (rename)(char const *, char const *); -void (perror)(char const *); -int (system)(char const *); /* Really in , but this'll do... */ -int (pclose)(FILE *); -/* If we have a sufficiently old-fashioned stdio, it probably uses these... */ -int (_flsbuf)(int, FILE *); -int (_filbuf)(FILE *); -int (ungetc)(int, FILE *); -size_t (fread)(char *, size_t, size_t, FILE *); -size_t (fwrite)(char const *, size_t, size_t, FILE *); -#if defined(va_start) || defined(va_arg) || defined(va_end) -int (vfprintf)(FILE *, char const *, ...); -#endif -#endif /* NO_STDIO_PROTOS */ - -#endif /* EOF */ - /* * Make Microsoft Visual C shut the hell up about a few things... * Warning 4116 complains about the alignof() macro, saying: From 3b2df07f3e62959db14b7e2a9fe6ab3f1bb02b8f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 23 Jun 2012 00:21:12 +0000 Subject: [PATCH 0564/1057] Fix bnlib call to AC_INIT --- libs/libzrtp/third_party/bnlib/configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libzrtp/third_party/bnlib/configure.in b/libs/libzrtp/third_party/bnlib/configure.in index 0520be70a4..a51e304359 100644 --- a/libs/libzrtp/third_party/bnlib/configure.in +++ b/libs/libzrtp/third_party/bnlib/configure.in @@ -7,7 +7,7 @@ dnl Anything which is not an m4 macro is copied directly to the output. dnl dnl Start things up. If the specified file doesn't exist, configure dnl will complain. -AC_INIT(lbn16.c) +AC_INIT([libbn], [0.1]) dnl The following tests need to know that we intend to produce a config.h dnl file, even though this won't expand to any shell script code until From b8109bde58d38cdb5e3d8bf57fdd734c31119981 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 23 Jun 2012 00:30:41 +0000 Subject: [PATCH 0565/1057] Bootstrap bnlib without warnings or errors --- libs/libzrtp/projects/gnu/bootstrap.sh | 2 +- libs/libzrtp/third_party/bnlib/bootstrap.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 libs/libzrtp/third_party/bnlib/bootstrap.sh diff --git a/libs/libzrtp/projects/gnu/bootstrap.sh b/libs/libzrtp/projects/gnu/bootstrap.sh index df9bb21e30..1559388ad1 100755 --- a/libs/libzrtp/projects/gnu/bootstrap.sh +++ b/libs/libzrtp/projects/gnu/bootstrap.sh @@ -9,6 +9,6 @@ reconf () { automake --no-force --add-missing --copy } -(cd ../../third_party/bnlib && reconf) +(cd ../../third_party/bnlib && ./bootstrap.sh) reconf diff --git a/libs/libzrtp/third_party/bnlib/bootstrap.sh b/libs/libzrtp/third_party/bnlib/bootstrap.sh new file mode 100755 index 0000000000..93030be3f6 --- /dev/null +++ b/libs/libzrtp/third_party/bnlib/bootstrap.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +aclocal +autoconf + From 5fd025eb6653789a44f3e478698783119ee92827 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 23 Jun 2012 03:44:38 +0000 Subject: [PATCH 0566/1057] Update AUTHORS --- libs/libzrtp/AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/libzrtp/AUTHORS b/libs/libzrtp/AUTHORS index 471f0148b3..6a435669c0 100644 --- a/libs/libzrtp/AUTHORS +++ b/libs/libzrtp/AUTHORS @@ -23,6 +23,7 @@ Thanks to: Colin Plumb Sagar Pai Werner Dittmann + Travis Cross L. Amber Wilcox-O'Hearn Ariel Boston Donovan Preston From 9b79922a51d2e5eca0d2ce2ddab38f53bfc2c4b5 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 22 Jun 2012 23:16:37 +0000 Subject: [PATCH 0567/1057] Retry updating base image If updating the base image fails, retry a few times. If that doesn't work, simply move on; the update usually fails because Debian is updating its mirrors; it's not important that we be absolutely up to date. --- debian/util.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 7c33056a93..b270dbd2f8 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -282,7 +282,10 @@ build_debs () { cow --create fi announce "Updating base $distro-$arch image..." - cow --update + local x=5 + while ! cow --update; do + [ $x -lt 1 ] && break; sleep 60; x=$((x-1)) + done announce "Building $distro-$arch DEBs from $dsc..." if $debug_hook; then mkdir -p .hooks From a97ec71902761b41c8099e339a4dc05a5dedb48e Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 25 Jun 2012 10:06:41 -0500 Subject: [PATCH 0568/1057] fix warnings on windows code verification --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 05dd7ef0c5..c76eb2b41b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -590,7 +590,7 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice) packet = switch_stun_packet_build_header(SWITCH_STUN_BINDING_REQUEST, NULL, buf); switch_stun_packet_attribute_add_username(packet, ice->ice_user, 32); if (ice->pass) { - switch_stun_packet_attribute_add_password(packet, ice->pass, strlen(ice->pass)); + switch_stun_packet_attribute_add_password(packet, ice->pass, (uint16_t)strlen(ice->pass)); } bytes = switch_stun_packet_length(packet); @@ -992,7 +992,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) rb->dlsr = 0; rtcp_bytes += sizeof(struct switch_rtcp_report_block); - rtp_session->rtcp_send_msg.header.length = htons((rtcp_bytes / 4) - 1); + rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); #ifdef ENABLE_SRTP From 690cae5de177480853a7d310e95b7052339b7b25 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 25 Jun 2012 11:00:48 -0500 Subject: [PATCH 0569/1057] FS-4350 --resolve --- src/mod/languages/mod_spidermonkey/mod_spidermonkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index e17c590a71..83e723e061 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -2383,7 +2383,7 @@ static JSBool session_hangup(JSContext * cx, JSObject * obj, uintN argc, jsval * if (switch_channel_up(channel)) { jsval ret = JS_TRUE; - if (argc > 1) { + if (argc > 0) { if (JSVAL_IS_INT(argv[0])) { int32 i = 0; JS_ValueToInt32(cx, argv[0], &i); From 7dc9a9cacc5366fb04748a89aa7556da8d68e57c Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 25 Jun 2012 15:31:58 -0500 Subject: [PATCH 0570/1057] FS-3085 --resolve --- conf/vanilla/autoload_configs/enum.conf.xml | 9 ++- src/mod/applications/mod_enum/mod_enum.c | 84 +++++++++++++++++---- 2 files changed, 78 insertions(+), 15 deletions(-) diff --git a/conf/vanilla/autoload_configs/enum.conf.xml b/conf/vanilla/autoload_configs/enum.conf.xml index 0304d0dacd..6cd198050b 100644 --- a/conf/vanilla/autoload_configs/enum.conf.xml +++ b/conf/vanilla/autoload_configs/enum.conf.xml @@ -2,8 +2,15 @@ - + + + + + + + + diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index c0cf904da2..0abd27b601 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -24,6 +24,7 @@ * Contributor(s): * * Anthony Minessale II + * Jay Binks * * mod_enum.c -- ENUM * @@ -35,6 +36,8 @@ #endif #include +#define ENUM_MAXNAMESERVERS 10 /* max nameservers that will be used */ + SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown); SWITCH_MODULE_DEFINITION(mod_enum, mod_enum_load, mod_enum_shutdown, NULL); @@ -72,6 +75,7 @@ static struct { int timeout; int retries; int random; + char *nameserver[ENUM_MAXNAMESERVERS]; } globals; SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_root, globals.root); @@ -102,6 +106,7 @@ static void add_route(char *service, char *regex, char *replace) static switch_status_t load_config(void) { char *cf = "enum.conf"; + int inameserver = 0; switch_xml_t cfg, xml = NULL, param, settings, route, routes; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -135,6 +140,11 @@ static switch_status_t load_config(void) globals.random = switch_true(val); } else if (!strcasecmp(var, "default-isn-root")) { set_global_isn_root(val); + } else if (!strcasecmp(var, "nameserver")) { + if ( inameserver < ENUM_MAXNAMESERVERS ) { + globals.nameserver[inameserver] = (char *) val; + inameserver++; + } } else if (!strcasecmp(var, "log-level-trace")) { } @@ -442,8 +452,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t return; } - -switch_status_t ldns_lookup(const char *number, const char *root, const char *server_name, enum_record_t **results) +switch_status_t ldns_lookup(const char *number, const char *root, char *server_name[ENUM_MAXNAMESERVERS] , enum_record_t **results) { ldns_resolver *res = NULL; ldns_rdf *domain = NULL; @@ -454,6 +463,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se switch_status_t status = SWITCH_STATUS_FALSE; char *name = NULL; struct timeval to = { 0, 0}; + int inameserver = 0; if (!(name = reverse_number(number, root))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n"); @@ -464,14 +474,20 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se goto end; } - if (!zstr(server_name)) { + if (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); + for(inameserver=0; inameserverdestination_number); - if (enum_lookup(dp, caller_profile->destination_number, &results) == SWITCH_STATUS_SUCCESS) { + if (enum_lookup(dp, caller_profile->destination_number, &results, channel, session) == SWITCH_STATUS_SUCCESS) { if ((extension = switch_caller_extension_new(session, caller_profile->destination_number, caller_profile->destination_number)) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); free_results(&results); @@ -624,7 +680,7 @@ SWITCH_STANDARD_APP(enum_app_function) if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { dest = argv[0]; root = argv[1]; - if (enum_lookup(root, dest, &results) == SWITCH_STATUS_SUCCESS) { + if (enum_lookup(root, dest, &results, channel, session) == SWITCH_STATUS_SUCCESS) { switch_event_t *vars; if (switch_channel_get_variables(channel, &vars) == SWITCH_STATUS_SUCCESS) { @@ -692,7 +748,7 @@ SWITCH_STANDARD_API(enum_api) dest = argv[0]; root = argv[1]; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Looking up %s@%s\n", dest, root); - if (enum_lookup(root, dest, &results) == SWITCH_STATUS_SUCCESS) { + if (enum_lookup(root, dest, &results, NULL, session) == SWITCH_STATUS_SUCCESS) { for (rp = results; rp; rp = rp->next) { if (!rp->supported) { continue; @@ -770,7 +826,7 @@ SWITCH_STANDARD_API(enum_function) } - if (!enum_lookup(root, dest, &results) == SWITCH_STATUS_SUCCESS) { + if (!enum_lookup(root, dest, &results, NULL, session) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "No Match!\n"); return SWITCH_STATUS_SUCCESS; } From e7f05b49adebc220a8ab52aa86110ca5c2305f01 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 26 Jun 2012 09:58:51 -0500 Subject: [PATCH 0571/1057] FS-4349 try this, it should be a minimal wait since this will poll the socket for 20ms only when there are no events at all and no log data at all --- .../mod_event_socket/mod_event_socket.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 c2862d8ab2..a7b62dfd63 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 @@ -96,6 +96,7 @@ struct listener { switch_event_t *filters; time_t linger_timeout; struct listener *next; + switch_pollfd_t *pollfd; }; typedef struct listener listener_t; @@ -475,6 +476,8 @@ SWITCH_STANDARD_APP(socket_function) listener->session = session; switch_set_flag(listener, LFLAG_ALLOW_LOG); + switch_socket_create_pollset(&listener->pollfd, listener->sock, SWITCH_POLLIN | SWITCH_POLLERR, listener->pool); + switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool); switch_mutex_init(&listener->filter_mutex, SWITCH_MUTEX_NESTED, listener->pool); @@ -833,6 +836,7 @@ SWITCH_STANDARD_API(event_sink_function) switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool); switch_mutex_init(&listener->filter_mutex, SWITCH_MUTEX_NESTED, listener->pool); + switch_core_hash_init(&listener->event_hash, listener->pool); switch_set_flag(listener, LFLAG_AUTHED); switch_set_flag(listener, LFLAG_STATEFUL); @@ -1381,7 +1385,10 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, } if (do_sleep) { - switch_cond_next(); + int fdr = 0; + switch_poll(listener->pollfd, 1, &fdr, 20000); + } else { + switch_os_yield(); } } @@ -2850,6 +2857,9 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime) switch_mutex_init(&listener->filter_mutex, SWITCH_MUTEX_NESTED, listener->pool); switch_core_hash_init(&listener->event_hash, listener->pool); + switch_socket_create_pollset(&listener->pollfd, listener->sock, SWITCH_POLLIN | SWITCH_POLLERR, listener->pool); + + if (switch_socket_addr_get(&listener->sa, SWITCH_TRUE, listener->sock) == SWITCH_STATUS_SUCCESS && listener->sa) { switch_get_addr(listener->remote_ip, sizeof(listener->remote_ip), listener->sa); From 60bb3595fdae8010bf770acdd22300c4bcb927fd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 26 Jun 2012 11:34:24 -0500 Subject: [PATCH 0572/1057] FS-4313 --resolve --- src/switch_channel.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 94c9a35cfe..c214cfd881 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3879,7 +3879,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * 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_last_hold, tt_hold_accum, 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; + mtt_hungup = 0, tt_prof_created, mtt_progress = 0, mtt_progress_media = 0; void *pop; char dtstr[SWITCH_DTMF_LOG_LEN + 1] = ""; int x = 0; @@ -3992,7 +3992,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_channel_set_variable(channel, "start_uepoch", tmp); tt_prof_created = (time_t) (caller_profile->times->profile_created / 1000000); - mtt_prof_created = (time_t) (caller_profile->times->profile_created / 1000); switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_prof_created); switch_channel_set_variable(channel, "profile_start_epoch", tmp); switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created); @@ -4072,13 +4071,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * billmsec = (int32_t) (mtt_hungup - mtt_answered); billusec = caller_profile->times->hungup - caller_profile->times->answered; - legbillsec = (int32_t) (tt_hungup - tt_prof_created); - legbillmsec = (int32_t) (mtt_hungup - mtt_prof_created); - legbillusec = caller_profile->times->hungup - caller_profile->times->profile_created; + legbillsec = (int32_t) (tt_hungup - tt_created); + legbillmsec = (int32_t) (mtt_hungup - mtt_created); + legbillusec = caller_profile->times->hungup - caller_profile->times->created; - answersec = (int32_t) (tt_answered - tt_prof_created); - answermsec = (int32_t) (mtt_answered - mtt_prof_created); - answerusec = caller_profile->times->answered - caller_profile->times->profile_created; + answersec = (int32_t) (tt_answered - tt_created); + answermsec = (int32_t) (mtt_answered - mtt_created); + answerusec = caller_profile->times->answered - caller_profile->times->created; } if (caller_profile->times->progress) { From 1ae88d51d0160d29012583d5686ca735f3d28e05 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 26 Jun 2012 20:32:28 +0200 Subject: [PATCH 0573/1057] ftmod_libpri: Move service_change_status_t down into #include guard area. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h index b54d0b1dcf..9b2c5d09d2 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h @@ -30,18 +30,17 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -typedef enum { - SERVICE_CHANGE_STATUS_INSERVICE = 0, - SERVICE_CHANGE_STATUS_MAINTENANCE = 1, - SERVICE_CHANGE_STATUS_OUTOFSERVICE = 2 -} service_change_status_t; - #ifndef FTMOD_LIBPRI_H #define FTMOD_LIBPRI_H #include "freetdm.h" #include "lpwrap_pri.h" +typedef enum { + SERVICE_CHANGE_STATUS_INSERVICE = 0, + SERVICE_CHANGE_STATUS_MAINTENANCE, + SERVICE_CHANGE_STATUS_OUTOFSERVICE +} service_change_status_t; + typedef enum { FTMOD_LIBPRI_OPT_NONE = 0, FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL = (1 << 0), From c92a55d3f1b2948a90f39afd312430bf918d513c Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 26 Jun 2012 21:33:40 +0200 Subject: [PATCH 0574/1057] ftmod_libpri: Add MSN/DDI filter for incoming calls. This feature allows ftmod_libpri to ignore calls with non-matching destination number. You may want to use this on BRI PTMP lines (Point-to-MultiPoint), to avoid conflicts between your FreeSWITCH server and other devices connected to the line. The filter is disabled by default (all calls will be accepted), setting one (or more) "local-number" parameters on the span configuration enables it. Example configuration snippet: Signed-off-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 254 +++++++++++++++++- .../src/ftmod/ftmod_libpri/ftmod_libpri.h | 4 + 2 files changed, 250 insertions(+), 8 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index aef0d0ddff..8428437c3c 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -38,6 +38,11 @@ #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #endif + +static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); +static ftdm_io_interface_t ftdm_libpri_interface; + + static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) { assert(chan); @@ -258,8 +263,145 @@ out: return 0; } -static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); -static ftdm_io_interface_t ftdm_libpri_interface; + +/*************************************************************** + * MSN filter + ***************************************************************/ + +static int msn_filter_init(ftdm_libpri_data_t *isdn_data) +{ + if (!isdn_data) + return FTDM_FAIL; + + isdn_data->msn_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); + if (!isdn_data->msn_hash) + return FTDM_FAIL; + + if (ftdm_mutex_create(&isdn_data->msn_mutex)) { + hashtable_destroy(isdn_data->msn_hash); + return FTDM_FAIL; + } + + return FTDM_SUCCESS; +} + +static int msn_filter_destroy(ftdm_libpri_data_t *isdn_data) +{ + if (!isdn_data) + return FTDM_FAIL; + + if (isdn_data->msn_hash) + hashtable_destroy(isdn_data->msn_hash); + if (isdn_data->msn_mutex) + ftdm_mutex_destroy(&isdn_data->msn_mutex); + + return FTDM_SUCCESS; +} + +static int msn_filter_verify(const char *str) +{ + if (ftdm_strlen_zero(str) || strlen(str) >= FTDM_DIGITS_LIMIT) + return FTDM_FALSE; + + if (ftdm_is_number(str) != FTDM_SUCCESS) + return FTDM_FALSE; + + return FTDM_TRUE; +} + +static int msn_filter_add(ftdm_libpri_data_t *isdn_data, const char *msn) +{ + static const int value = 0xdeadbeef; + char *key = NULL; + int ret = FTDM_SUCCESS; + + if (!isdn_data || !msn_filter_verify(msn)) + return FTDM_FAIL; + + ftdm_mutex_lock(isdn_data->msn_mutex); + + /* check for duplicates (ignore if already in set) */ + if (hashtable_search(isdn_data->msn_hash, (void *)msn)) { + ret = FTDM_SUCCESS; + goto out; + } + + /* Copy MSN (transient string), hashtable will free it in hashtable_destroy() */ + key = ftdm_strdup(msn); + if (!key) { + ret = FTDM_FAIL; + goto out; + } + + /* add MSN to list/hash */ + if (!hashtable_insert(isdn_data->msn_hash, (void *)key, (void *)&value, HASHTABLE_FLAG_FREE_KEY)) { + ftdm_safe_free(key); + ret = FTDM_FAIL; + } +out: + ftdm_mutex_unlock(isdn_data->msn_mutex); + return ret; +} + + +/** + * + */ +static int msn_filter_match(ftdm_libpri_data_t *isdn_data, const char *msn) +{ + int ret = FTDM_FALSE; + + if (!isdn_data) + return FTDM_FAIL; + /* No number? return match found */ + if (ftdm_strlen_zero(msn)) + return FTDM_TRUE; + + ftdm_mutex_lock(isdn_data->msn_mutex); + + /* No MSN configured? */ + if (hashtable_count(isdn_data->msn_hash) <= 0) { + ret = FTDM_TRUE; + goto out; + } + /* Search for a matching MSN */ + if (hashtable_search(isdn_data->msn_hash, (void *)msn)) + ret = FTDM_TRUE; +out: + ftdm_mutex_unlock(isdn_data->msn_mutex); + return ret; +} + +static int msn_filter_foreach(ftdm_libpri_data_t *isdn_data, int (* func)(const char *, void *), void *data) +{ + ftdm_hash_iterator_t *iter = NULL; + int ret = FTDM_SUCCESS; + + if (!isdn_data || !func) + return FTDM_FAIL; + + /* iterate over MSNs */ + ftdm_mutex_lock(isdn_data->msn_mutex); + + for (iter = hashtable_first(isdn_data->msn_hash); iter; iter = hashtable_next(iter)) { + const char *msn = NULL; + + hashtable_this(iter, (const void **)&msn, NULL, NULL); + + if (ftdm_strlen_zero(msn)) + break; + if ((ret = func(msn, data)) != FTDM_SUCCESS) + break; + } + + ftdm_mutex_unlock(isdn_data->msn_mutex); + return ret; +} + + +/*************************************************************** + * Module API (CLI) interface + ***************************************************************/ static const char *ftdm_libpri_usage = "Usage:\n" @@ -268,6 +410,7 @@ static const char *ftdm_libpri_usage = "libpri restart \n" "libpri maintenance \n" "libpri debug [all|none|flag,...flagN]\n" + "libpri msn \n" "\n" "Possible debug flags:\n" "\tq921_raw - Q.921 Raw messages\n" @@ -287,6 +430,29 @@ static const char *ftdm_libpri_usage = "\tnone - Disable debugging\n" "\tall - Enable all debug options\n"; + +/** + * Custom data handle for list iterator functions + */ +struct msn_list_cb_private { + ftdm_stream_handle_t *stream; + unsigned int count; +}; + +static int msn_list_cb(const char *msn, void *priv) +{ + struct msn_list_cb_private *data = priv; + ftdm_stream_handle_t *stream = data->stream; + + if (!stream || ftdm_strlen_zero(msn)) + return FTDM_FAIL; + + stream->write_function(stream, "\t%s\n", msn); + data->count++; + return FTDM_SUCCESS; +} + + /** * \brief API function to kill or debug a libpri span * \param stream API stream handler @@ -331,6 +497,40 @@ static FIO_API_FUNCTION(ftdm_libpri_api) goto done; } } + if (!strcasecmp(argv[0], "msn")) { + ftdm_span_t *span = NULL; + struct msn_list_cb_private data; + data.stream = stream; + data.count = 0; + + if (ftdm_span_find_by_name(argv[1], &span) != FTDM_SUCCESS) { + stream->write_function(stream, "%s: -ERR span '%s' not found.\n", + __FILE__, argv[1]); + goto done; + } + if (span->start != ftdm_libpri_start) { + stream->write_function(stream, "%s: -ERR '%s' is not a libpri span.\n", + __FILE__, ftdm_span_get_name(span)); + goto done; + } + + /* header */ + stream->write_function(stream, "------------------------------------------------------------------------------\n"); + + if (msn_filter_foreach(span->signal_data, msn_list_cb, &data)) { + stream->write_function(stream, "-ERR: Failed to list MSN(s)\n"); + goto done; + } + if (data.count == 0) { + stream->write_function(stream, "\t\t\t -- no entries --\n"); + } + + /* footer */ + stream->write_function(stream, "---------------------------------------------------------------[ %02d MSN(s) ]--\n", + data.count); + stream->write_function(stream, "+OK"); + goto done; + } } else if (argc >= 2) { if (!strcasecmp(argv[0], "debug")) { ftdm_span_t *span = NULL; @@ -1309,12 +1509,30 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event { ftdm_span_t *span = spri->span; ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ring.channel); + ftdm_channel_t *chan = NULL; ftdm_caller_data_t *caller_data = NULL; int ret = 0; + if (pevent->ring.channel == -1) { + ftdm_log(FTDM_LOG_ERROR, "-- New call without channel on span '%s' [NOTE: Initial SETUP w/o channel selection is not supported by FreeTDM]\n", + ftdm_span_get_name(span)); + pri_destroycall(spri->pri, pevent->ring.call); + return ret; + } + + chan = ftdm_span_get_channel(span, pevent->ring.channel); if (!chan) { - ftdm_log(FTDM_LOG_ERROR, "-- Unable to get channel %d:%d\n", ftdm_span_get_id(span), pevent->ring.channel); + ftdm_log(FTDM_LOG_ERROR, "-- Unable to get channel %d:%d\n", + ftdm_span_get_id(span), pevent->ring.channel); + pri_hangup(spri->pri, pevent->ring.call, PRI_CAUSE_DESTINATION_OUT_OF_ORDER); + return ret; + } + + /* check MSN filter */ + if (!msn_filter_match(isdn_data, pevent->ring.callednum)) { + ftdm_log(FTDM_LOG_INFO, "-- MSN filter not matching incoming DNIS '%s', ignoring call\n", + pevent->ring.callednum); + pri_destroycall(spri->pri, pevent->ring.call); return ret; } @@ -2216,7 +2434,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) #ifndef HAVE_LIBPRI_BRI ftdm_log(FTDM_LOG_ERROR, "Unsupported trunk type: '%s', libpri too old\n", ftdm_span_get_trunk_type_str(span)); snprintf(span->last_error, sizeof(span->last_error), "Unsupported trunk type [%s], libpri too old", ftdm_span_get_trunk_type_str(span)); - return FTDM_FAIL; + goto error; #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"); @@ -2232,7 +2450,16 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) default: ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_span_get_trunk_type_str(span)); snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type [%s]", ftdm_span_get_trunk_type_str(span)); - return FTDM_FAIL; + goto error; + } + + /* + * Init MSN filter + */ + if (msn_filter_init(isdn_data) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Failed to init MSN filter\n"); + snprintf(span->last_error, sizeof(span->last_error), "Failed to init MSN filter"); + goto error; } for (i = 0; ftdm_parameters[i].var; i++) { @@ -2247,7 +2474,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) if (ftdm_strlen_zero(val)) { ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); snprintf(span->last_error, sizeof(span->last_error), "Parameter [%s] has no value", var); - return FTDM_FAIL; + goto error; } if (!strcasecmp(var, "node") || !strcasecmp(var, "mode")) { @@ -2285,10 +2512,17 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) isdn_data->service_message_support = 1; } } + else if (!strcasecmp(var, "local-number") || !strcasecmp(var, "msn")) { + if (msn_filter_add(isdn_data, val) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Invalid MSN/DDI(s) '%s' specified\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid MSN/DDI(s) '%s' specified!", val); + goto error; + } + } else { ftdm_log(FTDM_LOG_ERROR, "Unknown parameter '%s', aborting configuration\n", var); snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); - return FTDM_FAIL; + goto error; } } @@ -2315,6 +2549,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) } return FTDM_SUCCESS; +error: + msn_filter_destroy(isdn_data); + ftdm_safe_free(isdn_data); + return FTDM_FAIL; } /** diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h index 9b2c5d09d2..260df0fe35 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h @@ -76,6 +76,10 @@ struct ftdm_libpri_data { unsigned int service_message_support; lpwrap_pri_t spri; + + /* MSN filter */ + ftdm_hash_t *msn_hash; + ftdm_mutex_t *msn_mutex; }; typedef struct ftdm_libpri_data ftdm_libpri_data_t; From 909fca199dfb054ec50bf084b7a144fa8cad3e56 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 26 Jun 2012 16:21:26 -0700 Subject: [PATCH 0575/1057] Tweak phrase_en.xml --- docs/phrase/phrase_en.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 322cdf5e02..4e1b6901ba 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -186,7 +186,7 @@ - + @@ -220,7 +220,7 @@ - + From b0f53cd62593db9376cea1de24a96840479b08c7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Jun 2012 09:32:54 -0500 Subject: [PATCH 0576/1057] FS-4353 --resolve this may also fix FS-4079 --- .../applications/mod_dptools/mod_dptools.c | 1 + src/mod/endpoints/mod_sofia/mod_sofia.c | 31 ++++++++++++++++--- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 ++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 12cab2cf66..016bbae2fa 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1239,6 +1239,7 @@ SWITCH_STANDARD_APP(respond_function) msg.from = __FILE__; msg.string_arg = data; msg.message_id = SWITCH_MESSAGE_INDICATE_RESPOND; + msg.numeric_arg = -1; switch_core_session_receive_message(session, &msg); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 35ad2e821f..594266d885 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -534,6 +534,18 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) } } else { char *resp_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); + const char *phrase; + if (tech_pvt->respond_code) { + sip_cause = tech_pvt->respond_code; + } + + if (tech_pvt->respond_phrase) { + phrase = su_strdup(nua_handle_home(tech_pvt->nh), tech_pvt->respond_phrase); + } else { + phrase = sip_status_phrase(sip_cause); + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause); if (!tech_pvt->got_bye) { @@ -548,7 +560,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_FAIL); } - nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), + nua_respond(tech_pvt->nh, sip_cause, phrase, TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), TAG_IF(cid, SIPTAG_HEADER_STR(cid)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), @@ -2356,7 +2368,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi int code = msg->numeric_arg; const char *reason = NULL; - if (code) { + if (code > 0) { reason = msg->string_arg; } else { if (!zstr(msg->string_arg)) { @@ -2490,8 +2502,19 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_ANSWER); } } else { - nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); + if (msg->numeric_arg) { + if (code > 399) { + tech_pvt->respond_code = code; + tech_pvt->respond_phrase = switch_core_session_strdup(tech_pvt->session, reason); + switch_channel_hangup(tech_pvt->channel, sofia_glue_sip_cause_to_freeswitch(code)); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot respond.\n"); + } + } else { + nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), + TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); + } + } switch_safe_free(extra_headers); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index cc4b08c822..79e0bc4285 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -836,6 +836,8 @@ struct private_object { char *local_sdp_video_zrtp_hash; char *remote_sdp_audio_zrtp_hash; char *remote_sdp_video_zrtp_hash; + char *respond_phrase; + int respond_code; }; struct callback_t { From ed0ab36e2df1a88349f4dce807cc3b620e730658 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Jun 2012 12:25:03 -0500 Subject: [PATCH 0577/1057] FS-4353 redirect case --- .../applications/mod_dptools/mod_dptools.c | 1 + src/mod/endpoints/mod_sofia/mod_sofia.c | 43 +++++++++++++------ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 016bbae2fa..c98db6a04b 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1182,6 +1182,7 @@ SWITCH_STANDARD_APP(redirect_function) msg.from = __FILE__; msg.string_arg = data; msg.message_id = SWITCH_MESSAGE_INDICATE_REDIRECT; + msg.numeric_arg = 1; switch_core_session_receive_message(session, &msg); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 594266d885..ce3e9ec1be 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -535,6 +535,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) } else { char *resp_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); const char *phrase; + char *added_headers = NULL; + if (tech_pvt->respond_code) { sip_cause = tech_pvt->respond_code; } @@ -545,6 +547,9 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) phrase = sip_status_phrase(sip_cause); } + if (tech_pvt->respond_dest && !sofia_test_pflag(tech_pvt->profile, PFLAG_MANUAL_REDIRECT)) { + added_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_HEADER_PREFIX); + } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause); @@ -565,6 +570,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) TAG_IF(cid, SIPTAG_HEADER_STR(cid)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_IF(!zstr(resp_headers), SIPTAG_HEADER_STR(resp_headers)), + TAG_IF(!zstr(added_headers), SIPTAG_HEADER_STR(added_headers)), + TAG_IF(tech_pvt->respond_dest, SIPTAG_CONTACT_STR(tech_pvt->respond_dest)), TAG_END()); switch_safe_free(resp_headers); @@ -2263,14 +2270,27 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } break; case SWITCH_MESSAGE_INDICATE_REDIRECT: + if (!zstr(msg->string_arg)) { + + int status = 0; + + if (tech_pvt->nh && tech_pvt->nh->nh_ds && tech_pvt->nh->nh_ds->ds_sr && nua_server_request_is_pending(tech_pvt->nh->nh_ds->ds_sr)) { + status = tech_pvt->nh->nh_ds->ds_sr->sr_status; + } + + if (status == 0 || status > 199 || tech_pvt->nh->nh_destroyed) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot call respond on handle at status %d\n", + switch_channel_get_name(channel), status); + goto end_lock; + } + + if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) { - char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); - char *added_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_HEADER_PREFIX); char *dest = (char *) msg->string_arg; char *argv[128] = { 0 }; char *mydata = NULL, *newdest = NULL; - int argc = 0, ok = 0, i; + int argc = 0, i; switch_size_t len = 0; if (strchr(dest, ',')) { @@ -2306,21 +2326,18 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirecting to %s\n", dest); - ok = sofia_test_pflag(tech_pvt->profile, PFLAG_MANUAL_REDIRECT); - + tech_pvt->respond_dest = dest; + if (argc > 1) { - nua_respond(tech_pvt->nh, SIP_300_MULTIPLE_CHOICES, SIPTAG_CONTACT_STR(dest), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), - TAG_IF((!zstr(added_headers) && !ok), SIPTAG_HEADER_STR(added_headers)), TAG_END()); + tech_pvt->respond_code = 300; + tech_pvt->respond_phrase = "Multiple Choices"; } else { - nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(dest), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), - TAG_IF((!zstr(added_headers) && !ok), SIPTAG_HEADER_STR(added_headers)), TAG_END()); + tech_pvt->respond_code = 302; + tech_pvt->respond_phrase = "Moved Temporarily"; } + switch_channel_hangup(tech_pvt->channel, sofia_glue_sip_cause_to_freeswitch(tech_pvt->respond_code)); - sofia_set_flag_locked(tech_pvt, TFLAG_BYE); - switch_safe_free(extra_headers); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Too late for redirecting, already answered\n"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 79e0bc4285..6ccb9ef0f8 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -838,6 +838,7 @@ struct private_object { char *remote_sdp_video_zrtp_hash; char *respond_phrase; int respond_code; + char *respond_dest; }; struct callback_t { From e9a66618ffff694bc5ba51183200ea505a37a126 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 27 Jun 2012 15:53:15 -0400 Subject: [PATCH 0578/1057] FS-4353: missing free from last commit --- src/mod/endpoints/mod_sofia/mod_sofia.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ce3e9ec1be..2360f92a64 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -576,6 +576,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) switch_safe_free(resp_headers); } + switch_safe_free(added_headers); } } sofia_set_flag_locked(tech_pvt, TFLAG_BYE); From 7978bd892111e4235f93211919bd713c78d87c80 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 27 Jun 2012 20:16:46 +0000 Subject: [PATCH 0579/1057] Don't truncate 5-digit port numbers The adj_port buffer was only 5 bytes wide, so we were truncating any port numbers >= 10000 that were written to this variable as snprintf ensures the last byte is null. FS-4354 --resolve --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c76eb2b41b..33be911b2c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3502,7 +3502,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ const char *tx_host; const char *old_host; char bufa[30], bufb[30]; - char adj_port[5]; + char adj_port[6]; tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr); old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr); From 59f38f13627a796fbe406db673dd4994f9c1a4f0 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Wed, 27 Jun 2012 16:39:01 -0700 Subject: [PATCH 0580/1057] Misspelled filename in phrase_en.xml --- docs/phrase/phrase_en.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 4e1b6901ba..0fd09dd217 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -463,7 +463,7 @@ - + From 8850c1d5e5ff191b0ada50b938efa82a959e264d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Jun 2012 10:10:13 -0500 Subject: [PATCH 0581/1057] moot leak in logger since it only happens on shutdown 1/10 times but hey, lets fix it --- src/switch_log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_log.c b/src/switch_log.c index 1bd931a44e..9799a3698f 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -296,6 +296,7 @@ static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj) } if (!pop) { + THREAD_RUNNING = -1; break; } @@ -558,7 +559,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void) { switch_status_t st; - THREAD_RUNNING = -1; + switch_queue_push(LOG_QUEUE, NULL); while (THREAD_RUNNING) { switch_cond_next(); From 1330ad9cf4d684a6728ea0bc01bb0d2d7f5d0241 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Jun 2012 10:21:08 -0500 Subject: [PATCH 0582/1057] FS-4363 try this --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 8f50fe1257..cac064b544 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1734,7 +1734,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ (long) switch_epoch_time_now(NULL), new_profile->uuid_str, extension, use_context, use_dialplan); switch_channel_add_variable_var_check(channel, SWITCH_TRANSFER_HISTORY_VARIABLE, new_profile->transfer_source, SWITCH_FALSE, SWITCH_STACK_PUSH); - switch_channel_set_variable(channel, SWITCH_TRANSFER_SOURCE_VARIABLE, new_profile->transfer_source); + switch_channel_set_variable_var_check(channel, SWITCH_TRANSFER_SOURCE_VARIABLE, new_profile->transfer_source, SWITCH_FALSE); return SWITCH_STATUS_SUCCESS; } From ed6e7b9fc0fdcd02bed410996f94689e1584e761 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Jun 2012 13:17:52 -0500 Subject: [PATCH 0583/1057] if valid_terminators string starts with = it implies one of them must be typed --- src/switch_ivr_play_say.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 8738071cb4..c483ccfbed 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1879,6 +1879,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, switch_status_t status = SWITCH_STATUS_SUCCESS; size_t len = 0; char tb[2] = ""; + int term_required = 0; + + + if (*valid_terminators == '=') { + term_required = 1; + } switch_assert(session); @@ -1945,6 +1951,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, } } } + } else if (term_required) { + status = SWITCH_STATUS_TOO_SMALL; } len = strlen(digit_buffer); From 848f05fb41182d25e16b70e4b4972461b87f33f3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Jun 2012 14:01:50 -0500 Subject: [PATCH 0584/1057] FS-3659 this fixes sub issue, this should have been a new jira ticket --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 33be911b2c..c8e6ff94cb 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2883,7 +2883,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t #endif #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtcp_recv_msg.header.version == 2) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) { int sbytes = (int) *bytes; err_status_t stat = 0; @@ -3002,7 +3002,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t } #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtcp_recv_msg.header.version == 2) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) { int sbytes = (int) *bytes; err_status_t stat = 0; From dca6e2bb8ed814adc346a488a09bfb8f06f2abb0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Jun 2012 12:12:38 -0500 Subject: [PATCH 0585/1057] FS-4359 --resolve --- src/switch_ivr_originate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 72d0ab0393..6d3ad966ec 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2331,7 +2331,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess q = !q; } - if (end && p < end && *p == ',') { + if (end && p < end && *p == ',' && *(p-1) != '\\') { if (q || alt) { *p = QUOTED_ESC_COMMA; From 7ec8fb43d46e16ce57e3ab271a440a90987a35e1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 29 Jun 2012 11:39:49 -0500 Subject: [PATCH 0586/1057] add initial-event-threads to switch.conf.xml --- src/include/switch_event.h | 1 + src/switch_core.c | 19 ++++++++++++++++++- src/switch_event.c | 15 +++++++++------ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 5909c0e0c0..d0474a6929 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -403,6 +403,7 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event); SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map); SWITCH_DECLARE(int) switch_event_check_permission_list(switch_event_t *list, const char *name); SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix); +SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max); ///\} diff --git a/src/switch_core.c b/src/switch_core.c index d706563f83..2a4cae408f 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1538,7 +1538,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_log_init(runtime.memory_pool, runtime.colorize_console); if (flags & SCF_MINIMAL) return SWITCH_STATUS_SUCCESS; - + runtime.tipping_point = 0; runtime.timer_affinity = -1; runtime.microseconds_per_tick = 20000; @@ -1813,6 +1813,23 @@ static void switch_load_core_config(const char *file) switch_core_min_idle_cpu(atof(val)); } else if (!strcasecmp(var, "tipping-point") && !zstr(val)) { runtime.tipping_point = atoi(val); + } else if (!strcasecmp(var, "initial-event-threads") && !zstr(val)) { + int tmp = atoi(val); + + + if (tmp > runtime.cpu_count / 2) { + tmp = runtime.cpu_count / 2; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "This value cannot be higher than %d so setting it to that value\n", + runtime.cpu_count / 2); + } + + if (tmp < 1) { + tmp = 1; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "This value cannot be lower than 1 so setting it to that level\n"); + } + + switch_event_launch_dispatch_threads(tmp); + } else if (!strcasecmp(var, "1ms-timer") && switch_true(val)) { runtime.microseconds_per_tick = 1000; } else if (!strcasecmp(var, "timer-affinity") && !zstr(val)) { diff --git a/src/switch_event.c b/src/switch_event.c index defae3586c..0f08b496c0 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -34,6 +34,7 @@ #include #include + //#define SWITCH_EVENT_RECYCLE #define DISPATCH_QUEUE_LEN 100 //#define DEBUG_DISPATCH_QUEUES @@ -87,7 +88,6 @@ static uint64_t EVENT_SEQUENCE_NR = 0; static switch_queue_t *EVENT_RECYCLE_QUEUE = NULL; static switch_queue_t *EVENT_HEADER_RECYCLE_QUEUE = NULL; #endif -static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool); static char *my_dup(const char *s) { @@ -305,7 +305,7 @@ static switch_status_t switch_event_queue_dispatch_event(switch_event_t **eventp if (launch) { if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) { - launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, RUNTIME_POOL); + switch_event_launch_dispatch_threads(SOFT_MAX_DISPATCH + 1); } } @@ -515,13 +515,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) return SWITCH_STATUS_SUCCESS; } -static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool) +SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max) { switch_threadattr_t *thd_attr; uint32_t index = 0; int launched = 0; uint32_t sanity = 200; + switch_memory_pool_t *pool = RUNTIME_POOL; + if (max > MAX_DISPATCH) { return; } @@ -532,6 +534,7 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool) for (index = SOFT_MAX_DISPATCH; index < max && index < MAX_DISPATCH; index++) { if (EVENT_DISPATCH_QUEUE_THREADS[index]) { + printf("Index exists continue\n"); continue; } @@ -540,13 +543,13 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool) switch_threadattr_priority_increase(thd_attr); switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE, pool); while(--sanity && !EVENT_DISPATCH_QUEUE_RUNNING[index]) switch_yield(10000); + if (index == 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create event dispatch thread %d\n", index); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create additional event dispatch thread %d\n", index); } launched++; - break; } SOFT_MAX_DISPATCH = index; @@ -598,7 +601,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) //switch_threadattr_priority_increase(thd_attr); switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, pool); - launch_dispatch_threads(1, RUNTIME_POOL); + switch_event_launch_dispatch_threads(1); //switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL); //switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL); From 13068f178313bb47661729dc6e97bbd9d7cd5dc1 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 29 Jun 2012 16:14:46 -0500 Subject: [PATCH 0587/1057] allow silence for moh type on campon --- src/mod/applications/mod_dptools/mod_dptools.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index c98db6a04b..344544f705 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2869,6 +2869,10 @@ SWITCH_STANDARD_APP(audio_bridge_function) moh = switch_channel_get_variable(caller_channel, "campon_hold_music"); } + if (!zstr(moh) && !strcasecmp(moh, "silence")) { + moh = NULL; + } + do { fail = 0; From 5f09b403811c31b0038639b50f1a1cab4ba97ff0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 29 Jun 2012 14:41:02 -0500 Subject: [PATCH 0588/1057] add sip_recovery_break_rfc variable to set globally or per channel to not reverse the from and 2 on uas re-invites --- src/mod/endpoints/mod_sofia/sofia_glue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index b08d7efc17..68763cd452 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5764,6 +5764,8 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_to")); } else { + int break_rfc = switch_true(switch_channel_get_variable(channel, "sip_recovery_break_rfc")); + tech_pvt->redirected = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_contact_uri")); if (zstr(rr)) { @@ -5776,11 +5778,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri")); if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE, -1)) { - switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_to")); + switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, break_rfc ? "sip_full_from" : "sip_full_to")); } if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE, -1)) { - switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_from")); + switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, break_rfc ? "sip_full_to" : "sip_full_from")); } } From 5c259f26d2be44aa868f5d8b48f2439d898acec5 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Mon, 2 Jul 2012 21:31:04 +0800 Subject: [PATCH 0589/1057] Various little tweaks to spandsp to stop warnings with newer compilers Various little tweaks to spandsp to bring it into line with the master versions Addition of Ademco Contact ID protocol processing to spandsp --- libs/spandsp/Makefile.am | 2 + libs/spandsp/configure.ac | 221 ++-- libs/spandsp/doc/doxygen.in | 14 +- .../spandsp/{config => m4}/ax_c99_features.m4 | 0 .../ax_check_export_capability.m4 | 0 .../{config => m4}/ax_check_real_file.m4 | 0 .../{config => m4}/ax_compiler_vendor.m4 | 0 .../{config => m4}/ax_fixed_point_machine.m4 | 0 .../ax_misaligned_access_fails.m4 | 0 libs/spandsp/spandsp.pc.in | 5 +- libs/spandsp/spandsp.spec | 60 +- libs/spandsp/spandsp.spec.in | 60 +- libs/spandsp/src/Makefile.am | 7 +- libs/spandsp/src/ademco_contactid.c | 1062 +++++++++++++++++ libs/spandsp/src/sig_tone.c | 4 +- libs/spandsp/src/spandsp.h.in | 11 +- libs/spandsp/src/spandsp/ademco_contactid.h | 365 ++++++ libs/spandsp/src/spandsp/expose.h | 1 + .../src/spandsp/private/ademco_contactid.h | 95 ++ libs/spandsp/src/t30.c | 4 +- libs/spandsp/src/t38_gateway.c | 38 +- libs/spandsp/src/t38_terminal.c | 29 +- libs/spandsp/src/timezone.c | 14 +- libs/spandsp/src/v18.c | 2 + libs/spandsp/src/v8.c | 7 +- libs/spandsp/tests/Makefile.am | 6 +- libs/spandsp/tests/ademco_contactid_tests.c | 391 ++++++ libs/spandsp/tests/echo_tests.c | 12 +- libs/spandsp/tests/fax_decode.c | 28 +- libs/spandsp/tests/fax_tester.c | 3 - libs/spandsp/tests/fax_tests.sh | 4 +- libs/spandsp/tests/g722_tests.c | 2 +- libs/spandsp/tests/regression_tests.sh | 2 +- libs/spandsp/tests/schedule_tests.c | 2 +- libs/spandsp/tests/super_tone_rx_tests.c | 3 +- libs/spandsp/tests/tsb85_tests.c | 10 +- 36 files changed, 2235 insertions(+), 229 deletions(-) rename libs/spandsp/{config => m4}/ax_c99_features.m4 (100%) rename libs/spandsp/{config => m4}/ax_check_export_capability.m4 (100%) rename libs/spandsp/{config => m4}/ax_check_real_file.m4 (100%) rename libs/spandsp/{config => m4}/ax_compiler_vendor.m4 (100%) rename libs/spandsp/{config => m4}/ax_fixed_point_machine.m4 (100%) rename libs/spandsp/{config => m4}/ax_misaligned_access_fails.m4 (100%) create mode 100644 libs/spandsp/src/ademco_contactid.c create mode 100644 libs/spandsp/src/spandsp/ademco_contactid.h create mode 100644 libs/spandsp/src/spandsp/private/ademco_contactid.h create mode 100644 libs/spandsp/tests/ademco_contactid_tests.c diff --git a/libs/spandsp/Makefile.am b/libs/spandsp/Makefile.am index 193c108c6b..ccc9240240 100644 --- a/libs/spandsp/Makefile.am +++ b/libs/spandsp/Makefile.am @@ -16,6 +16,8 @@ ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +ACLOCAL_AMFLAGS = -I m4 + AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index 7914885d79..9783f0a685 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -18,34 +18,25 @@ # @start 1 -AC_INIT - -m4_include(config/ax_compiler_vendor.m4) -m4_include(config/ax_check_real_file.m4) -m4_include(config/ax_fixed_point_machine.m4) -m4_include(config/ax_misaligned_access_fails.m4) -m4_include(config/ax_c99_features.m4) -m4_include(config/ax_check_export_capability.m4) - -SPANDSP_MAJOR_VERSION=0 -SPANDSP_MINOR_VERSION=0 -SPANDSP_MICRO_VERSION=6 +AC_PREREQ([2.59]) +AC_INIT([spandsp], [0.0.6]) SPANDSP_LT_CURRENT=2 SPANDSP_LT_REVISION=0 SPANDSP_LT_AGE=0 -VERSION=$SPANDSP_MAJOR_VERSION.$SPANDSP_MINOR_VERSION.$SPANDSP_MICRO_VERSION -PACKAGE=spandsp - -AC_SUBST(SPANDSP_LT_CURRENT) -AC_SUBST(SPANDSP_LT_REVISION) -AC_SUBST(SPANDSP_LT_AGE) +m4_include(m4/ax_compiler_vendor.m4) +m4_include(m4/ax_check_real_file.m4) +m4_include(m4/ax_fixed_point_machine.m4) +m4_include(m4/ax_misaligned_access_fails.m4) +m4_include(m4/ax_c99_features.m4) +m4_include(m4/ax_check_export_capability.m4) AC_CONFIG_SRCDIR([src/tone_generate.c]) -AC_CONFIG_AUX_DIR(config) +AC_CONFIG_AUX_DIR([config]) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([src/config.h:config-h.in]) -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) +AM_INIT_AUTOMAKE([1.9.5]) AC_CANONICAL_HOST #AC_CANONICAL_BUILD @@ -59,51 +50,51 @@ AX_COMPILER_VENDOR if test "${build}" != "${host}" then - # If we are doing a Canadian Cross, in which the host and build systems - # are not the same, we set reasonable default values for the tools. + # If we are doing a Canadian Cross, in which the host and build systems + # are not the same, we set reasonable default values for the tools. - CC_FOR_BUILD=${CC_FOR_BUILD-gcc} - CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" - CC=${CC-${host_alias}-gcc} - CFLAGS=${CFLAGS-"-g -O2"} - CXX=${CXX-${host_alias}-c++} - CXXFLAGS=${CXXFLAGS-"-g -O2"} + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} + CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" + CC=${CC-${host_alias}-gcc} + CFLAGS=${CFLAGS-"-g -O2"} + CXX=${CXX-${host_alias}-c++} + CXXFLAGS=${CXXFLAGS-"-g -O2"} else - # Set reasonable default values for some tools even if not Canadian. - # Of course, these are different reasonable default values, originally - # specified directly in the Makefile. - # We don't export, so that autoconf can do its job. - # Note that all these settings are above the fragment inclusion point - # in Makefile.in, so can still be overridden by fragments. - # This is all going to change when we autoconfiscate... - CC_FOR_BUILD="\$(CC)" - CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" - AC_PROG_CC + # Set reasonable default values for some tools even if not Canadian. + # Of course, these are different reasonable default values, originally + # specified directly in the Makefile. + # We don't export, so that autoconf can do its job. + # Note that all these settings are above the fragment inclusion point + # in Makefile.in, so can still be overridden by fragments. + # This is all going to change when we autoconfiscate... + CC_FOR_BUILD="\$(CC)" + CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" + AC_PROG_CC - # We must set the default linker to the linker used by gcc for the correct - # operation of libtool. If LD is not defined and we are using gcc, try to - # set the LD default to the ld used by gcc. - if test -z "$LD" - then - if test "$GCC" = yes + # We must set the default linker to the linker used by gcc for the correct + # operation of libtool. If LD is not defined and we are using gcc, try to + # set the LD default to the ld used by gcc. + if test -z "$LD" then - case $build in - *-*-mingw*) - gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; - *) - gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; - esac - case $gcc_prog_ld in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - LD="$gcc_prog_ld" ;; - esac + if test "$GCC" = yes + then + case $build in + *-*-mingw*) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; + *) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; + esac + case $gcc_prog_ld in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + LD="$gcc_prog_ld" ;; + esac + fi fi - fi - CXX=${CXX-"c++"} - CFLAGS=${CFLAGS-"-g -O2"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} + CXX=${CXX-"c++"} + CFLAGS=${CFLAGS-"-g -O2"} + CXXFLAGS=${CXXFLAGS-"-g -O2"} fi AC_DEFUN([REMOVE_FROM_VAR],[ @@ -143,6 +134,7 @@ AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support]) AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support]) AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support]) AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support]) +AC_ARG_ENABLE(avx, [ --enable-avx Enable AVX support]) AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support]) # The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp AC_ARG_ENABLE(builtin_tiff, @@ -207,9 +199,9 @@ AC_CHECK_HEADERS([fenv.h]) AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])]) AC_CHECK_HEADERS([pcap.h]) AC_CHECK_HEADERS([pthread.h]) -if test "${build}" = "${host}" +if test "${build}" == "${host}" then - AC_CHECK_HEADERS([X11/X.h]) + AC_CHECK_HEADERS([X11/X.h]) fi # Determine XML2 include path @@ -253,12 +245,12 @@ AC_CHECK_HEADERS([FL/Fl_Audio_Meter.H], [], [], [],[[#include AC_LANG([C]) -if test "${build}" = "${host}" +if test "${build}" == "${host}" then case "${host}" in x86_64-*) # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set - AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='$(exec_prefix)/lib64') + AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='${exec_prefix}/lib64') AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"])) # The very oldest AMD 64 bit chips support SSE2, SSE and MMX enable_sse2="yes" @@ -266,6 +258,10 @@ then esac fi +#AC_DEFINE([SPANDSP_SUPPORT_T42], [1], [Support T.42 JPEG compression]) +SPANDSP_SUPPORT_T42="#undef SPANDSP_SUPPORT_T42" +#AC_DEFINE([SPANDSP_SUPPORT_T43], [1], [Support T.43 JBIG gray and colour compression]) +SPANDSP_SUPPORT_T43="#undef SPANDSP_SUPPORT_T43" #AC_DEFINE([SPANDSP_SUPPORT_T85], [1], [Support T.85 JBIG compression]) SPANDSP_SUPPORT_T85="#undef SPANDSP_SUPPORT_T85" #AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem]) @@ -287,14 +283,27 @@ AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.])) AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.])) -# Checks for libraries. -AC_CHECK_LIB([xml2], [xmlParseFile], [AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have the 'libxml2' library (-lxml2).]) SIMLIBS="$SIMLIBS -lxml2"]) +AC_SEARCH_LIBS([open_memstream], [m], AC_DEFINE([HAVE_OPEN_MEMSTREAM], [1], [Define to 1 if you have the open_memstream() function.])) if test -n "$enable_tests" ; then + AC_CHECK_PROG([HAVE_SOX], [sox], yes) + if test "x$HAVE_SOX" != "xyes" ; then + AC_MSG_ERROR("Cannot make tests without sox installed") + fi + AC_CHECK_PROG([HAVE_PBMTOG3], [pbmtog3], yes) + if test "x$HAVE_PBMTOG3" != "xyes" ; then + AC_MSG_ERROR("Cannot make tests without pbmtog3 installed (does your system require a netpbm-progs package?)") + fi + AC_CHECK_PROG([HAVE_FAX2TIFF], [fax2tiff], yes) + if test "x$HAVE_FAX2TIFF" != "xyes" ; then + AC_MSG_ERROR("Cannot make tests without fax2tiff installed (does your system require a libtiff-tools package?)") + fi AC_LANG([C]) - AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)")) - AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))]) - AC_CHECK_LIB([pcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lpcap", AC_MSG_ERROR("Can't make tests without libpcap (does your system require a libpcap-devel package?)")) + # Checks for libraries. + AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Cannot make tests without libsndfile (does your system require a libsndfile-devel package?)")) + AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Cannot make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))]) + AC_CHECK_LIB([xml2], [xmlParseFile], TESTLIBS="$TESTLIBS -lxml2", AC_MSG_ERROR("Cannot make tests without libxml2 (does your system require a libxml2-devel package?)")) + AC_CHECK_LIB([pcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lpcap", [AC_CHECK_LIB([wpcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lwpcap", AC_MSG_ERROR("Cannot make tests without libpcap (does your system require an libpcap-devel package?)"))]) AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread") AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl") AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS) @@ -314,7 +323,10 @@ AX_CHECK_EXPORT_CAPABILITY([$host], case "${ax_cv_c_compiler_vendor}" in gnu) - COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + if test "$enable_avx" = "yes" ; then + COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS" + fi if test "$enable_sse5" = "yes" ; then COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS" fi @@ -343,9 +355,12 @@ gnu) COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS" fi case $host_os in - mingw* | cygwin*) + cygwin*) COMP_VENDOR_LDFLAGS="-no-undefined" ;; + mingw*) + COMP_VENDOR_LDFLAGS="-no-undefined -lws2_32" + ;; *) COMP_VENDOR_LDFLAGS= ;; @@ -369,7 +384,10 @@ sun) REMOVE_FROM_VAR(CFLAGS, -Xc) ;; intel) - COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + if test "$enable_avx" = "yes" ; then + COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS" + fi if test "$enable_sse5" = "yes" ; then COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS" fi @@ -400,25 +418,13 @@ intel) COMP_VENDOR_LDFLAGS= ;; *) - COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" COMP_VENDOR_LDFLAGS= ;; esac COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS" -AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes]) -AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes]) -AM_CONDITIONAL([COND_TESTDATA], [test "$enable_test_data" = yes]) -AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes]) -AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes]) -AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes]) -AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes]) -AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes]) -AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes]) -AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes]) -AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes]) -AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes]) if test "$enable_fixed_point" = "yes" ; then AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1" @@ -433,6 +439,10 @@ AX_MISALIGNED_ACCESS_FAILS([$host], SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1"], [SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS"]) +if test "$enable_avx" = "yes" ; then + AC_DEFINE([SPANDSP_USE_AVX], [1], [Use the AVX instruction set (i386 and x86_64 only).]) + enable_sse5"yes" +fi if test "$enable_sse5" = "yes" ; then AC_DEFINE([SPANDSP_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).]) enable_sse4a="yes" @@ -469,23 +479,42 @@ if test "$enable_mmx" = "yes" ; then AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).]) fi +AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes]) +AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes]) +AM_CONDITIONAL([COND_TESTDATA], [test "$enable_test_data" = yes]) +AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes]) +AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes]) +AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes]) +AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes]) +AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes]) +AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes]) +AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes]) +AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes]) +AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes]) +AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes]) + if test "$enable_builtin_tiff" = "yes" ; then - abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`" - save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff" - AC_CHECK_HEADERS([tiffio.h]) - CFLAGS="$save_CFLAGS" - COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS" - COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS" - LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la" - AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).]) + abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`" + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff" + AC_CHECK_HEADERS([tiffio.h]) + CFLAGS="$save_CFLAGS" + COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS" + COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS" + LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la" + AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).]) else - AC_CHECK_HEADERS([tiffio.h]) - AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Can't build without libtiff (does your system require a libtiff-devel package?)"), -lm) + AC_CHECK_HEADERS([tiffio.h]) + AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm) fi +AC_CHECK_HEADERS([jpeglib.h]) +AC_CHECK_LIB([jpeg], [jpeg_start_compress]) TESTLIBS="$SIMLIBS $TESTLIBS" +AC_SUBST(SPANDSP_LT_CURRENT) +AC_SUBST(SPANDSP_LT_REVISION) +AC_SUBST(SPANDSP_LT_AGE) AC_SUBST(CC_FOR_BUILD) AC_SUBST(CPPFLAGS_FOR_BUILD) AC_SUBST(COMP_VENDOR_CFLAGS) @@ -495,6 +524,8 @@ AC_SUBST(TESTLIBS) AC_SUBST(SPANDSP_USE_FIXED_POINT) AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS) AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY) +AC_SUBST(SPANDSP_SUPPORT_T42) +AC_SUBST(SPANDSP_SUPPORT_T43) AC_SUBST(SPANDSP_SUPPORT_T85) AC_SUBST(SPANDSP_SUPPORT_V34) AC_SUBST(INSERT_INTTYPES_HEADER) diff --git a/libs/spandsp/doc/doxygen.in b/libs/spandsp/doc/doxygen.in index 87c3c34572..38af500c1a 100644 --- a/libs/spandsp/doc/doxygen.in +++ b/libs/spandsp/doc/doxygen.in @@ -357,12 +357,6 @@ MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES -# 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. The default is YES. - -SHOW_DIRECTORIES = YES - # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the # version control system). Doxygen will invoke the program by executing (via @@ -635,12 +629,6 @@ HTML_FOOTER = HTML_STYLESHEET = css.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) @@ -1123,7 +1111,7 @@ CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. diff --git a/libs/spandsp/config/ax_c99_features.m4 b/libs/spandsp/m4/ax_c99_features.m4 similarity index 100% rename from libs/spandsp/config/ax_c99_features.m4 rename to libs/spandsp/m4/ax_c99_features.m4 diff --git a/libs/spandsp/config/ax_check_export_capability.m4 b/libs/spandsp/m4/ax_check_export_capability.m4 similarity index 100% rename from libs/spandsp/config/ax_check_export_capability.m4 rename to libs/spandsp/m4/ax_check_export_capability.m4 diff --git a/libs/spandsp/config/ax_check_real_file.m4 b/libs/spandsp/m4/ax_check_real_file.m4 similarity index 100% rename from libs/spandsp/config/ax_check_real_file.m4 rename to libs/spandsp/m4/ax_check_real_file.m4 diff --git a/libs/spandsp/config/ax_compiler_vendor.m4 b/libs/spandsp/m4/ax_compiler_vendor.m4 similarity index 100% rename from libs/spandsp/config/ax_compiler_vendor.m4 rename to libs/spandsp/m4/ax_compiler_vendor.m4 diff --git a/libs/spandsp/config/ax_fixed_point_machine.m4 b/libs/spandsp/m4/ax_fixed_point_machine.m4 similarity index 100% rename from libs/spandsp/config/ax_fixed_point_machine.m4 rename to libs/spandsp/m4/ax_fixed_point_machine.m4 diff --git a/libs/spandsp/config/ax_misaligned_access_fails.m4 b/libs/spandsp/m4/ax_misaligned_access_fails.m4 similarity index 100% rename from libs/spandsp/config/ax_misaligned_access_fails.m4 rename to libs/spandsp/m4/ax_misaligned_access_fails.m4 diff --git a/libs/spandsp/spandsp.pc.in b/libs/spandsp/spandsp.pc.in index 1a91ba04e1..19fb1d501a 100644 --- a/libs/spandsp/spandsp.pc.in +++ b/libs/spandsp/spandsp.pc.in @@ -1,5 +1,5 @@ prefix=@prefix@ -exec_prefix=@prefix@ +exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ @@ -7,5 +7,6 @@ Name: spandsp Description: A DSP library for telephony. Requires: Version: @VERSION@ -Libs: -L${libdir} -lspandsp -ltiff -lm +Libs: -L${libdir} -lspandsp +Libs.private: -ltiff -lm Cflags: -I${includedir} diff --git a/libs/spandsp/spandsp.spec b/libs/spandsp/spandsp.spec index 5ba3f2cc8d..bf4fcb13da 100644 --- a/libs/spandsp/spandsp.spec +++ b/libs/spandsp/spandsp.spec @@ -1,19 +1,22 @@ -Summary: A DSP library for telephony. -Name: spandsp -Version: 0.0.6 -Release: 1 -License: LGPL -Group: System Environment/Libraries -URL: http://www.soft-switch.org/spandsp -BuildRoot: %{_tmppath}/%{name}-%{version}-root -Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +%global pre 21 -BuildRequires: libtiff-devel -BuildRequires: audiofile-devel +Summary: A DSP library for telephony. +Name: spandsp +Version: 0.0.6 +Release: 1 +License: LGPLv2 and GPLv2 +Group: System Environment/Libraries +URL: http://www.soft-switch.org/spandsp +Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: libtiff-devel%{?_isa} +BuildRequires: libjpeg-turbo-devel%{?_isa} +BuildRequires: libxml2-devel%{?_isa} +BuildRequires: libsndfile-devel%{?_isa} BuildRequires: doxygen -# for xsltproc: BuildRequires: libxslt +BuildRequires: docbook-style-xsl %description SpanDSP is a library of DSP functions for telephony, in the 8000 @@ -26,49 +29,66 @@ relevant patents have expired. See the file DueDiligence for important information about these intellectual property issues. %package devel -Summary: SpanDSP development files -Group: Development/Libraries -Requires: spandsp = %{version} -Requires: libtiff-devel -PreReq: /sbin/install-info +Summary: SpanDSP development files +Group: Development/Libraries +Requires: spandsp%{?_isa} = %{version}-%{release} +Requires: libtiff-devel%{?_isa} +Requires: libjpeg-turbo-devel%{?_isa} %description devel SpanDSP development files. +%package apidoc +Summary: SpanDSP API documentation +Group: Development/Libraries + +%description apidoc +SpanDSP API documentation. + %prep %setup -q %build %configure --enable-doc --disable-static --disable-rpath make +find doc/api -type f | xargs touch -r configure %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} rm %{buildroot}%{_libdir}/libspandsp.la +mkdir -p %{buildroot}%{_datadir}/spandsp %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README +%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README %{_libdir}/libspandsp.so.* +%{_datadir}/spandsp + %files devel %defattr(-,root,root,-) -%doc doc/api %{_includedir}/spandsp.h %{_includedir}/spandsp %{_libdir}/libspandsp.so %{_libdir}/pkgconfig/spandsp.pc +%files apidoc +%defattr(-,root,root,-) +%doc doc/api/html/* + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %changelog +* Mon Oct 03 2011 Steve Underwood 0.0.6-1 +- Converge with what Fedora do + * Wed Sep 24 2008 Tzafrir Cohen 0.0.5-1 - Preparing for 0.0.5pre4 release - License: LGPL diff --git a/libs/spandsp/spandsp.spec.in b/libs/spandsp/spandsp.spec.in index 7b8406fa7c..759dd17c07 100644 --- a/libs/spandsp/spandsp.spec.in +++ b/libs/spandsp/spandsp.spec.in @@ -1,19 +1,22 @@ -Summary: A DSP library for telephony. -Name: @PACKAGE@ -Version: @VERSION@ -Release: 1 -License: LGPL -Group: System Environment/Libraries -URL: http://www.soft-switch.org/spandsp -BuildRoot: %{_tmppath}/%{name}-%{version}-root -Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +%global pre 21 -BuildRequires: libtiff-devel -BuildRequires: audiofile-devel +Summary: A DSP library for telephony. +Name: @PACKAGE@ +Version: @VERSION@ +Release: 1 +License: LGPLv2 and GPLv2 +Group: System Environment/Libraries +URL: http://www.soft-switch.org/spandsp +Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: libtiff-devel%{?_isa} +BuildRequires: libjpeg-turbo-devel%{?_isa} +BuildRequires: libxml2-devel%{?_isa} +BuildRequires: libsndfile-devel%{?_isa} BuildRequires: doxygen -# for xsltproc: BuildRequires: libxslt +BuildRequires: docbook-style-xsl %description SpanDSP is a library of DSP functions for telephony, in the 8000 @@ -26,49 +29,66 @@ relevant patents have expired. See the file DueDiligence for important information about these intellectual property issues. %package devel -Summary: SpanDSP development files -Group: Development/Libraries -Requires: spandsp = %{version} -Requires: libtiff-devel -PreReq: /sbin/install-info +Summary: SpanDSP development files +Group: Development/Libraries +Requires: spandsp%{?_isa} = %{version}-%{release} +Requires: libtiff-devel%{?_isa} +Requires: libjpeg-turbo-devel%{?_isa} %description devel SpanDSP development files. +%package apidoc +Summary: SpanDSP API documentation +Group: Development/Libraries + +%description apidoc +SpanDSP API documentation. + %prep %setup -q %build %configure --enable-doc --disable-static --disable-rpath make +find doc/api -type f | xargs touch -r configure %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} rm %{buildroot}%{_libdir}/libspandsp.la +mkdir -p %{buildroot}%{_datadir}/spandsp %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README +%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README %{_libdir}/libspandsp.so.* +%{_datadir}/spandsp + %files devel %defattr(-,root,root,-) -%doc doc/api %{_includedir}/spandsp.h %{_includedir}/spandsp %{_libdir}/libspandsp.so %{_libdir}/pkgconfig/spandsp.pc +%files apidoc +%defattr(-,root,root,-) +%doc doc/api/html/* + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %changelog +* Mon Oct 03 2011 Steve Underwood 0.0.6-1 +- Converge with what Fedora do + * Wed Sep 24 2008 Tzafrir Cohen 0.0.5-1 - Preparing for 0.0.5pre4 release - License: LGPL diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index 96924bfe4c..ce4f5bad4c 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -87,7 +87,8 @@ INCLUDES = -I$(top_builddir) lib_LTLIBRARIES = libspandsp.la -libspandsp_la_SOURCES = adsi.c \ +libspandsp_la_SOURCES = ademco_contactid.c \ + adsi.c \ async.c \ at_interpreter.c \ awgn.c \ @@ -173,7 +174,8 @@ libspandsp_la_SOURCES = adsi.c \ libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS) -nobase_include_HEADERS = spandsp/adsi.h \ +nobase_include_HEADERS = spandsp/ademco_contactid.h \ + spandsp/adsi.h \ spandsp/async.h \ spandsp/arctan2.h \ spandsp/at_interpreter.h \ @@ -257,6 +259,7 @@ nobase_include_HEADERS = spandsp/adsi.h \ spandsp/vector_float.h \ spandsp/vector_int.h \ spandsp/version.h \ + spandsp/private/ademco_contactid.h \ spandsp/private/adsi.h \ spandsp/private/async.h \ spandsp/private/at_interpreter.h \ diff --git a/libs/spandsp/src/ademco_contactid.c b/libs/spandsp/src/ademco_contactid.c new file mode 100644 index 0000000000..1ba11f4763 --- /dev/null +++ b/libs/spandsp/src/ademco_contactid.c @@ -0,0 +1,1062 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * ademco_contactid.c - Ademco ContactID alarm protocol + * + * Written by Steve Underwood + * + * Copyright (C) 2012 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" +#include "spandsp/logging.h" +#include "spandsp/queue.h" +#include "spandsp/complex.h" +#include "spandsp/dds.h" +#include "spandsp/power_meter.h" +#include "spandsp/async.h" +#include "spandsp/vector_float.h" +#include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" +#include "spandsp/tone_detect.h" +#include "spandsp/tone_generate.h" +#include "spandsp/super_tone_rx.h" +#include "spandsp/dtmf.h" +#include "spandsp/ademco_contactid.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/queue.h" +#include "spandsp/private/tone_detect.h" +#include "spandsp/private/tone_generate.h" +#include "spandsp/private/dtmf.h" +#include "spandsp/private/ademco_contactid.h" + +/* +Ademco ContactID Protocol + +Answer +Wait 0.5s to 2s for the line to settle +Send 1400Hz for 100ms +Send silence for 100ms +Send 2300Hz for 100ms +Receiver now waits + +(both timing and frequency errors specified as 3%, but sender side should accept these tones with 5% frequency error.) + +Sender waits 250-300ms after end of 2300Hz tone + +Send ACCT MT QXYZ GG CCC + +ACCT = 4 digit account code (0-9, B-F) +MT = 2 digit message type (18 preferred, 98 optional) +Q = 1 digit event qualifier. 1 = New event or opening. 3 = New restore or closing. 6 = Previous condition still present +XYZ = 3 digit event code (0-9, B-F) +GG = 2 digit group or partition number (0-9, B-F). 00=no specific group +CCC = 3 digit zone number (event reports) or user number (open/close reports). 000=no specific zone or user information +S = 1 digit hex checksum (sum all message digits + S) mod 15 == 0 + +DTMF tones are 50-60ms on 50-60ms off + +0 10 (counted as 10 in checksum calculations) +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +B (*) 11 +C (#) 12 +D (A) 13 +E (B) 14 +F (C) 15 + +DTMF D is not used + +Wait 1.25s for a kiss-off tone +Detect at least 400ms of kissoff to be valid, then wait for end of tone + +Wait 250-300ms before sending the next DTMF message + +If kissoff doesn't start within 1.25s of the end of the DTMF, repeat the DTMF message + +Receiver sends 750-1000ms of 1400Hz as the kissoff tone + +Sender shall make 4 attempts before giving up. One successful kissoff resets the attempt counter +*/ + +struct ademco_code_s +{ + int code; + const char *name; + int data_type; +}; + +static const struct ademco_code_s ademco_codes[] = +{ + {0x100, "Medical", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x101, "Personal emergency", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x102, "Fail to report in", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x110, "Fire", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x111, "Smoke", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x112, "Combustion", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x113, "Water flow", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x114, "Heat", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x115, "Pull station", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x116, "Duct", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x117, "Flame", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x118, "Near alarm", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x120, "Panic", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x121, "Duress", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x122, "Silent", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x123, "Audible", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x124, "Duress - Access granted", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x125, "Duress - Egress granted", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x130, "Burglary", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x131, "Perimeter", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x132, "Interior", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x133, "24 hour (safe)", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x134, "Entry/Exit", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x135, "Day/Night", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x136, "Outdoor", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x137, "Tamper", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x138, "Near alarm", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x139, "Intrusion verifier", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x140, "General alarm", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x141, "Polling loop open", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x142, "Polling loop short", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x143, "Expansion module failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x144, "Sensor tamper", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x145, "Expansion module tamper", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x146, "Silent burglary", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x147, "Sensor supervision failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x150, "24 hour non-burglary", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x151, "Gas detected", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x152, "Refrigeration", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x153, "Loss of heat", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x154, "Water leakage", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x155, "Foil break", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x156, "Day trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x157, "Low bottled gas level", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x158, "High temp", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x159, "Low temp", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x161, "Loss of air flow", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x162, "Carbon monoxide detected", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x163, "Tank level", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x200, "Fire supervisory", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x201, "Low water pressure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x202, "Low CO2", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x203, "Gate valve sensor", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x204, "Low water level", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x205, "Pump activated", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x206, "Pump failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x300, "System trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x301, "AC loss", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x302, "Low system battery", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x303, "RAM checksum bad", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x304, "ROM checksum bad", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x305, "System reset", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x306, "Panel programming changed", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x307, "Self-test failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x308, "System shutdown", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x309, "Battery test failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x310, "Ground fault", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x311, "Battery missing/dead", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x312, "Power supply overcurrent", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x313, "Engineer reset", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x320, "Sounder/relay", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x321, "Bell 1", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x322, "Bell 2", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x323, "Alarm relay", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x324, "Trouble relay", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x325, "Reversing relay", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x326, "Notification appliance ckt. #3", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x327, "Notification appliance ckt. #4", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x330, "System peripheral trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x331, "Polling loop open", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x332, "Polling loop short", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x333, "Expansion module failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x334, "Repeater failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x335, "Local printer out of paper", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x336, "Local printer failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x337, "Exp. module DC loss", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x338, "Exp. module low battery", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x339, "Exp. module reset", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x341, "Exp. module tamper", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x342, "Exp. module AC loss", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x343, "Exp. module self-test fail", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x344, "RF receiver jam detect", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x350, "Communication trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x351, "Telco 1 fault", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x352, "Telco 2 fault", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x353, "Long range radio transmitter fault", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x354, "Failure to communicate event", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x355, "Loss of radio supervision", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x356, "Loss of central polling", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x357, "Long range radio VSWR problem", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x370, "Protection loop", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x371, "Protection loop open", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x372, "Protection loop short", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x373, "Fire trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x374, "Exit error alarm (zone)", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x375, "Panic zone trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x376, "Hold-up zone trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x377, "Swinger trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x378, "Cross-zone trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x380, "Sensor trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x381, "Loss of supervision - RF", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x382, "Loss of supervision - RPM", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x383, "Sensor tamper", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x384, "RF low battery", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x385, "Smoke detector high sensitivity", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x386, "Smoke detector low sensitivity", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x387, "Intrusion detector high sensitivity", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x388, "Intrusion detector low sensitivity", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x389, "Sensor self-test failure", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x391, "Sensor Watch trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x392, "Drift compensation error", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x393, "Maintenance alert", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x400, "Open/Close", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x401, "O/C by user", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x402, "Group O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x403, "Automatic O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x404, "Late to O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x405, "Deferred O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x406, "Cancel", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x407, "Remote arm/disarm", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x408, "Quick arm", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x409, "Keyswitch O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x441, "Armed STAY", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x442, "Keyswitch Armed STAY", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x450, "Exception O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x451, "Early O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x452, "Late O/C", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x453, "Failed to open", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x454, "Failed to close", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x455, "Auto-arm failed", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x456, "Partial arm", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x457, "Exit error (user)", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x458, "User on Premises", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x459, "Recent close", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x461, "Wrong code entry", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x462, "Legal code entry", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x463, "Re-arm after alarm", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x464, "Auto-arm time extended", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x465, "Panic alarm reset", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x466, "Service on/off premises", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x411, "Callback request made", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x412, "Successful download/access", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x413, "Unsuccessful access", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x414, "System shutdown command received", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x415, "Dialer shutdown command received", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x416, "Successful Upload", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x421, "Access denied", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x422, "Access report by user", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x423, "Forced Access", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x424, "Egress Denied", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x425, "Egress Granted", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x426, "Access Door propped open", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x427, "Access point door status monitor trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x428, "Access point request to exit trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x429, "Access program mode entry", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x430, "Access program mode exit", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x431, "Access threat level change", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x432, "Access relay/trigger fail", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x433, "Access RTE shunt", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x434, "Access DSM shunt", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x501, "Access reader disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x520, "Sounder/Relay disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x521, "Bell 1 disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x522, "Bell 2 disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x523, "Alarm relay disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x524, "Trouble relay disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x525, "Reversing relay disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x526, "Notification appliance ckt. #3 disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x527, "Notification appliance ckt. #4 disable", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x531, "Module added", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x532, "Module removed", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x551, "Dialer disabled", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x552, "Radio transmitter disabled", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x553, "Remote upload/download disabled", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x570, "Zone/Sensor bypass", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x571, "Fire bypass", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x572, "24 hour zone bypass", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x573, "Burg. bypass", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x574, "Group bypass", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x575, "Swinger bypass", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x576, "Access zone shunt", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x577, "Access point bypass", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x601, "Manual trigger test report", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x602, "Periodic test report", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x603, "Periodic RF transmission", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x604, "Fire test", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x605, "Status report to follow", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x606, "Listen-in to follow", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x607, "Walk test mode", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x608, "Periodic test - system trouble present", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x609, "Video transmitter active", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x611, "Point tested OK", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x612, "Point not tested", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x613, "Intrusion zone walk tested", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x614, "Fire zone walk tested", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x615, "Panic zone walk tested", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x616, "Service request", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x621, "Event log reset", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x622, "Event log 50% full", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x623, "Event log 90% full", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x624, "Event log overflow", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x625, "Time/Date reset", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x626, "Time/Date inaccurate", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x627, "Program mode entry", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x628, "Program mode exit", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x629, "32 hour event log marker", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x630, "Schedule change", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x631, "Exception schedule change", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x632, "Access schedule change", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x641, "Senior watch trouble", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x642, "Latch-key supervision", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x651, "Reserved for Ademco use", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x652, "Reserved for Ademco use", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x653, "Reserved for Ademco use", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x654, "System inactivity", ADEMCO_CONTACTID_DATA_IS_ZONE}, + {0x900, "Download abort", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x901, "Download start/end", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x902, "Download interrupted", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x910, "Auto-close with bypass", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x911, "Bypass closing", ADEMCO_CONTACTID_DATA_IS_USER}, + {0x999, "32 hour no read of event log", ADEMCO_CONTACTID_DATA_IS_USER}, + {-1, "???"} +}; + +#if defined(SPANDSP_USE_FIXED_POINT) +#define GOERTZEL_SAMPLES_PER_BLOCK 55 /* We need to detect over a +-5% range */ +#define DETECTION_THRESHOLD 16439 /* -42dBm0 [((GOERTZEL_SAMPLES_PER_BLOCK*GOERTZEL_SAMPLES_PER_BLOCK*32768.0/(1.4142*128.0))*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ +#define TONE_TWIST 4 /* 6dB */ +#define TONE_TO_TOTAL_ENERGY 64 /* -3dB */ +#else +#define GOERTZEL_SAMPLES_PER_BLOCK 55 /* We need to detect over a +-5% range */ +#define DETECTION_THRESHOLD 2104205.6f /* -42dBm0 [((GOERTZEL_SAMPLES_PER_BLOCK*GOERTZEL_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ +#define TONE_TWIST 3.981f /* 6dB */ +#define TONE_TO_TOTAL_ENERGY 1.995f /* 3dB */ +#endif + +static goertzel_descriptor_t tone_1400_desc; +static goertzel_descriptor_t tone_2300_desc; + +SPAN_DECLARE(int) encode_msg(char buf[], const ademco_contactid_report_t *report) +{ + char *s; + int sum; + int x; + static const char remap[] = {'D', '*', '#', 'A', 'B', 'C'}; + + sprintf(buf, "%04X%02X%1X%03X%02X%03X", report->acct, report->mt, report->q, report->xyz, report->gg, report->ccc); + for (sum = 0, s = buf; *s; s++) + { + if (*s == 'A') + return -1; + if (*s > '9') + { + x = *s - ('A' - 10); + /* Remap the Ademco B-F digits to normal DTMF *#ABC digits */ + *s = remap[x - 10]; + } + else + { + x = *s - '0'; + if (x == 0) + x = 10; + } + sum += x; + } + sum = ((sum + 15)/15)*15 - sum; + if (sum == 0) + sum = 'C'; + else if (sum <= 9) + sum += '0'; + else + sum = remap[sum - 10]; + *s++ = sum; + *s = '\0'; + return s - buf; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) decode_msg(ademco_contactid_report_t *report, const char buf[]) +{ + const char *s; + char *t; + int sum; + int x; + char buf2[20]; + + /* We need to remap normal DTMF (0-0, *, #, A-D) to Ademco's psuedo-hex (0-0, B-F, nothing for A) + and calculate the checksum */ + for (sum = 0, s = buf, t = buf2; *s; s++, t++) + { + x = *s; + switch (x) + { + case '*': + x = 'B'; + break; + case '#': + x = 'C'; + break; + case 'A': + x = 'D'; + break; + case 'B': + x = 'E'; + break; + case 'C': + x = 'F'; + break; + case 'D': + /* This should not happen in the Ademco protocol */ + x = 'A'; + break; + default: + x = *s; + break; + } + *t = x; + if (x > '9') + { + x -= ('B' - 11); + } + else + { + if (x == '0') + x = 10; + else + x -= '0'; + } + sum += x; + } + *t = '\0'; + if (sum%15 != 0) + return -1; + if (sscanf(buf2, "%04x%02x%1x%03x%02x%03x", &report->acct, &report->mt, &report->q, &report->xyz, &report->gg, &report->ccc) != 6) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) ademco_contactid_msg_qualifier_to_str(int q) +{ + switch (q) + { + case ADEMCO_CONTACTID_QUALIFIER_NEW_EVENT: + return "New event"; + case ADEMCO_CONTACTID_QUALIFIER_NEW_RESTORE: + return "New restore"; + case ADEMCO_CONTACTID_QUALIFIER_STATUS_REPORT: + return "Status report"; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(const char *) ademco_contactid_event_to_str(int xyz) +{ + int entry; + + for (entry = 0; ademco_codes[entry].code >= 0; entry++) + { + if (xyz == ademco_codes[entry].code) + return ademco_codes[entry].name; + } + return "???"; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_receiver_log_msg(ademco_contactid_receiver_state_t *s, const ademco_contactid_report_t *report) +{ + const char *t; + + span_log(&s->logging, SPAN_LOG_FLOW, "Ademco Contact ID message:\n"); + span_log(&s->logging, SPAN_LOG_FLOW, " Account %X\n", report->acct); + switch (report->mt) + { + case ADEMCO_CONTACTID_MESSAGE_TYPE_18: + case ADEMCO_CONTACTID_MESSAGE_TYPE_98: + t = "Contact ID"; + break; + default: + t = "???"; + break; + } + span_log(&s->logging, SPAN_LOG_FLOW, " Message type %s (%X)\n", t, report->mt); + t = ademco_contactid_msg_qualifier_to_str(report->q); + span_log(&s->logging, SPAN_LOG_FLOW, " Qualifier %s (%X)\n", t, report->q); + t = ademco_contactid_event_to_str(report->xyz); + span_log(&s->logging, SPAN_LOG_FLOW, " Event %s (%X)\n", t, report->xyz); + span_log(&s->logging, SPAN_LOG_FLOW, " Group/partition %X\n", report->gg); + span_log(&s->logging, SPAN_LOG_FLOW, " User/Zone information %X\n", report->ccc); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_receiver_tx(ademco_contactid_receiver_state_t *s, int16_t amp[], int max_samples) +{ + int i; + int samples; + + switch (s->step) + { + case 0: + samples = (s->remaining_samples > max_samples) ? max_samples : s->remaining_samples; + vec_zeroi16(amp, samples); + s->remaining_samples -= samples; + if (s->remaining_samples > 0) + return samples; + span_log(&s->logging, SPAN_LOG_FLOW, "Initial silence finished\n"); + s->step++; + s->tone_phase_rate = dds_phase_rate(1400.0); + s->tone_level = dds_scaling_dbm0(-11); + s->tone_phase = 0; + s->remaining_samples = ms_to_samples(100); + return samples; + case 1: + samples = (s->remaining_samples > max_samples) ? max_samples : s->remaining_samples; + for (i = 0; i < samples; i++) + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->tone_level, 0); + s->remaining_samples -= samples; + if (s->remaining_samples > 0) + return samples; + span_log(&s->logging, SPAN_LOG_FLOW, "1400Hz tone finished\n"); + s->step++; + s->remaining_samples = ms_to_samples(100); + return samples; + case 2: + samples = (s->remaining_samples > max_samples) ? max_samples : s->remaining_samples; + vec_zeroi16(amp, samples); + s->remaining_samples -= samples; + if (s->remaining_samples > 0) + return samples; + span_log(&s->logging, SPAN_LOG_FLOW, "Second silence finished\n"); + s->step++; + s->tone_phase_rate = dds_phase_rate(2300.0); + s->tone_level = dds_scaling_dbm0(-11); + s->tone_phase = 0; + s->remaining_samples = ms_to_samples(100); + return samples; + case 3: + samples = (s->remaining_samples > max_samples) ? max_samples : s->remaining_samples; + for (i = 0; i < samples; i++) + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->tone_level, 0); + s->remaining_samples -= samples; + if (s->remaining_samples > 0) + return samples; + span_log(&s->logging, SPAN_LOG_FLOW, "2300Hz tone finished\n"); + s->step++; + s->remaining_samples = ms_to_samples(100); + return samples; + case 4: + /* Idle here, waiting for a response */ + return 0; + case 5: + samples = (s->remaining_samples > max_samples) ? max_samples : s->remaining_samples; + vec_zeroi16(amp, samples); + s->remaining_samples -= samples; + if (s->remaining_samples > 0) + return samples; + span_log(&s->logging, SPAN_LOG_FLOW, "Sending kissoff\n"); + s->step++; + s->tone_phase_rate = dds_phase_rate(1400.0); + s->tone_level = dds_scaling_dbm0(-11); + s->tone_phase = 0; + s->remaining_samples = ms_to_samples(850); + return samples; + case 6: + samples = (s->remaining_samples > max_samples) ? max_samples : s->remaining_samples; + for (i = 0; i < samples; i++) + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->tone_level, 0); + s->remaining_samples -= samples; + if (s->remaining_samples > 0) + return samples; + span_log(&s->logging, SPAN_LOG_FLOW, "1400Hz tone finished\n"); + s->step = 4; + s->remaining_samples = ms_to_samples(100); + return samples; + } + return max_samples; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_receiver_rx(ademco_contactid_receiver_state_t *s, const int16_t amp[], int samples) +{ + return dtmf_rx(&s->dtmf, amp, samples); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_receiver_fillin(ademco_contactid_receiver_state_t *s, int samples) +{ + return dtmf_rx_fillin(&s->dtmf, samples); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) ademco_contactid_receiver_get_logging_state(ademco_contactid_receiver_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +static void dtmf_digit_delivery(void *user_data, const char *digits, int len) +{ + ademco_contactid_receiver_state_t *s; + ademco_contactid_report_t report; + + s = (ademco_contactid_receiver_state_t *) user_data; + memcpy(&s->rx_digits[s->rx_digits_len], digits, len); + s->rx_digits_len += len; + if (s->rx_digits_len == 16) + { + s->rx_digits[16] = '\0'; + if (decode_msg(&report, s->rx_digits) == 0) + { + ademco_contactid_receiver_log_msg(s, &report); + if (s->callback) + s->callback(s->callback_user_data, &report); + s->step++; + } + s->rx_digits_len = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) ademco_contactid_receiver_set_realtime_callback(ademco_contactid_receiver_state_t *s, + ademco_contactid_report_func_t callback, + void *user_data) +{ + s->callback = callback; + s->callback_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(ademco_contactid_receiver_state_t *) ademco_contactid_receiver_init(ademco_contactid_receiver_state_t *s, + ademco_contactid_report_func_t callback, + void *user_data) +{ + if (s == NULL) + { + if ((s = (ademco_contactid_receiver_state_t *) malloc(sizeof (*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "Ademco"); + + dtmf_rx_init(&s->dtmf, dtmf_digit_delivery, (void *) s); + s->rx_digits_len = 0; + + s->callback = callback; + s->callback_user_data = user_data; + + s->step = 0; + s->remaining_samples = ms_to_samples(500); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_receiver_release(ademco_contactid_receiver_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_receiver_free(ademco_contactid_receiver_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s, int16_t amp[], int max_samples) +{ + int sample; + int samples; + + for (sample = 0; sample < max_samples; sample += samples) + { + switch (s->step) + { + case 0: + if (!s->clear_to_send) + return 0; + s->clear_to_send = FALSE; + s->step++; + s->remaining_samples = ms_to_samples(250); + /* Fall through */ + case 1: + samples = (s->remaining_samples > (max_samples - sample)) ? (max_samples - sample) : s->remaining_samples; + vec_zeroi16(&[sample], samples); + s->remaining_samples -= samples; + if (s->remaining_samples > 0) + return samples; + span_log(&s->logging, SPAN_LOG_FLOW, "Pre-send silence finished\n"); + s->step++; + break; + case 2: + samples = dtmf_tx(&s->dtmf, &[sample], max_samples - sample); + if (samples == 0) + { + s->clear_to_send = FALSE; + s->step = 0; + return sample; + } + break; + default: + return sample; + } + } + return sample; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s, const int16_t amp[], int samples) +{ +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t energy_1400; + int32_t energy_2300; + int16_t xamp; +#else + float energy_1400; + float energy_2300; + float xamp; +#endif + int sample; + int limit; + int hit; + int j; + + for (sample = 0; sample < samples; sample = limit) + { + if ((samples - sample) >= (GOERTZEL_SAMPLES_PER_BLOCK - s->current_sample)) + limit = sample + (GOERTZEL_SAMPLES_PER_BLOCK - s->current_sample); + else + limit = samples; + for (j = sample; j < limit; j++) + { + xamp = amp[j]; + xamp = goertzel_preadjust_amp(xamp); +#if defined(SPANDSP_USE_FIXED_POINT) + s->energy += ((int32_t) xamp*xamp); +#else + s->energy += xamp*xamp; +#endif + goertzel_samplex(&s->tone_1400, xamp); + goertzel_samplex(&s->tone_2300, xamp); + } + s->current_sample += (limit - sample); + if (s->current_sample < GOERTZEL_SAMPLES_PER_BLOCK) + continue; + + energy_1400 = goertzel_result(&s->tone_1400); + energy_2300 = goertzel_result(&s->tone_2300); + hit = 0; + if (energy_1400 > DETECTION_THRESHOLD || energy_2300 > DETECTION_THRESHOLD) + { + if (energy_1400 > energy_2300) + { + if (energy_1400 > TONE_TO_TOTAL_ENERGY*s->energy) + hit = 1; + } + else + { + if (energy_2300 > TONE_TO_TOTAL_ENERGY*s->energy) + hit = 2; + } + } + if (hit != s->in_tone && hit == s->last_hit) + { + /* We have two successive indications that something has changed to a + specific new state. */ + switch (s->tone_state) + { + case 0: + if (hit == 1) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Receiving initial 1400Hz\n"); + s->in_tone = hit; + s->tone_state = 1; + s->duration = 0; + } + break; + case 1: + /* We are looking for a burst of 1400Hz which is 100ms +- 5% long */ + if (hit == 0) + { + if (s->duration < ms_to_samples(70) || s->duration > ms_to_samples(130)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad initial 1400Hz tone duration\n"); + s->tone_state = 0; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Received 1400Hz tone\n"); + s->tone_state = 2; + } + s->in_tone = hit; + s->duration = 0; + } + break; + case 2: + /* We are looking for 100ms +-5% of silence after the 1400Hz tone */ + if (s->duration < ms_to_samples(70) || s->duration > ms_to_samples(130)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad silence length\n"); + s->tone_state = 0; + s->in_tone = hit; + } + else if (hit == 2) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Received silence\n"); + s->tone_state = 3; + s->in_tone = hit; + } + else + { + s->tone_state = 0; + s->in_tone = 0; + } + s->duration = 0; + break; + case 3: + /* We are looking for a burst of 2300Hz which is 100ms +- 5% long */ + if (hit == 0) + { + if (s->duration < ms_to_samples(70) || s->duration > ms_to_samples(130)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad initial 2300Hz tone duration\n"); + s->tone_state = 0; + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Received 2300Hz\n"); + if (s->callback) + s->callback(s->callback_user_data, -1, 0, 0); + s->tone_state = 4; + /* Release the transmit side, and it will time the 250ms post tone delay */ + s->clear_to_send = TRUE; + s->tries = 0; + if (s->tx_digits_len) + s->timer = ms_to_samples(3000); + } + s->in_tone = hit; + s->duration = 0; + } + break; + case 4: + if (hit == 1) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Receiving kissoff\n"); + s->tone_state = 5; + s->in_tone = hit; + s->duration = 0; + } + break; + case 5: + if (hit == 0) + { + s->busy = FALSE; + if (s->duration < ms_to_samples(400) || s->duration > ms_to_samples(1500)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad kissoff duration %d\n", s->duration); + if (++s->tries < 4) + { + dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len); + s->timer = ms_to_samples(3000); + s->tone_state = 4; + } + else + { + s->timer = 0; + if (s->callback) + s->callback(s->callback_user_data, FALSE, 0, 0); + } + } + else + { + span_log(&s->logging, SPAN_LOG_FLOW, "Received good kissoff\n"); + s->clear_to_send = TRUE; + s->tx_digits_len = 0; + if (s->callback) + s->callback(s->callback_user_data, TRUE, 0, 0); + s->tone_state = 4; + s->clear_to_send = TRUE; + s->tries = 0; + if (s->tx_digits_len) + s->timer = ms_to_samples(3000); + } + s->in_tone = hit; + s->duration = 0; + } + break; + } + } + s->last_hit = hit; + s->duration += GOERTZEL_SAMPLES_PER_BLOCK; + if (s->timer > 0) + { + s->timer -= GOERTZEL_SAMPLES_PER_BLOCK; + if (s->timer <= 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Timer expired\n"); + if (s->tone_state == 4 && s->tx_digits_len) + { + if (++s->tries < 4) + { + dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len); + s->timer = ms_to_samples(3000); + } + else + { + s->timer = 0; + if (s->callback) + s->callback(s->callback_user_data, FALSE, 0, 0); + } + } + } + } + s->energy = 0; + s->current_sample = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_sender_fillin(ademco_contactid_sender_state_t *s, int samples) +{ + /* Restart any Goertzel and energy gathering operation we might be in the middle of. */ + goertzel_reset(&s->tone_1400); + goertzel_reset(&s->tone_2300); +#if defined(SPANDSP_USE_FIXED_POINT) + s->energy = 0; +#else + s->energy = 0.0f; +#endif + s->current_sample = 0; + /* Don't update the hit detection. Pretend it never happened. */ + /* TODO: Surely we can be cleverer than this. */ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_sender_put(ademco_contactid_sender_state_t *s, const ademco_contactid_report_t *report) +{ + if (s->busy) + return -1; + if ((s->tx_digits_len = encode_msg(s->tx_digits, report)) < 0) + return -1; + s->busy = TRUE; + return dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(logging_state_t *) ademco_contactid_sender_get_logging_state(ademco_contactid_sender_state_t *s) +{ + return &s->logging; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) ademco_contactid_sender_set_realtime_callback(ademco_contactid_sender_state_t *s, + tone_report_func_t callback, + void *user_data) +{ + s->callback = callback; + s->callback_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ademco_contactid_sender_state_t *s, + tone_report_func_t callback, + void *user_data) +{ + static int initialised = FALSE; + + if (s == NULL) + { + if ((s = (ademco_contactid_sender_state_t *) malloc(sizeof (*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "Ademco"); + + if (!initialised) + { + make_goertzel_descriptor(&tone_1400_desc, 1400.0f, GOERTZEL_SAMPLES_PER_BLOCK); + make_goertzel_descriptor(&tone_2300_desc, 2300.0f, GOERTZEL_SAMPLES_PER_BLOCK); + } + goertzel_init(&s->tone_1400, &tone_1400_desc); + goertzel_init(&s->tone_2300, &tone_2300_desc); + s->current_sample = 0; + + s->callback = callback; + s->callback_user_data = user_data; + + s->step = 0; + s->remaining_samples = ms_to_samples(100); + dtmf_tx_init(&s->dtmf); + /* The specified timing is 50-60ms on, 50-60ms off */ + dtmf_tx_set_timing(&s->dtmf, 55, 55); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_sender_release(ademco_contactid_sender_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) ademco_contactid_sender_free(ademco_contactid_sender_state_t *s) +{ + free(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/sig_tone.c b/libs/spandsp/src/sig_tone.c index 6aaecdb211..369218438c 100644 --- a/libs/spandsp/src/sig_tone.c +++ b/libs/spandsp/src/sig_tone.c @@ -647,9 +647,9 @@ SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int } memset(s, 0, sizeof(*s)); #if !defined(SPANDSP_USE_FIXED_POINT) - for (j = 0; j < 2; j++) + for (j = 0; j < 3; j++) { - for (i = 0; i < 3; i++) + for (i = 0; i < 2; i++) { s->tone[j].notch_z1[i] = 0.0f; s->tone[j].notch_z2[i] = 0.0f; diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index acb8a18ed5..e3c0d4f477 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -33,15 +33,19 @@ @SPANDSP_USE_EXPORT_CAPABILITY@ +@SPANDSP_SUPPORT_T42@ +@SPANDSP_SUPPORT_T43@ +@SPANDSP_SUPPORT_T85@ +@SPANDSP_SUPPORT_V34@ + #include @INSERT_INTTYPES_HEADER@ #include #include #include @INSERT_MATH_HEADER@ -#if !defined(SPANDSP_NO_TIFF) #include -#endif + #include #include #include @@ -106,6 +110,8 @@ #include /*#include */ /*#include */ +/*#include */ +/*#include */ #include #include #include @@ -120,6 +126,7 @@ #include #include #include +#include #include #include #include diff --git a/libs/spandsp/src/spandsp/ademco_contactid.h b/libs/spandsp/src/spandsp/ademco_contactid.h new file mode 100644 index 0000000000..8e42d70256 --- /dev/null +++ b/libs/spandsp/src/spandsp/ademco_contactid.h @@ -0,0 +1,365 @@ +/* + * SpanDSP a series of DSP components for telephony + * + * ademco_contactid.h Ademco ContactID alarm protocol + * + * Written by Steve Underwood + * + * Copyright (C) 2012 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_SPANDSP_ADEMCO_CONTACTID_H_) +#define _SPANDSP_ADEMCO_CONTACTID_H_ + +enum +{ + ADEMCO_CONTACTID_MESSAGE_TYPE_18 = 0x18, + ADEMCO_CONTACTID_MESSAGE_TYPE_98 = 0x98 +}; + +enum +{ + ADEMCO_CONTACTID_QUALIFIER_NEW_EVENT = 1, + ADEMCO_CONTACTID_QUALIFIER_NEW_RESTORE = 3, + ADEMCO_CONTACTID_QUALIFIER_STATUS_REPORT = 6 +}; + +enum +{ + ADEMCO_CONTACTID_DATA_IS_ZONE = 0, + ADEMCO_CONTACTID_DATA_IS_USER = 1 +}; + +enum +{ + ADEMCO_CONTACTID_MEDICAL = 0x100, + ADEMCO_CONTACTID_PERSONAL_EMERGENCY = 0x101, + ADEMCO_CONTACTID_FAIL_TO_REPORT_IN = 0x102, + ADEMCO_CONTACTID_FIRE = 0x110, + ADEMCO_CONTACTID_SMOKE = 0x111, + ADEMCO_CONTACTID_COMBUSTION = 0x112, + ADEMCO_CONTACTID_WATER_FLOW = 0x113, + ADEMCO_CONTACTID_HEAT = 0x114, + ADEMCO_CONTACTID_PULL_STATION = 0x115, + ADEMCO_CONTACTID_DUCT = 0x116, + ADEMCO_CONTACTID_FLAME = 0x117, + ADEMCO_CONTACTID_NEAR_ALARM_A = 0x118, + ADEMCO_CONTACTID_PANIC = 0x120, + ADEMCO_CONTACTID_DURESS = 0x121, + ADEMCO_CONTACTID_SILENT = 0x122, + ADEMCO_CONTACTID_AUDIBLE = 0x123, + ADEMCO_CONTACTID_DURESS_ACCESS_GRANTED = 0x124, + ADEMCO_CONTACTID_DURESS_EGRESS_GRANTED = 0x125, + ADEMCO_CONTACTID_BURGLARY = 0x130, + ADEMCO_CONTACTID_PERIMETER = 0x131, + ADEMCO_CONTACTID_INTERIOR = 0x132, + ADEMCO_CONTACTID_24_HOUR_SAFE = 0x133, + ADEMCO_CONTACTID_ENTRY_EXIT = 0x134, + ADEMCO_CONTACTID_DAY_NIGHT = 0x135, + ADEMCO_CONTACTID_OUTDOOR = 0x136, + ADEMCO_CONTACTID_TAMPER = 0x137, + ADEMCO_CONTACTID_NEAR_ALARM_B = 0x138, + ADEMCO_CONTACTID_INTRUSION_VERIFIER = 0x139, + ADEMCO_CONTACTID_GENERAL_ALARM = 0x140, + ADEMCO_CONTACTID_POLLING_LOOP_OPEN_A = 0x141, + ADEMCO_CONTACTID_POLLING_LOOP_SHORT_A = 0x142, + ADEMCO_CONTACTID_EXPANSION_MODULE_FAILURE_A = 0x143, + ADEMCO_CONTACTID_SENSOR_TAMPER_A = 0x144, + ADEMCO_CONTACTID_EXPANSION_MODULE_TAMPER = 0x145, + ADEMCO_CONTACTID_SILENT_BURGLARY = 0x146, + ADEMCO_CONTACTID_SENSOR_SUPERVISION_FAILURE = 0x147, + ADEMCO_CONTACTID_24_HOUR_NONBURGLARY = 0x150, + ADEMCO_CONTACTID_GAS_DETECTED = 0x151, + ADEMCO_CONTACTID_REFRIGERATION = 0x152, + ADEMCO_CONTACTID_LOSS_OF_HEAT = 0x153, + ADEMCO_CONTACTID_WATER_LEAKAGE = 0x154, + ADEMCO_CONTACTID_FOIL_BREAK = 0x155, + ADEMCO_CONTACTID_DAY_TROUBLE = 0x156, + ADEMCO_CONTACTID_LOW_BOTTLED_GAS_LEVEL = 0x157, + ADEMCO_CONTACTID_HIGH_TEMP = 0x158, + ADEMCO_CONTACTID_LOW_TEMP = 0x159, + ADEMCO_CONTACTID_LOSS_OF_AIR_FLOW = 0x161, + ADEMCO_CONTACTID_CARBON_MONOXIDE_DETECTED = 0x162, + ADEMCO_CONTACTID_TANK_LEVEL = 0x163, + ADEMCO_CONTACTID_FIRE_SUPERVISORY = 0x200, + ADEMCO_CONTACTID_LOW_WATER_PRESSURE = 0x201, + ADEMCO_CONTACTID_LOW_CO2 = 0x202, + ADEMCO_CONTACTID_GATE_VALVE_SENSOR = 0x203, + ADEMCO_CONTACTID_LOW_WATER_LEVEL = 0x204, + ADEMCO_CONTACTID_PUMP_ACTIVATED = 0x205, + ADEMCO_CONTACTID_PUMP_FAILURE = 0x206, + ADEMCO_CONTACTID_SYSTEM_TROUBLE = 0x300, + ADEMCO_CONTACTID_AC_LOSS = 0x301, + ADEMCO_CONTACTID_LOW_SYSTEM_BATTERY = 0x302, + ADEMCO_CONTACTID_RAM_CHECKSUM_BAD = 0x303, + ADEMCO_CONTACTID_ROM_CHECKSUM_BAD = 0x304, + ADEMCO_CONTACTID_SYSTEM_RESET = 0x305, + ADEMCO_CONTACTID_PANEL_PROGRAMMING_CHANGED = 0x306, + ADEMCO_CONTACTID_SELFTEST_FAILURE = 0x307, + ADEMCO_CONTACTID_SYSTEM_SHUTDOWN = 0x308, + ADEMCO_CONTACTID_BATTERY_TEST_FAILURE = 0x309, + ADEMCO_CONTACTID_GROUND_FAULT = 0x310, + ADEMCO_CONTACTID_BATTERY_MISSING_DEAD = 0x311, + ADEMCO_CONTACTID_POWER_SUPPLY_OVERCURRENT = 0x312, + ADEMCO_CONTACTID_ENGINEER_RESET = 0x313, + ADEMCO_CONTACTID_SOUNDER_RELAY = 0x320, + ADEMCO_CONTACTID_BELL_1 = 0x321, + ADEMCO_CONTACTID_BELL_2 = 0x322, + ADEMCO_CONTACTID_ALARM_RELAY = 0x323, + ADEMCO_CONTACTID_TROUBLE_RELAY = 0x324, + ADEMCO_CONTACTID_REVERSING_RELAY = 0x325, + ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_3 = 0x326, + ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_4 = 0x327, + ADEMCO_CONTACTID_SYSTEM_PERIPHERAL_TROUBLE = 0x330, + ADEMCO_CONTACTID_POLLING_LOOP_OPEN_B = 0x331, + ADEMCO_CONTACTID_POLLING_LOOP_SHORT_B = 0x332, + ADEMCO_CONTACTID_EXPANSION_MODULE_FAILURE_B = 0x333, + ADEMCO_CONTACTID_REPEATER_FAILURE = 0x334, + ADEMCO_CONTACTID_LOCAL_PRINTER_OUT_OF_PAPER = 0x335, + ADEMCO_CONTACTID_LOCAL_PRINTER_FAILURE = 0x336, + ADEMCO_CONTACTID_EXP_MODULE_DC_LOSS = 0x337, + ADEMCO_CONTACTID_EXP_MODULE_LOW_BATTERY = 0x338, + ADEMCO_CONTACTID_EXP_MODULE_RESET = 0x339, + ADEMCO_CONTACTID_EXP_MODULE_TAMPER = 0x341, + ADEMCO_CONTACTID_EXP_MODULE_AC_LOSS = 0x342, + ADEMCO_CONTACTID_EXP_MODULE_SELFTEST_FAIL = 0x343, + ADEMCO_CONTACTID_RF_RECEIVER_JAM_DETECT = 0x344, + ADEMCO_CONTACTID_COMMUNICATION_TROUBLE = 0x350, + ADEMCO_CONTACTID_TELCO_1_FAULT = 0x351, + ADEMCO_CONTACTID_TELCO_2_FAULT = 0x352, + ADEMCO_CONTACTID_LONG_RANGE_RADIO_TRANSMITTER_FAULT = 0x353, + ADEMCO_CONTACTID_FAILURE_TO_COMMUNICATE_EVENT = 0x354, + ADEMCO_CONTACTID_LOSS_OF_RADIO_SUPERVISION = 0x355, + ADEMCO_CONTACTID_LOSS_OF_CENTRAL_POLLING = 0x356, + ADEMCO_CONTACTID_LONG_RANGE_RADIO_VSWR_PROBLEM = 0x357, + ADEMCO_CONTACTID_PROTECTION_LOOP = 0x370, + ADEMCO_CONTACTID_PROTECTION_LOOP_OPEN = 0x371, + ADEMCO_CONTACTID_PROTECTION_LOOP_SHORT = 0x372, + ADEMCO_CONTACTID_FIRE_TROUBLE = 0x373, + ADEMCO_CONTACTID_EXIT_ERROR_ALARM_ZONE = 0x374, + ADEMCO_CONTACTID_PANIC_ZONE_TROUBLE = 0x375, + ADEMCO_CONTACTID_HOLDUP_ZONE_TROUBLE = 0x376, + ADEMCO_CONTACTID_SWINGER_TROUBLE = 0x377, + ADEMCO_CONTACTID_CROSSZONE_TROUBLE = 0x378, + ADEMCO_CONTACTID_SENSOR_TROUBLE = 0x380, + ADEMCO_CONTACTID_LOSS_OF_SUPERVISION__RF = 0x381, + ADEMCO_CONTACTID_LOSS_OF_SUPERVISION__RPM = 0x382, + ADEMCO_CONTACTID_SENSOR_TAMPER_B = 0x383, + ADEMCO_CONTACTID_RF_LOW_BATTERY = 0x384, + ADEMCO_CONTACTID_SMOKE_DETECTOR_HIGH_SENSITIVITY = 0x385, + ADEMCO_CONTACTID_SMOKE_DETECTOR_LOW_SENSITIVITY = 0x386, + ADEMCO_CONTACTID_INTRUSION_DETECTOR_HIGH_SENSITIVITY = 0x387, + ADEMCO_CONTACTID_INTRUSION_DETECTOR_LOW_SENSITIVITY = 0x388, + ADEMCO_CONTACTID_SENSOR_SELFTEST_FAILURE = 0x389, + ADEMCO_CONTACTID_SENSOR_WATCH_TROUBLE = 0x391, + ADEMCO_CONTACTID_DRIFT_COMPENSATION_ERROR = 0x392, + ADEMCO_CONTACTID_MAINTENANCE_ALERT = 0x393, + ADEMCO_CONTACTID_OPEN_CLOSE = 0x400, + ADEMCO_CONTACTID_OC_BY_USER = 0x401, + ADEMCO_CONTACTID_GROUP_OC = 0x402, + ADEMCO_CONTACTID_AUTOMATIC_OC = 0x403, + ADEMCO_CONTACTID_LATE_TO_OC = 0x404, + ADEMCO_CONTACTID_DEFERRED_OC = 0x405, + ADEMCO_CONTACTID_CANCEL = 0x406, + ADEMCO_CONTACTID_REMOTE_ARM_DISARM = 0x407, + ADEMCO_CONTACTID_QUICK_ARM = 0x408, + ADEMCO_CONTACTID_KEYSWITCH_OC = 0x409, + ADEMCO_CONTACTID_ARMED_STAY = 0x441, + ADEMCO_CONTACTID_KEYSWITCH_ARMED_STAY = 0x442, + ADEMCO_CONTACTID_EXCEPTION_OC = 0x450, + ADEMCO_CONTACTID_EARLY_OC = 0x451, + ADEMCO_CONTACTID_LATE_OC = 0x452, + ADEMCO_CONTACTID_FAILED_TO_OPEN = 0x453, + ADEMCO_CONTACTID_FAILED_TO_CLOSE = 0x454, + ADEMCO_CONTACTID_AUTOARM_FAILED = 0x455, + ADEMCO_CONTACTID_PARTIAL_ARM = 0x456, + ADEMCO_CONTACTID_EXIT_ERROR_USER = 0x457, + ADEMCO_CONTACTID_USER_ON_PREMISES = 0x458, + ADEMCO_CONTACTID_RECENT_CLOSE = 0x459, + ADEMCO_CONTACTID_WRONG_CODE_ENTRY = 0x461, + ADEMCO_CONTACTID_LEGAL_CODE_ENTRY = 0x462, + ADEMCO_CONTACTID_REARM_AFTER_ALARM = 0x463, + ADEMCO_CONTACTID_AUTOARM_TIME_EXTENDED = 0x464, + ADEMCO_CONTACTID_PANIC_ALARM_RESET = 0x465, + ADEMCO_CONTACTID_SERVICE_ON_OFF_PREMISES = 0x466, + ADEMCO_CONTACTID_CALLBACK_REQUEST_MADE = 0x411, + ADEMCO_CONTACTID_SUCCESSFUL_DOWNLOAD_ACCESS = 0x412, + ADEMCO_CONTACTID_UNSUCCESSFUL_ACCESS = 0x413, + ADEMCO_CONTACTID_SYSTEM_SHUTDOWN_COMMAND_RECEIVED = 0x414, + ADEMCO_CONTACTID_DIALER_SHUTDOWN_COMMAND_RECEIVED = 0x415, + ADEMCO_CONTACTID_SUCCESSFUL_UPLOAD = 0x416, + ADEMCO_CONTACTID_ACCESS_DENIED = 0x421, + ADEMCO_CONTACTID_ACCESS_REPORT_BY_USER = 0x422, + ADEMCO_CONTACTID_FORCED_ACCESS = 0x423, + ADEMCO_CONTACTID_EGRESS_DENIED = 0x424, + ADEMCO_CONTACTID_EGRESS_GRANTED = 0x425, + ADEMCO_CONTACTID_ACCESS_DOOR_PROPPED_OPEN = 0x426, + ADEMCO_CONTACTID_ACCESS_POINT_DOOR_STATUS_MONITOR_TROUBLE = 0x427, + ADEMCO_CONTACTID_ACCESS_POINT_REQUEST_TO_EXIT_TROUBLE = 0x428, + ADEMCO_CONTACTID_ACCESS_PROGRAM_MODE_ENTRY = 0x429, + ADEMCO_CONTACTID_ACCESS_PROGRAM_MODE_EXIT = 0x430, + ADEMCO_CONTACTID_ACCESS_THREAT_LEVEL_CHANGE = 0x431, + ADEMCO_CONTACTID_ACCESS_RELAY_TRIGGER_FAIL = 0x432, + ADEMCO_CONTACTID_ACCESS_RTE_SHUNT = 0x433, + ADEMCO_CONTACTID_ACCESS_DSM_SHUNT = 0x434, + ADEMCO_CONTACTID_ACCESS_READER_DISABLE = 0x501, + ADEMCO_CONTACTID_SOUNDER_RELAY_DISABLE = 0x520, + ADEMCO_CONTACTID_BELL_1_DISABLE = 0x521, + ADEMCO_CONTACTID_BELL_2_DISABLE = 0x522, + ADEMCO_CONTACTID_ALARM_RELAY_DISABLE = 0x523, + ADEMCO_CONTACTID_TROUBLE_RELAY_DISABLE = 0x524, + ADEMCO_CONTACTID_REVERSING_RELAY_DISABLE = 0x525, + ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_3_DISABLE = 0x526, + ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_4_DISABLE = 0x527, + ADEMCO_CONTACTID_MODULE_ADDED = 0x531, + ADEMCO_CONTACTID_MODULE_REMOVED = 0x532, + ADEMCO_CONTACTID_DIALER_DISABLED = 0x551, + ADEMCO_CONTACTID_RADIO_TRANSMITTER_DISABLED = 0x552, + ADEMCO_CONTACTID_REMOTE_UPLOAD_DOWNLOAD_DISABLED = 0x553, + ADEMCO_CONTACTID_ZONE_SENSOR_BYPASS = 0x570, + ADEMCO_CONTACTID_FIRE_BYPASS = 0x571, + ADEMCO_CONTACTID_24_HOUR_ZONE_BYPASS = 0x572, + ADEMCO_CONTACTID_BURG_BYPASS = 0x573, + ADEMCO_CONTACTID_GROUP_BYPASS = 0x574, + ADEMCO_CONTACTID_SWINGER_BYPASS = 0x575, + ADEMCO_CONTACTID_ACCESS_ZONE_SHUNT = 0x576, + ADEMCO_CONTACTID_ACCESS_POINT_BYPASS = 0x577, + ADEMCO_CONTACTID_MANUAL_TRIGGER_TEST_REPORT = 0x601, + ADEMCO_CONTACTID_PERIODIC_TEST_REPORT = 0x602, + ADEMCO_CONTACTID_PERIODIC_RF_TRANSMISSION = 0x603, + ADEMCO_CONTACTID_FIRE_TEST = 0x604, + ADEMCO_CONTACTID_STATUS_REPORT_TO_FOLLOW = 0x605, + ADEMCO_CONTACTID_LISTENIN_TO_FOLLOW = 0x606, + ADEMCO_CONTACTID_WALK_TEST_MODE = 0x607, + ADEMCO_CONTACTID_PERIODIC_TEST__SYSTEM_TROUBLE_PRESENT = 0x608, + ADEMCO_CONTACTID_VIDEO_TRANSMITTER_ACTIVE = 0x609, + ADEMCO_CONTACTID_POINT_TESTED_OK = 0x611, + ADEMCO_CONTACTID_POINT_NOT_TESTED = 0x612, + ADEMCO_CONTACTID_INTRUSION_ZONE_WALK_TESTED = 0x613, + ADEMCO_CONTACTID_FIRE_ZONE_WALK_TESTED = 0x614, + ADEMCO_CONTACTID_PANIC_ZONE_WALK_TESTED = 0x615, + ADEMCO_CONTACTID_SERVICE_REQUEST = 0x616, + ADEMCO_CONTACTID_EVENT_LOG_RESET = 0x621, + ADEMCO_CONTACTID_EVENT_LOG_50PC_FULL = 0x622, + ADEMCO_CONTACTID_EVENT_LOG_90PC_FULL = 0x623, + ADEMCO_CONTACTID_EVENT_LOG_OVERFLOW = 0x624, + ADEMCO_CONTACTID_TIME_DATE_RESET = 0x625, + ADEMCO_CONTACTID_TIME_DATE_INACCURATE = 0x626, + ADEMCO_CONTACTID_PROGRAM_MODE_ENTRY = 0x627, + ADEMCO_CONTACTID_PROGRAM_MODE_EXIT = 0x628, + ADEMCO_CONTACTID_32_HOUR_EVENT_LOG_MARKER = 0x629, + ADEMCO_CONTACTID_SCHEDULE_CHANGE = 0x630, + ADEMCO_CONTACTID_EXCEPTION_SCHEDULE_CHANGE = 0x631, + ADEMCO_CONTACTID_ACCESS_SCHEDULE_CHANGE = 0x632, + ADEMCO_CONTACTID_SENIOR_WATCH_TROUBLE = 0x641, + ADEMCO_CONTACTID_LATCHKEY_SUPERVISION = 0x642, + ADEMCO_CONTACTID_RESERVED_FOR_ADEMCO_USE_1 = 0x651, + ADEMCO_CONTACTID_RESERVED_FOR_ADEMCO_USE_2 = 0x652, + ADEMCO_CONTACTID_RESERVED_FOR_ADEMCO_USE_3 = 0x653, + ADEMCO_CONTACTID_SYSTEM_INACTIVITY = 0x654, + ADEMCO_CONTACTID_DOWNLOAD_ABORT = 0x900, + ADEMCO_CONTACTID_DOWNLOAD_START_END = 0x901, + ADEMCO_CONTACTID_DOWNLOAD_INTERRUPTED = 0x902, + ADEMCO_CONTACTID_AUTOCLOSE_WITH_BYPASS = 0x910, + ADEMCO_CONTACTID_BYPASS_CLOSING = 0x911, + ADEMCO_CONTACTID_32_HOUR_NO_READ_OF_EVENT_LOG = 0x999 +}; + +typedef struct ademco_contactid_sender_state_s ademco_contactid_sender_state_t; + +typedef struct ademco_contactid_receiver_state_s ademco_contactid_receiver_state_t; + +typedef struct +{ + int acct; + int mt; + int q; + int xyz; + int gg; + int ccc; +} ademco_contactid_report_t; + +typedef void (*ademco_contactid_report_func_t)(void *user_data, const ademco_contactid_report_t *report); + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(const char *) ademco_contactid_msg_qualifier_to_str(int q); + +SPAN_DECLARE(const char *) ademco_contactid_event_to_str(int xyz); + +SPAN_DECLARE(int) encode_msg(char buf[], const ademco_contactid_report_t *report); + +SPAN_DECLARE(int) decode_msg(ademco_contactid_report_t *report, const char buf[]); + +SPAN_DECLARE(int) ademco_contactid_receiver_log_msg(ademco_contactid_receiver_state_t *s, const ademco_contactid_report_t *report); + +SPAN_DECLARE(int) ademco_contactid_receiver_tx(ademco_contactid_receiver_state_t *s, int16_t amp[], int max_samples); + +SPAN_DECLARE(int) ademco_contactid_receiver_rx(ademco_contactid_receiver_state_t *s, const int16_t amp[], int samples); + +SPAN_DECLARE(int) ademco_contactid_receiver_fillin(ademco_contactid_receiver_state_t *s, int samples); + +SPAN_DECLARE(logging_state_t *) ademco_contactid_receiver_get_logging_state(ademco_contactid_receiver_state_t *s); + +SPAN_DECLARE(void) ademco_contactid_receiver_set_realtime_callback(ademco_contactid_receiver_state_t *s, + ademco_contactid_report_func_t callback, + void *user_data); + +SPAN_DECLARE(ademco_contactid_receiver_state_t *) ademco_contactid_receiver_init(ademco_contactid_receiver_state_t *s, + ademco_contactid_report_func_t callback, + void *user_data); + +SPAN_DECLARE(int) ademco_contactid_receiver_release(ademco_contactid_receiver_state_t *s); + +SPAN_DECLARE(int) ademco_contactid_receiver_free(ademco_contactid_receiver_state_t *s); + + + +SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s, int16_t amp[], int max_samples); + +SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s, const int16_t amp[], int samples); + +SPAN_DECLARE(int) ademco_contactid_sender_fillin(ademco_contactid_sender_state_t *s, int samples); + +SPAN_DECLARE(int) ademco_contactid_sender_put(ademco_contactid_sender_state_t *s, const ademco_contactid_report_t *report); + +SPAN_DECLARE(logging_state_t *) ademco_contactid_sender_get_logging_state(ademco_contactid_sender_state_t *s); + +SPAN_DECLARE(void) ademco_contactid_sender_set_realtime_callback(ademco_contactid_sender_state_t *s, + tone_report_func_t callback, + void *user_data); + +SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ademco_contactid_sender_state_t *s, + tone_report_func_t callback, + void *user_data); + +SPAN_DECLARE(int) ademco_contactid_sender_release(ademco_contactid_sender_state_t *s); + +SPAN_DECLARE(int) ademco_contactid_sender_free(ademco_contactid_sender_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/expose.h b/libs/spandsp/src/spandsp/expose.h index ac10084535..75c16f2405 100644 --- a/libs/spandsp/src/spandsp/expose.h +++ b/libs/spandsp/src/spandsp/expose.h @@ -93,6 +93,7 @@ #include #include #include +#include #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/private/ademco_contactid.h b/libs/spandsp/src/spandsp/private/ademco_contactid.h new file mode 100644 index 0000000000..bada9193a1 --- /dev/null +++ b/libs/spandsp/src/spandsp/private/ademco_contactid.h @@ -0,0 +1,95 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/ademco_contactid.h - Ademco ContactID alarm protocol + * + * Written by Steve Underwood + * + * Copyright (C) 2012 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_) +#define _SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_ + +struct ademco_contactid_receiver_state_s +{ + ademco_contactid_report_func_t callback; + void *callback_user_data; + + int step; + int remaining_samples; + uint32_t tone_phase; + int32_t tone_phase_rate; + int16_t tone_level; + dtmf_rx_state_t dtmf; + + char rx_digits[16 + 1]; + int rx_digits_len; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +struct ademco_contactid_sender_state_s +{ + tone_report_func_t callback; + void *callback_user_data; + + int step; + int remaining_samples; + + dtmf_tx_state_t dtmf; +#if defined(SPANDSP_USE_FIXED_POINT) + /*! Minimum acceptable tone level for detection. */ + int32_t threshold; + /*! The accumlating total energy on the same period over which the Goertzels work. */ + int32_t energy; +#else + /*! Minimum acceptable tone level for detection. */ + float threshold; + /*! The accumlating total energy on the same period over which the Goertzels work. */ + float energy; +#endif + goertzel_state_t tone_1400; + goertzel_state_t tone_2300; + /*! The current sample number within a processing block. */ + int current_sample; + + /*! \brief A buffer to save the sent message, in case we need to retry. */ + char tx_digits[16 + 1]; + int tx_digits_len; + /*! \brief The number of consecutive retries. */ + int tries; + + int tone_state; + int duration; + int last_hit; + int in_tone; + int clear_to_send; + int timer; + + int busy; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 68a5c901c3..92564fcb0e 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -2534,7 +2534,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) we sent - which would have been a T30_MCF - If the block is for the previous page, or the previous block of the current page, we can assume we have hit this condition. */ - if (((s->rx_page_number & 0xFF) == page && (s->ecm_block & 0xFF) == block) + if (((s->rx_page_number & 0xFF) == page && ((s->ecm_block - 1) & 0xFF) == block) || (((s->rx_page_number - 1) & 0xFF) == page && s->ecm_block == 0)) { @@ -2568,7 +2568,6 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) for (j = 0; j < 8; j++) { frame_no = (i << 3) + j; -#if defined(VET_ALL_FCD_FRAMES) if (s->ecm_len[frame_no] >= 0) { /* The correct pattern of frame lengths is they will all be 64 or 256 octets long, except the @@ -2598,7 +2597,6 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) } } } -#endif if (s->ecm_len[frame_no] < 0) { s->ecm_frame_map[i + 3] |= (1 << j); diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 03552efc41..85022b8d54 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -383,7 +383,6 @@ static void hdlc_underflow_handler(void *user_data) { t38_gateway_state_t *s; t38_gateway_hdlc_state_t *t; - int old_data_type; s = (t38_gateway_state_t *) user_data; t = &s->core.hdlc_to_modem; @@ -392,7 +391,6 @@ static void hdlc_underflow_handler(void *user_data) underflow must be an end of preamble condition. */ if ((t->buf[t->out].flags & HDLC_FLAG_PROCEED_WITH_OUTPUT)) { - old_data_type = t->buf[t->out].contents; t->buf[t->out].len = 0; t->buf[t->out].flags = 0; t->buf[t->out].contents = 0; @@ -2117,6 +2115,7 @@ static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit) static int restart_rx_modem(t38_gateway_state_t *s) { + fax_modems_state_t *t; put_bit_func_t put_bit_func; void *put_bit_user_data; @@ -2138,19 +2137,20 @@ static int restart_rx_modem(t38_gateway_state_t *s) s->core.short_train, s->core.ecm_mode); - hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s); - s->audio.modems.rx_signal_present = FALSE; - s->audio.modems.rx_trained = FALSE; + t = &s->audio.modems; + hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s); + t->rx_signal_present = FALSE; + t->rx_trained = FALSE; /* Default to the transmit data being V.21, unless a faster modem pops up trained. */ s->t38x.current_tx_data_type = T38_DATA_V21; - fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx)); + fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &t->hdlc_rx); #if 0 - fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -45.5f); + fsk_rx_signal_cutoff(&t->v21_rx, -45.5f); #endif if (s->core.image_data_mode && s->core.ecm_mode) { put_bit_func = (put_bit_func_t) t38_hdlc_rx_put_bit; - put_bit_user_data = (void *) &(s->audio.modems.hdlc_rx); + put_bit_user_data = (void *) &t->hdlc_rx; } else { @@ -2166,26 +2166,26 @@ static int restart_rx_modem(t38_gateway_state_t *s) s->core.to_t38.octets_per_data_packet = 1; switch (s->core.fast_rx_modem) { - case FAX_MODEM_V17_RX: - v17_rx_restart(&s->audio.modems.fast_modems.v17_rx, s->core.fast_bit_rate, s->core.short_train); - v17_rx_set_put_bit(&s->audio.modems.fast_modems.v17_rx, put_bit_func, put_bit_user_data); - set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s); - s->core.fast_rx_active = FAX_MODEM_V17_RX; - break; case FAX_MODEM_V27TER_RX: - v27ter_rx_restart(&s->audio.modems.fast_modems.v27ter_rx, s->core.fast_bit_rate, FALSE); - v27ter_rx_set_put_bit(&s->audio.modems.fast_modems.v27ter_rx, put_bit_func, put_bit_user_data); + v27ter_rx_restart(&t->fast_modems.v27ter_rx, s->core.fast_bit_rate, FALSE); + v27ter_rx_set_put_bit(&t->fast_modems.v27ter_rx, put_bit_func, put_bit_user_data); set_rx_handler(s, &v27ter_v21_rx, &v27ter_v21_rx_fillin, s); s->core.fast_rx_active = FAX_MODEM_V27TER_RX; break; case FAX_MODEM_V29_RX: - v29_rx_restart(&s->audio.modems.fast_modems.v29_rx, s->core.fast_bit_rate, FALSE); - v29_rx_set_put_bit(&s->audio.modems.fast_modems.v29_rx, put_bit_func, put_bit_user_data); + v29_rx_restart(&t->fast_modems.v29_rx, s->core.fast_bit_rate, FALSE); + v29_rx_set_put_bit(&t->fast_modems.v29_rx, put_bit_func, put_bit_user_data); set_rx_handler(s, &v29_v21_rx, &v29_v21_rx_fillin, s); s->core.fast_rx_active = FAX_MODEM_V29_RX; break; + case FAX_MODEM_V17_RX: + v17_rx_restart(&t->fast_modems.v17_rx, s->core.fast_bit_rate, s->core.short_train); + v17_rx_set_put_bit(&t->fast_modems.v17_rx, put_bit_func, put_bit_user_data); + set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s); + s->core.fast_rx_active = FAX_MODEM_V17_RX; + break; default: - set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &(s->audio.modems.v21_rx)); + set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx); s->core.fast_rx_active = FAX_MODEM_NONE; break; } diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index 1a2c3eca2e..1efa1b09d6 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -152,9 +152,12 @@ enum T38_TIMED_STEP_NO_SIGNAL = 0x60 }; -static __inline__ void front_end_status(t38_terminal_state_t *s, int status) +static __inline__ int front_end_status(t38_terminal_state_t *s, int status) { t30_front_end_status(&s->t30, status); + if (s->t38_fe.timed_step == T38_TIMED_STEP_NONE) + return -1; + return 0; } /*- End of function --------------------------------------------------------*/ @@ -749,6 +752,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) contain data. Hopefully, following the current spec will not cause compatibility issues. */ len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet); + if (len < 0) + return -1; + /*endif*/ if (len > 0) bit_reverse(buf, buf, len); /*endif*/ @@ -776,7 +782,8 @@ static int stream_non_ecm(t38_terminal_state_t *s) return res; /*endif*/ fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; - front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0) + return -1; break; } /*endif*/ @@ -806,7 +813,8 @@ static int stream_non_ecm(t38_terminal_state_t *s) if (fe->us_per_tx_chunk) delay = bits_to_us(s, 8*len) + 60000; /*endif*/ - front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0) + return -1; break; } /*endif*/ @@ -910,7 +918,8 @@ static int stream_hdlc(t38_terminal_state_t *s) previous = fe->current_tx_data_type; fe->hdlc_tx.ptr = 0; fe->hdlc_tx.len = 0; - front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0) + return -1; /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */ if (fe->hdlc_tx.len >= 0) { @@ -940,7 +949,8 @@ static int stream_hdlc(t38_terminal_state_t *s) if (fe->us_per_tx_chunk) delay += 100000; /*endif*/ - front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0) + return -1; } /*endif*/ break; @@ -969,7 +979,8 @@ static int stream_hdlc(t38_terminal_state_t *s) previous = fe->current_tx_data_type; fe->hdlc_tx.ptr = 0; fe->hdlc_tx.len = 0; - front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0) + return -1; /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */ if (fe->hdlc_tx.len >= 0) { @@ -1003,7 +1014,8 @@ static int stream_hdlc(t38_terminal_state_t *s) if (fe->us_per_tx_chunk) delay += 100000; /*endif*/ - front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0) + return -1; } /*endif*/ break; @@ -1059,7 +1071,8 @@ static int stream_ced(t38_terminal_state_t *s) case T38_TIMED_STEP_CED_3: /* End of CED */ fe->timed_step = fe->queued_timed_step; - front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); + if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0) + return -1; return 0; } /*endswitch*/ diff --git a/libs/spandsp/src/timezone.c b/libs/spandsp/src/timezone.c index 04dfa51daf..79966f1d4c 100644 --- a/libs/spandsp/src/timezone.c +++ b/libs/spandsp/src/timezone.c @@ -112,9 +112,11 @@ static const int year_lengths[2] = DAYS_PER_LEAP_YEAR }; -static int increment_overflow(int *number, int delta) +static int add_with_overflow_detection(int *number, int delta) { - int last_number; + /* This needs to be considered volatile, or clever optimisation destroys + the effect of the the rollover detection logic */ + volatile int last_number; last_number = *number; *number += delta; @@ -209,7 +211,7 @@ static struct tm *time_sub(const time_t * const timep, const long int offset, co if (idelta == 0) idelta = (tdays < 0) ? -1 : 1; newy = y; - if (increment_overflow(&newy, idelta)) + if (add_with_overflow_detection(&newy, idelta)) return NULL; leapdays = leaps_thru_end_of(newy - 1) - leaps_thru_end_of(y - 1); tdays -= ((time_t) newy - y)*DAYS_PER_NON_LEAP_YEAR; @@ -234,18 +236,18 @@ static struct tm *time_sub(const time_t * const timep, const long int offset, co } while (idays < 0) { - if (increment_overflow(&y, -1)) + if (add_with_overflow_detection(&y, -1)) return NULL; idays += year_lengths[isleap(y)]; } while (idays >= year_lengths[isleap(y)]) { idays -= year_lengths[isleap(y)]; - if (increment_overflow(&y, 1)) + if (add_with_overflow_detection(&y, 1)) return NULL; } tmp->tm_year = y; - if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE)) + if (add_with_overflow_detection(&tmp->tm_year, -TM_YEAR_BASE)) return NULL; tmp->tm_yday = idays; /* The "extra" mods below avoid overflow problems. */ diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index bb26644b62..b35d5fa4e9 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -567,9 +567,11 @@ SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch) static void v18_rx_dtmf(void *user_data, const char digits[], int len) { +#if 0 v18_state_t *s; s = (v18_state_t *) user_data; +#endif } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/v8.c b/libs/spandsp/src/v8.c index 78f2904bac..906f96ba95 100644 --- a/libs/spandsp/src/v8.c +++ b/libs/spandsp/src/v8.c @@ -124,7 +124,7 @@ SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function) case V8_CALL_FUNCTION_EXTENSION: return "Call function is in extension octet"; } - return "???"; + return "Unknown call function"; } /*- End of function --------------------------------------------------------*/ @@ -199,7 +199,7 @@ SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access) case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR: return "DCE on digital, and answering and calling modems on cellular"; } - return "???"; + return "PSTN access unknown"; } /*- End of function --------------------------------------------------------*/ @@ -235,7 +235,7 @@ SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availa case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE: return "V.91 and V.90/V.92 digital/analogue available"; } - return "???"; + return "PCM availability unknown"; } /*- End of function --------------------------------------------------------*/ @@ -374,6 +374,7 @@ static const uint8_t *process_pstn_access(v8_state_t *s, const uint8_t *p) static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p) { + /* TODO: This is wrong */ s->result.nsf = (*p >> 5) & 0x07; span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_nsf_to_str(s->result.nsf)); return p; diff --git a/libs/spandsp/tests/Makefile.am b/libs/spandsp/tests/Makefile.am index 401e8f41e6..c370f20a46 100644 --- a/libs/spandsp/tests/Makefile.am +++ b/libs/spandsp/tests/Makefile.am @@ -50,7 +50,8 @@ INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$(pk LIBDIR = -L$(top_builddir)/src -noinst_PROGRAMS = adsi_tests \ +noinst_PROGRAMS = ademco_contactid_tests \ + adsi_tests \ async_tests \ at_interpreter_tests \ awgn_tests \ @@ -134,6 +135,9 @@ noinst_HEADERS = echo_monitor.h \ pcap_parse.h \ udptl.h +ademco_contactid_tests_SOURCES = ademco_contactid_tests.c +ademco_contactid_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + adsi_tests_SOURCES = adsi_tests.c adsi_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp diff --git a/libs/spandsp/tests/ademco_contactid_tests.c b/libs/spandsp/tests/ademco_contactid_tests.c new file mode 100644 index 0000000000..c8e87f1fb8 --- /dev/null +++ b/libs/spandsp/tests/ademco_contactid_tests.c @@ -0,0 +1,391 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * ademco_contactid.c - Ademco ContactID alarm protocol + * + * Written by Steve Underwood + * + * Copyright (C) 2012 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \page ademco_contactid_tests_page Ademco ContactID tests +\section ademco_contactid_tests_page_sec_1 What does it do? + +\section ademco_contactid_tests_page_sec_2 How does it work? +*/ + +/* Enable the following definition to enable direct probing into the FAX structures */ +//#define WITH_SPANDSP_INTERNALS + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +//#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" +#include "spandsp-sim.h" + +#define SAMPLES_PER_CHUNK 160 + +#define OUTPUT_FILE_NAME "ademco_contactid.wav" + +#define MITEL_DIR "../test-data/mitel/" +#define BELLCORE_DIR "../test-data/bellcore/" + +const char *bellcore_files[] = +{ + MITEL_DIR "mitel-cm7291-talkoff.wav", + BELLCORE_DIR "tr-tsy-00763-1.wav", + BELLCORE_DIR "tr-tsy-00763-2.wav", + BELLCORE_DIR "tr-tsy-00763-3.wav", + BELLCORE_DIR "tr-tsy-00763-4.wav", + BELLCORE_DIR "tr-tsy-00763-5.wav", + BELLCORE_DIR "tr-tsy-00763-6.wav", + "" +}; + +static const ademco_contactid_report_t reports[] = +{ + {0x1234, 0x18, 0x1, 0x131, 0x1, 0x15}, + {0x1234, 0x18, 0x3, 0x131, 0x1, 0x15}, + {0x1234, 0x18, 0x1, 0x401, 0x2, 0x3}, + {0x1234, 0x18, 0x3, 0x401, 0x3, 0x5}, + {0x1234, 0x56, 0x7, 0x890, 0xBC, 0xDEF}, + {0x1234, 0x56, 0x7, 0x89A, 0xBC, 0xDEF} /* This one is bad, as it contains a hex 'A' */ +}; +static int reports_entry = 0; + +static int16_t amp[1000000]; + +int tx_callback_reported = FALSE; +int rx_callback_reported = FALSE; + +int sending_complete = FALSE; + +SNDFILE *outhandle; + +static void talkoff_tx_callback(void *user_data, int tone, int level, int duration) +{ + printf("Ademco sender report %d\n", tone); + tx_callback_reported = TRUE; +} + +static int mitel_cm7291_side_2_and_bellcore_tests(void) +{ + int j; + SNDFILE *inhandle; + int frames; + ademco_contactid_sender_state_t *sender; + logging_state_t *logging; + + if ((sender = ademco_contactid_sender_init(NULL, talkoff_tx_callback, NULL)) == NULL) + return -1; + logging = ademco_contactid_sender_get_logging_state(sender); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "Ademco-tx"); + + tx_callback_reported = FALSE; + + /* The remainder of the Mitel tape is the talk-off test */ + /* Here we use the Bellcore test tapes (much tougher), in six + files - 1 from each side of the original 3 cassette tapes */ + /* Bellcore say you should get no more than 470 false detections with + a good receiver. Dialogic claim 20. Of course, we can do better than + that, eh? */ + printf("Talk-off test\n"); + for (j = 0; bellcore_files[j][0]; j++) + { + if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL) + { + printf(" Cannot open speech file '%s'\n", bellcore_files[j]); + return -1; + } + while ((frames = sf_readf_short(inhandle, amp, SAMPLE_RATE))) + { + ademco_contactid_sender_rx(sender, amp, frames); + } + if (sf_close_telephony(inhandle)) + { + printf(" Cannot close speech file '%s'\n", bellcore_files[j]); + return -1; + } + printf(" File %d gave %d false hits.\n", j + 1, 0); + } + if (tx_callback_reported) + { + printf(" Failed\n"); + return -1; + } + printf(" Passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void rx_callback(void *user_data, const ademco_contactid_report_t *report) +{ + printf("Ademco Contact ID message:\n"); + printf(" Account %X\n", report->acct); + printf(" Message type %X\n", report->mt); + printf(" Qualifier %X\n", report->q); + printf(" Event %X\n", report->xyz); + printf(" Group/partition %X\n", report->gg); + printf(" User/Zone information %X\n", report->ccc); + if (memcmp(&reports[reports_entry], report, sizeof (*report))) + { + printf("Report mismatch\n"); + exit(2); + } + rx_callback_reported = TRUE; +} +/*- End of function --------------------------------------------------------*/ + +static void tx_callback(void *user_data, int tone, int level, int duration) +{ + ademco_contactid_sender_state_t *sender; + + sender = (ademco_contactid_sender_state_t *) user_data; + printf("Ademco sender report %d\n", tone); + switch (tone) + { + case -1: + /* We are connected and ready to send */ + ademco_contactid_sender_put(sender, &reports[reports_entry]); + break; + case 1: + /* We have succeeded in sending, and are ready to send another message. */ + if (++reports_entry < 5) + ademco_contactid_sender_put(sender, &reports[reports_entry]); + else + sending_complete = TRUE; + break; + case 0: + /* Sending failed after retries */ + sending_complete = TRUE; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +static int end_to_end_tests(void) +{ + ademco_contactid_receiver_state_t *receiver; + ademco_contactid_sender_state_t *sender; + logging_state_t *logging; + codec_munge_state_t *munge; + awgn_state_t noise_source; + int16_t amp[SAMPLES_PER_CHUNK]; + int16_t sndfile_buf[2*SAMPLES_PER_CHUNK]; + int samples; + int i; + int j; + + printf("End to end tests\n"); + + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + + if ((receiver = ademco_contactid_receiver_init(NULL, rx_callback, NULL)) == NULL) + return -1; + ademco_contactid_receiver_set_realtime_callback(receiver, rx_callback, receiver); + + logging = ademco_contactid_receiver_get_logging_state(receiver); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "Ademco-rx"); + + if ((sender = ademco_contactid_sender_init(NULL, tx_callback, NULL)) == NULL) + return -1; + ademco_contactid_sender_set_realtime_callback(sender, tx_callback, sender); + logging = ademco_contactid_sender_get_logging_state(sender); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "Ademco-tx"); + + awgn_init_dbm0(&noise_source, 1234567, -50); + munge = codec_munge_init(MUNGE_CODEC_ALAW, 0); + + sending_complete = FALSE; + rx_callback_reported = FALSE; + + for (i = 0; i < 1000; i++) + { + samples = ademco_contactid_sender_tx(sender, amp, SAMPLES_PER_CHUNK); + for (j = samples; j < SAMPLES_PER_CHUNK; j++) + amp[j] = 0; + for (j = 0; j < SAMPLES_PER_CHUNK; j++) + sndfile_buf[2*j] = amp[j]; + /* There is no point in impairing this signal. It is just DTMF tones, which + will work as wel as the DTMF detector beign used. */ + ademco_contactid_receiver_rx(receiver, amp, SAMPLES_PER_CHUNK); + + samples = ademco_contactid_receiver_tx(receiver, amp, SAMPLES_PER_CHUNK); + for (j = samples; j < SAMPLES_PER_CHUNK; j++) + amp[j] = 0; + + /* We add AWGN and codec impairments to the signal, to stress the tone detector. */ + codec_munge(munge, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < SAMPLES_PER_CHUNK; j++) + { + sndfile_buf[2*j + 1] = amp[j]; + /* Add noise to the tones */ + amp[j] += awgn(&noise_source); + } + codec_munge(munge, amp, SAMPLES_PER_CHUNK); + ademco_contactid_sender_rx(sender, amp, SAMPLES_PER_CHUNK); + + sf_writef_short(outhandle, sndfile_buf, SAMPLES_PER_CHUNK); + } + if (!rx_callback_reported) + { + fprintf(stderr, " Report not received\n"); + return -1; + } + + if (sf_close_telephony(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + return -1; + } + printf(" Passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int encode_decode_tests(void) +{ + char buf[100]; + ademco_contactid_receiver_state_t *receiver; + ademco_contactid_sender_state_t *sender; + logging_state_t *logging; + ademco_contactid_report_t result; + int i; + + printf("Encode and decode tests\n"); + + if ((receiver = ademco_contactid_receiver_init(NULL, NULL, NULL)) == NULL) + return 2; + logging = ademco_contactid_receiver_get_logging_state(receiver); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "Ademco-rx"); + + if ((sender = ademco_contactid_sender_init(NULL, NULL, NULL)) == NULL) + return 2; + logging = ademco_contactid_sender_get_logging_state(sender); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "Ademco-tx"); + + for (i = 0; i < 5; i++) + { + if (encode_msg(buf, &reports[i]) < 0) + { + printf("Bad encode message\n"); + return -1; + } + printf("'%s'\n", buf); + if (decode_msg(&result, buf)) + { + printf("Bad decode message\n"); + return -1; + } + ademco_contactid_receiver_log_msg(receiver, &result); + printf("\n"); + if (memcmp(&reports[i], &result, sizeof(result))) + { + printf("Received message does not match the one sent\n"); + return -1; + } + } + + if (encode_msg(buf, &reports[5]) >= 0) + { + printf("Incorrectly good message\n"); + return -1; + } + printf("'%s'\n", buf); + printf("\n"); + printf(" Passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void decode_file(const char *file) +{ + //SPAN_DECLARE(int) decode_msg(ademco_contactid_report_t *report, const char buf[]) +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + int opt; + const char *decode_test_file; + + decode_test_file = NULL; + while ((opt = getopt(argc, argv, "d:")) != -1) + { + switch (opt) + { + case 'd': + decode_test_file = optarg; + break; + default: + //usage(); + exit(2); + break; + } + } + + if (decode_test_file) + { + decode_file(decode_test_file); + return 0; + } + + if (encode_decode_tests()) + { + printf("Tests failed\n"); + return 2; + } + + if (mitel_cm7291_side_2_and_bellcore_tests()) + { + printf("Tests failed\n"); + return 2; + } + + if (end_to_end_tests()) + { + printf("Tests failed\n"); + return 2; + } + + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/echo_tests.c b/libs/spandsp/tests/echo_tests.c index 86b6cda961..2bf0d68799 100644 --- a/libs/spandsp/tests/echo_tests.c +++ b/libs/spandsp/tests/echo_tests.c @@ -633,20 +633,20 @@ static int perform_test_sanity(void) int16_t tx; int16_t clean; int far_tx; - int16_t far_sound[SAMPLE_RATE]; + //int16_t far_sound[SAMPLE_RATE]; int16_t result_sound[64000]; int result_cur; int outframes; - int local_cur; - int far_cur; + //int local_cur; + //int far_cur; //int32_t coeffs[200][128]; //int coeff_index; print_test_title("Performing basic sanity test\n"); ctx = echo_can_init(TEST_EC_TAPS, 0); - local_cur = 0; - far_cur = 0; + //local_cur = 0; + //far_cur = 0; result_cur = 0; echo_can_flush(ctx); @@ -684,7 +684,7 @@ static int perform_test_sanity(void) far_tx = 0; } #else - far_sound[0] = 0; + //far_sound[0] = 0; far_tx = 0; #endif rx = channel_model(&chan_model, tx, far_tx); diff --git a/libs/spandsp/tests/fax_decode.c b/libs/spandsp/tests/fax_decode.c index dd60fe9280..e175a6168b 100644 --- a/libs/spandsp/tests/fax_decode.c +++ b/libs/spandsp/tests/fax_decode.c @@ -89,7 +89,7 @@ int decode_test = FALSE; int rx_bits = 0; t30_state_t t30_dummy; -t4_state_t t4_state; +t4_state_t t4_rx_state; int t4_up = FALSE; hdlc_rx_state_t hdlcrx; @@ -291,12 +291,12 @@ static void t4_begin(void) int i; //printf("Begin T.4 - %d %d %d %d\n", line_encoding, x_resolution, y_resolution, image_width); - t4_rx_set_rx_encoding(&t4_state, line_encoding); - t4_rx_set_x_resolution(&t4_state, x_resolution); - t4_rx_set_y_resolution(&t4_state, y_resolution); - t4_rx_set_image_width(&t4_state, image_width); + t4_rx_set_rx_encoding(&t4_rx_state, line_encoding); + t4_rx_set_x_resolution(&t4_rx_state, x_resolution); + t4_rx_set_y_resolution(&t4_rx_state, y_resolution); + t4_rx_set_image_width(&t4_rx_state, image_width); - t4_rx_start_page(&t4_state); + t4_rx_start_page(&t4_rx_state); t4_up = TRUE; for (i = 0; i < 256; i++) @@ -316,13 +316,13 @@ static void t4_end(void) for (i = 0; i < 256; i++) { if (ecm_len[i] > 0) - t4_rx_put_chunk(&t4_state, ecm_data[i], ecm_len[i]); + t4_rx_put_chunk(&t4_rx_state, ecm_data[i], ecm_len[i]); fprintf(stderr, "%d", (ecm_len[i] <= 0) ? 0 : 1); } fprintf(stderr, "\n"); } - t4_rx_end_page(&t4_state); - t4_rx_get_transfer_statistics(&t4_state, &stats); + t4_rx_end_page(&t4_rx_state); + t4_rx_get_transfer_statistics(&t4_rx_state, &stats); fprintf(stderr, "Pages = %d\n", stats.pages_transferred); fprintf(stderr, "Image size = %dx%d\n", stats.width, stats.length); fprintf(stderr, "Image resolution = %dx%d\n", stats.x_resolution, stats.y_resolution); @@ -378,7 +378,7 @@ static void v17_put_bit(void *user_data, int bit) } else { - if (t4_rx_put_bit(&t4_state, bit)) + if (t4_rx_put_bit(&t4_rx_state, bit)) { t4_end(); fprintf(stderr, "End of page detected\n"); @@ -414,7 +414,7 @@ static void v29_put_bit(void *user_data, int bit) } else { - if (t4_rx_put_bit(&t4_state, bit)) + if (t4_rx_put_bit(&t4_rx_state, bit)) { t4_end(); fprintf(stderr, "End of page detected\n"); @@ -450,7 +450,7 @@ static void v27ter_put_bit(void *user_data, int bit) } else { - if (t4_rx_put_bit(&t4_state, bit)) + if (t4_rx_put_bit(&t4_rx_state, bit)) { t4_end(); fprintf(stderr, "End of page detected\n"); @@ -527,7 +527,7 @@ int main(int argc, char *argv[]) span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); #endif - if (t4_rx_init(&t4_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL) + if (t4_rx_init(&t4_rx_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL) { fprintf(stderr, "Failed to init\n"); exit(0); @@ -543,7 +543,7 @@ int main(int argc, char *argv[]) v29_rx(v29, amp, len); //v27ter_rx(v27ter, amp, len); } - t4_rx_release(&t4_state); + t4_rx_release(&t4_rx_state); if (sf_close(inhandle)) { diff --git a/libs/spandsp/tests/fax_tester.c b/libs/spandsp/tests/fax_tester.c index 79e8a09ae8..20af011981 100644 --- a/libs/spandsp/tests/fax_tester.c +++ b/libs/spandsp/tests/fax_tester.c @@ -271,14 +271,11 @@ static void non_ecm_rx_status(void *user_data, int status) static void non_ecm_put_bit(void *user_data, int bit) { - faxtester_state_t *s; - if (bit < 0) { non_ecm_rx_status(user_data, bit); return; } - s = (faxtester_state_t *) user_data; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index bd29f3bf34..3c78fe51a2 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -18,7 +18,7 @@ run_fax_test() { rm -f fax_tests_1.tif - echo -i ${FILE} ${OPTS} -i ${FILE} + echo ./fax_tests -i ${FILE} ${OPTS} -i ${FILE} ./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2 RETVAL=$? if [ $RETVAL != 0 ] @@ -28,7 +28,7 @@ run_fax_test() fi # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t # option means the normal differences in tags will be ignored. - tiffcmp -t ${FILE} fax_tests.tif #>/dev/null + tiffcmp -t ${FILE} fax_tests.tif >/dev/null RETVAL=$? if [ $RETVAL != 0 ] then diff --git a/libs/spandsp/tests/g722_tests.c b/libs/spandsp/tests/g722_tests.c index c33d9e67b6..863ea3e63d 100644 --- a/libs/spandsp/tests/g722_tests.c +++ b/libs/spandsp/tests/g722_tests.c @@ -307,7 +307,7 @@ static void itu_compliance_tests(void) /* Get the upper reference output data */ len_comp_upper = get_test_vector(decode_test_files[file + 4], itu_ref_upper, MAX_TEST_VECTOR_LEN); - if (len_data != len_comp_lower || len_data != len_comp_lower) + if (len_data != len_comp_lower || len_data != len_comp_upper) { printf("Test data length mismatch\n"); exit(2); diff --git a/libs/spandsp/tests/regression_tests.sh b/libs/spandsp/tests/regression_tests.sh index 4f32ebbc32..fe1e1a8ad9 100755 --- a/libs/spandsp/tests/regression_tests.sh +++ b/libs/spandsp/tests/regression_tests.sh @@ -634,7 +634,7 @@ do done echo v27ter_tests completed OK -for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -58" "-b 4800 -s -42 -n -55" +for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -59" "-b 4800 -s -42 -n -55" do ./v29_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? diff --git a/libs/spandsp/tests/schedule_tests.c b/libs/spandsp/tests/schedule_tests.c index 81c467c927..a9fa466199 100644 --- a/libs/spandsp/tests/schedule_tests.c +++ b/libs/spandsp/tests/schedule_tests.c @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) int i; span_sched_state_t sched; uint64_t when; - + span_schedule_init(&sched); span_schedule_event(&sched, 500000, callback1, NULL); diff --git a/libs/spandsp/tests/super_tone_rx_tests.c b/libs/spandsp/tests/super_tone_rx_tests.c index 717768d0c5..b9b673855d 100644 --- a/libs/spandsp/tests/super_tone_rx_tests.c +++ b/libs/spandsp/tests/super_tone_rx_tests.c @@ -410,7 +410,6 @@ static int detection_range_tests(super_tone_rx_state_t *super) int16_t amp[SAMPLES_PER_CHUNK]; int i; int j; - int x; uint32_t phase; int32_t phase_inc; int scale; @@ -427,7 +426,7 @@ static int detection_range_tests(super_tone_rx_state_t *super) { for (i = 0; i < SAMPLES_PER_CHUNK; i++) amp[i] = (dds(&phase, phase_inc)*scale) >> 15; - x = super_tone_rx(super, amp, SAMPLES_PER_CHUNK); + super_tone_rx(super, amp, SAMPLES_PER_CHUNK); } } return 0; diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index aa78e5dfba..74587fbb90 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -80,6 +80,8 @@ int test_local_interrupt = FALSE; const char *output_tiff_file_name; +int log_audio = FALSE; + fax_state_t *fax; faxtester_state_t state; @@ -1058,10 +1060,8 @@ static void exchange(faxtester_state_t *s) int len; int i; int total_audio_time; - int log_audio; logging_state_t *logging; - log_audio = TRUE; output_tiff_file_name = OUTPUT_TIFF_FILE_NAME; if (log_audio) @@ -1295,10 +1295,14 @@ int main(int argc, char *argv[]) xml_file_name = "../spandsp/tsb85.xml"; test_name = "MRGN01"; - while ((opt = getopt(argc, argv, "x:")) != -1) + log_audio = FALSE; + while ((opt = getopt(argc, argv, "lx:")) != -1) { switch (opt) { + case 'l': + log_audio = TRUE; + break; case 'x': xml_file_name = optarg; break; From 7f418621563334f02ea8ba8d1f21b28c157c15c8 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 2 Jul 2012 09:04:15 -0500 Subject: [PATCH 0590/1057] build fix for recent spandsp commit - windows --- libs/spandsp/src/libspandsp.2010.vcxproj | 3 +++ libs/spandsp/src/libspandsp.2010.vcxproj.filters | 14 ++++++++++++++ libs/spandsp/src/msvc/spandsp.h | 1 + 3 files changed, 18 insertions(+) diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj b/libs/spandsp/src/libspandsp.2010.vcxproj index bb2ae97878..393a1b6d45 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj +++ b/libs/spandsp/src/libspandsp.2010.vcxproj @@ -155,6 +155,7 @@ + @@ -239,6 +240,7 @@ + @@ -279,6 +281,7 @@ + diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj.filters b/libs/spandsp/src/libspandsp.2010.vcxproj.filters index 2a6d60a9d4..c75936a851 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj.filters +++ b/libs/spandsp/src/libspandsp.2010.vcxproj.filters @@ -253,6 +253,12 @@ Source Files + + Source Files + + + Source Files + @@ -660,6 +666,14 @@ Header Files + + + + Header Files + + + Header Files + diff --git a/libs/spandsp/src/msvc/spandsp.h b/libs/spandsp/src/msvc/spandsp.h index 95ee8bf11b..ba0bc280d6 100644 --- a/libs/spandsp/src/msvc/spandsp.h +++ b/libs/spandsp/src/msvc/spandsp.h @@ -118,6 +118,7 @@ #include #include #include +#include #include #include #include From 784fcf08ad8b36abfab90553edba7719f4ce0e32 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 09:50:58 -0500 Subject: [PATCH 0591/1057] FS-4373 --resolve --- .../endpoints/mod_dingaling/mod_dingaling.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 6136ed47ce..c47f589d68 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1935,12 +1935,14 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) ldl_session_destroy(&tech_pvt->dlsession); } - switch_thread_rwlock_unlock(tech_pvt->profile->rwlock); - - if (tech_pvt->profile->purge) { - mdl_profile_t *profile = tech_pvt->profile; - if (switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name); + if (tech_pvt->profile) { + switch_thread_rwlock_unlock(tech_pvt->profile->rwlock); + + if (tech_pvt->profile->purge) { + mdl_profile_t *profile = tech_pvt->profile; + if (switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name); + } } } } @@ -2450,6 +2452,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi return SWITCH_CAUSE_NORMAL_UNSPECIFIED; } + + + if (!ldl_handle_ready(mdl_profile->handle)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Doh! we are not logged in yet!\n"); terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -2473,6 +2478,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_core_session_add_stream(*new_session, NULL); if ((tech_pvt = (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object))) != 0) { memset(tech_pvt, 0, sizeof(*tech_pvt)); + tech_pvt->profile = mdl_profile; switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(*new_session)); tech_pvt->flags |= globals.flags; tech_pvt->flags |= mdl_profile->flags; @@ -2563,7 +2569,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } switch_safe_free(f_cid_msg); - tech_pvt->profile = mdl_profile; + ldl_session_set_private(dlsession, *new_session); ldl_session_set_value(dlsession, "dnis", dnis); ldl_session_set_value(dlsession, "caller_id_name", outbound_profile->caller_id_name); From 195949f25fb8fec61749f6366f1b01122ab19697 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 2 Jul 2012 11:55:49 -0400 Subject: [PATCH 0592/1057] don't seg on no valid_terminators --- 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 c483ccfbed..c15da6fb03 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1882,7 +1882,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, int term_required = 0; - if (*valid_terminators == '=') { + if (valid_terminators && *valid_terminators == '=') { term_required = 1; } From 104bab6b9217a0f86e68fc5f68ccb3be37b08ef1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 12:33:13 -0500 Subject: [PATCH 0593/1057] tdd fix --- src/mod/applications/mod_spandsp/mod_spandsp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 25a180ef84..f79bea68ac 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -403,7 +403,7 @@ SWITCH_STANDARD_API(start_send_tdd_api) } - if (!(psession = switch_core_session_locate(cmd))) { + if (!(psession = switch_core_session_locate(puuid))) { stream->write_function(stream, "-ERR Cannot locate session\n"); goto end; } @@ -736,6 +736,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) SWITCH_ADD_API(api_interface, "uuid_send_tdd", "send tdd data to a uuid", start_send_tdd_api, " "); + switch_console_set_complete("add uuid_send_tdd ::console::list_uuid"); + if ((switch_event_bind(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL) != SWITCH_STATUS_SUCCESS)) { From 158f96651fa019bdba1a8eaa68c554b2b967525a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 11:04:10 -0500 Subject: [PATCH 0594/1057] add trailing newlines for lazy parsers --- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index b01a4638a3..bec0172dea 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -121,7 +121,7 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "TDD MESSAGE"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(pvt->session)); - switch_event_add_body(event, "%s", (char *)msg); + switch_event_add_body(event, "%s\n\n", (char *)msg); if (switch_core_session_get_partner(pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) { From e06bf26e65a1088aff8dcb42578c4ec7b72a15cc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 11:05:56 -0500 Subject: [PATCH 0595/1057] add tdd data also as a header for even lazier parsers --- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index bec0172dea..a3439ed612 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -120,6 +120,7 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", "mod_spandsp"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "TDD MESSAGE"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "TDD-Data", (char *)msg); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(pvt->session)); switch_event_add_body(event, "%s\n\n", (char *)msg); From 4654bda84aee989a59e8bb51fc1c34981653797f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 11:20:05 -0500 Subject: [PATCH 0596/1057] FS-4374 try this: it will set the stack size for the whole app to 240 if its too big or too small, if there are system limits, fs may have to be run as root and drop privs to be allowed to change this setting --- src/switch.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/switch.c b/src/switch.c index 3903a15604..30a6f1e7e1 100644 --- a/src/switch.c +++ b/src/switch.c @@ -793,12 +793,11 @@ int main(int argc, char *argv[]) memset(&rlp, 0, sizeof(rlp)); getrlimit(RLIMIT_STACK, &rlp); - if (rlp.rlim_max > SWITCH_THREAD_STACKSIZE) { + if (rlp.rlim_cur != SWITCH_THREAD_STACKSIZE) { char buf[1024] = ""; int i = 0; - - fprintf(stderr, "Error: stacksize %d is too large: run ulimit -s %d from your shell before starting the application.\nauto-adjusting stack size for optimal performance...\n", - (int) (rlp.rlim_max / 1024), SWITCH_THREAD_STACKSIZE / 1024); + fprintf(stderr, "Error: stacksize %d is not optimal: run ulimit -s %d from your shell before starting the application.\nauto-adjusting stack size for optimal performance...\n", + (int) (rlp.rlim_cur / 1024), SWITCH_THREAD_STACKSIZE / 1024); memset(&rlp, 0, sizeof(rlp)); rlp.rlim_cur = SWITCH_THREAD_STACKSIZE; From d32a72bcc10af5aadf8ec6611254392f2291067a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 11:49:42 -0500 Subject: [PATCH 0597/1057] show current process stack size from status command where supported --- .../applications/mod_commands/mod_commands.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 65518dc0d3..dd29136dca 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1721,6 +1721,14 @@ SWITCH_STANDARD_API(lan_addr_function) return SWITCH_STATUS_SUCCESS; } +#include "switch_private.h" +#ifndef WIN32 +#ifdef HAVE_SETRLIMIT +#include +#endif +#endif + + SWITCH_STANDARD_API(status_function) { uint8_t html = 0; @@ -1728,6 +1736,11 @@ SWITCH_STANDARD_API(status_function) char *http = NULL; int sps = 0, last_sps = 0; const char *var; +#ifdef HAVE_SETRLIMIT + struct rlimit rlp; +#endif + + switch_core_measure_time(switch_core_uptime(), &duration); @@ -1764,6 +1777,14 @@ SWITCH_STANDARD_API(status_function) stream->write_function(stream, "%d session(s) max\n", switch_core_session_limit(0)); stream->write_function(stream, "min idle cpu %0.2f/%0.2f\n", switch_core_min_idle_cpu(-1.0), switch_core_idle_cpu()); +#ifdef HAVE_SETRLIMIT + memset(&rlp, 0, sizeof(rlp)); + getrlimit(RLIMIT_STACK, &rlp); + + stream->write_function(stream, "Current Stack Size/Max %ldK/%ldK\n", rlp.rlim_cur / 1024, rlp.rlim_max / 1024); +#endif + + if (html) { stream->write_function(stream, "\n"); } From c62fcb23e9183e3eed20742c50807ce3ea358b96 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 2 Jul 2012 12:00:02 -0700 Subject: [PATCH 0598/1057] Update phrase_en.xml in preparation for new recordings. --- docs/phrase/phrase_en.xml | 41 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 0fd09dd217..e2e10650d3 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -528,10 +528,45 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c583224be1f8cc58334a3eca642b1beb6efa7116 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 2 Jul 2012 14:30:39 -0500 Subject: [PATCH 0599/1057] FS-4375 --resolve --- scripts/gentls_cert.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gentls_cert.in b/scripts/gentls_cert.in index e397e97d61..26da60c7f8 100644 --- a/scripts/gentls_cert.in +++ b/scripts/gentls_cert.in @@ -82,7 +82,7 @@ setup_ca() { openssl req -out "${CONFDIR}/CA/cacert.pem" \ -new -x509 -keyout "${CONFDIR}/CA/cakey.pem" \ - -config "${TMPFILE}.cfg" -nodes -sha1 >/dev/null || exit 1 + -config "${TMPFILE}.cfg" -nodes -days ${DAYS} -sha1 >/dev/null || exit 1 cat "${CONFDIR}/CA/cacert.pem" > "${CONFDIR}/cafile.pem" rm "${TMPFILE}.cfg" From b2df2ee1d766437f6fbf9705cefe9be3648cd0d1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 14:24:14 -0500 Subject: [PATCH 0600/1057] FS-4376 --resolve update and repeat 'make spandsp-reconf' --- libs/spandsp/configure.ac | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index 9783f0a685..b1c7156794 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -316,14 +316,32 @@ if test -n "$enable_tests" ; then AC_LANG([C]) fi + +saved_CFLAGS="$CFLAGS" AX_CHECK_EXPORT_CAPABILITY([$host], [AC_DEFINE([SPANDSP_USE_EXPORT_CAPABILITY], [1], [Use the library symbol export capability of the compiler]) SPANDSP_USE_EXPORT_CAPABILITY="#define SPANDSP_USE_EXPORT_CAPABILITY 1"], [SPANDSP_USE_EXPORT_CAPABILITY="#undef SPANDSP_USE_EXPORT_CAPABILITY"]) +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) +CFLAGS="$saved_CFLAGS" + + case "${ax_cv_c_compiler_vendor}" in gnu) - COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + + + if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then + COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS" + + fi + + if test "$enable_avx" = "yes" ; then COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS" fi @@ -384,7 +402,13 @@ sun) REMOVE_FROM_VAR(CFLAGS, -Xc) ;; intel) - COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + + if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then + COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS" + + fi + if test "$enable_avx" = "yes" ; then COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS" fi From 78addbfe447e5afc64386d2c6d6f0bee8aa74601 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 2 Jul 2012 14:42:06 -0500 Subject: [PATCH 0601/1057] trivial fix windows build --- src/mod/applications/mod_commands/mod_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index dd29136dca..9ba5b9dcca 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1721,8 +1721,8 @@ SWITCH_STANDARD_API(lan_addr_function) return SWITCH_STATUS_SUCCESS; } -#include "switch_private.h" #ifndef WIN32 +#include "switch_private.h" #ifdef HAVE_SETRLIMIT #include #endif From 412efaaf870ff562056568df143576f42911224a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 12:53:52 -0500 Subject: [PATCH 0602/1057] let campon_hold_music take precedence over the normal hold_music variable --- 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 344544f705..814e541be8 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2870,7 +2870,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) } if (!zstr(moh) && !strcasecmp(moh, "silence")) { - moh = NULL; + moh = "silence_stream://0"; } do { From 87eeaac629aff297dc947c7f02399927c18f5c42 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 13:02:18 -0500 Subject: [PATCH 0603/1057] wrong commit --- src/mod/applications/mod_dptools/mod_dptools.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 814e541be8..3e47062a1d 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2865,12 +2865,12 @@ SWITCH_STANDARD_APP(audio_bridge_function) camp_data = (char *) data; } - if (!(moh = switch_channel_get_hold_music(caller_channel))) { - moh = switch_channel_get_variable(caller_channel, "campon_hold_music"); + if (!(moh = switch_channel_get_variable(caller_channel, "campon_hold_music"))) { + moh = switch_channel_get_hold_music(caller_channel); } if (!zstr(moh) && !strcasecmp(moh, "silence")) { - moh = "silence_stream://0"; + moh = NULL; } do { From 02c2b532e7efada029cc06657f70dc24c2164c71 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 2 Jul 2012 16:20:10 -0400 Subject: [PATCH 0604/1057] add vm::maintenance event for mwi change --- src/mod/applications/mod_voicemail/mod_voicemail.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index d3438aacfc..de44945e8e 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1815,6 +1815,7 @@ static void update_mwi(vm_profile_t *profile, const char *id, const char *domain int total_new_urgent_messages = 0; int total_saved_urgent_messages = 0; switch_event_t *event; + switch_event_t *message_event; message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages, &total_new_urgent_messages, &total_saved_urgent_messages); @@ -1831,6 +1832,18 @@ static void update_mwi(vm_profile_t *profile, const char *id, const char *domain switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages); switch_event_fire(&event); + + + switch_event_create_subclass(&message_event, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT); + switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Action", "mwi-update"); + switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-User", id); + switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name); + switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-New", "%d", total_new_messages); + switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-Saved", "%d", total_saved_messages); + switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-New-Urgent", "%d", total_new_urgent_messages); + switch_event_add_header(message_event, SWITCH_STACK_BOTTOM, "VM-Total-Saved-Urgent", "%d", total_saved_urgent_messages); + + switch_event_fire(&message_event); } From 3951a187a016f213a288546277dbd686d51f295a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 14:02:57 -0500 Subject: [PATCH 0605/1057] FS-4331 please test this patch and regenerate logs if necessary --- src/mod/applications/mod_dptools/mod_dptools.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 3e47062a1d..570d4ce286 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3515,6 +3515,10 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio name = switch_core_session_sprintf(nsession, "pickup/%s", pickup); switch_channel_set_name(nchannel, name); switch_channel_set_variable(nchannel, "process_cdr", "false"); + switch_channel_set_variable(nchannel, "presence_id", NULL); + + switch_event_del_header(var_event, "presence_id"); + pickup_add_session(nsession, pickup); switch_channel_set_flag(nchannel, CF_PICKUP); @@ -3565,7 +3569,7 @@ SWITCH_STANDARD_APP(pickup_function) switch_channel_set_flag(pickup_channel, CF_CHANNEL_SWAP); switch_channel_set_variable(pickup_channel, "channel_swap_uuid", switch_core_session_get_uuid(session)); - + name = caller_profile->caller_id_name; num = caller_profile->caller_id_number; From 7b4b15b551964b3b67d52e6aac2e7fd33bb32f3b Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 2 Jul 2012 17:41:10 -0400 Subject: [PATCH 0606/1057] use var for automake --- bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5c9ab26f03..52d0cd15c0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -430,7 +430,7 @@ bootstrap_libs_post() { ldns) cd $BASEDIR/libs/ldns if test ! -x install-sh; then - ex automake --add-missing --copy + ex ${AUTOMAKE:-automake} --add-missing --copy ex rm -rf autom4te*.cache fi ;; From 6068534c8ebf3fd572ec4fa4bd450dffd5ab286c Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 2 Jul 2012 17:46:02 -0400 Subject: [PATCH 0607/1057] add to make sure config dir is there for AC_CONFIG_AUX_DIR --- libs/spandsp/config/.empty | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 libs/spandsp/config/.empty diff --git a/libs/spandsp/config/.empty b/libs/spandsp/config/.empty new file mode 100644 index 0000000000..e69de29bb2 From 3708c96257e4583827af8df469ff9f965ae0988e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 Jul 2012 14:55:45 -0500 Subject: [PATCH 0608/1057] add uuid to event socket apps --- .../mod_event_socket/mod_event_socket.c | 7 ++++++- src/switch_core_session.c | 13 ++++++++++++- src/switch_ivr.c | 7 +++++++ 3 files changed, 25 insertions(+), 2 deletions(-) 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 a7b62dfd63..c377080e63 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 @@ -2101,6 +2101,10 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if (!strncasecmp(cmd, "sendevent", 9)) { char *ename; const char *uuid = NULL; + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + switch_uuid_str(uuid_str, sizeof(uuid_str)); + + switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-UUID", uuid_str); strip_cr(cmd); @@ -2128,6 +2132,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if ((uuid = switch_event_get_header(*event, "unique-id"))) { switch_core_session_t *dsession; + if ((dsession = switch_core_session_locate(uuid))) { switch_core_session_queue_event(dsession, event); switch_core_session_rwunlock(dsession); @@ -2137,7 +2142,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if (*event) { switch_event_fire(event); } - switch_snprintf(reply, reply_len, "+OK"); + switch_snprintf(reply, reply_len, "+OK %s", uuid_str); goto done; } else if (!strncasecmp(cmd, "api ", 4)) { struct api_command_struct acs = { 0 }; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index c45e62a4f9..66c39f7056 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2221,10 +2221,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * const char *var; switch_channel_t *channel = switch_core_session_get_channel(session); char *expanded = NULL; - const char *app; + const char *app, *app_uuid_var; switch_core_session_message_t msg = { 0 }; char delim = ','; int scope = 0; + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + char *app_uuid = uuid_str; + + if ((app_uuid_var = switch_channel_get_variable(channel, "app_uuid"))) { + app_uuid = (char *)app_uuid_var; + switch_channel_set_variable(channel, "app_uuid", NULL); + } else { + switch_uuid_str(uuid_str, sizeof(uuid_str)); + } switch_assert(application_interface); @@ -2304,6 +2313,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * switch_channel_event_set_data(session->channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", expanded); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-UUID", app_uuid); switch_event_fire(&event); } @@ -2327,6 +2337,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", expanded); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Response", resp ? resp : "_none_"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-UUID", app_uuid); switch_event_fire(&event); } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index cac064b544..fb3852a353 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -530,6 +530,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se if (cmd_hash == CMD_EXECUTE) { char *app_name = switch_event_get_header(event, "execute-app-name"); + char *event_uuid = switch_event_get_header(event, "event-uuid"); char *app_arg = switch_event_get_header(event, "execute-app-arg"); char *content_type = switch_event_get_header(event, "content-type"); char *loop_h = switch_event_get_header(event, "loops"); @@ -598,6 +599,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n", switch_channel_get_name(channel), app_name, switch_str_nil(app_arg)); b4 = switch_micro_time_now(); + + if (event_uuid) { + switch_channel_set_variable(channel, "app_uuid", event_uuid); + } + + if (switch_core_session_execute_application(session, app_name, app_arg) != SWITCH_STATUS_SUCCESS) { if (!inner || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) switch_channel_clear_flag(channel, CF_BROADCAST); goto done; From 7d89f943614f06940696836692e64132fdf43620 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 3 Jul 2012 20:04:19 -0500 Subject: [PATCH 0609/1057] update cnam.cgi --- scripts/perl/cnam.cgi | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/scripts/perl/cnam.cgi b/scripts/perl/cnam.cgi index d7acaa9b49..5f777cc5e3 100755 --- a/scripts/perl/cnam.cgi +++ b/scripts/perl/cnam.cgi @@ -11,7 +11,7 @@ use Fcntl; my %params = map { $_ => get_data( $_ ) } param; -$ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); +$ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0, timeout => 3 }); sub get_data { my $name = shift; @@ -29,8 +29,6 @@ my $number = $params{number}; if($number =~ m/1?\d{10}/) { - - if($number =~ m/^1(\d{10})$/) { $number = $1; } @@ -42,21 +40,15 @@ if($number =~ m/1?\d{10}/) { } my $url = "https://api.opencnam.com/v1/phone/$number?format=text"; - - my $res = $ua->get( $url ); + my $code = $res->code; - if ($res->is_success) { + if ($code eq '200') { my $content = $res->decoded_content; - if ($content =~ m/^Invalid/) { - # API shouldn't return this crap. - print "UNKNOWN"; - } else { - # Cache the entry. - $cache{"$number"} = $content; - # print the entry. - print $content; - } + $cache{"$number"} = $content; + print $content; + } else { + print "UNKNOWN"; } } From 305aa77a15f689a71fa0109d42d579afc3187d40 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 3 Jul 2012 09:01:27 -0500 Subject: [PATCH 0610/1057] FS-2216 --resolve clang --- src/fs_encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fs_encode.c b/src/fs_encode.c index efd93738fc..7606138234 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) switch_codec_t codec = { 0 }; char buf[2048]; switch_size_t len = sizeof(buf)/2; - switch_memory_pool_t *pool; + switch_memory_pool_t *pool = NULL; int bitrate = 0; int blocksize; From f3a49366a13ddb08bda3384892c49042d64ec320 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 08:05:41 -0500 Subject: [PATCH 0611/1057] FS-4331 please test and post a new log if necessary --- src/include/switch_types.h | 1 + src/mod/applications/mod_dptools/mod_dptools.c | 1 + src/switch_channel.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index a9f17cb339..c5e1fab7b4 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1224,6 +1224,7 @@ typedef enum { CF_CHANNEL_SWAP, CF_PICKUP, CF_CONFIRM_BLIND_TRANSFER, + CF_NO_PRESENCE, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 570d4ce286..0937b37c3c 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3521,6 +3521,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio pickup_add_session(nsession, pickup); switch_channel_set_flag(nchannel, CF_PICKUP); + switch_channel_set_flag(nchannel, CF_NO_PRESENCE); goto done; diff --git a/src/switch_channel.c b/src/switch_channel.c index c214cfd881..8c36f64fe7 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -606,6 +606,10 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel, const char *call_info = NULL; char *call_info_state = "active"; + if (switch_channel_test_flag(channel, CF_NO_PRESENCE)) { + return; + } + if (!status) { type = SWITCH_EVENT_PRESENCE_OUT; } From 15fda06646ed74beed458da5a67196e177362bd0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 09:23:25 -0500 Subject: [PATCH 0612/1057] FS-4381 --resolve --- src/mod/endpoints/mod_sofia/mod_sofia.c | 94 ++++++++++++++----------- 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 2360f92a64..d5faa8e3c9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -491,6 +491,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) char reason[128] = ""; char *bye_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_BYE_HEADER_PREFIX); const char *val = NULL; + const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE); val = switch_channel_get_variable(tech_pvt->channel, "disable_q850_reason"); @@ -537,15 +538,57 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) const char *phrase; char *added_headers = NULL; - if (tech_pvt->respond_code) { - sip_cause = tech_pvt->respond_code; - } if (tech_pvt->respond_phrase) { phrase = su_strdup(nua_handle_home(tech_pvt->nh), tech_pvt->respond_phrase); } else { phrase = sip_status_phrase(sip_cause); } + + if (tech_pvt->respond_code) { + sip_cause = tech_pvt->respond_code; + switch (sip_cause) { + case 401: + case 407: + { + const char *to_host = switch_channel_get_variable(channel, "sip_challenge_realm"); + + if (zstr(to_host)) { + to_host = switch_channel_get_variable(channel, "sip_to_host"); + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Challenging call\n"); + sofia_reg_auth_challenge(tech_pvt->profile, tech_pvt->nh, NULL, REG_INVITE, to_host, 0); + *reason = '\0'; + } + break; + + case 484: + { + const char *to = switch_channel_get_variable(channel, "sip_to_uri"); + char *to_uri = NULL; + + if (to) { + char *p; + to_uri = switch_core_session_sprintf(session, "sip:%s", to); + if ((p = strstr(to_uri, ":5060"))) { + *p = '\0'; + } + + tech_pvt->respond_dest = to_uri; + + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", sip_cause, phrase); + + } + break; + + default: + break; + + } + } if (tech_pvt->respond_dest && !sofia_test_pflag(tech_pvt->profile, PFLAG_MANUAL_REDIRECT)) { added_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_HEADER_PREFIX); @@ -572,6 +615,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) TAG_IF(!zstr(resp_headers), SIPTAG_HEADER_STR(resp_headers)), TAG_IF(!zstr(added_headers), SIPTAG_HEADER_STR(added_headers)), TAG_IF(tech_pvt->respond_dest, SIPTAG_CONTACT_STR(tech_pvt->respond_dest)), + TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END()); switch_safe_free(resp_headers); @@ -2415,44 +2459,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } - if (code == 407 && !msg->numeric_arg) { - const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri"); - const char *to_host = reason; - - if (zstr(to_host)) { - to_host = switch_channel_get_variable(channel, "sip_to_host"); - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri); - sofia_reg_auth_challenge(tech_pvt->profile, tech_pvt->nh, NULL, REG_INVITE, to_host, 0); - switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE); - } else if (code == 484 && msg->numeric_arg) { - const char *to = switch_channel_get_variable(channel, "sip_to_uri"); - const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE); - char *cid = generate_pai_str(tech_pvt); - char *to_uri = NULL; - - if (to) { - char *p; - to_uri = switch_core_session_sprintf(session, "sip:%s", to); - if ((p = strstr(to_uri, ":5060"))) { - *p = '\0'; - } - } - - if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) { - char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason); - - nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)), - SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL), - TAG_IF(cid, SIPTAG_HEADER_STR(cid)), - TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), - TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END()); - - sofia_set_flag_locked(tech_pvt, TFLAG_BYE); - switch_safe_free(extra_headers); - } - } else if (code == 302 && !zstr(msg->string_arg)) { + if (code == 302 && !zstr(msg->string_arg)) { char *p; if ((p = strchr(msg->string_arg, ' '))) { @@ -2522,9 +2529,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } else { if (msg->numeric_arg) { if (code > 399) { + switch_call_cause_t cause = sofia_glue_sip_cause_to_freeswitch(code); + if (code == 401 || cause == 407) cause = SWITCH_CAUSE_USER_CHALLENGE; + tech_pvt->respond_code = code; tech_pvt->respond_phrase = switch_core_session_strdup(tech_pvt->session, reason); - switch_channel_hangup(tech_pvt->channel, sofia_glue_sip_cause_to_freeswitch(code)); + switch_channel_hangup(tech_pvt->channel, cause); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot respond.\n"); } From 2b17e82dd4920ccddc0c67c7cf91e3a7fc099b1d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 11:06:12 -0500 Subject: [PATCH 0613/1057] FS-4380 --resolve --- src/mod/applications/mod_sms/mod_sms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_sms/mod_sms.c b/src/mod/applications/mod_sms/mod_sms.c index ee13481c03..8b747cb015 100644 --- a/src/mod/applications/mod_sms/mod_sms.c +++ b/src/mod/applications/mod_sms/mod_sms.c @@ -262,7 +262,7 @@ static int parse_exten(switch_event_t *event, switch_xml_t xexten, switch_event_ if (xinline) { switch_core_execute_chat_app(event, application, app_data); } else { - switch_event_add_header_string(*extension, SWITCH_STACK_BOTTOM, application, zstr(data) ? "__undef" : data); + switch_event_add_header_string(*extension, SWITCH_STACK_BOTTOM, application, zstr(app_data) ? "__undef" : app_data); } } switch_safe_free(substituted); From c5ba5acbd565ef8aa167068655c4df81e1165c19 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 11:35:41 -0500 Subject: [PATCH 0614/1057] move stacksize thing into the core deeper to avoid build issues --- src/include/switch_core.h | 2 +- .../applications/mod_commands/mod_commands.c | 23 ++++-------------- src/switch_core.c | 24 +++++++++++++++++++ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 05d6e0aa48..179361dc96 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2332,7 +2332,7 @@ SWITCH_DECLARE(int) switch_max_file_desc(void); SWITCH_DECLARE(void) switch_close_extra_files(int *keep, int keep_ttl); SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu); SWITCH_DECLARE(void) switch_os_yield(void); - +SWITCH_DECLARE(switch_status_t) switch_core_get_stacksizes(switch_size_t *cur, switch_size_t *max); SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 9ba5b9dcca..d0399fcb42 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1721,14 +1721,6 @@ SWITCH_STANDARD_API(lan_addr_function) return SWITCH_STATUS_SUCCESS; } -#ifndef WIN32 -#include "switch_private.h" -#ifdef HAVE_SETRLIMIT -#include -#endif -#endif - - SWITCH_STANDARD_API(status_function) { uint8_t html = 0; @@ -1736,11 +1728,7 @@ SWITCH_STANDARD_API(status_function) char *http = NULL; int sps = 0, last_sps = 0; const char *var; -#ifdef HAVE_SETRLIMIT - struct rlimit rlp; -#endif - - + switch_size_t cur = 0, max = 0; switch_core_measure_time(switch_core_uptime(), &duration); @@ -1777,13 +1765,10 @@ SWITCH_STANDARD_API(status_function) stream->write_function(stream, "%d session(s) max\n", switch_core_session_limit(0)); stream->write_function(stream, "min idle cpu %0.2f/%0.2f\n", switch_core_min_idle_cpu(-1.0), switch_core_idle_cpu()); -#ifdef HAVE_SETRLIMIT - memset(&rlp, 0, sizeof(rlp)); - getrlimit(RLIMIT_STACK, &rlp); - - stream->write_function(stream, "Current Stack Size/Max %ldK/%ldK\n", rlp.rlim_cur / 1024, rlp.rlim_max / 1024); -#endif + if (switch_core_get_stacksizes(&cur, &max) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "Current Stack Size/Max %ldK/%ldK\n", cur / 1024, max / 1024); + } if (html) { stream->write_function(stream, "\n"); diff --git a/src/switch_core.c b/src/switch_core.c index 2a4cae408f..1ad1c1756e 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2647,6 +2647,30 @@ SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_han } +SWITCH_DECLARE(switch_status_t) switch_core_get_stacksizes(switch_size_t *cur, switch_size_t *max) +{ +#ifdef HAVE_SETRLIMIT + struct rlimit rlp; + + memset(&rlp, 0, sizeof(rlp)); + getrlimit(RLIMIT_STACK, &rlp); + + *cur = rlp.rlim_cur; + *max = rlp.rlim_max; + + return SWITCH_STATUS_SUCCESS; + +#else + + return SWITCH_STATUS_FALSE; + +#endif + + + +} + + SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream) { #ifdef WIN32 From 59bd4b0f14161f6c86285bcacd702b7b1e8003e1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 13:17:38 -0500 Subject: [PATCH 0615/1057] fix regression with proxy_packet flag --- 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 c8e6ff94cb..bbb3dfdb6e 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4426,7 +4426,8 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra return -1; } - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { + if (switch_test_flag(frame, SFF_PROXY_PACKET) || switch_test_flag(frame, SFF_UDPTL_PACKET) || + 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]; From e941a61ff72df3b7a0a76cfc5b51013d0b2c4d3f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 13:35:08 -0500 Subject: [PATCH 0616/1057] add v18_mode var --- .../mod_spandsp/mod_spandsp_dsp.c | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index a3439ed612..5a37af1f63 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -146,6 +146,36 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len) } +static int get_v18_mode(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *var; + int r = V18_MODE_BELL103; + + if ((var = switch_channel_get_variable(channel, "v18_mode"))) { + if (!strcasecmp(var, "5BIT_45") || !strcasecmp(var, "baudot")) { + r = V18_MODE_5BIT_45; + } else if (!strcasecmp(var, "5BIT_50")) { + r = V18_MODE_5BIT_50; + } else if (!strcasecmp(var, "DTMF")) { + r = V18_MODE_DTMF; + } else if (!strcasecmp(var, "EDT")) { + r = V18_MODE_EDT; + } else if (!strcasecmp(var, "BELL103") || !strcasecmp(var, "ascii")) { + r = V18_MODE_BELL103; + } else if (!strcasecmp(var, "V23VIDEOTEX")) { + r = V18_MODE_V23VIDEOTEX; + } else if (!strcasecmp(var, "V21TEXTPHONE")) { + r = V18_MODE_V21TEXTPHONE; + } else if (!strcasecmp(var, "V18TEXTPHONE")) { + r = V18_MODE_V18TEXTPHONE; + } + } + + return r; +} + + switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const char *text) { v18_state_t *tdd_state; @@ -176,9 +206,9 @@ switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const c return SWITCH_STATUS_FALSE; } - tdd_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, put_text_msg, NULL); - + tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL); + v18_put(tdd_state, text, -1); while(switch_channel_ready(channel)) { @@ -223,7 +253,7 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const } pvt->session = session; - pvt->tdd_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, put_text_msg, NULL); + pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL); pvt->head_lead = TDD_LEAD; v18_put(pvt->tdd_state, text, -1); @@ -301,7 +331,7 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session) } pvt->session = session; - pvt->tdd_state = v18_init(NULL, FALSE, V18_MODE_5BIT_45, put_text_msg, pvt); + pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), put_text_msg, pvt); if ((status = switch_core_media_bug_add(session, "spandsp_tdd_decode", NULL, tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { From 02f4aa85908af924934832bc6499fdc704e282f5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 13:53:29 -0500 Subject: [PATCH 0617/1057] change default --- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 5a37af1f63..b3616c7892 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -150,7 +150,7 @@ static int get_v18_mode(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); const char *var; - int r = V18_MODE_BELL103; + int r = V18_MODE_5BIT_45; if ((var = switch_channel_get_variable(channel, "v18_mode"))) { if (!strcasecmp(var, "5BIT_45") || !strcasecmp(var, "baudot")) { From b1ae97466d95ff68abdf8b84216dcecbdb3cbcc8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Jul 2012 17:15:14 -0500 Subject: [PATCH 0618/1057] add enable-use-system-time param to switch.conf.xml use at your own risk, someone with windows could verify it works ok --- src/include/private/switch_core_pvt.h | 2 ++ src/include/switch_core.h | 2 ++ src/switch_core.c | 5 +++- src/switch_time.c | 42 ++++++++++++++++++++++++--- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 0005008252..6d36bae008 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -213,6 +213,8 @@ typedef enum { struct switch_runtime { switch_time_t initiated; + switch_time_t mono_initiated; + switch_time_t mono_reference; switch_time_t reference; int64_t offset; switch_event_t *global_vars; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 179361dc96..d7e899e6e7 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2107,6 +2107,7 @@ SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_m \return the current epoch time in microseconds */ SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void); +SWITCH_DECLARE(switch_time_t) switch_mono_micro_time_now(void); SWITCH_DECLARE(void) switch_core_memory_reclaim(void); SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void); SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void); @@ -2130,6 +2131,7 @@ SWITCH_DECLARE(void) switch_time_set_timerfd(switch_bool_t enable); SWITCH_DECLARE(void) switch_time_set_nanosleep(switch_bool_t enable); SWITCH_DECLARE(void) switch_time_set_matrix(switch_bool_t enable); SWITCH_DECLARE(void) switch_time_set_cond_yield(switch_bool_t enable); +SWITCH_DECLARE(void) switch_time_set_use_system_time(switch_bool_t enable); SWITCH_DECLARE(uint32_t) switch_core_min_dtmf_duration(uint32_t duration); SWITCH_DECLARE(uint32_t) switch_core_max_dtmf_duration(uint32_t duration); SWITCH_DECLARE(double) switch_core_min_idle_cpu(double new_limit); diff --git a/src/switch_core.c b/src/switch_core.c index 1ad1c1756e..357f7d09cf 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1560,6 +1560,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc runtime.running = 1; runtime.initiated = switch_time_now(); + runtime.mono_initiated = switch_mono_micro_time_now(); switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL); @@ -1779,6 +1780,8 @@ static void switch_load_core_config(const char *file) if (tmp > 0) { switch_core_default_dtmf_duration((uint32_t) tmp); } + } else if (!strcasecmp(var, "enable-use-system-time")) { + switch_time_set_use_system_time(switch_true(val)); } else if (!strcasecmp(var, "enable-monotonic-timing")) { switch_time_set_monotonic(switch_true(val)); } else if (!strcasecmp(var, "enable-softtimer-timerfd")) { @@ -1990,7 +1993,7 @@ SWITCH_DECLARE(void) switch_core_measure_time(switch_time_t total_ms, switch_cor SWITCH_DECLARE(switch_time_t) switch_core_uptime(void) { - return switch_micro_time_now() - runtime.initiated; + return switch_mono_micro_time_now() - runtime.mono_initiated; } diff --git a/src/switch_time.c b/src/switch_time.c index d4f5454d3b..7cb47822d2 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -70,6 +70,9 @@ static int MONO = 1; static int MONO = 0; #endif + +static int SYSTEM_TIME = 0; + /* 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. */ @@ -140,6 +143,8 @@ typedef struct timer_matrix timer_matrix_t; static timer_matrix_t TIMER_MATRIX[MAX_ELEMENTS + 1]; +static switch_time_t time_now(int64_t offset); + SWITCH_DECLARE(void) switch_os_yield(void) { #if defined(WIN32) @@ -313,6 +318,11 @@ SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void) return (globals.RUNNING == 1 && runtime.timestamp) ? runtime.timestamp : switch_time_now(); } +SWITCH_DECLARE(switch_time_t) switch_mono_micro_time_now(void) +{ + return time_now(-1); +} + SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t) { @@ -334,6 +344,12 @@ SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable) } +SWITCH_DECLARE(void) switch_time_set_use_system_time(switch_bool_t enable) +{ + SYSTEM_TIME = enable; +} + + SWITCH_DECLARE(void) switch_time_set_timerfd(switch_bool_t enable) { #if defined(HAVE_TIMERFD_CREATE) @@ -376,9 +392,15 @@ static switch_time_t time_now(int64_t offset) if (MONO) { #ifndef WIN32 struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(offset ? CLOCK_MONOTONIC : CLOCK_REALTIME, &ts); + if (offset < 0) offset = 0; now = ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000) + offset; #else + if (offset == 0) { + return switch_time_now(); + } else if (offset < 0) offset = 0; + + if (win32_use_qpc) { /* Use QueryPerformanceCounter */ uint64_t count = 0; @@ -431,10 +453,22 @@ SWITCH_DECLARE(void) switch_time_sync(void) runtime.reference = switch_time_now(); - runtime.offset = runtime.reference - time_now(0); - runtime.reference = time_now(runtime.offset); + if (SYSTEM_TIME) { + runtime.reference = time_now(0); + runtime.mono_reference = time_now(-1); + runtime.offset = 0; + } else { + runtime.offset = runtime.reference - time_now(0); + runtime.reference = time_now(runtime.offset); + } + + if (runtime.reference - last_time > 1000000 || last_time == 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Clock synchronized to system time.\n"); + if (SYSTEM_TIME) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Clock is already configured to always report system time.\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Clock synchronized to system time.\n"); + } } last_time = runtime.reference; From 2b75169c077e01fb439124dd05a68894d635b03e Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 4 Jul 2012 22:51:46 +0800 Subject: [PATCH 0619/1057] A lot of tweaks to clean up some inconsistencies in spandsp. They should have no functional effect. --- libs/spandsp/spandsp-sim/make_line_models.c | 10 +- libs/spandsp/src/at_interpreter.c | 4 +- libs/spandsp/src/fax.c | 56 +++++------ libs/spandsp/src/fax_modems.c | 32 +++--- libs/spandsp/src/spandsp/at_interpreter.h | 10 +- .../src/spandsp/private/at_interpreter.h | 6 +- libs/spandsp/src/spandsp/private/fax_modems.h | 8 +- libs/spandsp/src/spandsp/private/t30.h | 16 +-- libs/spandsp/src/spandsp/private/t31.h | 4 +- libs/spandsp/src/spandsp/private/t38_core.h | 8 +- .../spandsp/src/spandsp/private/t38_gateway.h | 6 +- libs/spandsp/src/spandsp/private/v8.h | 2 +- libs/spandsp/src/spandsp/t30.h | 28 +++--- libs/spandsp/src/spandsp/t30_api.h | 10 +- libs/spandsp/src/spandsp/t31.h | 8 +- libs/spandsp/src/spandsp/t38_core.h | 16 +-- libs/spandsp/src/spandsp/t38_gateway.h | 14 +-- libs/spandsp/src/spandsp/t38_terminal.h | 2 +- libs/spandsp/src/spandsp/telephony.h | 8 +- libs/spandsp/src/spandsp/v8.h | 4 +- libs/spandsp/src/t30.c | 6 +- libs/spandsp/src/t30_api.c | 10 +- libs/spandsp/src/t31.c | 98 ++++++++++--------- libs/spandsp/src/t38_core.c | 8 +- libs/spandsp/src/t38_gateway.c | 58 +++++------ libs/spandsp/src/t38_terminal.c | 4 +- libs/spandsp/src/v8.c | 2 +- .../etsi/fax/generate_etsi_300_242_pages.c | 15 +-- libs/spandsp/tests/fax_tester.c | 44 ++++----- libs/spandsp/tests/t4_tests.c | 10 +- 30 files changed, 248 insertions(+), 259 deletions(-) diff --git a/libs/spandsp/spandsp-sim/make_line_models.c b/libs/spandsp/spandsp-sim/make_line_models.c index fd7b81f72f..300de80c22 100644 --- a/libs/spandsp/spandsp-sim/make_line_models.c +++ b/libs/spandsp/spandsp-sim/make_line_models.c @@ -787,7 +787,7 @@ static void generate_ad_edd(void) float offset; float amp; float phase; - float delay; + //float delay; float pw; #if defined(HAVE_FFTW3_H) double in[FFT_SIZE][2]; @@ -836,7 +836,7 @@ static void generate_ad_edd(void) amp = (1.0 - offset)*ad[l - 1].ad[j] + offset*ad[l].ad[j]; amp = pow(10.0, -amp/20.0); } - delay = 0.0f; + //delay = 0.0f; for (l = 0; l < (int) (sizeof(edd)/sizeof(edd[0])); l++) { if (f < edd[l].freq) @@ -845,7 +845,7 @@ static void generate_ad_edd(void) if (l < (int) (sizeof(edd)/sizeof(edd[0]))) { offset = (f - edd[l - 1].freq)/(edd[l].freq - edd[l - 1].freq); - delay = (1.0f - offset)*edd[l - 1].edd[k] + offset*edd[l].edd[k]; + //delay = (1.0f - offset)*edd[l - 1].edd[k] + offset*edd[l].edd[k]; } //phase = 2.0f*M_PI*f*delay*0.001f; phase = 0.0f; @@ -915,7 +915,7 @@ static void generate_proakis(void) float offset; float amp; float phase; - float delay; + //float delay; float pw; int index; int i; @@ -953,7 +953,7 @@ static void generate_proakis(void) /* Linear interpolation */ amp = ((1.0f - offset)*proakis[index].amp + offset*proakis[index + 1].amp)/2.3f; - delay = (1.0f - offset)*proakis[index].delay + offset*proakis[index + 1].delay; + //delay = (1.0f - offset)*proakis[index].delay + offset*proakis[index + 1].delay; //phase = 2.0f*M_PI*f*delay*0.001f; phase = 0.0f; #if defined(HAVE_FFTW3_H) diff --git a/libs/spandsp/src/at_interpreter.c b/libs/spandsp/src/at_interpreter.c index 73625ef8d7..ba29e55469 100644 --- a/libs/spandsp/src/at_interpreter.c +++ b/libs/spandsp/src/at_interpreter.c @@ -5501,9 +5501,9 @@ SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t hand /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s, - at_tx_handler_t *at_tx_handler, + at_tx_handler_t at_tx_handler, void *at_tx_user_data, - at_modem_control_handler_t *modem_control_handler, + at_modem_control_handler_t modem_control_handler, void *modem_control_user_data) { if (s == NULL) diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c index c5422e7a52..ce28fde882 100644 --- a/libs/spandsp/src/fax.c +++ b/libs/spandsp/src/fax.c @@ -173,8 +173,8 @@ static void hdlc_underflow_handler(void *user_data) /*- End of function --------------------------------------------------------*/ static void set_rx_handler(fax_state_t *s, - span_rx_handler_t *rx_handler, - span_rx_fillin_handler_t *fillin_handler, + span_rx_handler_t rx_handler, + span_rx_fillin_handler_t fillin_handler, void *user_data) { s->modems.rx_handler = rx_handler; @@ -183,14 +183,14 @@ static void set_rx_handler(fax_state_t *s, } /*- End of function --------------------------------------------------------*/ -static void fax_modems_set_tx_handler(fax_state_t *s, span_tx_handler_t *handler, void *user_data) +static void fax_modems_set_tx_handler(fax_state_t *s, span_tx_handler_t handler, void *user_data) { s->modems.tx_handler = handler; s->modems.tx_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -static void fax_modems_set_next_tx_handler(fax_state_t *s, span_tx_handler_t *handler, void *user_data) +static void fax_modems_set_next_tx_handler(fax_state_t *s, span_tx_handler_t handler, void *user_data) { s->modems.next_tx_handler = handler; s->modems.next_tx_user_data = user_data; @@ -209,7 +209,7 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len) { /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->fast_modems.v17_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v17_rx, (span_rx_fillin_handler_t *) &v17_rx_fillin, &s->fast_modems.v17_rx); + set_rx_handler(t, (span_rx_handler_t) &v17_rx, (span_rx_fillin_handler_t) &v17_rx_fillin, &s->fast_modems.v17_rx); } else { @@ -219,7 +219,7 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len) /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } } return 0; @@ -251,7 +251,7 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) { /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->fast_modems.v27ter_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, (span_rx_fillin_handler_t *) &v27ter_rx_fillin, &s->fast_modems.v27ter_rx); + set_rx_handler(t, (span_rx_handler_t) &v27ter_rx, (span_rx_fillin_handler_t) &v27ter_rx_fillin, &s->fast_modems.v27ter_rx); } else { @@ -261,7 +261,7 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } } return 0; @@ -293,7 +293,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) { /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->fast_modems.v29_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->fast_modems.v29_rx); + set_rx_handler(t, (span_rx_handler_t) &v29_rx, (span_rx_fillin_handler_t) &v29_rx_fillin, &s->fast_modems.v29_rx); } else { @@ -303,7 +303,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } } return 0; @@ -380,8 +380,8 @@ static int set_next_tx_type(fax_state_t *s) } /* If there is nothing else to change to, so use zero length silence */ silence_gen_alter(&t->silence_gen, 0); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); t->transmit = FALSE; return -1; } @@ -466,7 +466,7 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t case T30_MODEM_V21: fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data); fsk_rx_signal_cutoff(&t->v21_rx, -45.5f); - set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx); + set_rx_handler(s, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &t->v21_rx); break; case T30_MODEM_V27TER: v27ter_rx_restart(&t->fast_modems.v27ter_rx, bit_rate, FALSE); @@ -486,7 +486,7 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t case T30_MODEM_DONE: span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); default: - set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + set_rx_handler(s, (span_rx_handler_t) &span_dummy_rx, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, s); break; } } @@ -519,8 +519,8 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t { case T30_MODEM_PAUSE: silence_gen_alter(&t->silence_gen, ms_to_samples(short_train)); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); t->transmit = TRUE; break; case T30_MODEM_CED: @@ -530,8 +530,8 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t else tone = MODEM_CONNECT_TONES_FAX_CNG; modem_connect_tones_tx_init(&t->connect_tx, tone); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &modem_connect_tones_tx, &t->connect_tx); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); t->transmit = TRUE; break; case T30_MODEM_V21: @@ -543,8 +543,8 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t a 75ms gap before any V.21 transmission is harmless, adds little to the overall length of a call, and ensures the receiving end is ready. */ silence_gen_alter(&t->silence_gen, ms_to_samples(75)); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &fsk_tx, &t->v21_tx); t->transmit = TRUE; break; case T30_MODEM_V27TER: @@ -553,8 +553,8 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); v27ter_tx_restart(&t->fast_modems.v27ter_tx, bit_rate, t->use_tep); v27ter_tx_set_get_bit(&t->fast_modems.v27ter_tx, get_bit_func, get_bit_user_data); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->fast_modems.v27ter_tx); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx); t->transmit = TRUE; break; case T30_MODEM_V29: @@ -563,8 +563,8 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); v29_tx_restart(&t->fast_modems.v29_tx, bit_rate, t->use_tep); v29_tx_set_get_bit(&t->fast_modems.v29_tx, get_bit_func, get_bit_user_data); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->fast_modems.v29_tx); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx); t->transmit = TRUE; break; case T30_MODEM_V17: @@ -573,8 +573,8 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); v17_tx_restart(&t->fast_modems.v17_tx, bit_rate, t->use_tep, short_train); v17_tx_set_get_bit(&t->fast_modems.v17_tx, get_bit_func, get_bit_user_data); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->fast_modems.v17_tx); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx); t->transmit = TRUE; break; case T30_MODEM_DONE: @@ -582,8 +582,8 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t /* Fall through */ default: silence_gen_alter(&t->silence_gen, 0); - fax_modems_set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); t->transmit = FALSE; break; } diff --git a/libs/spandsp/src/fax_modems.c b/libs/spandsp/src/fax_modems.c index cad8594592..d684f03d54 100644 --- a/libs/spandsp/src/fax_modems.c +++ b/libs/spandsp/src/fax_modems.c @@ -98,8 +98,8 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t am /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - s->rx_handler = (span_rx_handler_t *) &fsk_rx; - s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin; + s->rx_handler = (span_rx_handler_t) &fsk_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; } return 0; @@ -129,8 +129,8 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - s->rx_handler = (span_rx_handler_t *) &fsk_rx; - s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin; + s->rx_handler = (span_rx_handler_t) &fsk_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; } return 0; @@ -160,8 +160,8 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t am /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - s->rx_handler = (span_rx_handler_t *) &fsk_rx; - s->rx_fillin_handler = (span_rx_fillin_handler_t *) &fsk_rx_fillin; + s->rx_handler = (span_rx_handler_t) &fsk_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; } return 0; @@ -181,9 +181,11 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len) static void v21_rx_status_handler(void *user_data, int status) { +#if 0 fax_modems_state_t *s; s = (fax_modems_state_t *) user_data; +#endif } /*- End of function --------------------------------------------------------*/ @@ -196,8 +198,8 @@ static void v17_rx_status_handler(void *user_data, int status) { case SIG_STATUS_TRAINING_SUCCEEDED: span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->fast_modems.v17_rx)); - s->rx_handler = (span_rx_handler_t *) &v17_rx; - s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v17_rx_fillin; + s->rx_handler = (span_rx_handler_t) &v17_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t) &v17_rx_fillin; s->rx_user_data = &s->fast_modems.v17_rx; break; } @@ -213,8 +215,8 @@ static void v27ter_rx_status_handler(void *user_data, int status) { case SIG_STATUS_TRAINING_SUCCEEDED: span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->fast_modems.v27ter_rx)); - s->rx_handler = (span_rx_handler_t *) &v27ter_rx; - s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v27ter_rx_fillin; + s->rx_handler = (span_rx_handler_t) &v27ter_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t) &v27ter_rx_fillin; s->rx_user_data = &s->fast_modems.v27ter_rx; break; } @@ -230,8 +232,8 @@ static void v29_rx_status_handler(void *user_data, int status) { case SIG_STATUS_TRAINING_SUCCEEDED: span_log(&s->logging, SPAN_LOG_FLOW, "Switching to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->fast_modems.v29_rx)); - s->rx_handler = (span_rx_handler_t *) &v29_rx; - s->rx_fillin_handler = (span_rx_fillin_handler_t *) &v29_rx_fillin; + s->rx_handler = (span_rx_handler_t) &v29_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t) &v29_rx_fillin; s->rx_user_data = &s->fast_modems.v29_rx; break; } @@ -315,10 +317,10 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, dc_restore_init(&s->dc_restore); s->rx_signal_present = FALSE; - s->rx_handler = (span_rx_handler_t *) &span_dummy_rx; - s->rx_fillin_handler = (span_rx_fillin_handler_t *) &span_dummy_rx; + s->rx_handler = (span_rx_handler_t) &span_dummy_rx; + s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx; s->rx_user_data = NULL; - s->tx_handler = (span_tx_handler_t *) &silence_gen; + s->tx_handler = (span_tx_handler_t) &silence_gen; s->tx_user_data = &s->silence_gen; return s; } diff --git a/libs/spandsp/src/spandsp/at_interpreter.h b/libs/spandsp/src/spandsp/at_interpreter.h index 6f844599f0..d4c8f0018e 100644 --- a/libs/spandsp/src/spandsp/at_interpreter.h +++ b/libs/spandsp/src/spandsp/at_interpreter.h @@ -38,9 +38,9 @@ modem control commands. typedef struct at_state_s at_state_t; -typedef int (at_modem_control_handler_t)(at_state_t *s, void *user_data, int op, const char *num); -typedef int (at_tx_handler_t)(at_state_t *s, void *user_data, const uint8_t *buf, size_t len); -typedef int (at_class1_handler_t)(at_state_t *s, void *user_data, int direction, int operation, int val); +typedef int (*at_modem_control_handler_t)(at_state_t *s, void *user_data, int op, const char *num); +typedef int (*at_tx_handler_t)(at_state_t *s, void *user_data, const uint8_t *buf, size_t len); +typedef int (*at_class1_handler_t)(at_state_t *s, void *user_data, int direction, int operation, int val); enum at_rx_mode_e { @@ -172,9 +172,9 @@ SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t hand \param modem_control_user_data x. \return A pointer to the AT context, or NULL if there was a problem. */ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s, - at_tx_handler_t *at_tx_handler, + at_tx_handler_t at_tx_handler, void *at_tx_user_data, - at_modem_control_handler_t *modem_control_handler, + at_modem_control_handler_t modem_control_handler, void *modem_control_user_data); /*! Release an AT interpreter context. diff --git a/libs/spandsp/src/spandsp/private/at_interpreter.h b/libs/spandsp/src/spandsp/private/at_interpreter.h index da13b5a2bb..a99dea9a35 100644 --- a/libs/spandsp/src/spandsp/private/at_interpreter.h +++ b/libs/spandsp/src/spandsp/private/at_interpreter.h @@ -113,11 +113,11 @@ struct at_state_s char line[256]; int line_ptr; - at_modem_control_handler_t *modem_control_handler; + at_modem_control_handler_t modem_control_handler; void *modem_control_user_data; - at_tx_handler_t *at_tx_handler; + at_tx_handler_t at_tx_handler; void *at_tx_user_data; - at_class1_handler_t *class1_handler; + at_class1_handler_t class1_handler; void *class1_user_data; /*! \brief Error and flow logging control */ diff --git a/libs/spandsp/src/spandsp/private/fax_modems.h b/libs/spandsp/src/spandsp/private/fax_modems.h index 4250198ded..f45969bb94 100644 --- a/libs/spandsp/src/spandsp/private/fax_modems.h +++ b/libs/spandsp/src/spandsp/private/fax_modems.h @@ -95,18 +95,18 @@ struct fax_modems_state_s int rx_frame_received; /*! \brief The current receive signal handler */ - span_rx_handler_t *rx_handler; + span_rx_handler_t rx_handler; /*! \brief The current receive missing signal fill-in handler */ - span_rx_fillin_handler_t *rx_fillin_handler; + span_rx_fillin_handler_t rx_fillin_handler; void *rx_user_data; /*! \brief The current transmit signal handler */ - span_tx_handler_t *tx_handler; + span_tx_handler_t tx_handler; void *tx_user_data; /*! The next transmit signal handler, for two stage transmit operations. E.g. a short silence followed by a modem signal. */ - span_tx_handler_t *next_tx_handler; + span_tx_handler_t next_tx_handler; void *next_tx_user_data; /*! The current bit rate of the transmitter. */ diff --git a/libs/spandsp/src/spandsp/private/t30.h b/libs/spandsp/src/spandsp/private/t30.h index 8cd890b9e0..a8f23c0197 100644 --- a/libs/spandsp/src/spandsp/private/t30.h +++ b/libs/spandsp/src/spandsp/private/t30.h @@ -94,42 +94,42 @@ struct t30_state_s /*! \brief A pointer to a callback routine to be called when phase B events occur. */ - t30_phase_b_handler_t *phase_b_handler; + t30_phase_b_handler_t phase_b_handler; /*! \brief An opaque pointer supplied in event B callbacks. */ void *phase_b_user_data; /*! \brief A pointer to a callback routine to be called when phase D events occur. */ - t30_phase_d_handler_t *phase_d_handler; + t30_phase_d_handler_t phase_d_handler; /*! \brief An opaque pointer supplied in event D callbacks. */ void *phase_d_user_data; /*! \brief A pointer to a callback routine to be called when phase E events occur. */ - t30_phase_e_handler_t *phase_e_handler; + t30_phase_e_handler_t phase_e_handler; /*! \brief An opaque pointer supplied in event E callbacks. */ void *phase_e_user_data; /*! \brief A pointer to a callback routine to be called when frames are exchanged. */ - t30_real_time_frame_handler_t *real_time_frame_handler; + t30_real_time_frame_handler_t real_time_frame_handler; /*! \brief An opaque pointer supplied in real time frame callbacks. */ void *real_time_frame_user_data; /*! \brief A pointer to a callback routine to be called when document events (e.g. end of transmitted document) occur. */ - t30_document_handler_t *document_handler; + t30_document_handler_t document_handler; /*! \brief An opaque pointer supplied in document callbacks. */ void *document_user_data; /*! \brief The handler for changes to the receive mode */ - t30_set_handler_t *set_rx_type_handler; + t30_set_handler_t set_rx_type_handler; /*! \brief An opaque pointer passed to the handler for changes to the receive mode */ void *set_rx_type_user_data; /*! \brief The handler for changes to the transmit mode */ - t30_set_handler_t *set_tx_type_handler; + t30_set_handler_t set_tx_type_handler; /*! \brief An opaque pointer passed to the handler for changes to the transmit mode */ void *set_tx_type_user_data; /*! \brief The transmitted HDLC frame handler. */ - t30_send_hdlc_handler_t *send_hdlc_handler; + t30_send_hdlc_handler_t send_hdlc_handler; /*! \brief An opaque pointer passed to the transmitted HDLC frame handler. */ void *send_hdlc_user_data; diff --git a/libs/spandsp/src/spandsp/private/t31.h b/libs/spandsp/src/spandsp/private/t31.h index ee481c5151..fafdf72341 100644 --- a/libs/spandsp/src/spandsp/private/t31.h +++ b/libs/spandsp/src/spandsp/private/t31.h @@ -36,7 +36,7 @@ typedef struct v8_state_t v8; /*! The transmit signal handler to be used when the current one has finished sending. */ - span_tx_handler_t *next_tx_handler; + span_tx_handler_t next_tx_handler; void *next_tx_user_data; /*! \brief No of data bits in current_byte. */ @@ -136,7 +136,7 @@ typedef struct struct t31_state_s { at_state_t at_state; - t31_modem_control_handler_t *modem_control_handler; + t31_modem_control_handler_t modem_control_handler; void *modem_control_user_data; t31_audio_front_end_state_t audio; diff --git a/libs/spandsp/src/spandsp/private/t38_core.h b/libs/spandsp/src/spandsp/private/t38_core.h index de0aac9d60..e965ca6f40 100644 --- a/libs/spandsp/src/spandsp/private/t38_core.h +++ b/libs/spandsp/src/spandsp/private/t38_core.h @@ -32,16 +32,16 @@ struct t38_core_state_s { /*! \brief Handler routine to transmit IFP packets generated by the T.38 protocol engine */ - t38_tx_packet_handler_t *tx_packet_handler; + t38_tx_packet_handler_t tx_packet_handler; /*! \brief An opaque pointer passed to tx_packet_handler */ void *tx_packet_user_data; /*! \brief Handler routine to process received indicator packets */ - t38_rx_indicator_handler_t *rx_indicator_handler; + t38_rx_indicator_handler_t rx_indicator_handler; /*! \brief Handler routine to process received data packets */ - t38_rx_data_handler_t *rx_data_handler; + t38_rx_data_handler_t rx_data_handler; /*! \brief Handler routine to process the missing packet condition */ - t38_rx_missing_handler_t *rx_missing_handler; + t38_rx_missing_handler_t rx_missing_handler; /*! \brief An opaque pointer passed to any of the above receive handling routines */ void *rx_user_data; diff --git a/libs/spandsp/src/spandsp/private/t38_gateway.h b/libs/spandsp/src/spandsp/private/t38_gateway.h index 54a935a270..d7cd549264 100644 --- a/libs/spandsp/src/spandsp/private/t38_gateway.h +++ b/libs/spandsp/src/spandsp/private/t38_gateway.h @@ -61,8 +61,8 @@ typedef struct fax_modems_state_t modems; /*! \brief The current receive signal handler. Actual receiving hops between this and a dummy receive routine. */ - span_rx_handler_t *base_rx_handler; - span_rx_fillin_handler_t *base_rx_fillin_handler; + span_rx_handler_t base_rx_handler; + span_rx_fillin_handler_t base_rx_fillin_handler; } t38_gateway_audio_state_t; /*! @@ -183,7 +183,7 @@ typedef struct /*! \brief A pointer to a callback routine to be called when frames are exchanged. */ - t38_gateway_real_time_frame_handler_t *real_time_frame_handler; + t38_gateway_real_time_frame_handler_t real_time_frame_handler; /*! \brief An opaque pointer supplied in real time frame callbacks. */ void *real_time_frame_user_data; } t38_gateway_core_state_t; diff --git a/libs/spandsp/src/spandsp/private/v8.h b/libs/spandsp/src/spandsp/private/v8.h index 2fb481d0b2..77dd55eea0 100644 --- a/libs/spandsp/src/spandsp/private/v8.h +++ b/libs/spandsp/src/spandsp/private/v8.h @@ -32,7 +32,7 @@ struct v8_state_s int calling_party; /*! \brief A handler to process the V.8 signals */ - v8_result_handler_t *result_handler; + v8_result_handler_t result_handler; /*! \brief An opaque pointer passed to result_handler */ void *result_handler_user_data; diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 2f97729859..8c0edffd83 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -158,7 +158,7 @@ typedef struct t30_state_s t30_state_t; \param result The phase B event code. \return The new status. Normally, T30_ERR_OK is returned. */ -typedef int (t30_phase_b_handler_t)(t30_state_t *s, void *user_data, int result); +typedef int (*t30_phase_b_handler_t)(t30_state_t *s, void *user_data, int result); /*! T.30 phase D callback handler. @@ -168,7 +168,7 @@ typedef int (t30_phase_b_handler_t)(t30_state_t *s, void *user_data, int result) \param result The phase D event code. \return The new status. Normally, T30_ERR_OK is returned. */ -typedef int (t30_phase_d_handler_t)(t30_state_t *s, void *user_data, int result); +typedef int (*t30_phase_d_handler_t)(t30_state_t *s, void *user_data, int result); /*! T.30 phase E callback handler. @@ -177,7 +177,7 @@ typedef int (t30_phase_d_handler_t)(t30_state_t *s, void *user_data, int result) \param user_data An opaque pointer. \param completion_code The phase E completion code. */ -typedef void (t30_phase_e_handler_t)(t30_state_t *s, void *user_data, int completion_code); +typedef void (*t30_phase_e_handler_t)(t30_state_t *s, void *user_data, int completion_code); /*! T.30 real time frame handler. @@ -188,11 +188,11 @@ typedef void (t30_phase_e_handler_t)(t30_state_t *s, void *user_data, int comple \param msg The HDLC message. \param len The length of the message. */ -typedef void (t30_real_time_frame_handler_t)(t30_state_t *s, - void *user_data, - int direction, - const uint8_t msg[], - int len); +typedef void (*t30_real_time_frame_handler_t)(t30_state_t *s, + void *user_data, + int direction, + const uint8_t msg[], + int len); /*! T.30 document handler. @@ -201,7 +201,7 @@ typedef void (t30_real_time_frame_handler_t)(t30_state_t *s, \param user_data An opaque pointer. \param result The document event code. */ -typedef int (t30_document_handler_t)(t30_state_t *s, void *user_data, int status); +typedef int (*t30_document_handler_t)(t30_state_t *s, void *user_data, int status); /*! T.30 set a receive or transmit type handler. @@ -212,7 +212,7 @@ typedef int (t30_document_handler_t)(t30_state_t *s, void *user_data, int status \param short_train TRUE if the short training sequence should be used (where one exists). \param use_hdlc FALSE for bit stream, TRUE for HDLC framing. */ -typedef void (t30_set_handler_t)(void *user_data, int type, int bit_rate, int short_train, int use_hdlc); +typedef void (*t30_set_handler_t)(void *user_data, int type, int bit_rate, int short_train, int use_hdlc); /*! T.30 send HDLC handler. @@ -221,7 +221,7 @@ typedef void (t30_set_handler_t)(void *user_data, int type, int bit_rate, int sh \param msg The HDLC message. \param len The length of the message. */ -typedef void (t30_send_hdlc_handler_t)(void *user_data, const uint8_t msg[], int len); +typedef void (*t30_send_hdlc_handler_t)(void *user_data, const uint8_t msg[], int len); /*! T.30 protocol completion codes, at phase E. @@ -572,11 +572,11 @@ extern "C" \return A pointer to the context, or NULL if there was a problem. */ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, int calling_party, - t30_set_handler_t *set_rx_type_handler, + t30_set_handler_t set_rx_type_handler, void *set_rx_type_user_data, - t30_set_handler_t *set_tx_type_handler, + t30_set_handler_t set_tx_type_handler, void *set_tx_type_user_data, - t30_send_hdlc_handler_t *send_hdlc_handler, + t30_send_hdlc_handler_t send_hdlc_handler, void *send_hdlc_user_data); /*! Release a T.30 context. diff --git a/libs/spandsp/src/spandsp/t30_api.h b/libs/spandsp/src/spandsp/t30_api.h index d758c8e871..08a0383634 100644 --- a/libs/spandsp/src/spandsp/t30_api.h +++ b/libs/spandsp/src/spandsp/t30_api.h @@ -507,28 +507,28 @@ SPAN_DECLARE(int) t30_set_receiver_not_ready(t30_state_t *s, int count); \param s The T.30 context. \param handler The callback function. \param user_data An opaque pointer passed to the callback function. */ -SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data); +SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t handler, void *user_data); /*! Set a callback function for T.30 phase D handling. \brief Set a callback function for T.30 phase D handling. \param s The T.30 context. \param handler The callback function. \param user_data An opaque pointer passed to the callback function. */ -SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data); +SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t handler, void *user_data); /*! Set a callback function for T.30 phase E handling. \brief Set a callback function for T.30 phase E handling. \param s The T.30 context. \param handler The callback function. \param user_data An opaque pointer passed to the callback function. */ -SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data); +SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t handler, void *user_data); /*! Set a callback function for T.30 end of document handling. \brief Set a callback function for T.30 end of document handling. \param s The T.30 context. \param handler The callback function. \param user_data An opaque pointer passed to the callback function. */ -SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data); +SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t handler, void *user_data); /*! Set a callback function for T.30 frame exchange monitoring. This is called from the heart of the signal processing, so don't take too long in the handler routine. @@ -536,7 +536,7 @@ SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler \param s The T.30 context. \param handler The callback function. \param user_data An opaque pointer passed to the callback function. */ -SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data); +SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t handler, void *user_data); /*! Get a pointer to the logging context associated with a T.30 context. \brief Get a pointer to the logging context associated with a T.30 context. diff --git a/libs/spandsp/src/spandsp/t31.h b/libs/spandsp/src/spandsp/t31.h index 25f826d42c..80a676b207 100644 --- a/libs/spandsp/src/spandsp/t31.h +++ b/libs/spandsp/src/spandsp/t31.h @@ -42,7 +42,7 @@ modems in spandsp. */ typedef struct t31_state_s t31_state_t; -typedef int (t31_modem_control_handler_t)(t31_state_t *s, void *user_data, int op, const char *num); +typedef int (*t31_modem_control_handler_t)(t31_state_t *s, void *user_data, int op, const char *num); #define T31_TX_BUF_LEN (4096) #define T31_TX_BUF_HIGH_TIDE (4096 - 1024) @@ -133,11 +133,11 @@ SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s); \param tx_t38_packet_user_data ??? \return A pointer to the T.31 context. */ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, - at_tx_handler_t *at_tx_handler, + at_tx_handler_t at_tx_handler, void *at_tx_user_data, - t31_modem_control_handler_t *modem_control_handler, + t31_modem_control_handler_t modem_control_handler, void *modem_control_user_data, - t38_tx_packet_handler_t *tx_t38_packet_handler, + t38_tx_packet_handler_t tx_t38_packet_handler, void *tx_t38_packet_user_data); /*! Release a T.31 context. diff --git a/libs/spandsp/src/spandsp/t38_core.h b/libs/spandsp/src/spandsp/t38_core.h index cda7a19b52..662cf8d37e 100644 --- a/libs/spandsp/src/spandsp/t38_core.h +++ b/libs/spandsp/src/spandsp/t38_core.h @@ -201,11 +201,11 @@ typedef struct */ typedef struct t38_core_state_s t38_core_state_t; -typedef int (t38_tx_packet_handler_t)(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count); +typedef int (*t38_tx_packet_handler_t)(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count); -typedef int (t38_rx_indicator_handler_t)(t38_core_state_t *s, void *user_data, int indicator); -typedef int (t38_rx_data_handler_t)(t38_core_state_t *s, void *user_data, int data_type, int field_type, const uint8_t *buf, int len); -typedef int (t38_rx_missing_handler_t)(t38_core_state_t *s, void *user_data, int rx_seq_no, int expected_seq_no); +typedef int (*t38_rx_indicator_handler_t)(t38_core_state_t *s, void *user_data, int indicator); +typedef int (*t38_rx_data_handler_t)(t38_core_state_t *s, void *user_data, int data_type, int field_type, const uint8_t *buf, int len); +typedef int (*t38_rx_missing_handler_t)(t38_core_state_t *s, void *user_data, int rx_seq_no, int expected_seq_no); #if defined(__cplusplus) extern "C" @@ -398,11 +398,11 @@ SPAN_DECLARE(int) t38_core_restart(t38_core_state_t *s); \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler. \return A pointer to the T.38 context, or NULL if there was a problem. */ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, - t38_rx_indicator_handler_t *rx_indicator_handler, - t38_rx_data_handler_t *rx_data_handler, - t38_rx_missing_handler_t *rx_missing_handler, + t38_rx_indicator_handler_t rx_indicator_handler, + t38_rx_data_handler_t rx_data_handler, + t38_rx_missing_handler_t rx_missing_handler, void *rx_user_data, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data); /*! Release a signaling tone transmitter context. diff --git a/libs/spandsp/src/spandsp/t38_gateway.h b/libs/spandsp/src/spandsp/t38_gateway.h index fa6db4bec5..d6bfc39555 100644 --- a/libs/spandsp/src/spandsp/t38_gateway.h +++ b/libs/spandsp/src/spandsp/t38_gateway.h @@ -56,11 +56,11 @@ typedef struct t38_gateway_state_s t38_gateway_state_t; \param msg The HDLC message. \param len The length of the message. */ -typedef void (t38_gateway_real_time_frame_handler_t)(t38_gateway_state_t *s, - void *user_data, - int direction, - const uint8_t *msg, - int len); +typedef void (*t38_gateway_real_time_frame_handler_t)(t38_gateway_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len); /*! T.38 gateway results. @@ -86,7 +86,7 @@ extern "C" \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data); /*! Release a gateway mode T.38 context. @@ -212,7 +212,7 @@ SPAN_DECLARE(logging_state_t *) t38_gateway_get_logging_state(t38_gateway_state_ \param handler The callback function. \param user_data An opaque pointer passed to the callback function. */ SPAN_DECLARE(void) t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s, - t38_gateway_real_time_frame_handler_t *handler, + t38_gateway_real_time_frame_handler_t handler, void *user_data); #if defined(__cplusplus) diff --git a/libs/spandsp/src/spandsp/t38_terminal.h b/libs/spandsp/src/spandsp/t38_terminal.h index 2307f765f7..a847d96cf3 100644 --- a/libs/spandsp/src/spandsp/t38_terminal.h +++ b/libs/spandsp/src/spandsp/t38_terminal.h @@ -123,7 +123,7 @@ SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s, \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, int calling_party, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data); /*! Release a termination mode T.38 context. diff --git a/libs/spandsp/src/spandsp/telephony.h b/libs/spandsp/src/spandsp/telephony.h index 49d7200e83..7a09bbe044 100644 --- a/libs/spandsp/src/spandsp/telephony.h +++ b/libs/spandsp/src/spandsp/telephony.h @@ -56,16 +56,16 @@ #define DBOV_MAX_SINE_POWER (-3.02f) /*! \brief A handler for pure receive. The buffer cannot be altered. */ -typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len); +typedef int (*span_rx_handler_t)(void *s, const int16_t amp[], int len); /*! \brief A handler for receive, where the buffer can be altered. */ -typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len); +typedef int (*span_mod_handler_t)(void *s, int16_t amp[], int len); /*! \brief A handler for missing receive data fill-in. */ -typedef int (span_rx_fillin_handler_t)(void *s, int len); +typedef int (*span_rx_fillin_handler_t)(void *s, int len); /*! \brief A handler for transmit, where the buffer will be filled. */ -typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len); +typedef int (*span_tx_handler_t)(void *s, int16_t amp[], int max_len); #define ms_to_samples(t) ((t)*(SAMPLE_RATE/1000)) #define us_to_samples(t) ((t)/(1000000/SAMPLE_RATE)) diff --git a/libs/spandsp/src/spandsp/v8.h b/libs/spandsp/src/spandsp/v8.h index 25449fb6c1..152c478fad 100644 --- a/libs/spandsp/src/spandsp/v8.h +++ b/libs/spandsp/src/spandsp/v8.h @@ -43,7 +43,7 @@ being negotiating and training with their chosen modem standard. typedef struct v8_parms_s v8_parms_t; -typedef void (v8_result_handler_t)(void *user_data, v8_parms_t *result); +typedef void (*v8_result_handler_t)(void *user_data, v8_parms_t *result); enum v8_call_function_e { @@ -147,7 +147,7 @@ SPAN_DECLARE(int) v8_restart(v8_state_t *s, SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s, int calling_party, v8_parms_t *parms, - v8_result_handler_t *result_handler, + v8_result_handler_t result_handler, void *user_data); /*! Release a V.8 context. diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 92564fcb0e..e95a75f15a 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -6345,11 +6345,11 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s) SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, int calling_party, - t30_set_handler_t *set_rx_type_handler, + t30_set_handler_t set_rx_type_handler, void *set_rx_type_user_data, - t30_set_handler_t *set_tx_type_handler, + t30_set_handler_t set_tx_type_handler, void *set_tx_type_user_data, - t30_send_hdlc_handler_t *send_hdlc_handler, + t30_send_hdlc_handler_t send_hdlc_handler, void *send_hdlc_user_data) { if (s == NULL) diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index 8ba35e5732..c1ee907477 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -765,35 +765,35 @@ SPAN_DECLARE(int) t30_set_receiver_not_ready(t30_state_t *s, int count) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data) +SPAN_DECLARE(void) t30_set_phase_b_handler(t30_state_t *s, t30_phase_b_handler_t handler, void *user_data) { s->phase_b_handler = handler; s->phase_b_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data) +SPAN_DECLARE(void) t30_set_phase_d_handler(t30_state_t *s, t30_phase_d_handler_t handler, void *user_data) { s->phase_d_handler = handler; s->phase_d_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data) +SPAN_DECLARE(void) t30_set_phase_e_handler(t30_state_t *s, t30_phase_e_handler_t handler, void *user_data) { s->phase_e_handler = handler; s->phase_e_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t *handler, void *user_data) +SPAN_DECLARE(void) t30_set_document_handler(t30_state_t *s, t30_document_handler_t handler, void *user_data) { s->document_handler = handler; s->document_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data) +SPAN_DECLARE(void) t30_set_real_time_frame_handler(t30_state_t *s, t30_real_time_frame_handler_t handler, void *user_data) { s->real_time_frame_handler = handler; s->real_time_frame_user_data = user_data; diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c index bc18a72e59..2ed6a9e24d 100644 --- a/libs/spandsp/src/t31.c +++ b/libs/spandsp/src/t31.c @@ -186,9 +186,9 @@ enum static int restart_modem(t31_state_t *s, int new_modem); static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok); -static void set_rx_handler(t31_state_t *s, span_rx_handler_t *rx_handler, span_rx_fillin_handler_t *fillin_handler, void *user_data); -static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data); -static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data); +static void set_rx_handler(t31_state_t *s, span_rx_handler_t rx_handler, span_rx_fillin_handler_t fillin_handler, void *user_data); +static void set_tx_handler(t31_state_t *s, span_tx_handler_t handler, void *user_data); +static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t handler, void *user_data); static int v17_v21_rx(void *user_data, const int16_t amp[], int len); static int v17_v21_rx_fillin(void *user_data, int len); static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len); @@ -1327,6 +1327,7 @@ static void tone_detected(void *user_data, int tone, int level, int delay) } /*- End of function --------------------------------------------------------*/ +#if 0 static void v8_handler(void *user_data, v8_parms_t *result) { t31_state_t *s; @@ -1335,6 +1336,7 @@ static void v8_handler(void *user_data, v8_parms_t *result) span_log(&s->logging, SPAN_LOG_FLOW, "V.8 report received\n"); } /*- End of function --------------------------------------------------------*/ +#endif static void hdlc_tx_underflow(void *user_data) { @@ -1564,7 +1566,7 @@ static int restart_modem(t31_state_t *s, int new_modem) s->at_state.rx_signal_present = FALSE; s->at_state.rx_trained = FALSE; s->rx_frame_received = FALSE; - set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, NULL); + set_rx_handler(s, (span_rx_handler_t) &span_dummy_rx, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, NULL); use_hdlc = FALSE; switch (s->modem) { @@ -1583,10 +1585,10 @@ static int restart_modem(t31_state_t *s, int new_modem) /* Do V.21/HDLC receive in parallel. The other end may send its first message at any time. The CNG tone will continue until we get a valid preamble. */ - set_rx_handler(s, (span_rx_handler_t *) &cng_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + set_rx_handler(s, (span_rx_handler_t) &cng_rx, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, s); t31_v21_rx(s); - set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &modem_connect_tones_tx, &t->connect_tx); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->at_state.transmit = TRUE; break; @@ -1596,10 +1598,10 @@ static int restart_modem(t31_state_t *s, int new_modem) } else { - set_rx_handler(s, (span_rx_handler_t *) &cng_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + set_rx_handler(s, (span_rx_handler_t) &cng_rx, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, s); t31_v21_rx(s); silence_gen_set(&t->silence_gen, 0); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); } s->at_state.transmit = FALSE; break; @@ -1613,8 +1615,8 @@ static int restart_modem(t31_state_t *s, int new_modem) else { modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CED); - set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &modem_connect_tones_tx, &t->connect_tx); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->at_state.transmit = TRUE; break; @@ -1633,8 +1635,8 @@ static int restart_modem(t31_state_t *s, int new_modem) /* The spec says 1s +-15% of preamble. So, the minimum is 32 octets. */ hdlc_tx_flags(&t->hdlc_tx, 32); fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &t->hdlc_tx); - set_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &fsk_tx, &t->v21_tx); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->hdlc_tx.final = FALSE; s->hdlc_tx.len = 0; @@ -1647,7 +1649,7 @@ static int restart_modem(t31_state_t *s, int new_modem) } else { - set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx); + set_rx_handler(s, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &t->v21_rx); t31_v21_rx(s); } break; @@ -1679,8 +1681,8 @@ static int restart_modem(t31_state_t *s, int new_modem) else { v17_tx_restart(&t->fast_modems.v17_tx, s->bit_rate, FALSE, s->short_train); - set_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->fast_modems.v17_tx); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->tx.out_bytes = 0; s->tx.data_started = FALSE; @@ -1689,7 +1691,7 @@ static int restart_modem(t31_state_t *s, int new_modem) case FAX_MODEM_V17_RX: if (!s->t38_mode) { - set_rx_handler(s, (span_rx_handler_t *) &v17_v21_rx, (span_rx_fillin_handler_t *) &v17_v21_rx_fillin, s); + set_rx_handler(s, (span_rx_handler_t) &v17_v21_rx, (span_rx_fillin_handler_t) &v17_v21_rx_fillin, s); v17_rx_restart(&t->fast_modems.v17_rx, s->bit_rate, s->short_train); /* Allow for +FCERROR/+FRH:3 */ t31_v21_rx(s); @@ -1716,8 +1718,8 @@ static int restart_modem(t31_state_t *s, int new_modem) else { v27ter_tx_restart(&t->fast_modems.v27ter_tx, s->bit_rate, FALSE); - set_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->fast_modems.v27ter_tx); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->tx.out_bytes = 0; s->tx.data_started = FALSE; @@ -1726,7 +1728,7 @@ static int restart_modem(t31_state_t *s, int new_modem) case FAX_MODEM_V27TER_RX: if (!s->t38_mode) { - set_rx_handler(s, (span_rx_handler_t *) &v27ter_v21_rx, (span_rx_fillin_handler_t *) &v27ter_v21_rx_fillin, s); + set_rx_handler(s, (span_rx_handler_t) &v27ter_v21_rx, (span_rx_fillin_handler_t) &v27ter_v21_rx_fillin, s); v27ter_rx_restart(&t->fast_modems.v27ter_rx, s->bit_rate, FALSE); /* Allow for +FCERROR/+FRH:3 */ t31_v21_rx(s); @@ -1753,8 +1755,8 @@ static int restart_modem(t31_state_t *s, int new_modem) else { v29_tx_restart(&t->fast_modems.v29_tx, s->bit_rate, FALSE); - set_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->fast_modems.v29_tx); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->tx.out_bytes = 0; s->tx.data_started = FALSE; @@ -1763,7 +1765,7 @@ static int restart_modem(t31_state_t *s, int new_modem) case FAX_MODEM_V29_RX: if (!s->t38_mode) { - set_rx_handler(s, (span_rx_handler_t *) &v29_v21_rx, (span_rx_fillin_handler_t *) &v29_v21_rx_fillin, s); + set_rx_handler(s, (span_rx_handler_t) &v29_v21_rx, (span_rx_fillin_handler_t) &v29_v21_rx_fillin, s); v29_rx_restart(&t->fast_modems.v29_rx, s->bit_rate, FALSE); /* Allow for +FCERROR/+FRH:3 */ t31_v21_rx(s); @@ -1781,18 +1783,18 @@ static int restart_modem(t31_state_t *s, int new_modem) else { silence_gen_set(&t->silence_gen, 0); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->at_state.transmit = FALSE; break; case FAX_MODEM_SILENCE_RX: if (!s->t38_mode) { - set_rx_handler(s, (span_rx_handler_t *) &silence_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, s); + set_rx_handler(s, (span_rx_handler_t) &silence_rx, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, s); silence_gen_set(&t->silence_gen, 0); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); } s->at_state.transmit = FALSE; break; @@ -1806,8 +1808,8 @@ static int restart_modem(t31_state_t *s, int new_modem) { s->modem = FAX_MODEM_SILENCE_TX; silence_gen_alter(&t->silence_gen, ms_to_samples(200)); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); s->at_state.transmit = TRUE; } break; @@ -2150,7 +2152,7 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len) s->at_state.rx_data_bytes = 0; s->at_state.transmit = FALSE; s->modem = FAX_MODEM_SILENCE_TX; - set_rx_handler(s, (span_rx_handler_t *) &span_dummy_rx, (span_rx_fillin_handler_t *) &span_dummy_rx_fillin, NULL); + set_rx_handler(s, (span_rx_handler_t) &span_dummy_rx, (span_rx_fillin_handler_t) &span_dummy_rx_fillin, NULL); t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); } @@ -2177,8 +2179,8 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len) /*- End of function --------------------------------------------------------*/ static void set_rx_handler(t31_state_t *s, - span_rx_handler_t *rx_handler, - span_rx_fillin_handler_t *fillin_handler, + span_rx_handler_t rx_handler, + span_rx_fillin_handler_t fillin_handler, void *user_data) { s->audio.modems.rx_handler = rx_handler; @@ -2187,14 +2189,14 @@ static void set_rx_handler(t31_state_t *s, } /*- End of function --------------------------------------------------------*/ -static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data) +static void set_tx_handler(t31_state_t *s, span_tx_handler_t handler, void *user_data) { s->audio.modems.tx_handler = handler; s->audio.modems.tx_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data) +static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t handler, void *user_data) { s->audio.modems.next_tx_handler = handler; s->audio.modems.next_tx_user_data = user_data; @@ -2252,7 +2254,7 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->fast_modems.v17_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v17_rx, (span_rx_fillin_handler_t *) &v17_rx_fillin, &s->fast_modems.v17_rx); + set_rx_handler(t, (span_rx_handler_t) &v17_rx, (span_rx_fillin_handler_t) &v17_rx_fillin, &s->fast_modems.v17_rx); } else { @@ -2262,7 +2264,7 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len) /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } } return len; @@ -2295,7 +2297,7 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->fast_modems.v27ter_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, (span_rx_fillin_handler_t *) &v27ter_rx_fillin, &s->fast_modems.v27ter_rx); + set_rx_handler(t, (span_rx_handler_t) &v27ter_rx, (span_rx_fillin_handler_t) &v27ter_rx_fillin, &s->fast_modems.v27ter_rx); } else { @@ -2305,7 +2307,7 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } } return len; @@ -2338,7 +2340,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->fast_modems.v29_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->fast_modems.v29_rx); + set_rx_handler(t, (span_rx_handler_t) &v29_rx, (span_rx_fillin_handler_t) &v29_rx_fillin, &s->fast_modems.v29_rx); } else { @@ -2348,7 +2350,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } } return len; @@ -2461,13 +2463,13 @@ static int set_next_tx_type(t31_state_t *s) if (s->audio.next_tx_handler) { set_tx_handler(s, s->audio.next_tx_handler, s->audio.next_tx_user_data); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); return 0; } /* There is nothing else to change to, so use zero length silence */ silence_gen_alter(&s->audio.modems.silence_gen, 0); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &s->audio.modems.silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &s->audio.modems.silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); return -1; } /*- End of function --------------------------------------------------------*/ @@ -2556,7 +2558,7 @@ SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s) /*- End of function --------------------------------------------------------*/ static int t31_t38_fe_init(t31_state_t *t, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data) { t31_t38_front_end_state_t *s; @@ -2589,11 +2591,11 @@ static int t31_t38_fe_init(t31_state_t *t, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, - at_tx_handler_t *at_tx_handler, + at_tx_handler_t at_tx_handler, void *at_tx_user_data, - t31_modem_control_handler_t *modem_control_handler, + t31_modem_control_handler_t modem_control_handler, void *modem_control_user_data, - t38_tx_packet_handler_t *tx_t38_packet_handler, + t38_tx_packet_handler_t tx_t38_packet_handler, void *tx_t38_packet_user_data) { #if 0 diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c index 67a53ae707..4a81b0eda1 100644 --- a/libs/spandsp/src/t38_core.c +++ b/libs/spandsp/src/t38_core.c @@ -1100,11 +1100,11 @@ SPAN_DECLARE(int) t38_core_restart(t38_core_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, - t38_rx_indicator_handler_t *rx_indicator_handler, - t38_rx_data_handler_t *rx_data_handler, - t38_rx_missing_handler_t *rx_missing_handler, + t38_rx_indicator_handler_t rx_indicator_handler, + t38_rx_data_handler_t rx_data_handler, + t38_rx_missing_handler_t rx_missing_handler, void *rx_user_data, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data) { if (s == NULL) diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 85022b8d54..4c0c5a59da 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -206,7 +206,7 @@ static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit); static void non_ecm_push_residue(t38_gateway_state_t *s); static void tone_detected(void *user_data, int tone, int level, int delay); -static void set_rx_handler(t38_gateway_state_t *s, span_rx_handler_t *handler, span_rx_fillin_handler_t *fillin_handler, void *user_data) +static void set_rx_handler(t38_gateway_state_t *s, span_rx_handler_t handler, span_rx_fillin_handler_t fillin_handler, void *user_data) { if (s->audio.modems.rx_handler != span_dummy_rx) { @@ -220,14 +220,14 @@ static void set_rx_handler(t38_gateway_state_t *s, span_rx_handler_t *handler, s } /*- End of function --------------------------------------------------------*/ -static void set_tx_handler(t38_gateway_state_t *s, span_tx_handler_t *handler, void *user_data) +static void set_tx_handler(t38_gateway_state_t *s, span_tx_handler_t handler, void *user_data) { s->audio.modems.tx_handler = handler; s->audio.modems.tx_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -static void set_next_tx_handler(t38_gateway_state_t *s, span_tx_handler_t *handler, void *user_data) +static void set_next_tx_handler(t38_gateway_state_t *s, span_tx_handler_t handler, void *user_data) { s->audio.modems.next_tx_handler = handler; s->audio.modems.next_tx_user_data = user_data; @@ -267,7 +267,7 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->fast_modems.v17_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v17_rx, (span_rx_fillin_handler_t *) &v17_rx_fillin, &s->fast_modems.v17_rx); + set_rx_handler(t, (span_rx_handler_t) &v17_rx, (span_rx_fillin_handler_t) &v17_rx_fillin, &s->fast_modems.v17_rx); } else { @@ -275,7 +275,7 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len) if (s->rx_signal_present) { span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } /*endif*/ } @@ -310,7 +310,7 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->fast_modems.v27ter_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v27ter_rx, (span_rx_fillin_handler_t *) &v27ter_v21_rx_fillin, &s->fast_modems.v27ter_rx); + set_rx_handler(t, (span_rx_handler_t) &v27ter_rx, (span_rx_fillin_handler_t) &v27ter_v21_rx_fillin, &s->fast_modems.v27ter_rx); } else { @@ -318,7 +318,7 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) if (s->rx_signal_present) { span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } /*endif*/ } @@ -353,7 +353,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->fast_modems.v29_rx)); - set_rx_handler(t, (span_rx_handler_t *) &v29_rx, (span_rx_fillin_handler_t *) &v29_rx_fillin, &s->fast_modems.v29_rx); + set_rx_handler(t, (span_rx_handler_t) &v29_rx, (span_rx_fillin_handler_t) &v29_rx_fillin, &s->fast_modems.v29_rx); } else { @@ -361,7 +361,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) if (s->rx_signal_present) { span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); - set_rx_handler(t, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &s->v21_rx); + set_rx_handler(t, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx); } /*endif*/ } @@ -440,9 +440,9 @@ static int set_next_tx_type(t38_gateway_state_t *s) /* There is a handler queued, so that is the next one. */ set_tx_handler(s, t->next_tx_handler, t->next_tx_user_data); set_next_tx_handler(s, NULL, NULL); - if (t->tx_handler == (span_tx_handler_t *) &(silence_gen) + if (t->tx_handler == (span_tx_handler_t) &(silence_gen) || - t->tx_handler == (span_tx_handler_t *) &(tone_gen)) + t->tx_handler == (span_tx_handler_t) &(tone_gen)) { set_rx_active(s, TRUE); } @@ -489,23 +489,23 @@ static int set_next_tx_type(t38_gateway_state_t *s) t->tx_bit_rate = 0; /* Impose 75ms minimum on transmitted silence */ //silence_gen_set(&t->silence_gen, ms_to_samples(75)); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); set_rx_active(s, TRUE); break; case T38_IND_CNG: t->tx_bit_rate = 0; modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CNG); - set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); + set_tx_handler(s, (span_tx_handler_t) &modem_connect_tones_tx, &t->connect_tx); silence_gen_set(&t->silence_gen, 0); - set_next_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); set_rx_active(s, TRUE); break; case T38_IND_CED: t->tx_bit_rate = 0; modem_connect_tones_tx_init(&t->connect_tx, MODEM_CONNECT_TONES_FAX_CED); - set_tx_handler(s, (span_tx_handler_t *) &modem_connect_tones_tx, &t->connect_tx); - set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL); + set_tx_handler(s, (span_tx_handler_t) &modem_connect_tones_tx, &t->connect_tx); + set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL); set_rx_active(s, TRUE); break; case T38_IND_V21_PREAMBLE: @@ -515,8 +515,8 @@ static int set_next_tx_type(t38_gateway_state_t *s) silence_gen_alter(&t->silence_gen, ms_to_samples(75)); u->buf[u->in].len = 0; fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &t->hdlc_tx); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) &fsk_tx, &t->v21_tx); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) &fsk_tx, &t->v21_tx); set_rx_active(s, TRUE); break; case T38_IND_V27TER_2400_TRAINING: @@ -534,8 +534,8 @@ static int set_next_tx_type(t38_gateway_state_t *s) silence_gen_alter(&t->silence_gen, ms_to_samples(75)); v27ter_tx_restart(&t->fast_modems.v27ter_tx, t->tx_bit_rate, t->use_tep); v27ter_tx_set_get_bit(&t->fast_modems.v27ter_tx, get_bit_func, get_bit_user_data); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) &v27ter_tx, &t->fast_modems.v27ter_tx); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx); set_rx_active(s, TRUE); break; case T38_IND_V29_7200_TRAINING: @@ -553,8 +553,8 @@ static int set_next_tx_type(t38_gateway_state_t *s) silence_gen_alter(&t->silence_gen, ms_to_samples(75)); v29_tx_restart(&t->fast_modems.v29_tx, t->tx_bit_rate, t->use_tep); v29_tx_set_get_bit(&t->fast_modems.v29_tx, get_bit_func, get_bit_user_data); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) &v29_tx, &t->fast_modems.v29_tx); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx); set_rx_active(s, TRUE); break; case T38_IND_V17_7200_SHORT_TRAINING: @@ -601,8 +601,8 @@ static int set_next_tx_type(t38_gateway_state_t *s) silence_gen_alter(&t->silence_gen, ms_to_samples(75)); v17_tx_restart(&t->fast_modems.v17_tx, t->tx_bit_rate, t->use_tep, short_train); v17_tx_set_get_bit(&t->fast_modems.v17_tx, get_bit_func, get_bit_user_data); - set_tx_handler(s, (span_tx_handler_t *) &silence_gen, &t->silence_gen); - set_next_tx_handler(s, (span_tx_handler_t *) &v17_tx, &t->fast_modems.v17_tx); + set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + set_next_tx_handler(s, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx); set_rx_active(s, TRUE); break; case T38_IND_V8_ANSAM: @@ -2185,7 +2185,7 @@ static int restart_rx_modem(t38_gateway_state_t *s) s->core.fast_rx_active = FAX_MODEM_V17_RX; break; default: - set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx); + set_rx_handler(s, (span_rx_handler_t) &fsk_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &t->v21_rx); s->core.fast_rx_active = FAX_MODEM_NONE; break; } @@ -2393,7 +2393,7 @@ SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s, - t38_gateway_real_time_frame_handler_t *handler, + t38_gateway_real_time_frame_handler_t handler, void *user_data) { s->core.real_time_frame_handler = handler; @@ -2424,7 +2424,7 @@ static int t38_gateway_audio_init(t38_gateway_state_t *s) /*- End of function --------------------------------------------------------*/ static int t38_gateway_t38_init(t38_gateway_state_t *t, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data) { t38_gateway_t38_state_t *s; @@ -2447,7 +2447,7 @@ static int t38_gateway_t38_init(t38_gateway_state_t *t, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data) { if (tx_packet_handler == NULL) diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index 1efa1b09d6..b66e9ce409 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -1446,7 +1446,7 @@ static int t38_terminal_t38_fe_restart(t38_terminal_state_t *t) /*- End of function --------------------------------------------------------*/ static int t38_terminal_t38_fe_init(t38_terminal_state_t *t, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data) { t38_terminal_front_end_state_t *s; @@ -1495,7 +1495,7 @@ SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s, SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, int calling_party, - t38_tx_packet_handler_t *tx_packet_handler, + t38_tx_packet_handler_t tx_packet_handler, void *tx_packet_user_data) { if (tx_packet_handler == NULL) diff --git a/libs/spandsp/src/v8.c b/libs/spandsp/src/v8.c index 906f96ba95..8ac13d3dd8 100644 --- a/libs/spandsp/src/v8.c +++ b/libs/spandsp/src/v8.c @@ -1040,7 +1040,7 @@ SPAN_DECLARE(int) v8_restart(v8_state_t *s, int calling_party, v8_parms_t *parms SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s, int calling_party, v8_parms_t *parms, - v8_result_handler_t *result_handler, + v8_result_handler_t result_handler, void *user_data) { if (s == NULL) diff --git a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c index d7cefc6778..dda0d0fbc7 100644 --- a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c +++ b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c @@ -543,7 +543,6 @@ static int create_error_page(TIFF *tiff_file) int main(int argc, char *argv[]) { - int row; TIFF *tiff_file; struct tm *tm; time_t now; @@ -553,24 +552,13 @@ int main(int argc, char *argv[]) int i; int image_length; int opt; - int compression; - compression = T4_COMPRESSION_ITU_T6; photo_metric = PHOTOMETRIC_MINISWHITE; fill_order = FILLORDER_LSB2MSB; - while ((opt = getopt(argc, argv, "126ir")) != -1) + while ((opt = getopt(argc, argv, "ir")) != -1) { switch (opt) { - case '1': - compression = T4_COMPRESSION_ITU_T4_1D; - break; - case '2': - compression = T4_COMPRESSION_ITU_T4_2D; - break; - case '6': - compression = T4_COMPRESSION_ITU_T6; - break; case 'i': photo_metric = PHOTOMETRIC_MINISBLACK; break; @@ -637,7 +625,6 @@ int main(int argc, char *argv[]) image_length = sequence[i].length; /* Write the image first.... */ - row = 0; switch (sequence[i].type) { case 0: diff --git a/libs/spandsp/tests/fax_tester.c b/libs/spandsp/tests/fax_tester.c index 20af011981..544756f712 100644 --- a/libs/spandsp/tests/fax_tester.c +++ b/libs/spandsp/tests/fax_tester.c @@ -334,7 +334,7 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->fast_modems.v17_rx)); - s->rx_handler = (span_rx_handler_t *) &v17_rx; + s->rx_handler = (span_rx_handler_t) &v17_rx; s->rx_user_data = &s->fast_modems.v17_rx; } return 0; @@ -355,7 +355,7 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->fast_modems.v27ter_rx)); - s->rx_handler = (span_rx_handler_t *) &v27ter_rx; + s->rx_handler = (span_rx_handler_t) &v27ter_rx; s->rx_user_data = &s->fast_modems.v27ter_rx; } return 0; @@ -376,7 +376,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) /* The fast modem has trained, so we no longer need to run the slow one in parallel. */ span_log(&t->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->fast_modems.v29_rx)); - s->rx_handler = (span_rx_handler_t *) &v29_rx; + s->rx_handler = (span_rx_handler_t) &v29_rx; s->rx_user_data = &s->fast_modems.v29_rx; } return 0; @@ -482,7 +482,7 @@ void faxtester_set_rx_type(void *user_data, int type, int bit_rate, int short_tr tone, tone_detected, (void *) s); - t->rx_handler = (span_rx_handler_t *) &modem_connect_tones_rx; + t->rx_handler = (span_rx_handler_t) &modem_connect_tones_rx; t->rx_user_data = &t->connect_rx; s->tone_state = MODEM_CONNECT_TONES_NONE; break; @@ -491,31 +491,31 @@ void faxtester_set_rx_type(void *user_data, int type, int bit_rate, int short_tr s->flush_handler(s, s->flush_user_data, 3); fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data); fsk_rx_signal_cutoff(&t->v21_rx, -45.5); - t->rx_handler = (span_rx_handler_t *) &fsk_rx; + t->rx_handler = (span_rx_handler_t) &fsk_rx; t->rx_user_data = &t->v21_rx; break; case T30_MODEM_V27TER: v27ter_rx_restart(&t->fast_modems.v27ter_rx, bit_rate, FALSE); v27ter_rx_set_put_bit(&t->fast_modems.v27ter_rx, put_bit_func, put_bit_user_data); - t->rx_handler = (span_rx_handler_t *) &v27ter_v21_rx; + t->rx_handler = (span_rx_handler_t) &v27ter_v21_rx; t->rx_user_data = s; break; case T30_MODEM_V29: v29_rx_restart(&t->fast_modems.v29_rx, bit_rate, FALSE); v29_rx_set_put_bit(&t->fast_modems.v29_rx, put_bit_func, put_bit_user_data); - t->rx_handler = (span_rx_handler_t *) &v29_v21_rx; + t->rx_handler = (span_rx_handler_t) &v29_v21_rx; t->rx_user_data = s; break; case T30_MODEM_V17: v17_rx_restart(&t->fast_modems.v17_rx, bit_rate, short_train); v17_rx_set_put_bit(&t->fast_modems.v17_rx, put_bit_func, put_bit_user_data); - t->rx_handler = (span_rx_handler_t *) &v17_v21_rx; + t->rx_handler = (span_rx_handler_t) &v17_v21_rx; t->rx_user_data = s; break; case T30_MODEM_DONE: span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); default: - t->rx_handler = (span_rx_handler_t *) &span_dummy_rx; + t->rx_handler = (span_rx_handler_t) &span_dummy_rx; t->rx_user_data = s; break; } @@ -549,7 +549,7 @@ void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_tr { case T30_MODEM_PAUSE: silence_gen_alter(&t->silence_gen, ms_to_samples(short_train)); - t->tx_handler = (span_tx_handler_t *) &silence_gen; + t->tx_handler = (span_tx_handler_t) &silence_gen; t->tx_user_data = &t->silence_gen; s->transmit = TRUE; break; @@ -560,14 +560,14 @@ void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_tr else tone = MODEM_CONNECT_TONES_FAX_CNG; modem_connect_tones_tx_init(&t->connect_tx, tone); - t->tx_handler = (span_tx_handler_t *) &modem_connect_tones_tx; + t->tx_handler = (span_tx_handler_t) &modem_connect_tones_tx; t->tx_user_data = &t->connect_tx; s->transmit = TRUE; break; case T30_MODEM_V21: fsk_tx_init(&t->v21_tx, &preset_fsk_specs[FSK_V21CH2], get_bit_func, get_bit_user_data); fsk_tx_set_modem_status_handler(&t->v21_tx, modem_tx_status, (void *) s); - t->tx_handler = (span_tx_handler_t *) &fsk_tx; + t->tx_handler = (span_tx_handler_t) &fsk_tx; t->tx_user_data = &t->v21_tx; s->transmit = TRUE; break; @@ -575,7 +575,7 @@ void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_tr v27ter_tx_restart(&t->fast_modems.v27ter_tx, bit_rate, t->use_tep); v27ter_tx_set_get_bit(&t->fast_modems.v27ter_tx, get_bit_func, get_bit_user_data); v27ter_tx_set_modem_status_handler(&t->fast_modems.v27ter_tx, modem_tx_status, (void *) s); - t->tx_handler = (span_tx_handler_t *) &v27ter_tx; + t->tx_handler = (span_tx_handler_t) &v27ter_tx; t->tx_user_data = &t->fast_modems.v27ter_tx; /* For any fast modem, set 200ms of preamble flags */ hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); @@ -585,7 +585,7 @@ void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_tr v29_tx_restart(&t->fast_modems.v29_tx, bit_rate, t->use_tep); v29_tx_set_get_bit(&t->fast_modems.v29_tx, get_bit_func, get_bit_user_data); v29_tx_set_modem_status_handler(&t->fast_modems.v29_tx, modem_tx_status, (void *) s); - t->tx_handler = (span_tx_handler_t *) &v29_tx; + t->tx_handler = (span_tx_handler_t) &v29_tx; t->tx_user_data = &t->fast_modems.v29_tx; /* For any fast modem, set 200ms of preamble flags */ hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); @@ -595,7 +595,7 @@ void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_tr v17_tx_restart(&t->fast_modems.v17_tx, bit_rate, t->use_tep, short_train); v17_tx_set_get_bit(&t->fast_modems.v17_tx, get_bit_func, get_bit_user_data); v17_tx_set_modem_status_handler(&t->fast_modems.v17_tx, modem_tx_status, (void *) s); - t->tx_handler = (span_tx_handler_t *) &v17_tx; + t->tx_handler = (span_tx_handler_t) &v17_tx; t->tx_user_data = &t->fast_modems.v17_tx; /* For any fast modem, set 200ms of preamble flags */ hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); @@ -606,7 +606,7 @@ void faxtester_set_tx_type(void *user_data, int type, int bit_rate, int short_tr /* Fall through */ default: silence_gen_alter(&t->silence_gen, 0); - t->tx_handler = (span_tx_handler_t *) &silence_gen; + t->tx_handler = (span_tx_handler_t) &silence_gen; t->tx_user_data = &t->silence_gen; s->transmit = FALSE; break; @@ -636,21 +636,21 @@ void faxtester_set_tep_mode(faxtester_state_t *s, int use_tep) } /*- End of function --------------------------------------------------------*/ -void faxtester_set_real_time_frame_handler(faxtester_state_t *s, faxtester_real_time_frame_handler_t *handler, void *user_data) +void faxtester_set_real_time_frame_handler(faxtester_state_t *s, faxtester_real_time_frame_handler_t handler, void *user_data) { s->real_time_frame_handler = handler; s->real_time_frame_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -void faxtester_set_front_end_step_complete_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data) +void faxtester_set_front_end_step_complete_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t handler, void *user_data) { s->front_end_step_complete_handler = handler; s->front_end_step_complete_user_data = user_data; } /*- End of function --------------------------------------------------------*/ -void faxtester_set_front_end_step_timeout_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data) +void faxtester_set_front_end_step_timeout_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t handler, void *user_data) { s->front_end_step_timeout_handler = handler; s->front_end_step_timeout_user_data = user_data; @@ -686,9 +686,9 @@ static void faxtester_fax_modems_init(fax_modems_state_t *s, int use_tep, void * dc_restore_init(&s->dc_restore); s->rx_signal_present = FALSE; - s->rx_handler = (span_rx_handler_t *) &span_dummy_rx; + s->rx_handler = (span_rx_handler_t) &span_dummy_rx; s->rx_user_data = NULL; - s->tx_handler = (span_tx_handler_t *) &silence_gen; + s->tx_handler = (span_tx_handler_t) &silence_gen; s->tx_user_data = &s->silence_gen; } /*- End of function --------------------------------------------------------*/ @@ -725,7 +725,7 @@ int faxtester_free(faxtester_state_t *s) } /*- End of function --------------------------------------------------------*/ -void faxtester_set_flush_handler(faxtester_state_t *s, faxtester_flush_handler_t *handler, void *user_data) +void faxtester_set_flush_handler(faxtester_state_t *s, faxtester_flush_handler_t handler, void *user_data) { s->flush_handler = handler; s->flush_user_data = user_data; diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index a2967948b7..fc8d3f4ebb 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -102,14 +102,12 @@ int rows_read = 0; static void dump_image_as_xxx(t4_state_t *state) { - uint8_t *s; int i; int j; int k; /* Dump the entire image as text 'X's and spaces */ printf("Image (%d x %d):\n", receive_state.image_width, receive_state.image_length); - s = state->image_buffer; for (i = 0; i < state->image_length; i++) { for (j = 0; j < state->bytes_per_row; j++) @@ -305,7 +303,7 @@ int main(int argc, char *argv[]) int compression; int compression_step; int add_page_headers; - int overlay_page_headers; + //int overlay_page_headers; int min_row_bits; int restart_pages; int block_size; @@ -329,7 +327,7 @@ int main(int argc, char *argv[]) compression = -1; compression_step = 0; add_page_headers = FALSE; - overlay_page_headers = FALSE; + //overlay_page_headers = FALSE; restart_pages = FALSE; in_file_name = IN_FILE_NAME; decode_file_name = NULL; @@ -395,11 +393,11 @@ int main(int argc, char *argv[]) break; case 'h': add_page_headers = TRUE; - overlay_page_headers = FALSE; + //overlay_page_headers = FALSE; break; case 'H': add_page_headers = TRUE; - overlay_page_headers = TRUE; + //overlay_page_headers = TRUE; break; case 'r': restart_pages = TRUE; From 4a200ce3a0be7334a94bae7c97c55284c5158cd5 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 4 Jul 2012 23:57:30 +0800 Subject: [PATCH 0620/1057] More tweaks for spandsp. --- libs/spandsp/src/dtmf.c | 73 +++++---- libs/spandsp/src/hdlc.c | 9 +- libs/spandsp/src/make_modem_filter.c | 145 ++++++++++++++++++ libs/spandsp/src/modem_connect_tones.c | 88 ++++++++++- .../spandsp/src/spandsp/modem_connect_tones.h | 5 +- .../src/spandsp/private/super_tone_rx.h | 6 +- libs/spandsp/src/spandsp/private/v22bis.h | 2 +- libs/spandsp/src/spandsp/v8.h | 2 + libs/spandsp/src/super_tone_rx.c | 26 ++-- libs/spandsp/src/t38_gateway.c | 4 +- libs/spandsp/src/v18.c | 2 +- libs/spandsp/src/v22bis_rx.c | 9 +- libs/spandsp/src/v22bis_tx.c | 33 ++-- libs/spandsp/src/v8.c | 49 +++++- libs/spandsp/src/vector_float.c | 6 +- libs/spandsp/tests/fax_tester.h | 30 ++-- libs/spandsp/tests/udptl.h | 4 +- 17 files changed, 375 insertions(+), 118 deletions(-) diff --git a/libs/spandsp/src/dtmf.c b/libs/spandsp/src/dtmf.c index 35dc6c9dd1..ac1656360e 100644 --- a/libs/spandsp/src/dtmf.c +++ b/libs/spandsp/src/dtmf.c @@ -258,45 +258,42 @@ SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples) Note this is only relevant to VoIP using A-law, u-law or similar. Low bit rate codecs scramble DTMF too much for it to be recognised, and often slip in units larger than a sample. */ - if (hit != s->in_digit) + if (hit != s->in_digit && s->last_hit != s->in_digit) { - if (s->last_hit != s->in_digit) + /* We have two successive indications that something has changed. */ + /* To declare digit on, the hits must agree. Otherwise we declare tone off. */ + hit = (hit && hit == s->last_hit) ? hit : 0; + if (s->realtime_callback) { - /* We have two successive indications that something has changed. */ - /* To declare digit on, the hits must agree. Otherwise we declare tone off. */ - hit = (hit && hit == s->last_hit) ? hit : 0; - if (s->realtime_callback) + /* Avoid reporting multiple no digit conditions on flaky hits */ + if (s->in_digit || hit) { - /* Avoid reporting multiple no digit conditions on flaky hits */ - if (s->in_digit || hit) - { - i = (s->in_digit && !hit) ? -99 : lfastrintf(log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER); - s->realtime_callback(s->realtime_callback_data, hit, i, s->duration); - s->duration = 0; - } + i = (s->in_digit && !hit) ? -99 : lfastrintf(log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER); + s->realtime_callback(s->realtime_callback_data, hit, i, s->duration); + s->duration = 0; } - else - { - if (hit) - { - if (s->current_digits < MAX_DTMF_DIGITS) - { - s->digits[s->current_digits++] = (char) hit; - s->digits[s->current_digits] = '\0'; - if (s->digits_callback) - { - s->digits_callback(s->digits_callback_data, s->digits, s->current_digits); - s->current_digits = 0; - } - } - else - { - s->lost_digits++; - } - } - } - s->in_digit = hit; } + else + { + if (hit) + { + if (s->current_digits < MAX_DTMF_DIGITS) + { + s->digits[s->current_digits++] = (char) hit; + s->digits[s->current_digits] = '\0'; + if (s->digits_callback) + { + s->digits_callback(s->digits_callback_data, s->digits, s->current_digits); + s->current_digits = 0; + } + } + else + { + s->lost_digits++; + } + } + } + s->in_digit = hit; } s->last_hit = hit; #if defined(SPANDSP_USE_FIXED_POINT) @@ -333,7 +330,7 @@ SPAN_DECLARE(int) dtmf_rx_fillin(dtmf_rx_state_t *s, int samples) #endif s->current_sample = 0; /* Don't update the hit detection. Pretend it never happened. */ - /* TODO: Surely we can be a cleverer than this. */ + /* TODO: Surely we can be cleverer than this. */ return 0; } /*- End of function --------------------------------------------------------*/ @@ -359,7 +356,7 @@ SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *buf, int max) s->current_digits -= max; } buf[max] = '\0'; - return max; + return max; } /*- End of function --------------------------------------------------------*/ @@ -417,7 +414,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s, if (s == NULL) { if ((s = (dtmf_rx_state_t *) malloc(sizeof (*s))) == NULL) - return NULL; + return NULL; } memset(s, 0, sizeof(*s)); span_log_init(&s->logging, SPAN_LOG_NONE, NULL); @@ -570,7 +567,7 @@ SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s) if (s == NULL) { if ((s = (dtmf_tx_state_t *) malloc(sizeof (*s))) == NULL) - return NULL; + return NULL; } memset(s, 0, sizeof(*s)); if (!dtmf_tx_inited) diff --git a/libs/spandsp/src/hdlc.c b/libs/spandsp/src/hdlc.c index fc401fb5d1..d08ab1a05e 100644 --- a/libs/spandsp/src/hdlc.c +++ b/libs/spandsp/src/hdlc.c @@ -154,7 +154,8 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) s->rx_frames++; s->rx_bytes += s->len - s->crc_bytes; s->len -= s->crc_bytes; - s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE); + if (s->frame_handler) + s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE); } else { @@ -162,7 +163,8 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) if (s->report_bad_frames) { s->len -= s->crc_bytes; - s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); + if (s->frame_handler) + s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); } } } @@ -177,7 +179,8 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) s->len -= s->crc_bytes; else s->len = 0; - s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); + if (s->frame_handler) + s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); } s->rx_length_errors++; } diff --git a/libs/spandsp/src/make_modem_filter.c b/libs/spandsp/src/make_modem_filter.c index aa58ac301b..9bf49eb0aa 100644 --- a/libs/spandsp/src/make_modem_filter.c +++ b/libs/spandsp/src/make_modem_filter.c @@ -450,6 +450,151 @@ int main(int argc, char **argv) rx_tag = ""; tx_tag = ""; } + else if (strcmp(modem, "V.34_2400") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 10; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1600.0; + baud_rate = 2400.0; + rx_tag = "_2400_low_carrier"; + tx_tag = "_2400"; + } + else if (strcmp(modem, "V.34_2400_high") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 10; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1800.0; + baud_rate = 2400.0; + rx_tag = "_2400_high_carrier"; + tx_tag = "_2400"; + } + else if (strcmp(modem, "V.34_2743") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 35; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1646.0; + baud_rate = 2400.0*8.0/7.0; + rx_tag = "_2743_low_carrier"; + tx_tag = "_2743"; + } + else if (strcmp(modem, "V.34_2743_high") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 35; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1829.0; + baud_rate = 2400.0*8.0/7.0; + rx_tag = "_2743_high_carrier"; + tx_tag = "_2743"; + } + else if (strcmp(modem, "V.34_2800") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 20; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1680.0; + baud_rate = 2400.0*7.0/6.0; + rx_tag = "_2800_low_carrier"; + tx_tag = "_2800"; + } + else if (strcmp(modem, "V.34_2800_high") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 20; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1867.0; + baud_rate = 2400.0*7.0/6.0; + rx_tag = "_2800_high_carrier"; + tx_tag = "_2800"; + } + else if (strcmp(modem, "V.34_3000") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 8; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1800.0; + baud_rate = 2400.0*5.0/4.0; + rx_tag = "_3000_low_carrier"; + tx_tag = "_3000"; + } + else if (strcmp(modem, "V.34_3000_high") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 8; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 2000.0; + baud_rate = 2400.0*5.0/4.0; + rx_tag = "_3000_high_carrier"; + tx_tag = "_3000"; + } + else if (strcmp(modem, "V.34_3200") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 5; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1829.0; + baud_rate = 2400.0*4.0/3.0; + rx_tag = "_3200_low_carrier"; + tx_tag = "_3200"; + } + else if (strcmp(modem, "V.34_3200_high") == 0) + { + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 5; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + carrier = 1920.0; + baud_rate = 2400.0*4.0/3.0; + rx_tag = "_3200_high_carrier"; + tx_tag = "_3200"; + } + else if (strcmp(modem, "V.34_3429") == 0) + { + /* There is only one carrier frequency defined for this baud rate */ + rx_coeff_sets = 192; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.25; + tx_coeff_sets = 7; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.12; + //carrier = 1959.0; + carrier = 1959.0; + baud_rate = 2400.0*10.0/7.0; + rx_tag = "_3429"; + tx_tag = "_3429"; + } else { usage(); diff --git a/libs/spandsp/src/modem_connect_tones.c b/libs/spandsp/src/modem_connect_tones.c index 25e96b04d2..4162286db8 100644 --- a/libs/spandsp/src/modem_connect_tones.c +++ b/libs/spandsp/src/modem_connect_tones.c @@ -29,9 +29,11 @@ /* CNG is 0.5s+-15% of 1100+-38Hz, 3s+-15% off, repeating. CED is 0.2s silence, 3.3+-0.7s of 2100+-15Hz, and 75+-20ms of silence. - + + Calling tone is 0.5s-0.7s of 1300Hz+-15Hz, 1.5s-2.0s off, repeating. + ANS is 3.3+-0.7s of 2100+-15Hz. - + ANS/ is 3.3+-0.7s of 2100+-15Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms. ANSam/ is 2100+-1Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms, and AM with a sinewave of 15+-0.1Hz. @@ -92,6 +94,8 @@ SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone) return "FAX preamble"; case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE: return "FAX CED or preamble"; + case MODEM_CONNECT_TONES_CALLING_TONE: + return "Calling tone"; } return "???"; } @@ -202,6 +206,29 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t * } s->duration_timer -= len; break; + case MODEM_CONNECT_TONES_CALLING_TONE: + for ( ; i < len; i++) + { + if (s->duration_timer > ms_to_samples(2000)) + { + if ((xlen = i + s->duration_timer - ms_to_samples(2000)) > len) + xlen = len; + s->duration_timer -= (xlen - i); + for ( ; i < xlen; i++) + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->level, 0); + } + if (s->duration_timer > 0) + { + if ((xlen = i + s->duration_timer) > len) + xlen = len; + s->duration_timer -= (xlen - i); + memset(amp + i, 0, sizeof(int16_t)*(xlen - i)); + i = xlen; + } + if (s->duration_timer == 0) + s->duration_timer = ms_to_samples(600 + 2000); + } + break; } return len; } @@ -274,6 +301,17 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem s->mod_phase = 0; s->hop_timer = ms_to_samples(450); break; + case MODEM_CONNECT_TONES_CALLING_TONE: + /* 0.6s of 1300Hz+-15Hz + 2.0s of silence repeating. */ + s->tone_phase_rate = dds_phase_rate(1300.0); + s->level = dds_scaling_dbm0(-11); + s->duration_timer = ms_to_samples(600 + 2000); + s->mod_phase_rate = 0; + s->tone_phase = 0; + s->mod_phase = 0; + s->mod_level = 0; + s->hop_timer = 0; + break; default: if (alloced) free(s); @@ -402,6 +440,8 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * famp = amp[i]; /* A Cauer notch at 1100Hz, spread just wide enough to meet our detection bandwidth criteria. */ + /* Poles 0.736618498*exp(+-1047/4000 * PI * j) + Zeroes exp(+-1099.5 * PI * j) */ v1 = 0.792928f*famp + 1.0018744927985f*s->znotch_1 - 0.54196833412465f*s->znotch_2; famp = v1 - 1.2994747954630f*s->znotch_1 + s->znotch_2; s->znotch_2 = s->znotch_1; @@ -446,6 +486,8 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * { famp = amp[i]; /* A Cauer bandpass at 15Hz, with which we demodulate the AM signal. */ + /* Poles 0.9983989*exp(+-15/4000 * PI * j) + Zeroes exp(0 * PI * j) */ v1 = fabs(famp) + 1.996667f*s->z15hz_1 - 0.9968004f*s->z15hz_2; filtered = 0.001599787f*(v1 - s->z15hz_2); s->z15hz_2 = s->z15hz_1; @@ -454,8 +496,8 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * //printf("%9.1f %10.4f %9d %9d\n", famp, filtered, s->am_level, s->channel_level); /* A Cauer notch at 2100Hz, spread just wide enough to meet our detection bandwidth criteria. */ - /* This is actually centred at 2095Hz, but gets the balance we want, due - to the asymmetric walls of the notch */ + /* Poles 0.7144255*exp(+-2105.612/4000 * PI * j) + Zeroes exp(+-2099.9 * PI * j) */ v1 = 0.76000f*famp - 0.1183852f*s->znotch_1 - 0.5104039f*s->znotch_2; famp = v1 + 0.1567596f*s->znotch_1 + s->znotch_2; s->znotch_2 = s->znotch_1; @@ -543,6 +585,44 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * } } break; + case MODEM_CONNECT_TONES_CALLING_TONE: + for (i = 0; i < len; i++) + { + famp = amp[i]; + /* A Cauer notch at 1300Hz, spread just wide enough to meet our detection bandwidth + criteria. */ + /* Poles 0.736618498*exp(+-1247/4000 * PI * j) + Zeroes exp(+-1299.5 * PI * j) */ + v1 = 0.755582f*famp + 0.820887174515f*s->znotch_1 - 0.541968324778f*s->znotch_2; + famp = v1 - 1.0456667108f*s->znotch_1 + s->znotch_2; + s->znotch_2 = s->znotch_1; + s->znotch_1 = v1; + notched = (int16_t) lfastrintf(famp); + + /* Estimate the overall energy in the channel, and the energy in + the notch (i.e. overall channel energy - tone energy => noise). + Use abs instead of multiply for speed (is it really faster?). */ + s->channel_level += ((abs(amp[i]) - s->channel_level) >> 5); + s->notch_level += ((abs(notched) - s->notch_level) >> 5); + if (s->channel_level > 70 && s->notch_level*6 < s->channel_level) + { + /* There is adequate energy in the channel, and it is mostly at 1300Hz. */ + if (s->tone_present != MODEM_CONNECT_TONES_CALLING_TONE) + { + if (++s->tone_cycle_duration >= ms_to_samples(415)) + report_tone_state(s, MODEM_CONNECT_TONES_CALLING_TONE, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + } + } + else + { + /* If the signal looks wrong, even for a moment, we consider this the + end of the tone. */ + if (s->tone_present == MODEM_CONNECT_TONES_CALLING_TONE) + report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99); + s->tone_cycle_duration = 0; + } + } + break; } return 0; } diff --git a/libs/spandsp/src/spandsp/modem_connect_tones.h b/libs/spandsp/src/spandsp/modem_connect_tones.h index db3831bf28..f0c0aaeb2e 100644 --- a/libs/spandsp/src/spandsp/modem_connect_tones.h +++ b/libs/spandsp/src/spandsp/modem_connect_tones.h @@ -75,7 +75,10 @@ enum /*! \brief CED tone is the same as ANS tone. FAX preamble in a string of V.21 HDLC flag octets. This is only valid as a tone type to receive. It is never reported as a detected tone type. The report will either be for FAX preamble or CED/ANS tone. */ - MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE = 7 + MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE = 7, + /*! \brief Calling tone is a pure 1300Hz tone, in 0.6s bursts, with 2s silences in between. The + bursts repeat for as long as is required. */ + MODEM_CONNECT_TONES_CALLING_TONE = 8 }; /*! \brief FAX CED tone is the same as ANS tone. */ diff --git a/libs/spandsp/src/spandsp/private/super_tone_rx.h b/libs/spandsp/src/spandsp/private/super_tone_rx.h index 1f0fd98564..e62d455d47 100644 --- a/libs/spandsp/src/spandsp/private/super_tone_rx.h +++ b/libs/spandsp/src/spandsp/private/super_tone_rx.h @@ -26,7 +26,7 @@ #if !defined(_SPANDSP_PRIVATE_SUPER_TONE_RX_H_) #define _SPANDSP_PRIVATE_SUPER_TONE_RX_H_ -#define BINS 128 +#define SUPER_TONE_BINS 128 struct super_tone_rx_segment_s { @@ -41,7 +41,7 @@ struct super_tone_rx_descriptor_s { int used_frequencies; int monitored_frequencies; - int pitches[BINS/2][2]; + int pitches[SUPER_TONE_BINS/2][2]; int tones; super_tone_rx_segment_t **tone_list; int *tone_segs; @@ -55,7 +55,7 @@ struct super_tone_rx_state_s int detected_tone; int rotation; tone_report_func_t tone_callback; - void (*segment_callback)(void *data, int f1, int f2, int duration); + tone_segment_func_t segment_callback; void *callback_data; super_tone_rx_segment_t segments[11]; goertzel_state_t state[]; diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h index d5016430e9..dca574df77 100644 --- a/libs/spandsp/src/spandsp/private/v22bis.h +++ b/libs/spandsp/src/spandsp/private/v22bis.h @@ -209,7 +209,7 @@ struct v22bis_state_s uint32_t guard_phase; /*! \brief The update rate for the phase of the guard tone (i.e. the DDS increment). */ int32_t guard_phase_rate; - float guard_level; + float guard_tone_gain; /*! \brief The current fractional phase of the baud timing. */ int baud_phase; /*! \brief The code number for the current position in the constellation. */ diff --git a/libs/spandsp/src/spandsp/v8.h b/libs/spandsp/src/spandsp/v8.h index 152c478fad..fa9df4a0c5 100644 --- a/libs/spandsp/src/spandsp/v8.h +++ b/libs/spandsp/src/spandsp/v8.h @@ -118,6 +118,8 @@ struct v8_parms_s { int status; int modem_connect_tone; + int send_ci; + int v92; int call_function; unsigned int modulations; int protocol; diff --git a/libs/spandsp/src/super_tone_rx.c b/libs/spandsp/src/super_tone_rx.c index 87934669ab..97b9655ea7 100644 --- a/libs/spandsp/src/super_tone_rx.c +++ b/libs/spandsp/src/super_tone_rx.c @@ -56,11 +56,11 @@ #include "spandsp/private/super_tone_rx.h" #if defined(SPANDSP_USE_FIXED_POINT) -#define DETECTION_THRESHOLD 16439 /* -42dBm0 [((BINS*BINS*32768.0/(1.4142*128.0))*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ +#define DETECTION_THRESHOLD 16439 /* -42dBm0 [((SUPER_TONE_BINS*SUPER_TONE_BINS*32768.0/(1.4142*128.0))*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ #define TONE_TWIST 4 /* 6dB */ #define TONE_TO_TOTAL_ENERGY 64 /* -3dB */ #else -#define DETECTION_THRESHOLD 2104205.6f /* -42dBm0 [((BINS*BINS*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ +#define DETECTION_THRESHOLD 2104205.6f /* -42dBm0 [((SUPER_TONE_BINS*SUPER_TONE_BINS*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ #define TONE_TWIST 3.981f /* 6dB */ #define TONE_TO_TOTAL_ENERGY 1.995f /* 3dB */ #endif @@ -86,7 +86,7 @@ static int add_super_tone_freq(super_tone_rx_descriptor_t *desc, int freq) /* Merge these two */ desc->pitches[desc->used_frequencies][0] = freq; desc->pitches[desc->used_frequencies][1] = i; - make_goertzel_descriptor(&desc->desc[desc->pitches[i][1]], (float) (freq + desc->pitches[i][0])/2, BINS); + make_goertzel_descriptor(&desc->desc[desc->pitches[i][1]], (float) (freq + desc->pitches[i][0])/2, SUPER_TONE_BINS); desc->used_frequencies++; return desc->pitches[i][1]; } @@ -97,7 +97,7 @@ static int add_super_tone_freq(super_tone_rx_descriptor_t *desc, int freq) { desc->desc = (goertzel_descriptor_t *) realloc(desc->desc, (desc->monitored_frequencies + 5)*sizeof(goertzel_descriptor_t)); } - make_goertzel_descriptor(&desc->desc[desc->monitored_frequencies++], (float) freq, BINS); + make_goertzel_descriptor(&desc->desc[desc->monitored_frequencies++], (float) freq, SUPER_TONE_BINS); desc->used_frequencies++; return desc->pitches[i][1]; } @@ -162,9 +162,9 @@ static int test_cadence(super_tone_rx_segment_t *pattern, j = (rotation + steps - 2)%steps; if (pattern[j].f1 != test[8].f1 || pattern[j].f2 != test[8].f2) return 0; - if (pattern[j].min_duration > test[8].min_duration*BINS + if (pattern[j].min_duration > test[8].min_duration*SUPER_TONE_BINS || - pattern[j].max_duration < test[8].min_duration*BINS) + pattern[j].max_duration < test[8].min_duration*SUPER_TONE_BINS) { return 0; } @@ -172,7 +172,7 @@ static int test_cadence(super_tone_rx_segment_t *pattern, j = (rotation + steps - 1)%steps; if (pattern[j].f1 != test[9].f1 || pattern[j].f2 != test[9].f2) return 0; - if (pattern[j].max_duration < test[9].min_duration*BINS) + if (pattern[j].max_duration < test[9].min_duration*SUPER_TONE_BINS) return 0; } else @@ -183,9 +183,9 @@ static int test_cadence(super_tone_rx_segment_t *pattern, j = i + 10 - steps; if (pattern[i].f1 != test[j].f1 || pattern[i].f2 != test[j].f2) return 0; - if (pattern[i].min_duration > test[j].min_duration*BINS + if (pattern[i].min_duration > test[j].min_duration*SUPER_TONE_BINS || - pattern[i].max_duration < test[j].min_duration*BINS) + pattern[i].max_duration < test[j].min_duration*SUPER_TONE_BINS) { return 0; } @@ -313,9 +313,9 @@ static void super_tone_chunk(super_tone_rx_state_t *s) int k1; int k2; #if defined(SPANDSP_USE_FIXED_POINT) - int32_t res[BINS/2]; + int32_t res[SUPER_TONE_BINS/2]; #else - float res[BINS/2]; + float res[SUPER_TONE_BINS/2]; #endif for (i = 0; i < s->desc->monitored_frequencies; i++) @@ -397,7 +397,7 @@ static void super_tone_chunk(super_tone_rx_state_t *s) s->segment_callback(s->callback_data, s->segments[9].f1, s->segments[9].f2, - s->segments[9].min_duration*BINS/8); + s->segments[9].min_duration*SUPER_TONE_BINS/8); } memcpy (&s->segments[0], &s->segments[1], 9*sizeof(s->segments[0])); s->segments[9].f1 = k1; @@ -467,7 +467,7 @@ SPAN_DECLARE(int) super_tone_rx(super_tone_rx_state_t *s, const int16_t amp[], i s->energy += xamp*xamp; #endif } - if (s->state[0].current_sample >= BINS) + if (s->state[0].current_sample >= SUPER_TONE_BINS) { /* We have finished a Goertzel block. */ super_tone_chunk(s); diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 4c0c5a59da..1cf859b997 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -440,9 +440,9 @@ static int set_next_tx_type(t38_gateway_state_t *s) /* There is a handler queued, so that is the next one. */ set_tx_handler(s, t->next_tx_handler, t->next_tx_user_data); set_next_tx_handler(s, NULL, NULL); - if (t->tx_handler == (span_tx_handler_t) &(silence_gen) + if (t->tx_handler == (span_tx_handler_t) &silence_gen || - t->tx_handler == (span_tx_handler_t) &(tone_gen)) + t->tx_handler == (span_tx_handler_t) &tone_gen) { set_rx_active(s, TRUE); } diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index b35d5fa4e9..ee939b5cfd 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -111,7 +111,7 @@ static const struct dtmf_to_ascii_s dtmf_to_ascii[] = {"##8", 'W'}, {"##9", 'Z'}, {"##0", ' '}, -#if defined(WIN32) || ( defined(__SVR4) && defined (__sun)) +#if defined(WIN32) || (defined(__SVR4) && defined (__sun)) {"#*1", 'X'}, // (Note 1) 111 1011 {"#*2", 'X'}, // (Note 1) 111 1100 {"#*3", 'X'}, // (Note 1) 111 1101 diff --git a/libs/spandsp/src/v22bis_rx.c b/libs/spandsp/src/v22bis_rx.c index 55c540d53e..85c0b9e10c 100644 --- a/libs/spandsp/src/v22bis_rx.c +++ b/libs/spandsp/src/v22bis_rx.c @@ -52,6 +52,9 @@ #include "spandsp/telephony.h" #include "spandsp/logging.h" +#include "spandsp/fast_convert.h" +#include "spandsp/math_fixed.h" +#include "spandsp/saturated.h" #include "spandsp/complex.h" #include "spandsp/vector_float.h" #include "spandsp/complex_vector_float.h" @@ -77,12 +80,12 @@ #include "v22bis_rx_2400_floating_rrc.h" #endif -#define ms_to_symbols(t) (((t)*600)/1000) +#define ms_to_symbols(t) (((t)*600)/1000) /*! The adaption rate coefficient for the equalizer */ -#define EQUALIZER_DELTA 0.25f +#define EQUALIZER_DELTA 0.25f /*! The number of phase shifted coefficient set for the pulse shaping/bandpass filter */ -#define PULSESHAPER_COEFF_SETS 12 +#define PULSESHAPER_COEFF_SETS 12 /* The basic method used by the V.22bis receiver is: diff --git a/libs/spandsp/src/v22bis_tx.c b/libs/spandsp/src/v22bis_tx.c index 39ad4dd240..41c7ed2f38 100644 --- a/libs/spandsp/src/v22bis_tx.c +++ b/libs/spandsp/src/v22bis_tx.c @@ -310,8 +310,8 @@ static __inline__ int get_scrambled_bit(v22bis_state_t *s) static complexf_t training_get(v22bis_state_t *s) { - complexf_t z; int bits; + static const complexf_t zero = {0.0f, 0.0f}; /* V.22bis training sequence */ switch (s->tx.training) @@ -329,20 +329,17 @@ static complexf_t training_get(v22bis_state_t *s) case V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE: /* Silence */ s->tx.constellation_state = 0; - z = complex_setf(0.0f, 0.0f); - break; + return zero; case V22BIS_TX_TRAINING_STAGE_U11: /* Send continuous unscrambled ones at 1200bps (i.e. 270 degree phase steps). */ /* Only the answering modem sends unscrambled ones. It is the first thing exchanged between the modems. */ s->tx.constellation_state = (s->tx.constellation_state + phase_steps[3]) & 3; - z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; - break; + return v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; case V22BIS_TX_TRAINING_STAGE_U0011: /* Continuous unscrambled double dibit 00 11 at 1200bps. This is termed the S1 segment in the V.22bis spec. It is only sent to request or accept 2400bps mode, and lasts 100+-3ms. After this timed burst, we unconditionally change to sending scrambled ones at 1200bps. */ s->tx.constellation_state = (s->tx.constellation_state + phase_steps[3*(s->tx.training_count & 1)]) & 3; - z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; if (++s->tx.training_count >= ms_to_symbols(100)) { span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 after U0011\n"); @@ -357,7 +354,7 @@ static complexf_t training_get(v22bis_state_t *s) s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11; } } - break; + return v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; case V22BIS_TX_TRAINING_STAGE_TIMED_S11: /* A timed period of scrambled ones at 1200bps. */ if (++s->tx.training_count >= ms_to_symbols(756)) @@ -383,8 +380,7 @@ static complexf_t training_get(v22bis_state_t *s) bits = scramble(s, 1); bits = (bits << 1) | scramble(s, 1); s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3; - z = v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; - break; + return v22bis_constellation[(s->tx.constellation_state << 2) | 0x01]; case V22BIS_TX_TRAINING_STAGE_S1111: /* Scrambled ones at 2400bps. We send a timed 200ms burst, and switch to normal operation at 2400bps */ bits = scramble(s, 1); @@ -392,7 +388,6 @@ static complexf_t training_get(v22bis_state_t *s) s->tx.constellation_state = (s->tx.constellation_state + phase_steps[bits]) & 3; bits = scramble(s, 1); bits = (bits << 1) | scramble(s, 1); - z = v22bis_constellation[(s->tx.constellation_state << 2) | bits]; if (++s->tx.training_count >= ms_to_symbols(200)) { /* We have completed training. Now handle some real work. */ @@ -402,13 +397,9 @@ static complexf_t training_get(v22bis_state_t *s) v22bis_report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); s->tx.current_get_bit = s->get_bit; } - break; - case V22BIS_TX_TRAINING_STAGE_PARKED: - default: - z = complex_setf(0.0f, 0.0f); - break; + return v22bis_constellation[(s->tx.constellation_state << 2) | bits]; } - return z; + return zero; } /*- End of function --------------------------------------------------------*/ @@ -476,12 +467,12 @@ SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) x.im += tx_pulseshaper[39 - s->tx.baud_phase][i]*s->tx.rrc_filter[i + s->tx.rrc_filter_step].im; } /* Now create and modulate the carrier */ - z = dds_complexf(&(s->tx.carrier_phase), s->tx.carrier_phase_rate); + z = dds_complexf(&s->tx.carrier_phase, s->tx.carrier_phase_rate); famp = (x.re*z.re - x.im*z.im)*s->tx.gain; if (s->tx.guard_phase_rate && (s->tx.rrc_filter[s->tx.rrc_filter_step].re != 0.0f || s->tx.rrc_filter[s->tx.rrc_filter_step].im != 0.0f)) { /* Add the guard tone */ - famp += dds_modf(&(s->tx.guard_phase), s->tx.guard_phase_rate, s->tx.guard_level, 0); + famp += dds_modf(&s->tx.guard_phase, s->tx.guard_phase_rate, s->tx.guard_tone_gain, 0); } /* Don't bother saturating. We should never clip. */ amp[sample] = (int16_t) lfastrintf(famp); @@ -499,20 +490,20 @@ SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power) l = 1.6f*powf(10.0f, (power - 1.0f - DBM0_MAX_POWER)/20.0f); s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); l = powf(10.0f, (power - 1.0f - 3.0f - DBM0_MAX_POWER)/20.0f); - s->tx.guard_level = l*32768.0f; + s->tx.guard_tone_gain = l*32768.0f; } else if(s->tx.guard_phase_rate == dds_phase_ratef(1800.0f)) { l = 1.6f*powf(10.0f, (power - 1.0f - 1.0f - DBM0_MAX_POWER)/20.0f); s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); l = powf(10.0f, (power - 1.0f - 6.0f - DBM0_MAX_POWER)/20.0f); - s->tx.guard_level = l*32768.0f; + s->tx.guard_tone_gain = l*32768.0f; } else { l = 1.6f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f); s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); - s->tx.guard_level = 0; + s->tx.guard_tone_gain = 0; } } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/v8.c b/libs/spandsp/src/v8.c index 8ac13d3dd8..37ef368a44 100644 --- a/libs/spandsp/src/v8.c +++ b/libs/spandsp/src/v8.c @@ -63,7 +63,8 @@ enum { - V8_WAIT_1S, + V8_WAIT_1S, /* Start point when sending CI */ + V8_AWAIT_ANSAM, /* Start point when sending initial silence */ V8_CI_ON, V8_CI_OFF, V8_HEARD_ANSAM, @@ -100,7 +101,8 @@ enum enum { V8_CI_SYNC_OCTET = 0x00, - V8_CM_JM_SYNC_OCTET = 0xE0 + V8_CM_JM_SYNC_OCTET = 0xE0, + V8_V92_SYNC_OCTET = 0x55 }; SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function) @@ -755,7 +757,24 @@ SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len) } /*- End of function --------------------------------------------------------*/ -static void v8_send_ci(v8_state_t *s) +static void send_v92(v8_state_t *s) +{ + int i; + + if (s->result.v92 >= 0) + { + /* Send 2 V.92 packets */ + for (i = 0; i < 2; i++) + { + v8_put_preamble(s); + v8_put_byte(s, V8_V92_SYNC_OCTET); + v8_put_byte(s, s->result.v92); + } + } +} +/*- End of function --------------------------------------------------------*/ + +static void send_ci(v8_state_t *s) { int i; @@ -810,7 +829,7 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) if ((s->negotiation_timer -= len) > 0) break; fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]); - v8_send_ci(s); + send_ci(s); s->state = V8_CI_ON; s->fsk_tx_on = TRUE; break; @@ -851,12 +870,18 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) { /* Try again */ fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]); - v8_send_ci(s); + send_ci(s); s->state = V8_CI_ON; s->fsk_tx_on = TRUE; } } break; + case V8_AWAIT_ANSAM: + residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len); + /* Check if an ANSam or ANSam/ tone has been detected */ + if ((tone = modem_connect_tones_rx_get(&s->ansam_rx)) != MODEM_CONNECT_TONES_NONE) + handle_modem_connect_tone(s, tone); + break; case V8_HEARD_ANSAM: /* We have heard the ANSam or ANSam/ signal, but we still need to wait for the end of the Te timeout period to comply with the spec. */ @@ -865,6 +890,7 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) v8_decode_init(s); s->negotiation_timer = ms_to_samples(5000); fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]); + send_v92(s); send_cm_jm(s); s->state = V8_CM_ON; s->fsk_tx_on = TRUE; @@ -1015,9 +1041,16 @@ SPAN_DECLARE(int) v8_restart(v8_state_t *s, int calling_party, v8_parms_t *parms s->calling_party = calling_party; if (s->calling_party) { - s->state = V8_WAIT_1S; - s->negotiation_timer = ms_to_samples(1000); - s->ci_count = 0; + if (s->result.send_ci) + { + s->state = V8_WAIT_1S; + s->negotiation_timer = ms_to_samples(1000); + s->ci_count = 0; + } + else + { + s->state = V8_AWAIT_ANSAM; + } modem_connect_tones_rx_init(&s->ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH1], get_bit, s); } diff --git a/libs/spandsp/src/vector_float.c b/libs/spandsp/src/vector_float.c index 7b5a7efa69..dd09e449e1 100644 --- a/libs/spandsp/src/vector_float.c +++ b/libs/spandsp/src/vector_float.c @@ -107,8 +107,8 @@ SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n) SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n) { int i; - static const uint32_t mask = 0x80000000; - static const float *fmask = (float *) &mask; + static const uint32_t mask = 0x80000000; + static const float *fmask = (float *) &mask; __m128 n1; __m128 n2; @@ -118,7 +118,7 @@ SPAN_DECLARE(void) vec_negatef(float z[], const float x[], int n) for (i -= 4; i >= 0; i -= 4) { n1 = _mm_loadu_ps(x + i); - n1 = _mm_xor_ps(n1, n2); + n1 = _mm_xor_ps(n1, n2); _mm_storeu_ps(z + i, n1); } } diff --git a/libs/spandsp/tests/fax_tester.h b/libs/spandsp/tests/fax_tester.h index 9735e0f2a5..3d64e2e6b7 100644 --- a/libs/spandsp/tests/fax_tester.h +++ b/libs/spandsp/tests/fax_tester.h @@ -37,7 +37,7 @@ typedef struct faxtester_state_s faxtester_state_t; -typedef void (faxtester_flush_handler_t)(faxtester_state_t *s, void *user_data, int which); +typedef void (*faxtester_flush_handler_t)(faxtester_state_t *s, void *user_data, int which); /*! FAX tester real time frame handler. @@ -48,13 +48,13 @@ typedef void (faxtester_flush_handler_t)(faxtester_state_t *s, void *user_data, \param msg The HDLC message. \param len The length of the message. */ -typedef void (faxtester_real_time_frame_handler_t)(faxtester_state_t *s, - void *user_data, - int direction, - const uint8_t *msg, - int len); +typedef void (*faxtester_real_time_frame_handler_t)(faxtester_state_t *s, + void *user_data, + int direction, + const uint8_t *msg, + int len); -typedef void (faxtester_front_end_step_complete_handler_t)(faxtester_state_t *s, void *user_data); +typedef void (*faxtester_front_end_step_complete_handler_t)(faxtester_state_t *s, void *user_data); /*! FAX tester descriptor. @@ -64,19 +64,19 @@ struct faxtester_state_s /*! \brief Pointer to our current step in the test. */ xmlNodePtr cur; - faxtester_flush_handler_t *flush_handler; + faxtester_flush_handler_t flush_handler; void *flush_user_data; /*! \brief A pointer to a callback routine to be called when frames are exchanged. */ - faxtester_real_time_frame_handler_t *real_time_frame_handler; + faxtester_real_time_frame_handler_t real_time_frame_handler; /*! \brief An opaque pointer supplied in real time frame callbacks. */ void *real_time_frame_user_data; - faxtester_front_end_step_complete_handler_t *front_end_step_complete_handler; + faxtester_front_end_step_complete_handler_t front_end_step_complete_handler; void *front_end_step_complete_user_data; - faxtester_front_end_step_complete_handler_t *front_end_step_timeout_handler; + faxtester_front_end_step_complete_handler_t front_end_step_timeout_handler; void *front_end_step_timeout_user_data; const uint8_t *image_buffer; @@ -149,7 +149,7 @@ void faxtester_send_hdlc_flags(faxtester_state_t *s, int flags); void faxtester_send_hdlc_msg(faxtester_state_t *s, const uint8_t *msg, int len, int crc_ok); -void faxtester_set_flush_handler(faxtester_state_t *s, faxtester_flush_handler_t *handler, void *user_data); +void faxtester_set_flush_handler(faxtester_state_t *s, faxtester_flush_handler_t handler, void *user_data); /*! Select whether silent audio will be sent when FAX transmit is idle. \brief Select whether silent audio will be sent when FAX transmit is idle. @@ -167,11 +167,11 @@ void faxtester_set_transmit_on_idle(faxtester_state_t *s, int transmit_on_idle); */ void faxtester_set_tep_mode(faxtester_state_t *s, int use_tep); -void faxtester_set_real_time_frame_handler(faxtester_state_t *s, faxtester_real_time_frame_handler_t *handler, void *user_data); +void faxtester_set_real_time_frame_handler(faxtester_state_t *s, faxtester_real_time_frame_handler_t handler, void *user_data); -void faxtester_set_front_end_step_complete_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data); +void faxtester_set_front_end_step_complete_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t handler, void *user_data); -void faxtester_set_front_end_step_timeout_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t *handler, void *user_data); +void faxtester_set_front_end_step_timeout_handler(faxtester_state_t *s, faxtester_front_end_step_complete_handler_t handler, void *user_data); void faxtester_set_timeout(faxtester_state_t *s, int timeout); diff --git a/libs/spandsp/tests/udptl.h b/libs/spandsp/tests/udptl.h index 23563ad484..ae555cd500 100644 --- a/libs/spandsp/tests/udptl.h +++ b/libs/spandsp/tests/udptl.h @@ -31,7 +31,7 @@ #define UDPTL_BUF_MASK 15 -typedef int (udptl_rx_packet_handler_t) (void *user_data, const uint8_t msg[], int len, int seq_no); +typedef int (*udptl_rx_packet_handler_t) (void *user_data, const uint8_t msg[], int len, int seq_no); typedef struct { @@ -51,7 +51,7 @@ typedef struct struct udptl_state_s { - udptl_rx_packet_handler_t *rx_packet_handler; + udptl_rx_packet_handler_t rx_packet_handler; void *user_data; /*! This option indicates the error correction scheme used in transmitted UDPTL From 04bd463d12bf4c0116bec3cee537749b2040ed40 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Wed, 4 Jul 2012 12:09:32 -0700 Subject: [PATCH 0621/1057] Add phrase macro with funny prompts and sample dp x9386 (9FUN) --- conf/vanilla/dialplan/default.xml | 9 +++++++ conf/vanilla/lang/en/demo/funnies.xml | 35 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 conf/vanilla/lang/en/demo/funnies.xml diff --git a/conf/vanilla/dialplan/default.xml b/conf/vanilla/dialplan/default.xml index fb6713d0ce..82189d6633 100644 --- a/conf/vanilla/dialplan/default.xml +++ b/conf/vanilla/dialplan/default.xml @@ -720,6 +720,15 @@ + + + + + + + + + diff --git a/conf/vanilla/lang/en/demo/funnies.xml b/conf/vanilla/lang/en/demo/funnies.xml new file mode 100644 index 0000000000..e901c5ad9c --- /dev/null +++ b/conf/vanilla/lang/en/demo/funnies.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 939a26764fe58aa3681888dea4b2e82d4c92743f Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 4 Jul 2012 23:06:32 -0500 Subject: [PATCH 0622/1057] FS-4387 --resolve --- src/switch_time.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index 7cb47822d2..96e4ec9937 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -442,7 +442,13 @@ static switch_time_t time_now(int64_t offset) SWITCH_DECLARE(switch_time_t) switch_time_ref(void) { - return time_now(0); + if (SYSTEM_TIME) { + /* Return system time reference */ + return time_now(0); + } else { + /* Return monotonic time reference (when available) */ + return time_now(-1); + } } static switch_time_t last_time = 0; @@ -458,7 +464,7 @@ SWITCH_DECLARE(void) switch_time_sync(void) runtime.mono_reference = time_now(-1); runtime.offset = 0; } else { - runtime.offset = runtime.reference - time_now(0); + runtime.offset = runtime.reference - time_now(-1); /* Get the offset between system time and the monotonic clock (when available) */ runtime.reference = time_now(runtime.offset); } @@ -844,7 +850,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) if (MONO) { int loops; for (loops = 0; loops < 3; loops++) { - ts = time_now(0); + ts = switch_time_ref(); /* if it returns the same value every time it won't be of much use. */ if (ts == last) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Broken MONOTONIC Clock Detected!, Support Disabled.\n"); @@ -1287,6 +1293,8 @@ SWITCH_MODULE_LOAD_FUNCTION(softtimer_load) } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enabled Windows monotonic clock, using timeGetTime()\n"); } + + runtime.mono_initiated = switch_mono_micro_time_now(); /* Update mono_initiated, since now is the first time the real clock is enabled */ } /* No need to calibrate clock in Win32, we will only sleep ms anyway, it's just not accurate enough */ From 5bc2745472d9713451359072d128f5263ea7df25 Mon Sep 17 00:00:00 2001 From: Darren Schreiber Date: Thu, 5 Jul 2012 01:47:07 -0700 Subject: [PATCH 0623/1057] Avoid segfault and race condition when socket is destroyed while listener is in use. --- .../mod_erlang_event/mod_erlang_event.c | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index b8e13b2a5c..8d7b239282 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -411,14 +411,20 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c switch_thread_rwlock_rdlock(globals.bindings_rwlock); - for (ptr = bindings.head; ptr; ptr = ptr->next) { - if (ptr->section != section) - continue; + /* Keep the listener from getting pulled out from under us */ + switch_thread_rwlock_rdlock(globals.listener_rwlock); + for (ptr = bindings.head; ptr; ptr = ptr->next) { + /* If we got listener_rwlock while a listner thread was dying after removing the listener + from listener_list but before locking for the bindings removal (now pending our lock) check + if it already closed the socket. Our listener pointer should still be good (pointed at an orphan + listener) until it is removed from the binding...*/ if (!ptr->listener) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NULL pointer binding!\n"); - switch_thread_rwlock_unlock(globals.bindings_rwlock); - goto cleanup; /* our pointer is trash */ + continue; + } + + if (ptr->section != section) { + continue; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "binding for %s in section %s with key %s and value %s requested from node %s\n", tag_name, sectionstr, key_name, key_value, ptr->process.pid.node); @@ -445,11 +451,14 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c on our condition before the action starts. */ switch_mutex_lock(ptr->listener->sock_mutex); - ei_sendto(ptr->listener->ec, ptr->listener->sockfd, &ptr->process, &buf); + if (ptr->listener->sockfd) { + ei_sendto(ptr->listener->ec, ptr->listener->sockfd, &ptr->process, &buf); + } switch_mutex_unlock(ptr->listener->sock_mutex); } switch_thread_rwlock_unlock(globals.bindings_rwlock); + switch_thread_rwlock_unlock(globals.listener_rwlock); ei_x_free(&buf); @@ -1243,9 +1252,11 @@ void destroy_listener(listener_t * listener) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n"); switch_thread_rwlock_wrlock(listener->rwlock); + switch_mutex_lock(listener->sock_mutex); if (listener->sockfd) { close_socket(&listener->sockfd); } + switch_mutex_unlock(listener->sock_mutex); switch_core_hash_destroy(&listener->event_hash); From 694c8c0fa198d7e920db42f81d3237a04806ac7a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jul 2012 11:42:07 -0500 Subject: [PATCH 0624/1057] FS-4335 please update and try this --- src/mod/endpoints/mod_sofia/sofia.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index bcc1acbc73..af7605e6c2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5640,6 +5640,10 @@ void *SWITCH_THREAD_FUNC media_on_hold_thread_run(switch_thread_t *thread, void if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) { if (switch_core_session_compare(session, other_session)) { sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK); + + switch_yield(100000); + switch_channel_wait_for_flag(channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL); + switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE); if (tech_pvt->rtp_session) { @@ -6227,7 +6231,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_core_session_message_t *msg; private_object_t *other_tech_pvt; - if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 && profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) { + if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 && (profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD)) { if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp)) { tech_pvt->hold_laps = 1; switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp); From ef23fbaf12c9a435e93b3640f87f90604fc8633f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jul 2012 12:04:30 -0500 Subject: [PATCH 0625/1057] FS-4374 moving the memory to the heap, this should take care of the problem for sure --- src/mod/endpoints/mod_sofia/sofia_glue.c | 80 ++++++++++++------------ 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 68763cd452..a62c184907 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -372,10 +372,10 @@ void sofia_glue_check_dtmf_type(private_object_t *tech_pvt) } } - +#define SDPBUFLEN 65536 void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch_port_t port, const char *sr, int force) { - char buf[65536]; + char *buf; int ptime = 0; uint32_t rate = 0; uint32_t v_port; @@ -393,7 +393,9 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch switch_event_t *map = NULL, *ptmap = NULL; const char *b_sdp = NULL; int verbose_sdp = 0; - + + switch_zmalloc(buf, SDPBUFLEN); + sofia_glue_check_dtmf_type(tech_pvt); if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) || @@ -492,7 +494,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } family = strchr(ip, ':') ? "IP6" : "IP4"; - switch_snprintf(buf, sizeof(buf), + switch_snprintf(buf, SDPBUFLEN, "v=0\n" "o=%s %010u %010u IN %s %s\n" "s=%s\n" @@ -501,25 +503,25 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch username, tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip, srbuf); if (tech_pvt->rm_encoding) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio %d RTP/%sAVP", + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio %d RTP/%sAVP", port, (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : ""); - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", tech_pvt->pt); if ((tech_pvt->dtmf_type == DTMF_2833 || sofia_test_pflag(tech_pvt->profile, PFLAG_LIBERAL_DTMF) || sofia_test_flag(tech_pvt, TFLAG_LIBERAL_DTMF)) && tech_pvt->te > 95) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", tech_pvt->te); } if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", tech_pvt->cng_pt); } - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n"); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\n"); rate = tech_pvt->rm_rate; - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->agreed_pt, tech_pvt->rm_encoding, rate); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->agreed_pt, tech_pvt->rm_encoding, rate); if (fmtp_out) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->agreed_pt, fmtp_out); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->agreed_pt, fmtp_out); } if (tech_pvt->read_codec.implementation && !ptime) { @@ -529,40 +531,40 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch if ((tech_pvt->dtmf_type == DTMF_2833 || sofia_test_pflag(tech_pvt->profile, PFLAG_LIBERAL_DTMF) || sofia_test_flag(tech_pvt, TFLAG_LIBERAL_DTMF)) && 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); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te); } if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt); if (!tech_pvt->rm_encoding) { tech_pvt->cng_pt = 0; } } else { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n"); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=silenceSupp:off - - - -\n"); } if (append_audio) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s%s", append_audio, end_of(append_audio) == '\n' ? "" : "\n"); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "%s%s", append_audio, end_of(append_audio) == '\n' ? "" : "\n"); } if (ptime) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ptime:%d\n", ptime); } if (tech_pvt->local_sdp_audio_zrtp_hash) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Adding audio a=zrtp-hash:%s\n", tech_pvt->local_sdp_audio_zrtp_hash); - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=zrtp-hash:%s\n", + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=zrtp-hash:%s\n", tech_pvt->local_sdp_audio_zrtp_hash); } if (!zstr(sr)) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - 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"); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key); + //switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=encryption:optional\n"); } } else if (tech_pvt->num_codecs) { @@ -585,7 +587,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch int both = 1; 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); + generate_m(tech_pvt, buf, SDPBUFLEN, port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1); bp = (buf + strlen(buf)); /* asterisk can't handle AVP and SAVP in sep streams, way to blow off the spec....*/ @@ -596,7 +598,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } if (both) { - generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0); + generate_m(tech_pvt, bp, SDPBUFLEN - strlen(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0); } } else { @@ -621,7 +623,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch cur_ptime = this_ptime; if ((!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE))) { - generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1); + generate_m(tech_pvt, bp, SDPBUFLEN - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1); bp = (buf + strlen(buf)); /* asterisk can't handle AVP and SAVP in sep streams, way to blow off the spec....*/ @@ -631,7 +633,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } if (both) { - generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0); + generate_m(tech_pvt, bp, SDPBUFLEN - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0); } } @@ -646,12 +648,12 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } if ((v_port = tech_pvt->adv_sdp_video_port)) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=video %d RTP/AVP", v_port); /*****************************/ if (tech_pvt->video_rm_encoding) { sofia_glue_tech_set_video_codec(tech_pvt, 0); - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_agreed_pt); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", tech_pvt->video_agreed_pt); } else if (tech_pvt->num_codecs) { int i; int already_did[128] = { 0 }; @@ -669,19 +671,19 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch already_did[tech_pvt->ianacodes[i]] = 1; } - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->ianacodes[i]); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", tech_pvt->ianacodes[i]); if (!ptime) { ptime = imp->microseconds_per_packet / 1000; } } } - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n"); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\n"); if (tech_pvt->video_rm_encoding) { const char *of; rate = tech_pvt->video_rm_rate; - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate); if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) { @@ -704,7 +706,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } if (pass_fmtp) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, pass_fmtp); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, pass_fmtp); } } else if (tech_pvt->num_codecs) { @@ -732,7 +734,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", ianacode, imp->iananame, + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d\n", ianacode, imp->iananame, imp->samples_per_second); if (!zstr(ov_fmtp)) { @@ -749,7 +751,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } if (!zstr(fmtp) && strcasecmp(fmtp, "_blank_")) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", ianacode, fmtp); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\n", ianacode, fmtp); } } @@ -758,7 +760,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch if (tech_pvt->local_sdp_video_zrtp_hash) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Adding video a=zrtp-hash:%s\n", tech_pvt->local_sdp_video_zrtp_hash); - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=zrtp-hash:%s\n", + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=zrtp-hash:%s\n", tech_pvt->local_sdp_video_zrtp_hash); } } @@ -4020,7 +4022,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha for (m = sdp->sdp_media; m; m = m->m_next) { ptime = dptime; if (m->m_type == sdp_media_image && m->m_port) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",t38"); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), ",t38"); } else if (m->m_type == sdp_media_audio && m->m_port) { for (attr = m->m_attributes; attr; attr = attr->a_next) { if (zstr(attr->a_name)) { @@ -4061,7 +4063,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha } if (match) { - add_audio_codec(map, ptime, buf, sizeof(buf)); + add_audio_codec(map, ptime, buf, SDPBUFLEN); break; } @@ -4090,7 +4092,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha } if (match) { - add_audio_codec(map, ptime, buf, sizeof(buf)); + add_audio_codec(map, ptime, buf, SDPBUFLEN); break; } } @@ -4129,10 +4131,10 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha if (match) { if (ptime > 0) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime); } else { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); } already_did[imp->ianacode] = 1; break; @@ -4394,7 +4396,7 @@ switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, swi } } - switch_snprintf(buf, sizeof(buf), "%d", map->rm_pt); + switch_snprintf(buf, SDPBUFLEN, "%d", map->rm_pt); if (br) { switch_snprintf(key, sizeof(key), "%s:%s", map->rm_encoding, br); From bf20f524520968eb71d3f6457a8af57ef79d619f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jul 2012 12:34:09 -0500 Subject: [PATCH 0626/1057] add execute_on_post_originate and api_on_post_originate to run on chosen newly originated channels vs execute_on_originate which runs on all candidates --- src/include/switch_types.h | 2 ++ src/switch_ivr_originate.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index c5e1fab7b4..dd301bd5ce 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -143,6 +143,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring" #define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect" #define SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE "execute_on_originate" +#define SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE "execute_on_post_originate" #define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer" #define SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE "api_on_pre_answer" @@ -150,6 +151,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CHANNEL_API_ON_RING_VARIABLE "api_on_ring" #define SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE "api_on_tone_detect" #define SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE "api_on_originate" +#define SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE "api_on_post_originate" #define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout" #define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid" diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 6d3ad966ec..0a9c82eff7 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3598,6 +3598,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } + switch_channel_execute_on(bchan, SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE); + switch_channel_api_on(bchan, SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE); + + while(switch_channel_state_change_pending(bchan)) { switch_cond_next(); } From b6ac33ea80b27fe32335fc04f864b86f37651b19 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jul 2012 14:27:32 -0500 Subject: [PATCH 0627/1057] come to cluecon --- Makefile.am | 1 + build/Makefile.am | 4 ++-- cluecon.tmpl | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 cluecon.tmpl diff --git a/Makefile.am b/Makefile.am index 99d3c2dd92..1aa424f754 100644 --- a/Makefile.am +++ b/Makefile.am @@ -656,6 +656,7 @@ cluecon: @clear @echo Thank you for updating. This is going to take a while so relax. @echo Now would be a good time to register for ClueCon! + @cat cluecon.tmpl @echo @echo http://www.cluecon.com @sleep 5 diff --git a/build/Makefile.am b/build/Makefile.am index 1d57dad528..e7c22a7640 100644 --- a/build/Makefile.am +++ b/build/Makefile.am @@ -11,7 +11,7 @@ all: @echo " + http://www.cluecon.com +" @echo " + +" @echo " +-----------------------------------------------+" - + @cat ../cluecon.tmpl install: @echo " +---------- FreeSWITCH install Complete ----------+" @@ -69,7 +69,7 @@ install: @echo " + http://www.cluecon.com +" @echo " + +" @echo " +-------------------------------------------------+" - + @cat ../cluecon.tmpl .PHONY: check dvi html info install-data \ diff --git a/cluecon.tmpl b/cluecon.tmpl new file mode 100644 index 0000000000..5818f80a61 --- /dev/null +++ b/cluecon.tmpl @@ -0,0 +1,26 @@ +.===========================================================================================================. +| ____ _____ ____ _ ____ _ _ ____ | +| / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ \ | +| | | / _ \| '_ ` _ \ / _ \ | |/ _ \ | | | | | | |/ _ \ | / _ \| '_ \ |/| | __) | | +| | |__| (_) | | | | | | __/ | | (_) | | |___| | |_| | __/ |__| (_) | | | | | |/ __/ | +| \____\___/|_| |_| |_|\___| |_|\___/ \____|_|\__,_|\___|\____\___/|_| |_| |_|_____| | +| | +| ____ _ _ _ _ ____ _ | +| / ___| |__ (_) ___ __ _ __ _ ___ | | | / ___| / \ | +| | | | '_ \| |/ __/ _` |/ _` |/ _ \ | | | \___ \ / _ \ | +| | |___| | | | | (_| (_| | (_| | (_) | | |_| |___) / ___ \ | +| \____|_| |_|_|\___\__,_|\__, |\___/ \___/|____/_/ \_\ | +| |___/ | +| _ _ _____ _ _ _ ___ _ _ ____ ___ _ ____ | +| / \ _ _ __ _ _ _ ___| |_ |___ | |_| |__ / |/ _ \| |_| |__ |___ \ / _ \/ |___ \ | +| / _ \| | | |/ _` | | | / __| __| / /| __| '_ \ _____ | | | | | __| '_ \ __) | | | | | __) | | +| / ___ \ |_| | (_| | |_| \__ \ |_ / / | |_| | | | |_____| | | |_| | |_| | | | / __/| |_| | |/ __/ | +| /_/ \_\__,_|\__, |\__,_|___/\__| /_/ \__|_| |_| |_|\___/ \__|_| |_| |_____|\___/|_|_____| | +| |___/ | +| _ | +| __ ____ ____ __ ___| |_ _ ___ ___ ___ _ __ ___ ___ _ __ ___ | +| \ \ /\ / /\ \ /\ / /\ \ /\ / / / __| | | | |/ _ \/ __/ _ \| '_ \ / __/ _ \| '_ ` _ \ | +| \ V V / \ V V / \ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | | +| \_/\_/ \_/\_/ \_/\_/ (_) \___|_|\__,_|\___|\___\___/|_| |_| (_) \___\___/|_| |_| |_| | +| | +.===========================================================================================================. From 48779a80c2803914b2953d11f711a9b50f7586a7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jul 2012 14:29:48 -0500 Subject: [PATCH 0628/1057] add space --- cluecon.tmpl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cluecon.tmpl b/cluecon.tmpl index 5818f80a61..e66eda8a13 100644 --- a/cluecon.tmpl +++ b/cluecon.tmpl @@ -1,4 +1,5 @@ -.===========================================================================================================. + +.===========================================================================================================. | ____ _____ ____ _ ____ _ _ ____ | | / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ \ | | | | / _ \| '_ ` _ \ / _ \ | |/ _ \ | | | | | | |/ _ \ | / _ \| '_ \ |/| | __) | | @@ -23,4 +24,6 @@ | \ V V / \ V V / \ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | | | \_/\_/ \_/\_/ \_/\_/ (_) \___|_|\__,_|\___|\___\___/|_| |_| (_) \___\___/|_| |_| |_| | | | -.===========================================================================================================. +.===========================================================================================================. + + From b4a4fbc3c7b70c3f5e28604f81614f8db8c7ca71 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jul 2012 14:45:11 -0500 Subject: [PATCH 0629/1057] doh --- cluecon.tmpl | 53 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/cluecon.tmpl b/cluecon.tmpl index e66eda8a13..c435195d12 100644 --- a/cluecon.tmpl +++ b/cluecon.tmpl @@ -1,29 +1,28 @@  -.===========================================================================================================. -| ____ _____ ____ _ ____ _ _ ____ | -| / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ \ | -| | | / _ \| '_ ` _ \ / _ \ | |/ _ \ | | | | | | |/ _ \ | / _ \| '_ \ |/| | __) | | -| | |__| (_) | | | | | | __/ | | (_) | | |___| | |_| | __/ |__| (_) | | | | | |/ __/ | -| \____\___/|_| |_| |_|\___| |_|\___/ \____|_|\__,_|\___|\____\___/|_| |_| |_|_____| | -| | -| ____ _ _ _ _ ____ _ | -| / ___| |__ (_) ___ __ _ __ _ ___ | | | / ___| / \ | -| | | | '_ \| |/ __/ _` |/ _` |/ _ \ | | | \___ \ / _ \ | -| | |___| | | | | (_| (_| | (_| | (_) | | |_| |___) / ___ \ | -| \____|_| |_|_|\___\__,_|\__, |\___/ \___/|____/_/ \_\ | -| |___/ | -| _ _ _____ _ _ _ ___ _ _ ____ ___ _ ____ | -| / \ _ _ __ _ _ _ ___| |_ |___ | |_| |__ / |/ _ \| |_| |__ |___ \ / _ \/ |___ \ | -| / _ \| | | |/ _` | | | / __| __| / /| __| '_ \ _____ | | | | | __| '_ \ __) | | | | | __) | | -| / ___ \ |_| | (_| | |_| \__ \ |_ / / | |_| | | | |_____| | | |_| | |_| | | | / __/| |_| | |/ __/ | -| /_/ \_\__,_|\__, |\__,_|___/\__| /_/ \__|_| |_| |_|\___/ \__|_| |_| |_____|\___/|_|_____| | -| |___/ | -| _ | -| __ ____ ____ __ ___| |_ _ ___ ___ ___ _ __ ___ ___ _ __ ___ | -| \ \ /\ / /\ \ /\ / /\ \ /\ / / / __| | | | |/ _ \/ __/ _ \| '_ \ / __/ _ \| '_ ` _ \ | -| \ V V / \ V V / \ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | | -| \_/\_/ \_/\_/ \_/\_/ (_) \___|_|\__,_|\___|\___\___/|_| |_| (_) \___\___/|_| |_| |_| | -| | -.===========================================================================================================. +.========================================================================================================. +| ____ _____ ____ _ ____ _ _ ____ | +| / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ \ | +| | | / _ \| '_ ` _ \ / _ \ | |/ _ \ | | | | | | |/ _ \ | / _ \| '_ \ |/| | __) | | +| | |__| (_) | | | | | | __/ | | (_) | | |___| | |_| | __/ |__| (_) | | | | | |/ __/ | +| \____\___/|_| |_| |_|\___| |_|\___/ \____|_|\__,_|\___|\____\___/|_| |_| |_|_____| | +| | +| ____ _ _ _ _ ____ _ | +| / ___| |__ (_) ___ __ _ __ _ ___ | | | / ___| / \ | +| | | | '_ \| |/ __/ _` |/ _` |/ _ \ | | | \___ \ / _ \ | +| | |___| | | | | (_| (_| | (_| | (_) | _ | |_| |___) / ___ \ | +| \____|_| |_|_|\___\__,_|\__, |\___/ ( ) \___/|____/_/ \_\ | +| |___/ |/ | +| _ _ _____ _ _ ___ _ _ ____ ___ _ ____ | +| / \ _ _ __ _ _ _ ___| |_ |___ | |_| |__ / _ \| |_| |__ |___ \ / _ \/ |___ \ | +| / _ \| | | |/ _` | | | / __| __| / /| __| '_ \ _____ | (_) | __| '_ \ __) | | | | | __) | | +| / ___ \ |_| | (_| | |_| \__ \ |_ / / | |_| | | | |_____| \__, | |_| | | | / __/| |_| | |/ __/ | +| /_/ \_\__,_|\__, |\__,_|___/\__| /_/ \__|_| |_| /_/ \__|_| |_| |_____|\___/|_|_____| | +| |___/ | +| _ | +| __ ____ ____ __ ___| |_ _ ___ ___ ___ _ __ ___ ___ _ __ ___ | +| \ \ /\ / /\ \ /\ / /\ \ /\ / / / __| | | | |/ _ \/ __/ _ \| '_ \ / __/ _ \| '_ ` _ \ | +| \ V V / \ V V / \ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | | +| \_/\_/ \_/\_/ \_/\_/ (_) \___|_|\__,_|\___|\___\___/|_| |_| (_) \___\___/|_| |_| |_| | +| | +.========================================================================================================.  - From 6ea4c42c95c1466ad2e0dae0e340f93ac4c8f5d8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jul 2012 16:42:49 -0500 Subject: [PATCH 0630/1057] have sql thread manually subscribe to each event it cares about instead of every event and filtering it --- src/switch_core_sqldb.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index ee726500ac..267e82fd5f 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -59,7 +59,6 @@ static struct { switch_cache_db_handle_t *event_db; switch_queue_t *sql_queue[2]; switch_memory_pool_t *memory_pool; - switch_event_node_t *event_node; switch_thread_t *thread; switch_thread_t *db_thread; int thread_running; @@ -2123,10 +2122,33 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ skip: if (sql_manager.manage) { - if (switch_event_bind_removable("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, - core_event_handler, NULL, &sql_manager.event_node) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event handler!\n"); - } +#ifdef SWITCH_SQL_BIND_EVERY_EVENT + switch_event_bind("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); +#else + switch_event_bind("core_db", SWITCH_EVENT_ADD_SCHEDULE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_DEL_SCHEDULE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_EXE_SCHEDULE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_RE_SCHEDULE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_DESTROY, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_UUID, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_CREATE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CODEC, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_HOLD, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_UNHOLD, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_EXECUTE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_ORIGINATE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CALL_UPDATE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_CALLSTATE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_STATE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_BRIDGE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CHANNEL_UNBRIDGE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_SHUTDOWN, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_LOG, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_MODULE_LOAD, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_MODULE_UNLOAD, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_CALL_SECURE, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); + switch_event_bind("core_db", SWITCH_EVENT_NAT, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL); +#endif switch_queue_create(&sql_manager.sql_queue[0], SWITCH_SQL_QUEUE_LEN, sql_manager.memory_pool); switch_queue_create(&sql_manager.sql_queue[1], SWITCH_SQL_QUEUE_LEN, sql_manager.memory_pool); @@ -2152,7 +2174,7 @@ void switch_core_sqldb_stop(void) { switch_status_t st; - switch_event_unbind(&sql_manager.event_node); + switch_event_unbind_callback(core_event_handler); if (sql_manager.thread && sql_manager.thread_running) { From a5e11013023f1f714a217cef4ca8e11d418eb502 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 27 Jun 2012 11:23:15 +0200 Subject: [PATCH 0631/1057] ftmod_libpri: Add doxygen documentation for new MSN/DDI filter functions. Signed-off-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 41 ++++++++++++++++++- 1 file changed, 39 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 8428437c3c..ecd1cff1d3 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -268,6 +268,11 @@ out: * MSN filter ***************************************************************/ +/** + * Initialize MSN filter data structures + * \param[in] isdn_data Span private data + * \return FTDM_SUCCESS, FTDM_FAIL + */ static int msn_filter_init(ftdm_libpri_data_t *isdn_data) { if (!isdn_data) @@ -285,6 +290,11 @@ static int msn_filter_init(ftdm_libpri_data_t *isdn_data) return FTDM_SUCCESS; } +/** + * Destroy MSN filter data structures + * \param[in] isdn_data Span private data + * \return FTDM_SUCCESS, FTDM_FAIL + */ static int msn_filter_destroy(ftdm_libpri_data_t *isdn_data) { if (!isdn_data) @@ -298,6 +308,12 @@ static int msn_filter_destroy(ftdm_libpri_data_t *isdn_data) return FTDM_SUCCESS; } +/** + * Check if the given string is a valid MSN/DDI + * (i.e.: Not empty, not longer than FDM_DIGITS_LIMIT and all numbers) + * \param[in] str String to check + * \return FTDM_SUCCESS, FTDM_FAIL + */ static int msn_filter_verify(const char *str) { if (ftdm_strlen_zero(str) || strlen(str) >= FTDM_DIGITS_LIMIT) @@ -309,6 +325,12 @@ static int msn_filter_verify(const char *str) return FTDM_TRUE; } +/** + * Add a new MSN/DDI to the filter + * \param[in] isdn_data Span private data + * \param[in] msn New MSN/DDI to add + * \return FTDM_SUCCESS, FTDM_FAIL + */ static int msn_filter_add(ftdm_libpri_data_t *isdn_data, const char *msn) { static const int value = 0xdeadbeef; @@ -345,14 +367,18 @@ out: /** - * + * Check if a DNIS (destination number) is a valid MSN/DDI + * \param[in] isdn_data Span private data + * \param[in] msn Number to check + * \retval FTDM_TRUE \p msn is a valid MSN/DDI or filter list is empty + * \retval FTDM_FALSE \p msn is not a valid MSN/DDI */ static int msn_filter_match(ftdm_libpri_data_t *isdn_data, const char *msn) { int ret = FTDM_FALSE; if (!isdn_data) - return FTDM_FAIL; + return FTDM_FALSE; /* No number? return match found */ if (ftdm_strlen_zero(msn)) return FTDM_TRUE; @@ -372,6 +398,13 @@ out: return ret; } +/** + * Helper function to iterate over MSNs in the filter hash (handles locking) + * \param[in] isdn_data Span private data + * \param[in] func Callback function that is invoked for each entry + * \param[in] data Private data passed to callback + * \return FTDM_SUCCESS, FTDM_FAIL + */ static int msn_filter_foreach(ftdm_libpri_data_t *isdn_data, int (* func)(const char *, void *), void *data) { ftdm_hash_iterator_t *iter = NULL; @@ -439,6 +472,10 @@ struct msn_list_cb_private { unsigned int count; }; +/** + * "ftdm libpri msn " API command callback + * function for msn_filter_foreach() + */ static int msn_list_cb(const char *msn, void *priv) { struct msn_list_cb_private *data = priv; From da8885cc51791e6665c89b09709154e756a866ba Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Jul 2012 10:55:53 -0500 Subject: [PATCH 0632/1057] FS-4397 --resolve --- src/mod/endpoints/mod_sofia/sofia_glue.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index a62c184907..2cdd45e171 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -438,6 +438,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch if (!force && !ip && zstr(sr) && (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) { + switch_safe_free(buf); return; } @@ -449,6 +450,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch if (!ip) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s NO IP!\n", switch_channel_get_name(tech_pvt->channel)); + switch_safe_free(buf); return; } @@ -460,6 +462,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch if (!port) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s NO PORT!\n", switch_channel_get_name(tech_pvt->channel)); + switch_safe_free(buf); return; } @@ -776,6 +779,8 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE); + + switch_safe_free(buf); } const char *sofia_glue_get_codec_string(private_object_t *tech_pvt) @@ -4022,7 +4027,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha for (m = sdp->sdp_media; m; m = m->m_next) { ptime = dptime; if (m->m_type == sdp_media_image && m->m_port) { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), ",t38"); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",t38"); } else if (m->m_type == sdp_media_audio && m->m_port) { for (attr = m->m_attributes; attr; attr = attr->a_next) { if (zstr(attr->a_name)) { @@ -4063,7 +4068,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha } if (match) { - add_audio_codec(map, ptime, buf, SDPBUFLEN); + add_audio_codec(map, ptime, buf, sizeof(buf)); break; } @@ -4092,7 +4097,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha } if (match) { - add_audio_codec(map, ptime, buf, SDPBUFLEN); + add_audio_codec(map, ptime, buf, sizeof(buf)); break; } } @@ -4131,10 +4136,10 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha if (match) { if (ptime > 0) { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime); } else { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); } already_did[imp->ianacode] = 1; break; @@ -4396,7 +4401,7 @@ switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, swi } } - switch_snprintf(buf, SDPBUFLEN, "%d", map->rm_pt); + switch_snprintf(buf, sizeof(buf), "%d", map->rm_pt); if (br) { switch_snprintf(key, sizeof(key), "%s:%s", map->rm_encoding, br); From 9ca929218fafa1fe4271693c16f3dbe05c884730 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Jul 2012 11:12:14 -0500 Subject: [PATCH 0633/1057] FS-4382 --resolve --- src/include/switch_types.h | 8 +++++++- src/mod/endpoints/mod_sofia/sofia_glue.c | 8 ++++++++ src/switch_rtp.c | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index dd301bd5ce..08b6c61954 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -712,7 +712,7 @@ typedef enum { */ - RTP_BUG_GEN_ONE_GEN_ALL = (1 << 8) + RTP_BUG_GEN_ONE_GEN_ALL = (1 << 8), /* Some RTP endpoints (and by some we mean *cough* _SONUS_!) do not like it when the timestamps jump forward or backwards in time. @@ -726,6 +726,12 @@ typedef enum { */ + RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER = (1 << 9) + + /* + By default FS will change the SSRC when the marker is set and it detects a timestamp reset. + If this setting is enabled it will NOT do this (old behaviour). + */ } switch_rtp_bug_flag_t; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2cdd45e171..75c201ddb2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -7022,6 +7022,14 @@ void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str if (switch_stristr("~GEN_ONE_GEN_ALL", str)) { *flag_pole &= ~RTP_BUG_GEN_ONE_GEN_ALL; } + + if (switch_stristr("NEVER_CHANGE_SSRC_ON_MARKER", str)) { + *flag_pole |= RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER; + } + + if (switch_stristr("~NEVER_CHANGE_SSRC_ON_MARKER", str)) { + *flag_pole &= ~RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER; + } } char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_nat_parse_t *np) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index bbb3dfdb6e..7d6ad297a2 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4062,6 +4062,12 @@ static int rtp_common_write(switch_rtp_t *rtp_session, send_msg->header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; + /* If the marker was set, and the timestamp seems to have started over - set a new SSRC, to indicate this is a new stream */ + if (send_msg->header.m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER) && (rtp_session->last_write_ts == RTP_TS_RESET || + (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->last_write_ts > 0))) { + switch_rtp_set_ssrc(rtp_session, (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL))); + } + memcpy(send_msg->body, data, datalen); bytes = datalen + rtp_header_len; } From f509b708a7b4ba02a4045af7157e88988867f4e1 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 Jul 2012 15:23:37 -0400 Subject: [PATCH 0634/1057] Freetdm: Fix for 64-bit check on Ubuntu --- libs/freetdm/configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index cb7f9afd4d..b4c9cda8ab 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -313,7 +313,7 @@ AC_MSG_RESULT([checking whether to build ftmod_sangoma_isdn... ${HAVE_SNG_ISDN}] AM_CONDITIONAL([HAVE_SNG_ISDN], [test "${HAVE_SNG_ISDN}" = "yes"]) if test "${HAVE_SNG_ISDN}" = "yes"; then - if test "${build}" == "${host}" + if test "${build}" = "${host}" then case "${host}" in x86_64-*) @@ -334,7 +334,7 @@ AC_MSG_RESULT([checking whether to build ftmod_sangoma_ss7... ${HAVE_SNG_SS7}]) AM_CONDITIONAL([HAVE_SNG_SS7], [test "${HAVE_SNG_SS7}" = "yes"]) if test "${HAVE_SNG_SS7}" = "yes"; then - if test "${build}" == "${host}" + if test "${build}" = "${host}" then case "${host}" in x86_64-*) From 6cf9ea181d485bcd5c58cbc3cf46f15d0779ce51 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Jul 2012 16:16:51 -0500 Subject: [PATCH 0635/1057] FS-4364 --resolve --- src/mod/say/mod_say_it/mod_say_it.c | 94 +++++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 4 deletions(-) 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 1cbe1d8488..f5d183a6a7 100644 --- a/src/mod/say/mod_say_it/mod_say_it.c +++ b/src/mod/say/mod_say_it/mod_say_it.c @@ -1,3 +1,4 @@ + /* * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. @@ -228,9 +229,11 @@ static switch_status_t it_say_general_count(switch_core_session_t *session, char static switch_status_t it_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) { int32_t t; - switch_time_t target = 0; - switch_time_exp_t tm; - uint8_t say_date = 0, say_time = 0; + 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"); if (say_args->type == SST_TIME_MEASUREMENT) { int64_t hours = 0; @@ -314,10 +317,28 @@ static switch_status_t it_say_time(switch_core_session_t *session, char *tosay, if ((t = atoi(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(); + } - switch_time_exp_lt(&tm, target); + + if (tz) { + int check = atoi(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: @@ -328,19 +349,81 @@ static switch_status_t it_say_time(switch_core_session_t *session, char *tosay, 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) { + say_file("time/today.wav"); + } + if (say_yesterday) { + say_file("time/yesterday.wav"); + } + if (say_dow) { + say_file("time/day-%d.wav", tm.tm_wday); + } + if (say_date) { + say_year = say_month = say_day = say_dow = 1; + say_today = say_yesterday = 0; + say_file("time/day-%d.wav", tm.tm_wday); say_num(tm.tm_mday, SSM_PRONOUNCED); say_file("time/mon-%d.wav", tm.tm_mon); say_num(tm.tm_year + 1900, SSM_PRONOUNCED); } + if (say_day) { + if (tm.tm_mday == 1) { /* 1 er Janvier,... 2 feb, 23 dec... */ + say_args->gender = SSG_MASCULINE; + say_num(tm.tm_mday, SSM_COUNTED); + } else { + say_args->gender = SSG_FEMININE; + say_num(tm.tm_mday, SSM_PRONOUNCED); + } + } + + if (say_month) { + say_file("time/mon-%d.wav", tm.tm_mon); + } + if (say_year) { + say_args->gender = SSG_MASCULINE; + say_num(tm.tm_year + 1900, SSM_PRONOUNCED); + } + + if (say_time) { + if (say_date || say_today || say_yesterday || say_dow) { + say_file("time/at.wav"); + } say_file("time/hours.wav"); say_num(tm.tm_hour, SSM_PRONOUNCED); @@ -432,6 +515,9 @@ static switch_status_t it_say(switch_core_session_t *session, char *tosay, switc case SST_CURRENT_DATE_TIME: say_cb = it_say_time; break; + case SST_SHORT_DATE_TIME: + say_cb = it_say_time; + break; case SST_IP_ADDRESS: return switch_ivr_say_ip(session, tosay, it_say_general_count, say_args, args); break; From c6fc4a2774e93ca941447617430706d5bf42692c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Jul 2012 17:20:38 -0500 Subject: [PATCH 0636/1057] add Current-Energy to conference events --- src/mod/applications/mod_conference/mod_conference.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 15d927fed1..68acd3ad70 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -803,6 +803,7 @@ static switch_status_t conference_add_event_member_data(conference_member_t *mem switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-Type", "%s", switch_test_flag(member, MFLAG_MOD) ? "moderator" : "member"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Current-Energy", "%d", member->score); return status; } From c81e20475fc520744a0992a3845fee4977342f2d Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 6 Jul 2012 18:43:03 -0400 Subject: [PATCH 0637/1057] freetdm: Try to be more foolproof when creating an iterator for an empty span to avoid triggering asserts later --- libs/freetdm/src/ftdm_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b8bee670a4..ab015b98ff 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4181,6 +4181,9 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_ FT_DECLARE(ftdm_iterator_t *) ftdm_span_get_chan_iterator(const ftdm_span_t *span, ftdm_iterator_t *iter) { + if (!span->chan_count) { + return NULL; + } if (!(iter = ftdm_get_iterator(FTDM_ITERATOR_CHANS, iter))) { return NULL; } @@ -4671,7 +4674,7 @@ static ftdm_status_t load_config(void) *name++ = '\0'; } - /* Verify is trunk_type was specified for previous span */ + /* Verify if trunk_type was specified for previous span */ if (span && span->trunk_type == FTDM_TRUNK_NONE) { ftdm_log(FTDM_LOG_ERROR, "trunk_type not specified for span %d (%s)\n", span->span_id, span->name); ret = FTDM_FAIL; From 16cb32cd5cc7d6bd65e739207f76f25e331a2eaa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Jul 2012 17:53:44 -0500 Subject: [PATCH 0638/1057] come to cluecon will ya --- src/include/cc.h | 3 +++ src/switch_core.c | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 src/include/cc.h diff --git a/src/include/cc.h b/src/include/cc.h new file mode 100644 index 0000000000..573a7f7332 --- /dev/null +++ b/src/include/cc.h @@ -0,0 +1,3 @@ + +const char *cc = "\n.========================================================================================================.\n| ____ _____ ____ _ ____ _ _ ____ |\n| / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ \\ |\n| | | / _ \\| '_ ` _ \\ / _ \\ | |/ _ \\ | | | | | | |/ _ \\ | / _ \\| '_ \\ |/| | __) | |\n| | |__| (_) | | | | | | __/ | | (_) | | |___| | |_| | __/ |__| (_) | | | | | |/ __/ |\n| \\____\\___/|_| |_| |_|\\___| |_|\\___/ \\____|_|\\__,_|\\___|\\____\\___/|_| |_| |_|_____| |\n| |\n| ____ _ _ _ _ ____ _ |\n| / ___| |__ (_) ___ __ _ __ _ ___ | | | / ___| / \\ |\n| | | | '_ \\| |/ __/ _` |/ _` |/ _ \\ | | | \\___ \\ / _ \\ |\n| | |___| | | | | (_| (_| | (_| | (_) | _ | |_| |___) / ___ \\ |\n| \\____|_| |_|_|\\___\\__,_|\\__, |\\___/ ( ) \\___/|____/_/ \\_\\ |\n| |___/ |/ |\n| _ _ _____ _ _ ___ _ _ ____ ___ _ ____ |\n| / \\ _ _ __ _ _ _ ___| |_ |___ | |_| |__ / _ \\| |_| |__ |___ \\ / _ \\/ |___ \\ |\n| / _ \\| | | |/ _` | | | / __| __| / /| __| '_ \\ _____ | (_) | __| '_ \\ __) | | | | | __) | |\n| / ___ \\ |_| | (_| | |_| \\__ \\ |_ / / | |_| | | | |_____| \\__, | |_| | | | / __/| |_| | |/ __/ |\n| /_/ \\_\\__,_|\\__, |\\__,_|___/\\__| /_/ \\__|_| |_| /_/ \\__|_| |_| |_____|\\___/|_|_____| |\n| |___/ |\n| _ |\n| __ ____ ____ __ ___| |_ _ ___ ___ ___ _ __ ___ ___ _ __ ___ |\n| \\ \\ /\\ / /\\ \\ /\\ / /\\ \\ /\\ / / / __| | | | |/ _ \\/ __/ _ \\| '_ \\ / __/ _ \\| '_ ` _ \\ |\n| \\ V V / \\ V V / \\ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | |\n| \\_/\\_/ \\_/\\_/ \\_/\\_/ (_) \\___|_|\\__,_|\\___|\\___\\___/|_| |_| (_) \\___\\___/|_| |_| |_| |\n| |\n.========================================================================================================.\n\n"; + diff --git a/src/switch_core.c b/src/switch_core.c index 357f7d09cf..a0f8526813 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1897,7 +1897,6 @@ static void switch_load_core_config(const char *file) SWITCH_DECLARE(const char *) switch_core_banner(void) { - return ("\n" " _____ ______ _____ _____ ____ _ _ \n" " | ___| __ ___ ___/ ___\\ \\ / /_ _|_ _/ ___| | | | \n" @@ -1909,7 +1908,8 @@ SWITCH_DECLARE(const char *) switch_core_banner(void) "* Anthony Minessale II, Michael Jerris, Brian West, Others *\n" "* FreeSWITCH (http://www.freeswitch.org) *\n" "* Paypal Donations Appreciated: paypal@freeswitch.org *\n" - "* Brought to you by ClueCon http://www.cluecon.com/ *\n" "************************************************************\n" "\n"); + "* Brought to you by ClueCon http://www.cluecon.com/ *\n" "************************************************************\n" + "\n"); } @@ -1917,6 +1917,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t { switch_event_t *event; char *cmd; +#include "cc.h" + if (switch_core_init(flags, console, err) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_GENERR; @@ -1951,7 +1953,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t switch_event_fire(&event); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", switch_core_banner()); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s", switch_core_banner(), cc); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, From 2bd7155ebd209d5c425e88aa76785ac0475ab038 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Jul 2012 17:54:17 -0500 Subject: [PATCH 0639/1057] come to cluecon will ya --- cc.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 cc.sh diff --git a/cc.sh b/cc.sh new file mode 100755 index 0000000000..85ab418e26 --- /dev/null +++ b/cc.sh @@ -0,0 +1,8 @@ +cc=`cat cluecon.tmpl | sed 's/\\\\/\\\\\\\\/g' | awk '{printf "%s\\\\n", $0}' ` + +cat < src/include/cc.h + +const char *cc = "$cc"; + +EOF + From fa1276d9492fd39ea733f7af301faed3556c9544 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 8 Jul 2012 09:10:28 -0500 Subject: [PATCH 0640/1057] FS-4219 --resolve --- libs/win32/util.vbs | 113 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 91 insertions(+), 22 deletions(-) diff --git a/libs/win32/util.vbs b/libs/win32/util.vbs index cbaf96a7b0..4f13e21ad0 100644 --- a/libs/win32/util.vbs +++ b/libs/win32/util.vbs @@ -262,6 +262,58 @@ Sub FindReplaceInFile(FileName, sFind, sReplace) fNewFile.Close End Sub +Function ExecAndGetResult(tmpFolder, VersionDir, execStr) + + Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpExec.Bat", True) + MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) + MyFile.WriteLine("@" & execStr) + MyFile.Close + + Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpExec.Bat" & quote) + + ExecAndGetResult = Trim(OExec.StdOut.ReadLine()) + + Do + Loop While Not OExec.StdOut.atEndOfStream + + FSO.DeleteFile(tmpFolder & "tmpExec.Bat") + +End Function + +Function ExecAndGetExitCode(tmpFolder, VersionDir, execStr) + + Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpExec.Bat", True) + MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) + MyFile.WriteLine("@" & execStr) + MyFile.WriteLine("@exit %ERRORLEVEL%") + MyFile.Close + + ExecAndGetExitCode = WshShell.Run("cmd /C " & quote & tmpFolder & "tmpExec.Bat" & quote, 0, True) + + FSO.DeleteFile(tmpFolder & "tmpExec.Bat") + +End Function + +Function pd(n, totalDigits) + If totalDigits > len(n) then + pd = String(totalDigits-len(n),"0") & n + Else + pd = n + End If +End Function + +Function GetTimeUTC() + + iOffset = WshShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias") + + If IsNumeric(iOffset) Then + GetTimeUTC = DateAdd("n", iOffset, Now()) + Else + GetTimeUTC = Now() + End If + +End Function + Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) Dim oExec @@ -276,29 +328,47 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) End If Dim sLastFile - Const ForReading = 1 + Const ForReading = 1 - 'Try To read revision from git, if it was not found in "configure.in" already - If strVerRev = "" Then - If FSO.FolderExists(VersionDir & ".git") Then - VersionCmd="git log --format=" & quote & "%%h %%ci" & quote & " -1 HEAD" - Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) - MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote) - MyFile.WriteLine("@" & VersionCmd) - MyFile.Close - Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote) - Do - strFromProc = Trim(OExec.StdOut.ReadLine()) - VERSION="git-" & strFromProc - Loop While Not OExec.StdOut.atEndOfStream - sLastVersion = "" - Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) - If Not sLastFile.atEndOfStream Then - sLastVersion = sLastFile.ReadLine() - End If - sLastFile.Close - VERSION = Replace(VERSION, ":", "-") + 'Try To read revision from git + If FSO.FolderExists(VersionDir & ".git") Then + 'Get timestamp for last commit + strFromProc = ExecAndGetResult(tmpFolder, VersionDir, "git log -n1 --format=" & quote & "%%ct" & quote & " HEAD") + If IsNumeric(strFromProc) Then + lastChangedDateTime = DateAdd("s", strFromProc, "01/01/1970 00:00:00") + strLastCommit = YEAR(lastChangedDateTime) & Pd(Month(lastChangedDateTime), 2) & Pd(DAY(lastChangedDateTime), 2) & "T" & Pd(Hour(lastChangedDateTime), 2) & Pd(Minute(lastChangedDateTime), 2) & Pd(Second(lastChangedDateTime), 2) & "Z" + Else + strLastCommit = "UNKNOWN" End If + + 'Get revision hash + strRevision = ExecAndGetResult(tmpFolder, VersionDir, "git rev-list -n1 --abbrev=10 --abbrev-commit HEAD") + + If strRevision = "" Then + strRevision = "UNKNOWN" + End If + + 'Bild version string + strGitVer="git~" & strLastCommit & "~" & strRevision + + 'Check for local changes, if found, append to git revision string + If ExecAndGetExitCode(tmpFolder, VersionDir, "git diff-index --quiet HEAD") <> 0 Then + lastChangedDateTime = GetTimeUTC() + strGitVer = strGitVer & "+unclean~" & YEAR(lastChangedDateTime) & Pd(Month(lastChangedDateTime), 2) & Pd(DAY(lastChangedDateTime), 2) & "T" & Pd(Hour(lastChangedDateTime), 2) & Pd(Minute(lastChangedDateTime), 2) & Pd(Second(lastChangedDateTime), 2) & "Z" + End If + + If strVerRev = "" Then + VERSION=strGitVer + Else + VERSION=VERSION & "+" & strGitVer + End If + + sLastVersion = "" + Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII) + If Not sLastFile.atEndOfStream Then + sLastVersion = sLastFile.ReadLine() + End If + sLastFile.Close End If If VERSION = "" Then @@ -315,7 +385,6 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) FindReplaceInFile includedest, "@SWITCH_VERSION_MAJOR@", strVerMajor FindReplaceInFile includedest, "@SWITCH_VERSION_MINOR@", strVerMinor FindReplaceInFile includedest, "@SWITCH_VERSION_MICRO@", strVerMicro - End If End Sub From b9b4db7d40159ec1b8d2a0c0f41655339daa0887 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 9 Jul 2012 10:37:15 -0500 Subject: [PATCH 0641/1057] FS-4404 --resolve --- src/mod/endpoints/mod_sofia/sofia.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index af7605e6c2..072d212d71 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1074,6 +1074,8 @@ static void our_sofia_event_callback(nua_event_t event, case nua_i_cancel: + switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_cancel"); + if (sip && channel && sip->sip_reason) { char *reason_header = sip_header_as_string(nh->nh_home, (void *) sip->sip_reason); From e79e6146c5cbed324c2cdf95a5af51bbb6705e8c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 9 Jul 2012 10:56:04 -0500 Subject: [PATCH 0642/1057] FS-4378 add sofia::error custom event --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6ccb9ef0f8..98975bdfdb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -90,6 +90,7 @@ typedef struct private_object private_object_t; #define MY_EVENT_RECOVERY "sofia::recovery_recv" #define MY_EVENT_RECOVERY_SEND "sofia::recovery_send" #define MY_EVENT_RECOVERY_RECOVERED "sofia::recovery_recovered" +#define MY_EVENT_ERROR "sofia::error" #define MULTICAST_EVENT "multicast::event" #define SOFIA_REPLACES_HEADER "_sofia_replaces_" diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 072d212d71..b5cd480d46 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7316,6 +7316,16 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_ivr_session_transfer(b_session, exten, NULL, NULL); switch_core_session_rwunlock(b_session); } else { + switch_event_t *event; + + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR)) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Error-Type", "attended_transfer"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Transfer-Exten", exten); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Full-Refer-To", full_ref_to); + + switch_channel_event_set_data(channel, event); + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n"); switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR"); nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), From 111ef49f1f366481fafe5e125e32d4d45c125834 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 10 Jul 2012 14:30:01 +0200 Subject: [PATCH 0643/1057] mod_sofia: Use switch_add_event_header_string() for string values. Errors fixed: sofia.c: In function 'sofia_handle_sip_i_refer': sofia.c:7323:5: error: format not a string literal and no format arguments sofia.c:7324:5: error: format not a string literal and no format arguments Signed-off-by: Stefan Knoblich --- src/mod/endpoints/mod_sofia/sofia.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b5cd480d46..e5722566e6 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7320,9 +7320,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR)) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Error-Type", "attended_transfer"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Transfer-Exten", exten); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Full-Refer-To", full_ref_to); - + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Transfer-Exten", exten); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Full-Refer-To", full_ref_to); switch_channel_event_set_data(channel, event); } From 3375c39c0252208082d0e4d459dab976df7b10bc Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 10 Jul 2012 09:28:26 -0700 Subject: [PATCH 0644/1057] Minor update to Spanish phrase files --- docs/phrase/phrase_es.xml | 4 ++-- docs/phrase/phrase_es_ES.xml | 2 +- docs/phrase/phrase_es_MX.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/phrase/phrase_es.xml b/docs/phrase/phrase_es.xml index 69b1e57994..518d7fce64 100644 --- a/docs/phrase/phrase_es.xml +++ b/docs/phrase/phrase_es.xml @@ -21,10 +21,10 @@ - + - + diff --git a/docs/phrase/phrase_es_ES.xml b/docs/phrase/phrase_es_ES.xml index ad99c1bf73..791088697b 100644 --- a/docs/phrase/phrase_es_ES.xml +++ b/docs/phrase/phrase_es_ES.xml @@ -19,7 +19,7 @@ - + diff --git a/docs/phrase/phrase_es_MX.xml b/docs/phrase/phrase_es_MX.xml index 527f8c3c89..188b5c68b1 100644 --- a/docs/phrase/phrase_es_MX.xml +++ b/docs/phrase/phrase_es_MX.xml @@ -19,7 +19,7 @@ - + From 27155bcb71396d65a7a22eb2079344ede30d0077 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Jul 2012 12:05:26 -0500 Subject: [PATCH 0645/1057] come to ClueCon its in one month --- libs/esl/fs_cli.c | 11 +++++++---- libs/esl/src/include/cc.h | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 libs/esl/src/include/cc.h diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 408c946d29..8532e23391 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -916,15 +916,18 @@ static const char *banner = "* Paypal Donations Appreciated: paypal@freeswitch.org *\n" "* Brought to you by ClueCon http://www.cluecon.com/ *\n" "*******************************************************\n" - "\n" - "Type /help to see a list of commands\n\n\n"; + "\n"; + +static const char *inf = "Type /help to see a list of commands\n\n\n"; static void print_banner(FILE *stream) { +#include + #ifndef WIN32 - fprintf(stream, "%s%s", output_text_color, banner); + fprintf(stream, "%s%s%s\n%s", output_text_color, banner, cc, inf); #else - fprintf(stream, "%s", banner); + fprintf(stream, "%s%s\n%s", banner, cc, inf); #endif } diff --git a/libs/esl/src/include/cc.h b/libs/esl/src/include/cc.h new file mode 100644 index 0000000000..573a7f7332 --- /dev/null +++ b/libs/esl/src/include/cc.h @@ -0,0 +1,3 @@ + +const char *cc = "\n.========================================================================================================.\n| ____ _____ ____ _ ____ _ _ ____ |\n| / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ \\ |\n| | | / _ \\| '_ ` _ \\ / _ \\ | |/ _ \\ | | | | | | |/ _ \\ | / _ \\| '_ \\ |/| | __) | |\n| | |__| (_) | | | | | | __/ | | (_) | | |___| | |_| | __/ |__| (_) | | | | | |/ __/ |\n| \\____\\___/|_| |_| |_|\\___| |_|\\___/ \\____|_|\\__,_|\\___|\\____\\___/|_| |_| |_|_____| |\n| |\n| ____ _ _ _ _ ____ _ |\n| / ___| |__ (_) ___ __ _ __ _ ___ | | | / ___| / \\ |\n| | | | '_ \\| |/ __/ _` |/ _` |/ _ \\ | | | \\___ \\ / _ \\ |\n| | |___| | | | | (_| (_| | (_| | (_) | _ | |_| |___) / ___ \\ |\n| \\____|_| |_|_|\\___\\__,_|\\__, |\\___/ ( ) \\___/|____/_/ \\_\\ |\n| |___/ |/ |\n| _ _ _____ _ _ ___ _ _ ____ ___ _ ____ |\n| / \\ _ _ __ _ _ _ ___| |_ |___ | |_| |__ / _ \\| |_| |__ |___ \\ / _ \\/ |___ \\ |\n| / _ \\| | | |/ _` | | | / __| __| / /| __| '_ \\ _____ | (_) | __| '_ \\ __) | | | | | __) | |\n| / ___ \\ |_| | (_| | |_| \\__ \\ |_ / / | |_| | | | |_____| \\__, | |_| | | | / __/| |_| | |/ __/ |\n| /_/ \\_\\__,_|\\__, |\\__,_|___/\\__| /_/ \\__|_| |_| /_/ \\__|_| |_| |_____|\\___/|_|_____| |\n| |___/ |\n| _ |\n| __ ____ ____ __ ___| |_ _ ___ ___ ___ _ __ ___ ___ _ __ ___ |\n| \\ \\ /\\ / /\\ \\ /\\ / /\\ \\ /\\ / / / __| | | | |/ _ \\/ __/ _ \\| '_ \\ / __/ _ \\| '_ ` _ \\ |\n| \\ V V / \\ V V / \\ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | |\n| \\_/\\_/ \\_/\\_/ \\_/\\_/ (_) \\___|_|\\__,_|\\___|\\___\\___/|_| |_| (_) \\___\\___/|_| |_| |_| |\n| |\n.========================================================================================================.\n\n"; + From 6904ae6f3be9d973f066fa9078061d9a955d885c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Jul 2012 13:28:38 -0500 Subject: [PATCH 0646/1057] FS-4404 regression from b9b4db7d40159ec1b8d2a0c0f41655339daa0887 --- src/mod/endpoints/mod_sofia/sofia.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e5722566e6..9364b50569 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1074,13 +1074,15 @@ static void our_sofia_event_callback(nua_event_t event, case nua_i_cancel: - switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_cancel"); + if (sip && channel) { + switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_cancel"); - if (sip && channel && sip->sip_reason) { - char *reason_header = sip_header_as_string(nh->nh_home, (void *) sip->sip_reason); + if (sip->sip_reason) { + char *reason_header = sip_header_as_string(nh->nh_home, (void *) sip->sip_reason); - if (!zstr(reason_header)) { - switch_channel_set_variable_partner(channel, "sip_reason", reason_header); + if (!zstr(reason_header)) { + switch_channel_set_variable_partner(channel, "sip_reason", reason_header); + } } } From 6c406aa0d9032512d45e1c7c84491e2afc784783 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Jul 2012 13:32:35 -0500 Subject: [PATCH 0647/1057] add wait handler to forking code in ivrd --- libs/esl/ivrd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/esl/ivrd.c b/libs/esl/ivrd.c index 2e2e6b2fa4..6098abcaf9 100644 --- a/libs/esl/ivrd.c +++ b/libs/esl/ivrd.c @@ -35,6 +35,15 @@ #include #include #include +#include + +static void handle_SIGCHLD(int sig) +{ + int status = 0; + + wait(&status); + return; +} static void my_forking_callback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr) { @@ -43,6 +52,8 @@ static void my_forking_callback(esl_socket_t server_sock, esl_socket_t client_so const char *path; char arg[64] = { 0 }; + signal(SIGCHLD, handle_SIGCHLD); + if (fork()) { close(client_sock); return; From 293516be59f2495a0517f8297a337a2876786cc4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Jul 2012 22:44:11 -0500 Subject: [PATCH 0648/1057] FS-4370 --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 8c36f64fe7..99a4cc6121 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3577,7 +3577,9 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c idx = atoi(ptr); } - if (vtype == 3 || (sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) { + if (!sub_val) sub_val = vname; + + if ((sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) { if (var_list && !switch_event_check_permission_list(var_list, vname)) { sub_val = "INVALID"; } From ba428a1559b2f689219ad3f41ffd9f20b2177c1e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Jul 2012 23:04:16 -0500 Subject: [PATCH 0649/1057] FS-4406 please test asap and report back --- src/mod/endpoints/mod_sofia/sofia.c | 6 ++++-- src/mod/endpoints/mod_sofia/sofia_reg.c | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9364b50569..b04cb89e37 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5041,11 +5041,13 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu } else if (sofia_test_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL) && (status != 200 && status != 486) && sip && sip->sip_to) { char *sql; time_t now = switch_epoch_time_now(NULL); + const char *call_id = sip->sip_call_id->i_id; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host); - sql = switch_mprintf("update sip_registrations set expires=%ld where sip_user='%s' and sip_host='%s'", - (long) now, sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host); + sql = switch_mprintf("update sip_registrations set expires=%ld where sip_user='%s' and sip_host='%s' and call_id='%q'", + (long) now, sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host, call_id); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 84367a23f3..1e17ad544e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -551,15 +551,16 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames { sofia_profile_t *profile = (sofia_profile_t *) pArg; nua_handle_t *nh; - char to[128] = ""; + char to[512] = ""; sofia_destination_t *dst = NULL; switch_snprintf(to, sizeof(to), "sip:%s@%s", argv[1], argv[2]); + dst = sofia_glue_get_destination(argv[3]); switch_assert(dst); nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url), - TAG_END()); + SIPTAG_CALL_ID_STR(argv[0]), TAG_END()); nua_handle_bind(nh, &mod_sofia_globals.destroy_private); nua_options(nh, NTATAG_SIP_T2(5000), From d6a395b6420108e9a4094ffa41c676ac46ba9f10 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 10 Jul 2012 14:47:38 +0200 Subject: [PATCH 0650/1057] freeswitch: Use switch_strlen_zero() to check for empty strings. Signed-off-by: Stefan Knoblich --- src/switch.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/switch.c b/src/switch.c index 30a6f1e7e1..d4a4e01694 100644 --- a/src/switch.c +++ b/src/switch.c @@ -437,7 +437,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-service")) { /* New installs will always have the service name specified, but keep a default for compat */ x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); } else { switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); @@ -450,7 +450,7 @@ int main(int argc, char *argv[]) char exePath[1024]; char servicePath[1024]; x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); } else { switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); @@ -485,7 +485,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-uninstall")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); } else { switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); @@ -521,7 +521,7 @@ int main(int argc, char *argv[]) #else if (local_argv[x] && !strcmp(local_argv[x], "-u")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { runas_user = local_argv[x]; } known_opt++; @@ -529,7 +529,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-g")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { runas_group = local_argv[x]; } known_opt++; @@ -641,7 +641,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-conf")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.conf_dir) { fprintf(stderr, "Allocation error\n"); @@ -658,7 +658,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-mod")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.mod_dir) { fprintf(stderr, "Allocation error\n"); @@ -674,7 +674,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-log")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.log_dir) { fprintf(stderr, "Allocation error\n"); @@ -692,7 +692,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-run")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.run_dir) { fprintf(stderr, "Allocation error\n"); @@ -709,7 +709,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-db")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.db_dir) { fprintf(stderr, "Allocation error\n"); @@ -726,7 +726,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-scripts")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.script_dir) { fprintf(stderr, "Allocation error\n"); @@ -742,7 +742,7 @@ int main(int argc, char *argv[]) if (local_argv[x] && !strcmp(local_argv[x], "-htdocs")) { x++; - if (local_argv[x] && strlen(local_argv[x])) { + if (!switch_strlen_zero(local_argv[x])) { SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.htdocs_dir) { fprintf(stderr, "Allocation error\n"); From 659ea9f117e189f89a5f29f44a69b90f995ae392 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 10 Jul 2012 15:08:59 +0200 Subject: [PATCH 0651/1057] freeswitch: Move usage description out of main() and improve cmdline option handling. Move empty cmdline option string check and "-help/-h/-?" handling to top of loop. Emit a proper error message for unknown options. (Just displaying the usage description, but not telling the user which option was wrong, is bad mojo). Signed-off-by: Stefan Knoblich --- src/switch.c | 98 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/src/switch.c b/src/switch.c index d4a4e01694..e5bcee3153 100644 --- a/src/switch.c +++ b/src/switch.c @@ -331,6 +331,50 @@ void daemonize(int do_wait) #endif +static const char const usage[] = + "Usage: freeswitch [OPTIONS]\n\n" + "These are the optional arguments you can pass to freeswitch:\n" +#ifdef WIN32 + "\t-service [name] -- start freeswitch as a service, cannot be used if loaded as a console app\n" + "\t-install [name] -- install freeswitch as a service, with optional service name\n" + "\t-uninstall -- remove freeswitch as a service\n" + "\t-monotonic-clock -- use monotonic clock as timer source\n" +#else + "\t-nf -- no forking\n" + "\t-u [user] -- specify user to switch to\n" + "\t-g [group] -- specify group to switch to\n" +#endif +#ifdef HAVE_SETRLIMIT + "\t-waste -- allow memory waste\n" + "\t-core -- dump cores\n" +#endif + "\t-help -- this message\n" + "\t-version -- print the version and exit\n" + "\t-rp -- enable high(realtime) priority settings\n" + "\t-lp -- enable low priority settings\n" + "\t-np -- enable normal priority settings (system defaults)\n" + "\t-vg -- run under valgrind\n" + "\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" + "\t-nc -- do not output to a console and background\n" +#ifndef WIN32 + "\t-ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc)\n" +#endif + "\t-c -- output to a console and stay in the foreground\n" + "\t-conf [confdir] -- specify an alternate config dir\n" + "\t-log [logdir] -- specify an alternate log dir\n" + "\t-run [rundir] -- specify an alternate run dir\n" + "\t-db [dbdir] -- specify an alternate db dir\n" + "\t-mod [moddir] -- specify an alternate mod dir\n" + "\t-htdocs [htdocsdir] -- specify an alternate htdocs dir\n" + "\t-scripts [scriptsdir] -- specify an alternate scripts dir\n"; + + /* the main application entry point */ int main(int argc, char *argv[]) { @@ -354,7 +398,6 @@ int main(int argc, char *argv[]) char *local_argv[1024] = { 0 }; int local_argc = argc; char *arg_argv[128] = { 0 }; - char *usageDesc; int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; int known_opt; int priority = 0; @@ -392,46 +435,16 @@ int main(int argc, char *argv[]) nc++; } - usageDesc = "these are the optional arguments you can pass to freeswitch\n" -#ifdef WIN32 - "\t-service [name] -- start freeswitch as a service, cannot be used if loaded as a console app\n" - "\t-install [name] -- install freeswitch as a service, with optional service name\n" - "\t-uninstall -- remove freeswitch as a service\n" - "\t-monotonic-clock -- use monotonic clock as timer source\n" -#else - "\t-nf -- no forking\n" - "\t-u [user] -- specify user to switch to\n" "\t-g [group] -- specify group to switch to\n" -#endif - "\t-help -- this message\n" "\t-version -- print the version and exit\n" -#ifdef HAVE_SETRLIMIT - "\t-waste -- allow memory waste\n" - "\t-core -- dump cores\n" -#endif - "\t-rp -- enable high(realtime) priority settings\n" - "\t-lp -- enable low priority settings\n" - "\t-np -- enable normal priority settings (system defaults)\n" - "\t-vg -- run under valgrind\n" - "\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" - "\t-nc -- do not output to a console and background\n" -#ifndef WIN32 - "\t-ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc)\n" -#endif - "\t-c -- output to a console and stay in the foreground\n" - "\t-conf [confdir] -- specify an alternate config dir\n" - "\t-log [logdir] -- specify an alternate log dir\n" - "\t-run [rundir] -- specify an alternate run dir\n" - "\t-db [dbdir] -- specify an alternate db dir\n" - "\t-mod [moddir] -- specify an alternate mod dir\n" - "\t-htdocs [htdocsdir] -- specify an alternate htdocs dir\n" "\t-scripts [scriptsdir] -- specify an alternate scripts dir\n"; - for (x = 1; x < local_argc; x++) { known_opt = 0; + + if (switch_strlen_zero(local_argv[x])) + continue; + + if (!strcmp(local_argv[x], "-help") || !strcmp(local_argv[x], "-h") || !strcmp(local_argv[x], "-?")) { + printf("%s\n", usage); + exit(EXIT_SUCCESS); + } #ifdef WIN32 if (x == 1) { if (local_argv[x] && !strcmp(local_argv[x], "-service")) { @@ -756,9 +769,10 @@ int main(int argc, char *argv[]) known_opt++; } - if (!known_opt || (local_argv[x] && (!strcmp(local_argv[x], "-help") || !strcmp(local_argv[x], "-h") || !strcmp(local_argv[x], "-?")))) { - printf("%s\n", usageDesc); - exit(0); + if (!known_opt) { + fprintf(stderr, "Unknown option '%s', see '%s -help' for a list of valid options\n", + local_argv[x], local_argv[0]); + exit(EXIT_FAILURE); } } From f9d0e249a11921175af0dc96cf9e524c1aa1d00f Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 10 Jul 2012 23:32:42 +0200 Subject: [PATCH 0652/1057] freeswitch: Rework option handling in main() and other clean ups. Use a chain of "else if" statements, drop known_opt completely. Added bonus: We stop trying to parse option arguments as (possible) options. Arguments of -u/-g and path options (-conf) now check whether their argument starts with a dash ('-') and error out in case it does (= next option, not a valid argument). Use PATH_MAX for everything that stores files / directories. Use switch_bool_t and SWITCH_TRUE/_FALSE for boolean variables. Use EXIT_SUCCESS/_FAILURE for exit() calls. Get rid of excessive indenting (especially in the win32 parts of main()). NOTE: Win32 parts untested. Signed-off-by: Stefan Knoblich --- src/switch.c | 468 +++++++++++++++++++++++++-------------------------- 1 file changed, 230 insertions(+), 238 deletions(-) diff --git a/src/switch.c b/src/switch.c index e5bcee3153..5edccd10b2 100644 --- a/src/switch.c +++ b/src/switch.c @@ -113,7 +113,7 @@ static void handle_SIGCHLD(int sig) static int freeswitch_kill_background() { FILE *f; /* FILE handle to open the pid file */ - char path[256] = ""; /* full path of the PID file */ + char path[PATH_MAX] = ""; /* full path of the PID file */ pid_t pid = 0; /* pid from the pid file */ /* set the globals so we can use the global paths. */ @@ -375,22 +375,34 @@ static const char const usage[] = "\t-scripts [scriptsdir] -- specify an alternate scripts dir\n"; +/** + * Check if value string starts with "-" + */ +static switch_bool_t is_option(const char *p) +{ + /* skip whitespaces */ + while ((*p == 13) || (*p == 10) || (*p == 9) || (*p == 32) || (*p == 11)) p++; + return (p[0] == '-'); +} + + /* the main application entry point */ int main(int argc, char *argv[]) { - char pid_path[256] = ""; /* full path to the pid file */ + char pid_path[PATH_MAX] = ""; /* full path to the pid file */ char pid_buffer[32] = ""; /* pid string */ char old_pid_buffer[32] = ""; /* pid string */ switch_size_t pid_len, old_pid_len; const char *err = NULL; /* error value for return from freeswitch initialization */ #ifndef WIN32 - int nf = 0; /* TRUE if we are running in nofork mode */ + switch_bool_t nf = SWITCH_FALSE; /* TRUE if we are running in nofork mode */ + switch_bool_t do_wait = SWITCH_FALSE; char *runas_user = NULL; char *runas_group = NULL; #else - int win32_service = 0; + switch_bool_t win32_service = SWITCH_FALSE; #endif - int nc = 0; /* TRUE if we are running in noconsole mode */ + switch_bool_t nc = SWITCH_FALSE; /* TRUE if we are running in noconsole mode */ pid_t pid = 0; int i, x; char *opts; @@ -399,11 +411,7 @@ int main(int argc, char *argv[]) int local_argc = argc; char *arg_argv[128] = { 0 }; int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; - int known_opt; int priority = 0; -#ifndef WIN32 - int do_wait = 0; -#endif #ifdef __sun switch_core_flag_t flags = SCF_USE_SQL; #else @@ -415,7 +423,7 @@ int main(int argc, char *argv[]) switch_memory_pool_t *pool = NULL; #ifdef HAVE_SETRLIMIT struct rlimit rlp; - int waste = 0; + switch_bool_t waste = SWITCH_FALSE; #endif for (x = 0; x < argc; x++) { @@ -430,13 +438,11 @@ int main(int argc, char *argv[]) } } - if (local_argv[0] && strstr(local_argv[0], "freeswitchd")) { - nc++; + nc = SWITCH_TRUE; } for (x = 1; x < local_argc; x++) { - known_opt = 0; if (switch_strlen_zero(local_argv[x])) continue; @@ -446,330 +452,317 @@ int main(int argc, char *argv[]) exit(EXIT_SUCCESS); } #ifdef WIN32 - if (x == 1) { - if (local_argv[x] && !strcmp(local_argv[x], "-service")) { - /* New installs will always have the service name specified, but keep a default for compat */ - x++; - if (!switch_strlen_zero(local_argv[x])) { - switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); - } else { - switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); - } - known_opt++; - win32_service++; - continue; - } - if (local_argv[x] && !strcmp(local_argv[x], "-install")) { - char exePath[1024]; - char servicePath[1024]; - x++; - if (!switch_strlen_zero(local_argv[x])) { - switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); - } else { - switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); - } - known_opt++; - GetModuleFileName(NULL, exePath, 1024); - snprintf(servicePath, sizeof(servicePath), "%s -service %s", exePath, service_name); - { /* Perform service installation */ - SC_HANDLE hService; - SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (!hSCManager) { - fprintf(stderr, "Could not open service manager (%d).\n", GetLastError()); - exit(1); - } - hService = CreateService(hSCManager, service_name, service_name, GENERIC_READ | GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, servicePath, NULL, NULL, NULL, NULL, /* Service start name */ - NULL); - if (!hService) { - fprintf(stderr, "Error creating freeswitch service (%d).\n", GetLastError()); - } else { - /* Set desc, and don't care if it succeeds */ - SERVICE_DESCRIPTION desc; - desc.lpDescription = "The FreeSWITCH service."; - if (!ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &desc)) { - fprintf(stderr, "FreeSWITCH installed, but could not set the service description (%d).\n", GetLastError()); - } - CloseServiceHandle(hService); - } - CloseServiceHandle(hSCManager); - exit(0); - } + if (x == 1 && !strcmp(local_argv[x], "-service")) { + /* New installs will always have the service name specified, but keep a default for compat */ + x++; + if (!switch_strlen_zero(local_argv[x])) { + switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); + } else { + switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); } - if (local_argv[x] && !strcmp(local_argv[x], "-uninstall")) { - x++; - if (!switch_strlen_zero(local_argv[x])) { - switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); - } else { - switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); - } - { /* Do the uninstallation */ - SC_HANDLE hService; - SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (!hSCManager) { - fprintf(stderr, "Could not open service manager (%d).\n", GetLastError()); - exit(1); - } - hService = OpenService(hSCManager, service_name, DELETE); - known_opt++; - if (hService != NULL) { - /* remove the service! */ - if (!DeleteService(hService)) { - fprintf(stderr, "Error deleting service (%d).\n", GetLastError()); - } - CloseServiceHandle(hService); - } else { - fprintf(stderr, "Error opening service (%d).\n", GetLastError()); - } - CloseServiceHandle(hSCManager); - exit(0); - } - } + win32_service = SWITCH_TRUE; + continue; } - if (local_argv[x] && !strcmp(local_argv[x], "-monotonic-clock")) { + else if (x == 1 && !strcmp(local_argv[x], "-install")) { + char servicePath[PATH_MAX]; + char exePath[PATH_MAX]; + SC_HANDLE hService; + SC_HANDLE hSCManager; + SERVICE_DESCRIPTION desc; + desc.lpDescription = "The FreeSWITCH service."; + + x++; + if (!switch_strlen_zero(local_argv[x])) { + switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); + } else { + switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); + } + + GetModuleFileName(NULL, exePath, sizeof(exePath)); + snprintf(servicePath, sizeof(servicePath), "%s -service %s", exePath, service_name); + + /* Perform service installation */ + + hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (!hSCManager) { + fprintf(stderr, "Could not open service manager (%d).\n", GetLastError()); + exit(EXIT_FAILURE); + } + + hService = CreateService(hSCManager, service_name, service_name, GENERIC_READ | GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, + servicePath, NULL, NULL, NULL, NULL, /* Service start name */ NULL); + if (!hService) { + fprintf(stderr, "Error creating freeswitch service (%d).\n", GetLastError()); + CloseServiceHandle(hSCManager); + exit(EXIT_FAILURE); + } + + /* Set desc, and don't care if it succeeds */ + if (!ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &desc)) { + fprintf(stderr, "FreeSWITCH installed, but could not set the service description (%d).\n", GetLastError()); + } + + CloseServiceHandle(hService); + CloseServiceHandle(hSCManager); + exit(EXIT_SUCCESS); + } + + else if (x == 1 && !strcmp(local_argv[x], "-uninstall")) { + SC_HANDLE hService; + SC_HANDLE hSCManager; + BOOL deleted; + + x++; + if (!switch_strlen_zero(local_argv[x])) { + switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); + } else { + switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); + } + + /* Do the uninstallation */ + hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (!hSCManager) { + fprintf(stderr, "Could not open service manager (%d).\n", GetLastError()); + exit(EXIT_FAILURE); + } + + hService = OpenService(hSCManager, service_name, DELETE); + if (!hService) { + fprintf(stderr, "Error opening service (%d).\n", GetLastError()); + CloseServiceHandle(hSCManager); + exit(EXIT_FAILURE); + } + + /* remove the service! */ + deleted = DeleteService(hService); + if (!deleted) { + fprintf(stderr, "Error deleting service (%d).\n", GetLastError()); + } + + CloseServiceHandle(hService); + CloseServiceHandle(hSCManager); + exit(deleted ? EXIT_SUCCESS : EXIT_FAILURE); + } + + else if (!strcmp(local_argv[x], "-monotonic-clock")) { flags |= SCF_USE_WIN32_MONOTONIC; - known_opt++; } #else - if (local_argv[x] && !strcmp(local_argv[x], "-u")) { + else if (!strcmp(local_argv[x], "-u")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - runas_user = local_argv[x]; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "Option '%s' requires an argument!\n", local_argv[x - 1]); + exit(EXIT_FAILURE); } - known_opt++; + runas_user = local_argv[x]; } - if (local_argv[x] && !strcmp(local_argv[x], "-g")) { + else if (!strcmp(local_argv[x], "-g")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - runas_group = local_argv[x]; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "Option '%s' requires an argument!\n", local_argv[x - 1]); + exit(EXIT_FAILURE); } - known_opt++; + runas_group = local_argv[x]; } - if (local_argv[x] && !strcmp(local_argv[x], "-nf")) { - nf++; - known_opt++; + else if (!strcmp(local_argv[x], "-nf")) { + nf = SWITCH_TRUE; } - if (local_argv[x] && !strcmp(local_argv[x], "-version")) { + else if (!strcmp(local_argv[x], "-version")) { fprintf(stdout, "FreeSWITCH version: %s\n", SWITCH_VERSION_FULL); - return 0; - known_opt++; + exit(EXIT_SUCCESS); } #endif #ifdef HAVE_SETRLIMIT - if (local_argv[x] && !strcmp(local_argv[x], "-core")) { + else if (!strcmp(local_argv[x], "-core")) { memset(&rlp, 0, sizeof(rlp)); rlp.rlim_cur = RLIM_INFINITY; rlp.rlim_max = RLIM_INFINITY; setrlimit(RLIMIT_CORE, &rlp); - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-waste")) { + else if (!strcmp(local_argv[x], "-waste")) { fprintf(stderr, "WARNING: Wasting up to 8 megs of memory per thread.\n"); sleep(2); - waste++; - known_opt++; + waste = SWITCH_TRUE; } - if (local_argv[x] && !strcmp(local_argv[x], "-no-auto-stack")) { - waste++; - known_opt++; + else if (!strcmp(local_argv[x], "-no-auto-stack")) { + waste = SWITCH_TRUE; } #endif - - if (local_argv[x] && (!strcmp(local_argv[x], "-hp") || !strcmp(local_argv[x], "-rp"))) { + else if (!strcmp(local_argv[x], "-hp") || !strcmp(local_argv[x], "-rp")) { priority = 2; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-lp")) { + else if (!strcmp(local_argv[x], "-lp")) { priority = -1; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-np")) { + else if (!strcmp(local_argv[x], "-np")) { priority = 1; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-nosql")) { + else if (!strcmp(local_argv[x], "-nosql")) { flags &= ~SCF_USE_SQL; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-nonat")) { + else if (!strcmp(local_argv[x], "-nonat")) { flags &= ~SCF_USE_AUTO_NAT; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-nonatmap")) { + else if (!strcmp(local_argv[x], "-nonatmap")) { flags &= ~SCF_USE_NAT_MAPPING; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-heavy-timer")) { + else if (!strcmp(local_argv[x], "-heavy-timer")) { flags |= SCF_USE_HEAVY_TIMING; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-nort")) { + else if (!strcmp(local_argv[x], "-nort")) { flags &= ~SCF_USE_CLOCK_RT; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-nocal")) { + else if (!strcmp(local_argv[x], "-nocal")) { flags &= ~SCF_CALIBRATE_CLOCK; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-vg")) { + else if (!strcmp(local_argv[x], "-vg")) { flags |= SCF_VG; - known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-stop")) { - do_kill++; - known_opt++; + else if (!strcmp(local_argv[x], "-stop")) { + do_kill = SWITCH_TRUE; } - if (local_argv[x] && !strcmp(local_argv[x], "-nc")) { - nc++; - known_opt++; + else if (!strcmp(local_argv[x], "-nc")) { + nc = SWITCH_TRUE; } #ifndef WIN32 - if (local_argv[x] && !strcmp(local_argv[x], "-ncwait")) { - nc++; - do_wait++; - known_opt++; + else if (!strcmp(local_argv[x], "-ncwait")) { + nc = SWITCH_TRUE; + do_wait = SWITCH_TRUE; } #endif - if (local_argv[x] && !strcmp(local_argv[x], "-c")) { - nc = 0; - known_opt++; + else if (!strcmp(local_argv[x], "-c")) { + nc = SWITCH_FALSE; } - if (local_argv[x] && !strcmp(local_argv[x], "-conf")) { + else if (!strcmp(local_argv[x], "-conf")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1); - if (!SWITCH_GLOBAL_dirs.conf_dir) { - fprintf(stderr, "Allocation error\n"); - return 255; - } - strcpy(SWITCH_GLOBAL_dirs.conf_dir, local_argv[x]); - alt_dirs++; - } else { + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { fprintf(stderr, "When using -conf you must specify a config directory\n"); return 255; } - known_opt++; + + SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.conf_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.conf_dir, local_argv[x]); + alt_dirs++; } - if (local_argv[x] && !strcmp(local_argv[x], "-mod")) { + else if (!strcmp(local_argv[x], "-mod")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1); - if (!SWITCH_GLOBAL_dirs.mod_dir) { - fprintf(stderr, "Allocation error\n"); - return 255; - } - strcpy(SWITCH_GLOBAL_dirs.mod_dir, local_argv[x]); - } else { + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { fprintf(stderr, "When using -mod you must specify a module directory\n"); return 255; } - known_opt++; + + SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.mod_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.mod_dir, local_argv[x]); } - if (local_argv[x] && !strcmp(local_argv[x], "-log")) { + else if (!strcmp(local_argv[x], "-log")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1); - if (!SWITCH_GLOBAL_dirs.log_dir) { - fprintf(stderr, "Allocation error\n"); - return 255; - } - strcpy(SWITCH_GLOBAL_dirs.log_dir, local_argv[x]); - alt_dirs++; - log_set++; - } else { + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { fprintf(stderr, "When using -log you must specify a log directory\n"); return 255; } - known_opt++; + + SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.log_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.log_dir, local_argv[x]); + alt_dirs++; + log_set = SWITCH_TRUE; } - if (local_argv[x] && !strcmp(local_argv[x], "-run")) { + else if (!strcmp(local_argv[x], "-run")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(local_argv[x]) + 1); - if (!SWITCH_GLOBAL_dirs.run_dir) { - fprintf(stderr, "Allocation error\n"); - return 255; - } - strcpy(SWITCH_GLOBAL_dirs.run_dir, local_argv[x]); - run_set++; - } else { + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { fprintf(stderr, "When using -run you must specify a pid directory\n"); return 255; } - known_opt++; + + SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.run_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.run_dir, local_argv[x]); + run_set = SWITCH_TRUE; } - if (local_argv[x] && !strcmp(local_argv[x], "-db")) { + else if (!strcmp(local_argv[x], "-db")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1); - if (!SWITCH_GLOBAL_dirs.db_dir) { - fprintf(stderr, "Allocation error\n"); - return 255; - } - strcpy(SWITCH_GLOBAL_dirs.db_dir, local_argv[x]); - alt_dirs++; - } else { + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { fprintf(stderr, "When using -db you must specify a db directory\n"); return 255; } - known_opt++; + + SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.db_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.db_dir, local_argv[x]); + alt_dirs++; } - if (local_argv[x] && !strcmp(local_argv[x], "-scripts")) { + else if (!strcmp(local_argv[x], "-scripts")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1); - if (!SWITCH_GLOBAL_dirs.script_dir) { - fprintf(stderr, "Allocation error\n"); - return 255; - } - strcpy(SWITCH_GLOBAL_dirs.script_dir, local_argv[x]); - } else { + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { fprintf(stderr, "When using -scripts you must specify a scripts directory\n"); return 255; } - known_opt++; + + SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.script_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.script_dir, local_argv[x]); } - if (local_argv[x] && !strcmp(local_argv[x], "-htdocs")) { + else if (!strcmp(local_argv[x], "-htdocs")) { x++; - if (!switch_strlen_zero(local_argv[x])) { - SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1); - if (!SWITCH_GLOBAL_dirs.htdocs_dir) { - fprintf(stderr, "Allocation error\n"); - return 255; - } - strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, local_argv[x]); - } else { + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { fprintf(stderr, "When using -htdocs you must specify a htdocs directory\n"); return 255; } - known_opt++; - } - if (!known_opt) { + SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.htdocs_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, local_argv[x]); + } + /* Unknown option (always last!) */ + else { fprintf(stderr, "Unknown option '%s', see '%s -help' for a list of valid options\n", local_argv[x], local_argv[0]); exit(EXIT_FAILURE); @@ -879,21 +872,20 @@ int main(int argc, char *argv[]) } #else if (win32_service) { - { /* Attempt to start service */ - SERVICE_TABLE_ENTRY dispatchTable[] = { - {service_name, &service_main} - , - {NULL, NULL} - }; - service_flags = flags; /* copy parsed flags for service startup */ + /* Attempt to start service */ + SERVICE_TABLE_ENTRY dispatchTable[] = { + {service_name, &service_main} + , + {NULL, NULL} + }; + service_flags = flags; /* copy parsed flags for service startup */ - if (StartServiceCtrlDispatcher(dispatchTable) == 0) { - /* Not loaded as a service */ - fprintf(stderr, "Error Freeswitch loaded as a console app with -service option\n"); - fprintf(stderr, "To install the service load freeswitch with -install\n"); - } - exit(0); + if (StartServiceCtrlDispatcher(dispatchTable) == 0) { + /* Not loaded as a service */ + fprintf(stderr, "Error Freeswitch loaded as a console app with -service option\n"); + fprintf(stderr, "To install the service load freeswitch with -install\n"); } + exit(EXIT_SUCCESS); } #endif From b494d46f45728a9d54b1640a3c0d92abca680546 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 00:11:59 +0200 Subject: [PATCH 0653/1057] freeswitch: Clean up daemonize(). Whitespace and indentation clean up. Use EXIT_SUCESS/_FAILURE. Signed-off-by: Stefan Knoblich --- src/switch.c | 73 ++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/src/switch.c b/src/switch.c index 5edccd10b2..d4f8b1b42c 100644 --- a/src/switch.c +++ b/src/switch.c @@ -236,75 +236,68 @@ void WINAPI service_main(DWORD numArgs, char **args) #else -void daemonize(int do_wait) +static void daemonize(int do_wait) { int fd; pid_t pid; if (!do_wait) { switch (fork()) { - case 0: + case 0: /* child process */ break; case -1: fprintf(stderr, "Error Backgrounding (fork)! %d - %s\n", errno, strerror(errno)); - exit(0); + exit(EXIT_SUCCESS); break; - default: - exit(0); + default: /* parent process */ + exit(EXIT_SUCCESS); } if (setsid() < 0) { fprintf(stderr, "Error Backgrounding (setsid)! %d - %s\n", errno, strerror(errno)); - exit(0); + exit(EXIT_SUCCESS); } } pid = fork(); switch (pid) { - case 0: + case 0: /* child process */ break; case -1: fprintf(stderr, "Error Backgrounding (fork2)! %d - %s\n", errno, strerror(errno)); - exit(0); + exit(EXIT_SUCCESS); break; - default: - { - fprintf(stderr, "%d Backgrounding.\n", (int) pid); + default: /* parent process */ + fprintf(stderr, "%d Backgrounding.\n", (int) pid); + if (do_wait) { + unsigned int sanity = 60; + char *o; - if (do_wait) { - unsigned int sanity = 60; - char *o; - - if ((o = getenv("FREESWITCH_BG_TIMEOUT"))) { - int tmp = atoi(o); - if (tmp > 0) { - sanity = tmp; - } + if ((o = getenv("FREESWITCH_BG_TIMEOUT"))) { + int tmp = atoi(o); + if (tmp > 0) { + sanity = tmp; } - - while(--sanity && !system_ready) { - - if (sanity % 2 == 0) { - printf("FreeSWITCH[%d] Waiting for background process pid:%d to be ready.....\n", (int)getpid(), (int) pid); - } - sleep(1); - } - - if (system_ready == 1) { - printf("FreeSWITCH[%d] System Ready pid:%d\n", (int) getpid(), (int) pid); - } else { - printf("FreeSWITCH[%d] Error starting system! pid:%d\n", (int)getpid(), (int) pid); - kill(pid, 9); - exit(-1); - } - } - } + while (--sanity && !system_ready) { - exit(0); + if (sanity % 2 == 0) { + printf("FreeSWITCH[%d] Waiting for background process pid:%d to be ready.....\n", (int)getpid(), (int) pid); + } + sleep(1); + } + if (!system_ready) { + printf("FreeSWITCH[%d] Error starting system! pid:%d\n", (int)getpid(), (int) pid); + kill(pid, 9); + exit(EXIT_FAILURE); + } + + printf("FreeSWITCH[%d] System Ready pid:%d\n", (int) getpid(), (int) pid); + } + exit(EXIT_SUCCESS); } if (do_wait) { @@ -317,11 +310,13 @@ void daemonize(int do_wait) dup2(fd, 0); close(fd); } + fd = open("/dev/null", O_WRONLY); if (fd != 1) { dup2(fd, 1); close(fd); } + fd = open("/dev/null", O_WRONLY); if (fd != 2) { dup2(fd, 2); From 93a429fc11ffece1cde64dd57da5bbfeb4a59436 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 00:12:57 +0200 Subject: [PATCH 0654/1057] freeswitch: Whitespace clean up in switch.c. Signed-off-by: Stefan Knoblich --- src/switch.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/switch.c b/src/switch.c index d4f8b1b42c..7ef7a157df 100644 --- a/src/switch.c +++ b/src/switch.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2012, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Michael Jerris * Pawel Pierscionek @@ -100,7 +100,6 @@ static void handle_SIGCHLD(int sig) if (sig) {}; pid = wait(&status); - if (pid > 0) { system_ready = -1; } @@ -798,28 +797,27 @@ int main(int argc, char *argv[]) if (rlp.rlim_cur != SWITCH_THREAD_STACKSIZE) { char buf[1024] = ""; int i = 0; + fprintf(stderr, "Error: stacksize %d is not optimal: run ulimit -s %d from your shell before starting the application.\nauto-adjusting stack size for optimal performance...\n", (int) (rlp.rlim_cur / 1024), SWITCH_THREAD_STACKSIZE / 1024); - + memset(&rlp, 0, sizeof(rlp)); rlp.rlim_cur = SWITCH_THREAD_STACKSIZE; rlp.rlim_max = SWITCH_THREAD_STACKSIZE; setrlimit(RLIMIT_STACK, &rlp); - + apr_terminate(); ret = (int) execv(argv[0], argv); - + for (i = 0; i < argc; i++) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]); } - - return system(buf); + return system(buf); } } #endif - signal(SIGILL, handle_SIGILL); signal(SIGTERM, handle_SIGILL); #ifndef WIN32 @@ -828,7 +826,7 @@ int main(int argc, char *argv[]) signal(SIGCHLD, handle_SIGCHLD); } #endif - + if (nc) { #ifdef WIN32 FreeConsole(); @@ -839,8 +837,7 @@ int main(int argc, char *argv[]) #endif } - - switch(priority) { + switch (priority) { case 2: set_realtime_priority(); break; From edfbbb127cfc16f32b519a6c9f8233db7f37449e Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 00:14:01 +0200 Subject: [PATCH 0655/1057] freeswitch: Create struct rlimit rlp where it is needed (move down into block scope). Signed-off-by: Stefan Knoblich --- src/switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch.c b/src/switch.c index 7ef7a157df..fc076fe709 100644 --- a/src/switch.c +++ b/src/switch.c @@ -416,7 +416,6 @@ int main(int argc, char *argv[]) switch_file_t *fd; switch_memory_pool_t *pool = NULL; #ifdef HAVE_SETRLIMIT - struct rlimit rlp; switch_bool_t waste = SWITCH_FALSE; #endif @@ -573,6 +572,7 @@ int main(int argc, char *argv[]) #endif #ifdef HAVE_SETRLIMIT else if (!strcmp(local_argv[x], "-core")) { + struct rlimit rlp; memset(&rlp, 0, sizeof(rlp)); rlp.rlim_cur = RLIM_INFINITY; rlp.rlim_max = RLIM_INFINITY; @@ -789,7 +789,7 @@ int main(int argc, char *argv[]) #if defined(HAVE_SETRLIMIT) && !defined(__sun) if (!waste && !(flags & SCF_VG)) { - //int x; + struct rlimit rlp; memset(&rlp, 0, sizeof(rlp)); getrlimit(RLIMIT_STACK, &rlp); From aeb4b31063e5378dbd41061b488f0daa8f8fb190 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 00:16:21 +0200 Subject: [PATCH 0656/1057] freeswitch: Show user/group name in error message if change_user_group() fails. Signed-off-by: Stefan Knoblich --- src/switch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch.c b/src/switch.c index fc076fe709..93ae47cfd5 100644 --- a/src/switch.c +++ b/src/switch.c @@ -858,7 +858,9 @@ int main(int argc, char *argv[]) #ifndef WIN32 if (runas_user || runas_group) { if (change_user_group(runas_user, runas_group) < 0) { - fprintf(stderr, "Failed to switch user / group\n"); + fprintf(stderr, "Failed to switch user [%s] / group [%s]\n", + switch_strlen_zero(runas_user) ? "-" : runas_user, + switch_strlen_zero(runas_group) ? "-" : runas_group); return 255; } } From 07e9467d351d42aabb19c7e5717308b06df0529a Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 00:50:46 +0200 Subject: [PATCH 0657/1057] freeswitch: Add more cmdline options to control file locations. Setting the base_dir variable didn't work so this will have to be enough for now. Signed-off-by: Stefan Knoblich --- src/switch.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 89 insertions(+), 7 deletions(-) diff --git a/src/switch.c b/src/switch.c index 93ae47cfd5..4410d75fb5 100644 --- a/src/switch.c +++ b/src/switch.c @@ -360,13 +360,19 @@ static const char const usage[] = "\t-ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc)\n" #endif "\t-c -- output to a console and stay in the foreground\n" - "\t-conf [confdir] -- specify an alternate config dir\n" - "\t-log [logdir] -- specify an alternate log dir\n" - "\t-run [rundir] -- specify an alternate run dir\n" - "\t-db [dbdir] -- specify an alternate db dir\n" - "\t-mod [moddir] -- specify an alternate mod dir\n" - "\t-htdocs [htdocsdir] -- specify an alternate htdocs dir\n" - "\t-scripts [scriptsdir] -- specify an alternate scripts dir\n"; + "\n\tOptions to control locations of files:\n" + "\t-conf [confdir] -- alternate directory for FreeSWITCH configuration files\n" + "\t-log [logdir] -- alternate directory for logfiles\n" + "\t-run [rundir] -- alternate directory for runtime files\n" + "\t-db [dbdir] -- alternate directory for the internal database\n" + "\t-mod [moddir] -- alternate directory for modules\n" + "\t-htdocs [htdocsdir] -- alternate directory for htdocs\n" + "\t-scripts [scriptsdir] -- alternate directory for scripts\n" + "\t-temp [directory] -- alternate directory for temporary files\n" + "\t-grammar [directory] -- alternate directory for grammar files\n" + "\t-recordings [directory] -- alternate directory for recordings\n" + "\t-storage [directory] -- alternate directory for voicemail storage\n" + "\t-sounds [directory] -- alternate directory for sound files\n"; /** @@ -755,6 +761,82 @@ int main(int argc, char *argv[]) } strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, local_argv[x]); } + + else if (!strcmp(local_argv[x], "-temp")) { + x++; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "When using -temp you must specify a temp directory\n"); + return 255; + } + + SWITCH_GLOBAL_dirs.temp_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.temp_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.temp_dir, local_argv[x]); + } + + else if (!strcmp(local_argv[x], "-storage")) { + x++; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "When using -storage you must specify a storage directory\n"); + return 255; + } + + SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.storage_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.storage_dir, local_argv[x]); + } + + else if (!strcmp(local_argv[x], "-recordings")) { + x++; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "When using -recordings you must specify a recording directory\n"); + return 255; + } + + SWITCH_GLOBAL_dirs.recordings_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.recordings_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.recordings_dir, local_argv[x]); + } + + else if (!strcmp(local_argv[x], "-grammar")) { + x++; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "When using -grammar you must specify a grammar directory\n"); + return 255; + } + + SWITCH_GLOBAL_dirs.grammar_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.grammar_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.grammar_dir, local_argv[x]); + } + + else if (!strcmp(local_argv[x], "-sounds")) { + x++; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "When using -sounds you must specify a sounds directory\n"); + return 255; + } + + SWITCH_GLOBAL_dirs.sounds_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.sounds_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.sounds_dir, local_argv[x]); + } + /* Unknown option (always last!) */ else { fprintf(stderr, "Unknown option '%s', see '%s -help' for a list of valid options\n", From 91236c9ad3e9e637d8047cc3effe1f94085f985e Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 11 Jul 2012 07:52:20 -0500 Subject: [PATCH 0658/1057] fix build related issues on windows - trivial --- src/switch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/switch.c b/src/switch.c index 4410d75fb5..c8342257c2 100644 --- a/src/switch.c +++ b/src/switch.c @@ -68,6 +68,10 @@ static switch_core_flag_t service_flags = SCF_NONE; /* event to signal shutdown (for you unix people, this is like a pthread_cond) */ static HANDLE shutdown_event; + +#ifndef PATH_MAX +#define PATH_MAX 256 +#endif #endif /* signal handler for when freeswitch is running in background mode. @@ -325,7 +329,7 @@ static void daemonize(int do_wait) #endif -static const char const usage[] = +static const char usage[] = "Usage: freeswitch [OPTIONS]\n\n" "These are the optional arguments you can pass to freeswitch:\n" #ifdef WIN32 From 61cfafe6c2866c75f64466697f10315bca173663 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 17:21:49 +0200 Subject: [PATCH 0659/1057] FreeTDM: Move custom backtrace code into ftdm_backtrace_walk() and helper functions. Portability fix for uClibc and other (linux) environments that lack execinfo.h. ftdm_backtrace_walk() and related return FTDM_NOTIMPL and print a message if backtraces are not available in the current environment. Signed-off-by: Stefan Knoblich --- libs/freetdm/Makefile.am | 3 +- libs/freetdm/configure.ac | 2 +- libs/freetdm/mod_freetdm/mod_freetdm.c | 40 +++++------ libs/freetdm/src/ftdm_backtrace.c | 75 ++++++++++++++++++++ libs/freetdm/src/include/freetdm.h | 34 +++++++++ libs/freetdm/src/include/private/ftdm_core.h | 4 -- 6 files changed, 132 insertions(+), 26 deletions(-) create mode 100644 libs/freetdm/src/ftdm_backtrace.c diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index bfd68a17eb..55d8865dec 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -79,7 +79,8 @@ libfreetdm_la_SOURCES = \ $(SRC)/ftdm_buffer.c \ $(SRC)/ftdm_threadmutex.c \ $(SRC)/ftdm_dso.c \ - $(SRC)/ftdm_cpu_monitor.c + $(SRC)/ftdm_cpu_monitor.c \ + $(SRC)/ftdm_backtrace.c library_include_HEADERS = \ $(SRC)/include/freetdm.h \ diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index b4c9cda8ab..f72a6268a8 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -136,7 +136,7 @@ AC_CHECK_LIB([dl], [dlopen]) AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([m], [cos]) -AC_CHECK_HEADERS([netdb.h sys/select.h]) +AC_CHECK_HEADERS([netdb.h sys/select.h execinfo.h]) AC_CHECK_FUNC([gethostbyname_r], [], [AC_CHECK_LIB([nsl], [gethostbyname_r])] diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 35b8d9b01a..64d34f232c 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -35,13 +35,6 @@ #include "freetdm.h" //#define CUDATEL_DEBUG -#ifdef CUDATEL_DEBUG -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif -#include -#include -#endif #ifndef __FUNCTION__ #define __FUNCTION__ __SWITCH_FUNC__ @@ -499,6 +492,21 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } +#ifdef CUDATEL_DEBUG +struct cudatel_trace_priv { + const char *name; + int span_id; + int chan_id; +}; + +static void cudatel_trace(const int tid, const void *addr, const char *symbol, void *priv) +{ + struct cudatel_trace_priv *data = priv; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%d:%d][tid:%d] %s -> %s\n", + data->span_id, data->chan_id, tid, data->name, symbol); +} +#endif + static switch_status_t channel_on_hangup(switch_core_session_t *session) { switch_channel_t *channel = NULL; @@ -558,19 +566,11 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) #ifdef CUDATEL_DEBUG { - pid_t tid = 0; - size_t size = 0; - char **symbols = NULL; - void *stacktrace[50]; - int si = 0; - size = backtrace(stacktrace, ftdm_array_len(stacktrace)); - symbols = backtrace_symbols(stacktrace, size); - tid = syscall(SYS_gettid); - for (si = 0; si < size; si++) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%d:%d][tid:%d] %s -> %s\n", - span_id, chan_id, tid, name, symbols[si]); - } - free(symbols); + struct cudatel_trace_priv trace_data; + trace_data.name = name; + trace_data.span_id = span_id; + trace_data.chan_id = chan_id; + ftdm_backtrace_walk(&cudatel_trace, &trace_data); } #endif diff --git a/libs/freetdm/src/ftdm_backtrace.c b/libs/freetdm/src/ftdm_backtrace.c new file mode 100644 index 0000000000..70eef159d1 --- /dev/null +++ b/libs/freetdm/src/ftdm_backtrace.c @@ -0,0 +1,75 @@ +/* + * + * + */ +#define _BSD_SOURCE +#include "private/ftdm_core.h" + +#ifdef HAVE_EXECINFO_H +#include +#include +#include +#include + +#define FTDM_BACKTRACE_MAX 50 + +FT_DECLARE(ftdm_status_t) ftdm_backtrace_walk(void (* callback)(const int tid, const void *addr, const char *symbol, void *priv), void *priv) +{ + void *stacktrace[FTDM_BACKTRACE_MAX]; + char **symbols = NULL; + size_t size = 0; + pid_t tid = 0; + int si = 0; + + if (!callback) { + return FTDM_EINVAL; + } + + tid = syscall(SYS_gettid); + + size = backtrace(stacktrace, ftdm_array_len(stacktrace)); + symbols = backtrace_symbols(stacktrace, size); + + for (si = 0; si < size; si++) { + callback(tid, stacktrace[si], symbols[si], priv); + } + + free(symbols); + return FTDM_SUCCESS; +} + +#else /* !HAVE_EXECINFO_H */ + +FT_DECLARE(ftdm_status_t) ftdm_backtrace_walk(void (* callback)(const int tid, const void *addr, const char *symbol, void *priv), void *priv) +{ + ftdm_log(FTDM_LOG_DEBUG, "Stack traces are not available on this platform!\n"); + return FTDM_NOTIMPL; +} + +#endif + + +static void span_backtrace(const int tid, const void *addr, const char *symbol, void *priv) +{ + ftdm_span_t *span = priv; + ftdm_log(FTDM_LOG_DEBUG, "[%d][tid:%d] %p -> %s\n", + ftdm_span_get_id(span), tid, addr, symbol); +} + +FT_DECLARE(ftdm_status_t) ftdm_backtrace_span(ftdm_span_t *span) +{ + return ftdm_backtrace_walk(&span_backtrace, span); +} + + +static void chan_backtrace(const int tid, const void *addr, const char *symbol, void *priv) +{ + ftdm_channel_t *chan = priv; + ftdm_log(FTDM_LOG_DEBUG, "[%d:%d][tid:%d] %p -> %s\n", + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan), tid, addr, symbol); +} + +FT_DECLARE(ftdm_status_t) ftdm_backtrace_chan(ftdm_channel_t *chan) +{ + return ftdm_backtrace_walk(&chan_backtrace, chan); +} diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index b178784239..d984f5b1c8 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1814,6 +1814,40 @@ FT_DECLARE(void) ftdm_global_set_config_directory(const char *path); /*! \brief Check if the FTDM library is initialized and running */ FT_DECLARE(ftdm_bool_t) ftdm_running(void); +/** + * Generate a stack trace and invoke a callback function for each entry + * \param[in] callback Callback function, that is invoked for each stack symbol + * \param[in] priv (User-)Private data passed to the callback + * \retval + * FTDM_SUCCESS On success + * FTDM_NOTIMPL Backtraces are not available + * FTDM_EINVAL Invalid arguments (callback was NULL) + */ +FT_DECLARE(ftdm_status_t) ftdm_backtrace_walk(void (* callback)(const int tid, const void *addr, const char *symbol, void *priv), void *priv); + +/** + * Convenience function to print a backtrace for a span. + * \note The backtrace is generated with FTDM_LOG_DEBUG log level. + * \param[in] span Span object + * \retval + * FTDM_SUCCESS On success + * FTDM_NOTIMPL Backtraces are not available + * FTDM_EINVAL Invalid arguments (e.g. span was NULL) + */ +FT_DECLARE(ftdm_status_t) ftdm_backtrace_span(ftdm_span_t *span); + +/** + * Convenience function to print a backtrace for a channel. + * \note The backtrace is generated with FTDM_LOG_DEBUG log level. + * \param[in] chan Channel object + * \retval + * FTDM_SUCCESS On success + * FTDM_NOTIMPL Backtraces are not available + * FTDM_EINVAL Invalid arguments (e.g. chan was NULL) + */ +FT_DECLARE(ftdm_status_t) ftdm_backtrace_chan(ftdm_channel_t *chan); + + FT_DECLARE_DATA extern ftdm_logger_t ftdm_log; /*! \brief Basic transcoding function prototype */ diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 6418baa3be..7cd8aacafb 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -104,10 +104,6 @@ #include #endif -#ifdef __linux__ -#include -#endif - #include #include #include From 7a12804577e87c6297b581532d7404f0ed450ec8 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 19:15:35 +0200 Subject: [PATCH 0660/1057] FreeTDM: Add trunk mode (NET/CPE) to span configuration in freetdm.conf and use it in ftmod_misdn and ftmod_libpri. Some I/O implementations (e.g. mISDN) need this information to correctly set up the port configuration. In FreeTDM, the mode of a span has been. up until now, a part of the signalling module configuration ("node" or "mode" for libpri and isdn spans), which is parsed _after_ the I/O part of a span has been initialized. This limitation currently prevents us from using mISDN in NT mode. To work around this problem (without adding a lot of new tunk_type values like "E1_NET" etc.), add a new "trunk_mode" parameter to the span categories in freetdm.conf, which by default is "CPE" for all trunk types, except "FXS" (which defaults to "NET"). ftmod_misdn uses trunk_type + trunk_mode to correctly choose the d-channel protocol for a port. ftmod_libpri uses trunk_mode as a hint for the default "mode" setting. (NOTE: It will print a warning if trunk_mode and signalling mode do not match.) All other modules currently ignore the value of trunk_mode. Example freetdm.conf snippet for a mISDN span in NET/NT mode (using a HFC-S USB dongle): [span misdn MBRI_1] trunk_type => BRI_PTMP trunk_mode => NET b-channel => HFC-S_USB.1:1-2 d-channel => HFC-S_USB.1:3 Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftdm_io.c | 42 +++++++++++++++---- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 22 ++++++++-- .../src/ftmod/ftmod_misdn/ftmod_misdn.c | 4 +- libs/freetdm/src/include/freetdm.h | 36 +++++++++++++++- libs/freetdm/src/include/private/ftdm_core.h | 1 + 5 files changed, 91 insertions(+), 14 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index ab015b98ff..4b49a9156c 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -262,9 +262,12 @@ FTDM_STR2ENUM(ftdm_str2ftdm_tonemap, ftdm_tonemap2str, ftdm_tonemap_t, TONEMAP_N FTDM_ENUM_NAMES(OOB_NAMES, OOB_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_oob_event, ftdm_oob_event2str, ftdm_oob_event_t, OOB_NAMES, FTDM_OOB_INVALID) -FTDM_ENUM_NAMES(TRUNK_TYPE_NAMES, TRUNK_STRINGS) +FTDM_ENUM_NAMES(TRUNK_TYPE_NAMES, TRUNK_TYPE_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t, TRUNK_TYPE_NAMES, FTDM_TRUNK_NONE) +FTDM_ENUM_NAMES(TRUNK_MODE_NAMES, TRUNK_MODE_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_trunk_mode, ftdm_trunk_mode2str, ftdm_trunk_mode_t, TRUNK_MODE_NAMES, FTDM_TRUNK_MODE_INVALID) + FTDM_ENUM_NAMES(START_TYPE_NAMES, START_TYPE_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_analog_start_type, ftdm_analog_start_type2str, ftdm_analog_start_type_t, START_TYPE_NAMES, FTDM_ANALOG_START_NA) @@ -816,6 +819,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_create(const char *iotype, const char *name, ftdm_copy_string(new_span->tone_map[FTDM_TONEMAP_BUSY], "%(500,500,480,620)", FTDM_TONEMAP_LEN); ftdm_copy_string(new_span->tone_map[FTDM_TONEMAP_ATTN], "%(100,100,1400,2060,2450,2600)", FTDM_TONEMAP_LEN); new_span->trunk_type = FTDM_TRUNK_NONE; + new_span->trunk_mode = FTDM_TRUNK_MODE_CPE; new_span->data_type = FTDM_TYPE_SPAN; ftdm_mutex_lock(globals.span_mutex); @@ -1994,6 +1998,21 @@ FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span) return ftdm_trunk_type2str(span->trunk_type); } +FT_DECLARE(void) ftdm_span_set_trunk_mode(ftdm_span_t *span, ftdm_trunk_mode_t mode) +{ + span->trunk_mode = mode; +} + +FT_DECLARE(ftdm_trunk_mode_t) ftdm_span_get_trunk_mode(const ftdm_span_t *span) +{ + return span->trunk_mode; +} + +FT_DECLARE(const char *) ftdm_span_get_trunk_mode_str(const ftdm_span_t *span) +{ + return ftdm_trunk_mode2str(span->trunk_mode); +} + FT_DECLARE(uint32_t) ftdm_span_get_id(const ftdm_span_t *span) { return span->span_id; @@ -4706,6 +4725,10 @@ static ftdm_status_t load_config(void) ftdm_trunk_type_t trtype = ftdm_str2ftdm_trunk_type(val); ftdm_span_set_trunk_type(span, trtype); ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s'\n", ftdm_trunk_type2str(trtype)); + } else if (!strcasecmp(var, "trunk_mode")) { + ftdm_trunk_mode_t trmode = ftdm_str2ftdm_trunk_mode(val); + ftdm_span_set_trunk_mode(span, trmode); + ftdm_log(FTDM_LOG_DEBUG, "setting trunk mode to '%s'\n", ftdm_trunk_mode2str(trmode)); } else if (!strcasecmp(var, "name")) { if (!strcasecmp(val, "undef")) { chan_config.name[0] = '\0'; @@ -4729,9 +4752,10 @@ static ftdm_status_t load_config(void) } } else if (!strcasecmp(var, "fxo-channel")) { if (span->trunk_type == FTDM_TRUNK_NONE) { - span->trunk_type = FTDM_TRUNK_FXO; - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s)\n", ftdm_trunk_type2str(span->trunk_type), - ftdm_analog_start_type2str(span->start_type)); + span->trunk_type = FTDM_TRUNK_FXO; + span->trunk_mode = FTDM_TRUNK_MODE_CPE; + ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s), mode(%s)\n", ftdm_trunk_type2str(span->trunk_type), + ftdm_analog_start_type2str(span->start_type), ftdm_trunk_mode2str(span->trunk_mode)); } if (span->trunk_type == FTDM_TRUNK_FXO) { unsigned chans_configured = 0; @@ -4745,8 +4769,9 @@ static ftdm_status_t load_config(void) } else if (!strcasecmp(var, "fxs-channel")) { if (span->trunk_type == FTDM_TRUNK_NONE) { span->trunk_type = FTDM_TRUNK_FXS; - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s)\n", ftdm_trunk_type2str(span->trunk_type), - ftdm_analog_start_type2str(span->start_type)); + span->trunk_mode = FTDM_TRUNK_MODE_NET; + ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s), mode(%s)\n", ftdm_trunk_type2str(span->trunk_type), + ftdm_analog_start_type2str(span->start_type), ftdm_trunk_mode2str(span->trunk_mode)); } if (span->trunk_type == FTDM_TRUNK_FXS) { unsigned chans_configured = 0; @@ -4760,8 +4785,9 @@ static ftdm_status_t load_config(void) } else if (!strcasecmp(var, "em-channel")) { if (span->trunk_type == FTDM_TRUNK_NONE) { span->trunk_type = FTDM_TRUNK_EM; - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s)\n", ftdm_trunk_type2str(span->trunk_type), - ftdm_analog_start_type2str(span->start_type)); + span->trunk_mode = FTDM_TRUNK_MODE_CPE; + ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s' start(%s), mode(%s)\n", ftdm_trunk_type2str(span->trunk_type), + ftdm_analog_start_type2str(span->start_type), ftdm_trunk_mode2str(span->trunk_mode)); } if (span->trunk_type == FTDM_TRUNK_EM) { unsigned chans_configured = 0; diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index ecd1cff1d3..471b870f34 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -2462,9 +2462,15 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) memset(isdn_data, 0, sizeof(*isdn_data)); /* set some default values */ - isdn_data->mode = PRI_CPE; isdn_data->ton = PRI_UNKNOWN; + /* Use span's trunk_mode as a reference for the default libpri mode */ + if (ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) { + isdn_data->mode = PRI_NETWORK; + } else { + isdn_data->mode = PRI_CPE; + } + switch (ftdm_span_get_trunk_type(span)) { case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: @@ -2516,8 +2522,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) if (!strcasecmp(var, "node") || !strcasecmp(var, "mode")) { if ((isdn_data->mode = parse_mode(val)) == -1) { - ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s', defaulting to CPE mode\n", val); - isdn_data->mode = PRI_CPE; + ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s'\n", val); + goto error; } } else if (!strcasecmp(var, "switch") || !strcasecmp(var, "dialect")) { @@ -2563,6 +2569,16 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) } } + /* Check if modes match and log a message if they do not. Just to be on the safe side. */ + if (isdn_data->mode == PRI_CPE && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) { + ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for TE/CPE/USER mode, while port is running in NT/NET mode. You may want to check your 'trunk_mode' settings.\n", + ftdm_span_get_name(span)); + } + else if (isdn_data->mode == PRI_NETWORK && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_CPE) { + ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for NT/NET mode, while port is running in TE/CPE/USER mode. You may want to check your 'trunk_mode' settings.\n", + ftdm_span_get_name(span)); + } + span->start = ftdm_libpri_start; span->stop = ftdm_libpri_stop; span->signal_cb = sig_cb; diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c index 60e3c1425d..c304a8b37b 100644 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c @@ -1432,12 +1432,12 @@ static ftdm_status_t misdn_open_range(ftdm_span_t *span, ftdm_chan_type_t type, switch (ftdm_span_get_trunk_type(span)) { case FTDM_TRUNK_E1: - d_protocol = ISDN_P_TE_E1; + d_protocol = ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET ? ISDN_P_NT_E1 : ISDN_P_TE_E1; d_channel = 16; break; case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: - d_protocol = ISDN_P_TE_S0; + d_protocol = ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET ? ISDN_P_NT_S0 : ISDN_P_TE_S0; d_channel = 0; break; default: diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index d984f5b1c8..809465c47a 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -484,11 +484,23 @@ typedef enum { FTDM_TRUNK_GSM, FTDM_TRUNK_NONE } ftdm_trunk_type_t; -#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "GSM", "NONE" +#define TRUNK_TYPE_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "GSM", "NONE" /*! \brief Move from string to ftdm_trunk_type_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t) +/*! \brief Span trunk modes */ +typedef enum { + FTDM_TRUNK_MODE_CPE, + FTDM_TRUNK_MODE_NET, + FTDM_TRUNK_MODE_INVALID +} ftdm_trunk_mode_t; +#define TRUNK_MODE_STRINGS "CPE", "NET", "INVALID" + +/*! \brief Move from string to ftdm_trunk_mode_t and viceversa */ +FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_mode, ftdm_trunk_mode2str, ftdm_trunk_mode_t) + + /*! \brief Basic channel configuration provided to ftdm_configure_span_channels */ typedef struct ftdm_channel_config { char name[FTDM_MAX_NAME_STR_SZ]; @@ -1744,6 +1756,28 @@ FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span); /*! \brief For display debugging purposes you can display this string which describes the trunk type of a span */ FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span); +/*! + * Set the trunk mode for a span + * \note This must be called before configuring any channels within the span! + * \param[in] span The span + * \param[in] type The trunk mode + */ +FT_DECLARE(void) ftdm_span_set_trunk_mode(ftdm_span_t *span, ftdm_trunk_mode_t mode); + +/*! + * Get the trunk mode for a span + * \param[in] span The span + * \return Span trunk mode + */ +FT_DECLARE(ftdm_trunk_mode_t) ftdm_span_get_trunk_mode(const ftdm_span_t *span); + +/*! + * Get the trunk mode of a span in textual form + * \param[in] span The span + * \return Span mode name as a string + */ +FT_DECLARE(const char *) ftdm_span_get_trunk_mode_str(const ftdm_span_t *span); + /*! * \brief Return the channel identified by the provided id * diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 7cd8aacafb..fa1bd233cd 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -485,6 +485,7 @@ struct ftdm_span { fio_event_cb_t event_callback; ftdm_mutex_t *mutex; ftdm_trunk_type_t trunk_type; + ftdm_trunk_mode_t trunk_mode; ftdm_analog_start_type_t start_type; ftdm_signal_type_t signal_type; uint32_t last_used_index; From fbfa31d2d14750cc342cf981b8999c0f495afc24 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Wed, 11 Jul 2012 11:10:24 -0700 Subject: [PATCH 0661/1057] Add dump_events.pl script --- libs/esl/perl/dump_events.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 libs/esl/perl/dump_events.pl diff --git a/libs/esl/perl/dump_events.pl b/libs/esl/perl/dump_events.pl new file mode 100755 index 0000000000..7ed018e7fa --- /dev/null +++ b/libs/esl/perl/dump_events.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl +require ESL; + +my $command = shift; +my $args = join(" ", @ARGV); + +my $con = new ESL::ESLconnection("localhost", "8021", "ClueCon"); +$con->events("plain","all"); +while ( $con->connected() ) { + my $e = $con->recvEventTimed(0); + print $e->serialize; +} From ab285ace3d2ce152b7c67d116b3e039541cea84a Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 20:24:35 +0200 Subject: [PATCH 0662/1057] FreeTDM: Improve error checking and logging in load_config(), add FTDM_SPAN_IS_DIGITAL() helper. Output the current trunk_type in "add X-channel vs. trunk_type" error messages and check this for B-/D-channels too. ISDN (= digital) spans need to have a trunk_type set before adding channels, bail out early with an error message (actually two) if this is not the case. (Adding channels should really be moved out of the parsing loop, to catch certain types of errors easier.) Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftdm_io.c | 36 +++++++++++++++++++++--------- libs/freetdm/src/include/freetdm.h | 9 ++++++++ 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 4b49a9156c..b99c2b164b 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4764,7 +4764,7 @@ static ftdm_status_t load_config(void) configured += chans_configured; } } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add FXO channels to an FXS trunk!\n"); + ftdm_log(FTDM_LOG_WARNING, "Cannot add FXO channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); } } else if (!strcasecmp(var, "fxs-channel")) { if (span->trunk_type == FTDM_TRUNK_NONE) { @@ -4780,7 +4780,7 @@ static ftdm_status_t load_config(void) configured += chans_configured; } } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add FXS channels to an FXO trunk!\n"); + ftdm_log(FTDM_LOG_WARNING, "Cannot add FXS channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); } } else if (!strcasecmp(var, "em-channel")) { if (span->trunk_type == FTDM_TRUNK_NONE) { @@ -4796,19 +4796,33 @@ static ftdm_status_t load_config(void) configured += chans_configured; } } else { - ftdm_log(FTDM_LOG_WARNING, "Cannot add EM channels to a non-EM trunk!\n"); + ftdm_log(FTDM_LOG_WARNING, "Cannot add EM channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); } } else if (!strcasecmp(var, "b-channel")) { - unsigned chans_configured = 0; - chan_config.type = FTDM_CHAN_TYPE_B; - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { - configured += chans_configured; + if (span->trunk_type == FTDM_TRUNK_NONE) { + ftdm_log(FTDM_LOG_ERROR, "No trunk type specified in configuration file\n"); + break; + } + if (FTDM_SPAN_IS_DIGITAL(span)) { + unsigned chans_configured = 0; + chan_config.type = FTDM_CHAN_TYPE_B; + if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { + configured += chans_configured; + } + } else { + ftdm_log(FTDM_LOG_WARNING, "Cannot add B channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); } } else if (!strcasecmp(var, "d-channel")) { - if (d) { - ftdm_log(FTDM_LOG_WARNING, "ignoring extra d-channel\n"); - } else { + if (span->trunk_type == FTDM_TRUNK_NONE) { + ftdm_log(FTDM_LOG_ERROR, "No trunk type specified in configuration file\n"); + break; + } + if (FTDM_SPAN_IS_DIGITAL(span)) { unsigned chans_configured = 0; + if (d) { + ftdm_log(FTDM_LOG_WARNING, "ignoring extra d-channel\n"); + continue; + } if (!strncasecmp(val, "lapd:", 5)) { chan_config.type = FTDM_CHAN_TYPE_DQ931; val += 5; @@ -4819,6 +4833,8 @@ static ftdm_status_t load_config(void) configured += chans_configured; } d++; + } else { + ftdm_log(FTDM_LOG_WARNING, "Cannot add D channels to a %s trunk!\n", ftdm_trunk_type2str(span->trunk_type)); } } else if (!strcasecmp(var, "cas-channel")) { unsigned chans_configured = 0; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 809465c47a..6ce9879b91 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -204,6 +204,15 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t) (fchan)->span->trunk_type == FTDM_TRUNK_BRI || \ (fchan)->span->trunk_type == FTDM_TRUNK_BRI_PTMP) +/*! \brief Test if a span is digital */ +#define FTDM_SPAN_IS_DIGITAL(span) \ + ((span)->trunk_type == FTDM_TRUNK_E1 || \ + (span)->trunk_type == FTDM_TRUNK_T1 || \ + (span)->trunk_type == FTDM_TRUNK_J1 || \ + (span)->trunk_type == FTDM_TRUNK_BRI || \ + (span)->trunk_type == FTDM_TRUNK_BRI_PTMP) + + /*! \brief Logging function prototype to be used for all FreeTDM logs * you should use ftdm_global_set_logger to set your own logger */ From fdf86c0c5130f067335f000f9deea0e3e2448e24 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 20:40:59 +0200 Subject: [PATCH 0663/1057] FreeTDM: Make cfg_name[] const in load_config(). Signed-off-by: Stefan Knoblich --- 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 b99c2b164b..221b6afc59 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4646,7 +4646,7 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const static ftdm_status_t load_config(void) { - char cfg_name[] = "freetdm.conf"; + const char const cfg_name[] = "freetdm.conf"; ftdm_config_t cfg; char *var, *val; int catno = -1; From 90cdc718ec2b0b7bd9b8420a2d86670fc36d365b Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 20:41:55 +0200 Subject: [PATCH 0664/1057] FreeTDM: Whitespace fixes for load_config(). Get rid of those annoying green trailing whitespace and empty lines with whitespace. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftdm_io.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 221b6afc59..e326618ee4 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4664,7 +4664,9 @@ static ftdm_status_t load_config(void) if (!ftdm_config_open_file(&cfg, cfg_name)) { return FTDM_FAIL; } - ftdm_log(FTDM_LOG_DEBUG, "Reading FreeTDM configuration file\n"); + + ftdm_log(FTDM_LOG_DEBUG, "Reading FreeTDM configuration file\n"); + while (ftdm_config_next_pair(&cfg, &var, &val)) { if (*cfg.category == '#') { if (cfg.catno != catno) { @@ -4675,14 +4677,14 @@ static ftdm_status_t load_config(void) if (cfg.catno != catno) { char *type = cfg.category + 4; char *name; - + if (*type == ' ') { type++; } - + ftdm_log(FTDM_LOG_DEBUG, "found config for span\n"); catno = cfg.catno; - + if (ftdm_strlen_zero(type)) { ftdm_log(FTDM_LOG_CRIT, "failure creating span, no type specified.\n"); span = NULL; @@ -4720,11 +4722,11 @@ static ftdm_status_t load_config(void) } ftdm_log(FTDM_LOG_DEBUG, "span %d [%s]=[%s]\n", span->span_id, var, val); - + if (!strcasecmp(var, "trunk_type")) { ftdm_trunk_type_t trtype = ftdm_str2ftdm_trunk_type(val); ftdm_span_set_trunk_type(span, trtype); - ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s'\n", ftdm_trunk_type2str(trtype)); + ftdm_log(FTDM_LOG_DEBUG, "setting trunk type to '%s'\n", ftdm_trunk_type2str(trtype)); } else if (!strcasecmp(var, "trunk_mode")) { ftdm_trunk_mode_t trmode = ftdm_str2ftdm_trunk_mode(val); ftdm_span_set_trunk_mode(span, trmode); @@ -4745,7 +4747,7 @@ static ftdm_status_t load_config(void) if (span->trunk_type == FTDM_TRUNK_FXS || span->trunk_type == FTDM_TRUNK_FXO || span->trunk_type == FTDM_TRUNK_EM) { if ((tmp = ftdm_str2ftdm_analog_start_type(val)) != FTDM_ANALOG_START_NA) { span->start_type = tmp; - ftdm_log(FTDM_LOG_DEBUG, "changing start type to '%s'\n", ftdm_analog_start_type2str(span->start_type)); + ftdm_log(FTDM_LOG_DEBUG, "changing start type to '%s'\n", ftdm_analog_start_type2str(span->start_type)); } } else { ftdm_log(FTDM_LOG_ERROR, "This option is only valid on analog trunks!\n"); @@ -4839,7 +4841,6 @@ static ftdm_status_t load_config(void) } else if (!strcasecmp(var, "cas-channel")) { unsigned chans_configured = 0; chan_config.type = FTDM_CHAN_TYPE_CAS; - if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) { configured += chans_configured; } @@ -4961,7 +4962,7 @@ done: if (!configured) { ret = FTDM_FAIL; } - + return ret; } From 2aebe2456f8cc4a58e948cf6ac91df9f9f8af192 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 15:15:43 -0500 Subject: [PATCH 0665/1057] first pass on some new stuff --- libs/esl/src/esl_event.c | 4 + libs/esl/src/include/esl_event.h | 4 + .../libsofia-sip-ua/nua/nua_notifier.c | 10 +- src/include/switch_types.h | 5 + .../mod_conference/mod_conference.c | 521 ++++++++++++++++-- .../applications/mod_dptools/mod_dptools.c | 12 + src/mod/endpoints/mod_sofia/mod_sofia.c | 48 +- src/mod/endpoints/mod_sofia/mod_sofia.h | 7 - src/mod/endpoints/mod_sofia/sofia.c | 86 ++- src/mod/endpoints/mod_sofia/sofia_presence.c | 134 ++++- src/switch_event.c | 4 + src/switch_rtp.c | 2 +- 12 files changed, 740 insertions(+), 97 deletions(-) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 6ebd6669b6..7a0da29db3 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -138,6 +138,10 @@ static const char *EVENT_NAMES[] = { "SOCKET_DATA", "MEDIA_BUG_START", "MEDIA_BUG_START", + "CONFERENCE_DATA_QUERY", + "CALL_SETUP_REQ", + "CALL_SETUP_RESULT", + "CONFERENCE_DATA", "ALL" }; diff --git a/libs/esl/src/include/esl_event.h b/libs/esl/src/include/esl_event.h index b7dea736c9..1b6e6e29b4 100644 --- a/libs/esl/src/include/esl_event.h +++ b/libs/esl/src/include/esl_event.h @@ -128,6 +128,10 @@ typedef enum { ESL_EVENT_SOCKET_DATA, ESL_EVENT_MEDIA_BUG_START, ESL_EVENT_MEDIA_BUG_STOP, + ESL_EVENT_CONFERENCE_DATA_QUERY, + ESL_EVENT_CONFERENCE_DATA, + ESL_EVENT_CALL_SETUP_REQ, + ESL_EVENT_CALL_SETUP_RESULT, ESL_EVENT_ALL } esl_event_types_t; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c index e7d3d7470f..8ef6747aff 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c @@ -1000,13 +1000,14 @@ int nua_refer_server_respond(nua_server_request_t *sr, tagi_t const *tags) static int nua_refer_server_report(nua_server_request_t *sr, tagi_t const *tags) { - nua_handle_t *nh = sr->sr_owner; + //nua_handle_t *nh = sr->sr_owner; struct notifier_usage *nu = nua_dialog_usage_private(sr->sr_usage); sip_t const *sip = sr->sr_request.sip; sip_referred_by_t *by = sip->sip_referred_by, default_by[1]; sip_event_t const *o = sr->sr_usage->du_event; enum nua_substate substate = nua_substate_terminated; - int initial = sr->sr_initial, retval; + //int initial = sr->sr_initial, retval; + int retval; if (nu) { if (!sr->sr_terminating) @@ -1029,13 +1030,14 @@ int nua_refer_server_report(nua_server_request_t *sr, tagi_t const *tags) if (retval >= 2 || nu == NULL) return retval; +#if 0 if (initial) nua_stack_post_signal(nh, nua_r_notify, SIPTAG_EVENT(o), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR("SIP/2.0 100 Trying\r\n"), - TAG_END()); - + TAG_END()); +#endif return retval; } diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 08b6c61954..6dc6118fe9 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1233,6 +1233,7 @@ typedef enum { CF_PICKUP, CF_CONFIRM_BLIND_TRANSFER, CF_NO_PRESENCE, + CF_CONFERENCE, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX @@ -1654,6 +1655,10 @@ typedef enum { SWITCH_EVENT_SOCKET_DATA, SWITCH_EVENT_MEDIA_BUG_START, SWITCH_EVENT_MEDIA_BUG_STOP, + SWITCH_EVENT_CONFERENCE_DATA_QUERY, + SWITCH_EVENT_CONFERENCE_DATA, + SWITCH_EVENT_CALL_SETUP_REQ, + SWITCH_EVENT_CALL_SETUP_RESULT, SWITCH_EVENT_ALL } switch_event_types_t; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 68acd3ad70..151084e44a 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -43,30 +43,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_conference_shutdown); SWITCH_MODULE_DEFINITION(mod_conference, mod_conference_load, mod_conference_shutdown, NULL); -typedef struct conference_cdr_node_s { - switch_caller_profile_t *cp; - char *record_path; - switch_time_t join_time; - switch_time_t leave_time; - uint32_t flags; - struct conference_cdr_node_s *next; -} conference_cdr_node_t; - -typedef enum { - CDRR_LOCKED = 1, - CDRR_PIN, - CDRR_MAXMEMBERS -} cdr_reject_reason_t; - -typedef struct conference_cdr_reject_s { - switch_caller_profile_t *cp; - switch_time_t reject_time; - cdr_reject_reason_t reason; - struct conference_cdr_reject_s *next; -} conference_cdr_reject_t; - - - typedef enum { CONF_SILENT_REQ = (1 << 0), CONF_SILENT_DONE = (1 << 1) @@ -121,13 +97,40 @@ static struct { uint32_t id_pool; int32_t running; uint32_t threads; - switch_event_node_t *node; } globals; /* forward declaration for conference_obj and caller_control */ struct conference_member; typedef struct conference_member conference_member_t; + +typedef struct conference_cdr_node_s { + switch_caller_profile_t *cp; + char *record_path; + switch_time_t join_time; + switch_time_t leave_time; + uint32_t flags; + uint32_t id; + conference_member_t *member; + struct conference_cdr_node_s *next; +} conference_cdr_node_t; + +typedef enum { + CDRR_LOCKED = 1, + CDRR_PIN, + CDRR_MAXMEMBERS +} cdr_reject_reason_t; + +typedef struct conference_cdr_reject_s { + switch_caller_profile_t *cp; + switch_time_t reject_time; + cdr_reject_reason_t reason; + struct conference_cdr_reject_s *next; +} conference_cdr_reject_t; + + + + struct call_list { char *string; int iteration; @@ -190,7 +193,8 @@ typedef enum { CFLAG_ENTER_SOUND = (1 << 13), CFLAG_VIDEO_BRIDGE = (1 << 14), CFLAG_AUDIO_ALWAYS = (1 << 15), - CFLAG_ENDCONF_FORCED = (1 << 16) + CFLAG_ENDCONF_FORCED = (1 << 16), + CFLAG_RFC4579 = (1 << 17) } conf_flag_t; typedef enum { @@ -263,6 +267,7 @@ struct vid_helper { /* Conference Object */ typedef struct conference_obj { char *name; + char *desc; char *timer_name; char *tts_engine; char *tts_voice; @@ -288,6 +293,7 @@ typedef struct conference_obj { char *record_filename; uint32_t terminate_on_silence; uint32_t max_members; + uint32_t doc_version; char *maxmember_sound; uint32_t announce_count; char *pin; @@ -476,11 +482,11 @@ static switch_status_t conference_outcall(conference_obj_t *conference, char *cid_num, char *profile, switch_call_cause_t *cause, - switch_call_cause_t *cancel_cause); + switch_call_cause_t *cancel_cause, switch_event_t *var_event); static switch_status_t conference_outcall_bg(conference_obj_t *conference, char *conference_name, switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, - const char *cid_num, const char *call_uuid, const char *profile, switch_call_cause_t *cancel_cause); + const char *cid_num, const char *call_uuid, const char *profile, switch_call_cause_t *cancel_cause, switch_event_t **var_event); SWITCH_STANDARD_APP(conference_function); static void launch_conference_thread(conference_obj_t *conference); static void launch_conference_video_thread(conference_obj_t *conference); @@ -522,6 +528,7 @@ static void conference_cdr_del(conference_member_t *member) { member->cdr_node->leave_time = switch_epoch_time_now(NULL); member->cdr_node->flags = member->flags; + member->cdr_node->member = NULL; } static void conference_cdr_add(conference_member_t *member) @@ -535,6 +542,7 @@ static void conference_cdr_add(conference_member_t *member) np->next = member->conference->cdr_nodes; member->conference->cdr_nodes = member->cdr_node = np; member->cdr_node->join_time = switch_epoch_time_now(NULL); + member->cdr_node->member = member; if (!member->session) { member->cdr_node->record_path = switch_core_strdup(member->conference->pool, member->rec_path); @@ -548,6 +556,11 @@ static void conference_cdr_add(conference_member_t *member) } member->cdr_node->cp = switch_caller_profile_dup(member->conference->pool, cp); + + member->cdr_node->id = member->id; + + + } static void conference_cdr_rejected(conference_obj_t *conference, switch_channel_t *channel, cdr_reject_reason_t reason) @@ -569,6 +582,246 @@ static void conference_cdr_rejected(conference_obj_t *conference, switch_channel rp->cp = switch_caller_profile_dup(conference->pool, cp); } +static char *conference_rfc4579_render(conference_obj_t *conference, switch_event_t *event) +{ + switch_xml_t xml, x_tag, x_tag1, x_tag2, x_tag3, x_tag4; + char tmp[30]; + const char *domain; const char *name; + char *dup_domain = NULL; + char *uri; + int off = 0, off1 = 0, off2 = 0, off3 = 0, off4 = 0; + conference_cdr_node_t *np; + char *tmpp = tmp; + char *xml_text = NULL; + + if (!(xml = switch_xml_new("conference-info"))) { + abort(); + } + + switch_mutex_lock(conference->mutex); + switch_snprintf(tmp, sizeof(tmp), "%u", conference->doc_version); + conference->doc_version++; + switch_mutex_unlock(conference->mutex); + + if (!event || !(name = switch_event_get_header(event, "conference-name"))) { + if (!(name = conference->name)) { + name = "conference"; + } + } + + if (!event || !(domain = switch_event_get_header(event, "conference-domain"))) { + if (!(domain = conference->domain)) { + dup_domain = switch_core_get_variable_dup("domain"); + if (!(domain = dup_domain)) { + domain = "cluecon.com"; + } + } + } + + switch_xml_set_attr_d(xml, "version", tmpp); + + switch_xml_set_attr_d(xml, "state", "full"); + switch_xml_set_attr_d(xml, "xmlns", "urn:ietf:params:xml:ns:conference-info"); + + + uri = switch_mprintf("sip:%s@%s", name, domain); + switch_xml_set_attr_d(xml, "entity", uri); + + if (!(x_tag = switch_xml_add_child_d(xml, "conference-description", off++))) { + abort(); + } + + if (!(x_tag1 = switch_xml_add_child_d(x_tag, "display-text", off1++))) { + abort(); + } + switch_xml_set_txt_d(x_tag1, conference->desc ? conference->desc : "FreeSWITCH Conference"); + + + if (!(x_tag1 = switch_xml_add_child_d(x_tag, "conf-uris", off1++))) { + abort(); + } + + if (!(x_tag2 = switch_xml_add_child_d(x_tag1, "entry", off2++))) { + abort(); + } + + if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "uri", off3++))) { + abort(); + } + switch_xml_set_txt_d(x_tag3, uri); + + + + if (!(x_tag = switch_xml_add_child_d(xml, "conference-state", off++))) { + abort(); + } + if (!(x_tag1 = switch_xml_add_child_d(x_tag, "user-count", off1++))) { + abort(); + } + switch_snprintf(tmp, sizeof(tmp), "%u", conference->count); + switch_xml_set_txt_d(x_tag1, tmpp); + + if (!(x_tag1 = switch_xml_add_child_d(x_tag, "active", off1++))) { + abort(); + } + switch_xml_set_txt_d(x_tag1, "true"); + + off1 = off2 = off3 = off4 = 0; + + if (!(x_tag = switch_xml_add_child_d(xml, "users", off++))) { + abort(); + } + + switch_mutex_lock(conference->member_mutex); + + for (np = conference->cdr_nodes; np; np = np->next) { + char *user_uri; + + if (!np->cp || (np->member && !np->member->session) || np->leave_time) { /* for now we'll remove participants when the leave */ + continue; + } + + if (!(x_tag1 = switch_xml_add_child_d(x_tag, "user", off1++))) { + abort(); + } + + user_uri = switch_mprintf("sip:%s@%s", np->cp->caller_id_number, domain); + + + switch_xml_set_attr_d(x_tag1, "state", "full"); + switch_xml_set_attr_d(x_tag1, "entity", user_uri); + + if (!(x_tag2 = switch_xml_add_child_d(x_tag1, "display-text", off2++))) { + abort(); + } + switch_xml_set_txt_d(x_tag2, np->cp->caller_id_name); + + + if (!(x_tag2 = switch_xml_add_child_d(x_tag1, "endpoint", off2++))) { + abort(); + } + switch_xml_set_attr_d(x_tag2, "entity", user_uri); + + + if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "display-text", off3++))) { + abort(); + } + switch_xml_set_txt_d(x_tag3, np->cp->caller_id_name); + + + if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "status", off3++))) { + abort(); + } + switch_xml_set_txt_d(x_tag3, np->leave_time ? "disconnected" : "connected"); + + + if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "joining-info", off3++))) { + abort(); + } + if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "when", off4++))) { + abort(); + } else { + switch_time_exp_t tm; + switch_size_t retsize; + const char *fmt = "%Y-%m-%dT%H:%M:%S%z"; + char *p; + + switch_time_exp_lt(&tm, (switch_time_t) conference->start_time * 1000000); + switch_strftime_nocheck(tmp, &retsize, sizeof(tmp), fmt, &tm); + p = end_of_p(tmpp) -1; + snprintf(p, 4, ":00"); + + + switch_xml_set_txt_d(x_tag4, tmpp); + } + + + + + /** ok so this is in the rfc but not the xsd + if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "joining-method", off3++))) { + abort(); + } + switch_xml_set_txt_d(x_tag3, np->cp->direction == SWITCH_CALL_DIRECTION_INBOUND ? "dialed-in" : "dialed-out"); + */ + + if (np->member) { + switch_channel_t *channel = switch_core_session_get_channel(np->member->session); + const char *var; + + if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "media", off3++))) { + abort(); + } + + snprintf(tmp, sizeof(tmp), "%ua", np->member->id); + switch_xml_set_attr_d(x_tag3, "id", tmpp); + + + if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "type", off4++))) { + abort(); + } + switch_xml_set_txt_d(x_tag4, "audio"); + + if ((var = switch_channel_get_variable(channel, "rtp_use_ssrc"))) { + if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "src-id", off4++))) { + abort(); + } + switch_xml_set_txt_d(x_tag4, var); + } + + if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "status", off4++))) { + abort(); + } + switch_xml_set_txt_d(x_tag4, switch_channel_test_flag(channel, CF_HOLD) ? "sendonly" : "sendrecv"); + + + if (switch_channel_test_flag(channel, CF_VIDEO)) { + off4 = 0; + + if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "media", off3++))) { + abort(); + } + + snprintf(tmp, sizeof(tmp), "%uv", np->member->id); + switch_xml_set_attr_d(x_tag3, "id", tmpp); + + + if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "type", off4++))) { + abort(); + } + switch_xml_set_txt_d(x_tag4, "video"); + + if ((var = switch_channel_get_variable(channel, "rtp_use_video_ssrc"))) { + if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "src-id", off4++))) { + abort(); + } + switch_xml_set_txt_d(x_tag4, var); + } + + if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "status", off4++))) { + abort(); + } + switch_xml_set_txt_d(x_tag4, switch_channel_test_flag(channel, CF_HOLD) ? "sendonly" : "sendrecv"); + + } + } + + switch_safe_free(user_uri); + } + + switch_mutex_unlock(conference->member_mutex); + + off1 = off2 = off3 = off4 = 0; + + xml_text = switch_xml_toxml(xml, SWITCH_TRUE); + switch_xml_free(xml); + + switch_safe_free(dup_domain); + switch_safe_free(uri); + + return xml_text; +} + static void conference_cdr_render(conference_obj_t *conference) { switch_xml_t cdr, x_ptr, x_member, x_members, x_conference, x_cp, x_flags, x_tag, x_rejected, x_attempt; @@ -966,6 +1219,45 @@ static switch_status_t member_del_relationship(conference_member_t *member, uint return status; } +static void send_rfc_event(conference_obj_t *conference) +{ + switch_event_t *event; + char *body; + char *name = NULL, *domain = NULL, *dup_domain = NULL; + + if (!switch_test_flag(conference, CFLAG_RFC4579)) { + return; + } + + if (!(name = conference->name)) { + name = "conference"; + } + + if (!(domain = conference->domain)) { + dup_domain = switch_core_get_variable_dup("domain"); + if (!(domain = dup_domain)) { + domain = "cluecon.com"; + } + } + + + if (switch_event_create(&event, SWITCH_EVENT_CONFERENCE_DATA) == SWITCH_STATUS_SUCCESS) { + event->flags |= EF_UNIQ_HEADERS; + + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "conference-name", name); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "conference-domain", domain); + + body = conference_rfc4579_render(conference, NULL); + switch_event_add_body(event, body); + free(body); + switch_event_fire(&event); + } + + switch_safe_free(dup_domain); + +} + + /* Gain exclusive access and add the member to the list */ static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member) { @@ -1109,9 +1401,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_mutex_unlock(member->audio_out_mutex); switch_mutex_unlock(member->audio_in_mutex); + send_rfc_event(conference); + switch_mutex_unlock(conference->mutex); status = SWITCH_STATUS_SUCCESS; + + + return status; } @@ -1248,6 +1545,11 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe unlock_member(member); switch_mutex_unlock(member->audio_out_mutex); switch_mutex_unlock(member->audio_in_mutex); + + + send_rfc_event(conference); + + switch_mutex_unlock(conference->mutex); status = SWITCH_STATUS_SUCCESS; @@ -3089,7 +3391,7 @@ static void conference_loop_output(conference_member_t *member) 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); + profile, &member->conference->cancel_cause, NULL); switch_safe_free(dial_str); } switch_safe_free(cpstr); @@ -5229,9 +5531,9 @@ static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_st } if (conference) { - conference_outcall(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], NULL, &cause, NULL); + conference_outcall(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], NULL, &cause, NULL, NULL); } else { - conference_outcall(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], NULL, &cause, NULL); + conference_outcall(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], NULL, &cause, NULL, NULL); } stream->write_function(stream, "Call Requested: result: [%s]\n", switch_channel_cause2str(cause)); @@ -5254,9 +5556,9 @@ static switch_status_t conf_api_sub_bgdial(conference_obj_t *conference, switch_ switch_uuid_format(uuid_str, &uuid); if (conference) { - conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL, NULL); + conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL, NULL, NULL); } else { - conference_outcall_bg(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL, NULL); + conference_outcall_bg(NULL, argv[0], NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str, NULL, NULL, NULL); } stream->write_function(stream, "OK Job-UUID: %s\n", uuid_str); @@ -5777,7 +6079,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference, char *cid_num, char *profile, switch_call_cause_t *cause, - switch_call_cause_t *cancel_cause) + switch_call_cause_t *cancel_cause, switch_event_t *var_event) { switch_core_session_t *peer_session = NULL; switch_channel_t *peer_channel; @@ -5792,7 +6094,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference, if (conference == NULL) { char *dialstr = switch_mprintf("{ignore_early_media=true}%s", bridgeto); - status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, NULL); + status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, var_event, SOF_NO_LIMITS, NULL); switch_safe_free(dialstr); if (status != SWITCH_STATUS_SUCCESS) { @@ -5828,7 +6130,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference, switch_mutex_lock(conference->mutex); conference->originating++; switch_mutex_unlock(conference->mutex); - status = switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, cancel_cause); + status = switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, var_event, SOF_NO_LIMITS, cancel_cause); switch_mutex_lock(conference->mutex); conference->originating--; switch_mutex_unlock(conference->mutex); @@ -5920,6 +6222,7 @@ struct bg_call { char *uuid; char *profile; switch_call_cause_t *cancel_cause; + switch_event_t *var_event; switch_memory_pool_t *pool; }; @@ -5931,8 +6234,10 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, switch_call_cause_t cause; switch_event_t *event; + conference_outcall(call->conference, call->conference_name, - call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, call->profile, &cause, call->cancel_cause); + call->session, call->bridgeto, call->timeout, + call->flags, call->cid_name, call->cid_num, call->profile, &cause, call->cancel_cause, call->var_event); if (call->conference && test_eflag(call->conference, EFLAG_BGDIAL_RESULT) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { @@ -5942,6 +6247,11 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-UUID", call->uuid); switch_event_fire(&event); } + + if (call->var_event) { + switch_event_destroy(&call->var_event); + } + switch_safe_free(call->bridgeto); switch_safe_free(call->flags); switch_safe_free(call->cid_name); @@ -5961,7 +6271,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, static switch_status_t conference_outcall_bg(conference_obj_t *conference, char *conference_name, switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, - const char *cid_num, const char *call_uuid, const char *profile, switch_call_cause_t *cancel_cause) + const char *cid_num, const char *call_uuid, const char *profile, switch_call_cause_t *cancel_cause, switch_event_t **var_event) { struct bg_call *call = NULL; switch_thread_t *thread; @@ -5977,6 +6287,11 @@ static switch_status_t conference_outcall_bg(conference_obj_t *conference, call->timeout = timeout; call->cancel_cause = cancel_cause; + if (var_event) { + call->var_event = *var_event; + var_event = NULL; + } + if (conference) { pool = conference->pool; } else { @@ -6152,7 +6467,11 @@ static void set_cflags(const char *flags, uint32_t *f) *f |= CFLAG_VIDEO_BRIDGE; } else if (!strcasecmp(argv[i], "audio-always")) { *f |= CFLAG_AUDIO_ALWAYS; + } else if (!strcasecmp(argv[i], "rfc-4579")) { + *f |= CFLAG_RFC4579; } + + } free(dup); @@ -6403,30 +6722,34 @@ SWITCH_STANDARD_APP(conference_function) switch_channel_set_app_flag_key("conf_silent", channel, CONF_SILENT_REQ); } + switch_channel_set_flag(channel, CF_CONFERENCE); + if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n"); - return; + goto end; } /* Save the original read codec. */ if (!(read_codec = switch_core_session_get_read_codec(session))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel has no media!\n"); - return; + goto end; } if (zstr(data)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Invalid arguments\n"); - return; + goto end; } mydata = switch_core_session_strdup(session, data); if (!mydata) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Pool Failure\n"); - return; + goto end; } + + if ((flags_str = strstr(mydata, flags_prefix))) { char *p; *((char *) flags_str) = '\0'; @@ -6764,7 +7087,7 @@ SWITCH_STANDARD_APP(conference_function) /* if we're using "bridge:" make an outbound call and bridge it in */ if (!zstr(bridgeto) && strcasecmp(bridgeto, "none")) { switch_call_cause_t cause; - if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, NULL, &cause, NULL) != SWITCH_STATUS_SUCCESS) { + if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, NULL, &cause, NULL, NULL) != SWITCH_STATUS_SUCCESS) { goto done; } } else { @@ -6913,6 +7236,11 @@ SWITCH_STANDARD_APP(conference_function) } switch_channel_set_variable(channel, "last_transfered_conference", NULL); + + end: + + switch_channel_clear_flag(channel, CF_CONFERENCE); + } /* Create a thread for the conference and launch it */ @@ -7123,6 +7451,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c switch_xml_t xml_kvp; char *timer_name = NULL; char *domain = NULL; + char *desc = NULL; char *name_domain = NULL; char *tts_engine = NULL; char *tts_voice = NULL; @@ -7246,6 +7575,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c } } else if (!strcasecmp(var, "domain") && !zstr(val)) { domain = val; + } else if (!strcasecmp(var, "description") && !zstr(val)) { + desc = val; } else if (!force_interval_i && !strcasecmp(var, "interval") && !zstr(val)) { uint32_t tmp = atoi(val); @@ -7606,6 +7937,11 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c if (!zstr(auto_record)) { conference->auto_record = switch_core_strdup(conference->pool, auto_record); } + + if (!zstr(desc)) { + conference->desc = switch_core_strdup(conference->pool, desc); + } + if (!zstr(terminate_on_silence)) { conference->terminate_on_silence = atoi(terminate_on_silence); } @@ -7681,6 +8017,89 @@ static void conference_send_presence(conference_obj_t *conference) } +static void call_setup_event_handler(switch_event_t *event) +{ + char *conf; + char *dial_str; + char *action; + conference_obj_t *conference = NULL; + + if (!switch_test_flag(conference, CFLAG_RFC4579)) { + return; + } + + conf = switch_event_get_header(event, "Target-Component"); + dial_str = switch_event_get_header(event, "Request-Target"); + action = switch_event_get_header(event, "Request-Action"); + + + if (!zstr(conf) && !zstr(dial_str) && !zstr(action) && (conference = conference_find(conf))) { + switch_event_t *var_event; + switch_event_header_t *hp; + + if (!strcasecmp(action, "call")) { + + if (switch_event_create_plain(&var_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) { + abort(); + } + + for(hp = event->headers; hp; hp = hp->next) { + if (!strncasecmp(hp->name, "var_", 4)) { + switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, hp->name + 4, hp->value); + } + } + + switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, "conference_dial_str", dial_str); + + conference_outcall_bg(conference, NULL, NULL, dial_str, 60, NULL, NULL, NULL, NULL, NULL, NULL, &var_event); + + } else if (!strcasecmp(action, "end")) { + switch_core_session_hupall_matching_var("conference_dial_str", dial_str, SWITCH_CAUSE_NORMAL_CLEARING); + } + + switch_thread_rwlock_unlock(conference->rwlock); + } + +} + +static void conf_data_event_handler(switch_event_t *event) +{ + switch_event_t *revent; + char *name = switch_event_get_header(event, "conference-name"); + conference_obj_t *conference = NULL; + char *body = NULL; + + switch_event_dup(&revent, event); + revent->event_id = SWITCH_EVENT_CONFERENCE_DATA; + revent->flags |= EF_UNIQ_HEADERS; + switch_event_add_header(revent, SWITCH_STACK_TOP, "Event-Name", "CONFERENCE_DATA"); + + if (!zstr(name) && (conference = conference_find(name))) { + if (switch_test_flag(conference, CFLAG_RFC4579)) { + body = conference_rfc4579_render(conference, event); + } + switch_thread_rwlock_unlock(conference->rwlock); + + } + + if (!body) { + char *domain = switch_event_get_header(event, "conference-domain"); + + if (zstr(domain)) { + domain = "cluecon.com"; + } + + body = switch_mprintf("\n", name, domain); + switch_event_add_header(revent, SWITCH_STACK_BOTTOM, "notfound", "true"); + } + + switch_event_add_body(revent, body); + + switch_event_fire(&revent); + switch_safe_free(body); +} + static void pres_event_handler(switch_event_t *event) { @@ -7997,10 +8416,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load) switch_mutex_init(&globals.setup_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool); /* Subscribe to presence request events */ - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.node) != - SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n"); - return SWITCH_STATUS_GENERR; + } + + if (switch_event_bind(modname, SWITCH_EVENT_CONFERENCE_DATA_QUERY, SWITCH_EVENT_SUBCLASS_ANY, conf_data_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to conference data query events!\n"); + } + + if (switch_event_bind(modname, SWITCH_EVENT_CALL_SETUP_REQ, SWITCH_EVENT_SUBCLASS_ANY, call_setup_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to conference data query events!\n"); } SWITCH_ADD_API(api_interface, "conference", "Conference module commands", conf_api_main, p); @@ -8031,7 +8456,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_conference_shutdown) switch_yield(100000); } - switch_event_unbind(&globals.node); + switch_event_unbind_callback(pres_event_handler); + switch_event_unbind_callback(conf_data_event_handler); + switch_event_unbind_callback(call_setup_event_handler); switch_event_free_subclass(CONF_EVENT_MAINT); /* free api interface help ".syntax" field string */ diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 0937b37c3c..80543033e0 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1145,6 +1145,18 @@ SWITCH_STANDARD_APP(set_name_function) SWITCH_STANDARD_APP(answer_function) { switch_channel_t *channel = switch_core_session_get_channel(session); + const char *arg = (char *) data; + + if (zstr(arg)) { + arg = switch_channel_get_variable(channel, "answer_flags"); + } + + if (!zstr(arg)) { + if (!switch_stristr("is_conference", arg)) { + switch_channel_set_flag(channel, CF_CONFERENCE); + } + } + switch_channel_answer(channel); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index d5faa8e3c9..b2c47d97d3 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -665,7 +665,10 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) int is_3pcc = 0; char *sticky = NULL; const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); - + + if (switch_channel_test_flag(channel, CF_CONFERENCE)) { + tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;isfocus", tech_pvt->reply_contact); + } if(sofia_test_flag(tech_pvt, TFLAG_3PCC_INVITE)) { // SNARK: complete hack to get final ack sent when a 3pcc invite has been passed from the other leg in bypass_media mode. @@ -5554,44 +5557,48 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for profiles to start\n"); switch_yield(1500000); - if (switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL, - &mod_sofia_globals.custom_node) != SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_TERM; } - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL, - &mod_sofia_globals.in_node) != SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_CONFERENCE_DATA, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_GENERR; } - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL, - &mod_sofia_globals.out_node) != SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_GENERR; } - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL, - &mod_sofia_globals.probe_node) != SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_GENERR; } - if (switch_event_bind_removable(modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL, - &mod_sofia_globals.roster_node) != SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_GENERR; } - if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_WAITING, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_mwi_event_handler, NULL, - &mod_sofia_globals.mwi_node) != SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_GENERR; } - if (switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, MY_EVENT_RECOVERY, sofia_glue_track_event_handler, NULL, - &mod_sofia_globals.recovery_node) != SWITCH_STATUS_SUCCESS) { + if (switch_event_bind(modname, SWITCH_EVENT_MESSAGE_WAITING, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_mwi_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); + return SWITCH_STATUS_GENERR; + } + + if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, MY_EVENT_RECOVERY, sofia_glue_track_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_GENERR; } @@ -5709,14 +5716,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown) } switch_mutex_unlock(mod_sofia_globals.mutex); - switch_event_unbind(&mod_sofia_globals.in_node); - switch_event_unbind(&mod_sofia_globals.probe_node); - switch_event_unbind(&mod_sofia_globals.out_node); - switch_event_unbind(&mod_sofia_globals.roster_node); - switch_event_unbind(&mod_sofia_globals.custom_node); - switch_event_unbind(&mod_sofia_globals.mwi_node); - switch_event_unbind(&mod_sofia_globals.recovery_node); + switch_event_unbind_callback(sofia_presence_event_handler); + switch_event_unbind_callback(sofia_presence_mwi_event_handler); + switch_event_unbind_callback(sofia_glue_track_event_handler); switch_event_unbind_callback(general_event_handler); + switch_event_unbind_callback(event_handler); while (mod_sofia_globals.threads) { switch_cond_next(); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 98975bdfdb..219b7c7b2f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -368,13 +368,6 @@ struct mod_sofia_globals { int msg_queue_len; struct sofia_private destroy_private; struct sofia_private keep_private; - switch_event_node_t *in_node; - switch_event_node_t *probe_node; - switch_event_node_t *out_node; - switch_event_node_t *roster_node; - switch_event_node_t *custom_node; - switch_event_node_t *mwi_node; - switch_event_node_t *recovery_node; int guess_mask; char guess_mask_str[16]; int debug_presence; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b04cb89e37..423757d655 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1189,8 +1189,59 @@ static void our_sofia_event_callback(nua_event_t event, case nua_r_refer: break; case nua_i_refer: - if (session) + if (session) { sofia_handle_sip_i_refer(nua, profile, nh, session, sip, de, tags); + } else { + const char *req_user = NULL, *req_host = NULL, *action = NULL, *ref_by_user = NULL; + char *refer_to = NULL, *referred_by = NULL, *method = NULL; + char *params = NULL; + switch_event_t *event; + + if (sip->sip_refer_to) { + refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to); + if ((params = strchr(refer_to, ';'))) { + *params++ = '\0'; + if ((method = switch_find_parameter(params, "method", NULL))) { + if (!strcasecmp(method, "INVITE")) { + action = "call"; + } else if (!strcasecmp(method, "BYE")) { + action = "end"; + } else { + action = method; + } + } + } + + refer_to = sofia_glue_get_url_from_contact(refer_to, 0); + + } + + if (sip->sip_referred_by) { + referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_referred_by), 0); + ref_by_user = sip->sip_referred_by->b_url->url_user; + } + + if (sip->sip_request && sip->sip_request->rq_url) { + req_user = sip->sip_request->rq_url->url_user; + req_host = sip->sip_request->rq_url->url_host; + } + + if (switch_event_create(&event, SWITCH_EVENT_CALL_SETUP_REQ) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Requesting-Component", "mod_sofia"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Target-Component", req_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Target-Domain", req_host); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Action", action); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Target", "sofia/%s/%s", profile->name, refer_to); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Sender", "sofia/%s/%s", profile->name, referred_by); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_number", ref_by_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_name", ref_by_user); + switch_event_fire(&event); + } + + nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END()); + switch_safe_free(method); + + } break; case nua_r_subscribe: sofia_presence_handle_sip_r_subscribe(status, phrase, nua, profile, nh, sofia_private, sip, de, tags); @@ -2112,13 +2163,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void nua_set_params(profile->nua, SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO"), - NUTAG_APPL_METHOD("OPTIONS"), - NUTAG_APPL_METHOD("REFER"), - NUTAG_APPL_METHOD("REGISTER"), - NUTAG_APPL_METHOD("NOTIFY"), NUTAG_APPL_METHOD("INFO"), NUTAG_APPL_METHOD("ACK"), NUTAG_APPL_METHOD("SUBSCRIBE"), -#ifdef MANUAL_BYE - NUTAG_APPL_METHOD("BYE"), -#endif NUTAG_AUTOANSWER(0), NUTAG_AUTOACK(0), NUTAG_AUTOALERT(0), @@ -2131,6 +2175,15 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NUTAG_ALLOW("NOTIFY"), NUTAG_ALLOW_EVENTS("talk"), NUTAG_ALLOW_EVENTS("hold"), + NUTAG_ALLOW_EVENTS("conference"), + NUTAG_APPL_METHOD("OPTIONS"), + NUTAG_APPL_METHOD("REFER"), + NUTAG_APPL_METHOD("REGISTER"), + NUTAG_APPL_METHOD("NOTIFY"), NUTAG_APPL_METHOD("INFO"), NUTAG_APPL_METHOD("ACK"), NUTAG_APPL_METHOD("SUBSCRIBE"), +#ifdef MANUAL_BYE + NUTAG_APPL_METHOD("BYE"), +#endif + NUTAG_SESSION_TIMER(profile->session_timeout), NTATAG_MAX_PROCEEDING(profile->max_proceeding), TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")), @@ -6829,11 +6882,13 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t goto done; } + printf("DICK %d\n", __LINE__); + if (!sip->sip_cseq || !(etmp = switch_mprintf("refer;id=%u", sip->sip_cseq->cs_seq))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Memory Error!\n"); goto done; } - + printf("DICK %d\n", __LINE__); from = sip->sip_from; //to = sip->sip_to; @@ -6850,7 +6905,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } if ((refer_to = sip->sip_refer_to)) { - char *rep; + char *rep = NULL; full_ref_to = sip_header_as_string(home, (void *) sip->sip_refer_to); if (sofia_test_pflag(profile, PFLAG_FULL_ID)) { @@ -6861,7 +6916,16 @@ 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_DEBUG, "Process REFER to [%s@%s]\n", exten, (char *) refer_to->r_url->url_host); - if (refer_to->r_url->url_headers && (rep = (char *) switch_stristr("Replaces=", refer_to->r_url->url_headers))) { + + if (refer_to->r_url && refer_to->r_url->url_headers) { + rep = (char *) switch_stristr("Replaces=", refer_to->r_url->url_headers); + } + + printf("WTFX %s\n", rep); + + if (!rep) { + printf("WTF [%s]\n", refer_to->r_url->url_headers); + } else { sip_replaces_t *replaces; nua_handle_t *bnh = NULL; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 16539aeef4..a6024037b1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -862,7 +862,102 @@ static void do_dialog_probe(switch_event_t *event) switch_safe_free(probe_user); } +static void send_conference_data(sofia_profile_t *profile, switch_event_t *event) +{ + char *sql; + struct pres_sql_cb cb = {profile, 0}; + const char *call_id = switch_event_get_header(event, "call_id"); + const char *from_user = switch_event_get_header(event, "conference-name"); + const char *from_host = switch_event_get_header(event, "conference-domain"); + const char *notfound = switch_event_get_header(event, "notfound"); + const char *body = switch_event_get_body(event); + if (!(from_user && from_host)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event information not given\n"); + return; + } + + if (switch_true(notfound)) { + sql = switch_mprintf("update sip_subscriptions set expires=%ld where " + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='conference'", + (long)switch_epoch_time_now(NULL), + mod_sofia_globals.hostname, profile->name, + from_user, from_host); + + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } + + + if (call_id) { + sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, " + "'application/conference-info+xml' as ct,'%q' as pt " + " from sip_subscriptions where " + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='conference'" + "and call_id = '%q' ", + switch_sql_concat(), + switch_str_nil(body), + mod_sofia_globals.hostname, profile->name, + from_user, from_host, call_id); + } else { + sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, " + "'application/conference-info+xml' as ct,'%q' as pt " + " from sip_subscriptions where " + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='conference'", + switch_sql_concat(), + switch_str_nil(body), + mod_sofia_globals.hostname, profile->name, + from_user, from_host); + } + + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_send_sql, &cb); + switch_safe_free(sql); + +} + +static void conference_data_event_handler(switch_event_t *event) +{ + const char *pname; + //const char *from_user = switch_event_get_header(event, "conference-name"); + //const char *from_host = switch_event_get_header(event, "conference-domain"); + const char *host = switch_event_get_header(event, "conference-domain"); + char *dup_domain = NULL; + sofia_profile_t *profile = NULL; + + if (zstr(host)) { + dup_domain = switch_core_get_variable_dup("domain"); + host = dup_domain; + } + + if ((pname = switch_event_get_header(event, "sofia-profile"))) { + profile = sofia_glue_find_profile(pname); + } + + if (host && !profile) { + profile = sofia_glue_find_profile(host); + } + + if (profile) { + send_conference_data(profile, event); + sofia_glue_release_profile(profile); + } else { + switch_console_callback_match_t *matches; + + if (list_profiles_full(NULL, NULL, &matches, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { + switch_console_callback_match_node_t *m; + + for (m = matches->head; m; m = m->next) { + if ((profile = sofia_glue_find_profile(m->val))) { + send_conference_data(profile, event); + sofia_glue_release_profile(profile); + } + } + + switch_console_free_matches(&matches); + } + } + + switch_safe_free(dup_domain); +} static void actual_sofia_presence_event_handler(switch_event_t *event) { @@ -1374,7 +1469,13 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread if (!pop) { break; } - actual_sofia_presence_event_handler(event); + + if (event->event_id == SWITCH_EVENT_CONFERENCE_DATA) { + conference_data_event_handler(event); + } else { + actual_sofia_presence_event_handler(event); + } + switch_event_destroy(&event); count++; } @@ -1871,14 +1972,22 @@ static void _send_presence_notify(sofia_profile_t *profile, char *our_contact = profile->url, *our_contact_dup = NULL; sofia_destination_t *dst = NULL; - char *contact_str, *contact, *user_via = NULL; + char *contact_str, *contact, *user_via = NULL, *send_contact = NULL; char *route_uri = NULL, *o_contact_dup = NULL, *tmp, *to_uri, *dcs = NULL; const char *tp; + char *cparams = NULL; if (zstr(full_to) || zstr(full_from) || zstr(o_contact)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "MISSING DATA TO SEND NOTIFY.\n"); return; } + + if ((cparams = strstr(o_contact, ";_;"))) { + cparams += 3; + } + + + tmp = (char *)o_contact; o_contact_dup = sofia_glue_get_url_from_contact(tmp, 1); @@ -2012,6 +2121,12 @@ static void _send_presence_notify(sofia_profile_t *profile, callsequence = ++profile->cseq_base; switch_mutex_unlock(profile->ireg_mutex); + if (cparams) { + send_contact = switch_mprintf("%s;%s", contact_str, cparams); + contact_str = send_contact; + } + + nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_CONTACT_STR(contact_str), TAG_END()); cseq = sip_cseq_create(nh->nh_home, callsequence, SIP_METHOD_NOTIFY); @@ -2047,6 +2162,7 @@ static void _send_presence_notify(sofia_profile_t *profile, sofia_glue_free_destination(dst); switch_safe_free(user_via); switch_safe_free(o_contact_dup); + switch_safe_free(send_contact); switch_safe_free(our_contact_dup); @@ -3649,9 +3765,17 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_safe_free(sql); } - } - - if ( sip->sip_event && sip->sip_event->o_type && !strcasecmp(sip->sip_event->o_type, "ua-profile") && contact_host ) { + } else if (!strcasecmp(event, "conference")) { + switch_event_t *event; + switch_event_create(&event, SWITCH_EVENT_CONFERENCE_DATA_QUERY); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Name", to_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Domain", to_host); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Query-From", from_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Query-From-Domain", from_host); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Id", call_id); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Sofia-Profile", profile->name); + switch_event_fire(&event); + } else if ( sip->sip_event && sip->sip_event->o_type && !strcasecmp(sip->sip_event->o_type, "ua-profile") && contact_host ) { switch_event_t *params; char *uri = NULL; char *extra_headers = NULL; diff --git a/src/switch_event.c b/src/switch_event.c index 0f08b496c0..4bfbbb1ff7 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -193,6 +193,10 @@ static char *EVENT_NAMES[] = { "SOCKET_DATA", "MEDIA_BUG_START", "MEDIA_BUG_STOP", + "CONFERENCE_DATA_QUERY", + "CONFERENCE_DATA", + "CALL_SETUP_REQ", + "CALL_SETUP_RESULT", "ALL" }; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 7d6ad297a2..ba55d693f6 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4676,7 +4676,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp_t *rtp_session) { - return rtp_session->send_msg.header.ssrc; + return rtp_session->ssrc; } SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data) From 088437cab162454547d40f3226f77990eff55f64 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 15:23:12 -0500 Subject: [PATCH 0666/1057] add some rtcp stuff for sangoma --- src/include/switch_types.h | 3 +- src/switch_rtp.c | 91 ++++++++++++++++++++++++++++++++------ 2 files changed, 80 insertions(+), 14 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 6dc6118fe9..eaf65d1c2d 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -554,7 +554,8 @@ typedef struct { typedef struct { uint32_t packet_count; - uint32_t octet_count; + uint32_t octet_count; + uint32_t peer_ssrc; } switch_rtcp_numbers_t; typedef struct { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index ba55d693f6..bb428b1f09 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -280,6 +280,43 @@ struct switch_rtp { }; +struct switch_rtcp_source { + unsigned ssrc1:32; + unsigned fraction_lost:8; + unsigned cumulative_lost:24; + unsigned hi_seq_recieved:32; + unsigned interarrival_jitter:32; + unsigned lsr:32; + unsigned lsr_delay:32; +}; + +#if SWITCH_BYTE_ORDER == __BIG_ENDIAN +struct switch_rtcp_s_desc_head { + unsigned v:2; + unsigned padding:1; + unsigned sc:5; + unsigned pt:8; + unsigned length:16; +}; + +#else /* BIG_ENDIAN */ +struct switch_rtcp_s_desc_head { + unsigned sc:5; + unsigned padding:1; + unsigned v:2; + unsigned pt:8; + unsigned length:16; +}; +#endif + +struct switch_rtcp_s_desc_trunk { + unsigned ssrc:32; + unsigned cname:8; + unsigned length:8; + char text[1]; +}; + + struct switch_rtcp_senderinfo { unsigned ssrc:32; unsigned ntp_msw:32; @@ -287,6 +324,10 @@ struct switch_rtcp_senderinfo { unsigned ts:32; unsigned pc:32; unsigned oc:32; + struct switch_rtcp_source sr_source; + struct switch_rtcp_s_desc_head sr_desc_head; + struct switch_rtcp_s_desc_trunk sr_desc_ssrc; + }; typedef enum { @@ -945,10 +986,12 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU) && rtp_session->rtcp_interval && (rtp_session->stats.read_count % rtp_session->rtcp_interval) == 0) { struct switch_rtcp_senderinfo *sr = (struct switch_rtcp_senderinfo*) rtp_session->rtcp_send_msg.body; + const char* str_cname=NULL; + //rtp_msg_t *send_msg = &rtp_session->send_msg; switch_size_t rtcp_bytes; switch_byte_t *ptr = (switch_byte_t *)rtp_session->rtcp_send_msg.body; - struct switch_rtcp_report_block *rb; + switch_time_t when; rtp_session->rtcp_send_msg.header.version = 2; rtp_session->rtcp_send_msg.header.p = 0; @@ -970,28 +1013,49 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) when = switch_time_now(); } - sr->ntp_msw = htonl((u_long)when / 1000000 + 2208988800UL); + sr->ntp_msw = htonl((u_long)(when / 1000000 + 2208988800UL)); + /* sr->ntp_lsw = htonl((u_long)(when % 1000000 * ((UINT_MAX * 1.0)/ 1000000.0))); + */ + sr->ntp_lsw = htonl((u_long)(rtp_session->send_time % 1000000 * 4294.967296)); sr->ts = htonl(rtp_session->last_write_ts); sr->pc = htonl(rtp_session->stats.outbound.packet_count); 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); - ptr += sizeof(struct switch_rtcp_senderinfo); } /* TBD need to put more accurate stats here. */ - rb = (struct switch_rtcp_report_block *) ptr; - rb->ssrc = rtp_session->recv_msg.header.ssrc; - rb->fraction = 0; - rb->lost = rtp_session->stats.inbound.skip_packet_count; - rb->highest_sequence_number_received = rtp_session->recv_msg.header.seq; - rb->jitter = 0; - rb->lsr = 0; - rb->dlsr = 0; - rtcp_bytes += sizeof(struct switch_rtcp_report_block); + sr->sr_source.ssrc1 = htonl(rtp_session->stats.rtcp.peer_ssrc); + sr->sr_source.fraction_lost = 0; + sr->sr_source.cumulative_lost = htonl(rtp_session->stats.inbound.skip_packet_count); + sr->sr_source.hi_seq_recieved = htonl(rtp_session->recv_msg.header.seq); + sr->sr_source.interarrival_jitter = htonl(0); + sr->sr_source.lsr = htonl(0); + sr->sr_source.lsr_delay = htonl(0); + sr->sr_desc_head.v = 0x02; + sr->sr_desc_head.padding = 0; + sr->sr_desc_head.sc = 1; + sr->sr_desc_head.pt = 202; + sr->sr_desc_head.length = htons(5); + + sr->sr_desc_ssrc.ssrc = htonl(rtp_session->ssrc); + sr->sr_desc_ssrc.cname = 0x1; + { + char bufa[30]; + str_cname = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_local_addr); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 to %s\n", str_cname); + sr->sr_desc_ssrc.length = strlen(str_cname); + memcpy ((char*)sr->sr_desc_ssrc.text, str_cname, strlen(str_cname)); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", sr->sr_desc_ssrc.length, sr->sr_desc_head.length, str_cname); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting msw = %d, lsw = %d \n", sr->ntp_msw, sr->ntp_lsw); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %lld, now lo = %d, now hi = %d\n", (int64_t)when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); + + rtcp_bytes = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_senderinfo) + sr->sr_desc_ssrc.length -1 ; rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); @@ -3070,6 +3134,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->stats.rtcp.packet_count += sr->pc; rtp_session->stats.rtcp.octet_count += sr->oc; + rtp_session->stats.rtcp.peer_ssrc = ntohl(sr->ssrc); /* sender report */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ From 1e7d214ae6d1f69779a46c1572da75755961152b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 15:35:49 -0500 Subject: [PATCH 0667/1057] compiler errs from last commit --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index bb428b1f09..d72374db78 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -991,7 +991,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) //rtp_msg_t *send_msg = &rtp_session->send_msg; switch_size_t rtcp_bytes; switch_byte_t *ptr = (switch_byte_t *)rtp_session->rtcp_send_msg.body; - switch_time_t when; + switch_time_t when = 0; rtp_session->rtcp_send_msg.header.version = 2; rtp_session->rtcp_send_msg.header.p = 0; @@ -1053,7 +1053,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", sr->sr_desc_ssrc.length, sr->sr_desc_head.length, str_cname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting msw = %d, lsw = %d \n", sr->ntp_msw, sr->ntp_lsw); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %lld, now lo = %d, now hi = %d\n", (int64_t)when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %ld, now lo = %d, now hi = %d\n", (int64_t)when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); rtcp_bytes = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_senderinfo) + sr->sr_desc_ssrc.length -1 ; rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); From f384e247fc42c4c3f361ed90f856271582b6ee57 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 11 Jul 2012 22:38:25 +0200 Subject: [PATCH 0668/1057] FreeTDM: Add gcc printf()-style format string checks to ftdm_log(), also add FTDM_(U)INT64_FMT and FTDM_TIME_FMT constants. The format string checks already caught a couple crash-worthy bugs and this commit fixes a couple more. Also includes __ftdm_check_scanf(), for completeness (currently unused). Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftdm_state.c | 4 +- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 4 +- .../src/ftmod/ftmod_misdn/ftmod_misdn.c | 2 +- libs/freetdm/src/include/freetdm.h | 2 +- libs/freetdm/src/include/ftdm_declare.h | 39 +++++++++++++++++++ libs/freetdm/src/include/ftdm_os.h | 2 + libs/freetdm/src/testr2.c | 2 +- 7 files changed, 48 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index e2ccf83747..db4097e84b 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -92,7 +92,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c diff = fchan->history[hindex].end_time - fchan->history[hindex].time; - ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Completed state change from %s to %s in %llums\n", + ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Completed state change from %s to %s in %"FTDM_TIME_FMT" ms\n", ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(state), diff); @@ -209,7 +209,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_cancel_state(const char *file, const char /* NOTE * we could potentially also take out the channel from the pendingchans queue, but I believe is easier just leave it, * the only side effect will be a call to ftdm_channel_advance_states() for a channel that has nothing to advance */ - ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Cancelled state change from %s to %s in %llums\n", + ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Cancelled state change from %s to %s in %"FTDM_TIME_FMT" ms\n", ftdm_channel_state2str(last_state), ftdm_channel_state2str(state), diff); return FTDM_SUCCESS; diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 471b870f34..edfd8132a1 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1221,7 +1221,7 @@ static int on_info(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event ftdm_caller_data_t *caller_data = NULL; if (!chan) { - ftdm_log(FTDM_LOG_CRIT, "-- Info on channel %d:%d %s but it's not in use?\n", ftdm_span_get_id(span), pevent->ring.channel); + ftdm_log(FTDM_LOG_CRIT, "-- Info on channel %d:%d but it's not in use?\n", ftdm_span_get_id(span), pevent->ring.channel); return 0; } @@ -1284,7 +1284,7 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel); 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); + ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); return 0; } diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c index c304a8b37b..c2c1abfb2c 100644 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c @@ -1143,7 +1143,7 @@ static ftdm_status_t misdn_handle_incoming(ftdm_channel_t *ftdmchan, const char assert(priv); if (msg_len < sizeof(*hh)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN message to small (%d < %d bytes)\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN message to small (%d < %"FTDM_SIZE_FMT" bytes)\n", msg_len, sizeof(*hh)); return FTDM_FAIL; } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 6ce9879b91..8f5fb4f1f3 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -216,7 +216,7 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t) /*! \brief Logging function prototype to be used for all FreeTDM logs * you should use ftdm_global_set_logger to set your own logger */ -typedef void (*ftdm_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...); +typedef void (*ftdm_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...) __ftdm_check_printf(5, 6); /*! \brief Data queue operation functions * you can use ftdm_global_set_queue_handler if you want to override the default implementation (not recommended) diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index cf4dcdd555..3a931fb718 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -121,6 +121,36 @@ extern "C" { #pragma comment(lib, "Winmm") #endif +/* + * Compiler-specific format checking attributes + * use these on custom functions that use printf/scanf-style + * format strings (e.g. ftdm_log()) + */ +#if defined(__GNUC__) +/** + * Enable compiler-specific printf()-style format and argument checks on a function + * @param fmtp Position of printf()-style format string parameter + * @param argp Position of variable argument list ("...") parameter + * @code + * void log(const int level, const char *fmt, ...) __ftdm_check_printf(2, 3); + * @endcode + */ +#define __ftdm_check_printf(fmtp, argp) __attribute__((format (printf, fmtp, argp))) +/** + * Enable compiler-specific scanf()-style format and argument checks on a function + * @param fmtp Position of scanf()-style format string parameter + * @param argp Position of variable argument list ("...") parameter + * @code + * void parse(struct foo *ctx, const char *fmt, ...) __ftdm_check_scanf(2, 3); + * @endcode + */ +#define __ftdm_check_scanf(fmtp, argp) __attribute__((format (scanf, fmtp, argp))) +#else +#define __ftdm_check_printf(fmtp, argp) +#define __ftdm_check_scanf(fmtp, argp) +#endif + + #define FTDM_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) FT_DECLARE(_TYPE) _FUNC1 (const char *name); FT_DECLARE(const char *) _FUNC2 (_TYPE type); #define FTDM_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ FT_DECLARE(_TYPE) _FUNC1 (const char *name) \ @@ -160,6 +190,8 @@ typedef __int16 int16_t; typedef __int8 int8_t; #define FTDM_O_BINARY O_BINARY #define FTDM_SIZE_FMT "Id" +#define FTDM_INT64_FMT "lld" +#define FTDM_UINT64_FMT "llu" #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else @@ -168,6 +200,13 @@ typedef __int8 int8_t; #else /* __WINDOWS__ */ #define FTDM_O_BINARY 0 #define FTDM_SIZE_FMT "zd" +#if (defined(__SIZEOF_LONG__) && (__SIZEOF_LONG__ == 8)) || defined(__LP64__) || defined(__LLP64__) +#define FTDM_INT64_FMT "ld" +#define FTDM_UINT64_FMT "lu" +#else +#define FTDM_INT64_FMT "lld" +#define FTDM_UINT64_FMT "llu" +#endif #define FTDM_INVALID_SOCKET -1 typedef int ftdm_socket_t; #include diff --git a/libs/freetdm/src/include/ftdm_os.h b/libs/freetdm/src/include/ftdm_os.h index a4605c3371..151f8d935e 100644 --- a/libs/freetdm/src/include/ftdm_os.h +++ b/libs/freetdm/src/include/ftdm_os.h @@ -53,6 +53,8 @@ extern "C" { /*! \brief time data type */ typedef uint64_t ftdm_time_t; +/*! format string for ftdm_time_t */ +#define FTDM_TIME_FMT FTDM_UINT64_FMT /*! \brief sleep x amount of milliseconds */ #ifdef __WINDOWS__ diff --git a/libs/freetdm/src/testr2.c b/libs/freetdm/src/testr2.c index 24dde38b08..530e6321bc 100644 --- a/libs/freetdm/src/testr2.c +++ b/libs/freetdm/src/testr2.c @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) ftdm_channel_call_indicate(lchan, ind); stop = ftdm_current_time_in_ms(); diff = stop - start; - ftdm_log(FTDM_LOG_DEBUG, "Setting indication %s took %llums\n", + ftdm_log(FTDM_LOG_DEBUG, "Setting indication %s took %"FTDM_TIME_FMT" ms\n", ftdm_channel_indication2str(ind), diff); } } From abbe8d5a0d110e8e2af19b09460b7eda75db462e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 15:50:38 -0500 Subject: [PATCH 0669/1057] tweak --- .../mod_conference/mod_conference.c | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 151084e44a..52b68b2cee 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -8019,44 +8019,37 @@ static void conference_send_presence(conference_obj_t *conference) static void call_setup_event_handler(switch_event_t *event) { - char *conf; - char *dial_str; - char *action; conference_obj_t *conference = NULL; - - if (!switch_test_flag(conference, CFLAG_RFC4579)) { - return; - } - - conf = switch_event_get_header(event, "Target-Component"); - dial_str = switch_event_get_header(event, "Request-Target"); - action = switch_event_get_header(event, "Request-Action"); + char *conf = switch_event_get_header(event, "Target-Component"); + char *dial_str = switch_event_get_header(event, "Request-Target"); + char *action = switch_event_get_header(event, "Request-Action"); if (!zstr(conf) && !zstr(dial_str) && !zstr(action) && (conference = conference_find(conf))) { switch_event_t *var_event; switch_event_header_t *hp; + + if (switch_test_flag(conference, CFLAG_RFC4579)) { + if (!strcasecmp(action, "call")) { - if (!strcasecmp(action, "call")) { - - if (switch_event_create_plain(&var_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) { - abort(); - } - - for(hp = event->headers; hp; hp = hp->next) { - if (!strncasecmp(hp->name, "var_", 4)) { - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, hp->name + 4, hp->value); + if (switch_event_create_plain(&var_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) { + abort(); } - } - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, "conference_dial_str", dial_str); + for(hp = event->headers; hp; hp = hp->next) { + if (!strncasecmp(hp->name, "var_", 4)) { + switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, hp->name + 4, hp->value); + } + } + + switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, "conference_dial_str", dial_str); - conference_outcall_bg(conference, NULL, NULL, dial_str, 60, NULL, NULL, NULL, NULL, NULL, NULL, &var_event); + conference_outcall_bg(conference, NULL, NULL, dial_str, 60, NULL, NULL, NULL, NULL, NULL, NULL, &var_event); - } else if (!strcasecmp(action, "end")) { - switch_core_session_hupall_matching_var("conference_dial_str", dial_str, SWITCH_CAUSE_NORMAL_CLEARING); + } else if (!strcasecmp(action, "end")) { + switch_core_session_hupall_matching_var("conference_dial_str", dial_str, SWITCH_CAUSE_NORMAL_CLEARING); + } } - switch_thread_rwlock_unlock(conference->rwlock); } From 9cad51b74bbfd0850388e35f7a6c5ed1022d8122 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 16:03:56 -0500 Subject: [PATCH 0670/1057] flip not --- 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 80543033e0..2aa5679b7b 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1152,7 +1152,7 @@ SWITCH_STANDARD_APP(answer_function) } if (!zstr(arg)) { - if (!switch_stristr("is_conference", arg)) { + if (switch_stristr("is_conference", arg)) { switch_channel_set_flag(channel, CF_CONFERENCE); } } From 75b36c9545053f14bd0f9cb2f05e03d0942b1141 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 16:48:56 -0500 Subject: [PATCH 0671/1057] tweaks --- libs/sofia-sip/.update | 2 +- .../mod_conference/mod_conference.c | 40 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index cfded9d9e2..7a0987854e 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Sat Jun 9 03:24:47 UTC 2012 +Wed Jul 11 16:48:51 CDT 2012 diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 52b68b2cee..9a4d9eb538 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -467,7 +467,7 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char * static void conference_send_all_dtmf(conference_member_t *member, conference_obj_t *conference, const char *dtmf); static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin); static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim); -static conference_obj_t *conference_find(char *name); +static conference_obj_t *conference_find(char *name, char *domain); static void member_bind_controls(conference_member_t *member, const char *controls); static void conference_send_presence(conference_obj_t *conference); @@ -6023,7 +6023,7 @@ SWITCH_STANDARD_API(conf_api_main) if (argc && argv[0]) { conference_obj_t *conference = NULL; - if ((conference = conference_find(argv[0]))) { + if ((conference = conference_find(argv[0], NULL))) { if (argc >= 2) { conf_api_dispatch(conference, stream, argc, argv, cmd, 1); } else { @@ -6838,7 +6838,7 @@ SWITCH_STANDARD_APP(conference_function) conf_name = uuid; } - if ((conference = conference_find(conf_name))) { + if ((conference = conference_find(conf_name, NULL))) { switch_thread_rwlock_unlock(conference->rwlock); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name); goto done; @@ -6878,7 +6878,7 @@ SWITCH_STANDARD_APP(conference_function) enforce_security = switch_true(pvar); } - if ((conference = conference_find(conf_name))) { + if ((conference = conference_find(conf_name, NULL))) { if (locked) { switch_mutex_unlock(globals.setup_mutex); locked = 0; @@ -7395,7 +7395,7 @@ static switch_status_t chat_send(switch_event_t *message_event) switch_copy_string(name, to, sizeof(name)); } - if (!(conference = conference_find(name))) { + if (!(conference = conference_find(name, NULL))) { switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL, NULL); return SWITCH_STATUS_FALSE; } @@ -7421,7 +7421,7 @@ static switch_status_t chat_send(switch_event_t *message_event) return SWITCH_STATUS_SUCCESS; } -static conference_obj_t *conference_find(char *name) +static conference_obj_t *conference_find(char *name, char *domain) { conference_obj_t *conference; @@ -7432,6 +7432,10 @@ static conference_obj_t *conference_find(char *name) switch_clear_flag(conference, CFLAG_INHASH); conference = NULL; } + + if (!zstr(domain) && conference->domain && strcasecmp(domain, conference->domain)) { + conference = NULL; + } } if (conference) { if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) { @@ -8021,11 +8025,12 @@ static void call_setup_event_handler(switch_event_t *event) { conference_obj_t *conference = NULL; char *conf = switch_event_get_header(event, "Target-Component"); + char *domain = switch_event_get_header(event, "Target-Domain"); char *dial_str = switch_event_get_header(event, "Request-Target"); char *action = switch_event_get_header(event, "Request-Action"); - if (!zstr(conf) && !zstr(dial_str) && !zstr(action) && (conference = conference_find(conf))) { + if (!zstr(conf) && !zstr(dial_str) && !zstr(action) && (conference = conference_find(conf, domain))) { switch_event_t *var_event; switch_event_header_t *hp; @@ -8059,38 +8064,33 @@ static void conf_data_event_handler(switch_event_t *event) { switch_event_t *revent; char *name = switch_event_get_header(event, "conference-name"); + char *domain = switch_event_get_header(event, "conference-domain"); conference_obj_t *conference = NULL; char *body = NULL; + switch_event_dup(&revent, event); revent->event_id = SWITCH_EVENT_CONFERENCE_DATA; revent->flags |= EF_UNIQ_HEADERS; switch_event_add_header(revent, SWITCH_STACK_TOP, "Event-Name", "CONFERENCE_DATA"); - if (!zstr(name) && (conference = conference_find(name))) { + + if (!zstr(name) && (conference = conference_find(name, domain))) { if (switch_test_flag(conference, CFLAG_RFC4579)) { body = conference_rfc4579_render(conference, event); + switch_event_add_body(revent, body); } switch_thread_rwlock_unlock(conference->rwlock); - } if (!body) { - char *domain = switch_event_get_header(event, "conference-domain"); - - if (zstr(domain)) { - domain = "cluecon.com"; - } - - body = switch_mprintf("\n", name, domain); + switch_event_add_body(revent, "CONFERENCE NOT FOUND"); switch_event_add_header(revent, SWITCH_STACK_BOTTOM, "notfound", "true"); } - - switch_event_add_body(revent, body); switch_event_fire(&revent); switch_safe_free(body); + } @@ -8119,7 +8119,7 @@ static void pres_event_handler(switch_event_t *event) dup_conf_name = switch_mprintf("%q@%q", conf_name, domain_name); - if ((conference = conference_find(conf_name)) || (conference = conference_find(dup_conf_name))) { + if ((conference = conference_find(conf_name, NULL)) || (conference = conference_find(dup_conf_name, NULL))) { if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name); From 63147207b631c60f3c537b85fdec978cc151b10e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 17:09:42 -0500 Subject: [PATCH 0672/1057] update --- 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 9a4d9eb538..6bd8353755 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -8085,7 +8085,7 @@ static void conf_data_event_handler(switch_event_t *event) if (!body) { switch_event_add_body(revent, "CONFERENCE NOT FOUND"); - switch_event_add_header(revent, SWITCH_STACK_BOTTOM, "notfound", "true"); + //switch_event_add_header(revent, SWITCH_STACK_BOTTOM, "notfound", "true"); } switch_event_fire(&revent); From 4e0f40d7c6c47561bc7fd507a2f5f90290a5e929 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 17:25:45 -0500 Subject: [PATCH 0673/1057] update --- .../applications/mod_conference/mod_conference.c | 14 +++++++++++--- src/mod/endpoints/mod_sofia/sofia.c | 7 ++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 6bd8353755..8017126748 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -8028,11 +8028,17 @@ static void call_setup_event_handler(switch_event_t *event) char *domain = switch_event_get_header(event, "Target-Domain"); char *dial_str = switch_event_get_header(event, "Request-Target"); char *action = switch_event_get_header(event, "Request-Action"); + char *ext = switch_event_get_header(event, "Request-Target-Extension"); + + + if (!ext) ext = dial_str; - if (!zstr(conf) && !zstr(dial_str) && !zstr(action) && (conference = conference_find(conf, domain))) { switch_event_t *var_event; switch_event_header_t *hp; + char *key = NULL; + + key = switch_mprintf("conf_%s_%s_%s", conference->name, conference->domain, ext); if (switch_test_flag(conference, CFLAG_RFC4579)) { if (!strcasecmp(action, "call")) { @@ -8047,14 +8053,16 @@ static void call_setup_event_handler(switch_event_t *event) } } - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, "conference_dial_str", dial_str); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_dial_str", key); conference_outcall_bg(conference, NULL, NULL, dial_str, 60, NULL, NULL, NULL, NULL, NULL, NULL, &var_event); } else if (!strcasecmp(action, "end")) { - switch_core_session_hupall_matching_var("conference_dial_str", dial_str, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_hupall_matching_var("conference_dial_str", key, SWITCH_CAUSE_NORMAL_CLEARING); } } + + switch_safe_free(key); switch_thread_rwlock_unlock(conference->rwlock); } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 423757d655..49bdb95534 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1192,12 +1192,15 @@ static void our_sofia_event_callback(nua_event_t event, if (session) { sofia_handle_sip_i_refer(nua, profile, nh, session, sip, de, tags); } else { - const char *req_user = NULL, *req_host = NULL, *action = NULL, *ref_by_user = NULL; + const char *req_user = NULL, *req_host = NULL, *action = NULL, *ref_by_user = NULL, *ref_to_user = NULL, *ref_to_host = NULL; char *refer_to = NULL, *referred_by = NULL, *method = NULL; char *params = NULL; switch_event_t *event; if (sip->sip_refer_to) { + ref_to_user = sip->sip_refer_to->r_url->url_user; + ref_to_host = sip->sip_refer_to->r_url->url_host; + refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to); if ((params = strchr(refer_to, ';'))) { *params++ = '\0'; @@ -1232,6 +1235,8 @@ static void our_sofia_event_callback(nua_event_t event, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Target-Domain", req_host); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Action", action); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Target", "sofia/%s/%s", profile->name, refer_to); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Extension", ref_to_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Domain", ref_to_host); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Sender", "sofia/%s/%s", profile->name, referred_by); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_number", ref_by_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_name", ref_by_user); From 0c945168cad9936116fc99defa8790582ad81ea6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 17:35:40 -0500 Subject: [PATCH 0674/1057] update --- .../mod_conference/mod_conference.c | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 8017126748..3b8273a87c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -582,7 +582,7 @@ static void conference_cdr_rejected(conference_obj_t *conference, switch_channel rp->cp = switch_caller_profile_dup(conference->pool, cp); } -static char *conference_rfc4579_render(conference_obj_t *conference, switch_event_t *event) +static char *conference_rfc4579_render(conference_obj_t *conference, switch_event_t *event, switch_event_t *revent) { switch_xml_t xml, x_tag, x_tag1, x_tag2, x_tag3, x_tag4; char tmp[30]; @@ -661,6 +661,10 @@ static char *conference_rfc4579_render(conference_obj_t *conference, switch_even switch_snprintf(tmp, sizeof(tmp), "%u", conference->count); switch_xml_set_txt_d(x_tag1, tmpp); + if (conference->count == 0) { + switch_event_add_header(revent, SWITCH_STACK_BOTTOM, "notfound", "true"); + } + if (!(x_tag1 = switch_xml_add_child_d(x_tag, "active", off1++))) { abort(); } @@ -1247,7 +1251,7 @@ static void send_rfc_event(conference_obj_t *conference) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "conference-name", name); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "conference-domain", domain); - body = conference_rfc4579_render(conference, NULL); + body = conference_rfc4579_render(conference, NULL, event); switch_event_add_body(event, body); free(body); switch_event_fire(&event); @@ -8076,29 +8080,20 @@ static void conf_data_event_handler(switch_event_t *event) conference_obj_t *conference = NULL; char *body = NULL; - - switch_event_dup(&revent, event); - revent->event_id = SWITCH_EVENT_CONFERENCE_DATA; - revent->flags |= EF_UNIQ_HEADERS; - switch_event_add_header(revent, SWITCH_STACK_TOP, "Event-Name", "CONFERENCE_DATA"); - - if (!zstr(name) && (conference = conference_find(name, domain))) { if (switch_test_flag(conference, CFLAG_RFC4579)) { - body = conference_rfc4579_render(conference, event); + switch_event_dup(&revent, event); + revent->event_id = SWITCH_EVENT_CONFERENCE_DATA; + revent->flags |= EF_UNIQ_HEADERS; + switch_event_add_header(revent, SWITCH_STACK_TOP, "Event-Name", "CONFERENCE_DATA"); + + body = conference_rfc4579_render(conference, event, revent); switch_event_add_body(revent, body); + switch_event_fire(&revent); + switch_safe_free(body); } switch_thread_rwlock_unlock(conference->rwlock); } - - if (!body) { - switch_event_add_body(revent, "CONFERENCE NOT FOUND"); - //switch_event_add_header(revent, SWITCH_STACK_BOTTOM, "notfound", "true"); - } - - switch_event_fire(&revent); - switch_safe_free(body); - } From 932fc2286fabc654d9ee0d6fbcbccc6321dfa4d6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 18:04:13 -0500 Subject: [PATCH 0675/1057] update --- .../mod_conference/mod_conference.c | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 3b8273a87c..8c82e03f2a 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1310,6 +1310,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_channel_set_variable(channel, "conference_recording", conference->record_filename); switch_channel_set_variable(channel, CONFERENCE_UUID_VARIABLE, conference->uuid_str); + + if (!switch_channel_get_variable(channel, "conference_dial_str")) { + char *key = switch_core_session_sprintf(member->session, "conf_%s_%s_%s", + conference->name, conference->domain, switch_channel_get_variable(channel, "caller_id_number")); + switch_channel_set_variable(channel, "conference_dial_str", key); + } + + if (switch_test_flag(conference, CFLAG_WAIT_MOD) && switch_test_flag(member, MFLAG_MOD)) { switch_clear_flag(conference, CFLAG_WAIT_MOD); } @@ -1512,6 +1520,7 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe member->conference = NULL; if (!switch_test_flag(member, MFLAG_NOCHANNEL)) { + switch_channel_t *channel = switch_core_session_get_channel(member->session); conference->count--; if (switch_test_flag(member, MFLAG_ENDCONF)) { @@ -1523,17 +1532,18 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe conference_send_presence(conference); + switch_channel_set_variable(channel, "conference_dial_str", NULL); if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min) || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0)) { switch_set_flag(conference, CFLAG_DESTRUCT); } else { if (!exit_sound && 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); + conference_play_file(conference, conference->exit_sound, 0, channel, 0); } if (conference->count == 1 && conference->alone_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) { conference_stop_file(conference, FILE_STOP_ASYNC); - conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session), 1); + conference_play_file(conference, conference->alone_sound, 0, channel, 1); } } @@ -8025,6 +8035,35 @@ static void conference_send_presence(conference_obj_t *conference) } +static void kickall_matching_var(conference_obj_t *conference, const char *var, const char *val) +{ + conference_member_t *member = NULL; + const char *vval = NULL; + switch_mutex_lock(conference->mutex); + switch_mutex_lock(conference->member_mutex); + + for (member = conference->members; member; member = member->next) { + switch_channel_t *channel = NULL; + + if (switch_test_flag(member, MFLAG_NOCHANNEL)) { + continue; + } + + channel = switch_core_session_get_channel(member->session); + vval = switch_channel_get_variable(channel, var); + + if (vval && !strcmp(vval, val)) { + switch_set_flag_locked(member, MFLAG_KICKED); + switch_clear_flag_locked(member, MFLAG_RUNNING); + switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK); + } + + } + + switch_mutex_unlock(conference->member_mutex); + switch_mutex_unlock(conference->mutex); +} + static void call_setup_event_handler(switch_event_t *event) { conference_obj_t *conference = NULL; @@ -8062,7 +8101,8 @@ static void call_setup_event_handler(switch_event_t *event) conference_outcall_bg(conference, NULL, NULL, dial_str, 60, NULL, NULL, NULL, NULL, NULL, NULL, &var_event); } else if (!strcasecmp(action, "end")) { - switch_core_session_hupall_matching_var("conference_dial_str", key, SWITCH_CAUSE_NORMAL_CLEARING); + //switch_core_session_hupall_matching_var("conference_dial_str", key, SWITCH_CAUSE_NORMAL_CLEARING); + kickall_matching_var(conference, "conference_dial_str", key); } } From a06eb2db3033bda731638fb751a668287485c1a5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Jul 2012 18:12:26 -0500 Subject: [PATCH 0676/1057] FS-4328 try this --- src/mod/endpoints/mod_sofia/sofia_glue.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 75c201ddb2..78beb73624 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5766,13 +5766,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName rr = switch_channel_get_variable(channel, "sip_invite_record_route"); if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_req_uri")); - switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_from")); - switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_to")); - } else { - int break_rfc = switch_true(switch_channel_get_variable(channel, "sip_recovery_break_rfc")); - + tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_req_uri")); + switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, break_rfc ? "sip_full_to" : "sip_full_from")); + switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, break_rfc ? "sip_full_from" : "sip_full_to")); + } else { tech_pvt->redirected = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_contact_uri")); if (zstr(rr)) { @@ -5785,11 +5783,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri")); if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE, -1)) { - switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, break_rfc ? "sip_full_from" : "sip_full_to")); + switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_to")); } if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE, -1)) { - switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, break_rfc ? "sip_full_to" : "sip_full_from")); + switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_from")); } } From a8efae998ffb90a8ae3321ec762b9adbc8fd3ab6 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Thu, 12 Jul 2012 01:34:36 +0200 Subject: [PATCH 0677/1057] Add FreeSWITCH-Version string and Uptime-msec (uptime in *milliseconds*) to heartbeat events --- src/switch_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core.c b/src/switch_core.c index a0f8526813..3be5f0d818 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -82,6 +82,8 @@ static void send_heartbeat(void) duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms, duration.mms == 1 ? "" : "s"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Version", SWITCH_VERSION_FULL); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Uptime-msec", "%lu", switch_core_uptime() / 1000); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Count", "%u", switch_core_session_count()); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Max-Sessions", "%u", switch_core_session_limit(0)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec", "%u", runtime.sps); From a0bd63d32d4606a9b3596d48245fc67d2f7c9cb6 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 01:42:14 +0200 Subject: [PATCH 0678/1057] mod_conference: Fix format string errors. Use switch_event_add_header_string() where needed and add a dummy "%s" format string to switch_event_add_body() calls. Signed-off-by: Stefan Knoblich --- .../applications/mod_conference/mod_conference.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 8c82e03f2a..0525a5031a 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1248,11 +1248,11 @@ static void send_rfc_event(conference_obj_t *conference) if (switch_event_create(&event, SWITCH_EVENT_CONFERENCE_DATA) == SWITCH_STATUS_SUCCESS) { event->flags |= EF_UNIQ_HEADERS; - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "conference-name", name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "conference-domain", domain); - + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "conference-name", name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "conference-domain", domain); + body = conference_rfc4579_render(conference, NULL, event); - switch_event_add_body(event, body); + switch_event_add_body(event, "%s", body); free(body); switch_event_fire(&event); } @@ -8092,7 +8092,7 @@ static void call_setup_event_handler(switch_event_t *event) for(hp = event->headers; hp; hp = hp->next) { if (!strncasecmp(hp->name, "var_", 4)) { - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, hp->name + 4, hp->value); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, hp->name + 4, hp->value); } } @@ -8128,9 +8128,9 @@ static void conf_data_event_handler(switch_event_t *event) switch_event_add_header(revent, SWITCH_STACK_TOP, "Event-Name", "CONFERENCE_DATA"); body = conference_rfc4579_render(conference, event, revent); - switch_event_add_body(revent, body); + switch_event_add_body(revent, "%s", body); switch_event_fire(&revent); - switch_safe_free(body); + switch_safe_free(body); } switch_thread_rwlock_unlock(conference->rwlock); } From 90d299cd7af941adf97f6e0952960331c23f1e09 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 02:37:55 +0200 Subject: [PATCH 0679/1057] FreeTDM: Add dumy "%s" format string to ftdm_assert() and ftdm_assert_return() to silence format string warnings. Neither of them accepts extra arguments and ftmod_sangoma_isdn is calling ftmod_assert() with a char * msg argument. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/include/private/ftdm_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index fa1bd233cd..d678efd8c8 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -695,7 +695,7 @@ FT_DECLARE(ftdm_status_t) ftdm_sigmsg_set_raw_data(ftdm_sigmsg_t *sigmsg, void * */ #define ftdm_assert(assertion, msg) \ if (!(assertion)) { \ - ftdm_log(FTDM_LOG_CRIT, msg); \ + ftdm_log(FTDM_LOG_CRIT, "%s", msg); \ if (g_ftdm_crash_policy & FTDM_CRASH_ON_ASSERT) { \ ftdm_abort(); \ } \ @@ -706,7 +706,7 @@ FT_DECLARE(ftdm_status_t) ftdm_sigmsg_set_raw_data(ftdm_sigmsg_t *sigmsg, void * */ #define ftdm_assert_return(assertion, retval, msg) \ if (!(assertion)) { \ - ftdm_log(FTDM_LOG_CRIT, msg); \ + ftdm_log(FTDM_LOG_CRIT, "%s", msg); \ if (g_ftdm_crash_policy & FTDM_CRASH_ON_ASSERT) { \ ftdm_abort(); \ } else { \ From ee2a5a33f34e3db13d6d6ecc15b6e4160ce1599b Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 03:01:20 +0200 Subject: [PATCH 0680/1057] FreeTDM: Fix format string errors in ftmod_analog, ftmod_wanpipe and ftmod_sangoma_isdn. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c | 2 +- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 6 +++--- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c | 2 +- .../ftmod_sangoma_isdn_stack_cfg.c | 2 +- .../ftmod_sangoma_isdn_stack_cntrl.c | 8 ++++---- .../ftmod_sangoma_isdn_stack_hndl.c | 4 ++-- .../ftmod_sangoma_isdn_support.c | 4 ++-- .../ftmod_sangoma_isdn_transfer.c | 2 +- .../src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 14 +++++++------- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 25e2a5ac77..8abfce78df 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -473,7 +473,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; - ftdm_assert(interval != 0, NULL); + ftdm_assert(interval != 0, "Invalid interval"); if (!dial_timeout) { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Not waiting for dial tone to dial number %s\n", ftdmchan->caller_data.dnis.digits); 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 e3af9d9b98..5e1c414a23 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 @@ -452,17 +452,17 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* get an interrupt queue for this span */ if (ftdm_queue_get_interrupt(span->pendingchans, &ftdm_sangoma_isdn_int[0]) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a ftdm_interrupt for span = %s!\n", span->name); + ftdm_log(FTDM_LOG_CRIT, "Failed to get a ftdm_interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } if (ftdm_queue_get_interrupt(span->pendingsignals, &ftdm_sangoma_isdn_int[1]) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a signal interrupt for span = %s!\n", span->name); + ftdm_log(FTDM_LOG_CRIT, "Failed to get a signal interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } if (ftdm_queue_get_interrupt(signal_data->event_queue, &ftdm_sangoma_isdn_int[2]) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a event interrupt for span = %s!\n", span->name); + ftdm_log(FTDM_LOG_CRIT, "Failed to get a event interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } 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 5b3db934a5..151fe847f5 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 @@ -130,7 +130,7 @@ static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span /* can be > 1 for some BRI variants */ break; default: - ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type)); + ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunktype:%s\n", span->name, ftdm_trunk_type2str(span->trunk_type)); return FTDM_FAIL; } /* see if we have profile with this switch_type already */ 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 a1229dcab9..7c6322c3bc 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 @@ -1181,7 +1181,7 @@ uint8_t sng_isdn_stack_switchtype(sngisdn_switchtype_t switchtype) case SNGISDN_SWITCH_INSNET: return SW_INSNET; case SNGISDN_SWITCH_INVALID: - ftdm_log(FTDM_LOG_ERROR, "%s:Invalid switchtype:%d\n", switchtype); + ftdm_log(FTDM_LOG_ERROR, "Invalid switchtype: %d\n", switchtype); break; } return 0; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index 2023f4c54c..f7193e20c1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -234,7 +234,7 @@ ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trac sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q921); if (sngisdn_cntrl_q921(span, ADISIMM, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q921 trace\n"); + ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q921 trace\n", signal_data->link_id); } } if (sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q931)) { @@ -242,7 +242,7 @@ ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trac sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q931); if (sngisdn_cntrl_q931(span, ADISIMM, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q931 trace\n"); + ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q931 trace\n", signal_data->link_id); } } break; @@ -252,7 +252,7 @@ ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trac sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q921); if (sngisdn_cntrl_q921(span, AENA, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q921 trace\n"); + ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q921 trace\n", signal_data->link_id); } } break; @@ -262,7 +262,7 @@ ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trac sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q931); if (sngisdn_cntrl_q931(span, AENA, SATRC) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q931 trace\n"); + ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q931 trace\n", signal_data->link_id); } } break; 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 11df566362..3769726f9f 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 @@ -480,7 +480,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "received %d of %d digits\n", num_digits, min_digits); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "received %"FTDM_SIZE_FMT" of %"FTDM_SIZE_FMT" digits\n", num_digits, min_digits); } } break; @@ -496,7 +496,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); break; default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "\n", suId, suInstId, spInstId); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled INFO (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); break; } } 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 254b3abbfb..df7e7b1667 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 @@ -453,7 +453,7 @@ ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) } memset(subaddress, 0, sizeof(subaddress)); if(cgPtySad->sadInfo.len >= sizeof(subaddress)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Calling Party Subaddress exceeds local size limit (len:%d max:%d)\n", cgPtySad->sadInfo.len, sizeof(subaddress)); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Calling Party Subaddress exceeds local size limit (len:%d max:%"FTDM_SIZE_FMT")\n", cgPtySad->sadInfo.len, sizeof(subaddress)); cgPtySad->sadInfo.len = sizeof(subaddress)-1; } @@ -1190,7 +1190,7 @@ void sngisdn_restart_timeout(void *p_signal_data) ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; - ftdm_log(FTDM_LOG_DEBUG, "s%d:Did not receive a RESTART from remote switch in %d ms - restarting\n", span->name, signal_data->restart_timeout); + ftdm_log(FTDM_LOG_DEBUG, "s%s:Did not receive a RESTART from remote switch in %d ms - restarting\n", span->name, signal_data->restart_timeout); chaniter = ftdm_span_get_chan_iterator(span, NULL); for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c index 407b826d60..5df54f48ea 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_transfer.c @@ -152,7 +152,7 @@ static ftdm_status_t att_courtesy_vru(ftdm_channel_t *ftdmchan, sngisdn_transfer goto done; } if (strlen(val) > COURTESY_TRANSFER_MAX_DATA_SIZE) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Data exceeds max size (len:%d max:%d), cannot perform transfer\n", strlen(val), COURTESY_TRANSFER_MAX_DATA_SIZE); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Data exceeds max size (len:%"FTDM_SIZE_FMT" max:%d), cannot perform transfer\n", strlen(val), COURTESY_TRANSFER_MAX_DATA_SIZE); goto done; } memcpy(sngisdn_info->transfer_data.tdata.att_courtesy_vru.data, val, strlen(val)); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 87ba7ed728..61f3702265 100755 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -910,7 +910,7 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t } if (!ftdmchan->iostats.tx.packets) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet write stats: Tx queue len: %d, Tx queue size: %d, Tx idle: %d\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet write stats: Tx queue len: %d, Tx queue size: %d, Tx idle: %"FTDM_UINT64_FMT"\n", ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size, ftdmchan->iostats.tx.idle_packets); @@ -956,11 +956,11 @@ static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx } if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length exceeded 80% threshold (%d/%d)\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length exceeded 80%% threshold (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length reduced 80% threshold (%d/%d)\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Rx Queue length reduced 80%% threshold (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } @@ -1516,10 +1516,10 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc if (fchan->dtmfdetect.duration_ms) { ftdm_time_t diff = ftdm_current_time_in_ms() - fchan->dtmfdetect.start_time; if (diff > fchan->dtmfdetect.duration_ms) { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c (duration:%d min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms); + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c (duration:%"FTDM_TIME_FMT" min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms); ftdm_channel_queue_dtmf(fchan, tmp_dtmf); } else { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c (duration:%d min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms); + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c (duration:%"FTDM_TIME_FMT" min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms); } } else if (!fchan->dtmfdetect.trigger_on_start) { ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); @@ -1617,7 +1617,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_FLASH); ftdm_set_flag_locked(span->channels[i], FTDM_CHANNEL_OFFHOOK); event_id = FTDM_OOB_OFFHOOK; - ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %llums, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); + ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %"FTDM_TIME_FMT" ms, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); goto event; } } @@ -1636,7 +1636,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); } - ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %llums, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); + ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %"FTDM_TIME_FMT" ms, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); goto event; } } From 6aebfe6a6043e2e96e2cbc0e6ced5929334e56e5 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 03:02:16 +0200 Subject: [PATCH 0681/1057] ftmod_wanpipe: Fix "initialization from incompatible pointer type" warning. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 2 +- 1 file changed, 1 insertion(+), 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 61f3702265..c26cbec02c 100755 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -124,7 +124,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event); static void wp_swap16(char *data, int datalen) { int i = 0; - uint16_t *samples = data; + uint16_t *samples = (uint16_t *)data; for (i = 0; i < datalen/2; i++) { uint16_t sample = ((samples[i] & 0x00FF) << 8) | ((samples[i] & 0xFF00) >> 8); samples[i] = sample; From da4b28c115d545a85056d2dc89141d6af603682c Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 03:18:52 +0200 Subject: [PATCH 0682/1057] FreeTDM: Cast flag to uint64_t and use FTDM_UINT64_FMT to silence format string warning. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/include/private/ftdm_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index d678efd8c8..6725f25655 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -214,7 +214,7 @@ extern "C" { ftdm_mutex_lock(obj->mutex); \ } \ if(!__safety) { \ - ftdm_log(FTDM_LOG_CRIT, "flag %d was never cleared\n", flag); \ + ftdm_log(FTDM_LOG_CRIT, "flag %"FTDM_UINT64_FMT" was never cleared\n", (uint64_t)flag); \ } \ } while(0); From ba1c27fec72ddd8c333a4466c7f3db93fb2fa646 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 03:20:47 +0200 Subject: [PATCH 0683/1057] ftmod_sangoma_ss7: Fix format string errors. Signed-off-by: Stefan Knoblich --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 8 ++++---- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c | 2 +- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c | 14 +++++++------- 3 files changed, 12 insertions(+), 12 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 dab2035450..24ea92e6db 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 @@ -293,9 +293,9 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE): handle_glare: /* the core already has plans for this channel...glare */ - SS7_INFO_CHAN(ftdmchan, "Got IAM on channel that is already inuse (state=%s|inuse=%d)...glare!\n", + SS7_INFO_CHAN(ftdmchan, "Got IAM on channel that is already inuse (state=%s|inuse=%c)...glare!\n", ftdm_channel_state2str (ftdmchan->state), - ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)); + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) ? 'Y' : 'N'); /* save the info so that we can use it later on */ sngss7_info->glare.spInstId = spInstId; @@ -739,7 +739,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ * ITU Q.784 Test Number 3.8 * Collision of REL messages */ - SS7_DEBUG_CHAN(ftdmchan, "Collision of REL messages. Rx REL while waiting for RLC.\n", " "); + SS7_DEBUG_CHAN(ftdmchan, "Collision of REL messages. Rx REL while waiting for RLC.%s\n", " "); if (sngss7_test_ckt_flag(sngss7_info, FLAG_LOCAL_REL) && !sngss7_test_ckt_flag (sngss7_info, FLAG_REMOTE_REL)) { /* locally requested hangup completed, wait for remote RLC */ @@ -1897,7 +1897,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* go to DOWN */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } else { - SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #, dropping\n", sngss7_info->circuit->cic); + SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #%d, dropping\n", sngss7_info->circuit->cic); } break; 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 bddcd39eca..cdedf791ce 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 @@ -280,7 +280,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 : %d\n", + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %s\n", buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event), DECODE_DISC_REASON(sta->t.usta.evntParm[1])); 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 613ad6d95e..457964a95f 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 @@ -319,7 +319,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\" \n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \"%s\"\n", val); sngss7_add_var(sngss7_info, "ss7_gn_numqual", val); } @@ -2454,7 +2454,7 @@ ftdm_status_t sngss7_save_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt) goto done; } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Compressed IAM size:%d\n", len); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Compressed IAM size:%lu\n", len); /* Worst case: size will triple after url encode */ url_encoded_iam = ftdm_malloc(3*sizeof(*siConEvnt)); @@ -2468,10 +2468,10 @@ ftdm_status_t sngss7_save_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt) /* URL encode buffer to that its safe to store it in a string */ ftdm_url_encode((const char*)compressed_iam, url_encoded_iam, len); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "IAM variable length:%d\n", strlen(url_encoded_iam)); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "IAM variable length:%"FTDM_SIZE_FMT"\n", strlen(url_encoded_iam)); if (strlen(url_encoded_iam) > g_ftdm_sngss7_data.cfg.transparent_iam_max_size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "IAM variable length exceeds max size (len:%d max:%d) \n", strlen(url_encoded_iam), g_ftdm_sngss7_data.cfg.transparent_iam_max_size); + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "IAM variable length exceeds max size (len:%"FTDM_SIZE_FMT" max:%d) \n", strlen(url_encoded_iam), g_ftdm_sngss7_data.cfg.transparent_iam_max_size); ret_val = FTDM_FAIL; goto done; } @@ -2505,10 +2505,10 @@ ftdm_status_t sngss7_retrieve_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt url_encoded_iam = ftdm_strdup(val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "IAM variable length:%d\n", strlen(val)); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "IAM variable length:%"FTDM_SIZE_FMT"\n", strlen(val)); ftdm_url_decode(url_encoded_iam, &url_encoded_iam_len); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Compressed IAM size:%d\n", url_encoded_iam_len); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Compressed IAM size:%"FTDM_SIZE_FMT"\n", url_encoded_iam_len); uncompressed_buffer = ftdm_malloc(sizeof(*siConEvnt)); ftdm_assert_return(uncompressed_buffer, FTDM_FAIL, "Failed to allocate buffer for uncompressed buffer\n"); @@ -2520,7 +2520,7 @@ ftdm_status_t sngss7_retrieve_iam(ftdm_channel_t *ftdmchan, SiConEvnt *siConEvnt } if (len != sizeof(*siConEvnt)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Incompatible IAM structure size (expected:%d size:%d)\n", sizeof(*siConEvnt), strlen(uncompressed_buffer)); + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Incompatible IAM structure size (expected:%"FTDM_SIZE_FMT" size:%"FTDM_SIZE_FMT")\n", sizeof(*siConEvnt), strlen(uncompressed_buffer)); goto done; } From 95c20425a899fe2ffc078abb93d60e526b5359c0 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 03:25:12 +0200 Subject: [PATCH 0684/1057] FreeSWITCH: Use SWITCH_TIME_T_FMT to fix format string error in send_heartbeat(). Signed-off-by: Stefan Knoblich --- src/switch_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core.c b/src/switch_core.c index 3be5f0d818..43b13b48c4 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -83,7 +83,7 @@ static void send_heartbeat(void) duration.ms, duration.ms == 1 ? "" : "s", duration.mms, duration.mms == 1 ? "" : "s"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Version", SWITCH_VERSION_FULL); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Uptime-msec", "%lu", switch_core_uptime() / 1000); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Uptime-msec", "%"SWITCH_TIME_T_FMT, switch_core_uptime() / 1000); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Count", "%u", switch_core_session_count()); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Max-Sessions", "%u", switch_core_session_limit(0)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Per-Sec", "%u", runtime.sps); From fc5490f1dc1e54787b7c8ff3c6d1ee34c026d06e Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 11 Jul 2012 22:31:36 -0500 Subject: [PATCH 0685/1057] FS-4415 --resolve --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d72374db78..47e02d99bc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1053,7 +1053,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting RTCP src-1 LENGTH to %d (%d, %s)\n", sr->sr_desc_ssrc.length, sr->sr_desc_head.length, str_cname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Setting msw = %d, lsw = %d \n", sr->ntp_msw, sr->ntp_lsw); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %ld, now lo = %d, now hi = %d\n", (int64_t)when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "now = %"SWITCH_TIME_T_FMT", now lo = %d, now hi = %d\n", when, (int32_t)(when&0xFFFFFFFF), (int32_t)((when>>32&0xFFFFFFFF))); rtcp_bytes = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_senderinfo) + sr->sr_desc_ssrc.length -1 ; rtp_session->rtcp_send_msg.header.length = htons((u_short)(rtcp_bytes / 4) - 1); From 435f28cefb513145d16484323d33caf78ef5ab99 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 10:02:09 +0200 Subject: [PATCH 0686/1057] FreeSWITCH: Fix copy&paste error in -storage cmdline option handling. "htdocs_dir" -> "storage_dir" Signed-off-by: Stefan Knoblich --- src/switch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch.c b/src/switch.c index c8342257c2..3fddcb4693 100644 --- a/src/switch.c +++ b/src/switch.c @@ -788,7 +788,7 @@ int main(int argc, char *argv[]) return 255; } - SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1); + SWITCH_GLOBAL_dirs.storage_dir = (char *) malloc(strlen(local_argv[x]) + 1); if (!SWITCH_GLOBAL_dirs.storage_dir) { fprintf(stderr, "Allocation error\n"); return 255; From 03a219772c9387209682a4bf39d88ab77791b096 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 12:41:23 +0200 Subject: [PATCH 0687/1057] ftmod_gsm: Fix format string errors. Two fixes: Use ftdm_set_string() instead of sprintf() (seriously, wtf?). Drop invalid, needless argument to ftdm_log(). Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index 35a7be22bb..a787a2b9eb 100755 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -718,7 +718,7 @@ static ftdm_status_t ftdm_gsm_state_advance(ftdm_channel_t *ftdmchan) gsm_data->call_id = g_outbound_call_id++; wat_con_event_t con_event; memset(&con_event, 0, sizeof(con_event)); - sprintf(con_event.called_num.digits, ftdmchan->caller_data.dnis.digits); + ftdm_set_string(con_event.called_num.digits, ftdmchan->caller_data.dnis.digits); ftdm_log(FTDM_LOG_DEBUG, "Dialing number %s\n", con_event.called_num.digits); wat_con_req(ftdmchan->span->span_id, gsm_data->call_id , &con_event); @@ -945,7 +945,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) var = ftdm_parameters[paramindex].var; val = ftdm_parameters[paramindex].val; if (!ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_WARNING, "Ignoring empty GSM parameter %s for span %s\n", var, val, span->name); + ftdm_log(FTDM_LOG_WARNING, "Ignoring empty GSM parameter %s for span %s\n", var, span->name); continue; } ftdm_log(FTDM_LOG_DEBUG, "Reading GSM parameter %s=%s for span %s\n", var, val, span->name); From d5d6b298939e71c595adeb7c13890ba971465195 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 10:42:46 -0500 Subject: [PATCH 0688/1057] add outcall-templ --- .../mod_conference/mod_conference.c | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 0525a5031a..b013530bf0 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -291,6 +291,7 @@ typedef struct conference_obj { char *special_announce; char *auto_record; char *record_filename; + char *outcall_templ; uint32_t terminate_on_silence; uint32_t max_members; uint32_t doc_version; @@ -1311,10 +1312,10 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_channel_set_variable(channel, CONFERENCE_UUID_VARIABLE, conference->uuid_str); - if (!switch_channel_get_variable(channel, "conference_dial_str")) { + if (!switch_channel_get_variable(channel, "conference_call_key")) { char *key = switch_core_session_sprintf(member->session, "conf_%s_%s_%s", conference->name, conference->domain, switch_channel_get_variable(channel, "caller_id_number")); - switch_channel_set_variable(channel, "conference_dial_str", key); + switch_channel_set_variable(channel, "conference_call_key", key); } @@ -1532,7 +1533,7 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe conference_send_presence(conference); - switch_channel_set_variable(channel, "conference_dial_str", NULL); + switch_channel_set_variable(channel, "conference_call_key", NULL); if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min) || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0)) { @@ -7500,6 +7501,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c char *conference_flags = NULL; char *perpetual_sound = NULL; char *moh_sound = NULL; + char *outcall_templ = NULL; uint32_t max_members = 0; uint32_t announce_count = 0; char *maxmember_sound = NULL; @@ -7618,6 +7620,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c tts_voice = val; } else if (!strcasecmp(var, "enter-sound") && !zstr(val)) { enter_sound = val; + } else if (!strcasecmp(var, "outcall-templ") && !zstr(val)) { + outcall_templ = val; } else if (!strcasecmp(var, "exit-sound") && !zstr(val)) { exit_sound = val; } else if (!strcasecmp(var, "alone-sound") && !zstr(val)) { @@ -7784,6 +7788,9 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number); conference->caller_controls = switch_core_strdup(conference->pool, caller_controls); conference->moderator_controls = switch_core_strdup(conference->pool, moderator_controls); + if (outcall_templ) { + conference->outcall_templ = switch_core_strdup(conference->pool, outcall_templ); + } conference->run_time = switch_epoch_time_now(NULL); if (!zstr(conference_log_dir)) { @@ -8079,11 +8086,12 @@ static void call_setup_event_handler(switch_event_t *event) if (!zstr(conf) && !zstr(dial_str) && !zstr(action) && (conference = conference_find(conf, domain))) { switch_event_t *var_event; switch_event_header_t *hp; - char *key = NULL; - - key = switch_mprintf("conf_%s_%s_%s", conference->name, conference->domain, ext); + if (switch_test_flag(conference, CFLAG_RFC4579)) { + char *key = switch_mprintf("conf_%s_%s_%s", conference->name, conference->domain, ext); + char *expanded = NULL, *ostr = dial_str;; + if (!strcasecmp(action, "call")) { if (switch_event_create_plain(&var_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) { @@ -8096,17 +8104,32 @@ static void call_setup_event_handler(switch_event_t *event) } } - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_dial_str", key); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_call_key", key); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_destination_number", ext); - conference_outcall_bg(conference, NULL, NULL, dial_str, 60, NULL, NULL, NULL, NULL, NULL, NULL, &var_event); + if (!strncasecmp(ostr, "url+", 4)) { + ostr += 4; + } else if (conference->outcall_templ) { + if ((expanded = switch_event_expand_headers(var_event, conference->outcall_templ))) { + ostr = expanded; + } + } + conference_outcall_bg(conference, NULL, NULL, ostr, 60, NULL, NULL, NULL, NULL, NULL, NULL, &var_event); + + if (expanded && expanded != conference->outcall_templ) { + switch_safe_free(expanded); + } + } else if (!strcasecmp(action, "end")) { - //switch_core_session_hupall_matching_var("conference_dial_str", key, SWITCH_CAUSE_NORMAL_CLEARING); - kickall_matching_var(conference, "conference_dial_str", key); + //switch_core_session_hupall_matching_var("conference_call_key", key, SWITCH_CAUSE_NORMAL_CLEARING); + kickall_matching_var(conference, "conference_call_key", key); } + + switch_safe_free(key); } - switch_safe_free(key); + switch_thread_rwlock_unlock(conference->rwlock); } From d141de28eaa18882f8aba0a1b69d0e61430cd264 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 19:52:00 +0200 Subject: [PATCH 0689/1057] freeswitch: Add -base cmdline option. Signed-off-by: Stefan Knoblich --- src/switch.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/switch.c b/src/switch.c index 3fddcb4693..4f25701671 100644 --- a/src/switch.c +++ b/src/switch.c @@ -365,6 +365,7 @@ static const char usage[] = #endif "\t-c -- output to a console and stay in the foreground\n" "\n\tOptions to control locations of files:\n" + "\t-base [basedir] -- alternate prefix directory\n" "\t-conf [confdir] -- alternate directory for FreeSWITCH configuration files\n" "\t-log [logdir] -- alternate directory for logfiles\n" "\t-run [rundir] -- alternate directory for runtime files\n" @@ -766,6 +767,21 @@ int main(int argc, char *argv[]) strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, local_argv[x]); } + else if (!strcmp(local_argv[x], "-base")) { + x++; + if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { + fprintf(stderr, "When using -base you must specify a base directory\n"); + return 255; + } + + SWITCH_GLOBAL_dirs.base_dir = (char *) malloc(strlen(local_argv[x]) + 1); + if (!SWITCH_GLOBAL_dirs.base_dir) { + fprintf(stderr, "Allocation error\n"); + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.base_dir, local_argv[x]); + } + else if (!strcmp(local_argv[x], "-temp")) { x++; if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) { From 391d498cbe4dd682c70e6299495def9e8b695d8f Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 14:45:38 +0200 Subject: [PATCH 0690/1057] ftmod_r2: Fix format string errors. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 6 +++--- 1 file changed, 3 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 8333a306c4..b74d5b003c 100755 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1557,10 +1557,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) intval = atoi(val); if (intval < 0) { r2conf.mf_dump_size = FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with default mf_dump_size = %d bytes\n", span->name, r2conf.mf_dump_size); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with default mf_dump_size = %"FTDM_SIZE_FMT" bytes\n", span->name, r2conf.mf_dump_size); } else { r2conf.mf_dump_size = intval; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with mf_dump_size = %d bytes\n", span->name, r2conf.mf_dump_size); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with mf_dump_size = %"FTDM_SIZE_FMT" bytes\n", span->name, r2conf.mf_dump_size); } } else if (!strcasecmp(var, "allow_collect_calls")) { r2conf.allow_collect_calls = ftdm_true(val); @@ -1970,7 +1970,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) r2data->monitor_thread_id = syscall(SYS_gettid); #endif - ftdm_log(FTDM_LOG_DEBUG, "OpenR2 monitor thread %lu started.\n", r2data->monitor_thread_id); + ftdm_log(FTDM_LOG_DEBUG, "OpenR2 monitor thread %u started.\n", r2data->monitor_thread_id); r2chan = NULL; chaniter = ftdm_span_get_chan_iterator(span, NULL); if (!chaniter) { From de4bf23d591ec34e83c09e463b297e414eb8b271 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 12 Jul 2012 14:52:42 +0200 Subject: [PATCH 0691/1057] ftmod_pritap: Fix format string errors. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c index 29c7860220..f136d59d9c 100644 --- a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c +++ b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c @@ -782,7 +782,7 @@ static ftdm_status_t ftdm_pritap_sig_read(ftdm_channel_t *ftdmchan, void *data, return FTDM_FAIL; } if (sizeread != size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "read from peer channel only %d bytes!\n", sizeread); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "read from peer channel only %"FTDM_SIZE_FMT" bytes!\n", sizeread); return FTDM_FAIL; } @@ -854,7 +854,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span) } if (!dchan) { - ftdm_log(FTDM_LOG_ERROR, "No d-channel specified in freetdm.conf!\n", ftdm_trunk_type2str(span->trunk_type)); + ftdm_log(FTDM_LOG_ERROR, "No d-channel specified in freetdm.conf!\n"); return FTDM_FAIL; } From f5fe8bc5f6db07273ec18ae7c1bdc0bf7f8f9f68 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 14:01:19 -0500 Subject: [PATCH 0692/1057] close fd on fsv_record --- src/mod/applications/mod_fsv/mod_fsv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 1c09365175..5c52a352df 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -273,6 +273,11 @@ SWITCH_STANDARD_APP(record_fsv_function) } } + if (fd > -1) { + close(fd); + } + + switch_core_session_set_read_codec(session, NULL); switch_core_codec_destroy(&codec); From cc48015709919db8ed06468c4eefd46cef46ef60 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 14:30:18 -0500 Subject: [PATCH 0693/1057] conf tweaks --- .../mod_conference/mod_conference.c | 29 +++++++++++++++---- src/mod/endpoints/mod_sofia/sofia.c | 1 + 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index b013530bf0..16e22e4039 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -681,16 +681,31 @@ static char *conference_rfc4579_render(conference_obj_t *conference, switch_even for (np = conference->cdr_nodes; np; np = np->next) { char *user_uri; + switch_channel_t *channel = NULL; if (!np->cp || (np->member && !np->member->session) || np->leave_time) { /* for now we'll remove participants when the leave */ continue; } + if (np->member && np->member->session) { + channel = switch_core_session_get_channel(np->member->session); + } + if (!(x_tag1 = switch_xml_add_child_d(x_tag, "user", off1++))) { abort(); } - user_uri = switch_mprintf("sip:%s@%s", np->cp->caller_id_number, domain); + if (channel) { + const char *uri = switch_channel_get_variable_dup(channel, "conference_invite_uri", SWITCH_FALSE, -1); + + if (uri) { + user_uri = strdup(uri); + } + } + + if (!user_uri) { + user_uri = switch_mprintf("sip:%s@%s", np->cp->caller_id_number, domain); + } switch_xml_set_attr_d(x_tag1, "state", "full"); @@ -707,7 +722,6 @@ static char *conference_rfc4579_render(conference_obj_t *conference, switch_even } switch_xml_set_attr_d(x_tag2, "entity", user_uri); - if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "display-text", off3++))) { abort(); } @@ -751,8 +765,11 @@ static char *conference_rfc4579_render(conference_obj_t *conference, switch_even */ if (np->member) { - switch_channel_t *channel = switch_core_session_get_channel(np->member->session); const char *var; + //char buf[1024]; + + //switch_snprintf(buf, sizeof(buf), "conf_%s_%s_%s", conference->name, conference->domain, np->cp->caller_id_number); + //switch_channel_set_variable(channel, "conference_call_key", buf); if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "media", off3++))) { abort(); @@ -8077,16 +8094,16 @@ static void call_setup_event_handler(switch_event_t *event) char *conf = switch_event_get_header(event, "Target-Component"); char *domain = switch_event_get_header(event, "Target-Domain"); char *dial_str = switch_event_get_header(event, "Request-Target"); + char *dial_uri = switch_event_get_header(event, "Request-Target-URI"); char *action = switch_event_get_header(event, "Request-Action"); char *ext = switch_event_get_header(event, "Request-Target-Extension"); - + if (!ext) ext = dial_str; if (!zstr(conf) && !zstr(dial_str) && !zstr(action) && (conference = conference_find(conf, domain))) { switch_event_t *var_event; switch_event_header_t *hp; - if (switch_test_flag(conference, CFLAG_RFC4579)) { char *key = switch_mprintf("conf_%s_%s_%s", conference->name, conference->domain, ext); @@ -8107,6 +8124,8 @@ static void call_setup_event_handler(switch_event_t *event) switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_call_key", key); switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_destination_number", ext); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_invite_uri", dial_uri); + if (!strncasecmp(ostr, "url+", 4)) { ostr += 4; } else if (conference->outcall_templ) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 49bdb95534..59f8a41984 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1235,6 +1235,7 @@ static void our_sofia_event_callback(nua_event_t event, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Target-Domain", req_host); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Action", action); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Target", "sofia/%s/%s", profile->name, refer_to); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Target-URI", "%s", refer_to); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Extension", ref_to_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Domain", ref_to_host); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Sender", "sofia/%s/%s", profile->name, referred_by); From 46fee25dadc5d40731fda6f19569ad4080579575 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 14:30:37 -0500 Subject: [PATCH 0694/1057] add fsctl sql start/stop for standby controls --- src/include/switch_core.h | 2 + src/include/switch_types.h | 1 + .../applications/mod_commands/mod_commands.c | 10 + src/switch_core.c | 7 + src/switch_core_sqldb.c | 239 ++++++++++++------ 5 files changed, 176 insertions(+), 83 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index d7e899e6e7..ae7e621539 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2149,6 +2149,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *dest_proto, sw SWITCH_DECLARE(switch_status_t) switch_core_chat_deliver(const char *dest_proto, switch_event_t **message_event); SWITCH_DECLARE(switch_status_t) switch_ivr_preprocess_session(switch_core_session_t *session, const char *cmds); +SWITCH_DECLARE(void) switch_core_sqldb_stop_thread(void); +SWITCH_DECLARE(void) switch_core_sqldb_start_thread(void); ///\} diff --git a/src/include/switch_types.h b/src/include/switch_types.h index eaf65d1c2d..86c7ab2f06 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1775,6 +1775,7 @@ typedef enum { SCSC_THREADED_SYSTEM_EXEC, SCSC_SYNC_CLOCK_WHEN_IDLE, SCSC_DEBUG_SQL, + SCSC_SQL, } switch_session_ctl_t; typedef enum { diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index d0399fcb42..21a1cb3138 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1915,6 +1915,16 @@ SWITCH_STANDARD_API(ctl_function) switch_core_session_ctl(SCSC_DEBUG_SQL, &x); stream->write_function(stream, "+OK SQL DEBUG [%s]\n", x ? "on" : "off"); + } else if (!strcasecmp(argv[0], "sql")) { + if (argv[1]) { + int x = 0; + if (!strcasecmp(argv[1], "start")) { + x = 1; + } + switch_core_session_ctl(SCSC_SQL, &x); + stream->write_function(stream, "+OK\n"); + } + } else if (!strcasecmp(argv[0], "reclaim_mem")) { switch_core_session_ctl(SCSC_RECLAIM, &arg); stream->write_function(stream, "+OK\n"); diff --git a/src/switch_core.c b/src/switch_core.c index 43b13b48c4..789b2d2c12 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2125,6 +2125,13 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void * case SCSC_SYNC_CLOCK_WHEN_IDLE: newintval = switch_core_session_sync_clock(); break; + case SCSC_SQL: + if (oldintval) { + switch_core_sqldb_start_thread(); + } else { + switch_core_sqldb_stop_thread(); + } + break; case SCSC_PAUSE_ALL: if (oldintval) { switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 267e82fd5f..90a88e59b5 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -66,11 +66,13 @@ static struct { switch_bool_t manage; switch_mutex_t *io_mutex; switch_mutex_t *dbh_mutex; + switch_mutex_t *ctl_mutex; switch_cache_db_handle_t *handle_pool; switch_thread_cond_t *cond; switch_mutex_t *cond_mutex; uint32_t total_handles; uint32_t total_used_handles; + switch_cache_db_handle_t *dbh; } sql_manager; @@ -1957,7 +1959,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force) switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_t manage) { switch_threadattr_t *thd_attr; - switch_cache_db_handle_t *dbh; uint32_t sanity = 400; sql_manager.memory_pool = pool; @@ -1966,15 +1967,18 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_mutex_init(&sql_manager.dbh_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); switch_mutex_init(&sql_manager.io_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); switch_mutex_init(&sql_manager.cond_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); + switch_mutex_init(&sql_manager.ctl_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); switch_thread_cond_create(&sql_manager.cond, sql_manager.memory_pool); - top: + if (!sql_manager.manage) goto skip; + top: + /* Activate SQL database */ - if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) { + if (switch_core_db_handle(&sql_manager.dbh) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB!\n"); if (switch_test_flag((&runtime), SCF_CORE_ODBC_REQ)) { @@ -1999,7 +2003,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening DB\n"); - switch (dbh->type) { + switch (sql_manager.dbh->type) { case SCDB_TYPE_ODBC: if (switch_test_flag((&runtime), SCF_CLEAR_SQL)) { char sql[512] = ""; @@ -2009,61 +2013,61 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ for (i = 0; tables[i]; i++) { switch_snprintfv(sql, sizeof(sql), "delete from %q where hostname='%q'", tables[i], hostname); - switch_cache_db_execute_sql(dbh, sql, NULL); + switch_cache_db_execute_sql(sql_manager.dbh, sql, NULL); } } break; case SCDB_TYPE_CORE_DB: { - switch_cache_db_execute_sql(dbh, "drop table channels", NULL); - switch_cache_db_execute_sql(dbh, "drop table calls", NULL); - switch_cache_db_execute_sql(dbh, "drop view detailed_calls", NULL); - switch_cache_db_execute_sql(dbh, "drop view basic_calls", NULL); - switch_cache_db_execute_sql(dbh, "drop table interfaces", NULL); - switch_cache_db_execute_sql(dbh, "drop table tasks", NULL); - switch_cache_db_execute_sql(dbh, "PRAGMA synchronous=OFF;", NULL); - switch_cache_db_execute_sql(dbh, "PRAGMA count_changes=OFF;", NULL); - switch_cache_db_execute_sql(dbh, "PRAGMA default_cache_size=8000", NULL); - switch_cache_db_execute_sql(dbh, "PRAGMA temp_store=MEMORY;", NULL); - switch_cache_db_execute_sql(dbh, "PRAGMA journal_mode=OFF;", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "drop table channels", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "drop table calls", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "drop view detailed_calls", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "drop view basic_calls", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "drop table interfaces", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "drop table tasks", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "PRAGMA synchronous=OFF;", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "PRAGMA count_changes=OFF;", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "PRAGMA default_cache_size=8000", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "PRAGMA temp_store=MEMORY;", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "PRAGMA journal_mode=OFF;", NULL); } break; } - switch_cache_db_test_reactive(dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql); - switch_cache_db_test_reactive(dbh, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql); - switch_cache_db_test_reactive(dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql); - switch_cache_db_test_reactive(dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", + switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", "DROP TABLE registrations", create_registrations_sql); - switch_cache_db_test_reactive(dbh, "select metadata from registrations", NULL, "ALTER TABLE registrations ADD COLUMN metadata VARCHAR(256)"); + switch_cache_db_test_reactive(sql_manager.dbh, "select metadata from registrations", NULL, "ALTER TABLE registrations ADD COLUMN metadata VARCHAR(256)"); - switch (dbh->type) { + switch (sql_manager.dbh->type) { case SCDB_TYPE_ODBC: { char *err; - switch_cache_db_test_reactive(dbh, "select call_uuid, read_bit_rate, sent_callee_name from channels", "DROP TABLE channels", create_channels_sql); - switch_cache_db_test_reactive(dbh, "select * from detailed_calls where sent_callee_name=''", "DROP VIEW detailed_calls", detailed_calls_sql); - switch_cache_db_test_reactive(dbh, "select * from basic_calls where sent_callee_name=''", "DROP VIEW basic_calls", basic_calls_sql); - switch_cache_db_test_reactive(dbh, "select call_uuid from calls", "DROP TABLE calls", create_calls_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select call_uuid, read_bit_rate, sent_callee_name from channels", "DROP TABLE channels", create_channels_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select * from detailed_calls where sent_callee_name=''", "DROP VIEW detailed_calls", detailed_calls_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select * from basic_calls where sent_callee_name=''", "DROP VIEW basic_calls", basic_calls_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select call_uuid from calls", "DROP TABLE calls", create_calls_sql); if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { - switch_cache_db_test_reactive(dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", + switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", "DROP TABLE registrations", create_registrations_sql); } else { char *tmp = switch_string_replace(create_registrations_sql, "url TEXT", "url VARCHAR(max)"); - switch_cache_db_test_reactive(dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", + switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", "DROP TABLE registrations", tmp); free(tmp); } - switch_cache_db_test_reactive(dbh, "select ikey from interfaces", "DROP TABLE interfaces", create_interfaces_sql); - switch_cache_db_test_reactive(dbh, "select hostname from tasks", "DROP TABLE tasks", create_tasks_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select ikey from interfaces", "DROP TABLE interfaces", create_interfaces_sql); + switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from tasks", "DROP TABLE tasks", create_tasks_sql); if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { - switch_cache_db_execute_sql(dbh, "begin;delete from channels where hostname='';delete from channels where hostname='';commit;", &err); + switch_cache_db_execute_sql(sql_manager.dbh, "begin;delete from channels where hostname='';delete from channels where hostname='';commit;", &err); } else { - switch_cache_db_execute_sql(dbh, "delete from channels where hostname='';delete from channels where hostname='';", &err); + switch_cache_db_execute_sql(sql_manager.dbh, "delete from channels where hostname='';delete from channels where hostname='';", &err); } if (err) { @@ -2071,7 +2075,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ runtime.odbc_user = NULL; runtime.odbc_pass = NULL; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Transactions not supported on your DB, disabling ODBC\n"); - switch_cache_db_release_db_handle(&dbh); + switch_cache_db_release_db_handle(&sql_manager.dbh); free(err); goto top; } @@ -2079,44 +2083,44 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ break; case SCDB_TYPE_CORE_DB: { - switch_cache_db_execute_sql(dbh, create_channels_sql, NULL); - switch_cache_db_execute_sql(dbh, create_calls_sql, NULL); - switch_cache_db_execute_sql(dbh, create_interfaces_sql, NULL); - switch_cache_db_execute_sql(dbh, create_tasks_sql, NULL); - switch_cache_db_execute_sql(dbh, detailed_calls_sql, NULL); - switch_cache_db_execute_sql(dbh, basic_calls_sql, NULL); + switch_cache_db_execute_sql(sql_manager.dbh, create_channels_sql, NULL); + switch_cache_db_execute_sql(sql_manager.dbh, create_calls_sql, NULL); + switch_cache_db_execute_sql(sql_manager.dbh, create_interfaces_sql, NULL); + switch_cache_db_execute_sql(sql_manager.dbh, create_tasks_sql, NULL); + switch_cache_db_execute_sql(sql_manager.dbh, detailed_calls_sql, NULL); + switch_cache_db_execute_sql(sql_manager.dbh, basic_calls_sql, NULL); } break; } - switch_cache_db_execute_sql(dbh, "delete from complete where sticky=0", NULL); - switch_cache_db_execute_sql(dbh, "delete from aliases where sticky=0", NULL); - switch_cache_db_execute_sql(dbh, "delete from nat where sticky=0", NULL); - switch_cache_db_execute_sql(dbh, "create index alias1 on aliases (alias)", NULL); - switch_cache_db_execute_sql(dbh, "create index tasks1 on tasks (hostname,task_id)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete1 on complete (a1,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete2 on complete (a2,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete3 on complete (a3,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete4 on complete (a4,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete5 on complete (a5,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete6 on complete (a6,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete7 on complete (a7,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete8 on complete (a8,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete9 on complete (a9,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete10 on complete (a10,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index complete11 on complete (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index nat_map_port_proto on nat (port,proto,hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index channels1 on channels(hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index calls1 on calls(hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index chidx1 on channels (hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index uuindex on channels (uuid)", NULL); - switch_cache_db_execute_sql(dbh, "create index uuindex2 on channels (call_uuid)", NULL); - switch_cache_db_execute_sql(dbh, "create index callsidx1 on calls (hostname)", NULL); - switch_cache_db_execute_sql(dbh, "create index eruuindex on calls (caller_uuid)", NULL); - switch_cache_db_execute_sql(dbh, "create index eeuuindex on calls (callee_uuid)", NULL); - switch_cache_db_execute_sql(dbh, "create index eeuuindex2 on calls (call_uuid)", NULL); - switch_cache_db_execute_sql(dbh, "create index regindex1 on registrations (reg_user,realm,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "delete from complete where sticky=0", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "delete from aliases where sticky=0", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "delete from nat where sticky=0", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index alias1 on aliases (alias)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index tasks1 on tasks (hostname,task_id)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete1 on complete (a1,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete2 on complete (a2,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete3 on complete (a3,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete4 on complete (a4,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete5 on complete (a5,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete6 on complete (a6,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete7 on complete (a7,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete8 on complete (a8,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete9 on complete (a9,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete10 on complete (a10,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index complete11 on complete (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index nat_map_port_proto on nat (port,proto,hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index channels1 on channels(hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index calls1 on calls(hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index chidx1 on channels (hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index uuindex on channels (uuid)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index uuindex2 on channels (call_uuid)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index callsidx1 on calls (hostname)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index eruuindex on calls (caller_uuid)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index eeuuindex on calls (callee_uuid)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index eeuuindex2 on calls (call_uuid)", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "create index regindex1 on registrations (reg_user,realm,hostname)", NULL); skip: @@ -2156,38 +2160,107 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_threadattr_create(&thd_attr, sql_manager.memory_pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - if (sql_manager.manage) { - switch_thread_create(&sql_manager.thread, thd_attr, switch_core_sql_thread, NULL, sql_manager.memory_pool); - } + + switch_core_sqldb_start_thread(); switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool); while (sql_manager.manage && !sql_manager.thread_running && --sanity) { switch_yield(10000); } - if (sql_manager.manage) switch_cache_db_release_db_handle(&dbh); - return SWITCH_STATUS_SUCCESS; } + + +SWITCH_DECLARE(void) switch_core_sqldb_stop_thread(void) +{ + switch_mutex_lock(sql_manager.ctl_mutex); + if (sql_manager.thread && sql_manager.thread_running) { + switch_status_t st; + + if (sql_manager.manage) { + switch_queue_push(sql_manager.sql_queue[0], NULL); + switch_queue_push(sql_manager.sql_queue[1], NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n"); + wake_thread(0); + sql_manager.thread_running = -1; + switch_thread_join(&st, sql_manager.thread); + sql_manager.thread = NULL; + switch_cache_db_release_db_handle(&sql_manager.dbh); + sql_manager.dbh = NULL; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL is not enabled\n"); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL thread is not running\n"); + } + switch_mutex_unlock(sql_manager.ctl_mutex); +} + +SWITCH_DECLARE(void) switch_core_sqldb_start_thread(void) +{ + switch_mutex_lock(sql_manager.ctl_mutex); + + if (sql_manager.manage) { + + top: + + if (!sql_manager.dbh) { + /* Activate SQL database */ + if (switch_core_db_handle(&sql_manager.dbh) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB!\n"); + + if (switch_test_flag((&runtime), SCF_CORE_ODBC_REQ)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure! ODBC IS REQUIRED!\n"); + goto end; + } + + if (runtime.odbc_dsn) { + runtime.odbc_dsn = NULL; + runtime.odbc_user = NULL; + runtime.odbc_pass = NULL; + runtime.odbc_dbtype = DBTYPE_DEFAULT; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Falling back to core_db.\n"); + sql_manager.dbh = NULL; + goto top; + } + + + switch_clear_flag((&runtime), SCF_USE_SQL); + goto end; + } + + switch_cache_db_execute_sql(sql_manager.dbh, "delete from channels", NULL); + switch_cache_db_execute_sql(sql_manager.dbh, "delete from calls", NULL); + } + + + if (!sql_manager.thread) { + switch_threadattr_t *thd_attr; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting SQL thread.\n"); + switch_threadattr_create(&thd_attr, sql_manager.memory_pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&sql_manager.thread, thd_attr, switch_core_sql_thread, NULL, sql_manager.memory_pool); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL thread is already running\n"); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL is not enabled\n"); + } + + end: + + switch_mutex_unlock(sql_manager.ctl_mutex); +} + void switch_core_sqldb_stop(void) { switch_status_t st; switch_event_unbind_callback(core_event_handler); - if (sql_manager.thread && sql_manager.thread_running) { - - if (sql_manager.manage) { - switch_queue_push(sql_manager.sql_queue[0], NULL); - switch_queue_push(sql_manager.sql_queue[1], NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Waiting for unfinished SQL transactions\n"); - wake_thread(0); - } - - sql_manager.thread_running = -1; - switch_thread_join(&st, sql_manager.thread); - } + switch_core_sqldb_stop_thread(); if (sql_manager.thread && sql_manager.db_thread_running) { From 0dfb4db8b494754c84fc3bc8d06d5b9e8b4d45b6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 14:34:56 -0500 Subject: [PATCH 0695/1057] how does the older compiler catch things the new one doesnt --- 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 16e22e4039..cec868f204 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -680,7 +680,7 @@ static char *conference_rfc4579_render(conference_obj_t *conference, switch_even switch_mutex_lock(conference->member_mutex); for (np = conference->cdr_nodes; np; np = np->next) { - char *user_uri; + char *user_uri = NULL; switch_channel_t *channel = NULL; if (!np->cp || (np->member && !np->member->session) || np->leave_time) { /* for now we'll remove participants when the leave */ From 18a16e6931d4f0e1e1b923801dcfa5e8f7c3c71d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 17:45:43 -0500 Subject: [PATCH 0696/1057] FS-4335 test this patch, and also remember you must resubmit the logs after each new test --- src/mod/endpoints/mod_sofia/sofia.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 59f8a41984..5004fc8d27 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5691,7 +5691,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } } - /* Pure black magic, if you can't understand this code you are lucky.........*/ void *SWITCH_THREAD_FUNC media_on_hold_thread_run(switch_thread_t *thread, void *obj) { @@ -5704,10 +5703,12 @@ void *SWITCH_THREAD_FUNC media_on_hold_thread_run(switch_thread_t *thread, void if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) { if (switch_core_session_compare(session, other_session)) { + switch_channel_t *other_channel = switch_core_session_get_channel(other_session); sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK); - switch_yield(100000); + switch_yield(250000); switch_channel_wait_for_flag(channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL); + switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL); switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE); @@ -5738,6 +5739,8 @@ static void launch_media_on_hold(switch_core_session_t *session) switch_thread_create(&thread, thd_attr, media_on_hold_thread_run, session, switch_core_session_get_pool(session)); } + + static void mark_transfer_record(switch_core_session_t *session, const char *br_a, const char *br_b) { switch_core_session_t *br_b_session, *br_a_session; @@ -6342,9 +6345,11 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END()); } + + switch_channel_set_flag(channel, CF_PROXY_MODE); + switch_yield(250000); launch_media_on_hold(session); - switch_core_session_rwunlock(other_session); goto done; } } From 643a18b5839440fd5dad77f5f42338b9adf67eac Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 17:54:02 -0500 Subject: [PATCH 0697/1057] FS-4418 --resolve --- src/mod/applications/mod_conference/mod_conference.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index cec868f204..be40aa6a08 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4520,6 +4520,7 @@ static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_str switch_clear_flag_locked(member, MFLAG_TALKING); switch_set_flag(member, MFLAG_INDICATE_MUTE); + member->score_iir = 0; if (stream != NULL) { stream->write_function(stream, "OK mute %u\n", member->id); From ba6c404eb9501b517dac60a375bf944cfc4aeae3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Jul 2012 18:10:20 -0500 Subject: [PATCH 0698/1057] FS-4422 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 28 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index b2c47d97d3..e158e48318 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4611,15 +4611,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session switch_channel_set_variable(nchannel, "sip_route_uri", gateway_ptr->outbound_sticky_proxy); } - if (gateway_ptr->ob_vars) { - switch_event_header_t *hp; - for (hp = gateway_ptr->ob_vars->headers; hp; hp = hp->next) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n", - switch_channel_get_name(nchannel), hp->name, hp->value); - switch_channel_set_variable(nchannel, hp->name, hp->value); - } - } - } else { if (!(dest = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid URL\n"); @@ -4780,8 +4771,27 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session not_const = (char *) caller_profile->caller_id_number; caller_profile->caller_id_number = switch_sanitize_number(not_const); + //caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest_num); switch_channel_set_caller_profile(nchannel, caller_profile); + + + if (gateway_ptr && gateway_ptr->ob_vars) { + switch_event_header_t *hp; + for (hp = gateway_ptr->ob_vars->headers; hp; hp = hp->next) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n", + switch_channel_get_name(nchannel), hp->name, hp->value); + if (!strncmp(hp->name, "p:", 2)) { + switch_channel_set_profile_var(nchannel, hp->name + 2, hp->value); + } else { + switch_channel_set_variable(nchannel, hp->name, hp->value); + } + } + } + + + + sofia_set_flag_locked(tech_pvt, TFLAG_OUTBOUND); sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION); if (switch_channel_get_state(nchannel) == CS_NEW) { From 0afd7318bdb8de9be096bdf13f27beba971a5d68 Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 24 Mar 2012 14:09:57 -0700 Subject: [PATCH 0699/1057] adding write support to mod_vlc --- src/mod/formats/mod_vlc/mod_vlc.c | 134 +++++++++++++++++++++++++++--- 1 file changed, 121 insertions(+), 13 deletions(-) diff --git a/src/mod/formats/mod_vlc/mod_vlc.c b/src/mod/formats/mod_vlc/mod_vlc.c index 15dd6c1d95..592acb1ff0 100644 --- a/src/mod/formats/mod_vlc/mod_vlc.c +++ b/src/mod/formats/mod_vlc/mod_vlc.c @@ -29,10 +29,14 @@ * * Examples: * + * To playback from an audio source into a file: * File: vlc:///path/to/file * Stream: http://path.to.file.com:port/file.pls * Stream: vlc://ftp://path.to.file.com:port/file.mp3 * + * To stream from a call(channel) out to a remote destination: + * vlc://#transcode{acodec=vorb,channels=1,samplerate=16000}:standard{access=http,mux=ogg,dst=:8080/thing.ogg} + * * Notes: * * Requires at least libvlc version 1.2 @@ -42,15 +46,19 @@ #include #include -#define VLC_BUFFER_SIZE 4096 +#define VLC_BUFFER_SIZE 65536 static char *vlc_file_supported_formats[SWITCH_MAX_CODECS] = { 0 }; +typedef int (*imem_get_t)(void *data, const char *cookie, + int64_t *dts, int64_t *pts, unsigned *flags, + size_t *, void **); +typedef void (*imem_release_t)(void *data, const char *cookie, size_t, void *); + /* Change valud to -vvv for vlc related debug. Be careful since vlc is at least as verbose as FS about logging */ const char *vlc_args = ""; libvlc_instance_t *read_inst; -libvlc_instance_t *inst_out; struct vlc_file_context { libvlc_media_player_t *mp; @@ -63,8 +71,10 @@ struct vlc_file_context { char *path; int samples; int playing; + int samplerate; int err; int pts; + libvlc_instance_t *inst_out; }; typedef struct vlc_file_context vlc_file_context_t; @@ -74,6 +84,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_vlc_load); SWITCH_MODULE_DEFINITION(mod_vlc, mod_vlc_load, mod_vlc_shutdown, NULL); void vlc_auto_play_callback(void *data, const void *samples, unsigned count, int64_t pts) { + vlc_file_context_t *context = (vlc_file_context_t *) data; switch_mutex_lock(context->audio_mutex); @@ -88,8 +99,47 @@ void vlc_auto_play_callback(void *data, const void *samples, unsigned count, int switch_thread_cond_signal(context->started); } switch_mutex_unlock(context->audio_mutex); +} - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC callback for %s %d \n", context->path, count); +int vlc_imem_get_callback(void *data, const char *cookie, int64_t *dts, int64_t *pts, unsigned *flags, size_t *size, void **output) +{ + vlc_file_context_t *context = (vlc_file_context_t *) data; + int samples = 0; + int bytes = 0; + + switch_mutex_lock(context->audio_mutex); + + /* If the stream should no longer be sending audio */ + /* then pretend we have less than one sample of audio */ + /* so that libvlc will close the client connections */ + if ( context->playing == 0 && switch_buffer_inuse(context->audio_buffer) == 0 ) { + switch_mutex_unlock(context->audio_mutex); + return 1; + } + + samples = context->samples; + context->samples = 0; + + if ( samples ) { + bytes = samples * 2; + *output = malloc(bytes); + bytes = switch_buffer_read(context->audio_buffer, *output, bytes); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC imem samples: %d\n", samples); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC imem bytes: %d\n", bytes); + } else { + bytes = 128; + *output = malloc(bytes); + memset(*output, 0, bytes); + } + switch_mutex_unlock(context->audio_mutex); + + *size = (size_t) bytes; + return 0; +} + +void vlc_imem_release_callback(void *data, const char *cookie, size_t size, void *unknown) +{ + free(unknown); } static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *path) @@ -100,7 +150,8 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p context->pool = handle->memory_pool; context->path = switch_core_strdup(context->pool, path); - switch_buffer_create_dynamic(&(context->audio_buffer), VLC_BUFFER_SIZE, VLC_BUFFER_SIZE * 2, 0); + + switch_buffer_create_dynamic(&(context->audio_buffer), VLC_BUFFER_SIZE, VLC_BUFFER_SIZE * 8, 0); switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->pool); switch_thread_cond_create(&(context->started), context->pool); @@ -136,16 +187,49 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p if ( !handle->samplerate) handle->samplerate = 16000; - libvlc_audio_set_format(context->mp, "S16N", handle->samplerate, 1); + + context->samplerate = handle->samplerate; + + libvlc_audio_set_format(context->mp, "S16N", context->samplerate, 1); libvlc_audio_set_callbacks(context->mp, vlc_auto_play_callback, NULL,NULL,NULL,NULL, (void *) context); libvlc_media_player_play(context->mp); } else if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC does not yet support writing to a output stream"); - return SWITCH_STATUS_GENERR; + const char * opts[10] = { + vlc_args, + switch_mprintf("--sout=%s", path) + }; + int opts_count = 10; + + if ( !handle->samplerate) + handle->samplerate = 16000; + + context->samplerate = handle->samplerate; + opts[2] = switch_mprintf("--imem-get=%ld", vlc_imem_get_callback); + opts[3] = switch_mprintf("--imem-release=%ld", vlc_imem_release_callback); + opts[4] = switch_mprintf("--imem-cat=%d", 4); + opts[5] = "--demux=rawaud"; + opts[6] = "--rawaud-fourcc=s16l"; + opts[7] = switch_mprintf("--rawaud-samplerate=%d", context->samplerate); + opts[8] = switch_mprintf("--imem-data=%ld", context); + opts[9] = "--rawaud-channels=1"; + + /* Prepare to write to an output stream. */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC open %s for writing\n", path); + + /* load the vlc engine. */ + context->inst_out = libvlc_new(opts_count, opts); + + /* Tell VLC the audio will come from memory, and to use the callbacks to fetch it. */ + context->m = libvlc_media_new_location(context->inst_out, "imem/rawaud://"); + context->mp = libvlc_media_player_new_from_media(context->m); + context->samples = 0; + context->pts = 0; + context->playing = 1; + libvlc_media_player_play(context->mp); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC tried to open %s for unknown reason\n", path); return SWITCH_STATUS_GENERR; @@ -201,21 +285,46 @@ static switch_status_t vlc_file_read(switch_file_handle_t *handle, void *data, s return SWITCH_STATUS_SUCCESS; } +static switch_status_t vlc_file_write(switch_file_handle_t *handle, void *data, size_t *len) +{ + vlc_file_context_t *context = handle->private_info; + size_t bytes = *len * sizeof(int16_t); + + switch_mutex_lock(context->audio_mutex); + context->samples += *len; + switch_buffer_write(context->audio_buffer, data, bytes); + switch_mutex_unlock(context->audio_mutex); + + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t vlc_file_close(switch_file_handle_t *handle) { vlc_file_context_t *context = handle->private_info; - - libvlc_media_player_stop(context->mp); - libvlc_media_release(context->m); - + context->playing = 0; + /* The clients need to empty the last of the audio buffer */ + while ( switch_buffer_inuse(context->audio_buffer) > 0 ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC waiting to close the files: %d \n", (int) switch_buffer_inuse(context->audio_buffer)); + sleep(1); + } + + /* Let the clients get the last of the audio stream */ + while ( 3 == libvlc_media_get_state(context->m) ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC waiting for clients: %d \n", libvlc_media_get_state(context->m)); + sleep(1); + } + if( context->mp ) libvlc_media_player_stop(context->mp); if( context->m ) libvlc_media_release(context->m); + if ( context->inst_out != NULL ) + libvlc_release(context->inst_out); + return SWITCH_STATUS_SUCCESS; } @@ -235,6 +344,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_vlc_load) file_interface->file_open = vlc_file_open; file_interface->file_close = vlc_file_close; file_interface->file_read = vlc_file_read; + file_interface->file_write = vlc_file_write; /* load the vlc engine. */ read_inst = libvlc_new(1, &vlc_args); @@ -252,8 +362,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_vlc_shutdown) { if ( read_inst != NULL ) libvlc_release(read_inst); - if ( inst_out != NULL ) - libvlc_release(inst_out); return SWITCH_STATUS_SUCCESS; } From 4a801c8626e1f56bbad86fed1ab47cd021da0e2a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 13 Jul 2012 14:58:15 -0500 Subject: [PATCH 0700/1057] only decode rtp packets in srtp mode --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 47e02d99bc..adbda9ffe2 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2947,7 +2947,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t #endif #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtp_recv_msg.header.version == 2) { int sbytes = (int) *bytes; err_status_t stat = 0; @@ -3066,7 +3066,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t } #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtp_recv_msg.header.version == 2) { int sbytes = (int) *bytes; err_status_t stat = 0; From a217dec243270be056453d062c0ae446de623148 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Fri, 13 Jul 2012 14:55:10 -0700 Subject: [PATCH 0701/1057] Update phrase_en.xml (new sound files created) --- docs/phrase/phrase_en.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index e2e10650d3..2140cb5f16 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -561,10 +561,11 @@ - - - - + + + + + From aebb15fe86d5a71abe5d6667dad6a293100ae374 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 13 Jul 2012 17:20:59 -0500 Subject: [PATCH 0702/1057] FS-4421 --resolve --- .../mod_conference/mod_conference.c | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index be40aa6a08..23f3360f2d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -516,6 +516,7 @@ static switch_status_t conf_api_sub_deaf(conference_member_t *member, switch_str static switch_status_t conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data); static switch_status_t conference_add_event_data(conference_obj_t *conference, switch_event_t *event); static switch_status_t conference_add_event_member_data(conference_member_t *member, switch_event_t *event); +static switch_status_t conf_api_sub_floor(conference_member_t *member, switch_stream_handle_t *stream, void *data); #define lock_member(_member) switch_mutex_lock(_member->write_mutex); switch_mutex_lock(_member->read_mutex) @@ -2397,6 +2398,13 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v return NULL; } +static void conference_loop_fn_floor_toggle(conference_member_t *member, caller_control_action_t *action) +{ + if (member == NULL) return; + + conf_api_sub_floor(member, NULL, NULL); +} + static void conference_loop_fn_mute_toggle(conference_member_t *member, caller_control_action_t *action) { if (member == NULL) @@ -4889,6 +4897,51 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st return ret_status; } +static switch_status_t conf_api_sub_floor(conference_member_t *member, switch_stream_handle_t *stream, void *data) +{ + switch_event_t *event; + + if (member == NULL) + return SWITCH_STATUS_GENERR; + + switch_mutex_lock(member->conference->mutex); + + if (member->conference->floor_holder == member) { + member->conference->floor_holder = NULL; + if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE)) { + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); + conference_add_event_data(member->conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "floor-change"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d", member->id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "none"); + switch_event_fire(&event); + if (stream != NULL) { + stream->write_function(stream, "OK floor none\n"); + } + } + } else if (member->conference->floor_holder == NULL) { + member->conference->floor_holder = member; + if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE)) { + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); + conference_add_event_data(member->conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "floor-change"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "none"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", member->id); + switch_event_fire(&event); + if (stream != NULL) { + stream->write_function(stream, "OK floor %u\n", member->id); + } + } + } else { + if (stream != NULL) { + stream->write_function(stream, "ERR floor is held by %u\n", member->conference->floor_holder->id); + } + } + + switch_mutex_unlock(member->conference->mutex); + + return SWITCH_STATUS_SUCCESS; +} static switch_xml_t add_x_tag(switch_xml_t x_member, const char *name, const char *value, int off) { @@ -5901,6 +5954,7 @@ static api_command_t conf_api_sub_commands[] = { {"nopin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "nopin", ""}, {"get", (void_fn_t) & conf_api_sub_get, CONF_API_SUB_ARGS_SPLIT, "get", ""}, {"set", (void_fn_t) & conf_api_sub_set, CONF_API_SUB_ARGS_SPLIT, "set", " "}, + {"floor", (void_fn_t) & conf_api_sub_floor, CONF_API_SUB_MEMBER_TARGET, "floor", ""}, }; #define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0])) @@ -8363,7 +8417,8 @@ static struct _mapping control_mappings[] = { {"event", conference_loop_fn_event}, {"lock", conference_loop_fn_lock_toggle}, {"transfer", conference_loop_fn_transfer}, - {"execute_application", conference_loop_fn_exec_app} + {"execute_application", conference_loop_fn_exec_app}, + {"floor", conference_loop_fn_floor_toggle}, }; #define MAPPING_LEN (sizeof(control_mappings)/sizeof(control_mappings[0])) From b6e962de1dc829c322f9d408abdfd3f4ef2e732b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 13 Jul 2012 18:02:09 -0500 Subject: [PATCH 0703/1057] typo --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index adbda9ffe2..fb7b0ae8ff 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2947,7 +2947,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t #endif #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtp_recv_msg.header.version == 2) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->recv_msg.header.version == 2) { int sbytes = (int) *bytes; err_status_t stat = 0; @@ -3066,7 +3066,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t } #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtp_recv_msg.header.version == 2) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->recv_msg.header.version == 2) { int sbytes = (int) *bytes; err_status_t stat = 0; From 1f39ecd13f02ea939ab4c976e52236241d510e5f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 13 Jul 2012 18:02:36 -0500 Subject: [PATCH 0704/1057] FS-3840 --resolve --- .../mod_conference/mod_conference.c | 138 +++++++++++++++++- 1 file changed, 133 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 23f3360f2d..fa5f02e8b9 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -173,7 +173,8 @@ typedef enum { MFLAG_INDICATE_UNMUTE = (1 << 18), MFLAG_NOMOH = (1 << 19), MFLAG_VIDEO_BRIDGE = (1 << 20), - MFLAG_INDICATE_MUTE_DETECT = (1 << 21) + MFLAG_INDICATE_MUTE_DETECT = (1 << 21), + MFLAG_PAUSE_RECORDING = (1 << 22) } member_flag_t; typedef enum { @@ -252,6 +253,12 @@ typedef struct conference_file_node { char *file; } conference_file_node_t; +typedef enum { + REC_ACTION_STOP = 1, + REC_ACTION_PAUSE, + REC_ACTION_RESUME +} recording_action_type_t; + /* conference xml config sections */ typedef struct conf_xml_cfg { switch_xml_t profile; @@ -1185,6 +1192,40 @@ static switch_status_t conference_record_stop(conference_obj_t *conference, char switch_mutex_unlock(conference->member_mutex); return count; } +/* stop/pause/resume the specified recording */ +static switch_status_t conference_record_action(conference_obj_t *conference, char *path, recording_action_type_t action) +{ + conference_member_t *member = NULL; + int count = 0; + //switch_file_handle_t *fh = NULL; + + switch_assert(conference != NULL); + switch_mutex_lock(conference->member_mutex); + for (member = conference->members; member; member = member->next) + { + if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) + { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Action: %d\n", action); + switch (action) + { + case REC_ACTION_STOP: + switch_clear_flag_locked(member, MFLAG_RUNNING); + count++; + break; + case REC_ACTION_PAUSE: + switch_set_flag_locked(member, MFLAG_PAUSE_RECORDING); + count = 1; + break; + case REC_ACTION_RESUME: + switch_clear_flag_locked(member, MFLAG_PAUSE_RECORDING); + count = 1; + break; + } + } + } + switch_mutex_unlock(conference->member_mutex); + return count; +} /* Add a custom relationship to a member */ @@ -3854,11 +3895,13 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th 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); + if (!switch_test_flag(member, MFLAG_PAUSE_RECORDING)) { + 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); @@ -5065,6 +5108,9 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer */ x_tag = switch_xml_add_child_d(x_member, "record_path", count++); + if (switch_test_flag(member, MFLAG_PAUSE_RECORDING)) { + switch_xml_set_attr_d(x_tag, "status", "paused"); + } switch_xml_set_txt_d(x_tag, member->rec_path); x_tag = switch_xml_add_child_d(x_member, "join_time", count++); @@ -5778,6 +5824,85 @@ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switc return SWITCH_STATUS_SUCCESS; } +static switch_status_t conf_api_sub_pauserec(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + switch_event_t *event; + recording_action_type_t action; + + switch_assert(conference != NULL); + switch_assert(stream != NULL); + + if (argc <= 2) + return SWITCH_STATUS_GENERR; + + if (strcasecmp(argv[1], "pause") == 0) { + action = REC_ACTION_PAUSE; + } else if (strcasecmp(argv[1], "resume") == 0) { + action = REC_ACTION_RESUME; + } else { + return SWITCH_STATUS_GENERR; + } + stream->write_function(stream, "%s recording file %s\n", + action == REC_ACTION_PAUSE ? "Pause" : "Resume", argv[2]); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s recording file %s\n", + action == REC_ACTION_PAUSE ? "Pause" : "Resume", argv[2]); + + if (!conference_record_action(conference, argv[2], action)) { + stream->write_function(stream, "non-existant recording '%s'\n", argv[2]); + } else { + if (test_eflag(conference, EFLAG_RECORD) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) + { + conference_add_event_data(conference, event); + if (action == REC_ACTION_PAUSE) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "pause-recording"); + } else { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "resume-recording"); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", argv[2]); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Recordings", conference->record_count ? "true" : "false"); + switch_event_fire(&event); + } + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t conf_api_sub_recording(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + switch_assert(conference != NULL); + switch_assert(stream != NULL); + + if (argc <= 3) { + /* It means that old syntax is used */ + return conf_api_sub_record(conference,stream,argc,argv); + } else { + /* for new syntax call existing functions with fixed parameter list */ + if (strcasecmp(argv[2], "start") == 0) { + argv[1] = argv[2]; + argv[2] = argv[3]; + return conf_api_sub_record(conference,stream,4,argv); + } else if (strcasecmp(argv[2], "stop") == 0) { + argv[1] = argv[2]; + argv[2] = argv[3]; + return conf_api_sub_norecord(conference,stream,4,argv); + } else if (strcasecmp(argv[2], "check") == 0) { + argv[1] = argv[2]; + argv[2] = argv[3]; + return conf_api_sub_check_record(conference,stream,4,argv); + } else if (strcasecmp(argv[2], "pause") == 0) { + argv[1] = argv[2]; + argv[2] = argv[3]; + return conf_api_sub_pauserec(conference,stream,4,argv); + } else if (strcasecmp(argv[2], "resume") == 0) { + argv[1] = argv[2]; + argv[2] = argv[3]; + return conf_api_sub_pauserec(conference,stream,4,argv); + } else { + return SWITCH_STATUS_GENERR; + } + } +} + static switch_status_t conf_api_sub_pin(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { switch_assert(conference != NULL); @@ -5948,6 +6073,9 @@ static api_command_t conf_api_sub_commands[] = { {"record", (void_fn_t) & conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "record", ""}, {"chkrecord", (void_fn_t) & conf_api_sub_check_record, CONF_API_SUB_ARGS_SPLIT, "chkrecord", ""}, {"norecord", (void_fn_t) & conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "norecord", "<[filename|all]>"}, + {"pause", (void_fn_t) & conf_api_sub_pauserec, CONF_API_SUB_ARGS_SPLIT, "pause", ""}, + {"resume", (void_fn_t) & conf_api_sub_pauserec, CONF_API_SUB_ARGS_SPLIT, "resume", ""}, + {"recording", (void_fn_t) & conf_api_sub_recording, CONF_API_SUB_ARGS_SPLIT, "recording", "[start|stop|check|pause|resume] [|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", ""}, From 445b74b765dac639fc42ea7fbd35b5ed94a4ff5d Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sat, 14 Jul 2012 12:43:36 +0200 Subject: [PATCH 0705/1057] mod_http_cache: Do not use C99-style for loops to fix non-debug builds. Debug builds add -std=c99 (or -xc99 for suncc) to CFLAGS (AX_CFLAGS_WARN_ALL_ANSI configure macro). Non-debug builds do not invoke AX_CFLAGS_WARN_ALL_ANSI checks and therefore won't have C99 support enabled, which breaks the build of mod_http_cache due to "for (int i... )"-style C99 loops. NOTE: AC_PROG_CC_C99 would make a lot of sense here and MSVC (2005) accepts "for (int ...)" constructs too. Signed-off-by: Stefan Knoblich --- .../mod_http_cache/mod_http_cache.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 4e9e892976..aec7be684d 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -322,6 +322,7 @@ static size_t get_file_callback(void *ptr, size_t size, size_t nmemb, void *get) static char *trim(char *str) { size_t len; + int i; if (zstr(str)) { return str; @@ -329,7 +330,7 @@ static char *trim(char *str) len = strlen(str); /* strip whitespace from front */ - for (int i = 0; i < len; i++) { + for (i = 0; i < len; i++) { if (!isspace(str[i])) { str = &str[i]; len -= i; @@ -341,7 +342,7 @@ static char *trim(char *str) } /* strip whitespace from end */ - for (int i = len - 1; i >= 0; i--) { + for (i = len - 1; i >= 0; i--) { if (!isspace(str[i])) { break; } @@ -359,6 +360,7 @@ static void process_cache_control_header(cached_url_t *url, char *data) { char *max_age_str; switch_time_t max_age; + int i; /* trim whitespace and check if empty */ data = trim(data); @@ -377,7 +379,7 @@ static void process_cache_control_header(cached_url_t *url, char *data) if (zstr(max_age_str)) { return; } - for (int i = 0; i < strlen(max_age_str); i++) { + for (i = 0; i < strlen(max_age_str); i++) { if (!isdigit(max_age_str[i])) { max_age_str[i] = '\0'; break; @@ -458,10 +460,12 @@ static void url_cache_unlock(url_cache_t *cache, switch_core_session_t *session) */ static void url_cache_clear(url_cache_t *cache, switch_core_session_t *session) { + int i; + url_cache_lock(cache, session); // remove each cached URL from the hash and the queue - for (int i = 0; i < cache->queue.max_size; i++) { + for (i = 0; i < cache->queue.max_size; i++) { cached_url_t *url = cache->queue.data[i]; if (url) { switch_core_hash_delete(cache->map, url->url); @@ -825,10 +829,12 @@ static switch_status_t http_get(url_cache_t *cache, cached_url_t *url, switch_co */ static void setup_dir(url_cache_t *cache) { + int i; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting up %s\n", cache->location); switch_dir_make_recursive(cache->location, SWITCH_DEFAULT_DIR_PERMS, cache->pool); - for (int i = 0x00; i <= 0xff; i++) { + for (i = 0x00; i <= 0xff; i++) { switch_dir_t *dir = NULL; char *dirname = switch_mprintf("%s%s%02x", cache->location, SWITCH_PATH_SEPARATOR, i); if (switch_dir_open(&dir, dirname, cache->pool) == SWITCH_STATUS_SUCCESS) { @@ -1153,6 +1159,8 @@ done: SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load) { switch_api_interface_t *api; + int i; + *module_interface = switch_loadable_module_create_module_interface(pool, modname); SWITCH_ADD_API(api, "http_get", "HTTP GET", http_cache_get, HTTP_GET_SYNTAX); @@ -1182,7 +1190,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load) /* Start the prefetch threads */ switch_queue_create(&gcache.prefetch_queue, gcache.prefetch_queue_size, gcache.pool); - for (int i = 0; i < gcache.prefetch_thread_count; i++) { + for (i = 0; i < gcache.prefetch_thread_count; i++) { int started = 0; switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; From 6ff084492b1af9cd0112c8744bd37e094b129931 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sat, 14 Jul 2012 14:01:18 +0200 Subject: [PATCH 0706/1057] esl-php: Create installation directories if they do not exist (+ other minor clean ups). Fixes: cp ESL.so /var/tmp/por.../image/usr/lib64/php5.3/lib/extensions/no-debug-zts-20090626 cp: cannot create regular file `/var/tmp/por.../image/usr/lib64/php5.3/lib/extensions/no-debug-zts-20090626': No such file or directory Signed-off-by: Stefan Knoblich --- libs/esl/php/Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/libs/esl/php/Makefile b/libs/esl/php/Makefile index e970ff7d82..dce8fd4bd1 100644 --- a/libs/esl/php/Makefile +++ b/libs/esl/php/Makefile @@ -1,8 +1,16 @@ +PHP=php +PHP_CONFIG=php-config + +PHP_LDFLAGS=$(shell $(PHP_CONFIG) --ldflags) +PHP_LIBS=$(shell $(PHP_CONFIG) --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g') +PHP_EXT_DIR=$(shell $(PHP_CONFIG) --extension-dir) +PHP_INC_DIR=$(shell $(PHP) -r 'echo ini_get("include_path");' | cut -d: -f2) +PHP_INI_DIR=$(shell $(PHP_CONFIG) --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=) + LOCAL_CFLAGS=$(shell php-config --includes) -PHP_LDFLAGS=$(shell php-config --ldflags) -PHP_LIBS=$(shell php-config --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g') LOCAL_LDFLAGS=$(PHP_LDFLAGS) $(PHP_LIBS) LOCAL_LDFLAGS+=-lpthread + WRAP_GCC_WARNING_SILENCE=-Wno-unused-label -Wno-unused-function all: ESL.so @@ -25,6 +33,9 @@ swigclean: reswig: swigclean esl_wrap.cpp install: ESL.so - cp ESL.so $(DESTDIR)/$(shell php-config --extension-dir) - cp ESL.php /$(DESTDIR)/$(shell php -r 'echo ini_get("include_path");' | cut -d: -f2) - echo 'extension=ESL.so' >> $(DESTDIR)/$(shell php-config --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=)/esl.ini + test -d "$(DESTDIR)$(PHP_EXT_DIR)" || mkdir -p "$(DESTDIR)$(PHP_EXT_DIR)" + cp ESL.so "$(DESTDIR)$(PHP_EXT_DIR)" + test -d "$(DESTDIR)$(PHP_INC_DIR)" || mkdir -p "$(DESTDIR)$(PHP_INC_DIR)" + cp ESL.php "$(DESTDIR)$(PHP_INC_DIR)" + test -d "$(DESTDIR)$(PHP_INI_DIR)" || mkdir -p "$(DESTDIR)$(PHP_INI_DIR)" + test -f "$(DESTDIR)$(PHP_INI_DIR)/esl.ini" || echo 'extension=ESL.so' > "$(DESTDIR)$(PHP_INI_DIR)/esl.ini" From 860b53183d01b4943d151d52beed8c014dec270a Mon Sep 17 00:00:00 2001 From: Brian West Date: Sat, 14 Jul 2012 10:24:35 -0500 Subject: [PATCH 0707/1057] tweak --- src/switch_loadable_module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 739f20f566..537e1a2550 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -580,7 +580,6 @@ static switch_status_t do_chat_send(switch_event_t *message_event) if (!do_skip && !switch_stristr("GLOBAL", dest_proto)) { if ((ci = switch_loadable_module_get_chat_interface(dest_proto)) && ci->chat_send) { status = ci->chat_send(message_event); - printf("FRICK\n"); UNPROTECT_INTERFACE(ci); } else { From 287678bc56b7ab51a242b9041021529e7aceda6a Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 14 Jul 2012 23:34:40 +0800 Subject: [PATCH 0708/1057] Tweaks to spandsp tests Addition of tones to modem connect tones Repeat function for V.18 TDD --- libs/spandsp/src/Makefile.am | 9 +- libs/spandsp/src/async.c | 35 +- libs/spandsp/src/cielab_luts.h | 4389 +++++++++++++++++ libs/spandsp/src/fax_modems.c | 1 + libs/spandsp/src/fsk.c | 60 +- libs/spandsp/src/modem_connect_tones.c | 75 +- libs/spandsp/src/spandsp/fsk.h | 6 +- .../spandsp/src/spandsp/modem_connect_tones.h | 4 +- libs/spandsp/src/spandsp/private/async.h | 4 +- libs/spandsp/src/spandsp/private/v18.h | 1 + libs/spandsp/src/v18.c | 145 +- .../spandsp/tests/modem_connect_tones_tests.c | 454 +- libs/spandsp/tests/t38_core_tests.c | 2 +- libs/spandsp/tests/t4_tests.c | 6 +- libs/spandsp/tests/tsb85_tests.c | 8 +- libs/spandsp/tests/v17_tests.c | 2 + libs/spandsp/tests/v18_tests.c | 1718 ++++++- libs/spandsp/tests/v22bis_tests.c | 2 + libs/spandsp/tests/v27ter_tests.c | 2 + libs/spandsp/tests/v29_tests.c | 2 + libs/spandsp/tests/v8_tests.c | 12 + 21 files changed, 6702 insertions(+), 235 deletions(-) create mode 100644 libs/spandsp/src/cielab_luts.h diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index ce4f5bad4c..a6846151eb 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -19,8 +19,6 @@ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) -MAINTAINERCLEANFILES = Makefile.in - DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \ $(srcdir)/math_fixed_tables.h \ $(srcdir)/v17_v32bis_rx_fixed_rrc.h \ @@ -46,6 +44,10 @@ DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \ $(srcdir)/v29tx_fixed_rrc.h \ $(srcdir)/v29tx_floating_rrc.h +CLEANFILES = ${DISTCLEANFILES} +MOSTLYCLEANFILES = ${DISTCLEANFILES} +MAINTAINERCLEANFILES = ${DISTCLEANFILES} + EXTRA_DIST = floating_fudge.h \ libspandsp.dsp \ libspandsp.2005.sln \ @@ -322,7 +324,8 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \ nodist_include_HEADERS = spandsp.h -noinst_HEADERS = faxfont.h \ +noinst_HEADERS = cielab_luts.h \ + faxfont.h \ filter_tools.h \ gsm0610_local.h \ lpc10_encdecs.h \ diff --git a/libs/spandsp/src/async.c b/libs/spandsp/src/async.c index 518642111e..3552d644ee 100644 --- a/libs/spandsp/src/async.c +++ b/libs/spandsp/src/async.c @@ -179,27 +179,30 @@ SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit) { /* Align the received value */ if (s->data_bits < 8) - s->byte_in_progress >>= (8 - s->data_bits); + s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits); s->put_byte(s->user_data, s->byte_in_progress); s->bitpos = 0; } - else if (s->use_v14) - { - /* This is actually the start bit for the next character, and - the stop bit has been dropped from the stream. This is the - rate adaption specified in V.14 */ - /* Align the received value */ - if (s->data_bits < 8) - s->byte_in_progress >>= (8 - s->data_bits); - s->put_byte(s->user_data, s->byte_in_progress); - s->bitpos = 1; - s->parity_bit = 0; - s->byte_in_progress = 0; - } else { - s->framing_errors++; - s->bitpos = 0; + if (s->use_v14) + { + /* This is actually the start bit for the next character, and + the stop bit has been dropped from the stream. This is the + rate adaption specified in V.14 */ + /* Align the received value */ + if (s->data_bits < 8) + s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits); + s->put_byte(s->user_data, s->byte_in_progress); + s->bitpos = 1; + s->parity_bit = 0; + s->byte_in_progress = 0; + } + else + { + s->framing_errors++; + s->bitpos = 0; + } } } } diff --git a/libs/spandsp/src/cielab_luts.h b/libs/spandsp/src/cielab_luts.h new file mode 100644 index 0000000000..73e72ac824 --- /dev/null +++ b/libs/spandsp/src/cielab_luts.h @@ -0,0 +1,4389 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * cielab_luts.h + * + * Written by Steve Underwood + * + * Copyright (C) 2011 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(T42_USE_LUTS) +static const float sRGB_to_linear[256] = +{ + 0.000000, + 0.000302, + 0.000605, + 0.000907, + 0.001209, + 0.001512, + 0.001814, + 0.002116, + 0.002419, + 0.002721, + 0.003023, + 0.003333, + 0.003661, + 0.004007, + 0.004371, + 0.004754, + 0.005156, + 0.005577, + 0.006017, + 0.006477, + 0.006957, + 0.007457, + 0.007977, + 0.008518, + 0.009080, + 0.009663, + 0.010267, + 0.010893, + 0.011540, + 0.012209, + 0.012900, + 0.013614, + 0.014350, + 0.015109, + 0.015890, + 0.016695, + 0.017523, + 0.018375, + 0.019250, + 0.020149, + 0.021072, + 0.022019, + 0.022991, + 0.023987, + 0.025008, + 0.026054, + 0.027125, + 0.028221, + 0.029343, + 0.030490, + 0.031663, + 0.032862, + 0.034087, + 0.035338, + 0.036616, + 0.037920, + 0.039250, + 0.040608, + 0.041993, + 0.043404, + 0.044844, + 0.046310, + 0.047804, + 0.049326, + 0.050876, + 0.052454, + 0.054060, + 0.055694, + 0.057357, + 0.059049, + 0.060769, + 0.062518, + 0.064296, + 0.066103, + 0.067940, + 0.069806, + 0.071701, + 0.073626, + 0.075581, + 0.077566, + 0.079581, + 0.081627, + 0.083702, + 0.085808, + 0.087945, + 0.090112, + 0.092311, + 0.094540, + 0.096800, + 0.099092, + 0.101414, + 0.103769, + 0.106155, + 0.108572, + 0.111021, + 0.113503, + 0.116016, + 0.118562, + 0.121139, + 0.123750, + 0.126392, + 0.129068, + 0.131776, + 0.134517, + 0.137291, + 0.140098, + 0.142938, + 0.145812, + 0.148719, + 0.151659, + 0.154633, + 0.157641, + 0.160683, + 0.163758, + 0.166868, + 0.170012, + 0.173190, + 0.176403, + 0.179650, + 0.182932, + 0.186248, + 0.189599, + 0.192985, + 0.196407, + 0.199863, + 0.203354, + 0.206881, + 0.210443, + 0.214041, + 0.217675, + 0.221344, + 0.225049, + 0.228789, + 0.232566, + 0.236379, + 0.240229, + 0.244114, + 0.248036, + 0.251995, + 0.255990, + 0.260021, + 0.264090, + 0.268196, + 0.272338, + 0.276518, + 0.280734, + 0.284988, + 0.289280, + 0.293609, + 0.297975, + 0.302379, + 0.306821, + 0.311301, + 0.315818, + 0.320374, + 0.324967, + 0.329599, + 0.334269, + 0.338978, + 0.343725, + 0.348510, + 0.353334, + 0.358197, + 0.363099, + 0.368040, + 0.373019, + 0.378038, + 0.383096, + 0.388193, + 0.393329, + 0.398505, + 0.403721, + 0.408976, + 0.414270, + 0.419605, + 0.424979, + 0.430393, + 0.435848, + 0.441342, + 0.446877, + 0.452452, + 0.458067, + 0.463722, + 0.469419, + 0.475156, + 0.480933, + 0.486751, + 0.492610, + 0.498510, + 0.504452, + 0.510434, + 0.516457, + 0.522522, + 0.528628, + 0.534775, + 0.540964, + 0.547194, + 0.553466, + 0.559780, + 0.566136, + 0.572533, + 0.578973, + 0.585455, + 0.591978, + 0.598544, + 0.605152, + 0.611803, + 0.618496, + 0.625232, + 0.632010, + 0.638831, + 0.645694, + 0.652600, + 0.659550, + 0.666542, + 0.673577, + 0.680656, + 0.687777, + 0.694942, + 0.702151, + 0.709402, + 0.716698, + 0.724036, + 0.731419, + 0.738845, + 0.746315, + 0.753829, + 0.761386, + 0.768988, + 0.776634, + 0.784324, + 0.792058, + 0.799837, + 0.807660, + 0.815527, + 0.823439, + 0.831396, + 0.839397, + 0.847443, + 0.855533, + 0.863669, + 0.871850, + 0.880075, + 0.888346, + 0.896662, + 0.905023, + 0.913429, + 0.921881, + 0.930378, + 0.938921, + 0.947509, + 0.956143, + 0.964823, + 0.973548, + 0.982319, + 0.991137 +}; + +static const uint8_t linear_to_sRGB[4096] = +{ + 0, + 0, + 1, + 2, + 3, + 4, + 4, + 5, + 6, + 7, + 8, + 8, + 9, + 10, + 11, + 12, + 12, + 13, + 14, + 14, + 15, + 15, + 16, + 17, + 17, + 18, + 18, + 19, + 19, + 20, + 20, + 21, + 21, + 22, + 22, + 23, + 23, + 23, + 24, + 24, + 25, + 25, + 25, + 26, + 26, + 27, + 27, + 27, + 28, + 28, + 28, + 29, + 29, + 30, + 30, + 30, + 31, + 31, + 31, + 32, + 32, + 32, + 33, + 33, + 33, + 33, + 34, + 34, + 34, + 35, + 35, + 35, + 36, + 36, + 36, + 36, + 37, + 37, + 37, + 38, + 38, + 38, + 38, + 39, + 39, + 39, + 39, + 40, + 40, + 40, + 40, + 41, + 41, + 41, + 41, + 42, + 42, + 42, + 42, + 43, + 43, + 43, + 43, + 44, + 44, + 44, + 44, + 45, + 45, + 45, + 45, + 45, + 46, + 46, + 46, + 46, + 47, + 47, + 47, + 47, + 47, + 48, + 48, + 48, + 48, + 49, + 49, + 49, + 49, + 49, + 50, + 50, + 50, + 50, + 50, + 51, + 51, + 51, + 51, + 51, + 52, + 52, + 52, + 52, + 52, + 53, + 53, + 53, + 53, + 53, + 54, + 54, + 54, + 54, + 54, + 54, + 55, + 55, + 55, + 55, + 55, + 56, + 56, + 56, + 56, + 56, + 56, + 57, + 57, + 57, + 57, + 57, + 57, + 58, + 58, + 58, + 58, + 58, + 59, + 59, + 59, + 59, + 59, + 59, + 60, + 60, + 60, + 60, + 60, + 60, + 61, + 61, + 61, + 61, + 61, + 61, + 62, + 62, + 62, + 62, + 62, + 62, + 62, + 63, + 63, + 63, + 63, + 63, + 63, + 64, + 64, + 64, + 64, + 64, + 64, + 65, + 65, + 65, + 65, + 65, + 65, + 65, + 66, + 66, + 66, + 66, + 66, + 66, + 66, + 67, + 67, + 67, + 67, + 67, + 67, + 68, + 68, + 68, + 68, + 68, + 68, + 68, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 70, + 70, + 70, + 70, + 70, + 70, + 70, + 70, + 71, + 71, + 71, + 71, + 71, + 71, + 71, + 72, + 72, + 72, + 72, + 72, + 72, + 72, + 73, + 73, + 73, + 73, + 73, + 73, + 73, + 73, + 74, + 74, + 74, + 74, + 74, + 74, + 74, + 75, + 75, + 75, + 75, + 75, + 75, + 75, + 75, + 76, + 76, + 76, + 76, + 76, + 76, + 76, + 76, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 78, + 78, + 78, + 78, + 78, + 78, + 78, + 78, + 79, + 79, + 79, + 79, + 79, + 79, + 79, + 79, + 80, + 80, + 80, + 80, + 80, + 80, + 80, + 80, + 80, + 81, + 81, + 81, + 81, + 81, + 81, + 81, + 81, + 82, + 82, + 82, + 82, + 82, + 82, + 82, + 82, + 82, + 83, + 83, + 83, + 83, + 83, + 83, + 83, + 83, + 83, + 84, + 84, + 84, + 84, + 84, + 84, + 84, + 84, + 84, + 85, + 85, + 85, + 85, + 85, + 85, + 85, + 85, + 85, + 86, + 86, + 86, + 86, + 86, + 86, + 86, + 86, + 86, + 87, + 87, + 87, + 87, + 87, + 87, + 87, + 87, + 87, + 88, + 88, + 88, + 88, + 88, + 88, + 88, + 88, + 88, + 89, + 89, + 89, + 89, + 89, + 89, + 89, + 89, + 89, + 89, + 90, + 90, + 90, + 90, + 90, + 90, + 90, + 90, + 90, + 90, + 91, + 91, + 91, + 91, + 91, + 91, + 91, + 91, + 91, + 92, + 92, + 92, + 92, + 92, + 92, + 92, + 92, + 92, + 92, + 93, + 93, + 93, + 93, + 93, + 93, + 93, + 93, + 93, + 93, + 94, + 94, + 94, + 94, + 94, + 94, + 94, + 94, + 94, + 94, + 95, + 95, + 95, + 95, + 95, + 95, + 95, + 95, + 95, + 95, + 95, + 96, + 96, + 96, + 96, + 96, + 96, + 96, + 96, + 96, + 96, + 97, + 97, + 97, + 97, + 97, + 97, + 97, + 97, + 97, + 97, + 97, + 98, + 98, + 98, + 98, + 98, + 98, + 98, + 98, + 98, + 98, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 101, + 101, + 101, + 101, + 101, + 101, + 101, + 101, + 101, + 101, + 101, + 102, + 102, + 102, + 102, + 102, + 102, + 102, + 102, + 102, + 102, + 102, + 103, + 103, + 103, + 103, + 103, + 103, + 103, + 103, + 103, + 103, + 103, + 103, + 104, + 104, + 104, + 104, + 104, + 104, + 104, + 104, + 104, + 104, + 104, + 105, + 105, + 105, + 105, + 105, + 105, + 105, + 105, + 105, + 105, + 105, + 105, + 106, + 106, + 106, + 106, + 106, + 106, + 106, + 106, + 106, + 106, + 106, + 106, + 107, + 107, + 107, + 107, + 107, + 107, + 107, + 107, + 107, + 107, + 107, + 107, + 108, + 108, + 108, + 108, + 108, + 108, + 108, + 108, + 108, + 108, + 108, + 108, + 109, + 109, + 109, + 109, + 109, + 109, + 109, + 109, + 109, + 109, + 109, + 109, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 111, + 111, + 111, + 111, + 111, + 111, + 111, + 111, + 111, + 111, + 111, + 111, + 111, + 112, + 112, + 112, + 112, + 112, + 112, + 112, + 112, + 112, + 112, + 112, + 112, + 113, + 113, + 113, + 113, + 113, + 113, + 113, + 113, + 113, + 113, + 113, + 113, + 113, + 114, + 114, + 114, + 114, + 114, + 114, + 114, + 114, + 114, + 114, + 114, + 114, + 114, + 115, + 115, + 115, + 115, + 115, + 115, + 115, + 115, + 115, + 115, + 115, + 115, + 115, + 116, + 116, + 116, + 116, + 116, + 116, + 116, + 116, + 116, + 116, + 116, + 116, + 116, + 117, + 117, + 117, + 117, + 117, + 117, + 117, + 117, + 117, + 117, + 117, + 117, + 117, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 118, + 119, + 119, + 119, + 119, + 119, + 119, + 119, + 119, + 119, + 119, + 119, + 119, + 119, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 121, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 122, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 123, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 124, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 125, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 126, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 127, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 128, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 129, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 130, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 131, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 132, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 133, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 134, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 135, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 136, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 137, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 138, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 139, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 140, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 141, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 142, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 143, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 144, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 145, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 146, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 147, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 148, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 149, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 150, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 151, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 152, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 153, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 154, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 155, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 156, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 157, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 158, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 159, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 160, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 161, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 162, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 163, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 164, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 165, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 166, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 167, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 168, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 169, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 170, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 171, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 172, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 173, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 174, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 175, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 176, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 177, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 178, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 179, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 180, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 181, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 182, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 183, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 184, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 185, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 186, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 187, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 188, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 189, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 190, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 191, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 192, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 193, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 194, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 195, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 196, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 197, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 198, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 199, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 200, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 201, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 202, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 203, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 204, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 205, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 206, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 207, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 208, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 209, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 210, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 211, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 214, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 215, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 217, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 218, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 219, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 220, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 222, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 223, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 224, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 226, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 227, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 228, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 229, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 230, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 231, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 232, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 233, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 234, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 235, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 236, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 237, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 238, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 239, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 240, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 241, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 243, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 244, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 245, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 251, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255 +}; +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/fax_modems.c b/libs/spandsp/src/fax_modems.c index d684f03d54..b3f9878b63 100644 --- a/libs/spandsp/src/fax_modems.c +++ b/libs/spandsp/src/fax_modems.c @@ -336,6 +336,7 @@ SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s) { if (s) free(s); + /*endif*/ return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/fsk.c b/libs/spandsp/src/fsk.c index 19941637c0..3f53aa7bc8 100644 --- a/libs/spandsp/src/fsk.c +++ b/libs/spandsp/src/fsk.c @@ -70,16 +70,16 @@ const fsk_spec_t preset_fsk_specs[] = }, { "V23 ch 1", - 2100, - 1300, + 1700 + 400, + 1700 - 400, -14, -30, 1200*100 }, { "V23 ch 2", - 450, - 390, + 420 + 30, + 420 - 30, -14, -30, 75*100 @@ -102,27 +102,35 @@ const fsk_spec_t preset_fsk_specs[] = }, { "Bell202", - 2200, - 1200, + 1700 + 500, + 1700 - 500, -14, -30, 1200*100 }, { - "Weitbrecht 45.45", /* Used for TDD (Telecoms Device for the Deaf) */ - 1800, - 1400, + "Weitbrecht 45.45", /* Used for US TDD (Telecoms Device for the Deaf) */ + 1600 + 200, + 1600 - 200, -14, -30, 4545 }, { - "Weitbrecht 50", /* Used for TDD (Telecoms Device for the Deaf) */ - 1800, - 1400, + "Weitbrecht 50", /* Used for Internatioal TDD (Telecoms Device for the Deaf) */ + 1600 + 200, + 1600 - 200, -14, -30, - 5000 + 50*100 + }, + { + "V21 (110bps) ch 1", + 1080 + 100, + 1080 - 100, + -14, + -30, + 110*100 } }; @@ -476,6 +484,10 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len) s->put_bit(s->put_bit_user_data, baudstate); } break; + case FSK_FRAME_MODE_5N1_FRAMES: + case FSK_FRAME_MODE_7N1_FRAMES: + case FSK_FRAME_MODE_7E1_FRAMES: + case FSK_FRAME_MODE_7E2_FRAMES: default: /* Gather the specified number of bits, with robust checking to ensure reasonable voice immunity. The first bit should be a start bit (0), and the last bit should be a stop bit (1) */ @@ -527,24 +539,22 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len) state as the next bit */ if (s->last_bit == baudstate) { - s->frame_bits |= (baudstate << s->framing_mode); - s->frame_bits >>= 1; - s->baud_phase -= (SAMPLE_RATE*100); if (++s->frame_state > s->framing_mode) { - /* Check we have a stop bit */ - if (baudstate == 1) + /* Check we have a stop bit and a start bit */ + if (baudstate == 1 && (s->frame_bits & 0x02) == 0) { - /* Check we have a start bit */ - if ((s->frame_bits & 1) == 0) - { - /* Drop the start bit, and pass the rest back */ - s->frame_bits >>= 1; - s->put_bit(s->put_bit_user_data, s->frame_bits); - } + /* Drop the start bit, and pass the rest back */ + s->put_bit(s->put_bit_user_data, s->frame_bits >> 2); } s->frame_state = 0; } + else + { + s->frame_bits |= (baudstate << s->framing_mode); + s->frame_bits >>= 1; + } + s->baud_phase -= (SAMPLE_RATE*100); } else { diff --git a/libs/spandsp/src/modem_connect_tones.c b/libs/spandsp/src/modem_connect_tones.c index 4162286db8..6bd7de8dac 100644 --- a/libs/spandsp/src/modem_connect_tones.c +++ b/libs/spandsp/src/modem_connect_tones.c @@ -94,6 +94,8 @@ SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone) return "FAX preamble"; case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE: return "FAX CED or preamble"; + case MODEM_CONNECT_TONES_BELL_ANS: + return "Bell ANS"; case MODEM_CONNECT_TONES_CALLING_TONE: return "Calling tone"; } @@ -206,6 +208,20 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t * } s->duration_timer -= len; break; + case MODEM_CONNECT_TONES_BELL_ANS: + if (s->duration_timer < len) + len = s->duration_timer; + if (s->duration_timer > ms_to_samples(2600)) + { + /* There is some initial silence to be generated. */ + if ((i = s->duration_timer - ms_to_samples(2600)) > len) + i = len; + memset(amp, 0, sizeof(int16_t)*i); + } + for ( ; i < len; i++) + amp[i] = dds_mod(&s->tone_phase, s->tone_phase_rate, s->level, 0); + s->duration_timer -= len; + break; case MODEM_CONNECT_TONES_CALLING_TONE: for ( ; i < len; i++) { @@ -301,6 +317,17 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem s->mod_phase = 0; s->hop_timer = ms_to_samples(450); break; + case MODEM_CONNECT_TONES_BELL_ANS: + /* 0.2s of silence, then 2.6s to 4s of 2225Hz+-15Hz tone, then 75ms of silence. */ + s->tone_phase_rate = dds_phase_rate(2225.0); + s->level = dds_scaling_dbm0(-11); + s->mod_phase_rate = 0; + s->mod_level = 0; + s->duration_timer = ms_to_samples(200 + 2600); + s->tone_phase = 0; + s->mod_phase = 0; + s->hop_timer = 0; + break; case MODEM_CONNECT_TONES_CALLING_TONE: /* 0.6s of 1300Hz+-15Hz + 2.0s of silence repeating. */ s->tone_phase_rate = dds_phase_rate(1300.0); @@ -441,7 +468,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * /* A Cauer notch at 1100Hz, spread just wide enough to meet our detection bandwidth criteria. */ /* Poles 0.736618498*exp(+-1047/4000 * PI * j) - Zeroes exp(+-1099.5 * PI * j) */ + Zeroes exp(+-1099.5/4000 * PI * j) */ v1 = 0.792928f*famp + 1.0018744927985f*s->znotch_1 - 0.54196833412465f*s->znotch_2; famp = v1 - 1.2994747954630f*s->znotch_1 + s->znotch_2; s->znotch_2 = s->znotch_1; @@ -487,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * famp = amp[i]; /* A Cauer bandpass at 15Hz, with which we demodulate the AM signal. */ /* Poles 0.9983989*exp(+-15/4000 * PI * j) - Zeroes exp(0 * PI * j) */ + Zeroes exp(0/4000 * PI * j) */ v1 = fabs(famp) + 1.996667f*s->z15hz_1 - 0.9968004f*s->z15hz_2; filtered = 0.001599787f*(v1 - s->z15hz_2); s->z15hz_2 = s->z15hz_1; @@ -497,8 +524,8 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * /* A Cauer notch at 2100Hz, spread just wide enough to meet our detection bandwidth criteria. */ /* Poles 0.7144255*exp(+-2105.612/4000 * PI * j) - Zeroes exp(+-2099.9 * PI * j) */ - v1 = 0.76000f*famp - 0.1183852f*s->znotch_1 - 0.5104039f*s->znotch_2; + Zeroes exp(+-2099.9/4000 * PI * j) */ + v1 = 0.7552f*famp - 0.1183852f*s->znotch_1 - 0.5104039f*s->znotch_2; famp = v1 + 0.1567596f*s->znotch_1 + s->znotch_2; s->znotch_2 = s->znotch_1; s->znotch_1 = v1; @@ -585,6 +612,44 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * } } break; + case MODEM_CONNECT_TONES_BELL_ANS: + for (i = 0; i < len; i++) + { + famp = amp[i]; + /* A Cauer notch at 2225Hz, spread just wide enough to meet our detection bandwidth + criteria. */ + /* Poles 0.7144255*exp(+-2230.612/4000 * PI * j) + Zeroes exp(+-2224.9/4000 * PI * j) */ + v1 = 0.739651f*famp - 0.257384f*s->znotch_1 - 0.510404f*s->znotch_2; + famp = v1 + 0.351437f*s->znotch_1 + s->znotch_2; + s->znotch_2 = s->znotch_1; + s->znotch_1 = v1; + notched = (int16_t) lfastrintf(famp); + + /* Estimate the overall energy in the channel, and the energy in + the notch (i.e. overall channel energy - tone energy => noise). + Use abs instead of multiply for speed (is it really faster?). */ + s->channel_level += ((abs(amp[i]) - s->channel_level) >> 5); + s->notch_level += ((abs(notched) - s->notch_level) >> 5); + if (s->channel_level > 70 && s->notch_level*6 < s->channel_level) + { + /* There is adequate energy in the channel, and it is mostly at 2225Hz. */ + if (s->tone_present != MODEM_CONNECT_TONES_BELL_ANS) + { + if (++s->tone_cycle_duration >= ms_to_samples(415)) + report_tone_state(s, MODEM_CONNECT_TONES_BELL_ANS, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + } + } + else + { + /* If the signal looks wrong, even for a moment, we consider this the + end of the tone. */ + if (s->tone_present == MODEM_CONNECT_TONES_BELL_ANS) + report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99); + s->tone_cycle_duration = 0; + } + } + break; case MODEM_CONNECT_TONES_CALLING_TONE: for (i = 0; i < len; i++) { @@ -592,7 +657,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t * /* A Cauer notch at 1300Hz, spread just wide enough to meet our detection bandwidth criteria. */ /* Poles 0.736618498*exp(+-1247/4000 * PI * j) - Zeroes exp(+-1299.5 * PI * j) */ + Zeroes exp(+-1299.5/4000 * PI * j) */ v1 = 0.755582f*famp + 0.820887174515f*s->znotch_1 - 0.541968324778f*s->znotch_2; famp = v1 - 1.0456667108f*s->znotch_1 + s->znotch_2; s->znotch_2 = s->znotch_1; diff --git a/libs/spandsp/src/spandsp/fsk.h b/libs/spandsp/src/spandsp/fsk.h index 03082ce3d0..9358b565cb 100644 --- a/libs/spandsp/src/spandsp/fsk.h +++ b/libs/spandsp/src/spandsp/fsk.h @@ -110,7 +110,8 @@ enum FSK_BELL103CH2, FSK_BELL202, FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */ - FSK_WEITBRECHT50 /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ + FSK_WEITBRECHT50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */ + FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */ }; enum @@ -119,7 +120,8 @@ enum FSK_FRAME_MODE_SYNC = 1, FSK_FRAME_MODE_5N1_FRAMES = 7, /* 5 bits of data + start bit + stop bit */ FSK_FRAME_MODE_7N1_FRAMES = 9, /* 7 bits of data + start bit + stop bit */ - FSK_FRAME_MODE_8N1_FRAMES = 10 /* 8 bits of data + start bit + stop bit */ + FSK_FRAME_MODE_7E1_FRAMES = 10, /* 7 bits of data + even parity + start bit + stop bit */ + FSK_FRAME_MODE_7E2_FRAMES = 11 /* 7 bits of data + even parity + start bit + 2 stop bits */ }; SPAN_DECLARE_DATA extern const fsk_spec_t preset_fsk_specs[]; diff --git a/libs/spandsp/src/spandsp/modem_connect_tones.h b/libs/spandsp/src/spandsp/modem_connect_tones.h index f0c0aaeb2e..7c0219f8a9 100644 --- a/libs/spandsp/src/spandsp/modem_connect_tones.h +++ b/libs/spandsp/src/spandsp/modem_connect_tones.h @@ -76,9 +76,11 @@ enum This is only valid as a tone type to receive. It is never reported as a detected tone type. The report will either be for FAX preamble or CED/ANS tone. */ MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE = 7, + /*! \brief Bell ANS tone is a pure continuous 2225Hz+-15Hz tone for 3.3s+-0.7s. */ + MODEM_CONNECT_TONES_BELL_ANS = 8, /*! \brief Calling tone is a pure 1300Hz tone, in 0.6s bursts, with 2s silences in between. The bursts repeat for as long as is required. */ - MODEM_CONNECT_TONES_CALLING_TONE = 8 + MODEM_CONNECT_TONES_CALLING_TONE = 9 }; /*! \brief FAX CED tone is the same as ANS tone. */ diff --git a/libs/spandsp/src/spandsp/private/async.h b/libs/spandsp/src/spandsp/private/async.h index c3837641df..715d659d9e 100644 --- a/libs/spandsp/src/spandsp/private/async.h +++ b/libs/spandsp/src/spandsp/private/async.h @@ -45,7 +45,7 @@ struct async_tx_state_s void *user_data; /*! \brief A current, partially transmitted, character. */ - int byte_in_progress; + unsigned int byte_in_progress; /*! \brief The current bit position within a partially transmitted character. */ int bitpos; /*! \brief Parity bit. */ @@ -73,7 +73,7 @@ struct async_rx_state_s void *user_data; /*! \brief A current, partially complete, character. */ - int byte_in_progress; + unsigned int byte_in_progress; /*! \brief The current bit position within a partially complete character. */ int bitpos; /*! \brief Parity bit. */ diff --git a/libs/spandsp/src/spandsp/private/v18.h b/libs/spandsp/src/spandsp/private/v18.h index 6f7d987bea..b51a899ec6 100644 --- a/libs/spandsp/src/spandsp/private/v18.h +++ b/libs/spandsp/src/spandsp/private/v18.h @@ -56,6 +56,7 @@ struct v18_state_s int rx_msg_len; int bit_pos; int in_progress; + int repeat_shifts; /*! \brief Error and flow logging control */ logging_state_t logging; diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index ee939b5cfd..639ae0770c 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -69,6 +69,55 @@ #include +/* + Ways in which a V.18 call may start + ----------------------------------- + + Originate: + ANS + Silence for 0.5s then send TXP + DTMF + Proceed as Annex B + 1650Hz (V21 ch 2 low) + Proceed as Annex F in call mode + 1300Hz (Calling tone) + Proceed as Annex E in call mode + 1400Hz/1800Hz (Weitbrecht) + Detect rate and proceed as Annex A + 980Hz/1180Hz (V21 ch 1) + Start timer Tr + 2225Hz (Bell ANS) + Proceed as Annex D call mode + 1270Hz (Bell103 ch 2 high) + Proceed as Annex D answer mode + 390Hz (V23 ch 2 low) + Proceed as Annex E answer mode + + Answer: + ANS + Monitor as caller for 980Hz or 1300Hz + CI/XCI + Respond with ANSam + 1300Hz + Probe + Timer Ta (3s) + Probe + 1400Hz/1800Hz (Weitbrecht) + Detect rate and proceed as Annex A + DTMF + Proceed as Annex B + 980Hz (V21 ch 1 low) + Start timer Te + 1270Hz (Bell103 ch 2 high) + Proceed as Annex D answer mode + 2225Hz (Bell ANS) + Proceed as Annex D call mode + 1650Hz (V21 ch 2 low) + Proceed as Annex F answer mode + ANSam + Proceed as V.8 caller Annex G +*/ + /*! The baudot code to shift from alpha to digits and symbols */ #define BAUDOT_FIGURE_SHIFT 0x1B /*! The baudot code to shift from digits and symbols to alpha */ @@ -310,6 +359,20 @@ static const char *ascii_to_dtmf[128] = "*0" /* DEL >> BACK SPACE */ }; +static const uint8_t txp[] = "1111111111000101011100001101110000010101"; + +/* XCI is: + 400 ms mark; + XCI marker; + 800 ms mark; + XCI marker; + 800 ms mark; + XCI marker; + 800 ms mark; + XCI marker; + 100 ms mark. */ +static const uint8_t xci[] = "01111111110111111111"; + static int cmp(const void *s, const void *t) { const char *ss; @@ -319,6 +382,7 @@ static int cmp(const void *s, const void *t) tt = (struct dtmf_to_ascii_s *) t; return strncmp(ss, tt->dtmf, strlen(tt->dtmf)); } +/*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) v18_encode_dtmf(v18_state_t *s, char dtmf[], const char msg[]) { @@ -525,14 +589,14 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch) /* Need to allow for a possible character set change. */ if ((ch & 0x80)) { - if (s->baudot_tx_shift == 1) + if (!s->repeat_shifts && s->baudot_tx_shift == 1) return ch & 0x1F; s->baudot_tx_shift = 1; shift = BAUDOT_FIGURE_SHIFT; } else { - if (s->baudot_tx_shift == 0) + if (!s->repeat_shifts && s->baudot_tx_shift == 0) return ch & 0x1F; s->baudot_tx_shift = 0; shift = BAUDOT_LETTER_SHIFT; @@ -592,13 +656,18 @@ static int v18_tdd_get_async_byte(void *user_data) } /*- End of function --------------------------------------------------------*/ +static int v18_edt_get_async_byte(void *user_data) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + static void v18_tdd_put_async_byte(void *user_data, int byte) { v18_state_t *s; uint8_t octet; s = (v18_state_t *) user_data; - //printf("Rx byte %x\n", byte); if (byte < 0) { /* Special conditions */ @@ -626,7 +695,8 @@ static void v18_tdd_put_async_byte(void *user_data, int byte) } return; } - if ((octet = v18_decode_baudot(s, (uint8_t) (byte & 0x1F)))) + span_log(&s->logging, SPAN_LOG_FLOW, "Rx byte %x\n", byte); + if ((octet = v18_decode_baudot(s, byte))) s->rx_msg[s->rx_msg_len++] = octet; if (s->rx_msg_len >= 256) { @@ -637,24 +707,44 @@ static void v18_tdd_put_async_byte(void *user_data, int byte) } /*- End of function --------------------------------------------------------*/ +static void v18_edt_put_async_byte(void *user_data, int byte) +{ +} +/*- End of function --------------------------------------------------------*/ + +static void v18_bell103_put_async_byte(void *user_data, int byte) +{ +} +/*- End of function --------------------------------------------------------*/ + +static void v18_videotex_put_async_byte(void *user_data, int byte) +{ +} +/*- End of function --------------------------------------------------------*/ + +static void v18_textphone_put_async_byte(void *user_data, int byte) +{ +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len) { int len; int lenx; - len = tone_gen(&(s->alert_tone_gen), amp, max_len); + len = tone_gen(&s->alert_tone_gen, amp, max_len); if (s->tx_signal_on) { switch (s->mode) { case V18_MODE_DTMF: if (len < max_len) - len += dtmf_tx(&(s->dtmftx), amp, max_len - len); + len += dtmf_tx(&s->dtmftx, amp, max_len - len); break; default: if (len < max_len) { - if ((lenx = fsk_tx(&(s->fsktx), amp + len, max_len - len)) <= 0) + if ((lenx = fsk_tx(&s->fsktx, amp + len, max_len - len)) <= 0) s->tx_signal_on = FALSE; len += lenx; } @@ -674,10 +764,10 @@ SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len) s->in_progress -= len; if (s->in_progress <= 0) s->rx_msg_len = 0; - dtmf_rx(&(s->dtmfrx), amp, len); + dtmf_rx(&s->dtmfrx, amp, len); break; default: - fsk_rx(&(s->fskrx), amp, len); + fsk_rx(&s->fskrx, amp, len); break; } return 0; @@ -744,45 +834,62 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, } memset(s, 0, sizeof(*s)); s->calling_party = calling_party; - s->mode = mode; + s->mode = mode & 0xFF; s->put_msg = put_msg; s->user_data = user_data; switch (s->mode) { case V18_MODE_5BIT_45: - fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &(s->asynctx)); - async_tx_init(&(s->asynctx), 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &s->asynctx); + async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_tx_shift = 2; /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); s->baudot_rx_shift = 0; + s->repeat_shifts = mode & 0x100; break; case V18_MODE_5BIT_50: - fsk_tx_init(&(s->fsktx), &preset_fsk_specs[FSK_WEITBRECHT50], async_tx_get_bit, &(s->asynctx)); - async_tx_init(&(s->asynctx), 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT50], async_tx_get_bit, &s->asynctx); + async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, FALSE, v18_tdd_get_async_byte, s); /* Schedule an explicit shift at the start of baudot transmission */ s->baudot_tx_shift = 2; /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and ride over the fraction. */ - fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s); s->baudot_rx_shift = 0; + s->repeat_shifts = mode & 0x100; break; case V18_MODE_DTMF: - dtmf_tx_init(&(s->dtmftx)); - dtmf_rx_init(&(s->dtmfrx), v18_rx_dtmf, s); + dtmf_tx_init(&s->dtmftx); + dtmf_rx_init(&s->dtmfrx, v18_rx_dtmf, s); break; case V18_MODE_EDT: + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_V21CH1_110], async_tx_get_bit, &s->asynctx); + async_tx_init(&s->asynctx, 7, ASYNC_PARITY_EVEN, 2, FALSE, v18_edt_get_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_V21CH1_110], FSK_FRAME_MODE_7E2_FRAMES, v18_edt_put_async_byte, s); break; case V18_MODE_BELL103: + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_BELL103CH1], async_tx_get_bit, &s->asynctx); + async_tx_init(&s->asynctx, 7, ASYNC_PARITY_EVEN, 1, FALSE, v18_edt_get_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_BELL103CH2], FSK_FRAME_MODE_7E1_FRAMES, v18_bell103_put_async_byte, s); break; case V18_MODE_V23VIDEOTEX: + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_V23CH1], async_tx_get_bit, &s->asynctx); + async_tx_init(&s->asynctx, 7, ASYNC_PARITY_EVEN, 1, FALSE, v18_edt_get_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_V23CH2], FSK_FRAME_MODE_7E1_FRAMES, v18_videotex_put_async_byte, s); break; case V18_MODE_V21TEXTPHONE: + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_V21CH1], async_tx_get_bit, &s->asynctx); + async_tx_init(&s->asynctx, 7, ASYNC_PARITY_EVEN, 1, FALSE, v18_edt_get_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_V21CH1], FSK_FRAME_MODE_7E1_FRAMES, v18_textphone_put_async_byte, s); break; case V18_MODE_V18TEXTPHONE: + fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_V21CH1], async_tx_get_bit, &s->asynctx); + async_tx_init(&s->asynctx, 7, ASYNC_PARITY_EVEN, 1, FALSE, v18_edt_get_async_byte, s); + fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_V21CH1], FSK_FRAME_MODE_7E1_FRAMES, v18_textphone_put_async_byte, s); break; } queue_init(&s->queue.queue, 128, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC); @@ -805,7 +912,7 @@ SPAN_DECLARE(int) v18_free(v18_state_t *s) SPAN_DECLARE(const char *) v18_mode_to_str(int mode) { - switch (mode) + switch (mode & 0xFF) { case V18_MODE_NONE: return "None"; diff --git a/libs/spandsp/tests/modem_connect_tones_tests.c b/libs/spandsp/tests/modem_connect_tones_tests.c index fb063cbc54..dc5147a9a8 100644 --- a/libs/spandsp/tests/modem_connect_tones_tests.c +++ b/libs/spandsp/tests/modem_connect_tones_tests.c @@ -49,30 +49,38 @@ These tests... #include "spandsp.h" #include "spandsp-sim.h" -#define SAMPLES_PER_CHUNK 160 +#define SAMPLES_PER_CHUNK 160 -#define OUTPUT_FILE_NAME "modem_connect_tones.wav" +#define OUTPUT_FILE_NAME "modem_connect_tones.wav" -#define MITEL_DIR "../test-data/mitel/" -#define BELLCORE_DIR "../test-data/bellcore/" +#define MITEL_DIR "../test-data/mitel/" +#define BELLCORE_DIR "../test-data/bellcore/" #define FALSE 0 #define TRUE (!FALSE) -#define LEVEL_MAX -5 -#define LEVEL_MIN -48 -#define LEVEL_MIN_ACCEPT -43 -#define LEVEL_MIN_REJECT -44 +#define LEVEL_MAX -5 +#define LEVEL_MIN -48 +#define LEVEL_MIN_ACCEPT -43 +#define LEVEL_MIN_REJECT -44 /* The 1100Hz tone is supposed to be within 38Hz, according to T.30. Allow another 8Hz for FDM, even though you rarely see that used today. */ -#define CED_FREQ_TOLERANCE (38 + 8) -#define CED_FREQ_BLACKOUT (80) +#define CED_FREQ_TOLERANCE (38 + 8) +#define CED_FREQ_BLACKOUT (80) /* The 2100Hz tone is supposed to be within 15Hz, according to T.30. Allow another 8Hz for FDM, even though you rarely see that used today. */ -#define CNG_FREQ_TOLERANCE (15 + 8) -#define CNG_FREQ_BLACKOUT (80) -#define AM_FREQ_TOLERANCE (1) +#define CNG_FREQ_TOLERANCE (15 + 8) +#define CNG_FREQ_BLACKOUT (80) +#define AM_FREQ_TOLERANCE (1) +/* The 2225Hz tone is supposed to be within 15Hz. Allow another 8Hz for FDM, even though + you rarely see that used today. */ +#define BELL_ANS_FREQ_TOLERANCE (15 + 8) +#define BELL_ANS_FREQ_BLACKOUT (80) +/* The 1300Hz tone is supposed to be within 15Hz, according to V.25. Allow another 8Hz for FDM, even though + you rarely see that used today. */ +#define CALLING_TONE_FREQ_TOLERANCE (15 + 8) +#define CALLING_TONE_FREQ_BLACKOUT (80) const char *bellcore_files[] = { @@ -93,24 +101,30 @@ enum PERFORM_TEST_1C = (1 << 3), PERFORM_TEST_1D = (1 << 4), PERFORM_TEST_1E = (1 << 5), - PERFORM_TEST_2A = (1 << 6), - PERFORM_TEST_2B = (1 << 7), - PERFORM_TEST_2C = (1 << 8), - PERFORM_TEST_2D = (1 << 9), - PERFORM_TEST_2E = (1 << 10), - PERFORM_TEST_3A = (1 << 11), - PERFORM_TEST_3B = (1 << 12), - PERFORM_TEST_3C = (1 << 13), - PERFORM_TEST_3D = (1 << 14), - PERFORM_TEST_3E = (1 << 15), - PERFORM_TEST_4 = (1 << 16), - PERFORM_TEST_5A = (1 << 17), - PERFORM_TEST_5B = (1 << 18), - PERFORM_TEST_6A = (1 << 19), - PERFORM_TEST_6B = (1 << 20), - PERFORM_TEST_7A = (1 << 21), - PERFORM_TEST_7B = (1 << 22), - PERFORM_TEST_8 = (1 << 23) + PERFORM_TEST_1F = (1 << 6), + PERFORM_TEST_1G = (1 << 7), + PERFORM_TEST_2A = (1 << 8), + PERFORM_TEST_2B = (1 << 9), + PERFORM_TEST_2C = (1 << 10), + PERFORM_TEST_2D = (1 << 11), + PERFORM_TEST_2E = (1 << 12), + PERFORM_TEST_2F = (1 << 13), + PERFORM_TEST_2G = (1 << 14), + PERFORM_TEST_3A = (1 << 15), + PERFORM_TEST_3B = (1 << 16), + PERFORM_TEST_3C = (1 << 17), + PERFORM_TEST_3D = (1 << 18), + PERFORM_TEST_3E = (1 << 19), + PERFORM_TEST_3F = (1 << 20), + PERFORM_TEST_3G = (1 << 21), + PERFORM_TEST_4 = (1 << 22), + PERFORM_TEST_5A = (1 << 23), + PERFORM_TEST_5B = (1 << 24), + PERFORM_TEST_6A = (1 << 25), + PERFORM_TEST_6B = (1 << 26), + PERFORM_TEST_7A = (1 << 27), + PERFORM_TEST_7B = (1 << 28), + PERFORM_TEST_8 = (1 << 29) }; int preamble_count = 0; @@ -184,6 +198,22 @@ static void ans_pr_detected(void *user_data, int tone, int level, int delay) } /*- End of function --------------------------------------------------------*/ +static void bell_ans_detected(void *user_data, int tone, int level, int delay) +{ + printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level); + if (tone == MODEM_CONNECT_TONES_BELL_ANS) + hits++; +} +/*- End of function --------------------------------------------------------*/ + +static void calling_tone_detected(void *user_data, int tone, int level, int delay) +{ + printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level); + if (tone == MODEM_CONNECT_TONES_CALLING_TONE) + hits++; +} +/*- End of function --------------------------------------------------------*/ + int main(int argc, char *argv[]) { int i; @@ -198,6 +228,8 @@ int main(int argc, char *argv[]) modem_connect_tones_rx_state_t ced_rx; modem_connect_tones_rx_state_t ans_pr_rx; modem_connect_tones_tx_state_t modem_tone_tx; + modem_connect_tones_rx_state_t calling_tone_rx; + modem_connect_tones_rx_state_t bell_ans_rx; awgn_state_t chan_noise_source; SNDFILE *inhandle; SNDFILE *outhandle; @@ -207,9 +239,6 @@ int main(int argc, char *argv[]) int hit; int false_hit; int false_miss; - power_meter_t power_state; - int power; - int max_power; int level2; int max_level2; int tone_type; @@ -247,6 +276,10 @@ int main(int argc, char *argv[]) test_list |= PERFORM_TEST_1D; else if (strcasecmp(argv[i], "1e") == 0) test_list |= PERFORM_TEST_1E; + else if (strcasecmp(argv[i], "1f") == 0) + test_list |= PERFORM_TEST_1F; + else if (strcasecmp(argv[i], "1g") == 0) + test_list |= PERFORM_TEST_1G; else if (strcasecmp(argv[i], "2a") == 0) test_list |= PERFORM_TEST_2A; else if (strcasecmp(argv[i], "2b") == 0) @@ -257,6 +290,10 @@ int main(int argc, char *argv[]) test_list |= PERFORM_TEST_2D; else if (strcasecmp(argv[i], "2e") == 0) test_list |= PERFORM_TEST_2E; + else if (strcasecmp(argv[i], "2f") == 0) + test_list |= PERFORM_TEST_2F; + else if (strcasecmp(argv[i], "2g") == 0) + test_list |= PERFORM_TEST_2G; else if (strcasecmp(argv[i], "3a") == 0) test_list |= PERFORM_TEST_3A; else if (strcasecmp(argv[i], "3b") == 0) @@ -267,6 +304,10 @@ int main(int argc, char *argv[]) test_list |= PERFORM_TEST_3D; else if (strcasecmp(argv[i], "3e") == 0) test_list |= PERFORM_TEST_3E; + else if (strcasecmp(argv[i], "3f") == 0) + test_list |= PERFORM_TEST_3F; + else if (strcasecmp(argv[i], "3g") == 0) + test_list |= PERFORM_TEST_3G; else if (strcasecmp(argv[i], "4") == 0) test_list |= PERFORM_TEST_4; else if (strcasecmp(argv[i], "5a") == 0) @@ -316,7 +357,7 @@ int main(int argc, char *argv[]) /*endfor*/ } /*endif*/ - + if ((test_list & PERFORM_TEST_1B)) { printf("Test 1b: CED/ANS generation to a file\n"); @@ -375,7 +416,7 @@ int main(int argc, char *argv[]) /*endfor*/ } /*endif*/ - + if ((test_list & PERFORM_TEST_1E)) { printf("Test 1e: ANSam/ (Modulated EC-disable) generation to a file\n"); @@ -396,13 +437,51 @@ int main(int argc, char *argv[]) } /*endif*/ + if ((test_list & PERFORM_TEST_1F)) + { + printf("Test 1f: Bell answer tone generation to a file\n"); + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_BELL_ANS); + for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + + if ((test_list & PERFORM_TEST_1G)) + { + printf("Test 1g: Calling tone generation to a file\n"); + modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_CALLING_TONE); + for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + outframes = sf_writef_short(outhandle, amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ + } + /*endfor*/ + } + /*endif*/ + if (sf_close_telephony(outhandle)) { printf(" Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); exit(2); } /*endif*/ - + if ((test_list & PERFORM_TEST_2A)) { printf("Test 2a: CNG detection with frequency\n"); @@ -410,16 +489,13 @@ int main(int argc, char *argv[]) awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); false_hit = FALSE; false_miss = FALSE; - for (pitch = 600; pitch <= 1600; pitch++) + for (pitch = 1100 - 500; pitch <= 1100 + 500; pitch++) { /* Use the transmitter to test the receiver */ modem_connect_tones_tx_init(&modem_tone_tx, tone_type); /* Fudge things for the test */ modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); modem_connect_tones_rx_init(&cng_rx, tone_type, NULL, NULL); - power_meter_init(&power_state, 5); - power = 0; - max_power = 0; level2 = 0; max_level2 = 0; for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) @@ -428,10 +504,6 @@ int main(int argc, char *argv[]) for (j = 0; j < samples; j++) { amp[j] += awgn(&chan_noise_source); - power = power_meter_update(&power_state, amp[j]); - if (power > max_power) - max_power = power; - /*endif*/ level2 += ((abs(amp[j]) - level2) >> 5); if (level2 > max_level2) max_level2 = level2; @@ -455,7 +527,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, cng_rx.channel_level, cng_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, cng_rx.channel_level, cng_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -475,7 +547,7 @@ int main(int argc, char *argv[]) awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); false_hit = FALSE; false_miss = FALSE; - for (pitch = 1600; pitch < 2600; pitch++) + for (pitch = 2100 - 500; pitch < 2100 + 500; pitch++) { /* Use the transmitter to test the receiver */ modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS); @@ -506,7 +578,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ced_rx.channel_level, ced_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ced_rx.channel_level, ced_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } if (false_hit || false_miss) @@ -526,7 +598,7 @@ int main(int argc, char *argv[]) awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); false_hit = FALSE; false_miss = FALSE; - for (pitch = 2000; pitch <= 2200; pitch++) + for (pitch = 2100 - 100; pitch <= 2100 + 100; pitch++) { /* Use the transmitter to test the receiver */ modem_connect_tones_tx_init(&modem_tone_tx, tone_type); @@ -557,7 +629,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -578,7 +650,7 @@ int main(int argc, char *argv[]) awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); false_hit = FALSE; false_miss = FALSE; - for (pitch = 2000; pitch <= 2200; pitch++) + for (pitch = 2100 - 100; pitch <= 2100 + 100; pitch++) { /* Use the transmitter to test the receiver */ modem_connect_tones_tx_init(&modem_tone_tx, tone_type); @@ -609,7 +681,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -630,7 +702,7 @@ int main(int argc, char *argv[]) awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); false_hit = FALSE; false_miss = FALSE; - for (pitch = 2000; pitch <= 2200; pitch++) + for (pitch = 2100 - 100; pitch <= 2100 + 100; pitch++) { /* Use the transmitter to test the receiver */ modem_connect_tones_tx_init(&modem_tone_tx, tone_type); @@ -661,7 +733,125 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_2F)) + { + printf("Test 2f: Bell answer tone detection with frequency\n"); + tone_type = MODEM_CONNECT_TONES_BELL_ANS; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2225 - 500; pitch <= 2225 + 500; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&bell_ans_rx, tone_type, NULL, NULL); + level2 = 0; + max_level2 = 0; + for (i = 0; i < 8000; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + { + amp[j] += awgn(&chan_noise_source); + level2 += ((abs(amp[j]) - level2) >> 5); + if (level2 > max_level2) + max_level2 = level2; + } + /*endfor*/ + modem_connect_tones_rx(&bell_ans_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&bell_ans_rx); + if (pitch < (2225 - BELL_ANS_FREQ_BLACKOUT) || pitch > (2225 + BELL_ANS_FREQ_BLACKOUT)) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (2225 - BELL_ANS_FREQ_TOLERANCE) && pitch < (2225 + BELL_ANS_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, bell_ans_rx.channel_level, bell_ans_rx.notch_level, modem_connect_tone_to_str(hit), hit); + /*endif*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_2G)) + { + printf("Test 2g: Calling tone detection with frequency\n"); + tone_type = MODEM_CONNECT_TONES_CALLING_TONE; + awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 1300 - 500; pitch <= 1300 + 500; pitch++) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_connect_tones_rx_init(&calling_tone_rx, tone_type, NULL, NULL); + level2 = 0; + max_level2 = 0; + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + { + amp[j] += awgn(&chan_noise_source); + level2 += ((abs(amp[j]) - level2) >> 5); + if (level2 > max_level2) + max_level2 = level2; + } + /*endfor*/ + modem_connect_tones_rx(&calling_tone_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&calling_tone_rx); + if (pitch < (1300 - CALLING_TONE_FREQ_BLACKOUT) || pitch > (1300 + CALLING_TONE_FREQ_BLACKOUT)) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (pitch > (1300 - CALLING_TONE_FREQ_TOLERANCE) && pitch < (1300 + CALLING_TONE_FREQ_TOLERANCE)) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, calling_tone_rx.channel_level, calling_tone_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -716,7 +906,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, cng_rx.channel_level, cng_rx.notch_level, hit); + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, level, cng_rx.channel_level, cng_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -773,7 +963,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ced_rx.channel_level, ced_rx.notch_level, hit); + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, level, ced_rx.channel_level, ced_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -831,8 +1021,8 @@ int main(int argc, char *argv[]) /*endif*/ } /*endif*/ - //if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -889,7 +1079,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -947,7 +1137,121 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_3F)) + { + printf("Test 3f: Bell answer tone detection with level\n"); + tone_type = MODEM_CONNECT_TONES_BELL_ANS; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 2225 - BELL_ANS_FREQ_TOLERANCE; pitch <= 2225 + BELL_ANS_FREQ_TOLERANCE; pitch += 2*BELL_ANS_FREQ_TOLERANCE) + { + for (level = LEVEL_MAX; level >= LEVEL_MIN; level--) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_tone_tx.level = dds_scaling_dbm0(level); + modem_connect_tones_rx_init(&calling_tone_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&calling_tone_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&calling_tone_rx); + if (level < LEVEL_MIN_REJECT) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (level > LEVEL_MIN_ACCEPT) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, level, calling_tone_rx.channel_level, calling_tone_rx.notch_level, modem_connect_tone_to_str(hit), hit); + /*endif*/ + } + /*endfor*/ + } + /*endfor*/ + if (false_hit || false_miss) + { + printf("Test failed.\n"); + exit(2); + } + /*endif*/ + printf("Test passed.\n"); + } + /*endif*/ + + if ((test_list & PERFORM_TEST_3G)) + { + printf("Test 3g: Calling tone detection with level\n"); + tone_type = MODEM_CONNECT_TONES_CALLING_TONE; + awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f); + false_hit = FALSE; + false_miss = FALSE; + for (pitch = 1300 - CALLING_TONE_FREQ_TOLERANCE; pitch <= 1300 + CALLING_TONE_FREQ_TOLERANCE; pitch += 2*CALLING_TONE_FREQ_TOLERANCE) + { + for (level = LEVEL_MAX; level >= LEVEL_MIN; level--) + { + /* Use the transmitter to test the receiver */ + modem_connect_tones_tx_init(&modem_tone_tx, tone_type); + /* Fudge things for the test */ + modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch); + modem_tone_tx.level = dds_scaling_dbm0(level); + modem_connect_tones_rx_init(&calling_tone_rx, tone_type, NULL, NULL); + for (i = 0; i < 10*SAMPLE_RATE; i += SAMPLES_PER_CHUNK) + { + samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK); + for (j = 0; j < samples; j++) + amp[j] += awgn(&chan_noise_source); + /*endfor*/ + modem_connect_tones_rx(&calling_tone_rx, amp, samples); + } + /*endfor*/ + hit = modem_connect_tones_rx_get(&calling_tone_rx); + if (level < LEVEL_MIN_REJECT) + { + if (hit != MODEM_CONNECT_TONES_NONE) + false_hit = TRUE; + /*endif*/ + } + else if (level > LEVEL_MIN_ACCEPT) + { + if (hit != tone_type) + false_miss = TRUE; + /*endif*/ + } + /*endif*/ + if (hit != MODEM_CONNECT_TONES_NONE) + printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, level, calling_tone_rx.channel_level, calling_tone_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -1146,7 +1450,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -1198,7 +1502,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -1251,7 +1555,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -1304,7 +1608,7 @@ int main(int argc, char *argv[]) } /*endif*/ if (hit != MODEM_CONNECT_TONES_NONE) - printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit); + printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %s (%d)\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, modem_connect_tone_to_str(hit), hit); /*endif*/ } /*endfor*/ @@ -1331,6 +1635,8 @@ int main(int argc, char *argv[]) modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, NULL, NULL); modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL); modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); + modem_connect_tones_rx_init(&bell_ans_rx, MODEM_CONNECT_TONES_BELL_ANS, NULL, NULL); + modem_connect_tones_rx_init(&calling_tone_rx, MODEM_CONNECT_TONES_CALLING_TONE, NULL, NULL); for (j = 0; bellcore_files[j][0]; j++) { if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL) @@ -1348,6 +1654,8 @@ int main(int argc, char *argv[]) modem_connect_tones_rx(&cng_rx, amp, frames); modem_connect_tones_rx(&ced_rx, amp, frames); modem_connect_tones_rx(&ans_pr_rx, amp, frames); + modem_connect_tones_rx(&bell_ans_rx, amp, frames); + modem_connect_tones_rx(&calling_tone_rx, amp, frames); if (modem_connect_tones_rx_get(&cng_rx) != MODEM_CONNECT_TONES_NONE) { /* This is not a true measure of hits, as there might be more @@ -1372,6 +1680,20 @@ int main(int argc, char *argv[]) modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); } /*endif*/ + if (modem_connect_tones_rx_get(&bell_ans_rx) != MODEM_CONNECT_TONES_NONE) + { + printf("Hit calling tone at %ds\n", when); + hits++; + modem_connect_tones_rx_init(&bell_ans_rx, MODEM_CONNECT_TONES_BELL_ANS, NULL, NULL); + } + /*endif*/ + if (modem_connect_tones_rx_get(&calling_tone_rx) != MODEM_CONNECT_TONES_NONE) + { + printf("Hit calling tone at %ds\n", when); + hits++; + modem_connect_tones_rx_init(&calling_tone_rx, MODEM_CONNECT_TONES_CALLING_TONE, NULL, NULL); + } + /*endif*/ } /*endwhile*/ if (sf_close_telephony(inhandle)) @@ -1399,6 +1721,8 @@ int main(int argc, char *argv[]) modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, cng_detected, NULL); modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, ced_detected, NULL); modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ans_pr_detected, NULL); + modem_connect_tones_rx_init(&bell_ans_rx, MODEM_CONNECT_TONES_BELL_ANS, bell_ans_detected, NULL); + modem_connect_tones_rx_init(&calling_tone_rx, MODEM_CONNECT_TONES_CALLING_TONE, calling_tone_detected, NULL); hits = 0; if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL) { @@ -1415,6 +1739,8 @@ int main(int argc, char *argv[]) modem_connect_tones_rx(&cng_rx, amp, frames); modem_connect_tones_rx(&ced_rx, amp, frames); modem_connect_tones_rx(&ans_pr_rx, amp, frames); + modem_connect_tones_rx(&bell_ans_rx, amp, frames); + modem_connect_tones_rx(&calling_tone_rx, amp, frames); } /*endwhile*/ if (sf_close_telephony(inhandle)) diff --git a/libs/spandsp/tests/t38_core_tests.c b/libs/spandsp/tests/t38_core_tests.c index c986d90c5d..efd103dcb3 100644 --- a/libs/spandsp/tests/t38_core_tests.c +++ b/libs/spandsp/tests/t38_core_tests.c @@ -479,7 +479,7 @@ int main(int argc, char *argv[]) int attack_packets; int opt; - attack_packets = 10000000; + attack_packets = 100000; while ((opt = getopt(argc, argv, "a:")) != -1) { switch (opt) diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index fc8d3f4ebb..2c07794196 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -62,7 +62,7 @@ t4_state_t receive_state; #define FILL_670 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_70 #define FILL_980 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_80 -static const char t4_test_patterns[][1728 + 1] = +static const char t4_t6_test_patterns[][1728 + 1] = { "XXXXXX " FILL_980 " XXX XXX X " FILL_670 " XXXX", "XXXXXX " FILL_980 " XXX X " FILL_670 " XXXX", @@ -145,7 +145,7 @@ static int row_read_handler(void *user_data, uint8_t buf[], size_t len) /* Send the test pattern. */ if (rows_read >= 16) return 0; - s = t4_test_patterns[rows_read++]; + s = t4_t6_test_patterns[rows_read++]; memset(buf, 0, len); for (i = 0; i < len; i++) { @@ -171,7 +171,7 @@ static int row_write_handler(void *user_data, const uint8_t buf[], size_t len) /* Verify that what is received matches the test pattern. */ if (len == 0) return 0; - s = t4_test_patterns[rows_written++]; + s = t4_t6_test_patterns[rows_written++]; memset(ref, 0, len); for (i = 0; i < len; i++) { diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index 74587fbb90..af557285ce 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -972,7 +972,6 @@ static int next_step(faxtester_state_t *s) printf("Test failed\n"); exit(2); } - t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); t4_tx_set_header_info(&t4_tx_state, NULL); compression_type = T4_COMPRESSION_ITU_T4_1D; if (compression) @@ -983,6 +982,7 @@ static int next_step(faxtester_state_t *s) compression_type = T4_COMPRESSION_ITU_T6; } t4_tx_set_tx_encoding(&t4_tx_state, compression_type); + t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); if (t4_tx_start_page(&t4_tx_state)) { span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); @@ -996,7 +996,7 @@ static int next_step(faxtester_state_t *s) corrupt_image(s, image, len, (const char *) bad_rows); } t4_tx_release(&t4_tx_state); - span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes\n", len); + span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes (min row bits %d)\n", len, min_row_bits); faxtester_set_non_ecm_image_buffer(s, image, len); } else if (strcasecmp((const char *) type, "PP") == 0) @@ -1012,7 +1012,6 @@ static int next_step(faxtester_state_t *s) printf("Test failed\n"); exit(2); } - t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); t4_tx_set_header_info(&t4_tx_state, NULL); compression_type = T4_COMPRESSION_ITU_T4_1D; if (compression) @@ -1023,6 +1022,7 @@ static int next_step(faxtester_state_t *s) compression_type = T4_COMPRESSION_ITU_T6; } t4_tx_set_tx_encoding(&t4_tx_state, compression_type); + t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); if (t4_tx_start_page(&t4_tx_state)) { span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); @@ -1038,7 +1038,7 @@ static int next_step(faxtester_state_t *s) } /*endif*/ t4_tx_release(&t4_tx_state); - span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes\n", len); + span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes (min row bits %d)\n", len, min_row_bits); faxtester_set_ecm_image_buffer(s, image, len, ecm_block, ecm_frame_size, i); } else diff --git a/libs/spandsp/tests/v17_tests.c b/libs/spandsp/tests/v17_tests.c index 33aef4d2ba..940e7f0751 100644 --- a/libs/spandsp/tests/v17_tests.c +++ b/libs/spandsp/tests/v17_tests.c @@ -227,11 +227,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #endif #if defined(ENABLE_GUI) if (use_gui) + { #if defined(SPANDSP_USE_FIXED_POINTx) qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(qam_monitor, coeffs, len); #endif + } #endif update_interval = 100; } diff --git a/libs/spandsp/tests/v18_tests.c b/libs/spandsp/tests/v18_tests.c index 1666ce96a1..951fc88781 100644 --- a/libs/spandsp/tests/v18_tests.c +++ b/libs/spandsp/tests/v18_tests.c @@ -70,7 +70,6 @@ const char *full_baudot_rx = "XABCDEFGHIJKLMNOPQRSTUVWXYZ(/)' " "'ABCDEFGHIJKLMNOPQRSTUVWXYZ(!) "; -#if 1 static void put_text_msg(void *user_data, const uint8_t *msg, int len) { if (strcmp((const char *) msg, qbf_rx)) @@ -94,10 +93,17 @@ static void basic_tests(int mode) int i; v18_state_t *v18_a; v18_state_t *v18_b; + logging_state_t *logging; printf("Testing %s\n", v18_mode_to_str(mode)); v18_a = v18_init(NULL, TRUE, mode, put_text_msg, NULL); + logging = v18_get_logging_state(v18_a); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "A"); v18_b = v18_init(NULL, FALSE, mode, put_text_msg, NULL); + logging = v18_get_logging_state(v18_b); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, "B"); /* Fake an OK condition for the first message test */ good_message_received = TRUE; @@ -153,11 +159,1353 @@ static void basic_tests(int mode) v18_free(v18_b); } /*- End of function --------------------------------------------------------*/ -#endif + +static int test_misc_01(void) +{ + /* + III.5.4.1.1 No disconnection test + Purpose: To verify that the DCE does not initiate a disconnection. + Preamble: N/A + Method: A call is made to the TUT from the tester which remains off hook for 10 minutes + without sending any signal. + Pass criteria: The TUT should answer the call and enter the probing state after 3 seconds. The + TUT should continue to probe until the test is terminated. + Comments: This feature should also be verified by observation during the automoding tests. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_02(void) +{ + /* + III.5.4.1.2 Automatic resumption of automoding + Purpose: To ensure that the DCE can be configured to automatically re-assume the automode + calling state after 10 s of no valid signal. + Preamble: The TUT should be configured to automatically re-assume the initial automoding + state. + Method: The tester should set up a call to the TUT in V.21 mode and then drop the carrier. + The tester will then transmit silence for 11 seconds followed by a 1300 Hz tone for + 5 seconds (i.e. V.23). + Pass criteria: 1) Ten seconds after dropping the carrier the TUT should return to state Monitor 1. + 2) After 2.7±0.3 seconds the TUT should select V.23 mode and send a 390 Hz tone. + Comments: The TUT should indicate that carrier has been lost at some time after the 1650 Hz + signal is lost. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_03(void) +{ + /* + III.5.4.1.3 Retention of selected mode on loss of signal + Purpose: To ensure that the DCE stays in the selected transmission mode if it is not + configured to automatically re-assume the initial automoding state. + Preamble: The TUT should be configured to remain in the selected transmission mode when + the carrier is lost. + Method: The tester should set up a call to the TUT in V.21 mode, for example. It will drop + the carrier for 9 seconds and then re-start transmission of the same carrier for + 1 second followed by a short message. + Pass criteria: The TUT should resume operation in V.21 mode and capture the entire test + message. + Comments: The TUT should indicate that carrier has been lost at some time after the carrier + signal is removed and not disconnect. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_04(void) +{ + /* + III.5.4.1.4 Detection of BUSY tone + Purpose: To ensure that the DCE provides the call progress indication "BUSY" in presence of + the national busy tone. + Preamble: N/A + Method: The TUT should be configured to dial out and then be presented with the + appropriate national busy tone. + Pass criteria: Detection of busy tone should be displayed by the TUT. + Comments: ITU-T V.18 specifies that the DCE should not hang up, but that is intended to apply + to the case where a connection is established and then lost. A terminal may + automatically hang up when busy tone is detected. PABX busy tones may differ in + frequency and cadence from national parameters. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_05(void) +{ + /* + III.5.4.1.5 Detection of RINGING + Purpose: To ensure that the DCE provides the call progress indication "RINGING" in + presence of the national ringing tone. + Preamble: N/A + Method: The tester will make a call to the TUT using the nationally recommended cadence + and the minimum recommended ring voltage/current. + Pass criteria: The RINGING condition should be visually indicated by the TUT. + Comments: This test should be repeated across a range of valid timings and ring voltages. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_06(void) +{ + /* + III.5.4.1.6 "LOSS OF CARRIER" indication + Purpose: To ensure that the DCE provides the call progress indication "LOSS OF CARRIER" + upon a loss of carrier in full duplex modes, i.e. V.21, V.23, Bell 103. + Preamble: N/A + Method: Set up a call in each of the full duplex modes and force a carrier failure to the TUT. + Pass criteria: Loss of carrier should be indicated and disappear when the carrier is restored. + Comments: The V.18 modem should not automatically disconnect when used in a manual + conversation mode. However, a V.18 equipped terminal may disconnect based on + operational decisions, e.g. when it is a terminal in automatic answering machine + mode. There may be other cases, e.g. where the V.18 DCE is used in a gateway, + when automatic disconnection is required. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_07(void) +{ + /* + III.5.4.1.7 Call progress indication + Purpose: To ensure that the DCE provides the call progress indication "CONNECT(x)" upon + a connection. + Preamble: N/A + Method: Correct CONNECT messages should be verified during the Automode tests that + follow. + Pass criteria: The relevant mode should be indicated by the DCE when automoding is complete. + However, this may possibly not be indicated by the DTE. + Comments: The possible modes are: V.21, V.23, Baudot 45, Baudot 50, EDT, Bell 103, DTMF. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_08(void) +{ + /* + III.5.4.1.8 Circuit 135 Test + Purpose: To ensure that the DCE implements circuit 135 or an equivalent way of indicating + presence of a signal. + Preamble: N/A + Method: A call from the TUT should be answered in voice mode after 20 seconds. The tester + will transmit sampled voice messages. V.24 circuit 135 or its equivalent should be + observed. + Pass criteria: The ring tone and speech shall be indicated by circuit 135. + Comment: The response times and signal level thresholds of Circuit 135 are not specified in + ITU-T V.18 or V.24 and therefore the pattern indicated may vary. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_misc_09(void) +{ + /* + III.5.4.1.9 Connection procedures + Purpose: To ensure that the TUT implements the call connect procedure described in + clause 6. + Preamble: N/A + Method: TBD + Pass criteria: TBD + Comment: TBD + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_01(void) +{ + /* + III.5.4.2.1 CI and XCI signal coding and cadence + Purpose: To verify that TUT correctly emits the CI and XCI signals with the ON/OFF + cadence defined in 5.1.1. + Preamble: N/A + Method: V.21 demodulator is used to decode the CI sequence and a timer to measure the + silence intervals between them. The XCI signal is also monitored and decoded to + check for correct coding and timing of the signal. + Pass criteria: 1) No signal should be transmitted for one second after connecting to the line. + 2) Four CI patterns are transmitted for each repetition. + 3) No signal is transmitted for two seconds after the end of each CI. + 4) Each CI must have the correct bit pattern. + 5) The CI patterns followed by two seconds of silence must be repeated twice. + 6) One second after every 3 blocks CI an XCI signal must be transmitted. + 7) The XCI should have the structure defined in 3.11. + 8) The whole sequence should be repeated until the call is cleared. + 9) When V.18 to V.18, the XCI must not force V.23 or Minitel mode. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_02(void) +{ + /* + III.5.4.2.2 ANS signal detection + Purpose: To verify that TUT correctly detects the ANS (2100 Hz) signal during the + two-second interval (Toff) between transmission of CI sequences. + Preamble: Make a V.18 call from the TUT. + Method: The Test System waits for the TUT to stop transmitting a CI and responds with an + ANS signal. The V.21 demodulator is used to decode the TXP sequence and a timer + measures the silence intervals between them. ANS should be transmitted for 2 + seconds. + Pass criteria: 1) No signal should be transmitted by TUT for 0.5 seconds from detection of ANS. + 2) The TUT should reply with transmission of TXP as defined in 5.1.2. + 3) Verify that TXP sequence has correct bit pattern. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_03(void) +{ + /* + III.5.4.2.3 End of ANS signal detection + Purpose: The TUT should stop sending TXP at the end of the current sequence when the ANS + tone ceases. + Preamble: Test ORG-02 should be successfully completed immediately prior to this test. + Method: The tester sends ANS for 2 seconds followed by silence. The tester will then + monitor for cessation of TXP at the end of the answer tone. + Pass criteria: The TUT should stop sending TXP at the end of the current sequence when ANS + tone ceases. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_04(void) +{ + /* + III.5.4.2.4 ANS tone followed by TXP + Purpose: To check correct detection of V.18 modem. + Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. + Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + 3 TXP sequences using V.21 (2) and starts a 1 s timer. It will then transmit 1650 Hz + for 5 seconds. + Pass criteria: 1) TUT should initially respond with TXP. + 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. + 3) TUT should respond with 980 Hz carrier within 1 second of end of 3 TXP sequences. + 4) Data should be transmitted and received according to ITU-T T.140 to comply + with the V.18 operational requirements. + Comments: The TUT should indicate that V.18 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_05(void) +{ + /* + III.5.4.2.5 ANS tone followed by 1650 Hz + Purpose: To check correct detection of V.21 modem upper channel when preceded by answer + tone and to confirm discrimination between V.21 and V.18 modes. + Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. + Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + 1650 Hz and starts a 0.7 second timer. + Pass criteria: 1) TUT should initially respond with TXP. + 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. + 3) TUT should respond with 980 Hz at 0.5(+0.2-0.0) seconds of start of 1650 Hz. + 4) Data should be transmitted and received at 300 bit/s complying with Annex F. + Comments: Selection of ITU-T V.21 as opposed to ITU-T V.18 should be confirmed by + examination of TUT. If there is no visual indication, verify by use of ITU-T T.50 for + ITU-T V.21 as opposed to UTF-8 coded ISO 10646 character set for ITU-T V.18. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_06(void) +{ + /* + III.5.4.2.6 ANS tone followed by 1300 Hz + Purpose: To check correct detection of V.23 modem upper channel when preceded by answer + tone. + Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. + Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + 1300 Hz and starts a 2.7 s timer. + Pass criteria: 1) TUT should initially respond with TXP. + 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. + 3) TUT should respond with 390 Hz after 1.7(+0.2-0.0) seconds of start of 1300 Hz. + 4) Data should be transmitted and received at 75 bit/s and 1200 bit/s respectively + by the TUT to comply with Annex E. + Comments: The TUT should indicate that V.23 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_07(void) +{ + /* + III.5.4.2.7 ANS tone followed by no tone + Purpose: To confirm that TUT does not lock up under this condition. + Preamble: Tests ORG-02 and ORG-03 should be successfully completed prior to this test. + Method: Tester transmits ANS for 2.5 seconds followed by no tone for 10 s. It then transmits + DTMF tones for 2 seconds. + Pass criteria: 1) TUT should initially respond with TXP. + 2) TUT should stop sending TXP within 0.2 seconds of end of ANS. + 3) TUT should return to Monitor 1 state and then connect in DTMF mode within + 12 seconds of the end of ANS tone. + Comments: This condition would cause the terminal to lock up if the V.18 standard is followed + literally. It may however, occur when connected to certain Swedish textphones if the + handset is lifted just after the start of an automatically answered incoming call. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_08(void) +{ + /* + III.5.4.2.8 Bell 103 (2225 Hz signal) detection + Purpose: To verify that the TUT correctly detects the Bell 103 upper channel signal during + the 2-second interval between transmission of CI sequences. + Preamble: N/A + Method: The tester waits for a CI and then sends a 2225 Hz signal for 5 seconds. + Pass criteria: 1) The TUT should respond with a 1270 Hz tone in 0.5±0.1 seconds. + 2) Data should be transmitted and received at 300 bit/s to comply with Annex D. + Comments: The TUT should indicate that Bell 103 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_09(void) +{ + /* + III.5.4.2.9 V.21 (1650 Hz signal) detection + Purpose: To verify that the TUT correctly detects the V.21 upper channel signal during the + 2-second interval between transmission of CI sequences. + Preamble: N/A + Method: The tester waits for a CI and then sends a 1650 Hz signal for 5 seconds. + Pass criteria: 1) The TUT should respond with a 980 Hz tone in 0.5±0.1 seconds. + 2) Data should be transmitted and received at 300 bit/s to comply with Annex F. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_10(void) +{ + /* + III.5.4.2.10 The TUT should indicate that V.21 mode has been selected. + V.23 (1300 Hz signal) detection + Purpose: To verify that the TUT correctly detects the V.23 upper channel signal during the + 2-second interval between transmission of CI sequences. + Preamble: N/A + Method: The tester waits for a CI and then sends a 1300 Hz signal for 5 seconds. + Pass criteria: 1) The TUT should respond with a 390 Hz tone in 1.7±0.1 seconds. + 2) Data should be transmitted and received at 75 bit/s and 1200 bit/s respectively + by the TUT to comply with Annex E. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_11(void) +{ + /* + III.5.4.2.11 The TUT should indicate that V.23 mode has been selected. + V.23 (390 Hz signal) detection + Purpose: To confirm correct selection of V.23 reverse mode during sending of XCI. + Preamble: N/A + Method: The tester should wait for the start of the XCI signal and then send 390 Hz to TUT + for 5 seconds. + Pass criteria: 1) The TUT should complete the XCI as normal. + 2) The TUT should then maintain the 1300 Hz tone while the 390 Hz test tone is + present. + 3) Data should be transmitted and received at 1200 bit/s and 75 bit/s respectively + by the TUT to comply with Annex E when connection is indicated. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_12(void) +{ + /* + III.5.4.2.12 The TUT should indicate that V.23 mode has been selected at least 3 seconds after + the start of the 390 Hz tone. + 5 bit mode (Baudot) detection tests + Purpose: To confirm detection of Baudot modulation at various bit rates that may be + encountered. + Preamble: N/A + Method: The tester transmits the 5-bit coded characters "0" to "9" followed by "abcdef" at + (a) 45.45, (b) 47.6, (c) 50 and (d) 100 bits per second. When TUT indicates a + connection, type at least 5 characters back to the tester so that correct selection of bit + rate can be confirmed. + Pass criteria: 1) TUT should select Baudot mode and the appropriate bit rate. + 2) The tester will analyse the bit rate of received characters, which should be at + either 45.45 or 50 bits per second as appropriate. + Comments: 45.45 and 50 bit/s are the commonly used Baudot bit rates. However, certain + textphones can operate at higher rates (e.g. 100 bit/s). Responding at either 45.45 or + 50 bit/s is acceptable to these devices which normally fall back to the selected rate. + 47.6 bit/s may possibly be encountered from another V.18 textphone in the + automode answer state. The TUT may then select either 45.45 or 50 bit/s for the + transmission. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_13(void) +{ + /* + III.5.4.2.13 DTMF signal detection + Purpose: To verify whether the TUT correctly recognizes DTMF signals during the 2-second + interval between transmission of CI. + Preamble: N/A + Method: The tester will send a single DTMF tone of 40 ms duration to TUT. When TUT + indicates a connection, type at least 5 characters back to the tester so that correct + selection of mode can be confirmed. + Pass criteria: The tester will analyse the received characters to confirm DTMF mode selection. + Comments: TUT should indicate that it has selected DTMF mode. The DTMF capabilities of the + TUT should comply with ITU-T Q.24 for the Danish Administration while + receiving for best possible performance. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_14(void) +{ + /* + III.5.4.2.14 EDT rate detection + Purpose: To confirm detection of EDT modems by detecting the transmission rate of received + characters. + Preamble: N/A + Method: The tester transmits EDT characters "abcdef" to TUT at 110 bit/s. When TUT + indicates that the connection is established, type characters "abcdef" back to + the tester. The same characters will then be transmitted back to the TUT. + Pass criteria: Ensure correct reception of characters by tester and TUT. + Comments: The TUT should be able to determine the rate on the six characters given. If it takes + more than this then performance is probably inadequate as too many characters + would be lost. Some characters may be lost during the detection process. However, + the number lost should be minimal. The data bits and parity are specified in + Annex C. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_15(void) +{ + /* + III.5.4.2.15 Rate detection test + Purpose: To verify the presence of 980/1180 Hz at a different signalling rate than 110 bit/s + returns the TUT modem to the "monitor A" state. + Preamble: N/A + Method: The tester transmits 980/1180 Hz signals at 300 bit/s for 2 seconds. + Pass criteria: The TUT should not select EDT or any other mode and should continue to transmit + the CI signal. + Comments: Echoes of the CI sequences may be detected at 300 bit/s. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_16(void) +{ + /* + III.5.4.2.16 980 Hz detection + Purpose: To confirm correct selection of V.21 reverse mode. + Preamble: N/A + Method: The tester sends 980 Hz to TUT for 5 seconds. + Pass criteria: 1) TUT should respond with 1650 Hz tone after 1.5±0.1 seconds after start of + 980 Hz tone. + 2) Data should be transmitted and received at 300 bit/s complying with Annex F. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_17(void) +{ + /* + III.5.4.2.17 The TUT should indicate that V.21 mode has been selected. + Loss of signal after 980 Hz + Purpose: To confirm that TUT returns to the Monitor 1 state if 980 Hz signal disappears. + Preamble: N/A + Method: The tester sends 980 Hz to TUT for 1.2 seconds followed by silence for 5 seconds. + Pass criteria: TUT should not respond to the 980 Hz tone and resume sending CI signals after a + maximum of 2.4 seconds from the end of the 980 Hz tone. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_18(void) +{ + /* + III.5.4.2.18 Tr timer + Purpose: To confirm that TUT returns to the Monitor 1 state if Timer Tr expires. + Preamble: N/A + Method: The tester sends 980 Hz to TUT for 1.2 seconds followed by 1650 Hz for 5 seconds + with no pause. + Pass criteria: TUT should respond with 980 Hz after 1.3±0.1 seconds of 1650 Hz. + Comments: This implies timer Tr has expired 2 seconds after the start of the 980 Hz tone and + then 1650 Hz has been detected for 0.5 seconds. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_19(void) +{ + /* + III.5.4.2.19 Bell 103 (1270 Hz signal) detection + Purpose: To confirm correct selection of Bell 103 reverse mode. + Preamble: N/A + Method: The tester sends 1270 Hz to TUT for 5 seconds. + Pass criteria: 1) TUT should respond with 2225 Hz tone after 0.7±0.1 s. + 2) Data should be transmitted and received at 300 bit/s complying with Annex D. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_20(void) +{ + /* + III.5.4.2.20 The TUT should indicate that Bell 103 mode has been selected. + Immunity to network tones + Purpose: To ensure that the TUT does not interpret network tones as valid signals. + Preamble: N/A + Method: The tester will first send a dial tone to the TUT, this will be followed by a ringing + tone and a network congestion tone. The frequencies and cadences of the tones will + vary according to the country setting. The tester must be configured for the same + country as the TUT. + Pass criteria: The countries supported by the TUT should be noted along with the response to + each tone. The tones should either be ignored or reported as the relevant network + tone to the user. + Comments: V.18 is required to recognize and report RINGING and BUSY tones. Other network + tones may be ignored. Some devices may only provide a visual indication of the + presence and cadence of the tones for instance by a flashing light. The TUT may + disconnect on reception of tones indicating a failed call attempt. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_21(void) +{ + /* + III.5.4.2.21 Immunity to non-textphone modems + Purpose: To ensure that the TUT does not interpret modem tones not supported by V.18 as + valid text telephone tones. + Preamble: N/A + Method: The tester will respond with an ANS tone (2100 Hz) followed by simulated (a) + V.32 bis and (b) V.34 modem training sequences. + Pass criteria: The tones should either be ignored or reported back to the user. No textphone + modem should be selected. + Comments: Some high speed modems may fall back to a compatibility mode, e.g. V.21 or V.23 + that should be correctly detected by the TUT. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_22(void) +{ + /* + III.5.4.2.22 Immunity to fax tones + Purpose: To ensure that the TUT will not interpret a called fax machine as being a textphone. + Preamble: N/A + Method: The tester will respond as if it were a typical group 3 fax machine in automatic + answer mode. It should send a CED tone (2100 Hz) plus Digital Identification + Signal (DIS) as defined in ITU-T T.30. + Pass criteria: The TUT should ignore the received tones. + Comments: Ideally the TUT should detect the presence of a fax machine and report it back to + the user. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_23(void) +{ + /* + III.5.4.2.23 Immunity to voice + Purpose: To ensure that the TUT does not misinterpret speech as a valid textphone signal. + Preamble: N/A + Method: The tester will respond with sampled speech. A number of phrases recorded from + typical male and female speakers will be transmitted. This will include a typical + network announcement. + Pass criteria: The TUT should ignore the speech. + Comments: Ideally the TUT should report the presence of speech back to the user, e.g. via + circuit 135. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_24(void) +{ + /* + III.5.4.2.24 ANSam signal detection + Purpose: To verify that TUT correctly detects the ANSam (2100 Hz modulated) signal during + the two-second interval (Toff) between transmission of CI sequences. + Preamble: Make a V.18 call from the TUT. + Method: The Test System waits for the TUT to stop transmitting a CI and responds with an + ANSam signal. The V.21 demodulator is used to decode the CM sequence. ANSam + should be transmitted for 2 seconds. + Pass criteria: 1) No signal should be transmitted by TUT for 0.5 seconds from detection of + ANSam. + 2) The TUT should reply with transmission of CM as defined in 5.2.13. + 3) Verify that CM sequence has correct bit pattern. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_org_25(void) +{ + /* + III.5.4.2.25 V.8 calling procedure + Purpose: To verify that TUT correctly performs a V.8 call negotiation. + Preamble: Make a V.18 call from the TUT. Answer with ANSam from the Tester and with JM + for V.21 on the CM. + Method: The Test System waits for the TUT to start transmitting V.21 carrier (1). + Pass criteria: The TUT should connect by sending V.21 carrier (1). + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_01(void) +{ + /* + III.5.4.3.1 Ta timer + Purpose: To ensure that on connecting the call, the DCE starts timer Ta (3 seconds) and on + expiry begins probing. + Preamble: N/A + Method: The tester makes a call to the TUT and attempts to determine when the TUT + answers the call. It will then monitor for any signal. + Pass criteria: The TUT should start probing 3 seconds after answering the call. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_02(void) +{ + /* + III.5.4.3.2 CI signal detection + Purpose: To confirm the correct detection and response to the V.18 CI signal. + Preamble: N/A + Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2 seconds. It will + monitor for ANS and measure duration. + Pass criteria: 1) The TUT should respond after either the first or second CI with ANSam tone. + 2) ANSam tone should remain for 3 seconds ±0.5 s followed by silence. + Comments: The ANSam tone is a modulated 2100 Hz tone. It may have phase reversals. The + XCI signal is tested in a separate test. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_03(void) +{ + /* + III.5.4.3.3 Early termination of ANSam tone + Purpose: To confirm that the TUT will respond correctly to TXP signals, i.e. by stopping + ANSam tone on reception of TXP signal. + Preamble: N/A + Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2 seconds. On + reception of the ANSam tone the tester will wait 0.5 seconds and then begin + transmitting the TXP signal in V.21 (1) mode. + Pass criteria: 1) On reception of the TXP signal, the TUT should remain silent for 75±5 ms. + 2) The TUT should then transmit 3 TXP sequences in V.21(2) mode. + 3) The 3 TXPs should be followed by continuous 1650 Hz. + 4) Correct transmission and reception of T.140 data should be verified after the + V.18 mode connection is completed. + Comments: The TUT should indicate V.18 mode. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_04(void) +{ + /* + III.5.4.3.4 Tt timer + Purpose: To ensure that after detection of ANSam the TUT will return to Monitor A after + timer Tt expires. + Preamble: Successful completion of test ANS-03. + Method: After completion of test ANS-03 the tester will continue to monitor for signals. + Pass criteria: The TUT should start probing 3 seconds after ANSam disappears. + Comments: It is assumed that timer Ta is restarted on return to Monitor A. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_05(void) +{ + /* + III.5.4.3.5 ANS tone followed by 980 Hz + Purpose: To check correct detection of V.21 modem lower channel when preceded by answer + tone. + Preamble: N/A + Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + 980 Hz and starts a 1 s timer. + Pass criteria: TUT should respond with 1650 Hz within 400±100 ms of start of 980 Hz. + Comments: The TUT should indicate that V.21 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_06(void) +{ + /* + III.5.4.3.6 ANS tone followed by 1300 Hz + Purpose: To check correct detection of V.23 modem upper channel when preceded by answer + tone. + Preamble: N/A + Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + 1300 Hz and starts a 2-s timer. + Pass criteria: TUT should respond with 390 Hz after 1.7(+0.2-0.0) seconds of start of 1300 Hz. + Comments: The TUT should indicate that V.23 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_07(void) +{ + /* + III.5.4.3.7 ANS tone followed by 1650 Hz + Purpose: To check correct detection of V.21 modem upper channel when preceded by answer + tone and to confirm discrimination between V.21 and V.18 modes. + Preamble: N/A + Method: Tester transmits ANS for 2.5 seconds followed by 75 ms of no tone then transmits + 1650 Hz and starts a 1-second timer. + Pass criteria: TUT should respond with 980 Hz within 400±100 ms of start of 1650 Hz. + Comments: The TUT should indicate that V.21 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_08(void) +{ + /* + III.5.4.3.8 980 Hz followed by 1650 Hz + Purpose: To ensure the correct selection of V.21 modem channel when certain types of + Swedish textphones are encountered. + Preamble: N/A + Method: The tester will simulate a call from a Diatext2 textphone that alternates between + 980 Hz and 1650 Hz until a connection is made. + Pass criteria: The TUT should respond with the appropriate carrier depending on when it + connects. + Comments: The TUT should indicate a V.21 connection. The time for which each frequency is + transmitted is random and varies between 0.64 and 2.56 seconds. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_09(void) +{ + /* + III.5.4.3.9 980 Hz calling tone detection + Purpose: To confirm correct detection of 980 Hz calling tones as defined in V.25. + Preamble: N/A + Method: The tester will send bursts of 980 Hz signals (a) 400 ms, (b) 500 ms, (c) 700 ms and + (d) 800 ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + 2) The TUT should immediately begin probing after a burst of 980 Hz for 500 or + 700 ms followed by 1 second of silence. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_10(void) +{ + /* + III.5.4.3.10 The probe sent by the TUT will depend on the country setting. + V.21 detection by timer + Purpose: To confirm correct selection of V.21 calling modem when the received signal is not + modulated, i.e. there is no 1180 Hz. + Preamble: N/A + Method: The tester sends 980 Hz to TUT for 2 seconds. + Pass criteria: The TUT should respond with a 1650 Hz tone in 1.5±0.1 seconds. + Comments: The TUT should indicate that V.21 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_11(void) +{ + /* + III.5.4.3.11 EDT detection by rate + Purpose: To confirm detection of EDT modems by detecting the transmission rate of received + characters. + Preamble: N/A + Method: The tester transmits EDT characters "abcdef" to TUT at 110 bit/s. When TUT + indicates that the connection is established, type characters "abcdef" back to + the tester. The same characters will then be transmitted back to the TUT. + Pass criteria: Ensure correct reception of characters by tester and TUT. + Comments: The TUT should indicate that EDT mode has been selected. Some characters may + be lost during the detection process. However, the number lost should be minimal. + The data bits and parity are specified in Annex C. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_12(void) +{ + /* + III.5.4.3.12 V.21 Detection by rate + Purpose: To confirm detection of V.21 modem low channel by detecting the transmission rate + of received characters and to ensure correct discrimination between V.18 and V.21 + modes. + Preamble: N/A + Method: The tester transmits characters "abcdef" to TUT using V.21 (1) at 300 bit/s. When + TUT indicates that the connection is established, type characters "abcdef" + back to the tester. The same characters will then be transmitted back to the TUT. + Pass criteria: Ensure correct reception of characters by tester and TUT. + Comments: This situation is unlikely to occur in practice unless the DCE is sending a V.21 + (1650 Hz) probe. However, it is catered for in V.18. It is more likely that this is + where CI or TXP characters would be detected (see test ANS-02). + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_13(void) +{ + /* + III.5.4.3.13 Tr timer + Purpose: To ensure that the TUT returns to the Monitor A state on expiry of timer Tr + (2 seconds). Timer Tr is started when a modulated V.21 (1) signal is detected. + Preamble: N/A + Method: The tester will transmit 980 Hz for 200 ms followed by alternating 980 Hz/1180 Hz + at 110 bit/s for 100 ms followed by 980 Hz for 1 second. + Pass criteria: The TUT should begin probing 4±0.5 seconds after the 980 Hz signal is removed. + Comments: It is not possible to be precise on timings for this test since the definition of a + "modulated signal" as in 5.2.4.4 is not specified. Therefore it is not known exactly + when timer Tr will start. It is assumed that timer Ta is restarted on re-entering the + Monitor A state. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_14(void) +{ + /* + III.5.4.3.14 Te timer + Purpose: To ensure that the TUT returns to the Monitor A on expiry of timer Te + (2.7 seconds). Timer Te is started when a 980 Hz signal is detected. + Preamble: N/A + Method: The tester will transmit 980 Hz for 200 ms followed silence for 7 s. + Pass criteria: The TUT should begin probing 5.5±0.5 seconds after the 980 Hz signal is removed. + Comments: It is assumed that timer Ta (3 seconds) is restarted on re-entering the Monitor A + state. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_15(void) +{ + /* + III.5.4.3.15 5 Bit mode (Baudot) detection tests + Purpose: To confirm detection of Baudot modulation at various bit rates that may be + encountered. + Preamble: N/A + Method: The tester transmits the 5-bit coded characters "0" to "9" followed by "abcdef" at + (a) 45.45, (b) 47.6, (c) 50 and (d) 100 bits per second. When TUT indicates a + connection, type at least 5 characters back to the tester so that correct selection of bit + rate can be confirmed. + Pass criteria: 1) The TUT should select Baudot mode and the appropriate bit rate. + 2) The tester will analyse the bit rate of received characters, which should be at an + appropriate rate, and confirm the carrier on/off times before and after the + characters. + Comments: 45.45 and 50 bit/s are the commonly used Baudot bit rates. However, some + textphones can transmit at higher rates, e.g. 100 bit/s. Responding at either 45.45 or + 50 bit/s is acceptable to these devices which then fall back to the selected rate. + A rate of 47.6 bit/s may be encountered from another V.18 textphone in the + automode answer state. The TUT may then select either 45.45 or 50 bit/s for the + transmission. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_16(void) +{ + /* + III.5.4.3.16 DTMF signal detection + Purpose: To verify whether the TUT correctly recognizes DTMF signals. + Preamble: N/A + Method: The tester will send a single DTMF tone of 40 ms duration to TUT. When TUT + indicates a connection, type at least 5 characters back to the tester so that correct + selection of mode can be confirmed. + Pass criteria: Tester will analyse the received characters to confirm DTMF mode selection. + Comments: The TUT should indicate that it has selected DTMF mode. The DTMF capabilities + of the TUT should comply with ITU-T Q.24 for the Danish Administration. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_17(void) +{ + /* + III.5.4.3.17 Bell 103 (1270 Hz signal) detection + Purpose: To ensure correct detection and selection of Bell 103 modems. + Preamble: N/A + Method: The tester sends 1270 Hz to TUT for 5 seconds. + Pass criteria: TUT should respond with 2225 Hz tone after 0.7±0.1 s. + Comments: The TUT should indicate that Bell 103 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_18(void) +{ + /* + III.5.4.3.18 Bell 103 (2225 Hz signal) detection + Purpose: To ensure correct detection and selection of Bell 103 modems in reverse mode. + Preamble: N/A + Method: The tester sends 2225 Hz to TUT for 5 seconds. + Pass criteria: The TUT should respond with 1270 Hz after 1±0.2 seconds. + Comments: The TUT should indicate that Bell 103 mode has been selected. Bell 103 modems + use 2225 Hz as both answer tone and higher frequency of the upper channel. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_19(void) +{ + /* + III.5.4.3.19 V.21 Reverse mode (1650 Hz) detection + Purpose: To ensure correct detection and selection of V.21 reverse mode. + Preamble: N/A + Method: The tester sends 1650 Hz to TUT for 5 seconds. + Pass criteria: The TUT should respond with 980 Hz after 0.4±0.2 seconds. + Comments: The TUT should indicate that V.21 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_20(void) +{ + /* + III.5.4.3.20 1300 Hz calling tone discrimination + Purpose: To confirm correct detection of 1300 Hz calling tones as defined in ITU-T V.25. + Preamble: N/A + Method: The tester will send 1300 Hz bursts of (a) 400 ms, (b) 500 ms, (c) 700 ms and + (d) 800 ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + 2) The TUT should immediately begin probing after a burst of 1300 Hz for 500 or + 700 ms followed by 1 second of silence. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_21(void) +{ + /* + III.5.4.3.21 The probe sent by the TUT will depend on the country setting. + V.23 Reverse mode (1300 Hz) detection + Purpose: To ensure correct detection and selection of V.23 reverse mode. + Preamble: N/A + Method: The tester sends 1300 Hz only, with no XCI signals, to TUT for 5 seconds. + Pass criteria: The TUT should respond with 390 Hz after 1.7±0.1 seconds. + Comments: The TUT should indicate that V.23 mode has been selected. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_22(void) +{ + /* + III.5.4.3.22 1300 Hz with XCI test + Purpose: To ensure correct detection of the XCI signal and selection of V.18 mode. + Preamble: N/A + Method: The tester sends XCI signal as defined in 3.11. On reception of ANS it will become + silent for 500 ms then transmit the TXP signal in V.21 (1) mode. + Pass criteria: The TUT should respond with TXP using V.21 (2) and select V.18 mode. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_23(void) +{ + /* + III.5.4.3.23 Stimulate mode country settings + Purpose: To ensure that the TUT steps through the probes in the specified order for the + country selected. + Preamble: The TUT should be configured for each of the possible probe orders specified in + Appendix I in turn. + Method: The tester will call the TUT, wait for Ta to expire and then monitor the probes sent + by the TUT. + Pass criteria: The TUT should use the orders described in Appendix I. + Comments: The order of the probes is not mandatory. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_24(void) +{ + /* + III.5.4.3.24 Stimulate carrierless mode probe message + Purpose: To ensure that the TUT sends the correct probe message for each of the carrierless + modes. + Preamble: N/A + Method: The tester will call the TUT, wait for Ta to expire and then monitor the probes sent + by the TUT. + Pass criteria: The TUT should send the user defined probe message for Annexes A, B, and C + modes followed by a pause of Tm (default 3) seconds. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_25(void) +{ + /* + III.5.4.3.25 The carrierless modes are those described in Annexes A, B and C. + Interrupted carrierless mode probe + Purpose: To ensure that the TUT continues probing from the point of interruption a maximum + of 20 s after a failed connect attempt. + Preamble: The TUT should be configured for the UK country setting. + Method: The tester will call the TUT, wait for Ta to expire and then during the pause after + the first Baudot probe it will send a 200 ms burst of 1270 Hz followed by silence + for 30 s. + Pass criteria: The TUT should transmit silence on detecting the 1270 Hz tone and then continue + probing starting with the V.23 probe 20 seconds after the end of the 1270 Hz signal. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_26(void) +{ + /* + III.5.4.3.26 Stimulate carrier mode probe time + Purpose: To ensure that the TUT sends each carrier mode for time Tc (default 6 seconds) + preceded by the correct answer tone. + Preamble: None. + Method: The tester will call the TUT, wait for Ta to expire and then monitor the probes sent + by the TUT. + Pass criteria: The TUT should send the ANS tone (2100 Hz) for 1 second followed by silence for + 75±5 ms and then the 1650 Hz, 1300 Hz and 2225 Hz probes for time Tc. + Comments: The carrier modes are those described in Annexes D, E, and F. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_27(void) +{ + /* + III.5.4.3.27 V.23 mode (390 Hz) detection + Purpose: To confirm correct selection of V.23 mode. + Preamble: N/A + Method: The tester waits until the 1300 Hz probe is detected from the TUT and then + transmits 390 Hz for 11 seconds. + Pass criteria: 1) After 3 seconds of the 390 Hz signal the TUT should indicate that V.23 has + been selected. + 2) The tester will confirm that the 1300 Hz carrier is maintained for at least + 4 seconds beyond the normal probe duration, i.e. Tc (= 6 s default) + 4 s = + 10 seconds total. + Comments: + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_28(void) +{ + /* + III.5.4.3.28 All known V.23 devices need to receive 1300 Hz tone before they will respond with + 390 Hz. When the 1300 Hz probe is not being transmitted, a 390 Hz tone may be + interpreted as a 400 Hz network tone. + Interrupted carrier mode probe + Purpose: To ensure that the TUT continues probing from the point of interruption a maximum + of 4 s after a failed connect attempt. + Preamble: The TUT should be configured for the UK country setting. + Method: The tester will call the TUT, wait for Ta to expire and then during the first V.21 + probe it will send a 200 ms burst of 1270 Hz followed by silence for 30 s. + Pass criteria: The TUT should transmit silence on detecting the 1270 Hz tone and then continue + probing with the Baudot stored message 4 seconds after the end of the 1270 Hz + burst. + Comments: It is most likely that the TUT will return to probing time Ta (3 seconds) after the + 1270 Hz tone ceases. This condition needs further clarification. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_29(void) +{ + /* + III.5.4.3.29 Stimulate mode response during probe + Purpose: To ensure that the TUT is able to detect an incoming signal while transmitting a + carrier mode probe. + Preamble: N/A + Method: The tester will step through each possible response as defined in tests ANS-08 to + ANS-23 for each of the carrier mode probes and for each pause after a carrierless + mode probe message. + Pass criteria: The TUT should respond as described in the appropriate test above. + Comments: The TUT may not respond to any signals while a carrierless mode probe is being + sent since these modes are half duplex. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_30(void) +{ + /* + III.5.4.3.30 Immunity to network tones + Purpose: To ensure that the TUT does not interpret network tones as valid signals. + Preamble: N/A + Method: The tester will first send a busy tone to the TUT this will be followed by a number + unobtainable tone. The frequencies and cadences of the tones will vary according to + the country setting. The tester must be configured for the same country as the TUT. + Pass criteria: The countries supported by the TUT should be noted along with the response to + each tone. The tones should either be ignored or reported as the relevant network + tone to the user. + Comments: V.18 is required to recognize and report RINGING and BUSY tones. Other network + tones may be ignored. Some devices may only provide a visual indication of the + presence and cadence of the tones for instance by a flashing light. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_31(void) +{ + /* + III.5.4.3.31 Immunity to fax calling tones + Purpose: To determine whether the TUT can discriminate fax calling tones. + Preamble: N/A + Method: The tester will call the TUT and send the fax calling tone, CNG. This is an 1100 Hz + tone with cadence of 0.5 seconds ON and 3 seconds OFF as defined in ITU-T T.30. + Pass criteria: The TUT should not respond to this signal and may report it as being a calling fax + machine. + Comments: This is an optional test as detection of the fax calling tone is not required by + ITU-T V.18. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_32(void) +{ + /* + III.5.4.3.32 Immunity to voice + Purpose: To ensure that the TUT does not misinterpret speech as a valid textphone signal. + Preamble: N/A + Method: The tester will respond with sampled speech. A number of phrases recorded from + typical male and female speakers will be transmitted. This will include a typical + network announcement. + Pass criteria: The TUT should ignore the speech. + Comments: Ideally the TUT should report the presence of speech back to the user. This is an + optional test. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_ans_33(void) +{ + /* + III.5.4.3.33 CM detection and V.8 answering + Purpose: To confirm that the TUT will respond correctly to CM signals and connect + according to V.8 procedures. + Preamble: N/A + Method: The tester will transmit 2 sequences of 4 CI patterns separated by 2 seconds. On + reception of the ANSam tone the tester will wait 0.5 seconds and then begin + transmitting the CM signal with textphone and V.21 specified. + Pass criteria: 1) On reception of the CM signal, the TUT should transmit JM with textphone + and V.21. + 2) The TUT should then transmit in V.21 (2) mode. + 3) The JM should be followed by continuous 1650 Hz. + 4) Correct transmission and reception of T.140 data should be verified after the + V.18 mode connection is completed. + Comments: The TUT should indicate V.18 mode. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_mon_01(void) +{ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_mon_21(void) +{ + /* + III.5.4.4.1 Automode monitor Ta timer test + Purpose: To ensure that on entering monitor mode, timer Ta (3 seconds) is not active and that + the TUT does not enter the probing state. + Preamble: N/A + Method: The TUT should be put into monitor state. The tester will then monitor for signals + for 1 minute. + Pass criteria: The TUT should not start probing. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_mon_22(void) +{ + /* + III.5.4.4.2 Automode monitor 1300 Hz calling tone discrimination + Purpose: To confirm correct detection and reporting of 1300 Hz calling tones as defined in + ITU-T V.25. + Preamble: N/A + Method: The tester will send 1300 Hz bursts of (a) 400 ms, (b) 500 ms, (c) 700 ms and + (d) 800 ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + 2) The TUT should report detection of calling tones to the DTE after a burst of + 1300 Hz for 500 or 700 ms followed by 1 second of silence. + Comments: In automode answer, the 1300 Hz calling causes the DCE to start probing. In + monitor mode it should only report detection to the DTE. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int test_mon_23(void) +{ + /* + III.5.4.4.3 Automode monitor 980 Hz calling tone discrimination + Purpose: To confirm correct detection and reporting of 980 Hz calling tones as defined in + ITU-T V.25. + Preamble: N/A + Method: The tester will send 980 Hz bursts of (a) 400 ms, (b) 500 ms, (c) 700 ms and + (d) 800 ms followed by 1 second of silence. + Pass criteria: 1) The TUT should not respond to bursts of 400 or 800 ms. + 2) The TUT should report detection of calling tones to the DTE after a burst of + 980 Hz for 500 or 700 ms followed by 1 second of silence. + Comments: In automode answer, the 980 Hz calling causes the DCE to start probing. In monitor + mode it should only report detection to the DTE. + */ + printf("Test not yet implemented\n"); + return 1; +} +/*- End of function --------------------------------------------------------*/ static int test_x_01(void) { - /* III.5.4.5.1 Baudot carrier timing and receiver disabling */ + /* + III.5.4.5.1 Baudot carrier timing and receiver disabling + Purpose: To verify that the TUT sends unmodulated carrier for 150 ms before a new character + and disables its receiver for 300 ms after a character is transmitted. + Preamble: Establish a call between the tester and TUT in Baudot mode. + Method: The operator should send a single character from the TUT. The tester will + immediately start sending a unique character sequence. Examination of the TUT + display will show when its receiver is re-enabled. + Pass criteria: 1) The TUT should send unmodulated carrier for 150 ms before the beginning of + the start bit. + 2) The receiver should be re-enabled after 300 ms. + 3) The tester will confirm that 1 start bit and at least 1.5 stop bits are used. + Comments: The carrier should be maintained during the 300 ms after a character. + */ printf("Test not yet implemented\n"); return 1; } @@ -165,7 +1513,15 @@ static int test_x_01(void) static int test_x_02(void) { - /* III.5.4.5.2 Baudot bit rate confirmation */ + /* + III.5.4.5.2 Baudot bit rate confirmation + Purpose: To verify that the TUT uses the correct bit rates in the Baudot mode. + Preamble: Establish a call between the tester and TUT in Baudot mode for each of the two + tests. + Method: The operator should select Baudot (a) 45 bit/s followed by (b) 50 bit/s modes and + transmit the string "abcdef" at each rate. + Pass criteria: The tester will measure the bit timings and confirm the rates. + */ printf("Test not yet implemented\n"); return 1; } @@ -173,7 +1529,18 @@ static int test_x_02(void) static int test_x_03(void) { - /* III.5.4.5.3 Baudot probe bit rate confirmation */ + /* + III.5.4.5.3 Baudot probe bit rate confirmation + Purpose: To verify that the TUT uses the correct bit rates in the Baudot mode probe during + automoding. + Preamble: Set the user defined carrierless mode probe message to the string "abcdef" if + possible. Set the TUT country setting to "United States". A call should be initiated + from the tester to the TUT. + Method: The tester will wait for the Baudot mode probe and measure the bit rate. + Pass criteria: The tester will measure the bit timings and confirm the rate of 47.6 bit/s. + Comments: The probe message must be long enough for the tester to establish the bit rate. "GA" + may not be sufficient. + */ printf("Test not yet implemented\n"); return 1; } @@ -188,9 +1555,31 @@ static int test_x_04(void) int yy; int i; v18_state_t *v18_state; + logging_state_t *logging; - /* III.5.4.5.4 5 Bit to T.50 character conversion */ + /* + III.5.4.5.4 5 Bit to T.50 character conversion + Purpose: To check that the character conversion tables in Annex A have been correctly + implemented. + Preamble: Establish a call between the tester and TUT in Baudot mode at 45 bit/s. + Method: The tester will send all possible characters preceded by the relevant case shift + command one at a time and wait for a response from the TUT operator. Each + character should be responded to at the TUT by typing the received character or + if the character is not available. + Pass criteria: 1) The tester will verify that each character is correctly echoed back by the TUT. + The operator should verify that each character is correctly displayed on the TUT. + 2) The TUT will send the LTRS symbol before its first character and the + appropriate mode character (either LTRS or FIGS) after every 72 subsequent + characters. + Comments: The tester should indicate which character has been sent in each case. Some of the + characters may not be available from the TUT keyboard and can be ignored. It is + assumed that the character conversion is the same for Baudot at 50 bit/s and any + other supported speed. + */ v18_state = v18_init(NULL, TRUE, V18_MODE_5BIT_45, NULL, NULL); + logging = v18_get_logging_state(v18_state); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, ""); printf("Original:\n"); t = result; for (i = 0; i < 127; i++) @@ -222,6 +1611,24 @@ static int test_x_04(void) } /*- End of function --------------------------------------------------------*/ +static int test_x_05(void) +{ + /* + III.5.4.5.5 DTMF receiver disabling + Purpose: To verify that the TUT disables its DTMF receiver for 300 ms when a character is + transmitted. + Preamble: Establish a call between the tester and TUT in DTMF mode. + Method: The operator should send a single "e" character from the TUT which will result in + sending a single DTMF tone to the tester. The tester will immediately start sending a + unique character sequence using single DTMF tones. Examination of the TUT + display will show when its receiver is re-enabled. + Pass criteria: The receiver should be re-enabled after 300 ms. + */ + printf("Test not yet implemented\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + static int test_x_06(void) { char msg[128]; @@ -230,7 +1637,20 @@ static int test_x_06(void) const char *ref; int i; - /* III.5.4.5.6 DTMF character conversion */ + /* + III.5.4.5.6 DTMF character conversion + Purpose: To check that the character conversion tables in Annex B have been correctly + implemented. + Preamble: Establish a call between the tester and TUT in DTMF mode. + Method: The tester will send each character from the set in Annex B, waiting for a response + after each one. Each character should be responded to at the TUT by typing the + same character. + Pass criteria: The tester will verify that each character is correctly echoed back by the TUT. + Comments: The conversion table is specified in Annex B. The receiver at the tester may be re- + enabled 100 ms after transmission of each character to maximize likelihood of + receiving character from the TUT. It is assumed that the echo delay in the test + system is negligible. + */ for (i = 0; i < 127; i++) msg[i] = i + 1; msg[127] = '\0'; @@ -253,10 +1673,124 @@ static int test_x_06(void) } /*- End of function --------------------------------------------------------*/ -static int test_unimplemented(void) +static int test_x_07(void) { + /* + III.5.4.5.7 EDT carrier timing and receiver disabling + Purpose: To verify that the TUT sends unmodulated carrier for 300 ms before a character and + disables its receiver for 300 ms after a character is transmitted. + Preamble: Establish a call between the tester and TUT in EDT mode. + Method: The operator should send a single character from the TUT. The tester will + immediately start sending a unique character sequence. Examination of the TUT + display will show when its receiver is re-enabled. + Pass criteria: 1) The TUT should send unmodulated carrier for 300 ms before the beginning of + the start bit. + 2) The receiver should be re-enabled after 300 ms. + 3) The tester will confirm that 1 start bit and at least 1.5 stop bits are used. + Comments: The carrier should be maintained during the 300 ms after a character. + */ printf("Test not yet implemented\n"); - return 1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_08(void) +{ + /* + III.5.4.5.8 EDT bit rate and character structure + Purpose: To verify that the TUT uses the correct bit rate and character structure in the EDT + mode. + Preamble: Establish a call between the tester and TUT in EDT mode. + Method: The operator should transmit the string "abcdef" from the TUT. + Pass criteria: 1) The tester should measure the bit timings and confirm that the rate is 110 bit/s. + 2) The tester should confirm that 1 start bit, 7 data bits, 1 even parity bit and 2 stop + bits are used. + */ + printf("Test not yet implemented\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_09(void) +{ + /* + III.5.4.5.9 V.23 calling mode character format + Purpose: To verify that the TUT uses the correct character format in the V.23 calling mode. + Preamble: Establish a call from the TUT to the tester in V.23 mode. + Method: The operator should transmit the string "abcdef" from the TUT. The tester will echo + characters back to the TUT as they are received. The tester will then transmit the + string "abcdef" with ODD parity to the TUT. + Pass criteria: 1) Confirm that 1 start bit, 7 data bits, 1 even parity bit and 2 stop bits are + transmitted. + 2) The operator should confirm that there is no local echo at the TUT by checking + that there are no duplicate characters on the TUT display. + 3) The received string should be correctly displayed despite the incorrect parity. + */ + printf("Test not yet implemented\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_10(void) +{ + /* + III.5.4.5.10 V.23 answer mode character format + Purpose: To verify that the TUT uses the correct character format in the V.23 answer mode. + Preamble: Establish a call from the tester to the TUT in V.23 mode. + Method: The tester will transmit the string "abcdef" with ODD parity. The TUT should echo + characters back to the tester as they are received. The operator should then transmit + the string "abcdef" from the TUT. + Pass criteria: 1) The received string should be correctly displayed at the TUT despite the + incorrect parity. + 2) Confirm that 1 start bit, 7 data bits, 1 even parity bit and 2 stop bits are + transmitted by the TUT. + 3) The tester should confirm that there is remote echo from TUT. + 4) The operator should confirm that there is local echo on the TUT. + Comments: + */ + printf("Test not yet implemented\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_11(void) +{ + /* + III.5.4.5.11 This test is only applicable to Minitel Dialogue terminals. Prestel and Minitel + Normal terminals cannot operate in this mode. + V.21 character structure + Purpose: To verify that the TUT uses the character structure in the V.21 mode. + Preamble: Establish a call from the TUT to the tester in V.21 mode. + Method: The operator should transmit a string from the TUT that is long enough to cause the + display to word wrap followed by "abcdef", new line (CR+LF). The tester will then + transmit the string "123456", BACKSPACE (0/8) with ODD parity to the TUT. + Pass criteria: 1) The tester should confirm that 1 start bit, 7 data bits, 1 even parity bit and 1 stop + bits are transmitted. + 2) The word wrap should not result in CR+LF. + 3) The forced new line should be indicated by CR+LF. + 4) The last five characters on the TUT display should be "12345" (no "6") + correctly displayed despite the incorrect parity. + */ + printf("Test not yet implemented\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_x_12(void) +{ + /* + III.5.4.5.12 V.18 mode + Purpose: To verify that the TUT uses the protocol defined in ITU-T T.140. + Preamble: Establish a call from the TUT to the tester in V.18 mode. + Method: The operator should transmit a string from the TUT that is long enough to cause the + display to word wrap followed by "abcdef", new line (CR+LF), new line + (UNICODE preferred). The tester will then transmit the string "123456", + BACKSPACE. + Pass criteria: The tester should confirm UTF8 encoded UNICODE characters are used with the + controls specified in ITU-T T.140. + */ + printf("Test not yet implemented\n"); + return 0; } /*- End of function --------------------------------------------------------*/ @@ -272,10 +1806,11 @@ static void put_v18_msg(void *user_data, const uint8_t *msg, int len) static int decode_test_data_file(int mode, const char *filename) { - v18_state_t *v18_state; int16_t amp[SAMPLES_PER_CHUNK]; SNDFILE *inhandle; int len; + v18_state_t *v18_state; + logging_state_t *logging; printf("Decoding as '%s'\n", v18_mode_to_str(mode)); /* We will decode the audio from a file. */ @@ -285,10 +1820,12 @@ static int decode_test_data_file(int mode, const char *filename) exit(2); } v18_state = v18_init(NULL, FALSE, mode, put_v18_msg, NULL); + logging = v18_get_logging_state(v18_state); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_tag(logging, ""); for (;;) { - len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK); - if (len == 0) + if ((len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)) <= 0) break; v18_rx(v18_state, amp, len); } @@ -309,97 +1846,97 @@ const struct } test_list[] = { {"III.3.2.1 Operational requirements tests", NULL}, - {"MISC-01 4 (1) No Disconnection Test", test_unimplemented}, - {"MISC-02 4 (2) Automatic resumption of automoding", test_unimplemented}, - {"MISC-03 4 (2) Retention of selected mode on loss of signal", test_unimplemented}, - {"MISC-04 4 (4) Detection of BUSY tone", test_unimplemented}, - {"MISC-05 4 (4) Detection of RINGING", test_unimplemented}, - {"MISC-06 4 (4) LOSS OF CARRIER indication", test_unimplemented}, - {"MISC-07 4 (4) Call progress indication", test_unimplemented}, - {"MISC-08 4 (5) Circuit 135 test", test_unimplemented}, - {"MISC-09 Connection Procedures", test_unimplemented}, + {"MISC-01 4 (1) No Disconnection Test", test_misc_01}, + {"MISC-02 4 (2) Automatic resumption of automoding", test_misc_02}, + {"MISC-03 4 (2) Retention of selected mode on loss of signal", test_misc_03}, + {"MISC-04 4 (4) Detection of BUSY tone", test_misc_04}, + {"MISC-05 4 (4) Detection of RINGING", test_misc_05}, + {"MISC-06 4 (4) LOSS OF CARRIER indication", test_misc_06}, + {"MISC-07 4 (4) Call progress indication", test_misc_07}, + {"MISC-08 4 (5) Circuit 135 test", test_misc_08}, + {"MISC-09 4 (6) Connection Procedures", test_misc_09}, {"III.3.2.2 Automode originate tests", NULL}, - {"ORG-01 5.1.1 CI & XCI Signal coding and cadence", test_unimplemented}, - {"ORG-02 5.1.3 ANS Signal Detection", test_unimplemented}, - {"ORG-03 5.2.3.1 End of ANS signal detection", test_unimplemented}, - {"ORG-04 5.1.3.2 ANS tone followed by TXP", test_unimplemented}, - {"ORG-05 5.1.3.3 ANS tone followed by 1650Hz", test_unimplemented}, - {"ORG-06 5.1.3.4 ANS tone followed by 1300Hz", test_unimplemented}, - {"ORG-07 5.1.3 ANS tone followed by no tone", test_unimplemented}, - {"ORG-08 5.1.4 Bell 103 (2225Hz Signal) Detection", test_unimplemented}, - {"ORG-09 5.1.5 V.21 (1650Hz Signal) Detection", test_unimplemented}, - {"ORG-10 5.1.6 V.23 (1300Hz Signal) Detection", test_unimplemented}, - {"ORG-11 5.1.7 V.23 (390Hz Signal) Detection", test_unimplemented}, - {"ORG-12a to d 5.1.8 5 Bit Mode (Baudot) Detection Tests", test_unimplemented}, - {"ORG-13 5.1.9 DTMF signal detection", test_unimplemented}, - {"ORG-14 5.1.10 EDT Rate Detection", test_unimplemented}, - {"ORG-15 5.1.10.1 Rate Detection Test", test_unimplemented}, - {"ORG-16 5.1.10.2 980Hz Detection", test_unimplemented}, - {"ORG-17 5.1.10.3 Loss of signal after 980Hz", test_unimplemented}, - {"ORG-18 5.1.10.3 Tr Timer", test_unimplemented}, - {"ORG-19 5.1.11 Bell 103 (1270Hz Signal) Detection", test_unimplemented}, - {"ORG-20 Immunity to Network Tones", test_unimplemented}, - {"ORG-21a to b Immunity to other non-textphone modems", test_unimplemented}, - {"ORG-22 Immunity to Fax Tones", test_unimplemented}, - {"ORG-23 Immunity to Voice", test_unimplemented}, - {"ORG-24 5.1.2 ANSam detection", test_unimplemented}, - {"ORG-25 6.1 V.8 originate call", test_unimplemented}, + {"ORG-01 5.1.1 CI & XCI Signal coding and cadence", test_org_01}, + {"ORG-02 5.1.3 ANS Signal Detection", test_org_02}, + {"ORG-03 5.2.3.1 End of ANS signal detection", test_org_03}, + {"ORG-04 5.1.3.2 ANS tone followed by TXP", test_org_04}, + {"ORG-05 5.1.3.3 ANS tone followed by 1650Hz", test_org_05}, + {"ORG-06 5.1.3.4 ANS tone followed by 1300Hz", test_org_06}, + {"ORG-07 5.1.3 ANS tone followed by no tone", test_org_07}, + {"ORG-08 5.1.4 Bell 103 (2225Hz Signal) Detection", test_org_08}, + {"ORG-09 5.1.5 V.21 (1650Hz Signal) Detection", test_org_09}, + {"ORG-10 5.1.6 V.23 (1300Hz Signal) Detection", test_org_10}, + {"ORG-11 5.1.7 V.23 (390Hz Signal) Detection", test_org_11}, + {"ORG-12a to d 5.1.8 5 Bit Mode (Baudot) Detection Tests", test_org_12}, + {"ORG-13 5.1.9 DTMF signal detection", test_org_13}, + {"ORG-14 5.1.10 EDT Rate Detection", test_org_14}, + {"ORG-15 5.1.10.1 Rate Detection Test", test_org_15}, + {"ORG-16 5.1.10.2 980Hz Detection", test_org_16}, + {"ORG-17 5.1.10.3 Loss of signal after 980Hz", test_org_17}, + {"ORG-18 5.1.10.3 Tr Timer", test_org_18}, + {"ORG-19 5.1.11 Bell 103 (1270Hz Signal) Detection", test_org_19}, + {"ORG-20 Immunity to Network Tones", test_org_20}, + {"ORG-21a to b Immunity to other non-textphone modems", test_org_21}, + {"ORG-22 Immunity to Fax Tones", test_org_22}, + {"ORG-23 Immunity to Voice", test_org_23}, + {"ORG-24 5.1.2 ANSam detection", test_org_24}, + {"ORG-25 6.1 V.8 originate call", test_org_25}, {"III.3.2.3 Automode answer tests", NULL}, - {"ANS-01 5.2.1 Ta timer", test_unimplemented}, - {"ANS-02 5.2.2 CI Signal Detection", test_unimplemented}, - {"ANS-03 5.2.2.1 Early Termination of ANS tone", test_unimplemented}, - {"ANS-04 5.2.2.2 Tt Timer", test_unimplemented}, - {"ANS-05 5.2.3.2 ANS tone followed by 980Hz", test_unimplemented}, - {"ANS-06 5.2.3.2 ANS tone followed by 1300Hz", test_unimplemented}, - {"ANS-07 5.2.3.3 ANS tone followed by 1650Hz", test_unimplemented}, - {"ANS-08 5.2.4.1 980Hz followed by 1650Hz", test_unimplemented}, - {"ANS-09a to d 5.2.4.2 980Hz calling tone detection", test_unimplemented}, - {"ANS-10 5.2.4.3 V.21 Detection by Timer", test_unimplemented}, - {"ANS-11 5.2.4.4.1 EDT Detection by Rate", test_unimplemented}, - {"ANS-12 5.2.4.4.2 V.21 Detection by Rate", test_unimplemented}, - {"ANS-13 5.2.4.4.3 Tr Timer", test_unimplemented}, - {"ANS-14 5.2.4.5 Te Timer", test_unimplemented}, - {"ANS-15a to d 5.2.5 5 Bit Mode (Baudot) Detection Tests", test_unimplemented}, - {"ANS-16 5.2.6 DTMF Signal Detection", test_unimplemented}, - {"ANS-17 5.2.7 Bell 103 (1270Hz signal) detection", test_unimplemented}, - {"ANS-18 5.2.8 Bell 103 (2225Hz signal) detection", test_unimplemented}, - {"ANS-19 5.2.9 V.21 Reverse Mode (1650Hz) Detection", test_unimplemented}, - {"ANS-20a to d 5.2.10 1300Hz Calling Tone Discrimination", test_unimplemented}, - {"ANS-21 5.2.11 V.23 Reverse Mode (1300Hz) Detection", test_unimplemented}, - {"ANS-22 1300Hz with XCI Test", test_unimplemented}, - {"ANS-23 5.2.12 Stimulate Mode Country Settings", test_unimplemented}, - {"ANS-24 5.2.12.1 Stimulate Carrierless Mode Probe Message", test_unimplemented}, - {"ANS-25 5.2.12.1.1 Interrupted Carrierless Mode Probe", test_unimplemented}, - {"ANS-26 5.2.12.2 Stimulate Carrier Mode Probe Time", test_unimplemented}, - {"ANS-27 5.2.12.2.1 V.23 Mode (390Hz) Detection", test_unimplemented}, - {"ANS-28 5.2.12.2.2 Interrupted Carrier Mode Probe", test_unimplemented}, - {"ANS-29 5.2.12.2.2 Stimulate Mode Response During Probe", test_unimplemented}, - {"ANS-30 Immunity to Network Tones", test_unimplemented}, - {"ANS-31 Immunity to Fax Calling Tones", test_unimplemented}, - {"ANS-32 Immunity to Voice", test_unimplemented}, - {"ANS-33 5.2.2.1 V.8 CM detection and V.8 Answering", test_unimplemented}, + {"ANS-01 5.2.1 Ta timer", test_ans_01}, + {"ANS-02 5.2.2 CI Signal Detection", test_ans_02}, + {"ANS-03 5.2.2.1 Early Termination of ANS tone", test_ans_03}, + {"ANS-04 5.2.2.2 Tt Timer", test_ans_04}, + {"ANS-05 5.2.3.2 ANS tone followed by 980Hz", test_ans_05}, + {"ANS-06 5.2.3.2 ANS tone followed by 1300Hz", test_ans_06}, + {"ANS-07 5.2.3.3 ANS tone followed by 1650Hz", test_ans_07}, + {"ANS-08 5.2.4.1 980Hz followed by 1650Hz", test_ans_08}, + {"ANS-09a to d 5.2.4.2 980Hz calling tone detection", test_ans_09}, + {"ANS-10 5.2.4.3 V.21 Detection by Timer", test_ans_10}, + {"ANS-11 5.2.4.4.1 EDT Detection by Rate", test_ans_11}, + {"ANS-12 5.2.4.4.2 V.21 Detection by Rate", test_ans_12}, + {"ANS-13 5.2.4.4.3 Tr Timer", test_ans_13}, + {"ANS-14 5.2.4.5 Te Timer", test_ans_14}, + {"ANS-15a to d 5.2.5 5 Bit Mode (Baudot) Detection Tests", test_ans_15}, + {"ANS-16 5.2.6 DTMF Signal Detection", test_ans_16}, + {"ANS-17 5.2.7 Bell 103 (1270Hz signal) detection", test_ans_17}, + {"ANS-18 5.2.8 Bell 103 (2225Hz signal) detection", test_ans_18}, + {"ANS-19 5.2.9 V.21 Reverse Mode (1650Hz) Detection", test_ans_19}, + {"ANS-20a to d 5.2.10 1300Hz Calling Tone Discrimination", test_ans_20}, + {"ANS-21 5.2.11 V.23 Reverse Mode (1300Hz) Detection", test_ans_21}, + {"ANS-22 1300Hz with XCI Test", test_ans_22}, + {"ANS-23 5.2.12 Stimulate Mode Country Settings", test_ans_23}, + {"ANS-24 5.2.12.1 Stimulate Carrierless Mode Probe Message", test_ans_24}, + {"ANS-25 5.2.12.1.1 Interrupted Carrierless Mode Probe", test_ans_25}, + {"ANS-26 5.2.12.2 Stimulate Carrier Mode Probe Time", test_ans_26}, + {"ANS-27 5.2.12.2.1 V.23 Mode (390Hz) Detection", test_ans_27}, + {"ANS-28 5.2.12.2.2 Interrupted Carrier Mode Probe", test_ans_28}, + {"ANS-29 5.2.12.2.2 Stimulate Mode Response During Probe", test_ans_29}, + {"ANS-30 Immunity to Network Tones", test_ans_30}, + {"ANS-31 Immunity to Fax Calling Tones", test_ans_31}, + {"ANS-32 Immunity to Voice", test_ans_32}, + {"ANS-33 5.2.2.1 V.8 CM detection and V.8 Answering", test_ans_33}, {"III.3.2.4 Automode monitor tests", NULL}, - {"MON-01 to -20 5.3 Repeat all answer mode tests excluding tests ANS-01, ANS-20 and ANS-23 to ANS-29", test_unimplemented}, - {"MON-21 5.3 Automode Monitor Ta timer", test_unimplemented}, - {"MON-22a to d 5.3 Automode Monitor 1300Hz Calling Tone Discrimination", test_unimplemented}, - {"MON-23a to d 5.3 Automode Monitor 980Hz Calling Tone Discrimination", test_unimplemented}, + {"MON-01 to -20 5.3 Repeat all answer mode tests excluding tests ANS-01, ANS-20 and ANS-23 to ANS-29", test_mon_01}, + {"MON-21 5.3 Automode Monitor Ta timer", test_mon_21}, + {"MON-22a to d 5.3 Automode Monitor 1300Hz Calling Tone Discrimination", test_mon_22}, + {"MON-23a to d 5.3 Automode Monitor 980Hz Calling Tone Discrimination", test_mon_23}, {"III.3.2.5 ITU-T V.18 annexes tests", NULL}, {"X-01 A.1 Baudot carrier timing and receiver disabling", test_x_01}, {"X-02 A.2 Baudot bit rate confirmation", test_x_02}, {"X-03 A.3 Baudot probe bit rate confirmation", test_x_03}, {"X-04 A.4 5 Bit to T.50 Character Conversion", test_x_04}, - {"X-05 B.1 DTMF receiver disabling", test_unimplemented}, + {"X-05 B.1 DTMF receiver disabling", test_x_05}, {"X-06 B.2 DTMF character conversion", test_x_06}, - {"X-07 C.1 EDT carrier timing and receiver disabling", test_unimplemented}, - {"X-08 C.2-3 EDT bit rate and character structure", test_unimplemented}, - {"X-09 E V.23 calling mode character format", test_unimplemented}, - {"X-10 E V.23 answer mode character format", test_unimplemented}, - {"X-11 F.4-5 V.21 character structure", test_unimplemented}, - {"X-12 G.1-3 V.18 mode", test_unimplemented}, + {"X-07 C.1 EDT carrier timing and receiver disabling", test_x_07}, + {"X-08 C.2-3 EDT bit rate and character structure", test_x_08}, + {"X-09 E V.23 calling mode character format", test_x_09}, + {"X-10 E V.23 answer mode character format", test_x_10}, + {"X-11 F.4-5 V.21 character structure", test_x_11}, + {"X-12 G.1-3 V.18 mode", test_x_12}, {"", NULL} }; @@ -490,6 +2027,7 @@ int main(int argc, char *argv[]) exit(2); } basic_tests(V18_MODE_5BIT_45); + basic_tests(V18_MODE_5BIT_45 | 0x100); if (log_audio) { if (sf_close_telephony(outhandle)) diff --git a/libs/spandsp/tests/v22bis_tests.c b/libs/spandsp/tests/v22bis_tests.c index f7d7ef7703..f070dd709c 100644 --- a/libs/spandsp/tests/v22bis_tests.c +++ b/libs/spandsp/tests/v22bis_tests.c @@ -228,11 +228,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #endif #if defined(ENABLE_GUI) if (use_gui) + { #if defined(SPANDSP_USE_FIXED_POINTx) qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(s->qam_monitor, coeffs, len); #endif + } #endif } } diff --git a/libs/spandsp/tests/v27ter_tests.c b/libs/spandsp/tests/v27ter_tests.c index cd05b13738..ca0e710ae3 100644 --- a/libs/spandsp/tests/v27ter_tests.c +++ b/libs/spandsp/tests/v27ter_tests.c @@ -260,11 +260,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #endif #if defined(ENABLE_GUI) if (use_gui) + { #if defined(SPANDSP_USE_FIXED_POINTx) qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(qam_monitor, coeffs, len); #endif + } #endif } } diff --git a/libs/spandsp/tests/v29_tests.c b/libs/spandsp/tests/v29_tests.c index 4b3b3858dc..dd1ac1bae5 100644 --- a/libs/spandsp/tests/v29_tests.c +++ b/libs/spandsp/tests/v29_tests.c @@ -244,11 +244,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #endif #if defined(ENABLE_GUI) if (use_gui) + { #if defined(SPANDSP_USE_FIXED_POINT) qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(qam_monitor, coeffs, len); #endif + } #endif update_interval = 100; } diff --git a/libs/spandsp/tests/v8_tests.c b/libs/spandsp/tests/v8_tests.c index 4c48143099..ae59817232 100644 --- a/libs/spandsp/tests/v8_tests.c +++ b/libs/spandsp/tests/v8_tests.c @@ -206,6 +206,8 @@ static int v8_calls_v8_tests(SNDFILE *outhandle) negotiations_ok = 0; v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + v8_call_parms.send_ci = TRUE; + v8_call_parms.v92 = -1; v8_call_parms.call_function = V8_CALL_V_SERIES; v8_call_parms.modulations = caller_available_modulations; v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; @@ -219,6 +221,8 @@ static int v8_calls_v8_tests(SNDFILE *outhandle) handler, (void *) "caller"); v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_answer_parms.send_ci = TRUE; + v8_answer_parms.v92 = -1; v8_answer_parms.call_function = V8_CALL_V_SERIES; v8_answer_parms.modulations = answerer_available_modulations; v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; @@ -329,6 +333,8 @@ static int non_v8_calls_v8_tests(SNDFILE *outhandle) non_v8_caller_rx = modem_connect_tones_rx_init(NULL, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_answer_parms.send_ci = TRUE; + v8_answer_parms.v92 = -1; v8_answer_parms.call_function = V8_CALL_V_SERIES; v8_answer_parms.modulations = answerer_available_modulations; v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; @@ -439,6 +445,8 @@ static int v8_calls_non_v8_tests(SNDFILE *outhandle) negotiations_ok = 0; v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + v8_call_parms.send_ci = TRUE; + v8_call_parms.v92 = -1; v8_call_parms.call_function = V8_CALL_V_SERIES; v8_call_parms.modulations = caller_available_modulations; v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; @@ -578,6 +586,8 @@ int main(int argc, char *argv[]) printf("Decode file '%s'\n", decode_test_file); v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + v8_call_parms.send_ci = TRUE; + v8_call_parms.v92 = -1; v8_call_parms.call_function = V8_CALL_V_SERIES; v8_call_parms.modulations = caller_available_modulations; v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42; @@ -595,6 +605,8 @@ int main(int argc, char *argv[]) span_log_set_tag(logging, "caller"); v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_answer_parms.send_ci = TRUE; + v8_answer_parms.v92 = -1; v8_answer_parms.call_function = V8_CALL_V_SERIES; v8_answer_parms.modulations = answerer_available_modulations; v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42; From 5d7e26141f9e01f31032808248d9279058202f9b Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 14 Jul 2012 23:59:01 +0800 Subject: [PATCH 0709/1057] Introducing T.85 encode and decodei to spandsp. This is not connected into the FAX engine in this update. --- libs/spandsp/src/Makefile.am | 7 + libs/spandsp/src/spandsp.h.in | 4 +- libs/spandsp/src/spandsp/expose.h | 4 +- .../spandsp/private/t81_t82_arith_coding.h | 79 ++ libs/spandsp/src/spandsp/private/t85.h | 212 +++++ .../src/spandsp/t81_t82_arith_coding.h | 82 ++ libs/spandsp/src/spandsp/t85.h | 288 ++++++ libs/spandsp/src/t81_t82_arith_coding.c | 509 +++++++++++ libs/spandsp/src/t85_decode.c | 864 ++++++++++++++++++ libs/spandsp/src/t85_encode.c | 747 +++++++++++++++ libs/spandsp/tests/Makefile.am | 8 + .../tests/t81_t82_arith_coding_tests.c | 238 +++++ libs/spandsp/tests/t85_tests.c | 369 ++++++++ 13 files changed, 3407 insertions(+), 4 deletions(-) create mode 100644 libs/spandsp/src/spandsp/private/t81_t82_arith_coding.h create mode 100644 libs/spandsp/src/spandsp/private/t85.h create mode 100644 libs/spandsp/src/spandsp/t81_t82_arith_coding.h create mode 100644 libs/spandsp/src/spandsp/t85.h create mode 100644 libs/spandsp/src/t81_t82_arith_coding.c create mode 100644 libs/spandsp/src/t85_decode.c create mode 100644 libs/spandsp/src/t85_encode.c create mode 100644 libs/spandsp/tests/t81_t82_arith_coding_tests.c create mode 100644 libs/spandsp/tests/t85_tests.c diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index a6846151eb..c6d5229d86 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -153,6 +153,9 @@ libspandsp_la_SOURCES = ademco_contactid.c \ t38_core.c \ t38_gateway.c \ t38_non_ecm_buffer.c \ + t81_t82_arith_coding.c \ + t85_decode.c \ + t85_encode.c \ t38_terminal.c \ testcpuid.c \ time_scale.c \ @@ -241,6 +244,8 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \ spandsp/t4_tx.h \ spandsp/t4_t6_decode.h \ spandsp/t4_t6_encode.h \ + spandsp/t81_t82_arith_coding.h \ + spandsp/t85.h \ spandsp/telephony.h \ spandsp/time_scale.h \ spandsp/timezone.h \ @@ -305,6 +310,8 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \ spandsp/private/t4_tx.h \ spandsp/private/t4_t6_decode.h \ spandsp/private/t4_t6_encode.h \ + spandsp/private/t81_t82_arith_coding.h \ + spandsp/private/t85.h \ spandsp/private/time_scale.h \ spandsp/private/timezone.h \ spandsp/private/tone_detect.h \ diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index e3c0d4f477..90e77cd5ef 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -108,8 +108,8 @@ #include #include #include -/*#include */ -/*#include */ +#include +#include /*#include */ /*#include */ #include diff --git a/libs/spandsp/src/spandsp/expose.h b/libs/spandsp/src/spandsp/expose.h index 75c16f2405..f4696d2688 100644 --- a/libs/spandsp/src/spandsp/expose.h +++ b/libs/spandsp/src/spandsp/expose.h @@ -78,8 +78,8 @@ #include #include #include -/*#include */ -/*#include */ +#include +#include /*#include */ /*#include */ #include diff --git a/libs/spandsp/src/spandsp/private/t81_t82_arith_coding.h b/libs/spandsp/src/spandsp/private/t81_t82_arith_coding.h new file mode 100644 index 0000000000..0efe3f00ca --- /dev/null +++ b/libs/spandsp/src/spandsp/private/t81_t82_arith_coding.h @@ -0,0 +1,79 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t81_t82_arith_coding.h - ITU T.81 and T.82 QM-coder arithmetic encoding + * and decoding + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_SPANDSP_PRIVATE_T81_T82_ARITH_CODING_H_) +#define _SPANDSP_PRIVATE_T81_T82_ARITH_CODING_H_ + +/* State of a working instance of the QM-coder arithmetic encoder */ +struct t81_t82_arith_encode_state_s +{ + /*! A register - see T.82 Table 23 */ + uint32_t a; + /*! C register - see T.82 Table 23 */ + uint32_t c; + /*! Probability status for contexts. MSB = MPS */ + uint8_t st[4096]; + /*! Number of buffered 0xFF values that might still overflow */ + int32_t sc; + /*! Bit shift counter. This determines when the next byte will be written */ + int ct; + /*! Buffer for the most recent output byte which is not 0xFF */ + int buffer; + /*! Callback function to deliver the encoded data, byte by byte */ + void (*output_byte_handler)(void *, int); + /*! Opaque pointer passed to byte_out */ + void *user_data; +}; + +/* State of a working instance of the QM-coder arithmetic decoder */ +struct t81_t82_arith_decode_state_s +{ + /*! A register - see T.82 Table 25 */ + uint32_t a; + /*! C register - see T.82 Table 25 */ + uint32_t c; + /*! Probability status for contexts. MSB = MPS */ + uint8_t st[4096]; + /*! Bit-shift counter. Determines when next byte will be read. + Special value -1 signals that zero-padding has started */ + int ct; + /*! Pointer to next PSCD data byte */ + const uint8_t *pscd_ptr; + /*! Pointer to byte after PSCD */ + const uint8_t *pscd_end; + /*! Boolean flag that controls initial fill of s->c */ + int startup; + /*! Boolean flag that triggers return -2 between reaching PSCD end + and decoding the first symbol that might never have been encoded + in the first place */ + int nopadding; +}; + +#endif + +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/private/t85.h b/libs/spandsp/src/spandsp/private/t85.h new file mode 100644 index 0000000000..dac7a3340a --- /dev/null +++ b/libs/spandsp/src/spandsp/private/t85.h @@ -0,0 +1,212 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t85.h - ITU T.85 JBIG for FAX image processing + * + * Written by Steve Underwood + * + * Copyright (C) 2008, 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if !defined(_SPANDSP_PRIVATE_T85_H_) +#define _SPANDSP_PRIVATE_T85_H_ + +/* Maximum number of ATMOVEs per stripe that the decoder can handle */ +#define T85_ATMOVES_MAX 1 + +/* TP special pixels */ +#define TPB2CX 0x195 +#define TPB3CX 0x0E5 + +/* T.82 table 2 - symbolic constants */ +enum +{ + T82_STUFF = 0x00, + T82_RESERVE = 0x01, + T82_SDNORM = 0x02, + T82_SDRST = 0x03, + T82_ABORT = 0x04, + T82_NEWLEN = 0x05, + T82_ATMOVE = 0x06, + T82_COMMENT = 0x07, + T82_ESC = 0xFF +}; + +/* State of a working instance of the T.85 JBIG FAX encoder */ +struct t85_encode_state_s +{ + /*! \brief Callback function to read a row of pixels from the image source. */ + t4_row_read_handler_t row_read_handler; + /*! \brief Opaque pointer passed to row_read_handler. */ + void *row_read_user_data; + + /*! The number of bit planes. Always 1 for true T.85 */ + uint8_t bit_planes; + uint8_t current_bit_plane; + /*! The width of the full image, in pixels */ + uint32_t xd; + /*! The height of the full image, in pixels */ + uint32_t yd; + /*! Then number of rows per stripe */ + uint32_t l0; + /*! Maximum ATMOVE window size (0 - 127) */ + int mx; + /*! Encoding parameters */ + int options; + /*! The contents for a COMMENT marker segment, to be added to the + image at the next opportunity. This is set to NULL when nothing is + pending. */ + const uint8_t *comment; + /*! Length of data pointed to by comment */ + size_t comment_len; + + /*! Next row number to be encoded */ + uint32_t y; + /*! Next row within current stripe */ + uint32_t i; + /*! Flag for handling NEWLEN processing. */ + int newlen; + /*! X-offset of adaptive template pixel */ + int32_t tx; + /*! Adaptive template algorithm variables */ + uint32_t c_all; + /*! Adaptive template algorithm variables */ + uint32_t c[128]; + /*! New TX value, or <0 for analysis in progress */ + int32_t new_tx; + /*! TRUE if previous row was typical */ + int prev_ltp; + /*! Pointers to the 3 row buffers */ + uint8_t *prev_row[3]; + /*! Pointer to a block of allocated memory 3 rows long, which + we divide up for the 3 row buffers. */ + uint8_t *row_buf; + uint8_t *bitstream; + int bitstream_len; + int bitstream_iptr; + int bitstream_optr; + int fill_with_white; + + /*! \brief The size of the compressed image, in bytes. */ + int compressed_image_size; + + /*! Arithmetic encoder state */ + t81_t82_arith_encode_state_t s; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +/* State of a working instance of the T.85 JBIG FAX decoder */ +struct t85_decode_state_s +{ + /*! A callback routine to handle decoded pixel rows */ + t4_row_write_handler_t row_write_handler; + /*! An opaque pointer passed to row_write_handler() */ + void *row_write_user_data; + /*! A callback routine to handle decoded comments */ + t4_row_write_handler_t comment_handler; + /*! An opaque pointer passed to comment_handler() */ + void *comment_user_data; + + uint8_t min_bit_planes; + uint8_t max_bit_planes; + /*! The maximum length of comment to be passed to the comment handler */ + uint32_t max_comment_len; + /*! The maximum permitted width of the full image, in pixels */ + uint32_t max_xd; + /*! The maximum permitted height of the full image, in pixels */ + uint32_t max_yd; + + /*! The number of bit planes expected, according to the header. Always 1 for true T.85 */ + uint8_t bit_planes; + uint8_t current_bit_plane; + + /*! The width of the full image, in pixels */ + uint32_t xd; + /*! The height of the full image, in pixels */ + uint32_t yd; + /*! The number of rows per stripe */ + uint32_t l0; + /*! Maximum ATMOVE window size */ + int mx; + /*! Encoding parameters */ + int options; + + /*! The current row and the previous 2 rows of image data */ + int p[3]; + /*! Pointers to the 3 row buffers */ + uint8_t *prev_row[3]; + /*! Pointer to a block of allocated memory 3 rows long, which + we divide up for the 3 row buffers. */ + uint8_t *row_buf; + /*! The length of the row buffer */ + int row_buf_len; + /*! Bytes per pixel row */ + size_t bytes_per_row; + /*! X-offset of AT pixel */ + int32_t tx; + /*! Number of bytes read so far */ + uint32_t bie_len; + /*! Buffer space for the BIH or marker segments fragments */ + uint8_t buffer[20]; + /*! Number of bytes in buffer. */ + int buf_len; + /*! Required number of bytes in buffer to proceed with processing + its contents. */ + int buf_needed; + /*! The content of a decoded COMMENT marker segment. */ + uint8_t *comment; + /*! The expected length of a decoded COMMENT segment */ + uint32_t comment_len; + /*! The length of COMMENT decoded to date */ + uint32_t comment_progress; + /*! Current column */ + uint32_t x; + /*! Current row */ + uint32_t y; + /*! Current row within the current stripe */ + uint32_t i; + /*! Number of AT moves in the current stripe */ + int at_moves; + /*! Rows at which an AT move will happen */ + uint32_t at_row[T85_ATMOVES_MAX]; + /*! ATMOVE x-offsets in current stripe */ + int at_tx[T85_ATMOVES_MAX]; + /*! Working data for decode_pscd() */ + uint32_t row_h[3]; + /*! Flag for TPBON/TPDON: next pixel is a pseudo pixel */ + int pseudo; + /*! Line is not typical flag. */ + int lntp; + /*! Flag that row_write_handler() requested an interrupt. */ + int interrupt; + /*! Flag that the data to be decoded has run out. */ + int end_of_data; + /*! Arithmetic decoder state */ + t81_t82_arith_decode_state_t s; + + /*! \brief The size of the compressed image, in bytes. */ + int compressed_image_size; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/t81_t82_arith_coding.h b/libs/spandsp/src/spandsp/t81_t82_arith_coding.h new file mode 100644 index 0000000000..905e0491be --- /dev/null +++ b/libs/spandsp/src/spandsp/t81_t82_arith_coding.h @@ -0,0 +1,82 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t81_t82_arith_coding.h - ITU T.81 and T.82 QM-coder arithmetic encoding + * and decoding + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_SPANDSP_T81_T82_ARITH_CODING_H_) +#define _SPANDSP_T81_T82_ARITH_CODING_H_ + +/*! \page t81_t82_arith_coding_page T.81 and T.82 QM-coder arithmetic encoding and decoding + +\section t81_t82_arith_coding_page_sec_1 What does it do? +A similar arithmetic coder, called the QM-coder, is used by several image compression +schemes. These routines implement this coder in a (hopefully) reusable way. + +\section t81_t82_arith_coding_page_sec_1 How does it work? +*/ + +/* State of a working instance of the arithmetic encoder */ +typedef struct t81_t82_arith_encode_state_s t81_t82_arith_encode_state_t; + +/* State of a working instance of the arithmetic decoder */ +typedef struct t81_t82_arith_decode_state_s t81_t82_arith_decode_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(t81_t82_arith_encode_state_t *) t81_t82_arith_encode_init(t81_t82_arith_encode_state_t *s, + void (*output_byte_handler)(void *, int), + void *user_data); + +SPAN_DECLARE(int) t81_t82_arith_encode_restart(t81_t82_arith_encode_state_t *s, int reuse_st); + +SPAN_DECLARE(int) t81_t82_arith_encode_release(t81_t82_arith_encode_state_t *s); + +SPAN_DECLARE(int) t81_t82_arith_encode_free(t81_t82_arith_encode_state_t *s); + +SPAN_DECLARE(void) t81_t82_arith_encode(t81_t82_arith_encode_state_t *s, int cx, int pix); + +SPAN_DECLARE(void) t81_t82_arith_encode_flush(t81_t82_arith_encode_state_t *s); + + +SPAN_DECLARE(t81_t82_arith_decode_state_t *) t81_t82_arith_decode_init(t81_t82_arith_decode_state_t *s); + +SPAN_DECLARE(int) t81_t82_arith_decode_restart(t81_t82_arith_decode_state_t *s, int reuse_st); + +SPAN_DECLARE(int) t81_t82_arith_decode_release(t81_t82_arith_decode_state_t *s); + +SPAN_DECLARE(int) t81_t82_arith_decode_free(t81_t82_arith_decode_state_t *s); + +SPAN_DECLARE(int) t81_t82_arith_decode(t81_t82_arith_decode_state_t *s, int cx); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/t85.h b/libs/spandsp/src/spandsp/t85.h new file mode 100644 index 0000000000..516f6ee0e7 --- /dev/null +++ b/libs/spandsp/src/spandsp/t85.h @@ -0,0 +1,288 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t85.h - ITU T.85 JBIG for FAX image processing + * + * Written by Steve Underwood + * + * Copyright (C) 2008, 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_SPANDSP_T85_H_) +#define _SPANDSP_T85_H_ + +/*! \page t85_page T.85 (JBIG for FAX) image compression and decompression + +\section t85_page_sec_1 What does it do? +The T.85 image compression and decompression routines implement the variant of the +JBIG encoding method defined in ITU specification T.85. This is an image compression +algorithm used for black and white FAX transmission. T.85 defines a subset of the +full JBIG spec (T.82), which only handled a single progressively scanned bit plane. +This results in a great deal of simplification, and results in the ability to +compress or decompress progressively, while only buffering the latest 3 pixel rows +of the image. + +\section t85_page_sec_1 How does it work? +*/ + +/*! Bits in the option byte of the T.82 BIH which are valid for T.85 */ +enum +{ + /*! Enable typical prediction (bottom) */ + T85_TPBON = 0x08, + /*! Variable length image */ + T85_VLENGTH = 0x20, + /*! Lowest-resolution-layer is a two-line template */ + T85_LRLTWO = 0x40 +}; + +/*! Return values from the T.85 decoder */ +enum +{ + /*! More image data is needed */ + T85_MORE_DATA = 0, + /*! Image completed successfully */ + T85_OK = -1, + /*! The decoder has interrupted */ + T85_INTERRUPT = -2, + /*! An abort was found in the image data */ + T85_ABORTED = -3, + /*! A memory allocation error occurred */ + T85_NOMEM = -4, + /*! The image data is invalid. This includes finding values + in the BIH which lie outside the T.85 domain */ + T85_INVALID_DATA = -5 +}; + +/*! State of a working instance of the T.85 encoder */ +typedef struct t85_encode_state_s t85_encode_state_t; + +/*! State of a working instance of the T.85 decoder */ +typedef struct t85_decode_state_s t85_decode_state_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Get the next byte of the current document page. The document will + be padded for the current minimum scan line time. + \param s The T.85 context. + \return The next byte. For the last byte of data, bit 8 is + set. In this case, one or more bits of the byte may be padded with + zeros, to complete the byte. */ +SPAN_DECLARE(int) t85_encode_get_byte(t85_encode_state_t *s); + +/*! \brief Get the next chunk of the current document page. The document will + be padded for the current minimum scan line time. + \param s The T.85 context. + \param buf The buffer into which the chunk is to written. + \param max_len The maximum length of the chunk. + \return The actual length of the chunk. If this is less than max_len it + indicates that the end of the document has been reached. */ +SPAN_DECLARE(int) t85_encode_get_chunk(t85_encode_state_t *s, uint8_t buf[], int max_len); + +/*! \brief Set the row read handler for a T.85 encode context. + \param s The T.85 context. + \param handler A pointer to the handler routine. + \param user_data An opaque pointer passed to the handler routine. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t85_encode_set_row_read_handler(t85_encode_state_t *s, + t4_row_read_handler_t handler, + void *user_data); + +/*! \brief Prepare to encode an image in T.85 format. + \param s The T.85 context. + \param image_width Image width, in pixels. + \param image_length Image length, in pixels. + \param handler A callback routine to handle encoded image rows. + \param user_data An opaque pointer passed to handler. + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(t85_encode_state_t *) t85_encode_init(t85_encode_state_t *s, + uint32_t image_width, + uint32_t image_length, + t4_row_read_handler_t handler, + void *user_data); + +/*! \brief Restart a T.85 encode context. + \param s The T.85 context. + \param image width The image width, in pixels. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t85_encode_restart(t85_encode_state_t *s, + uint32_t image_width, + uint32_t image_length); + +SPAN_DECLARE(int) t85_encode_release(t85_encode_state_t *s); + +SPAN_DECLARE(int) t85_encode_free(t85_encode_state_t *s); + +/*! \brief Set the T.85 options + \param s The T.85 context. + \brief l0 ??? + \brief mx ??? + \brief options ???. */ +SPAN_DECLARE(void) t85_encode_set_options(t85_encode_state_t *s, + uint32_t l0, + int mx, + int options); + +/*! \brief Insert a comment in the encoded file. + \param s The T.85 context. + \param comment The comment. Note that this is not a C string, and may contain any bytes. + \param len The length of the comment. */ +SPAN_DECLARE(void) t85_encode_comment(t85_encode_state_t *s, + const uint8_t comment[], + size_t len); + +/*! \brief Set the image width. + \param s The T.85 context. + \param width The width of the image. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t85_encode_set_image_width(t85_encode_state_t *s, uint32_t image_width); + +/*! \brief Alter the length of a T.85 encoded image. The new length cannot be greater than the + originally specified length. If the new length is less than the current length it + will be silently adjusted to the current length. Therefore, adjust the length to 1 + will make the currently encoded length the final length. + \param s The T.85 context. + \param length The new image length, in pixels. + \return 0 if OK, or -1 if the request was not valid. */ +SPAN_DECLARE(int) t85_encode_set_image_length(t85_encode_state_t *s, uint32_t length); + +/*! \brief Get the width of the image. + \param s The T.85 context. + \return The width of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t85_encode_get_image_width(t85_encode_state_t *s); + +/*! \brief Get the length of the image. + \param s The T.85 context. + \return The length of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t85_encode_get_image_length(t85_encode_state_t *s); + +/*! \brief Get the size of the compressed image, in bits. + \param s The T.85 context. + \return The size of the compressed image, in bits. */ +SPAN_DECLARE(int) t85_encode_get_compressed_image_size(t85_encode_state_t *s); + +/*! \brief Stop image encoding prematurely. + \param s The T.85 context. */ +SPAN_DECLARE(void) t85_encode_abort(t85_encode_state_t *s); + +/*! \brief Prepare to decode an image in T.85 format. + \param s The T.85 context. + \param handler A callback routine to handle decoded image rows. + \param user_data An opaque pointer passed to handler. + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(t85_decode_state_t *) t85_decode_init(t85_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t85_decode_new_plane(t85_decode_state_t *s); + +SPAN_DECLARE(int) t85_decode_restart(t85_decode_state_t *s); + +SPAN_DECLARE(int) t85_decode_release(t85_decode_state_t *s); + +SPAN_DECLARE(int) t85_decode_free(t85_decode_state_t *s); + +/*! \brief Get the width of the image. + \param s The T.85 context. + \return The width of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t85_decode_get_image_width(t85_decode_state_t *s); + +/*! \brief Get the length of the image. + \param s The T.85 context. + \return The length of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t85_decode_get_image_length(t85_decode_state_t *s); + +/*! \brief Get the size of the compressed image, in bits. + \param s The T.85 context. + \return The size of the compressed image, in bits. */ +SPAN_DECLARE(int) t85_decode_get_compressed_image_size(t85_decode_state_t *s); + +/*! \brief Set the row handler routine. + \param s The T.85 context. + \param handler A callback routine to handle decoded image rows. + \param user_data An opaque pointer passed to handler. + \return 0 for OK. */ +SPAN_DECLARE(int) t85_decode_set_row_write_handler(t85_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data); + +/*! \brief Set the comment handler routine. + \param s The T.85 context. + \param max_comment_len The maximum length of comment to be passed to the handler. + \param handler A callback routine to handle decoded comment. + \param user_data An opaque pointer passed to handler. + \return 0 for OK. */ +SPAN_DECLARE(int) t85_decode_set_comment_handler(t85_decode_state_t *s, + uint32_t max_comment_len, + t4_row_write_handler_t handler, + void *user_data); + +/*! A maliciously constructed T.85 image could consume too much memory, and constitute + a denial of service attack on the system. This function allows constraints to be + applied. + \brief Set constraints on the received image size. + \param s The T.85 context. + \param max_xd The maximum permitted width of the full image, in pixels + \param max_yd The maximum permitted height of the full image, in pixels + \return 0 for OK */ +SPAN_DECLARE(int) t85_decode_set_image_size_constraints(t85_decode_state_t *s, + uint32_t max_xd, + uint32_t max_yd); + +/*! After the final BIE byte has been delivered to t85_decode_put_xx(), it may still + return T85_MORE_DATA when the T85_VLENGTH option was used, and no NEWLEN + marker section has appeared yet. This is because such a BIE is not + self-terminating (i.e. there could still be a NEWLEN followed by an SDNORM + or SDRST at the very end of the final stripe, which needs to be processed + before the final row is output. See ITU-T Recommendation T.85, Appendix I). + Therefore, after the last byte has been delivered, call this routine to + signal the end of the BIE. This is necessary to allow the routine to finish + processing BIEs with option T85_VLENGTH that do not actually contain any + NEWLEN marker section. + \brief Inform the T.85 decode engine of a status change in the signal source (end + of tx, rx signal change, etc.). + \param s The T.85 context. + \param status The type of status change which occured. */ +SPAN_DECLARE(void) t85_decode_rx_status(t85_decode_state_t *s, int status); + +/*! \brief Decode a byte of T.85 data. + \param s The T.85 context. + \param byte The data to be decoded. + \return 0 for OK. */ +SPAN_DECLARE(int) t85_decode_put_byte(t85_decode_state_t *s, int byte); + +/*! \brief Decode a chunk of T.85 data. + \param s The T.85 context. + \param data The data to be decoded. + \param len The length of the data to be decoded. + \return 0 for OK. */ +SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, + const uint8_t data[], + size_t len); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t81_t82_arith_coding.c b/libs/spandsp/src/t81_t82_arith_coding.c new file mode 100644 index 0000000000..86e7e0271f --- /dev/null +++ b/libs/spandsp/src/t81_t82_arith_coding.c @@ -0,0 +1,509 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t81_t82_arith_coding.c - ITU T.81 and T.82 QM-coder arithmetic encoding + * and decoding + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/t81_t82_arith_coding.h" + +#include "spandsp/private/t81_t82_arith_coding.h" + +/* T.82 defines the QM-coder at a level very close to actual code. Therefore + this file closely mirrors the routine names, variable names, and flow + described in T.82. QM-Coder is supposed to be the same in some other image + compression schemes, such as T.81. However, this code has not been checked + to see if it follows the letter of any spec other than T.82. */ + +#define FALSE 0 +#define TRUE (!FALSE) + +/* Code bytes which must trigger stuffing */ +enum +{ + T81_T82_STUFF = 0x00, + T81_T82_ESC = 0xFF +}; + +/* This table is from T.82 table 24 - Probability estimation table */ +static const struct probability_estimation_s +{ + uint16_t lsz; + uint8_t nlps; /* The SWITCH bit is packed into the top of this byte */ + uint8_t nmps; +} prob[113] = +{ + {0x5A1D, 1 + 128, 1}, + {0x2586, 14, 2}, + {0x1114, 16, 3}, + {0x080B, 18, 4}, + {0x03D8, 20, 5}, + {0x01DA, 23, 6}, + {0x00E5, 25, 7}, + {0x006F, 28, 8}, + {0x0036, 30, 9}, + {0x001A, 33, 10}, + {0x000D, 35, 11}, + {0x0006, 9, 12}, + {0x0003, 10, 13}, + {0x0001, 12, 13}, + {0x5A7F, 15 + 128, 15}, + {0x3F25, 36, 16}, + {0x2CF2, 38, 17}, + {0x207C, 39, 18}, + {0x17B9, 40, 19}, + {0x1182, 42, 20}, + {0x0CEF, 43, 21}, + {0x09A1, 45, 22}, + {0x072F, 46, 23}, + {0x055C, 48, 24}, + {0x0406, 49, 25}, + {0x0303, 51, 26}, + {0x0240, 52, 27}, + {0x01B1, 54, 28}, + {0x0144, 56, 29}, + {0x00F5, 57, 30}, + {0x00B7, 59, 31}, + {0x008A, 60, 32}, + {0x0068, 62, 33}, + {0x004E, 63, 34}, + {0x003B, 32, 35}, + {0x002C, 33, 9}, + {0x5AE1, 37 + 128, 37}, + {0x484C, 64, 38}, + {0x3A0D, 65, 39}, + {0x2EF1, 67, 40}, + {0x261F, 68, 41}, + {0x1F33, 69, 42}, + {0x19A8, 70, 43}, + {0x1518, 72, 44}, + {0x1177, 73, 45}, + {0x0E74, 74, 46}, + {0x0BFB, 75, 47}, + {0x09F8, 77, 48}, + {0x0861, 78, 49}, + {0x0706, 79, 50}, + {0x05CD, 48, 51}, + {0x04DE, 50, 52}, + {0x040F, 50, 53}, + {0x0363, 51, 54}, + {0x02D4, 52, 55}, + {0x025C, 53, 56}, + {0x01F8, 54, 57}, + {0x01A4, 55, 58}, + {0x0160, 56, 59}, + {0x0125, 57, 60}, + {0x00F6, 58, 61}, + {0x00CB, 59, 62}, + {0x00AB, 61, 63}, + {0x008F, 61, 32}, + {0x5B12, 65 + 128, 65}, + {0x4D04, 80, 66}, + {0x412C, 81, 67}, + {0x37D8, 82, 68}, + {0x2FE8, 83, 69}, + {0x293C, 84, 70}, + {0x2379, 86, 71}, + {0x1EDF, 87, 72}, + {0x1AA9, 87, 73}, + {0x174E, 72, 74}, + {0x1424, 72, 75}, + {0x119C, 74, 76}, + {0x0F6B, 74, 77}, + {0x0D51, 75, 78}, + {0x0BB6, 77, 79}, + {0x0A40, 77, 48}, + {0x5832, 80 + 128, 81}, + {0x4D1C, 88, 82}, + {0x438E, 89, 83}, + {0x3BDD, 90, 84}, + {0x34EE, 91, 85}, + {0x2EAE, 92, 86}, + {0x299A, 93, 87}, + {0x2516, 86, 71}, + {0x5570, 88 + 128, 89}, + {0x4CA9, 95, 90}, + {0x44D9, 96, 91}, + {0x3E22, 97, 92}, + {0x3824, 99, 93}, + {0x32B4, 99, 94}, + {0x2E17, 93, 86}, + {0x56A8, 95 + 128, 96}, + {0x4F46, 101, 97}, + {0x47E5, 102, 98}, + {0x41CF, 103, 99}, + {0x3C3D, 104, 100}, + {0x375E, 99, 93}, + {0x5231, 105, 102}, + {0x4C0F, 106, 103}, + {0x4639, 107, 104}, + {0x415E, 103, 99}, + {0x5627, 105 + 128, 106}, + {0x50E7, 108, 107}, + {0x4B85, 109, 103}, + {0x5597, 110, 109}, + {0x504F, 111, 107}, + {0x5A10, 110 + 128, 111}, + {0x5522, 112, 109}, + {0x59EB, 112 + 128, 111} +}; + +static __inline__ void output_stuffed_byte(t81_t82_arith_encode_state_t *s, int byte) +{ + s->output_byte_handler(s->user_data, byte); + if (byte == T81_T82_ESC) + s->output_byte_handler(s->user_data, T81_T82_STUFF); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void byteout(t81_t82_arith_encode_state_t *s) +{ + uint32_t temp; + + /* T.30 figure 26 - BYTEOUT */ + temp = s->c >> 19; + if (temp > 0xFF) + { + if (s->buffer >= 0) + output_stuffed_byte(s, s->buffer + 1); + while (s->sc) + { + s->output_byte_handler(s->user_data, 0x00); + s->sc--; + } + s->buffer = temp & 0xFF; + } + else if (temp == 0xFF) + { + s->sc++; + } + else + { + if (s->buffer >= 0) + output_stuffed_byte(s, s->buffer); + while (s->sc) + { + output_stuffed_byte(s, T81_T82_ESC); + s->sc--; + } + s->buffer = temp; + } + s->c &= 0x7FFFF; + s->ct = 8; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void renorme(t81_t82_arith_encode_state_t *s) +{ + /* T.82 figure 25 - RENORME */ + do + { + s->a <<= 1; + s->c <<= 1; + s->ct--; + if (s->ct == 0) + byteout(s); + } + while (s->a < 0x8000); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t81_t82_arith_encode(t81_t82_arith_encode_state_t *s, int cx, int pix) +{ + uint32_t ss; + + /* T.82 figure 22 - ENCODE */ + ss = s->st[cx] & 0x7F; + if (((pix << 7) ^ s->st[cx]) & 0x80) + { + /* T.82 figure 23 - CODELPS */ + s->a -= prob[ss].lsz; + if (s->a >= prob[ss].lsz) + { + s->c += s->a; + s->a = prob[ss].lsz; + } + s->st[cx] = (s->st[cx] & 0x80) ^ prob[ss].nlps; + renorme(s); + } + else + { + /* T.82 figure 24 - CODEMPS */ + s->a -= prob[ss].lsz; + if (s->a < 0x8000) + { + if (s->a < prob[ss].lsz) + { + s->c += s->a; + s->a = prob[ss].lsz; + } + s->st[cx] = (s->st[cx] & 0x80) | prob[ss].nmps; + renorme(s); + } + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t81_t82_arith_encode_flush(t81_t82_arith_encode_state_t *s) +{ + uint32_t temp; + + /* T.82 figure 28 - FLUSH */ + /* T.82 figure 29 - CLEARBITS */ + temp = (s->c + s->a - 1) & 0xFFFF0000; + s->c = (temp < s->c) ? (temp + 0x8000) : temp; + /* T.82 figure 30 - FINALWRITES */ + s->c <<= s->ct; + if ((s->c > 0x7FFFFFF)) + { + if (s->buffer >= 0) + output_stuffed_byte(s, s->buffer + 1); + /* Only output 0x00 bytes if something non-0x00 will follow */ + if ((s->c & 0x7FFF800)) + { + while (s->sc) + { + output_stuffed_byte(s, 0x00); + s->sc--; + } + } + } + else + { + /* The next bit says s->buffer + 1 in T.82, but that makes no sense. It doesn't + agree with how we code things away from the flush condition, and it gives + answers which don't seem to match other JBIG coders. */ + if (s->buffer >= 0) + output_stuffed_byte(s, s->buffer); + while (s->sc) + { + output_stuffed_byte(s, 0xFF); + s->sc--; + } + } + /* Only output final bytes if they are not 0x00 */ + if ((s->c & 0x7FFF800)) + { + output_stuffed_byte(s, (s->c >> 19) & 0xFF); + if ((s->c & 0x7F800)) + output_stuffed_byte(s, (s->c >> 11) & 0xFF); + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t81_t82_arith_encode_restart(t81_t82_arith_encode_state_t *s, int reuse_st) +{ + /* T.82 figure 27 - INITENC */ + if (!reuse_st) + memset(s->st, 0, sizeof(s->st)); + s->c = 0; + s->a = 0x10000; + s->sc = 0; + s->ct = 11; + s->buffer = -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t81_t82_arith_encode_state_t *) t81_t82_arith_encode_init(t81_t82_arith_encode_state_t *s, + void (*output_byte_handler)(void *, int), + void *user_data) +{ + if (s == NULL) + { + if ((s = (t81_t82_arith_encode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + s->output_byte_handler = output_byte_handler; + s->user_data = user_data; + + t81_t82_arith_encode_restart(s, FALSE); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t81_t82_arith_encode_release(t81_t82_arith_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t81_t82_arith_encode_free(t81_t82_arith_encode_state_t *s) +{ + int ret; + + ret = t81_t82_arith_encode_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t81_t82_arith_decode(t81_t82_arith_decode_state_t *s, int cx) +{ + uint32_t ss; + int pix; + + /* T.82 figure 35 - RENORMD */ + while (s->a < 0x8000 || s->startup) + { + while (s->ct <= 8 && s->ct >= 0) + { + /* First we can move a new byte into s->c */ + if (s->pscd_ptr >= s->pscd_end) + return -1; + if (s->pscd_ptr[0] == T81_T82_ESC) + { + if (s->pscd_ptr + 1 >= s->pscd_end) + return -1; + if (s->pscd_ptr[1] == T81_T82_STUFF) + { + s->c |= (0xFF << (8 - s->ct)); + s->ct += 8; + s->pscd_ptr += 2; + } + else + { + /* Start padding with zero bytes */ + s->ct = -1; + if (s->nopadding) + { + /* Subsequent symbols might depend on zero padding */ + s->nopadding = FALSE; + return -2; + } + } + } + else + { + s->c |= (int32_t) *(s->pscd_ptr++) << (8 - s->ct); + s->ct += 8; + } + } + s->a <<= 1; + s->c <<= 1; + if (s->ct >= 0) + s->ct--; + if (s->a == 0x10000) + s->startup = FALSE; + } + + /* T.82 figure 32 - DECODE */ + ss = s->st[cx] & 0x7F; + if ((s->c >> 16) >= (s->a -= prob[ss].lsz)) + { + /* T.82 figure 33 - LPS_EXCHANGE */ + if (s->a < prob[ss].lsz) + { + s->c -= (s->a << 16); + s->a = prob[ss].lsz; + pix = s->st[cx] >> 7; + s->st[cx] = (s->st[cx] & 0x80) | prob[ss].nmps; + } + else + { + s->c -= (s->a << 16); + s->a = prob[ss].lsz; + pix = 1 - (s->st[cx] >> 7); + s->st[cx] = (s->st[cx]& 0x80) ^ prob[ss].nlps; + } + } + else + { + if (s->a < 0x8000) + { + /* T.82 figure 34 - MPS_EXCHANGE */ + if (s->a < prob[ss].lsz) + { + pix = 1 - (s->st[cx] >> 7); + s->st[cx] = (s->st[cx] & 0x80) ^ prob[ss].nlps; + } + else + { + pix = s->st[cx] >> 7; + s->st[cx] = (s->st[cx] & 0x80) | prob[ss].nmps; + } + } + else + { + pix = s->st[cx] >> 7; + } + } + + return pix; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t81_t82_arith_decode_restart(t81_t82_arith_decode_state_t *s, int reuse_st) +{ + if (!reuse_st) + memset(s->st, 0, sizeof(s->st)); + s->c = 0; + s->a = 1; + s->ct = 0; + s->startup = TRUE; + s->nopadding = FALSE; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t81_t82_arith_decode_state_t *) t81_t82_arith_decode_init(t81_t82_arith_decode_state_t *s) +{ + if (s == NULL) + { + if ((s = (t81_t82_arith_decode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + t81_t82_arith_decode_restart(s, FALSE); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t81_t82_arith_decode_release(t81_t82_arith_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t81_t82_arith_decode_free(t81_t82_arith_decode_state_t *s) +{ + int ret; + + ret = t81_t82_arith_decode_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t85_decode.c b/libs/spandsp/src/t85_decode.c new file mode 100644 index 0000000000..ff348a5fda --- /dev/null +++ b/libs/spandsp/src/t85_decode.c @@ -0,0 +1,864 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t85_decode.c - ITU T.85 JBIG for FAX image decompression + * + * Written by Steve Underwood + * + * Copyright (C) 2009, 2010 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/async.h" +#include "spandsp/timezone.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" + +#define FALSE 0 +#define TRUE (!FALSE) + +static __inline__ int32_t pack_32(uint8_t *s) +{ + int32_t value; + + value = (((int32_t) s[0] << 24) | ((int32_t) s[1] << 16) | ((int32_t) s[2] << 8) | (int32_t) s[3]); + return value; +} +/*- End of function --------------------------------------------------------*/ + +/* Decode some PSCD bytes, output the decoded rows as they are completed. Return + the number of bytes which have actually been read. This will be less than len + if a marker segment was part of the data or if the final byte was 0xFF, meaning + that this code can not determine whether we have a marker segment. */ +static size_t decode_pscd(t85_decode_state_t *s, const uint8_t data[], size_t len) +{ + uint8_t *hp[3]; + int32_t o; + int cx; + int i; + int pix; + int slntp; + int buffered_rows; + + buffered_rows = (s->options & T85_LRLTWO) ? 2 : 3; + /* Forward data to the arithmetic decoder */ + s->s.pscd_ptr = data; + s->s.pscd_end = data + len; + + for (s->interrupt = FALSE; s->i < s->l0 && s->y < s->yd && !s->interrupt; s->i++, s->y++) + { + /* Point to the current image bytes */ + for (i = 0; i < 3; i++) + hp[i] = s->row_buf + s->p[i]*s->bytes_per_row + (s->x >> 3); + + /* Adaptive template changes */ + if (s->x == 0 && s->pseudo) + { + for (i = 0; i < s->at_moves; i++) + { + if (s->at_row[i] == s->i) + s->tx = s->at_tx[i]; + } + } + + /* Typical prediction */ + if ((s->options & T85_TPBON) && s->pseudo) + { + slntp = t81_t82_arith_decode(&s->s, (s->options & T85_LRLTWO) ? TPB2CX : TPB3CX); + if (slntp < 0) + return s->s.pscd_ptr - data; + s->lntp = !(slntp ^ s->lntp); + if (!s->lntp) + { + /* This row is 'typical' (i.e. identical to the previous one) */ + if (s->p[1] < 0) + { + /* First row of page or (following SDRST) of stripe */ + for (i = 0; i < s->bytes_per_row; i++) + hp[0][i] = 0; + s->interrupt = s->row_write_handler(s->row_write_user_data, hp[0], s->bytes_per_row); + /* Rotate the ring buffer that holds the last few rows */ + s->p[2] = s->p[1]; + s->p[1] = s->p[0]; + if (++(s->p[0]) >= buffered_rows) + s->p[0] = 0; + } + else + { + s->interrupt = s->row_write_handler(s->row_write_user_data, hp[1], s->bytes_per_row); + /* Duplicate the last row in the ring buffer */ + s->p[2] = s->p[1]; + } + continue; + } + /* This row is 'not typical' and has to be coded completely */ + } + s->pseudo = FALSE; + + if (s->x == 0) + { + s->row_h[0] = 0; + s->row_h[1] = (s->p[1] >= 0) ? ((int32_t) hp[1][0] << 8) : 0; + s->row_h[2] = (s->p[2] >= 0) ? ((int32_t) hp[2][0] << 8) : 0; + } + + /* Decode row */ + while (s->x < s->xd) + { + if ((s->x & 7) == 0) + { + if (s->x < (s->bytes_per_row - 1)*8 && s->p[1] >= 0) + { + s->row_h[1] |= hp[1][1]; + if (s->p[2] >= 0) + s->row_h[2] |= hp[2][1]; + } + } + if ((s->options & T85_LRLTWO)) + { + /* Two row template */ + do + { + cx = (s->row_h[0] & 0x00F); + if (s->tx) + { + cx |= ((s->row_h[1] >> 9) & 0x3E0); + if (s->x >= (uint32_t) s->tx) + { + if (s->tx < 8) + { + cx |= ((s->row_h[0] >> (s->tx - 5)) & 0x010); + } + else + { + o = (s->x - s->tx) - (s->x & ~7); + cx |= (((hp[0][o >> 3] >> (7 - (o & 7))) & 1) << 4); + } + } + } + else + { + cx |= ((s->row_h[1] >> 9) & 0x3F0); + } + pix = t81_t82_arith_decode(&s->s, cx); + if (pix < 0) + return s->s.pscd_ptr - data; + s->row_h[0] = (s->row_h[0] << 1) | pix; + s->row_h[1] <<= 1; + } + while ((++s->x & 7) && s->x < s->xd); + } + else + { + /* Three row template */ + do + { + cx = ((s->row_h[2] >> 7) & 0x380) | (s->row_h[0] & 0x003); + if (s->tx) + { + cx |= ((s->row_h[1] >> 11) & 0x078); + if (s->x >= (uint32_t) s->tx) + { + if (s->tx < 8) + { + cx |= ((s->row_h[0] >> (s->tx - 3)) & 0x004); + } + else + { + o = (s->x - s->tx) - (s->x & ~7); + cx |= (((hp[0][o >> 3] >> (7 - (o & 7))) & 1) << 2); + } + } + } + else + { + cx |= ((s->row_h[1] >> 11) & 0x07C); + } + pix = t81_t82_arith_decode(&s->s, cx); + if (pix < 0) + return s->s.pscd_ptr - data; + s->row_h[0] = (s->row_h[0] << 1) | pix; + s->row_h[1] <<= 1; + s->row_h[2] <<= 1; + } + while ((++s->x & 7) && s->x < s->xd); + } + *hp[0]++ = s->row_h[0]; + hp[1]++; + hp[2]++; + } + *(hp[0] - 1) <<= (s->bytes_per_row*8 - s->xd); + s->interrupt = s->row_write_handler(s->row_write_user_data, &s->row_buf[s->p[0]*s->bytes_per_row], s->bytes_per_row); + s->x = 0; + s->pseudo = TRUE; + /* Shuffle the row buffers */ + s->p[2] = s->p[1]; + s->p[1] = s->p[0]; + if (++(s->p[0]) >= buffered_rows) + s->p[0] = 0; + } + return s->s.pscd_ptr - data; +} +/*- End of function --------------------------------------------------------*/ + +static int finish_sde(t85_decode_state_t *s) +{ + /* Decode final pixels based on trailing zero bytes */ + s->s.nopadding = FALSE; + if (decode_pscd(s, s->buffer, 2) != 2 && s->interrupt) + return 1; + + /* Prepare decoder for next SDE */ + t81_t82_arith_decode_restart(&s->s, s->buffer[1] == T82_SDNORM); + s->s.nopadding = s->options & T85_VLENGTH; + + s->x = 0; + s->i = 0; + s->pseudo = TRUE; + s->at_moves = 0; + if (s->buffer[1] == T82_SDRST) + { + s->tx = 0; + s->lntp = TRUE; + s->p[0] = 0; + s->p[1] = -1; + s->p[2] = -1; + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int check_bih(t85_decode_state_t *s) +{ + /* Check that the fixed parameters have the values they are expected to be + fixed at - see T.85/Table 1 */ + /* DL - Initial layer to be transmitted */ + /* D - Number of differential layers */ + /* Unspecified byte */ + /* MY - Maximum vertical offset allowed for AT pixel */ + /* Order byte */ + if (s->buffer[0] != 0 + || + s->buffer[1] != 0 + || + s->buffer[3] != 0 + || + s->buffer[17] != 0 + || +#if T85_STRICT_ORDER_BITS + s->buffer[18] != 0) +#else + (s->buffer[18] & 0xF0) != 0) +#endif + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Fixed bytes do not contain expected values.\n"); + return T85_INVALID_DATA; + } + /* P - Number of bit planes */ + if (s->buffer[2] < s->min_bit_planes || s->buffer[2] > s->max_bit_planes) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. %d bit planes. Should be %d to %d.\n", s->buffer[2], s->min_bit_planes, s->max_bit_planes); + return T85_INVALID_DATA; + } + s->bit_planes = s->buffer[2]; + s->current_bit_plane = 0; + /* Now look at the stuff which actually counts in a T.85 header. */ + /* XD - Horizontal image size at layer D */ + s->xd = pack_32(&s->buffer[4]); + if (s->xd == 0 || (s->max_xd && s->xd > s->max_xd)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Width is %" PRIu32 "\n", s->xd); + return T85_INVALID_DATA; + } + /* YD - Vertical image size at layer D */ + s->yd = pack_32(&s->buffer[8]); + if (s->yd == 0 || (s->max_yd && s->yd > s->max_yd)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Length is %" PRIu32 "\n", s->yd); + return T85_INVALID_DATA; + } + /* L0 - Rows per stripe, at the lowest resolution */ + s->l0 = pack_32(&s->buffer[12]); + if (s->l0 == 0) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. L0 is %" PRIu32 "\n", s->l0); + return T85_INVALID_DATA; + } + /* MX - Maximum horizontal offset allowed for AT pixel */ + s->mx = s->buffer[16]; + if (s->mx > 127) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. MX is %d\n", s->mx); + return T85_INVALID_DATA; + } + /* Options byte */ + s->options = s->buffer[19]; + if ((s->options & 0x97)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Options are 0x%X\n", s->options); + return T85_INVALID_DATA; + } + span_log(&s->logging, SPAN_LOG_FLOW, "BIH is OK. Image is %" PRIu32 "x%" PRIu32 " pixels\n", s->xd, s->yd); + return T85_OK; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t85_decode_rx_status(t85_decode_state_t *s, int status) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Signal status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + case SIG_STATUS_TRAINING_FAILED: + case SIG_STATUS_TRAINING_SUCCEEDED: + case SIG_STATUS_CARRIER_UP: + /* Ignore these */ + break; + case SIG_STATUS_CARRIER_DOWN: + case SIG_STATUS_END_OF_DATA: + /* Finalise the image */ + s->end_of_data = 1; + t85_decode_put_chunk(s, NULL, 0); + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_put_byte(t85_decode_state_t *s, int byte) +{ + uint8_t data[1]; + + if (byte < 0) + { + t85_decode_rx_status(s, byte); + return (s->y >= s->yd) ? T85_OK : T85_MORE_DATA; + } + data[0] = byte; + return t85_decode_put_chunk(s, data, 1); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, + const uint8_t data[], + size_t len) +{ + int ret; + uint32_t y; + uint8_t *buf; + size_t bytes_per_row; + size_t min_len; + size_t chunk; + size_t cnt; + int i; + + s->compressed_image_size += len; + cnt = 0; + + if (s->bie_len < 20) + { + /* Read in the 20-byte BIH */ + i = (s->bie_len + len > 20) ? (20 - s->bie_len) : len; + memcpy(&s->buffer[s->bie_len], data, i); + s->bie_len += i; + cnt = i; + if (s->bie_len < 20) + return T85_MORE_DATA; + if ((ret = check_bih(s)) != T85_OK) + return ret; + /* Set up the two/three row buffer */ + bytes_per_row = (s->xd + 7) >> 3; + min_len = ((s->options & T85_LRLTWO) ? 2 : 3)*bytes_per_row; + if (min_len > s->row_buf_len) + { + /* We need to expand the 3 row buffer */ + if ((buf = (uint8_t *) realloc(s->row_buf, min_len)) == NULL) + return T85_NOMEM; + s->row_buf = buf; + s->row_buf_len = min_len; + } + + t81_t82_arith_decode_init(&s->s); + s->s.nopadding = s->options & T85_VLENGTH; + if (s->comment) + { + free(s->comment); + s->comment = NULL; + } + s->comment_len = 0; + s->comment_progress = 0; + s->buf_len = 0; + s->buf_needed = 2; + s->x = 0; + s->y = 0; + s->i = 0; + s->pseudo = TRUE; + s->at_moves = 0; + s->tx = 0; + s->lntp = TRUE; + s->bytes_per_row = bytes_per_row; + s->p[0] = 0; + s->p[1] = -1; + s->p[2] = -1; + } + + /* BID processing loop */ + while (cnt < len || s->end_of_data == 1) + { + if (s->end_of_data == 1) + { + s->buf_needed = 2; + s->options &= ~T85_VLENGTH; + s->end_of_data = 2; + } + if (s->comment_len) + { + /* We are in a COMMENT. Absorb its contents */ + chunk = len - cnt; + if ((s->comment_progress + chunk) >= s->comment_len) + { + /* Finished */ + chunk = s->comment_len - s->comment_progress; + /* If the comment was too long to be passed to the handler, we still + call the handler with the buffer set to NULL, so it knows a large + comment has occurred. */ + if (s->comment) + memcpy(&s->comment[s->comment_progress], &data[cnt], chunk); + if (s->comment_handler) + s->interrupt = s->comment_handler(s->comment_user_data, s->comment, s->comment_len); + if (s->comment) + { + free(s->comment); + s->comment = NULL; + } + s->comment_len = 0; + s->comment_progress = 0; + } + else + { + if (s->comment) + memcpy(&s->comment[s->comment_progress], &data[cnt], chunk); + s->comment_progress += chunk; + } + cnt += chunk; + continue; + } + + /* Load marker segments into s->buffer for processing */ + if (s->buf_len > 0) + { + /* We are in a marker of some kind. Load the first 2 bytes of + the marker, so we can determine its type, and hence its full + length. */ + while (s->buf_len < s->buf_needed && cnt < len) + s->buffer[s->buf_len++] = data[cnt++]; + /* Check we have enough bytes to see the message type */ + if (s->buf_len < s->buf_needed) + continue; + switch (s->buffer[1]) + { + case T82_STUFF: + /* Forward stuffed 0xFF to arithmetic decoder. This is likely to be + the commonest thing for us to hit here. */ + decode_pscd(s, s->buffer, 2); + s->buf_len = 0; + + if (s->interrupt) + return T85_INTERRUPT; + break; + case T82_ABORT: + s->buf_len = 0; + return T85_ABORTED; + case T82_COMMENT: + s->buf_needed = 6; + if (s->buf_len < 6) + continue; + s->buf_needed = 2; + s->buf_len = 0; + + s->comment_len = pack_32(&s->buffer[2]); + /* Only try to buffer and process the comment's contents if we have + a defined callback routine to do something with it. */ + /* If this malloc fails we carry on working just fine, and don't try to + process the contents of the comment. That is fairly benign, as + the comments are not generally of critical importance, so let's + not worry. */ + if (s->comment_handler && s->comment_len > 0 && s->comment_len <= s->max_comment_len) + s->comment = malloc(s->comment_len); + s->comment_progress = 0; + continue; + case T82_ATMOVE: + s->buf_needed = 8; + if (s->buf_len < 8) + continue; + s->buf_needed = 2; + s->buf_len = 0; + + if (s->at_moves >= T85_ATMOVES_MAX) + return T85_INVALID_DATA; + s->at_row[s->at_moves] = pack_32(&s->buffer[2]); + s->at_tx[s->at_moves] = s->buffer[6]; + if (s->at_tx[s->at_moves] > s->mx + || + (s->at_tx[s->at_moves] > 0 && s->at_tx[s->at_moves] < ((s->options & T85_LRLTWO) ? 5 : 3)) + || + s->buffer[7] != 0) + { + return T85_INVALID_DATA; + } + s->at_moves++; + break; + case T82_NEWLEN: + s->buf_needed = 6; + if (s->buf_len < 6) + continue; + s->buf_needed = 2; + s->buf_len = 0; + + if (!(s->options & T85_VLENGTH)) + return T85_INVALID_DATA; + s->options &= ~T85_VLENGTH; + y = pack_32(&s->buffer[2]); + /* An update to the image length is not allowed to stretch it. */ + if (y > s->yd) + return T85_INVALID_DATA; + s->yd = y; + break; + case T82_SDNORM: + case T82_SDRST: + if (!(s->options & T85_VLENGTH)) + { + /* A plain SDNORM or SDRST with no peek ahead required */ + s->buf_len = 0; + if (finish_sde(s)) + return T85_INTERRUPT; + /* Check whether this was the last SDE */ + if (s->y >= s->yd) + { + s->compressed_image_size -= (len - cnt); + return T85_OK; + } + break; + } + /* This is the messy case. We need to peek ahead, as this element + might be immediately followed by a T82_NEWLEN which affects the + limit of what we decode here. */ + if (s->buf_needed < 3) + s->buf_needed = 3; + if (s->buf_len < 3) + continue; + /* Peek ahead to see whether a NEWLEN marker segment follows */ + if (s->buffer[2] != T82_ESC) + { + /* This is not an escape sequence, so push the single peek-ahead + byte back into the buffer. We should always have just grabbed + at least one byte, so this should be safe. */ + s->buf_needed = 2; + s->buf_len = 0; + cnt--; + /* Process the T82_SDNORM or T82_SDRST */ + if (finish_sde(s)) + return T85_INTERRUPT; + /* Check whether this was the last SDE */ + if (s->y >= s->yd) + { + s->compressed_image_size -= (len - cnt); + return T85_OK; + } + break; + } + if (s->buf_needed < 4) + s->buf_needed = 4; + if (s->buf_len < 4) + continue; + if (s->buffer[3] != T82_NEWLEN) + { + s->buf_needed = 2; + + /* Process the T82_SDNORM or T82_SDRST */ + if (finish_sde(s)) + return T85_INTERRUPT; + /* Check whether this was the last SDE */ + if (s->y >= s->yd) + { + s->compressed_image_size -= (len - cnt); + return T85_OK; + } + /* Recycle the two peek-ahead marker sequence bytes to + be processed later. */ + s->buffer[0] = s->buffer[2]; + s->buffer[1] = s->buffer[3]; + s->buf_len = 2; + break; + } + if (s->buf_needed < 8) + s->buf_needed = 8; + if (s->buf_len < 8) + continue; + s->buf_needed = 2; + s->buf_len = 0; + /* We must have a complete T82_NEWLEN to be here, which we need + to process immediately. */ + s->options &= ~T85_VLENGTH; + y = pack_32(&s->buffer[4]); + /* An update to the image length is not allowed to stretch it. */ + if (y > s->yd) + return T85_INVALID_DATA; + /* Things look OK, so accept this new length, and proceed. */ + s->yd = y; + /* Now process the T82_SDNORM or T82_SDRST */ + if (finish_sde(s)) + return T85_INTERRUPT; + /* We might be at the end of the image now, but even if we are + there should still be a final training T82_SDNORM or T82_SDRST + that we should pick up. When we do, we won't wait for further + T82_NEWLEN entries, so we should stop crisply on the last byte + of the image. */ + break; + default: + s->buf_len = 0; + return T85_INVALID_DATA; + } + } + else if (cnt < len && data[cnt] == T82_ESC) + { + s->buffer[s->buf_len++] = data[cnt++]; + } + else + { + /* We have found PSCD bytes */ + cnt += decode_pscd(s, data + cnt, len - cnt); + if (s->interrupt) + return T85_INTERRUPT; + /* We should only have stopped processing PSCD if + we ran out of data, or hit a T82_ESC */ + if (cnt < len && data[cnt] != T82_ESC) + return T85_INVALID_DATA; + } + } + + return T85_MORE_DATA; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_set_row_write_handler(t85_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data) +{ + s->row_write_handler = handler; + s->row_write_user_data = user_data; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_set_comment_handler(t85_decode_state_t *s, + uint32_t max_comment_len, + t4_row_write_handler_t handler, + void *user_data) +{ + s->max_comment_len = max_comment_len; + s->comment_handler = handler; + s->comment_user_data = user_data; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_set_image_size_constraints(t85_decode_state_t *s, + uint32_t max_xd, + uint32_t max_yd) +{ + s->max_xd = max_xd; + s->max_yd = max_yd; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t85_decode_get_image_width(t85_decode_state_t *s) +{ + return s->xd; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t85_decode_get_image_length(t85_decode_state_t *s) +{ + return s->yd; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_get_compressed_image_size(t85_decode_state_t *s) +{ + return s->compressed_image_size*8; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_new_plane(t85_decode_state_t *s) +{ + if (s->current_bit_plane >= s->bit_planes - 1) + return -1; + + s->current_bit_plane++; + s->tx = 0; + memset(s->buffer, 0, sizeof(s->buffer)); + s->buf_len = 0; + s->buf_needed = 0; + s->at_moves = 0; + memset(s->at_row, 0, sizeof(s->at_row)); + memset(s->at_tx, 0, sizeof(s->at_tx)); + memset(s->row_h, 0, sizeof(s->row_h)); + s->pseudo = FALSE; + s->lntp = FALSE; + s->interrupt = FALSE; + s->end_of_data = 0; + if (s->comment) + { + free(s->comment); + s->comment = NULL; + } + s->comment_len = 0; + s->comment_progress = 0; + s->compressed_image_size = 0; + + t81_t82_arith_decode_restart(&s->s, FALSE); + s->s.nopadding = s->options & T85_VLENGTH; + + s->buf_len = 0; + s->buf_needed = 2; + s->x = 0; + s->y = 0; + s->i = 0; + s->pseudo = TRUE; + s->at_moves = 0; + s->tx = 0; + s->lntp = TRUE; + s->p[0] = 0; + s->p[1] = -1; + s->p[2] = -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_restart(t85_decode_state_t *s) +{ + s->xd = 0; + s->yd = 0; + s->l0 = 0; + s->mx = 0; + s->bytes_per_row = 0; + s->tx = 0; + s->bie_len = 0; + memset(s->buffer, 0, sizeof(s->buffer)); + s->buf_len = 0; + s->buf_needed = 0; + s->at_moves = 0; + memset(s->at_row, 0, sizeof(s->at_row)); + memset(s->at_tx, 0, sizeof(s->at_tx)); + memset(s->row_h, 0, sizeof(s->row_h)); + s->pseudo = FALSE; + s->lntp = FALSE; + s->interrupt = FALSE; + s->end_of_data = 0; + if (s->comment) + { + free(s->comment); + s->comment = NULL; + } + s->comment_len = 0; + s->comment_progress = 0; + s->compressed_image_size = 0; + + t81_t82_arith_decode_restart(&s->s, FALSE); + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t85_decode_state_t *) t85_decode_init(t85_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (t85_decode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.85"); + + s->row_write_handler = handler; + s->row_write_user_data = user_data; + + s->min_bit_planes = 1; + s->max_bit_planes = 1; + + s->max_xd = 0; + s->max_yd = 0; + + t81_t82_arith_decode_init(&s->s); + t85_decode_restart(s); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_release(t85_decode_state_t *s) +{ + if (s->row_buf) + { + free(s->row_buf); + s->row_buf = NULL; + } + if (s->comment) + { + free(s->comment); + s->comment = NULL; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_decode_free(t85_decode_state_t *s) +{ + int ret; + + ret = t85_decode_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t85_encode.c b/libs/spandsp/src/t85_encode.c new file mode 100644 index 0000000000..6bcb3441f5 --- /dev/null +++ b/libs/spandsp/src/t85_encode.c @@ -0,0 +1,747 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t85_encode.c - ITU T.85 JBIG for FAX image compression + * + * Written by Steve Underwood + * + * Copyright (C) 2009, 2010 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/timezone.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" + +/* Image length update status */ +enum +{ + NEWLEN_NONE = 0, + NEWLEN_PENDING = 1, + NEWLEN_HANDLED = 2 +}; + +static __inline__ void unpack_32(uint8_t *s, int32_t value) +{ + s[3] = value & 0xFF; + value >>= 8; + s[2] = value & 0xFF; + value >>= 8; + s[1] = value & 0xFF; + value >>= 8; + s[0] = value & 0xFF; +} +/*- End of function --------------------------------------------------------*/ + +static void put_stuff(t85_encode_state_t *s, const uint8_t buf[], int len) +{ + uint8_t *new_buf; + uint32_t bytes_per_row; + + if (s->bitstream_iptr + len >= s->bitstream_len) + { + /* TODO: Handle memory allocation errors properly */ + /* The number of uncompressed bytes per row seems like a reasonable measure + of what to expect as a poor case for a compressed row. */ + bytes_per_row = (s->xd + 7) >> 3; + if ((new_buf = realloc(s->bitstream, s->bitstream_len + len + bytes_per_row)) == NULL) + return; + s->bitstream = new_buf; + s->bitstream_len += (len + bytes_per_row); + } + memcpy(&s->bitstream[s->bitstream_iptr], buf, len); + s->bitstream_iptr += len; + s->compressed_image_size += len; +} +/*- End of function --------------------------------------------------------*/ + +/* Callback function for the arithmetic encoder */ +static void output_byte(void *user_data, int byte) +{ + t85_encode_state_t *s; + uint8_t c = byte; + + s = (t85_encode_state_t *) user_data; + c = (uint8_t) byte; + put_stuff(s, &c, 1); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void output_esc_code(t85_encode_state_t *s, int code) +{ + uint8_t buf[2]; + + buf[0] = T82_ESC; + buf[1] = code; + put_stuff(s, buf, 2); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void output_newlen(t85_encode_state_t *s) +{ + uint8_t buf[6]; + + if (s->newlen == NEWLEN_PENDING) + { + buf[0] = T82_ESC; + buf[1] = T82_NEWLEN; + unpack_32(&buf[2], s->yd); + put_stuff(s, buf, 6); + if (s->y == s->yd) + { + /* See T.82/6.2.6.2 */ + output_esc_code(s, T82_SDNORM); + } + s->newlen = NEWLEN_HANDLED; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void output_comment(t85_encode_state_t *s) +{ + uint8_t buf[6]; + + if (s->comment) + { + buf[0] = T82_ESC; + buf[1] = T82_COMMENT; + unpack_32(&buf[2], s->comment_len); + put_stuff(s, buf, 6); + put_stuff(s, s->comment, s->comment_len); + s->comment = NULL; + s->comment_len = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void output_atmove(t85_encode_state_t *s) +{ + uint8_t buf[8]; + + if (s->new_tx >= 0 && s->new_tx != s->tx) + { + s->tx = s->new_tx; + buf[0] = T82_ESC; + buf[1] = T82_ATMOVE; + unpack_32(&buf[2], 0); + buf[6] = s->tx; + buf[7] = 0; + put_stuff(s, buf, 8); + } +} +/*- End of function --------------------------------------------------------*/ + +static void generate_bih(t85_encode_state_t *s, uint8_t *buf) +{ + /* DL - Initial layer to be transmitted */ + buf[0] = 0; + /* D - Number of differential layers */ + buf[1] = 0; + /* P - Number of bit planes */ + buf[2] = s->bit_planes; + /* Unspecified */ + buf[3] = 0; + /* XD - Horizontal image size at layer D */ + unpack_32(&buf[4], s->xd); + /* YD - Vertical image size at layer D */ + unpack_32(&buf[8], s->yd); + /* L0 - Rows per stripe, at the lowest resolution */ + unpack_32(&buf[12], s->l0); + /* MX - Maximum horizontal offset allowed for AT pixel */ + buf[16] = s->mx; + /* MY - Maximum vertical offset allowed for AT pixel */ + buf[17] = 0; + /* Order byte: */ + /* 4 unused bits */ + /* HITOLO - transmission order of differential layers */ + /* SEQ - indication of progressive-compatible sequential coding */ + /* ILEAVE - interleaved transmission order of multiple bit plane */ + /* SMID - transmission order of stripes */ + /* Note that none of these are relevant to T.85 */ + buf[18] = 0; + /* Options byte: */ + /* 1 unused bit */ + /* LRLTWO - number of reference rows */ + /* VLENGTH - indication of possible use of NEWLEN marker segment */ + /* TPDON - use of TP for Typical Prediction for differential layers */ + /* TPBON - use of TP for base layer */ + /* DPON - use of Deterministic Prediction */ + /* DPPRIV - use of private DP table */ + /* DPLAST - use of last DP table */ + /* Note that only T85_TPBON, T85_VLENGTH, and T85_LRLTWO are relevant to T.85 */ + buf[19] = s->options; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t85_encode_set_options(t85_encode_state_t *s, + uint32_t l0, + int mx, + int options) +{ + if (s->y > 0) + return; + + /* Its still OK to change things */ + if (l0 >= 1 && l0 <= s->yd) + s->l0 = l0; + if (mx >= 0 && mx <= 127) + s->mx = mx; + if (options >= 0) + s->options = options & (T85_TPBON | T85_VLENGTH | T85_LRLTWO); +} +/*- End of function --------------------------------------------------------*/ + +static int get_next_row(t85_encode_state_t *s) +{ + uint8_t buf[20]; + uint32_t bytes_per_row; + const uint8_t *hp[3]; + uint8_t *z; + uint32_t row_h[3]; + uint32_t j; + int32_t o; + uint32_t a; + uint32_t p; + uint32_t t; + uint32_t c_min; + uint32_t c_max; + uint32_t cl_min; + uint32_t cl_max; + int ltp; + int cx; + int t_max; + int i; + + if (s->y >= s->yd) + { + /* We have already finished pumping out the image */ + return -1; + } + + s->bitstream_iptr = 0; + s->bitstream_optr = 0; + bytes_per_row = (s->xd + 7) >> 3; + /* Rotate the three rows which we buffer */ + z = s->prev_row[2]; + s->prev_row[2] = s->prev_row[1]; + s->prev_row[1] = s->prev_row[0]; + s->prev_row[0] = z; + + /* Copy the new row to our buffer, and ensure the last byte of the row is + zero padded. The need to tweak this is actually the only reason for + storing a third row. We do not want to tamper with the source buffer. */ + if (s->fill_with_white) + { + memset(s->prev_row[0], 0, bytes_per_row); + } + else + { + if (s->row_read_handler(s->row_read_user_data, s->prev_row[0], bytes_per_row) <= 0) + { + /* The source has stopped feeding us rows early. Try to clip the image + to the current size. */ + if (t85_encode_set_image_length(s, 1) == 0) + return 0; + /* We can't clip the image to the current length. We will have to + continue up to the original length with blank (all white) rows. */ + s->fill_with_white = TRUE; + memset(s->prev_row[0], 0, bytes_per_row); + } + } + if ((s->xd & 7)) + s->prev_row[0][bytes_per_row - 1] &= ~((1 << (8 - (s->xd & 7))) - 1); + + if (s->current_bit_plane == 0 && s->y == 0) + { + /* Things that need to be done before the first row is encoded */ + generate_bih(s, buf); + put_stuff(s, buf, 20); + } + + if (s->i == 0) + { + /* Things that need to be done before the next SDE is encoded */ + output_newlen(s); + output_comment(s); + output_atmove(s); + if (s->mx == 0) + { + /* Disable ATMOVE analysis */ + s->new_tx = 0; + } + else + { + /* Enable ATMOVE analysis */ + s->new_tx = -1; + s->c_all = 0; + for (i = 0; i <= s->mx; i++) + s->c[i] = 0; + } + t81_t82_arith_encode_restart(&s->s, TRUE); + } + + /* Typical prediction */ + ltp = FALSE; + if ((s->options & T85_TPBON)) + { + /* Look for a match between the rows */ + ltp = (memcmp(s->prev_row[0], s->prev_row[1], bytes_per_row) == 0); + t81_t82_arith_encode(&s->s, + (s->options & T85_LRLTWO) ? TPB2CX : TPB3CX, + (ltp == s->prev_ltp)); + s->prev_ltp = ltp; + } + + if (!ltp) + { + /* Pointer to the first image byte in each the three rows of interest */ + hp[0] = s->prev_row[0]; + hp[1] = s->prev_row[1]; + hp[2] = s->prev_row[2]; + + row_h[0] = 0; + row_h[1] = (uint32_t) hp[1][0] << 8; + row_h[2] = (uint32_t) hp[2][0] << 8; + + /* Encode row */ + for (j = 0; j < s->xd; ) + { + row_h[0] |= hp[0][0]; + if (j < (bytes_per_row - 1)*8) + { + row_h[1] |= hp[1][1]; + row_h[2] |= hp[2][1]; + } + if ((s->options & T85_LRLTWO)) + { + /* Two row template */ + do + { + row_h[0] <<= 1; + row_h[1] <<= 1; + row_h[2] <<= 1; + cx = (row_h[0] >> 9) & 0x00F; + if (s->tx) + { + cx |= ((row_h[1] >> 10) & 0x3E0); + if (j >= (uint32_t) s->tx) + { + o = (j - s->tx) - (j & ~7); + cx |= (((hp[0][o >> 3] >> (7 - (o & 7))) & 1) << 4); + } + } + else + { + cx |= ((row_h[1] >> 10) & 0x3F0); + } + p = (row_h[0] >> 8) & 1; + t81_t82_arith_encode(&s->s, cx, p); + + /* Update the statistics for adaptive template changes, + if this analysis is in progress. */ + if (s->new_tx < 0 && j >= s->mx && j < s->xd - 2) + { + if (p == ((row_h[1] >> 14) & 1)) + s->c[0]++; + for (t = 5; t <= s->mx && t <= j; t++) + { + o = (j - t) - (j & ~7); + a = (hp[0][o >> 3] >> (7 - (o & 7))) & 1; + if (a == p) + s->c[t]++; + } + if (p == 0) + { + for ( ; t <= s->mx; t++) + s->c[t]++; + } + ++s->c_all; + } + } + while ((++j & 7) && j < s->xd); + } + else + { + /* Three row template */ + do + { + row_h[0] <<= 1; + row_h[1] <<= 1; + row_h[2] <<= 1; + cx = ((row_h[2] >> 8) & 0x380) | ((row_h[0] >> 9) & 0x003); + if (s->tx) + { + cx |= ((row_h[1] >> 12) & 0x078); + if (j >= (uint32_t) s->tx) + { + o = (j - s->tx) - (j & ~7); + cx |= (((hp[0][o >> 3] >> (7 - (o & 7))) & 1) << 2); + } + } + else + { + cx |= ((row_h[1] >> 12) & 0x07C); + } + p = (row_h[0] >> 8) & 1; + t81_t82_arith_encode(&s->s, cx, p); + + /* Update the statistics for adaptive template changes, + if this analysis is in progress. */ + if (s->new_tx < 0 && j >= s->mx && j < s->xd - 2) + { + if (p == ((row_h[1] >> 14) & 1)) + s->c[0]++; + for (t = 3; t <= s->mx && t <= j; t++) + { + o = (j - t) - (j & ~7); + a = (hp[0][o >> 3] >> (7 - (o & 7))) & 1; + if (a == p) + s->c[t]++; + } + if (p == 0) + { + for ( ; t <= s->mx; t++) + s->c[t]++; + } + ++s->c_all; + } + } + while ((++j & 7) && j < s->xd); + } + hp[0]++; + hp[1]++; + hp[2]++; + } + } + + s->i++; + s->y++; + if (s->i == s->l0 || s->y == s->yd) + { + /* We are at the end of the stripe */ + t81_t82_arith_encode_flush(&s->s); + output_esc_code(s, T82_SDNORM); + s->i = 0; + output_newlen(s); + } + + /* T.82/Annex C - is it time for an adaptive template change? */ + if (s->new_tx < 0 && s->c_all > 2048) + { + c_min = + cl_min = UINT32_MAX; + c_max = + cl_max = 0; + t_max = 0; + for (i = (s->options & T85_LRLTWO) ? 5 : 3; i <= s->mx; i++) + { + if (s->c[i] > c_max) + c_max = s->c[i]; + if (s->c[i] < c_min) + c_min = s->c[i]; + if (s->c[i] > s->c[t_max]) + t_max = i; + } + cl_min = (s->c[0] < c_min) ? s->c[0] : c_min; + cl_max = (s->c[0] > c_max) ? s->c[0] : c_max; + /* This test is straight from T.82/Figure C.2 */ + if ((s->c_all - c_max) < (s->c_all >> 3) + && + (c_max - s->c[s->tx]) > (s->c_all - c_max) + && + (c_max - s->c[s->tx]) > (s->c_all >> 4) + && + (c_max - (s->c_all - s->c[s->tx])) > (s->c_all - c_max) + && + (c_max - (s->c_all - s->c[s->tx])) > (s->c_all >> 4) + && + (c_max - c_min) > (s->c_all >> 2) + && + (s->tx || (cl_max - cl_min) > (s->c_all >> 3))) + { + /* It is time to perform an ATMOVE */ + s->new_tx = t_max; + } + else + { + /* Disable further analysis */ + s->new_tx = s->tx; + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_set_image_width(t85_encode_state_t *s, uint32_t image_width) +{ + int bytes_per_row; + uint8_t *t; + + if (s->xd == image_width) + return 0; + /* Are we too late to change the width for this page? */ + if (s->y > 0) + return -1; + s->xd = image_width; + bytes_per_row = (s->xd + 7) >> 3; + if ((t = (uint8_t *) realloc(s->row_buf, 3*bytes_per_row)) == NULL) + return -1; + s->row_buf = t; + memset(s->row_buf, 0, 3*bytes_per_row); + s->prev_row[0] = s->row_buf; + s->prev_row[1] = s->row_buf + bytes_per_row; + s->prev_row[2] = s->row_buf + 2*bytes_per_row; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_set_image_length(t85_encode_state_t *s, uint32_t length) +{ + /* We must have variable length enabled. + We do not allow the length to be changed multiple times. + We only allow an image to be shrunk, and not stretched. + We do not allow the length to become zero. */ + if (!(s->options & T85_VLENGTH) || s->newlen == NEWLEN_HANDLED || length >= s->yd || length < 1) + { + /* Invalid parameter */ + return -1; + } + if (s->y > 0) + { + /* TODO: If we are already beyond the new length, we scale back the new length silently. + Is there any downside to this? */ + if (length < s->y) + length = s->y; + if (s->yd != length) + s->newlen = NEWLEN_PENDING; + } + s->yd = length; + if (s->y == s->yd) + { + /* We are already at the end of the image, so finish it off. */ + if (s->i > 0) + { + t81_t82_arith_encode_flush(&s->s); + output_esc_code(s, T82_SDNORM); + s->i = 0; + } + output_newlen(s); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t85_encode_abort(t85_encode_state_t *s) +{ + output_esc_code(s, T82_ABORT); + /* Make the image appear to be complete, so the encoder stops outputting. + Take care, as this means s->y is now telling lies. */ + s->y = s->yd; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t85_encode_comment(t85_encode_state_t *s, const uint8_t comment[], size_t len) +{ + s->comment = comment; + s->comment_len = len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_get_byte(t85_encode_state_t *s) +{ + if (s->bitstream_optr >= s->bitstream_iptr) + { + do + { + if (get_next_row(s) < 0) + return 0x100; + } + while (s->bitstream_iptr == 0); + } + return s->bitstream[s->bitstream_optr++]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_get_chunk(t85_encode_state_t *s, uint8_t buf[], int max_len) +{ + int len; + int n; + + for (len = 0; len < max_len; len += n) + { + if (s->bitstream_optr >= s->bitstream_iptr) + { + if (get_next_row(s) < 0) + return len; + } + n = s->bitstream_iptr - s->bitstream_optr; + if (n > max_len - len) + n = max_len - len; + memcpy(&buf[len], &s->bitstream[s->bitstream_optr], n); + s->bitstream_optr += n; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t85_encode_get_image_width(t85_encode_state_t *s) +{ + return s->xd; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t85_encode_get_image_length(t85_encode_state_t *s) +{ + return s->yd; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_get_compressed_image_size(t85_encode_state_t *s) +{ + return s->compressed_image_size*8; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_set_row_read_handler(t85_encode_state_t *s, + t4_row_read_handler_t handler, + void *user_data) +{ + s->row_read_handler = handler; + s->row_read_user_data = user_data; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_restart(t85_encode_state_t *s, uint32_t image_width, uint32_t image_length) +{ + int bytes_per_row; + + /* Allow the image width to be anything, although only a few values are actually + permitted by the T.85 and T.4 specs. Higher levels in the stack need to impose + these restrictions. */ + t85_encode_set_image_width(s, image_width); + bytes_per_row = (s->xd + 7) >> 3; + memset(s->row_buf, 0, 3*bytes_per_row); + s->yd = image_length; + + s->comment = NULL; + s->comment_len = 0; + s->y = 0; + s->i = 0; + s->newlen = NEWLEN_NONE; + s->new_tx = -1; + s->tx = 0; + s->prev_ltp = FALSE; + s->bitstream_iptr = 0; + s->bitstream_optr = 0; + if (s->bitstream) + { + free(s->bitstream); + s->bitstream = NULL; + } + s->bitstream_len = 0; + s->fill_with_white = FALSE; + s->compressed_image_size = 0; + + t81_t82_arith_encode_init(&s->s, output_byte, s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t85_encode_state_t *) t85_encode_init(t85_encode_state_t *s, + uint32_t image_width, + uint32_t image_length, + t4_row_read_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (t85_encode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.85"); + + s->row_read_handler = handler; + s->row_read_user_data = user_data; + + /* T.85 BASIC setting for L0. In T.85 this may only be changed if T.30 negotiation permits. */ + s->l0 = 128; + /* No ATMOVE pending */ + s->mx = 127; + /* Default options */ + s->options = T85_TPBON | T85_VLENGTH; + + s->bitstream = NULL; + s->bitstream_len = 0; + + s->bit_planes = 1; + s->current_bit_plane = 0; + + t85_encode_restart(s, image_width, image_length); + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_release(t85_encode_state_t *s) +{ + if (s->row_buf) + { + free(s->row_buf); + s->row_buf = NULL; + } + if (s->bitstream) + { + free(s->bitstream); + s->bitstream = NULL; + s->bitstream_len = 0; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t85_encode_free(t85_encode_state_t *s) +{ + int ret; + + ret = t85_encode_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/Makefile.am b/libs/spandsp/tests/Makefile.am index c370f20a46..d4820d81d3 100644 --- a/libs/spandsp/tests/Makefile.am +++ b/libs/spandsp/tests/Makefile.am @@ -109,6 +109,8 @@ noinst_PROGRAMS = ademco_contactid_tests \ t38_decode \ t38_non_ecm_buffer_tests \ t4_tests \ + t81_t82_arith_coding_tests \ + t85_tests \ time_scale_tests \ timezone_tests \ tone_detect_tests \ @@ -312,6 +314,12 @@ t38_non_ecm_buffer_tests_LDADD = $(LIBDIR) -lspandsp t4_tests_SOURCES = t4_tests.c t4_tests_LDADD = $(LIBDIR) -lspandsp +t81_t82_arith_coding_tests_SOURCES = t81_t82_arith_coding_tests.c +t81_t82_arith_coding_tests_LDADD = $(LIBDIR) -lspandsp + +t85_tests_SOURCES = t85_tests.c +t85_tests_LDADD = $(LIBDIR) -lspandsp + time_scale_tests_SOURCES = time_scale_tests.c time_scale_tests_LDADD = $(LIBDIR) -lspandsp diff --git a/libs/spandsp/tests/t81_t82_arith_coding_tests.c b/libs/spandsp/tests/t81_t82_arith_coding_tests.c new file mode 100644 index 0000000000..8d5bab5808 --- /dev/null +++ b/libs/spandsp/tests/t81_t82_arith_coding_tests.c @@ -0,0 +1,238 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t81_t82_arith_coding_tests.c - Tests for the ITU T.81 and T.82 arithmetic + * encoder/decoder, based on the test description + * in T.82 + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +/*! \page t81_t82_arith_coding_tests_page T.81 and T.82 Arithmetic encoder/decoder tests +\section t81_t82_arith_coding_tests_pagesec_1 What does it do +These tests exercise the arithmetic encoder and decoder for T.81 and T.82. As T.85 is based +on T.82, this is also the arithmetic coder for T.85. + +These tests are based on T.82 section 7. Nothing beyond the prescibed tests is performed at +the present time. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define MSG_SIZE 10000 + +#define FALSE 0 +#define TRUE (!FALSE) + +uint8_t msg[MSG_SIZE]; + +int32_t msg_len; + +static void write_byte(void *user_data, int byte) +{ + if (msg_len < MSG_SIZE) + msg[msg_len++] = byte; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + t81_t82_arith_encode_state_t *se; + t81_t82_arith_decode_state_t *sd; + int i; + int j; + int test_failed; + int pix; + const uint8_t *pp; + /* Test data from T.82 7.1 */ + static const uint16_t pix_7_1[16] = + { + 0x05E0, 0x0000, 0x8B00, 0x01C4, 0x1700, 0x0034, 0x7FFF, 0x1A3F, + 0x951B, 0x05D8, 0x1D17, 0xE770, 0x0000, 0x0000, 0x0656, 0x0E6A + }; + /* Test data from T.82 7.1 */ + static const uint16_t cx_7_1[16] = + { + 0x0FE0, 0x0000, 0x0F00, 0x00F0, 0xFF00, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + }; + /* Test data from T.82 7.1 - scd with stuffing and SDNORM termination */ + static const uint8_t sde_7_1[32] = + { + 0x69, 0x89, 0x99, 0x5C, 0x32, 0xEA, 0xFA, 0xA0, + 0xD5, 0xFF, 0x00, 0x52, 0x7F, 0xFF, 0x00, 0xFF, + 0x00, 0xFF, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x3F, + 0xFF, 0x00, 0x2D, 0x20, 0x82, 0x91, 0xFF, 0x02 + }; +#define SDE_7_1_LEN 30 /* Don't include the termination SDNORM */ +#define SDE_7_1_FULL_LEN 32 /* Include the termination SDNORM */ + + printf("T.81/T.82 arithmetic encoder tests, from ITU-T T.82\n\n"); + + printf("Arithmetic encoder tests from ITU-T T.82/7.1\n"); + if ((se = t81_t82_arith_encode_init(NULL, write_byte, NULL)) == NULL) + { + fprintf(stderr, "Failed to allocate arithmetic encoder!\n"); + exit(2); + } + msg_len = 0; + for (i = 0; i < 16; i++) + { + for (j = 0; j < 16; j++) + { + t81_t82_arith_encode(se, + (cx_7_1[i] >> (15 - j)) & 1, + (pix_7_1[i] >> (15 - j)) & 1); + } + } + t81_t82_arith_encode_flush(se); + if (msg_len != SDE_7_1_LEN || memcmp(msg, sde_7_1, SDE_7_1_LEN)) + { + printf("Encoded data: "); + for (i = 0; i < msg_len; i++) + printf("%02X", msg[i]); + printf("\n"); + printf("Expected data: "); + for (i = 0; i < SDE_7_1_LEN; i++) + printf("%02X", sde_7_1[i]); + printf("\n"); + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + + printf("Arithmetic decoder tests from ITU-T T.82/7.1\n"); + printf("Decoding byte by byte...\n"); + test_failed = FALSE; + if ((sd = t81_t82_arith_decode_init(NULL)) == NULL) + { + fprintf(stderr, "Failed to allocate arithmetic decoder!\n"); + exit(2); + } + pp = sde_7_1; + sd->pscd_ptr = pp; + sd->pscd_end = pp + 1; + for (i = 0; i < 16; i++) + { + for (j = 0; j < 16; j++) + { + for (;;) + { + pix = t81_t82_arith_decode(sd, (cx_7_1[i] >> (15 - j)) & 1); + if ((pix >= 0 || sd->pscd_end >= sde_7_1 + SDE_7_1_FULL_LEN)) + break; + pp++; + if (sd->pscd_ptr != pp - 1) + sd->pscd_ptr = pp; + sd->pscd_end = pp + 1; + } + if (pix < 0) + { + printf("Bad pixel %d, byte %" PRIdPTR ".\n\n", + i*16 + j + 1, + sd->pscd_ptr - sd->pscd_end); + test_failed = TRUE; + break; + } + if (pix != ((pix_7_1[i] >> (15 - j)) & 1)) + { + printf("Bad PIX (%d) at pixel %d.\n\n", + pix, + i*16 + j + 1); + test_failed = TRUE; + break; + } + } + } + if (sd->pscd_ptr != sd->pscd_end - 2) + { + printf("%" PRIdPTR " bytes left after decoder finished.\n\n", + sd->pscd_end - sd->pscd_ptr - 2); + test_failed = TRUE; + } + if (test_failed) + { + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + + printf("Decoding chunk by chunk...\n"); + test_failed = FALSE; + t81_t82_arith_decode_init(sd); + sd->pscd_ptr = sde_7_1; + sd->pscd_end = sde_7_1 + SDE_7_1_FULL_LEN; + for (i = 0; i < 16; i++) + { + for (j = 0; j < 16; j++) + { + pix = t81_t82_arith_decode(sd, (cx_7_1[i] >> (15 - j)) & 1); + if (pix < 0) + { + printf("Bad pixel %d, byte %" PRIdPTR ".\n\n", + i*16 + j + 1, + sd->pscd_ptr - sd->pscd_end); + test_failed = TRUE; + break; + } + if (pix != ((pix_7_1[i] >> (15 - j)) & 1)) + { + printf("Bad PIX (%d) at pixel %d.\n\n", + pix, + i*16 + j + 1); + test_failed = TRUE; + break; + } + } + } + if (sd->pscd_ptr != sd->pscd_end - 2) + { + printf("%" PRIdPTR " bytes left after decoder finished.\n\n", + sd->pscd_end - sd->pscd_ptr - 2); + test_failed = TRUE; + } + if (test_failed) + { + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/t85_tests.c b/libs/spandsp/tests/t85_tests.c new file mode 100644 index 0000000000..832ee816fc --- /dev/null +++ b/libs/spandsp/tests/t85_tests.c @@ -0,0 +1,369 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t85_tests.c - ITU T.85 FAX image compression and decompression tests + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * These tests are based on code from Markus Kuhn's jbigkit. See + * http://www.cl.cam.ac.uk/~mgk25/ + * + * jbigkit is GPL2 licenced. This file is also GPL2 licenced, and our + * T.85 code is LGPL2.1 licenced. There are no licence incompatibilities + * in this reuse of Markus's work. + */ + +/*! \file */ + +/*! \page t85_tests_page T.85 image compress and decompression tests +\section t85_tests_page_sec_1 What does it do +These tests exercise the image compression and decompression methods defined +in ITU specifications T.85. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define TESTBUF_SIZE 400000 +#define TEST_IMAGE_SIZE (1951*1960/8) + +#define FALSE 0 +#define TRUE (!FALSE) + +uint8_t testbuf[TESTBUF_SIZE]; +uint8_t test_image[TEST_IMAGE_SIZE]; + +size_t testbuf_len; + +int read_row = 0; +int write_row = 0; + +int clip_to_row = 0; + +static int row_read_handler(void *user_data, uint8_t buf[], size_t len) +{ + //t85_encode_state_t *s; + + //s = (t85_encode_state_t *) user_data; + + memcpy(buf, &test_image[len*read_row], len); + //printf("Read row %d\n", read_row); + if (clip_to_row && read_row == clip_to_row) + { + clip_to_row = 0; + return 0; + } + read_row++; + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int row_write_handler(void *user_data, const uint8_t buf[], size_t len) +{ + uint8_t *bitmap; + + bitmap = (uint8_t *) user_data; + memcpy(&bitmap[len*write_row], buf, len); + //printf("Write row %d\n", write_row); + write_row++; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int comment_handler(void *user_data, const uint8_t buf[], size_t len) +{ + if (buf) + printf("Comment (%lu): %s\n", (unsigned long int) len, buf); + else + printf("Comment (%lu): ---\n", (unsigned long int) len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void create_test_image(uint8_t *pic) +{ + int i; + int j; + uint32_t sum; + uint32_t prsg; + uint32_t repeat[8]; + uint8_t *p; + + /* Cook up the test image defined in T.82/7.2.1. This image is 1960 x 1951 + pixels, and occupies a single plane (which it has to for T.85). */ + memset(pic, 0, TEST_IMAGE_SIZE); + p = pic; + prsg = 1; + for (i = 0; i < 1951; i++) + { + for (j = 0; j < 1960; j++) + { + if (i >= 192) + { + if (i < 1023 || (j & (3 << 3)) == 0) + { + sum = (prsg & 1) + + ((prsg >> 2) & 1) + + ((prsg >> 11) & 1) + + ((prsg >> 15) & 1); + prsg = (prsg << 1) + (sum & 1); + if ((prsg & 3) == 0) + { + *p |= (1 << (7 - (j & 7))); + repeat[j & 7] = 1; + } + else + { + repeat[j & 7] = 0; + } + } + else + { + if (repeat[j & 7]) + *p |= 1 << (7 - (j & 7)); + } + } + if ((j & 7) == 7) + ++p; + } + } + + /* Verify the test image has been generated OK, by checking the number of set pixels */ + sum = 0; + for (i = 0; i < TEST_IMAGE_SIZE; i++) + { + for (j = 0; j < 8; j++) + sum += ((pic[i] >> j) & 1); + } + if (sum != 861965) + { + printf("WARNING: Test image has %" PRIu32 " foreground pixels. There should be 861965.\n", + sum); + } +} +/*- End of function --------------------------------------------------------*/ + +/* Perform a test cycle, as defined in T.82/7, with one set of parameters. */ +static int test_cycle(const char *test_id, + const uint8_t *image, + uint32_t width, + uint32_t height, + uint32_t l0, + int mx, + int options, + int optionsx, + const uint8_t *comment, + size_t correct_length) +{ + t85_encode_state_t t85_enc; + t85_decode_state_t t85_dec; + long int l; + size_t image_size; + int result; + int len; + int max_len; + size_t bytes_per_row; + size_t cnt_a; + size_t cnt_b; + uint8_t *decoded_image; + + printf("%s: TPBON=%d, LRLTWO=%d, Mx=%d, L0=%" PRIu32 "\n", + test_id, + (options & T85_TPBON) ? 1 : 0, + (options & T85_LRLTWO) ? 1 : 0, + mx, + l0); + + printf("%s.1: Encode\n", test_id); + bytes_per_row = (width + 7)/8; + image_size = bytes_per_row*height; + + if ((optionsx & T85_VLENGTH)) + { + t85_encode_init(&t85_enc, width, height + 10, row_read_handler, &t85_enc); + clip_to_row = height; + } + else + { + t85_encode_init(&t85_enc, width, height, row_read_handler, &t85_enc); + clip_to_row = 0; + } + read_row = 0; + t85_encode_set_options(&t85_enc, l0, mx, options); + /* A comment inserted here should always succeed. The later one, inserted some way + down the image, will only succeed if a new chunk is started afterwards. */ + if (comment) + t85_encode_comment(&t85_enc, comment, strlen((const char *) comment) + 1); + + testbuf_len = 0; + max_len = 100; + while ((len = t85_encode_get_chunk(&t85_enc, &testbuf[testbuf_len], max_len)) > 0) + { + testbuf_len += len; + max_len = 100; + if (testbuf_len + 100 > TESTBUF_SIZE) + max_len = TESTBUF_SIZE - testbuf_len; + if (comment && testbuf_len == 1000) + t85_encode_comment(&t85_enc, comment, strlen((const char *) comment) + 1); + } + t85_encode_release(&t85_enc); + printf("Encoded BIE has %lu bytes\n", (unsigned long int) testbuf_len); + if (correct_length > 0) + { + if (testbuf_len != correct_length) + { + printf("Incorrect encoded length. Should have been %lu\n", (unsigned long int) correct_length); + printf("Test failed\n"); + exit(2); + } + printf("Test passed\n"); + } + + printf("%s.2: Decode in one big chunk\n", test_id); + if ((decoded_image = (uint8_t *) malloc(image_size)) == NULL) + { + fprintf(stderr, "Out of memory!\n"); + exit(2); + } + t85_decode_init(&t85_dec, row_write_handler, decoded_image); + if (comment && comment[0] != 'X') + t85_decode_set_comment_handler(&t85_dec, 1000, comment_handler, NULL); + write_row = 0; + result = t85_decode_put_chunk(&t85_dec, testbuf, testbuf_len); + if (result == T85_MORE_DATA) + result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); + cnt_a = t85_encode_get_compressed_image_size(&t85_enc); + cnt_b = t85_decode_get_compressed_image_size(&t85_dec); + if (cnt_a != cnt_b || cnt_a != testbuf_len*8 || result != T85_OK) + { + printf("Decode result %d\n", result); + printf("%ld/%ld bits of %ld bits of BIE read. %lu lines decoded.\n", + (long int) cnt_a, + (long int) cnt_b, + (unsigned long int) testbuf_len*8, + (unsigned long int) t85_dec.y); + printf("Test failed\n"); + exit(2); + } + if (memcmp(decoded_image, image, image_size)) + { + printf("Image mismatch\n"); + printf("Test failed\n"); + exit(2); + } + free(decoded_image); + t85_decode_release(&t85_dec); + printf("Test passed\n"); + + printf("%s.3: Decode byte by byte\n", test_id); + if ((decoded_image = (uint8_t *) malloc(image_size)) == NULL) + { + fprintf(stderr, "Out of memory!\n"); + exit(2); + } + t85_decode_init(&t85_dec, row_write_handler, decoded_image); + if (comment && comment[0] != 'X') + t85_decode_set_comment_handler(&t85_dec, 1000, comment_handler, NULL); + write_row = 0; + result = T85_MORE_DATA; + for (l = 0; l < testbuf_len; l++) + { + result = t85_decode_put_chunk(&t85_dec, &testbuf[l], 1); + if (result != T85_MORE_DATA) + { + l++; + break; + } + } + if (result == T85_MORE_DATA) + result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); + if (l != testbuf_len || result != T85_OK) + { + printf("Decode result %d\n", result); + printf("%ld bytes of %ld bytes of BIE read. %lu lines decoded.\n", + (long int) l, + (unsigned long int) testbuf_len, + (unsigned long int) t85_dec.y); + printf("Test failed\n"); + exit(2); + } + if (memcmp(decoded_image, image, image_size)) + { + printf("Image mismatch\n"); + printf("Test failed\n"); + exit(2); + } + free(decoded_image); + t85_decode_release(&t85_dec); + printf("Test passed\n"); + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char **argv) +{ + printf("T.85 JBIG for FAX encoder and decoder tests, from ITU-T T.82\n\n"); + + printf("Generating the test image from T.82...\n"); + create_test_image(test_image); + + /* Run through the tests in T.82/7.2, which are applicable to T.85 */ + test_cycle("1", test_image, 1960, 1951, 1951, 0, 0, 0, NULL, 317384); + test_cycle("2", test_image, 1960, 1951, 1951, 0, T85_LRLTWO, 0, NULL, 317132); + test_cycle("3", test_image, 1960, 1951, 128, 8, T85_TPBON, 0, NULL, 253653); + /* Again with a comment added and handled */ + test_cycle("4", test_image, 1960, 1951, 1951, 0, 0, 0, (const uint8_t *) "Comment 4", 317384 + 16); + test_cycle("5", test_image, 1960, 1951, 1951, 0, T85_LRLTWO, 0, (const uint8_t *) "Comment 5", 317132 + 16); + test_cycle("6", test_image, 1960, 1951, 128, 8, T85_TPBON, 0, (const uint8_t *) "Comment 6", 253653 + 2*16); + /* Again with a comment added, but not handled */ + test_cycle("7", test_image, 1960, 1951, 1951, 0, 0, 0, (const uint8_t *) "Xomment 7", 317384 + 16); + test_cycle("8", test_image, 1960, 1951, 1951, 0, T85_LRLTWO, 0, (const uint8_t *) "Xomment 8", 317132 + 16); + test_cycle("9", test_image, 1960, 1951, 128, 8, T85_TPBON, 0, (const uint8_t *) "Xomment 9", 253653 + 2*16); + /* Again with the image variable length and prematurely terminated */ + test_cycle("10", test_image, 1960, 1951, 1951, 0, T85_VLENGTH, T85_VLENGTH, NULL, 317384 + 8); + test_cycle("11", test_image, 1960, 1951, 1951, 0, T85_VLENGTH | T85_LRLTWO, T85_VLENGTH, NULL, 317132 + 8); + test_cycle("12", test_image, 1960, 1951, 128, 8, T85_VLENGTH | T85_TPBON, T85_VLENGTH, NULL, 253653 + 8); + /* Again with the image variable length but not prematurely terminated */ + test_cycle("13", test_image, 1960, 1951, 1951, 0, T85_VLENGTH, 0, NULL, 317384); + test_cycle("14", test_image, 1960, 1951, 1951, 0, T85_VLENGTH | T85_LRLTWO, 0, NULL, 317132); + test_cycle("15", test_image, 1960, 1951, 128, 8, T85_VLENGTH | T85_TPBON, 0, NULL, 253653); + + printf("Tests passed\n"); + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ From 232fe6772279abdfa6222c77ab2fbabf3e13a041 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 15 Jul 2012 01:47:55 +0800 Subject: [PATCH 0710/1057] More integration with the current spandsp --- libs/spandsp/tests/dtmf_rx_tests.c | 36 ++++++------- libs/spandsp/tests/fax_decode.c | 22 +++++--- libs/spandsp/tests/fax_tester.c | 43 ++++++--------- libs/spandsp/tests/fax_tests.sh | 5 +- libs/spandsp/tests/fax_utils.c | 2 +- libs/spandsp/tests/regression_tests.sh | 75 ++++++++++---------------- 6 files changed, 84 insertions(+), 99 deletions(-) diff --git a/libs/spandsp/tests/dtmf_rx_tests.c b/libs/spandsp/tests/dtmf_rx_tests.c index e160bbf4ef..bd0d81e083 100644 --- a/libs/spandsp/tests/dtmf_rx_tests.c +++ b/libs/spandsp/tests/dtmf_rx_tests.c @@ -154,8 +154,8 @@ int callback_ok; int callback_roll; int step; -int max_forward_twist; -int max_reverse_twist; +float max_forward_twist; +float max_reverse_twist; int use_dialtone_filter = FALSE; @@ -325,8 +325,8 @@ static void mitel_cm7291_side_1_tests(void) logging_state_t *logging; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) - dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f); logging = dtmf_rx_get_logging_state(dtmf_state); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "DTMF-rx"); @@ -635,8 +635,8 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void) logging_state_t *logging; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) - dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f); logging = dtmf_rx_get_logging_state(dtmf_state); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "DTMF-rx"); @@ -706,8 +706,8 @@ static void dial_tone_tolerance_tests(void) logging_state_t *logging; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) - dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f); logging = dtmf_rx_get_logging_state(dtmf_state); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "DTMF-rx"); @@ -763,8 +763,8 @@ static void callback_function_tests(void) callback_ok = TRUE; callback_roll = 0; dtmf_state = dtmf_rx_init(NULL, digit_delivery, (void *) 0x12345678); - if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) - dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f); logging = dtmf_rx_get_logging_state(dtmf_state); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "DTMF-rx"); @@ -793,8 +793,8 @@ static void callback_function_tests(void) callback_roll = 0; dtmf_rx_init(dtmf_state, NULL, NULL); dtmf_rx_set_realtime_callback(dtmf_state, digit_status, (void *) 0x12345678); - if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) - dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f); logging = dtmf_rx_get_logging_state(dtmf_state); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "DTMF-rx"); @@ -836,8 +836,8 @@ static void decode_test(const char *test_file) logging_state_t *logging; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) - dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f); logging = dtmf_rx_get_logging_state(dtmf_state); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "DTMF-rx"); @@ -874,8 +874,8 @@ int main(int argc, char *argv[]) use_dialtone_filter = FALSE; channel_codec = MUNGE_CODEC_NONE; decode_test_file = NULL; - max_forward_twist = -1; - max_reverse_twist = -1; + max_forward_twist = -1.0f; + max_reverse_twist = -1.0f; while ((opt = getopt(argc, argv, "c:d:F:fR:")) != -1) { switch (opt) @@ -887,13 +887,13 @@ int main(int argc, char *argv[]) decode_test_file = optarg; break; case 'F': - max_forward_twist = atoi(optarg); + max_forward_twist = atof(optarg); break; case 'f': use_dialtone_filter = TRUE; break; case 'R': - max_reverse_twist = atoi(optarg); + max_reverse_twist = atof(optarg); break; default: //usage(); diff --git a/libs/spandsp/tests/fax_decode.c b/libs/spandsp/tests/fax_decode.c index e175a6168b..4b8268cc01 100644 --- a/libs/spandsp/tests/fax_decode.c +++ b/libs/spandsp/tests/fax_decode.c @@ -465,7 +465,8 @@ int main(int argc, char *argv[]) fsk_rx_state_t *fsk; v17_rx_state_t *v17; v29_rx_state_t *v29; - v27ter_rx_state_t *v27ter; + v27ter_rx_state_t *v27ter_4800; + v27ter_rx_state_t *v27ter_2400; int16_t amp[SAMPLES_PER_CHUNK]; SNDFILE *inhandle; SF_INFO info; @@ -504,11 +505,14 @@ int main(int argc, char *argv[]) v17 = v17_rx_init(NULL, 14400, v17_put_bit, NULL); v29 = v29_rx_init(NULL, 9600, v29_put_bit, NULL); //v29 = v29_rx_init(NULL, 7200, v29_put_bit, NULL); - v27ter = v27ter_rx_init(NULL, 4800, v27ter_put_bit, NULL); + v27ter_4800 = v27ter_rx_init(NULL, 4800, v27ter_put_bit, NULL); + v27ter_2400 = v27ter_rx_init(NULL, 2400, v27ter_put_bit, NULL); + fsk_rx_signal_cutoff(fsk, -45.5); v17_rx_signal_cutoff(v17, -45.5); v29_rx_signal_cutoff(v29, -45.5); - v27ter_rx_signal_cutoff(v27ter, -40.0); + v27ter_rx_signal_cutoff(v27ter_4800, -40.0); + v27ter_rx_signal_cutoff(v27ter_2400, -40.0); #if 1 logging = v17_rx_get_logging_state(v17); @@ -521,9 +525,14 @@ int main(int argc, char *argv[]) span_log_set_protocol(logging, "V.29"); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); - logging = v27ter_rx_get_logging_state(v27ter); + logging = v27ter_rx_get_logging_state(v27ter_4800); span_log_init(logging, SPAN_LOG_FLOW, NULL); - span_log_set_protocol(logging, "V.27ter"); + span_log_set_protocol(logging, "V.27ter-4800"); + span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); + + logging = v27ter_rx_get_logging_state(v27ter_2400); + span_log_init(logging, SPAN_LOG_FLOW, NULL); + span_log_set_protocol(logging, "V.27ter-2400"); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); #endif @@ -541,7 +550,8 @@ int main(int argc, char *argv[]) fsk_rx(fsk, amp, len); v17_rx(v17, amp, len); v29_rx(v29, amp, len); - //v27ter_rx(v27ter, amp, len); + v27ter_rx(v27ter_4800, amp, len); + v27ter_rx(v27ter_2400, amp, len); } t4_rx_release(&t4_rx_state); diff --git a/libs/spandsp/tests/fax_tester.c b/libs/spandsp/tests/fax_tester.c index 544756f712..023b130751 100644 --- a/libs/spandsp/tests/fax_tester.c +++ b/libs/spandsp/tests/fax_tester.c @@ -86,15 +86,15 @@ static void front_end_step_complete(faxtester_state_t *s) void faxtester_send_hdlc_flags(faxtester_state_t *s, int flags) { - hdlc_tx_flags(&(s->modems.hdlc_tx), flags); + hdlc_tx_flags(&s->modems.hdlc_tx, flags); } /*- End of function --------------------------------------------------------*/ void faxtester_send_hdlc_msg(faxtester_state_t *s, const uint8_t *msg, int len, int crc_ok) { - hdlc_tx_frame(&(s->modems.hdlc_tx), msg, len); + hdlc_tx_frame(&s->modems.hdlc_tx, msg, len); if (!crc_ok) - hdlc_tx_corrupt_frame(&(s->modems.hdlc_tx)); + hdlc_tx_corrupt_frame(&s->modems.hdlc_tx); } /*- End of function --------------------------------------------------------*/ @@ -115,30 +115,24 @@ static void hdlc_underflow_handler(void *user_data) buf[2] = 0x06; buf[3] = s->image_ptr/s->ecm_frame_size; memcpy(buf + 4, &s->image_buffer[s->image_ptr], s->ecm_frame_size); - hdlc_tx_frame(&(s->modems.hdlc_tx), buf, 4 + s->ecm_frame_size); + hdlc_tx_frame(&s->modems.hdlc_tx, buf, 4 + s->ecm_frame_size); if (s->corrupt_crc >= 0 && s->corrupt_crc == s->image_ptr/s->ecm_frame_size) - hdlc_tx_corrupt_frame(&(s->modems.hdlc_tx)); + hdlc_tx_corrupt_frame(&s->modems.hdlc_tx); s->image_ptr += s->ecm_frame_size; return; } - else + /* The actual image is over. We are sending the final RCP frames. */ + if (s->image_bit_ptr > 2) { - /* The actual image is over. We are sending the final RCP frames. */ - if (s->image_bit_ptr > 2) - { - s->image_bit_ptr--; - buf[0] = 0xFF; - buf[1] = 0x03; - buf[2] = 0x86; - hdlc_tx_frame(&(s->modems.hdlc_tx), buf, 3); - return; - } - else - { - /* All done. */ - s->image_buffer = NULL; - } + s->image_bit_ptr--; + buf[0] = 0xFF; + buf[1] = 0x03; + buf[2] = 0x86; + hdlc_tx_frame(&s->modems.hdlc_tx, buf, 3); + return; } + /* All done. */ + s->image_buffer = NULL; } front_end_step_complete(s); } @@ -388,7 +382,7 @@ int faxtester_rx(faxtester_state_t *s, int16_t *amp, int len) int i; for (i = 0; i < len; i++) - amp[i] = dc_restore(&(s->modems.dc_restore), amp[i]); + amp[i] = dc_restore(&s->modems.dc_restore, amp[i]); s->modems.rx_handler(s->modems.rx_user_data, amp, len); timer_update(s, len); if (s->wait_for_silence) @@ -474,10 +468,7 @@ void faxtester_set_rx_type(void *user_data, int type, int bit_rate, int short_tr { case T30_MODEM_CED: case T30_MODEM_CNG: - if (type == T30_MODEM_CED) - tone = MODEM_CONNECT_TONES_FAX_CED; - else - tone = MODEM_CONNECT_TONES_FAX_CNG; + tone = (type == T30_MODEM_CED) ? MODEM_CONNECT_TONES_FAX_CED : MODEM_CONNECT_TONES_FAX_CNG; modem_connect_tones_rx_init(&t->connect_rx, tone, tone_detected, diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index 3c78fe51a2..e273968630 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -18,7 +18,7 @@ run_fax_test() { rm -f fax_tests_1.tif - echo ./fax_tests -i ${FILE} ${OPTS} -i ${FILE} + echo ./fax_tests ${OPTS} -i ${FILE} ./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2 RETVAL=$? if [ $RETVAL != 0 ] @@ -142,3 +142,6 @@ do FILE="${ITUTESTS_DIR}/R1200_1200_A3.tif" run_fax_test done + +echo +echo All fax tests successfully completed diff --git a/libs/spandsp/tests/fax_utils.c b/libs/spandsp/tests/fax_utils.c index bd69917ef1..063f14b331 100644 --- a/libs/spandsp/tests/fax_utils.c +++ b/libs/spandsp/tests/fax_utils.c @@ -91,7 +91,7 @@ void fax_log_final_transfer_statistics(t30_state_t *s, const char *tag) t30_get_transfer_statistics(s, &t); printf("%s: Bit rate %d\n", tag, t.bit_rate); printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off"); - //printf("%s: RTP events %d. RTN events %d\n", tag, t.rtp_events, t.rtn_events); + printf("%s: RTP events %d. RTN events %d\n", tag, t.rtp_events, t.rtn_events); printf("%s: Tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx); } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/regression_tests.sh b/libs/spandsp/tests/regression_tests.sh index fe1e1a8ad9..f6a4fb9a10 100755 --- a/libs/spandsp/tests/regression_tests.sh +++ b/libs/spandsp/tests/regression_tests.sh @@ -179,31 +179,14 @@ echo dtmf_tx_tests completed OK #echo echo_tests completed OK echo echo_tests not enabled -for OPTS in "-p AA" "-p AA -e" "-p TT" "-p TT -e" "-p GG" "-p GG -e" "-p TG" "-p TG -e" "-p GT" "-p GT -e" -do - for FILE in ${ITUTESTS_TIF} ${MIXEDSIZES_TIF} - do - rm -f fax_tests.tif - ./fax_tests ${OPTS} -i ${FILE} >$STDOUT_DEST 2>$STDERR_DEST - RETVAL=$? - if [ $RETVAL != 0 ] - then - echo fax_tests ${OPTS} -i ${FILE} failed! - exit $RETVAL - fi - # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t - # option means the normal differences in tags will be ignored. - tiffcmp -t ${FILE} fax_tests.tif >/dev/null - RETVAL=$? - if [ $RETVAL != 0 ] - then - echo fax_tests ${OPTS} -i ${FILE} failed! - exit $RETVAL - fi - echo fax_tests ${OPTS} -i ${FILE} completed OK - done -done -echo fax_tests completed OK +./fax_tests.sh +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo fax_tests.sh failed! + exit $RETVAL +fi +echo fax_tests.sh completed OK ./fsk_tests >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? @@ -536,27 +519,25 @@ echo t4_tests completed OK #echo t4_t6_tests completed OK echo t4_t6_tests not enabled -#rm -f t81_t82_arith_coding_tests_receive.tif -#./t4_tests >$STDOUT_DEST 2>$STDERR_DEST -#RETVAL=$? -#if [ $RETVAL != 0 ] -#then -# echo t81_t82_arith_coding_tests failed! -# exit $RETVAL -#fi -#echo t81_t82_arith_coding_tests completed OK -echo t81_t82_arith_coding_tests not enabled +rm -f t81_t82_arith_coding_tests_receive.tif +./t4_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t81_t82_arith_coding_tests failed! + exit $RETVAL +fi +echo t81_t82_arith_coding_tests completed OK -#rm -f t85_tests_receive.tif -#./t85_tests >$STDOUT_DEST 2>$STDERR_DEST -#RETVAL=$? -#if [ $RETVAL != 0 ] -#then -# echo t85_tests failed! -# exit $RETVAL -#fi -#echo t85_tests completed OK -echo t85_tests not enabled +rm -f t85_tests_receive.tif +./t85_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t85_tests failed! + exit $RETVAL +fi +echo t85_tests completed OK #./time_scale_tests >$STDOUT_DEST 2>$STDERR_DEST #RETVAL=$? @@ -672,10 +653,10 @@ echo v42_tests completed OK RETVAL=$? if [ $RETVAL != 0 ] then - echo v42bis_tests failed! + echo v42bis_tests.sh failed! exit $RETVAL fi -echo v42bis_tests completed OK +echo v42bis_tests.sh completed OK ./v8_tests >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? From b256cf5695919293daa7a6fe392a55a6f450307e Mon Sep 17 00:00:00 2001 From: Brian West Date: Sat, 14 Jul 2012 14:05:26 -0500 Subject: [PATCH 0711/1057] fix auth_only voicemail usage --- src/mod/applications/mod_voicemail/mod_voicemail.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index de44945e8e..611243bb2e 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3535,12 +3535,12 @@ SWITCH_STANDARD_APP(voicemail_function) if (argv[x] && !strcasecmp(argv[x], "check")) { check++; x++; - } else if (argv[x] && !strcasecmp(argv[x], "auth")) { - auth++; - x++; } else if (argv[x] && !strcasecmp(argv[x], "auth_only")) { auth = 2; x++; + } else if (argv[x] && !strcasecmp(argv[x], "auth")) { + auth++; + x++; } else { break; } @@ -3584,7 +3584,7 @@ SWITCH_STANDARD_APP(voicemail_function) return; } - if (check) { + if (check || auth == 2) { if (argv[x]) { uuid = argv[x++]; } From addcddc1ae617e6a8aa69b4038fc4669a957b9b4 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 15 Jul 2012 00:31:08 +0200 Subject: [PATCH 0712/1057] mod_http_cache: Fix last remaining C99-style for loop. Signed-off-by: Stefan Knoblich --- src/mod/applications/mod_http_cache/mod_http_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index aec7be684d..856f2be0a1 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -698,6 +698,7 @@ static cached_url_t *cached_url_create(url_cache_t *cache, const char *url) char *dirname = NULL; cached_url_t *u = NULL; const char *file_extension = ""; + const char *ext = NULL; if (zstr(url)) { return NULL; @@ -716,7 +717,7 @@ static cached_url_t *cached_url_create(url_cache_t *cache, const char *url) switch_dir_make_recursive(dirname, SWITCH_DEFAULT_DIR_PERMS, cache->pool); /* find extension on the end of URL */ - for(const char *ext = &url[strlen(url) - 1]; ext != url; ext--) { + for (ext = &url[strlen(url) - 1]; ext != url; ext--) { if (*ext == '/' || *ext == '\\') { break; } From fa03e4e0caf01a776b9114c94789474af14ebee0 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Sun, 15 Jul 2012 00:43:00 +0200 Subject: [PATCH 0713/1057] mod_http_cache: Remove DOS line-endings in http_put(). Signed-off-by: Stefan Knoblich --- .../mod_http_cache/mod_http_cache.c | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 856f2be0a1..d4117d0a69 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -191,29 +191,29 @@ static void url_cache_clear(url_cache_t *cache, switch_core_session_t *session); static switch_status_t http_put(url_cache_t *cache, switch_core_session_t *session, const char *url, const char *filename) { switch_status_t status = SWITCH_STATUS_SUCCESS; - - switch_curl_slist_t *headers = NULL; /* optional linked-list of HTTP headers */ - char *ext; /* file extension, used for MIME type identification */ - const char *mime_type = "application/octet-stream"; - char *buf; - + + switch_curl_slist_t *headers = NULL; /* optional linked-list of HTTP headers */ + char *ext; /* file extension, used for MIME type identification */ + const char *mime_type = "application/octet-stream"; + char *buf; + CURL *curl_handle = NULL; long httpRes = 0; struct stat file_info = {0}; FILE *file_to_put = NULL; int fd; - - /* guess what type of mime content this is going to be */ - if ((ext = strrchr(filename, '.'))) { - ext++; - if (!(mime_type = switch_core_mime_ext2type(ext))) { - mime_type = "application/octet-stream"; - } - } - - buf = switch_mprintf("Content-Type: %s", mime_type); - headers = switch_curl_slist_append(headers, buf); - + + /* guess what type of mime content this is going to be */ + if ((ext = strrchr(filename, '.'))) { + ext++; + if (!(mime_type = switch_core_mime_ext2type(ext))) { + mime_type = "application/octet-stream"; + } + } + + buf = switch_mprintf("Content-Type: %s", mime_type); + headers = switch_curl_slist_append(headers, buf); + /* open file and get the file size */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "opening %s for upload to %s\n", filename, url); fd = open(filename, O_RDONLY); @@ -244,7 +244,7 @@ static switch_status_t http_put(url_cache_t *cache, switch_core_session_t *sessi switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); - switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); + switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url); switch_curl_easy_setopt(curl_handle, CURLOPT_READDATA, file_to_put); switch_curl_easy_setopt(curl_handle, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size); @@ -279,12 +279,12 @@ done: fclose(file_to_put); } - if (headers) { - switch_curl_slist_free_all(headers); - } - - switch_safe_free(buf); - + if (headers) { + switch_curl_slist_free_all(headers); + } + + switch_safe_free(buf); + return status; } From 545c387938ad70ad7c204d7107519778c71d931b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 14 Jul 2012 20:23:13 -0500 Subject: [PATCH 0714/1057] frick --- libs/libscgi/src/scgi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index df05b5980b..d0eeab5203 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -606,7 +606,7 @@ SCGI_DECLARE(scgi_status_t) scgi_accept(scgi_socket_t server_sock, scgi_socket_t clntLen = sizeof(*echoClntAddr); if ((client_sock = accept(server_sock, (struct sockaddr *) echoClntAddr, &clntLen)) == SCGI_SOCK_INVALID) { - printf("FRICK %s\n", strerror(errno)); + //printf("FRICK %s\n", strerror(errno)); status = SCGI_FAIL; } else { *client_sock_p = client_sock; From 8d6b64e0ca85f2463de518a91876b8cb1ad258ee Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 15 Jul 2012 11:22:18 +0800 Subject: [PATCH 0715/1057] add flags to conference xml_list and show also on conference list --- .../mod_conference/mod_conference.c | 97 ++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index fa5f02e8b9..7c9146b1b1 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4903,13 +4903,96 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st if (conference == NULL) { switch_mutex_lock(globals.hash_mutex); for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) { + int fcount = 0; switch_hash_this(hi, NULL, NULL, &val); conference = (conference_obj_t *) val; - stream->write_function(stream, "Conference %s (%u member%s rate: %u%s)\n", + stream->write_function(stream, "Conference %s (%u member%s rate: %u%s flags: ", conference->name, conference->count, conference->count == 1 ? "" : "s", conference->rate, switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : ""); + + if (switch_test_flag(conference, CFLAG_LOCKED)) { + stream->write_function(stream, "%slocked", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_DESTRUCT)) { + stream->write_function(stream, "%sdestruct", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_WAIT_MOD)) { + stream->write_function(stream, "%swait_mod", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_AUDIO_ALWAYS)) { + stream->write_function(stream, "%saudio_always", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_RUNNING)) { + stream->write_function(stream, "%srunning", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_ANSWERED)) { + stream->write_function(stream, "%sanswered", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_ENFORCE_MIN)) { + stream->write_function(stream, "%senforce_min", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_BRIDGE_TO)) { + stream->write_function(stream, "%sbridge_to", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_DYNAMIC)) { + stream->write_function(stream, "%sdynamic", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_EXIT_SOUND)) { + stream->write_function(stream, "%sexit_sound", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_ENTER_SOUND)) { + stream->write_function(stream, "%senter_sound", fcount ? "|" : ""); + fcount++; + } + + if (conference->record_count > 0) { + stream->write_function(stream, "%srecording", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_VIDEO_BRIDGE)) { + stream->write_function(stream, "%svideo_bridge", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_VID_FLOOR)) { + stream->write_function(stream, "%svideo_floor_only", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_RFC4579)) { + stream->write_function(stream, "%svideo_rfc4579", fcount ? "|" : ""); + fcount++; + } + + if (!fcount) { + stream->write_function(stream, "none"); + } + + stream->write_function(stream, ")\n"); + count++; if (!summary) { if (pretty) { @@ -5074,6 +5157,18 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_xml_set_attr_d(x_conference, "endconf_grace_time", ival); } + if (switch_test_flag(conference, CFLAG_VIDEO_BRIDGE)) { + switch_xml_set_attr_d(x_conference, "video_bridge", "true"); + } + + if (switch_test_flag(conference, CFLAG_VID_FLOOR)) { + switch_xml_set_attr_d(x_conference, "video_floor_only", "true"); + } + + if (switch_test_flag(conference, CFLAG_RFC4579)) { + switch_xml_set_attr_d(x_conference, "video_rfc4579", "true"); + } + switch_snprintf(i, sizeof(i), "%d", switch_epoch_time_now(NULL) - conference->run_time); switch_xml_set_attr_d(x_conference, "run_time", ival); From 253e74d69b1b005a66f1131339467ae99a861f41 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 15 Jul 2012 12:37:54 +0800 Subject: [PATCH 0716/1057] add video_bridge flag to xml members --- src/mod/applications/mod_conference/mod_conference.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 7c9146b1b1..8a2dd2dc02 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5267,6 +5267,9 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer x_tag = switch_xml_add_child_d(x_flags, "has_video", count++); switch_xml_set_txt_d(x_tag, switch_channel_test_flag(switch_core_session_get_channel(member->session), CF_VIDEO) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "video_bridge", count++); + switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_VIDEO_BRIDGE) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "has_floor", count++); switch_xml_set_txt_d(x_tag, (member == member->conference->floor_holder) ? "true" : "false"); From f55f15c888aa5f7531516311b8b321198bd6993d Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 15 Jul 2012 12:44:26 +0800 Subject: [PATCH 0717/1057] accept binary in api and bgapi --- src/mod/event_handlers/mod_erlang_event/handle_msg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index e6d0d7a5f9..618b7eb829 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -634,7 +634,7 @@ static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, in ei_get_type(buf->buff, &buf->index, &type, &size); arg = malloc(size + 1); - if (ei_decode_string(buf->buff, &buf->index, arg)) { + if (ei_decode_string_or_binary(buf->buff, &buf->index, size, arg)) { fail = SWITCH_TRUE; } @@ -664,7 +664,7 @@ static switch_status_t handle_msg_bgapi(listener_t *listener, erlang_msg * msg, { char api_cmd[MAXATOMLEN]; char arg[1024]; - if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string(buf->buff, &buf->index, arg)) { + if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string_or_binary(buf->buff, &buf->index, 1023, arg)) { ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "badarg"); From b2f0e9079585858f7d2e07197b063d856ba55213 Mon Sep 17 00:00:00 2001 From: Brian West Date: Sun, 15 Jul 2012 00:05:28 -0500 Subject: [PATCH 0718/1057] fix set user call to include domain --- src/mod/applications/mod_voicemail/mod_voicemail.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 611243bb2e..699bc96311 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2548,7 +2548,10 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p if (authed) { switch_channel_set_variable(channel, "user_pin_authenticated", "true"); switch_channel_set_variable(channel, "user_pin_authenticated_user", myid); - if (!zstr(myid)) switch_ivr_set_user(session, myid); + if (!zstr(myid) && !zstr(domain_name)) { + char *account = switch_core_session_sprintf(session, "%s@%s", myid, domain_name); + switch_ivr_set_user(session, account); + } } else { switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE); } From 4bcdafec6870638593b95ff13b8f8db0a26d6cc8 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 15 Jul 2012 13:37:39 +0800 Subject: [PATCH 0719/1057] T.85 compression has now been added to the FAX engine in spandsp --- libs/spandsp/configure.ac | 3 - libs/spandsp/src/Makefile.am | 4 +- libs/spandsp/src/dtmf.c | 6 +- libs/spandsp/src/fax.c | 28 +- libs/spandsp/src/fax_modems.c | 18 +- libs/spandsp/src/image_translate.c | 8 - libs/spandsp/src/spandsp.h.in | 1 - libs/spandsp/src/spandsp/dtmf.h | 12 +- libs/spandsp/src/spandsp/private/fsk.h | 2 +- libs/spandsp/src/spandsp/private/t30.h | 4 +- libs/spandsp/src/spandsp/private/t4_rx.h | 80 +- .../src/spandsp/private/t4_t6_decode.h | 52 +- .../src/spandsp/private/t4_t6_encode.h | 54 +- libs/spandsp/src/spandsp/private/t4_tx.h | 151 +- libs/spandsp/src/spandsp/t4_rx.h | 43 +- libs/spandsp/src/spandsp/t4_t6_decode.h | 66 + libs/spandsp/src/spandsp/t4_t6_encode.h | 105 + libs/spandsp/src/spandsp/t4_tx.h | 70 +- libs/spandsp/src/spandsp/v18.h | 49 +- libs/spandsp/src/t30.c | 70 +- libs/spandsp/src/t30_api.c | 10 - libs/spandsp/src/t30_logging.c | 8 - libs/spandsp/src/t38_gateway.c | 8 - libs/spandsp/src/t38_terminal.c | 8 - libs/spandsp/src/t4_rx.c | 1851 ++++++--------- libs/spandsp/src/t4_t6_decode.c | 929 ++++++++ libs/spandsp/src/t4_t6_encode.c | 1154 +++++++++ libs/spandsp/src/t4_tx.c | 2108 ++++++----------- libs/spandsp/tests/Makefile.am | 7 +- libs/spandsp/tests/fax_decode.c | 2 +- libs/spandsp/tests/regression_tests.sh | 39 +- libs/spandsp/tests/t4_t6_tests.c | 439 ++++ libs/spandsp/tests/t4_tests.c | 43 +- libs/spandsp/tests/tsb85_tests.c | 2 +- libs/spandsp/tests/tsb85_tests.sh | 10 +- 35 files changed, 4625 insertions(+), 2819 deletions(-) create mode 100644 libs/spandsp/src/t4_t6_decode.c create mode 100644 libs/spandsp/src/t4_t6_encode.c create mode 100644 libs/spandsp/tests/t4_t6_tests.c diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index b1c7156794..559906f1ff 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -262,8 +262,6 @@ fi SPANDSP_SUPPORT_T42="#undef SPANDSP_SUPPORT_T42" #AC_DEFINE([SPANDSP_SUPPORT_T43], [1], [Support T.43 JBIG gray and colour compression]) SPANDSP_SUPPORT_T43="#undef SPANDSP_SUPPORT_T43" -#AC_DEFINE([SPANDSP_SUPPORT_T85], [1], [Support T.85 JBIG compression]) -SPANDSP_SUPPORT_T85="#undef SPANDSP_SUPPORT_T85" #AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem]) SPANDSP_SUPPORT_V34="#undef SPANDSP_SUPPORT_V34" @@ -550,7 +548,6 @@ AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS) AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY) AC_SUBST(SPANDSP_SUPPORT_T42) AC_SUBST(SPANDSP_SUPPORT_T43) -AC_SUBST(SPANDSP_SUPPORT_T85) AC_SUBST(SPANDSP_SUPPORT_V34) AC_SUBST(INSERT_INTTYPES_HEADER) AC_SUBST(INSERT_STDINT_HEADER) diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index c6d5229d86..039c8a6c9c 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -143,6 +143,8 @@ libspandsp_la_SOURCES = ademco_contactid.c \ super_tone_rx.c \ super_tone_tx.c \ swept_tone.c \ + t4_t6_decode.c \ + t4_t6_encode.c \ t4_rx.c \ t4_tx.c \ t30.c \ @@ -153,10 +155,10 @@ libspandsp_la_SOURCES = ademco_contactid.c \ t38_core.c \ t38_gateway.c \ t38_non_ecm_buffer.c \ + t38_terminal.c \ t81_t82_arith_coding.c \ t85_decode.c \ t85_encode.c \ - t38_terminal.c \ testcpuid.c \ time_scale.c \ timezone.c \ diff --git a/libs/spandsp/src/dtmf.c b/libs/spandsp/src/dtmf.c index ac1656360e..ee61f0095c 100644 --- a/libs/spandsp/src/dtmf.c +++ b/libs/spandsp/src/dtmf.c @@ -372,9 +372,9 @@ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s, SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s, int filter_dialtone, - int twist, - int reverse_twist, - int threshold) + float twist, + float reverse_twist, + float threshold) { float x; diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c index ce28fde882..abe25675ce 100644 --- a/libs/spandsp/src/fax.c +++ b/libs/spandsp/src/fax.c @@ -74,12 +74,8 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#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 @@ -112,12 +108,8 @@ #include "spandsp/private/hdlc.h" #include "spandsp/private/fax_modems.h" #include "spandsp/private/timezone.h" -#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 @@ -547,6 +539,16 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &fsk_tx, &t->v21_tx); t->transmit = TRUE; break; + case T30_MODEM_V17: + silence_gen_alter(&t->silence_gen, ms_to_samples(75)); + /* For any fast modem, set 200ms of preamble flags */ + hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); + v17_tx_restart(&t->fast_modems.v17_tx, bit_rate, t->use_tep, short_train); + v17_tx_set_get_bit(&t->fast_modems.v17_tx, get_bit_func, get_bit_user_data); + fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); + fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx); + t->transmit = TRUE; + break; case T30_MODEM_V27TER: silence_gen_alter(&t->silence_gen, ms_to_samples(75)); /* For any fast modem, set 200ms of preamble flags */ @@ -567,16 +569,6 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx); t->transmit = TRUE; break; - case T30_MODEM_V17: - silence_gen_alter(&t->silence_gen, ms_to_samples(75)); - /* For any fast modem, set 200ms of preamble flags */ - hdlc_tx_flags(&t->hdlc_tx, bit_rate/(8*5)); - v17_tx_restart(&t->fast_modems.v17_tx, bit_rate, t->use_tep, short_train); - v17_tx_set_get_bit(&t->fast_modems.v17_tx, get_bit_func, get_bit_user_data); - fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &t->silence_gen); - fax_modems_set_next_tx_handler(s, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx); - t->transmit = TRUE; - break; case T30_MODEM_DONE: span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n"); /* Fall through */ diff --git a/libs/spandsp/src/fax_modems.c b/libs/spandsp/src/fax_modems.c index b3f9878b63..6bc7e05ea8 100644 --- a/libs/spandsp/src/fax_modems.c +++ b/libs/spandsp/src/fax_modems.c @@ -95,13 +95,13 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t am fsk_rx(&s->v21_rx, amp, len); if (s->rx_frame_received) { - /* We have received something, and the fast modem has not trained. We must - be receiving valid V.21 */ + /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); s->rx_handler = (span_rx_handler_t) &fsk_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; } + /*endif*/ return 0; } /*- End of function --------------------------------------------------------*/ @@ -126,13 +126,13 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t fsk_rx(&s->v21_rx, amp, len); if (s->rx_frame_received) { - /* We have received something, and the fast modem has not trained. We must - be receiving valid V.21 */ + /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); s->rx_handler = (span_rx_handler_t) &fsk_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; } + /*endif*/ return 0; } /*- End of function --------------------------------------------------------*/ @@ -157,13 +157,13 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t am fsk_rx(&s->v21_rx, amp, len); if (s->rx_frame_received) { - /* We have received something, and the fast modem has not trained. We must - be receiving valid V.21 */ + /* We have received something, and the fast modem has not trained. We must be receiving valid V.21 */ span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx)); s->rx_handler = (span_rx_handler_t) &fsk_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; } + /*endif*/ return 0; } /*- End of function --------------------------------------------------------*/ @@ -203,6 +203,7 @@ static void v17_rx_status_handler(void *user_data, int status) s->rx_user_data = &s->fast_modems.v17_rx; break; } + /*endswitch*/ } /*- End of function --------------------------------------------------------*/ @@ -220,6 +221,7 @@ static void v27ter_rx_status_handler(void *user_data, int status) s->rx_user_data = &s->fast_modems.v27ter_rx; break; } + /*endswitch*/ } /*- End of function --------------------------------------------------------*/ @@ -237,6 +239,7 @@ static void v29_rx_status_handler(void *user_data, int status) s->rx_user_data = &s->fast_modems.v29_rx; break; } + /*endswitch*/ } /*- End of function --------------------------------------------------------*/ @@ -254,6 +257,7 @@ SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which) v29_rx_set_modem_status_handler(&s->fast_modems.v29_rx, v29_rx_status_handler, s); break; } + /*endswitch*/ fsk_rx_set_modem_status_handler(&s->v21_rx, v21_rx_status_handler, s); } /*- End of function --------------------------------------------------------*/ @@ -290,6 +294,7 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, if ((s = (fax_modems_state_t *) malloc(sizeof(*s))) == NULL) return NULL; } + /*endif*/ memset(s, 0, sizeof(*s)); s->use_tep = use_tep; @@ -314,6 +319,7 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, tone_callback, user_data); } + /*endif*/ dc_restore_init(&s->dc_restore); s->rx_signal_present = FALSE; diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c index beba3dab07..d21b5b9d81 100644 --- a/libs/spandsp/src/image_translate.c +++ b/libs/spandsp/src/image_translate.c @@ -57,12 +57,8 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#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 @@ -74,12 +70,8 @@ #include "spandsp/image_translate.h" #include "spandsp/private/logging.h" -#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 diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index 90e77cd5ef..0cb5fd3a73 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -35,7 +35,6 @@ @SPANDSP_SUPPORT_T42@ @SPANDSP_SUPPORT_T43@ -@SPANDSP_SUPPORT_T85@ @SPANDSP_SUPPORT_V34@ #include diff --git a/libs/spandsp/src/spandsp/dtmf.h b/libs/spandsp/src/spandsp/dtmf.h index 161131355f..a9aeb64ef9 100644 --- a/libs/spandsp/src/spandsp/dtmf.h +++ b/libs/spandsp/src/spandsp/dtmf.h @@ -152,15 +152,15 @@ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s, \param s The DTMF receiver context. \param filter_dialtone TRUE to enable filtering of dialtone, FALSE to disable, < 0 to leave unchanged. - \param twist Acceptable twist, in dB. < 0 to leave unchanged. - \param reverse_twist Acceptable reverse twist, in dB. < 0 to leave unchanged. + \param twist Acceptable twist, in dB. < 0.0 to leave unchanged. + \param reverse_twist Acceptable reverse twist, in dB. < 0.0 to leave unchanged. \param threshold The minimum acceptable tone level for detection, in dBm0. - <= -99 to leave unchanged. */ + <= -99.0 to leave unchanged. */ SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s, int filter_dialtone, - int twist, - int reverse_twist, - int threshold); + float twist, + float reverse_twist, + float threshold); /*! Process a block of received DTMF audio samples. \brief Process a block of received DTMF audio samples. diff --git a/libs/spandsp/src/spandsp/private/fsk.h b/libs/spandsp/src/spandsp/private/fsk.h index c1c1720157..3d3a5333b1 100644 --- a/libs/spandsp/src/spandsp/private/fsk.h +++ b/libs/spandsp/src/spandsp/private/fsk.h @@ -88,7 +88,7 @@ struct fsk_rx_state_s int buf_ptr; int frame_state; - int frame_bits; + unsigned int frame_bits; int baud_phase; int last_bit; int scaling_shift; diff --git a/libs/spandsp/src/spandsp/private/t30.h b/libs/spandsp/src/spandsp/private/t30.h index a8f23c0197..1fede6ed79 100644 --- a/libs/spandsp/src/spandsp/private/t30.h +++ b/libs/spandsp/src/spandsp/private/t30.h @@ -37,8 +37,8 @@ struct t30_state_s /*! \brief T.4 context for reading or writing image data. */ union { - t4_state_t rx; - t4_state_t tx; + t4_rx_state_t rx; + t4_tx_state_t tx; } t4; /*! \brief The type of FAX operation currently in progress */ int operation_in_progress; diff --git a/libs/spandsp/src/spandsp/private/t4_rx.h b/libs/spandsp/src/spandsp/private/t4_rx.h index 10ed0cf983..4dc2b21e21 100644 --- a/libs/spandsp/src/spandsp/private/t4_rx.h +++ b/libs/spandsp/src/spandsp/private/t4_rx.h @@ -36,37 +36,97 @@ typedef struct /*! \brief The libtiff context for the current TIFF file */ TIFF *tiff_file; + /*! Image type - bilevel, gray, colour */ + int image_type; /*! \brief The compression type for output to the TIFF file. */ - int32_t output_compression; + int output_encoding; /*! \brief The TIFF photometric setting for the current page. */ uint16_t photo_metric; /*! \brief The TIFF fill order setting for the current page. */ uint16_t fill_order; - /*! \brief The TIFF G3 FAX options. */ - int32_t output_t4_options; /*! \brief The number of pages in the current image file. */ int pages_in_file; + /*! \brief The time at which handling of the current page began. */ + time_t page_start_time; + + /*! \brief A point to the image buffer. */ + uint8_t *image_buffer; + /*! \brief The size of the image in the image buffer, in bytes. */ + int image_size; + /*! \brief The current size of the image buffer. */ + int image_buffer_size; +} t4_rx_tiff_state_t; + +/*! + T.4 FAX decompression metadata descriptor. This contains information about the image + which may be relevant to the backend, but is not relevant to the image decoding process. +*/ +typedef struct +{ + /*! \brief Column-to-column (X) resolution in pixels per metre. */ + int x_resolution; + /*! \brief Row-to-row (Y) resolution in pixels per metre. */ + int y_resolution; + /* "Background" information about the FAX, which can be stored in the image file. */ /*! \brief The vendor of the machine which produced the file. */ const char *vendor; /*! \brief The model of machine which produced the file. */ const char *model; - /*! \brief The local ident string. */ - const char *local_ident; /*! \brief The remote end's ident string. */ const char *far_ident; /*! \brief The FAX sub-address. */ const char *sub_address; /*! \brief The FAX DCS information, as an ASCII hex string. */ const char *dcs; +} t4_rx_metadata_t; - /*! \brief The first page to transfer. -1 to start at the beginning of the file. */ - int start_page; - /*! \brief The last page to transfer. -1 to continue to the end of the file. */ - int stop_page; -} t4_tiff_state_t; +/*! + T.4 FAX decompression descriptor. This defines the working state + for a single instance of a T.4 FAX decompression channel. +*/ +struct t4_rx_state_s +{ + /*! \brief Callback function to write a row of pixels to the image destination. */ + t4_row_write_handler_t row_handler; + /*! \brief Opaque pointer passed to row_write_handler. */ + void *row_handler_user_data; + + /*! \brief The number of pages transferred to date. */ + int current_page; + + /*! \brief The size of the compressed image on the line side, in bits. */ + int line_image_size; + + /*! \brief The type of compression used between the FAX machines. */ + int line_encoding; + + /*! \brief The width of the current page, in pixels. */ + uint32_t image_width; + + union + { + t4_t6_decode_state_t t4_t6; +#if defined(SPANDSP_SUPPORT_T42) + t42_decode_state_t t42; +#endif +#if defined(SPANDSP_SUPPORT_T43) + t43_decode_state_t t43; +#endif + t85_decode_state_t t85; + } decoder; + + /* Supporting information, like resolutions, which the backend may want. */ + t4_rx_metadata_t metadata; + + /*! \brief All TIFF file specific state information for the T.4 context. */ + t4_rx_tiff_state_t tiff; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/private/t4_t6_decode.h b/libs/spandsp/src/spandsp/private/t4_t6_decode.h index 1b15fc7f61..90b4e72d66 100644 --- a/libs/spandsp/src/spandsp/private/t4_t6_decode.h +++ b/libs/spandsp/src/spandsp/private/t4_t6_decode.h @@ -31,18 +31,36 @@ */ struct t4_t6_decode_state_s { - /*! \brief The type of compression used between the FAX machines. */ - //int encoding; - /*! \brief Width of the current page, in pixels. */ - //int image_width; - /*! \brief Callback function to write a row of pixels to the image destination. */ t4_row_write_handler_t row_write_handler; /*! \brief Opaque pointer passed to row_write_handler. */ void *row_write_user_data; - /*! \brief A pointer into the image buffer indicating where the last row begins */ - int last_row_starts_at; + /*! \brief The type of compression used between the FAX machines. */ + int encoding; + /*! \brief Width of the current page, in pixels. */ + int image_width; + + /*! \brief Length of the current page, in pixels. */ + int image_length; + /*! \brief The current number of bytes per row of uncompressed image data. */ + int bytes_per_row; + + /*! \brief The current number of bits in the current encoded row. */ + int row_bits; + /*! \brief Pointer to the buffer for the current pixel row. */ + uint8_t *row_buf; + + /*! \brief This variable is set if we are treating the current row as a 2D encoded + one. */ + int row_is_2d; + /*! \brief The current length of the current row. */ + int row_len; + + /*! \brief Black and white run-lengths for the current row. */ + uint32_t *cur_runs; + /*! \brief Black and white run-lengths for the reference row. */ + uint32_t *ref_runs; /*! \brief This variable is used to count the consecutive EOLS we have seen. If it reaches six, this is the end of the image. It is initially set to -1 for @@ -64,7 +82,7 @@ struct t4_t6_decode_state_s /*! \brief 2D horizontal mode control. */ int black_white; /*! \brief TRUE if the current run is black */ - int its_black; + int in_black; /*! \brief The current step into the current row run-lengths buffer. */ int a_cursor; @@ -78,14 +96,18 @@ struct t4_t6_decode_state_s /*! \brief The number of bits to be skipped before trying to match the next code word. */ int rx_skip_bits; - /*! \brief Decoded pixel buffer. */ - //uint32_t pixel_stream; - /*! \brief The number of bits currently in pixel_stream. */ - //int tx_bits; + /*! \brief Decoded pixel stream buffer. */ + uint32_t pixel_stream; + /*! \brief The number of pixels currently in pixel_stream. */ + int pixels; - /*! \brief Current pixel row number. */ - //int row; + /*! \brief The minimum bits in any row of the current page. For monitoring only. */ + int min_row_bits; + /*! \brief The maximum bits in any row of the current page. For monitoring only. */ + int max_row_bits; + /*! \brief The size of the compressed image, in bits. */ + int compressed_image_size; /*! \brief The current number of consecutive bad rows. */ int curr_bad_row_run; /*! \brief The longest run of consecutive bad rows seen in the current page. */ @@ -94,7 +116,7 @@ struct t4_t6_decode_state_s int bad_rows; /*! \brief Error and flow logging control */ - //logging_state_t logging; + logging_state_t logging; }; #endif diff --git a/libs/spandsp/src/spandsp/private/t4_t6_encode.h b/libs/spandsp/src/spandsp/private/t4_t6_encode.h index 40d750b732..ea080109aa 100644 --- a/libs/spandsp/src/spandsp/private/t4_t6_encode.h +++ b/libs/spandsp/src/spandsp/private/t4_t6_encode.h @@ -31,28 +31,66 @@ */ struct t4_t6_encode_state_s { + /*! \brief Callback function to read a row of pixels from the image source. */ + t4_row_read_handler_t row_read_handler; + /*! \brief Opaque pointer passed to row_read_handler. */ + void *row_read_user_data; + + /*! \brief The type of compression used. */ + int encoding; + /*! \brief Width of the current page, in pixels. */ + int image_width; /*! \brief The minimum number of encoded bits per row. This is a timing thing for hardware FAX machines. */ int min_bits_per_row; /*! \brief The current maximum contiguous rows that may be 2D encoded. */ int max_rows_to_next_1d_row; + /*! \brief Length of the current page, in pixels. */ + int image_length; + /*! \brief The current number of bytes per row of uncompressed image data. */ + int bytes_per_row; + /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row must be used. */ int rows_to_next_1d_row; + /*! \brief The current number of bits in the current encoded row. */ + int row_bits; + /*! \brief This variable is set if we are treating the current row as a 2D encoded + one. */ + int row_is_2d; + + /*! \brief Encoded data bits buffer. */ + uint32_t tx_bitstream; + /*! \brief The number of bits currently in tx_bitstream. */ + int tx_bits; + /*! \brief The working chunk of the output bit stream */ + uint8_t *bitstream; + /*! \brief Input pointer to the output bit stream buffer. */ + int bitstream_iptr; + /*! \brief Output pointer to the output bit stream buffer. */ + int bitstream_optr; + /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */ + int bit_pos; + + /*! \brief Black and white run-lengths for the current row. */ + uint32_t *cur_runs; + /*! \brief Black and white run-lengths for the reference row. */ + uint32_t *ref_runs; /*! \brief The number of runs currently in the reference row. */ int ref_steps; - /*! \brief Pointer to the byte containing the next image bit to transmit. */ - int bit_pos; - /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */ - int bit_ptr; + /*! \brief The minimum bits in any row of the current page. For monitoring only. */ + int min_row_bits; + /*! \brief The maximum bits in any row of the current page. For monitoring only. */ + int max_row_bits; - /*! \brief Callback function to read a row of pixels from the image source. */ - t4_row_read_handler_t row_read_handler; - /*! \brief Opaque pointer passed to row_read_handler. */ - void *row_read_user_data; + /*! \brief The size of the compressed image, in bits. */ + int compressed_image_size; + + /*! \brief Error and flow logging control */ + logging_state_t logging; }; #endif diff --git a/libs/spandsp/src/spandsp/private/t4_tx.h b/libs/spandsp/src/spandsp/private/t4_tx.h index d56c392afc..ffa3c342d8 100644 --- a/libs/spandsp/src/spandsp/private/t4_tx.h +++ b/libs/spandsp/src/spandsp/private/t4_tx.h @@ -27,20 +27,75 @@ #define _SPANDSP_PRIVATE_T4_TX_H_ /*! - T.4 FAX compression/decompression descriptor. This defines the working state - for a single instance of a T.4 FAX compression or decompression channel. + TIFF specific state information to go with T.4 compression or decompression handling. */ -struct t4_state_s +typedef struct { - /*! \brief The same structure is used for T.4 transmit and receive. This variable - records which mode is in progress. */ - int rx; + /*! \brief The current file name. */ + const char *file; + /*! \brief The libtiff context for the current TIFF file */ + TIFF *tiff_file; + + /*! Image type - bilevel, gray, colour */ + int image_type; + /*! \brief The TIFF photometric setting for the current page. */ + uint16_t photo_metric; + /*! \brief The TIFF fill order setting for the current page. */ + uint16_t fill_order; + + /*! \brief The number of pages in the current image file. */ + int pages_in_file; + + /*! \brief A pointer to the image buffer. */ + uint8_t *image_buffer; + /*! \brief The size of the image in the image buffer, in bytes. */ + int image_size; + /*! \brief The current size of the image buffer. */ + int image_buffer_size; + /*! \brief Row counter for playing out the rows of the image. */ + int row; +} t4_tx_tiff_state_t; + +/*! + T.4 FAX compression metadata descriptor. This contains information about the image + which may be relevant to the backend, but is not generally relevant to the image + encoding process. The exception here is the y-resolution, which is used in T.4 2-D + encoding for non-ECM applications, to optimise the balance of density and robustness. +*/ +typedef struct +{ + /*! \brief Column-to-column (X) resolution in pixels per metre. */ + int x_resolution; + /*! \brief Row-to-row (Y) resolution in pixels per metre. */ + int y_resolution; +} t4_tx_metadata_t; + +/*! + T.4 FAX compression descriptor. This defines the working state + for a single instance of a T.4 FAX compression channel. +*/ +struct t4_tx_state_s +{ + /*! \brief Callback function to read a row of pixels from the image source. */ + t4_row_read_handler_t row_handler; + /*! \brief Opaque pointer passed to row_read_handler. */ + void *row_handler_user_data; /*! \brief The type of compression used between the FAX machines. */ int line_encoding; - /*! \brief The time at which handling of the current page began. */ - time_t page_start_time; + /*! \brief The width of the current page, in pixels. */ + uint32_t image_width; + /*! \brief The length of the current page, in pixels. */ + uint32_t image_length; + + /*! \brief The size of the compressed image on the line side, in bits. */ + int line_image_size; + + /*! \brief The first page to transfer. -1 to start at the beginning of the file. */ + int start_page; + /*! \brief The last page to transfer. -1 to continue to the end of the file. */ + int stop_page; /*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the page image. FALSE for FAX page headers to add to the overall length of @@ -49,66 +104,42 @@ struct t4_state_s /*! \brief The text which will be used in FAX page header. No text results in no header line. */ const char *header_info; - /*! \brief Optional per instance time zone for the FAX page header timestamp. */ - struct tz_s *tz; - - /*! \brief The size of the compressed image on the line side, in bits. */ - int line_image_size; - - /*! \brief The current number of bytes per row of uncompressed image data. */ - int bytes_per_row; - /*! \brief The size of the image in the image buffer, in bytes. */ - int image_size; - /*! \brief The current size of the image buffer. */ - int image_buffer_size; - /*! \brief A point to the image buffer. */ - uint8_t *image_buffer; - - /*! \brief The number of pages transferred to date. */ + /*! \brief The local ident string. This is used with header_info to form a + page header line. */ + const char *local_ident; + /*! \brief The page number of current page. The first page is zero. If FAX page + headers are used, the page number in the header will be one more than + this value (i.e. they start from 1). */ int current_page; - /*! \brief Column-to-column (X) resolution in pixels per metre. */ - int x_resolution; - /*! \brief Row-to-row (Y) resolution in pixels per metre. */ - int y_resolution; - /*! \brief Width of the current page, in pixels. */ - int image_width; - /*! \brief Length of the current page, in pixels. */ - int image_length; - /*! \brief Current pixel row number. */ - int row; - /*! \brief This variable is set if we are treating the current row as a 2D encoded - one. */ - int row_is_2d; - /*! \brief The current length of the current row. */ - int row_len; + /*! \brief The composed text of the FAX page header, if there is one. */ + char *header_text; + /*! \brief Optional per instance time zone for the FAX page header timestamp. */ + tz_t *tz; - /*! \brief Black and white run-lengths for the current row. */ - uint32_t *cur_runs; - /*! \brief Black and white run-lengths for the reference row. */ - uint32_t *ref_runs; - /*! \brief Pointer to the buffer for the current pixel row. */ - uint8_t *row_buf; + /*! \brief Row counter for playing out the rows of the header line. */ + int header_row; - /*! \brief Encoded data bits buffer. */ - uint32_t tx_bitstream; - /*! \brief The number of bits currently in tx_bitstream. */ - int tx_bits; + union + { + t4_t6_encode_state_t t4_t6; +#if defined(SPANDSP_SUPPORT_T42) + t42_encode_state_t t42; +#endif +#if defined(SPANDSP_SUPPORT_T43) + t43_encode_state_t t43; +#endif + t85_encode_state_t t85; + } encoder; - /*! \brief The current number of bits in the current encoded row. */ - int row_bits; - /*! \brief The minimum bits in any row of the current page. For monitoring only. */ - int min_row_bits; - /*! \brief The maximum bits in any row of the current page. For monitoring only. */ - int max_row_bits; + /* Supporting information, like resolutions, which the backend may want. */ + t4_tx_metadata_t metadata; + + /*! \brief All TIFF file specific state information for the T.4 context. */ + t4_tx_tiff_state_t tiff; /*! \brief Error and flow logging control */ logging_state_t logging; - - /*! \brief All TIFF file specific state information for the T.4 context. */ - t4_tiff_state_t tiff; - t4_t6_decode_state_t t4_t6_rx; - t4_t6_encode_state_t t4_t6_tx; }; #endif diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index 004c75c840..8ff1e286e0 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -203,7 +203,7 @@ typedef enum T.4 FAX compression/decompression descriptor. This defines the working state for a single instance of a T.4 FAX compression or decompression channel. */ -typedef struct t4_state_s t4_state_t; +typedef struct t4_rx_state_s t4_rx_state_t; /*! T.4 FAX compression/decompression statistics. @@ -241,108 +241,109 @@ extern "C" { \param file The name of the file to be received. \param output_encoding The output encoding. \return A pointer to the context, or NULL if there was a problem. */ -SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding); +SPAN_DECLARE(t4_rx_state_t *) t4_rx_init(t4_rx_state_t *s, const char *file, int output_encoding); /*! \brief Prepare to receive the next page of the current document. \param s The T.4 context. \return zero for success, -1 for failure. */ -SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s); +SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s); /*! \brief Put a bit of the current document page. \param s The T.4 context. \param bit The data bit. \return TRUE when the bit ends the document page, otherwise FALSE. */ -SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit); +SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit); /*! \brief Put a byte of the current document page. \param s The T.4 context. \param byte The data byte. \return TRUE when the byte ends the document page, otherwise FALSE. */ -SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte); +SPAN_DECLARE(int) t4_rx_put_byte(t4_rx_state_t *s, uint8_t byte); /*! \brief Put a byte of the current document page. \param s The T.4 context. \param buf The buffer containing the chunk. \param len The length of the chunk. \return TRUE when the byte ends the document page, otherwise FALSE. */ -SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len); +SPAN_DECLARE(int) t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len); /*! \brief Complete the reception of a page. \param s The T.4 receive context. \return 0 for success, otherwise -1. */ -SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s); +SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s); /*! \brief End reception of a document. Tidy up and close the file. This should be used to end T.4 reception started with t4_rx_init. \param s The T.4 receive context. \return 0 for success, otherwise -1. */ -SPAN_DECLARE(int) t4_rx_release(t4_state_t *s); +SPAN_DECLARE(int) t4_rx_release(t4_rx_state_t *s); /*! \brief End reception of a document. Tidy up, close the file and free the context. This should be used to end T.4 reception started with t4_rx_init. \param s The T.4 receive context. \return 0 for success, otherwise -1. */ -SPAN_DECLARE(int) t4_rx_free(t4_state_t *s); +SPAN_DECLARE(int) t4_rx_free(t4_rx_state_t *s); /*! \brief Set the row write handler for a T.4 receive context. \param s The T.4 receive context. \param handler A pointer to the handler routine. \param user_data An opaque pointer passed to the handler routine. \return 0 for success, otherwise -1. */ -SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data); +SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_handler_t handler, void *user_data); /*! \brief Set the encoding for the received data. \param s The T.4 context. - \param encoding The encoding. */ -SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding); + \param encoding The encoding. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding); /*! \brief Set the expected width of the received image, in pixel columns. \param s The T.4 context. \param width The number of pixels across the image. */ -SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width); +SPAN_DECLARE(void) t4_rx_set_image_width(t4_rx_state_t *s, int width); /*! \brief Set the row-to-row (y) resolution to expect for a received image. \param s The T.4 context. \param resolution The resolution, in pixels per metre. */ -SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution); +SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_rx_state_t *s, int resolution); /*! \brief Set the column-to-column (x) resolution to expect for a received image. \param s The T.4 context. \param resolution The resolution, in pixels per metre. */ -SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution); +SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_rx_state_t *s, int resolution); /*! \brief Set the DCS information of the fax, for inclusion in the file. \param s The T.4 context. \param dcs The DCS information, formatted as an ASCII string. */ -SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs); +SPAN_DECLARE(void) t4_rx_set_dcs(t4_rx_state_t *s, const char *dcs); /*! \brief Set the sub-address of the fax, for inclusion in the file. \param s The T.4 context. \param sub_address The sub-address string. */ -SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address); +SPAN_DECLARE(void) t4_rx_set_sub_address(t4_rx_state_t *s, const char *sub_address); /*! \brief Set the identity of the remote machine, for inclusion in the file. \param s The T.4 context. \param ident The identity string. */ -SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident); +SPAN_DECLARE(void) t4_rx_set_far_ident(t4_rx_state_t *s, const char *ident); /*! \brief Set the vendor of the remote machine, for inclusion in the file. \param s The T.4 context. \param vendor The vendor string, or NULL. */ -SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor); +SPAN_DECLARE(void) t4_rx_set_vendor(t4_rx_state_t *s, const char *vendor); /*! \brief Set the model of the remote machine, for inclusion in the file. \param s The T.4 context. \param model The model string, or NULL. */ -SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model); +SPAN_DECLARE(void) t4_rx_set_model(t4_rx_state_t *s, const char *model); /*! Get the current image transfer statistics. \brief Get the current transfer statistics. \param s The T.4 context. \param t A pointer to a statistics structure. */ -SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t); +SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t); /*! Get the short text name of an encoding format. \brief Get the short text name of an encoding format. diff --git a/libs/spandsp/src/spandsp/t4_t6_decode.h b/libs/spandsp/src/spandsp/t4_t6_decode.h index 860d4ecea9..f84293b9b3 100644 --- a/libs/spandsp/src/spandsp/t4_t6_decode.h +++ b/libs/spandsp/src/spandsp/t4_t6_decode.h @@ -45,6 +45,72 @@ typedef struct t4_t6_decode_state_s t4_t6_decode_state_t; extern "C" { #endif +/*! \brief Put a bit of the current document page. + \param s The T.4/T.6 context. + \param bit The data bit. + \return TRUE when the bit ends the document page, otherwise FALSE. */ +SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit); + +/*! \brief Put a byte of the current document page. + \param s The T.4/T.6 context. + \param byte The data byte. + \return TRUE when the byte ends the document page, otherwise FALSE. */ +SPAN_DECLARE(int) t4_t6_decode_put_byte(t4_t6_decode_state_t *s, int byte); + +/*! \brief Put a byte of the current document page. + \param s The T.4/T.6 context. + \param buf The buffer containing the chunk. + \param len The length of the chunk. + \return TRUE when the byte ends the document page, otherwise FALSE. */ +SPAN_DECLARE(int) t4_t6_decode_put_chunk(t4_t6_decode_state_t *s, const uint8_t buf[], int len); + +/*! \brief Set the row write handler for a T.4/T.6 decode context. + \param s The T.4/T.6 context. + \param handler A pointer to the handler routine. + \param user_data An opaque pointer passed to the handler routine. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_t6_decode_set_row_write_handler(t4_t6_decode_state_t *s, t4_row_write_handler_t handler, void *user_data); + +/*! \brief Set the encoding for the encoded data. + \param s The T.4/T.6 context. + \param encoding The encoding. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_t6_decode_set_encoding(t4_t6_decode_state_t *s, int encoding); + +/*! \brief Get the width of the image. + \param s The T.4/T.6 context. + \return The width of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t4_t6_decode_get_image_width(t4_t6_decode_state_t *s); + +/*! \brief Get the length of the image. + \param s The T.4/T.6 context. + \return The length of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t4_t6_decode_get_image_length(t4_t6_decode_state_t *s); + +/*! \brief Get the size of the compressed image, in bits. + \param s The T.4/T.6 context. + \return The size of the compressed image, in bits. */ +SPAN_DECLARE(int) t4_t6_decode_get_compressed_image_size(t4_t6_decode_state_t *s); + +SPAN_DECLARE(int) t4_t6_decode_restart(t4_t6_decode_state_t *s, int image_width); + +/*! \brief Prepare to decode an image in T.4 or T.6 format. + \param s The T.4/T.6 context. + \param encoding The encoding mode. + \param image width The image width, in pixels. + \param handler A callback routine to handle decoded image rows. + \param user_data An opaque pointer passed to handler. + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(t4_t6_decode_state_t *) t4_t6_decode_init(t4_t6_decode_state_t *s, + int encoding, + int image_width, + t4_row_write_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t4_t6_decode_release(t4_t6_decode_state_t *s); + +SPAN_DECLARE(int) t4_t6_decode_free(t4_t6_decode_state_t *s); + #if defined(__cplusplus) } #endif diff --git a/libs/spandsp/src/spandsp/t4_t6_encode.h b/libs/spandsp/src/spandsp/t4_t6_encode.h index 72a3598bcb..975b68ce21 100644 --- a/libs/spandsp/src/spandsp/t4_t6_encode.h +++ b/libs/spandsp/src/spandsp/t4_t6_encode.h @@ -34,6 +34,111 @@ typedef struct t4_t6_encode_state_s t4_t6_encode_state_t; extern "C" { #endif +/*! \brief Return the next bit of the current document page, without actually + moving forward in the buffer. The document will be padded for the + current minimum scan line time. + \param s The T.4/T.6 context. + \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is + set (i.e. the returned value is 2 or 3). */ +SPAN_DECLARE(int) t4_t6_encode_check_bit(t4_t6_encode_state_t *s); + +/*! \brief Get the next bit of the current image. The image will + be padded for the current minimum scan line time. + \param s The T.4/T.6 context. + \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is + set (i.e. the returned value is 2 or 3). */ +SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s); + +/*! \brief Get the next byte of the current document page. The document will + be padded for the current minimum scan line time. + \param s The T.4/T.6 context. + \return The next byte. For the last byte of data, bit 8 is + set. In this case, one or more bits of the byte may be padded with + zeros, to complete the byte. */ +SPAN_DECLARE(int) t4_t6_encode_get_byte(t4_t6_encode_state_t *s); + +/*! \brief Get the next chunk of the current document page. The document will + be padded for the current minimum scan line time. + \param s The T.4/T.6 context. + \param buf The buffer into which the chunk is to written. + \param max_len The maximum length of the chunk. + \return The actual length of the chunk. If this is less than max_len it + indicates that the end of the document has been reached. */ +SPAN_DECLARE(int) t4_t6_encode_get_chunk(t4_t6_encode_state_t *s, uint8_t buf[], int max_len); + +/*! \brief Set the row read handler for a T.4/T.6 encode context. + \param s The T.4/T.6 context. + \param handler A pointer to the handler routine. + \param user_data An opaque pointer passed to the handler routine. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_t6_encode_set_row_read_handler(t4_t6_encode_state_t *s, + t4_row_read_handler_t handler, + void *user_data); + +/*! \brief Set the encoding for the encoded data. + \param s The T.4/T.6 context. + \param encoding The encoding. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_t6_encode_set_encoding(t4_t6_encode_state_t *s, int encoding); + +/*! \brief Set the width of the image. + \param s The T.4/T.6 context. + \param image_width The image width, in pixels. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_t6_encode_set_image_width(t4_t6_encode_state_t *s, int image_width); + +/*! \brief Get the width of the image. + \param s The T.4/T.6 context. + \return The width of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t4_t6_encode_get_image_width(t4_t6_encode_state_t *s); + +/*! \brief Get the length of the image. + \param s The T.4/T.6 context. + \return The length of the image, in pixels. */ +SPAN_DECLARE(uint32_t) t4_t6_encode_get_image_length(t4_t6_encode_state_t *s); + +/*! \brief Get the size of the compressed image, in bits. + \param s The T.4/T.6 context. + \return The size of the compressed image, in bits. */ +SPAN_DECLARE(int) t4_t6_encode_get_compressed_image_size(t4_t6_encode_state_t *s); + +/*! \brief Set the minimum number of encoded bits per row. This allows the + makes the encoding process to be set to comply with the minimum row + time specified by a remote receiving machine. + \param s The T.4/T.6 context. + \param bits The minimum number of bits per row. */ +SPAN_DECLARE(void) t4_t6_encode_set_min_bits_per_row(t4_t6_encode_state_t *s, int bits); + +/*! \brief Set the maximum number of 2D encoded rows between 1D encoded rows. This + is only valid for T.4 2D encoding. + \param s The T.4/T.6 context. + \param max The "K" parameter defined in the T.4 specification. This means the value is one + greater than the maximum number of 2D rows between each 1D row. */ +SPAN_DECLARE(void) t4_t6_encode_set_max_2d_rows_per_1d_row(t4_t6_encode_state_t *s, int max); + +/*! \brief Restart a T.4 or T.6 encode context. + \param s The T.4/T.6 context. + \param image width The image width, in pixels. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_t6_encode_restart(t4_t6_encode_state_t *s, int image_width); + +/*! \brief Prepare to encode an image in T.4 or T.6 format. + \param s The T.4/T.6 context. + \param encoding The encoding mode. + \param image width The image width, in pixels. + \param handler A callback routine to handle decoded image rows. + \param user_data An opaque pointer passed to handler. + \return A pointer to the context, or NULL if there was a problem. */ +SPAN_DECLARE(t4_t6_encode_state_t *) t4_t6_encode_init(t4_t6_encode_state_t *s, + int encoding, + int image_width, + t4_row_read_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t4_t6_encode_release(t4_t6_encode_state_t *s); + +SPAN_DECLARE(int) t4_t6_encode_free(t4_t6_encode_state_t *s); + #if defined(__cplusplus) } #endif diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h index 6a10588e3e..8bb4d035ee 100644 --- a/libs/spandsp/src/spandsp/t4_tx.h +++ b/libs/spandsp/src/spandsp/t4_tx.h @@ -28,13 +28,19 @@ #if !defined(_SPANDSP_T4_TX_H_) #define _SPANDSP_T4_TX_H_ -//#define SPANDSP_SUPPORT_TIFF_FX +#define SPANDSP_SUPPORT_TIFF_FX /*! This function is a callback from the image decoders, to read the unencoded bi-level image, row by row. It is called for each row, with len set to the number of bytes per row expected. \return len for OK, or zero to indicate the end of the image data. */ typedef int (*t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len); +/*! + T.4 FAX compression/decompression descriptor. This defines the working state + for a single instance of a T.4 FAX compression or decompression channel. +*/ +typedef struct t4_tx_state_s t4_tx_state_t; + #if defined(SPANDSP_SUPPORT_TIFF_FX) /* TIFF-FX related extensions to the tag set supported by libtiff */ @@ -217,17 +223,17 @@ SPAN_DECLARE(void) TIFF_FX_init(void); \param start_page The first page to send. -1 for no restriction. \param stop_page The last page to send. -1 for no restriction. \return A pointer to the context, or NULL if there was a problem. */ -SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page); +SPAN_DECLARE(t4_tx_state_t *) t4_tx_init(t4_tx_state_t *s, const char *file, int start_page, int stop_page); /*! \brief Prepare to send the next page of the current document. \param s The T.4 context. \return zero for success, -1 for failure. */ -SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s); /*! \brief Prepare the current page for a resend. \param s The T.4 context. \return zero for success, -1 for failure. */ -SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_restart_page(t4_tx_state_t *s); /*! \brief Check for the existance of the next page, and whether its format is like the current one. This information can be needed before it is determined that the current @@ -236,12 +242,12 @@ SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s); \return 0 for next page found with the same format as the current page. 1 for next page found with different format from the current page. -1 for no page found, or file failure. */ -SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_tx_state_t *s); /*! \brief Complete the sending of a page. \param s The T.4 context. \return zero for success, -1 for failure. */ -SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_end_page(t4_tx_state_t *s); /*! \brief Return the next bit of the current document page, without actually moving forward in the buffer. The document will be padded for the @@ -249,14 +255,14 @@ SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s); \param s The T.4 context. \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is set (i.e. the returned value is 2 or 3). */ -SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_check_bit(t4_tx_state_t *s); /*! \brief Get the next bit of the current document page. The document will be padded for the current minimum scan line time. \param s The T.4 context. \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is set (i.e. the returned value is 2 or 3). */ -SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s); /*! \brief Get the next byte of the current document page. The document will be padded for the current minimum scan line time. @@ -264,7 +270,7 @@ SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s); \return The next byte. For the last byte of data, bit 8 is set. In this case, one or more bits of the byte may be padded with zeros, to complete the byte. */ -SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_get_byte(t4_tx_state_t *s); /*! \brief Get the next chunk of the current document page. The document will be padded for the current minimum scan line time. @@ -273,37 +279,49 @@ SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s); \param max_len The maximum length of the chunk. \return The actual length of the chunk. If this is less than max_len it indicates that the end of the document has been reached. */ -SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len); +SPAN_DECLARE(int) t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len); /*! \brief End the transmission of a document. Tidy up and close the file. This should be used to end T.4 transmission started with t4_tx_init. \param s The T.4 context. \return 0 for success, otherwise -1. */ -SPAN_DECLARE(int) t4_tx_release(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_release(t4_tx_state_t *s); /*! \brief End the transmission of a document. Tidy up, close the file and free the context. This should be used to end T.4 transmission started with t4_tx_init. \param s The T.4 context. \return 0 for success, otherwise -1. */ -SPAN_DECLARE(int) t4_tx_free(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_free(t4_tx_state_t *s); /*! \brief Set the encoding for the encoded data. \param s The T.4 context. - \param encoding The encoding. */ -SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding); + \param encoding The encoding. + \return 0 for success, otherwise -1. */ +SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding); /*! \brief Set the minimum number of encoded bits per row. This allows the makes the encoding process to be set to comply with the minimum row time specified by a remote receiving machine. \param s The T.4 context. \param bits The minimum number of bits per row. */ -SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_state_t *s, int bits); +SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits); + +/*! \brief Set the width of the image. + \param s The T.4 context. + \param image_width The image width, in pixels. */ +SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width); + +/*! \brief Set the maximum number of 2D encoded rows between 1D encoded rows. This + is only valid for T.4 2D encoding. + \param s The T.4 context. + \param max The maximum number of 2D rows. */ +SPAN_DECLARE(void) t4_tx_set_max_2d_rows_per_1d_row(t4_tx_state_t *s, int max); /*! \brief Set the identity of the local machine, for inclusion in page headers. \param s The T.4 context. \param ident The identity string. */ -SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident); +SPAN_DECLARE(void) t4_tx_set_local_ident(t4_tx_state_t *s, const char *ident); /*! Set the info field, included in the header line included in each page of an encoded FAX. This is a string of up to 50 characters. Other information (date, local ident, etc.) @@ -312,58 +330,58 @@ SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident); \brief Set the header info. \param s The T.4 context. \param info A string, of up to 50 bytes, which will form the info field. */ -SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info); +SPAN_DECLARE(void) t4_tx_set_header_info(t4_tx_state_t *s, const char *info); /*! Set the time zone for the time stamp in page header lines. If this function is not used the current time zone of the program's environment is used. \brief Set the header timezone. \param s The T.4 context. \param tz A time zone descriptor. */ -SPAN_DECLARE(void) t4_tx_set_header_tz(t4_state_t *s, tz_t *tz); +SPAN_DECLARE(void) t4_tx_set_header_tz(t4_tx_state_t *s, tz_t *tz); /*! Set page header extends or overlays the image mode. \brief Set page header overlay mode. \param s The T.4 context. \param header_overlays_image TRUE for overlay, or FALSE for extend the page. */ -SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_state_t *s, int header_overlays_image); +SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_tx_state_t *s, int header_overlays_image); /*! \brief Set the row read handler for a T.4 transmit context. \param s The T.4 transmit context. \param handler A pointer to the handler routine. \param user_data An opaque pointer passed to the handler routine. \return 0 for success, otherwise -1. */ -SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data); +SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, void *user_data); /*! \brief Get the row-to-row (y) resolution of the current page. \param s The T.4 context. \return The resolution, in pixels per metre. */ -SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_tx_state_t *s); /*! \brief Get the column-to-column (x) resolution of the current page. \param s The T.4 context. \return The resolution, in pixels per metre. */ -SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_tx_state_t *s); /*! \brief Get the width of the current page, in pixel columns. \param s The T.4 context. \return The number of columns. */ -SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_get_image_width(t4_tx_state_t *s); /*! \brief Get the number of pages in the file. \param s The T.4 context. \return The number of pages, or -1 if there is an error. */ -SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_tx_state_t *s); /*! \brief Get the currnet page number in the file. \param s The T.4 context. \return The page number, or -1 if there is an error. */ -SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s); +SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_tx_state_t *s); /*! Get the current image transfer statistics. \brief Get the current transfer statistics. \param s The T.4 context. \param t A pointer to a statistics structure. */ -SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t); +SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t); #if defined(__cplusplus) } diff --git a/libs/spandsp/src/spandsp/v18.h b/libs/spandsp/src/spandsp/v18.h index 53da9d099f..bc73c7e619 100644 --- a/libs/spandsp/src/spandsp/v18.h +++ b/libs/spandsp/src/spandsp/v18.h @@ -39,24 +39,59 @@ typedef struct v18_state_s v18_state_t; enum { V18_MODE_NONE = 0, - /* V.18 Annex A - Weitbrecht TDD at 45.45bps, half-duplex, 5 bit baudot. */ + /* V.18 Annex A - Weitbrecht TDD at 45.45bps (US TTY), half-duplex, 5 bit baudot (USA). */ V18_MODE_5BIT_45 = 1, - /* V.18 Annex A - Weitbrecht TDD at 50bps, half-duplex, 5 bit baudot. */ + /* V.18 Annex A - Weitbrecht TDD at 50bps (International TTY), half-duplex, 5 bit baudot (UK, Australia and others). */ V18_MODE_5BIT_50 = 2, - /* V.18 Annex B - DTMF encoding of ASCII. */ + /* V.18 Annex B - DTMF encoding of ASCII (Denmark, Holland and others). */ V18_MODE_DTMF = 3, - /* V.18 Annex C - EDT 110bps, V.21, half-duplex, ASCII. */ + /* V.18 Annex C - EDT (European Deaf Telephone) 110bps, V.21, half-duplex, ASCII (Germany, Austria, Switzerland and others). */ V18_MODE_EDT = 4, - /* V.18 Annex D - 300bps, Bell 103, duplex, ASCII. */ + /* V.18 Annex D - 300bps, Bell 103, duplex, ASCII (USA). */ V18_MODE_BELL103 = 5, - /* V.18 Annex E - 1200bps Videotex terminals, ASCII. */ + /* V.18 Annex E - 1200bps Videotex terminals, ASCII (France). */ V18_MODE_V23VIDEOTEX = 6, - /* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII. */ + /* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII (Sweden, Norway and Finland). */ V18_MODE_V21TEXTPHONE = 7, /* V.18 Annex G - V.18 text telephone mode. */ V18_MODE_V18TEXTPHONE = 8 }; +/* Automoding sequences for different countries */ +enum +{ + /* 5-bit, V.21, V.23, EDT, DTMF, Bell 103 */ + V18_AUTOMODING_AUSTRALIA, + V18_AUTOMODING_IRELAND, + + /* EDT, V.21, V.23, 5-bit, DTMF, Bell 103 */ + V18_AUTOMODING_GERMANY, + V18_AUTOMODING_SWITZERLAND, + V18_AUTOMODING_ITALY, + V18_AUTOMODING_SPAIN, + V18_AUTOMODING_AUSTRIA, + + /* DTMF, V.21, V.23, 5-bit, EDT, Bell 103 */ + V18_AUTOMODING_NETHERLANDS, + + /* V.21, DTMF, 5-bit, EDT, V.23, Bell 103 */ + V18_AUTOMODING_ICELAND, + V18_AUTOMODING_NORWAY, + V18_AUTOMODING_SWEDEN, + V18_AUTOMODING_FINALND, + V18_AUTOMODING_DENMARK, + + /* V.21, 5-bit, V.23, EDT, DTMF, Bell 103 */ + V18_AUTOMODING_UK, + + /* 5-bit, Bell 103, V.21, V.23, EDT, DTMF */ + V18_AUTOMODING_USA, + + /* V.23, EDT, DTMF, 5-bit, V.21, Bell 103 */ + V18_AUTOMODING_FRANCE, + V18_AUTOMODING_BELGIUM +}; + #if defined(__cplusplus) extern "C" { diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index e95a75f15a..5db995ddc7 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -61,12 +61,8 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#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 @@ -83,12 +79,8 @@ #include "spandsp/private/logging.h" #include "spandsp/private/timezone.h" -#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 @@ -398,8 +390,9 @@ static const struct static void queue_phase(t30_state_t *s, int phase); static void set_phase(t30_state_t *s, int phase); static void set_state(t30_state_t *s, int state); -static void send_simple_frame(t30_state_t *s, int type); +static void shut_down_hdlc_tx(t30_state_t *s); static void send_frame(t30_state_t *s, const uint8_t *fr, int frlen); +static void send_simple_frame(t30_state_t *s, int type); static void send_dcn(t30_state_t *s); static void repeat_last_command(t30_state_t *s); static void disconnect(t30_state_t *s); @@ -834,6 +827,13 @@ static void print_frame(t30_state_t *s, const char *io, const uint8_t *msg, int } /*- End of function --------------------------------------------------------*/ +static void shut_down_hdlc_tx(t30_state_t *s) +{ + if (s->send_hdlc_handler) + s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); +} +/*- End of function --------------------------------------------------------*/ + static void send_frame(t30_state_t *s, const uint8_t *msg, int len) { print_frame(s, "Tx: ", msg, len); @@ -1344,7 +1344,6 @@ static int build_dcs(t30_state_t *s) set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; #endif -#if defined(SPANDSP_SUPPORT_T85) case T4_COMPRESSION_ITU_T85: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE); clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); @@ -1355,7 +1354,6 @@ static int build_dcs(t30_state_t *s) set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; -#endif case T4_COMPRESSION_ITU_T6: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T6_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); @@ -1750,9 +1748,7 @@ static int send_dis_or_dtc_sequence(t30_state_t *s, int start) break; case 3: s->step++; - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); break; default: return -1; @@ -1805,9 +1801,7 @@ static int send_dis_or_dtc_sequence(t30_state_t *s, int start) break; case 8: s->step++; - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); break; default: return -1; @@ -1866,9 +1860,7 @@ static int send_dcs_sequence(t30_state_t *s, int start) break; case 7: s->step++; - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); break; default: return -1; @@ -2683,10 +2675,14 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len) int frame_no; uint8_t frame[4]; - if (len != 3 + 32) + if (len != 3 + 256/8) { - span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for PPR bits - %d\n", len); - /* TODO: probably should send DCN */ + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for PPR bits - %d\n", (len - 3)*8); + /* This frame didn't get corrupted in transit, because its CRC is OK. It was sent bad + and there is little possibility that causing a retransmission will help. It is best + to just give up. */ + t30_set_status(s, T30_ERR_TX_ECMPHD); + disconnect(s); return; } /* Check which frames are OK, and mark them as OK. */ @@ -5866,9 +5862,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) case T30_STATE_F_CFR: if (s->step == 0) { - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); s->step++; } else @@ -5890,9 +5884,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) case T30_STATE_F_FTT: if (s->step == 0) { - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); s->step++; } else @@ -5908,9 +5900,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) case T30_STATE_F_POST_RCP_MCF: if (s->step == 0) { - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); s->step++; } else @@ -5962,9 +5952,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) case T30_STATE_IV_CTC: if (s->step == 0) { - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); s->step++; } else @@ -5987,9 +5975,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) case T30_STATE_C: if (s->step == 0) { - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); s->step++; } else @@ -6047,9 +6033,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) { if (send_next_ecm_frame(s)) { - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); s->step++; } } @@ -6068,9 +6052,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) /* This should be the end of a CTR being sent. */ if (s->step == 0) { - /* Shut down HDLC transmission. */ - if (s->send_hdlc_handler) - s->send_hdlc_handler(s->send_hdlc_user_data, NULL, 0); + shut_down_hdlc_tx(s); s->step++; } else diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index c1ee907477..9da3e25bcc 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -61,12 +61,8 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#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 @@ -83,12 +79,8 @@ #include "spandsp/private/logging.h" #include "spandsp/private/timezone.h" -#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 @@ -713,10 +705,8 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c #if defined(SPANDSP_SUPPORT_T43) | T30_SUPPORT_T43_COMPRESSION #endif -#if defined(SPANDSP_SUPPORT_T85) | T30_SUPPORT_T85_COMPRESSION | T30_SUPPORT_T85_L0_COMPRESSION -#endif | 0; s->supported_compressions = supported_compressions & mask; t30_build_dis_or_dtc(s); diff --git a/libs/spandsp/src/t30_logging.c b/libs/spandsp/src/t30_logging.c index 52ab767dfc..9c53b01037 100644 --- a/libs/spandsp/src/t30_logging.c +++ b/libs/spandsp/src/t30_logging.c @@ -61,12 +61,8 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#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 @@ -82,12 +78,8 @@ #include "spandsp/private/logging.h" #include "spandsp/private/timezone.h" -#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 diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 1cf859b997..205bc1b5bb 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -74,12 +74,8 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#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 @@ -110,12 +106,8 @@ #include "spandsp/private/hdlc.h" #include "spandsp/private/fax_modems.h" #include "spandsp/private/timezone.h" -#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 diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index b66e9ce409..675c895a2f 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -64,12 +64,8 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#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 @@ -88,12 +84,8 @@ #include "spandsp/private/logging.h" #include "spandsp/private/timezone.h" -#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 diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index ccb78a7e55..74dd152b7c 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -1,4 +1,3 @@ -//#define T4_STATE_DEBUGGING /* * SpanDSP - a series of DSP components for telephony * @@ -6,7 +5,7 @@ * * Written by Steve Underwood * - * Copyright (C) 2003, 2007 Steve Underwood + * Copyright (C) 2003, 2007, 2010 Steve Underwood * * All rights reserved. * @@ -24,36 +23,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* - * Much of this file is based on the T.4 and T.6 support in libtiff, which requires - * the following notice in any derived source code: - * - * Copyright (c) 1990-1997 Sam Leffler - * Copyright (c) 1991-1997 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - * Decoder support is derived from code in Frank Cringle's viewfax program; - * Copyright (C) 1990, 1995 Frank D. Cringle. - */ - /*! \file */ #if defined(HAVE_CONFIG_H) @@ -85,18 +54,26 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#if defined(SPANDSP_SUPPORT_T85) #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" +#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/version.h" #include "spandsp/private/logging.h" -#if defined(SPANDSP_SUPPORT_T85) #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" +#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" @@ -106,1137 +83,6 @@ /*! The number of centimetres in one inch */ #define CM_PER_INCH 2.54f -/*! The number of EOLs to expect at the end of a T.4 page */ -#define EOLS_TO_END_ANY_RX_PAGE 6 -/*! The number of EOLs to check at the end of a T.4 page */ -#define EOLS_TO_END_T4_RX_PAGE 5 -/*! The number of EOLs to check at the end of a T.6 page */ -#define EOLS_TO_END_T6_RX_PAGE 2 - -#include "t4_t6_decode_states.h" - -#if defined(T4_STATE_DEBUGGING) -static void STATE_TRACE(const char *format, ...) -{ - va_list arg_ptr; - - va_start(arg_ptr, format); - vprintf(format, arg_ptr); - va_end(arg_ptr); -} -/*- End of function --------------------------------------------------------*/ -#else -#define STATE_TRACE(...) /**/ -#endif - -#if defined(HAVE_LIBTIFF) -static int set_tiff_directory_info(t4_state_t *s) -{ - time_t now; - struct tm *tm; - char buf[256 + 1]; - uint16_t resunit; - float x_resolution; - float y_resolution; - t4_tiff_state_t *t; - - t = &s->tiff; - /* Prepare the directory entry fully before writing the image, or libtiff complains */ - TIFFSetField(t->tiff_file, TIFFTAG_COMPRESSION, t->output_compression); -#if defined(SPANDSP_SUPPORT_TIFF_FX) - TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX); - TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, FAXPROFILE_S); - TIFFSetField(t->tiff_file, TIFFTAG_CODINGMETHODS, CODINGMETHODS_T4_1D | CODINGMETHODS_T4_2D | CODINGMETHODS_T6); - TIFFSetField(t->tiff_file, TIFFTAG_VERSIONYEAR, "1998"); - /* TIFFSetField(t->tiff_file, TIFFTAG_MODENUMBER, 0); */ -#endif - if (t->output_compression == COMPRESSION_CCITT_T4) - { - TIFFSetField(t->tiff_file, TIFFTAG_T4OPTIONS, t->output_t4_options); - TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); - } - TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width); - TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, 1); - TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - TIFFSetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); - if (t->output_compression == COMPRESSION_CCITT_T4 - || - t->output_compression == COMPRESSION_CCITT_T6) - { - TIFFSetField(t->tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); - } - else - { - TIFFSetField(t->tiff_file, - TIFFTAG_ROWSPERSTRIP, - TIFFDefaultStripSize(t->tiff_file, 0)); - } - TIFFSetField(t->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - TIFFSetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); - TIFFSetField(t->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB); - - x_resolution = s->x_resolution/100.0f; - y_resolution = s->y_resolution/100.0f; - /* Metric seems the sane thing to use in the 21st century, but a lot of lousy software - gets FAX resolutions wrong, and more get it wrong using metric than using inches. */ -#if 0 - TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, x_resolution); - TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, y_resolution); - resunit = RESUNIT_CENTIMETER; - TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); -#else - TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*CM_PER_INCH + 0.5f)); - TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*CM_PER_INCH + 0.5f)); - resunit = RESUNIT_INCH; - TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); -#endif - /* TODO: add the version of spandsp */ - TIFFSetField(t->tiff_file, TIFFTAG_SOFTWARE, "Spandsp " SPANDSP_RELEASE_DATETIME_STRING); - if (gethostname(buf, sizeof(buf)) == 0) - TIFFSetField(t->tiff_file, TIFFTAG_HOSTCOMPUTER, buf); - -#if defined(TIFFTAG_FAXDCS) - if (t->dcs) - TIFFSetField(t->tiff_file, TIFFTAG_FAXDCS, t->dcs); -#endif - if (t->sub_address) - TIFFSetField(t->tiff_file, TIFFTAG_FAXSUBADDRESS, t->sub_address); - if (t->far_ident) - TIFFSetField(t->tiff_file, TIFFTAG_IMAGEDESCRIPTION, t->far_ident); - if (t->vendor) - TIFFSetField(t->tiff_file, TIFFTAG_MAKE, t->vendor); - if (t->model) - TIFFSetField(t->tiff_file, TIFFTAG_MODEL, t->model); - - time(&now); - tm = localtime(&now); - sprintf(buf, - "%4d/%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); - TIFFSetField(t->tiff_file, TIFFTAG_DATETIME, buf); - TIFFSetField(t->tiff_file, TIFFTAG_FAXRECVTIME, now - s->page_start_time); - - TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, s->image_length); - /* Set the total pages to 1. For any one page document we will get this - right. For multi-page documents we will need to come back and fill in - the right answer when we know it. */ - TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, s->current_page++, 1); - s->tiff.pages_in_file = s->current_page; - if (t->output_compression == COMPRESSION_CCITT_T4) - { - if (s->t4_t6_rx.bad_rows) - { - TIFFSetField(t->tiff_file, TIFFTAG_BADFAXLINES, s->t4_t6_rx.bad_rows); - TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_REGENERATED); - TIFFSetField(t->tiff_file, TIFFTAG_CONSECUTIVEBADFAXLINES, s->t4_t6_rx.longest_bad_row_run); - } - else - { - TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); - } - } - TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width); - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int open_tiff_output_file(t4_state_t *s, const char *file) -{ - if ((s->tiff.tiff_file = TIFFOpen(file, "w")) == NULL) - return -1; - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static void write_tiff_image(t4_state_t *s) -{ - /* Set up the TIFF directory info... */ - set_tiff_directory_info(s); - /* ..and then write the image... */ - if (TIFFWriteEncodedStrip(s->tiff.tiff_file, 0, s->image_buffer, s->image_length*s->bytes_per_row) < 0) - span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", s->tiff.file); - /* ...then the directory entry, and libtiff is happy. */ - TIFFWriteDirectory(s->tiff.tiff_file); -} -/*- End of function --------------------------------------------------------*/ - -static int close_tiff_output_file(t4_state_t *s) -{ - int i; - t4_tiff_state_t *t; - - t = &s->tiff; - /* Perform any operations needed to tidy up a written TIFF file before - closure. */ - if (s->current_page > 1) - { - /* We need to edit the TIFF directories. Until now we did not know - the total page count, so the TIFF file currently says one. Now we - need to set the correct total page count associated with each page. */ - for (i = 0; i < s->current_page; i++) - { - TIFFSetDirectory(t->tiff_file, (tdir_t) i); - TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, i, s->current_page); - TIFFWriteDirectory(t->tiff_file); - } - } - TIFFClose(t->tiff_file); - t->tiff_file = NULL; - if (t->file) - { - /* Try not to leave a file behind, if we didn't receive any pages to - put in it. */ - if (s->current_page == 0) - remove(t->file); - free((char *) t->file); - t->file = NULL; - } - return 0; -} -/*- End of function --------------------------------------------------------*/ - -#else - -static int set_tiff_directory_info(t4_state_t *s) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int get_tiff_directory_info(t4_state_t *s) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int test_tiff_directory_info(t4_state_t *s) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int open_tiff_input_file(t4_state_t *s, const char *file) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int read_tiff_image(t4_state_t *s) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int close_tiff_input_file(t4_state_t *s) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int open_tiff_output_file(t4_state_t *s, const char *file) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static void write_tiff_image(t4_state_t *s) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int close_tiff_output_file(t4_state_t *s) -{ - return 0; -} -/*- End of function --------------------------------------------------------*/ -#endif - -static void update_row_bit_info(t4_state_t *s) -{ - if (s->row_bits > s->max_row_bits) - s->max_row_bits = s->row_bits; - if (s->row_bits < s->min_row_bits) - s->min_row_bits = s->row_bits; - s->row_bits = 0; -} -/*- End of function --------------------------------------------------------*/ - -#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__powerpc__) -static __inline__ int run_length(unsigned int bits) -{ - return 7 - top_bit(bits); -} -/*- End of function --------------------------------------------------------*/ -#else -static __inline__ int run_length(unsigned int bits) -{ - static const uint8_t run_len[256] = - { - 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0F */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1F */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2F */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xAF */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 - 0xBF */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 - 0xCF */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 - 0xDF */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 - 0xEF */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 - 0xFF */ - }; - - return run_len[bits]; -} -/*- End of function --------------------------------------------------------*/ -#endif - -static int free_buffers(t4_state_t *s) -{ - if (s->image_buffer) - { - free(s->image_buffer); - s->image_buffer = NULL; - s->image_buffer_size = 0; - } - if (s->cur_runs) - { - free(s->cur_runs); - s->cur_runs = NULL; - } - if (s->ref_runs) - { - free(s->ref_runs); - s->ref_runs = NULL; - } - if (s->row_buf) - { - free(s->row_buf); - s->row_buf = NULL; - } - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static __inline__ void add_run_to_row(t4_state_t *s) -{ - if (s->t4_t6_rx.run_length >= 0) - { - s->row_len += s->t4_t6_rx.run_length; - /* Don't allow rows to grow too long, and overflow the buffers */ - if (s->row_len <= s->image_width) - s->cur_runs[s->t4_t6_rx.a_cursor++] = s->t4_t6_rx.run_length; - } - s->t4_t6_rx.run_length = 0; -} -/*- End of function --------------------------------------------------------*/ - -static int put_decoded_row(t4_state_t *s) -{ - static const int msbmask[9] = - { - 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff - }; - uint8_t *t; - uint32_t i; - uint32_t *p; - int fudge; - int row_starts_at; - int x; - int j; - - if (s->t4_t6_rx.run_length) - add_run_to_row(s); -#if defined(T4_STATE_DEBUGGING) - /* Dump the runs of black and white for analysis */ - { - int total; - - total = 0; - for (x = 0; x < s->t4_t6_rx.b_cursor; x++) - total += s->ref_runs[x]; - printf("Ref (%d)", total); - for (x = 0; x < s->t4_t6_rx.b_cursor; x++) - printf(" %" PRIu32, s->ref_runs[x]); - printf("\n"); - total = 0; - for (x = 0; x < s->t4_t6_rx.a_cursor; x++) - total += s->cur_runs[x]; - printf("Cur (%d)", total); - for (x = 0; x < s->t4_t6_rx.a_cursor; x++) - printf(" %" PRIu32, s->cur_runs[x]); - printf("\n"); - } -#endif - row_starts_at = s->image_size; - /* Make sure there is enough room for another row */ - if (s->image_size + s->bytes_per_row >= s->image_buffer_size) - { - if ((t = realloc(s->image_buffer, s->image_buffer_size + 100*s->bytes_per_row)) == NULL) - return -1; - s->image_buffer_size += 100*s->bytes_per_row; - s->image_buffer = t; - } - if (s->row_len == s->image_width) - { - STATE_TRACE("%d Good row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d) ? "2D" : "1D"); - if (s->t4_t6_rx.curr_bad_row_run) - { - if (s->t4_t6_rx.curr_bad_row_run > s->t4_t6_rx.longest_bad_row_run) - s->t4_t6_rx.longest_bad_row_run = s->t4_t6_rx.curr_bad_row_run; - s->t4_t6_rx.curr_bad_row_run = 0; - } - /* Convert the runs to a bit image of the row */ - /* White/black/white... runs, always starting with white. That means the first run could be - zero length. */ - for (x = 0, fudge = 0; x < s->t4_t6_rx.a_cursor; x++, fudge ^= 0xFF) - { - i = s->cur_runs[x]; - if ((int) i >= s->tx_bits) - { - s->tx_bitstream = (s->tx_bitstream << s->tx_bits) | (msbmask[s->tx_bits] & fudge); - for (i += (8 - s->tx_bits); i >= 8; i -= 8) - { - s->tx_bits = 8; - s->image_buffer[s->image_size++] = (uint8_t) s->tx_bitstream; - s->tx_bitstream = fudge; - } - } - s->tx_bitstream = (s->tx_bitstream << i) | (msbmask[i] & fudge); - s->tx_bits -= i; - } - s->image_length++; - } - else - { - STATE_TRACE("%d Bad row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d) ? "2D" : "1D"); - /* Try to clean up the bad runs, and produce something reasonable as the reference - row for the next row. Use a copy of the previous good row as the actual current - row. If the row only fell apart near the end, reusing it might be the best - solution. */ - for (j = 0, fudge = 0; j < s->t4_t6_rx.a_cursor && fudge < s->image_width; j++) - fudge += s->cur_runs[j]; - if (fudge < s->image_width) - { - /* Try to pad with white, and avoid black, to minimise mess on the image. */ - if ((s->t4_t6_rx.a_cursor & 1)) - { - /* We currently finish in white. We could extend that, but it is probably of - the right length. Changing it would only further mess up what happens in the - next row. It seems better to add a black spot, and an extra white run. */ - s->cur_runs[s->t4_t6_rx.a_cursor++] = 1; - fudge++; - if (fudge < s->image_width) - s->cur_runs[s->t4_t6_rx.a_cursor++] = s->image_width - fudge; - } - else - { - /* We currently finish on black, so we add an extra white run to fill out the line. */ - s->cur_runs[s->t4_t6_rx.a_cursor++] = s->image_width - fudge; - } - } - else - { - /* Trim the last element to align with the proper image width */ - s->cur_runs[s->t4_t6_rx.a_cursor] += (s->image_width - fudge); - } - /* Ensure there is a previous line to copy from. */ - if (s->image_size != s->t4_t6_rx.last_row_starts_at) - { - /* Copy the previous row over this one */ - memcpy(s->image_buffer + s->image_size, s->image_buffer + s->t4_t6_rx.last_row_starts_at, s->bytes_per_row); - s->image_size += s->bytes_per_row; - s->image_length++; - } - s->t4_t6_rx.bad_rows++; - s->t4_t6_rx.curr_bad_row_run++; - } - - /* Pad the row as it becomes the reference row, so there are no odd runs to pick up if we - step off the end of the list. */ - s->cur_runs[s->t4_t6_rx.a_cursor] = 0; - s->cur_runs[s->t4_t6_rx.a_cursor + 1] = 0; - - /* Prepare the buffers for the next row. */ - s->t4_t6_rx.last_row_starts_at = row_starts_at; - /* Swap the buffers */ - p = s->cur_runs; - s->cur_runs = s->ref_runs; - s->ref_runs = p; - - s->t4_t6_rx.b_cursor = 1; - s->t4_t6_rx.a_cursor = 0; - s->t4_t6_rx.b1 = s->ref_runs[0]; - s->t4_t6_rx.a0 = 0; - - s->t4_t6_rx.run_length = 0; - - return 0; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s) -{ - int row; - int i; - - if (s->line_encoding == T4_COMPRESSION_ITU_T6) - { - /* Push enough zeros through the decoder to flush out any remaining codes */ - for (i = 0; i < 13; i++) - t4_rx_put_bit(s, 0); - } - if (s->t4_t6_rx.curr_bad_row_run) - { - if (s->t4_t6_rx.curr_bad_row_run > s->t4_t6_rx.longest_bad_row_run) - s->t4_t6_rx.longest_bad_row_run = s->t4_t6_rx.curr_bad_row_run; - s->t4_t6_rx.curr_bad_row_run = 0; - } - - if (s->image_size == 0) - return -1; - - if (s->t4_t6_rx.row_write_handler) - { - for (row = 0; row < s->image_length; row++) - { - if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, s->image_buffer + row*s->bytes_per_row, s->bytes_per_row) < 0) - { - span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row); - break; - } - } - /* Write a blank row to indicate the end of the image. */ - if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, NULL, 0) < 0) - span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row); - } - else - { - write_tiff_image(s); - } - s->t4_t6_rx.rx_bits = 0; - s->t4_t6_rx.rx_skip_bits = 0; - s->t4_t6_rx.rx_bitstream = 0; - s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; - - s->image_size = 0; - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static __inline__ void drop_rx_bits(t4_state_t *s, int bits) -{ - /* Only remove one bit right now. The rest need to be removed step by step, - checking for a misaligned EOL along the way. This is time consuming, but - if we don't do it a single bit error can severely damage an image. */ - s->row_bits += bits; - s->t4_t6_rx.rx_skip_bits += (bits - 1); - s->t4_t6_rx.rx_bits--; - s->t4_t6_rx.rx_bitstream >>= 1; -} -/*- End of function --------------------------------------------------------*/ - -static __inline__ void force_drop_rx_bits(t4_state_t *s, int bits) -{ - /* This should only be called to drop the bits of an EOL, as that is the - only place where it is safe to drop them all at once. */ - s->row_bits += bits; - s->t4_t6_rx.rx_skip_bits = 0; - s->t4_t6_rx.rx_bits -= bits; - s->t4_t6_rx.rx_bitstream >>= bits; -} -/*- End of function --------------------------------------------------------*/ - -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. */ - s->line_image_size += quantity; - s->t4_t6_rx.rx_bitstream |= (bit_string << s->t4_t6_rx.rx_bits); - /* The longest item we need to scan for is 13 bits long (a 2D EOL), so we - need a minimum of 13 bits in the buffer to proceed with any bit stream - analysis. */ - if ((s->t4_t6_rx.rx_bits += quantity) < 13) - return FALSE; - if (s->t4_t6_rx.consecutive_eols) - { - /* Check if the image has already terminated. */ - if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_ANY_RX_PAGE) - return TRUE; - /* Check if the image hasn't even started. */ - if (s->t4_t6_rx.consecutive_eols < 0) - { - /* We are waiting for the very first EOL (1D or 2D only). */ - /* We need to take this bit by bit, as the EOL could be anywhere, - and any junk could preceed it. */ - while ((s->t4_t6_rx.rx_bitstream & 0xFFF) != 0x800) - { - s->t4_t6_rx.rx_bitstream >>= 1; - if (--s->t4_t6_rx.rx_bits < 13) - return FALSE; - } - /* We have an EOL, so now the page begins and we can proceed to - process the bit stream as image data. */ - s->t4_t6_rx.consecutive_eols = 0; - if (s->line_encoding == T4_COMPRESSION_ITU_T4_1D) - { - s->row_is_2d = FALSE; - force_drop_rx_bits(s, 12); - } - else - { - s->row_is_2d = !(s->t4_t6_rx.rx_bitstream & 0x1000); - force_drop_rx_bits(s, 13); - } - } - } - - while (s->t4_t6_rx.rx_bits >= 13) - { - /* We need to check for EOLs bit by bit through the whole stream. If - we just try looking between code words, we will miss an EOL when a bit - error has throw the code words completely out of step. The can mean - recovery takes many lines, and the image gets really messed up. */ - /* Although EOLs are not inserted at the end of each row of a T.6 image, - they are still perfectly valid, and can terminate an image. */ - if ((s->t4_t6_rx.rx_bitstream & 0x0FFF) == 0x0800) - { - STATE_TRACE("EOL\n"); - if (s->row_len == 0) - { - /* A zero length row - i.e. 2 consecutive EOLs - is distinctly - the end of page condition. That's all we actually get on a - T.6 page. However, there are a minimum of 6 EOLs at the end of - any T.4 page. We can look for more than 2 EOLs in case bit - errors simulate the end of page condition at the wrong point. - Such robust checking is irrelevant for a T.6 page, as it should - be error free. */ - /* Note that for a T.6 page we should get here on the very first - EOL, as the row length should be zero at that point. Therefore - we should count up both EOLs, unless there is some bogus partial - row ahead of them. */ - s->t4_t6_rx.consecutive_eols++; - if (s->line_encoding == T4_COMPRESSION_ITU_T6) - { - if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_T6_RX_PAGE) - { - s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; - return TRUE; - } - } - else - { - if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_T4_RX_PAGE) - { - s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; - return TRUE; - } - } - } - else - { - /* The EOLs are not back-to-back, so they are not part of the - end of page condition. */ - if (s->t4_t6_rx.run_length > 0) - add_run_to_row(s); - s->t4_t6_rx.consecutive_eols = 0; - if (put_decoded_row(s)) - return TRUE; - update_row_bit_info(s); - } - if (s->line_encoding == T4_COMPRESSION_ITU_T4_2D) - { - s->row_is_2d = !(s->t4_t6_rx.rx_bitstream & 0x1000); - force_drop_rx_bits(s, 13); - } - else - { - force_drop_rx_bits(s, 12); - } - s->t4_t6_rx.its_black = FALSE; - s->t4_t6_rx.black_white = 0; - s->t4_t6_rx.run_length = 0; - s->row_len = 0; - continue; - } - if (s->t4_t6_rx.rx_skip_bits) - { - /* We are clearing out the remaining bits of the last code word we - absorbed. */ - s->t4_t6_rx.rx_skip_bits--; - s->t4_t6_rx.rx_bits--; - s->t4_t6_rx.rx_bitstream >>= 1; - continue; - } - if (s->row_is_2d && s->t4_t6_rx.black_white == 0) - { - bits = s->t4_t6_rx.rx_bitstream & 0x7F; - STATE_TRACE("State %d, %d - ", - t4_2d_table[bits].state, - t4_2d_table[bits].width); - if (s->row_len >= s->image_width) - { - drop_rx_bits(s, t4_2d_table[bits].width); - continue; - } - if (s->t4_t6_rx.a_cursor) - { - /* Move past a0, always staying on the current colour */ - for ( ; s->t4_t6_rx.b1 <= s->t4_t6_rx.a0; s->t4_t6_rx.b_cursor += 2) - s->t4_t6_rx.b1 += (s->ref_runs[s->t4_t6_rx.b_cursor] + s->ref_runs[s->t4_t6_rx.b_cursor + 1]); - } - switch (t4_2d_table[bits].state) - { - case S_Horiz: - STATE_TRACE("Horiz %d %d %d\n", - s->image_width, - s->t4_t6_rx.a0, - s->t4_t6_rx.a_cursor); - /* We now need to extract a white/black or black/white pair of runs, using the 1D - method. If the first of the pair takes us exactly to the end of the row, there - should still be a zero length element for the second of the pair. */ - s->t4_t6_rx.its_black = s->t4_t6_rx.a_cursor & 1; - s->t4_t6_rx.black_white = 2; - break; - case S_Vert: - STATE_TRACE("Vert[%d] %d %d %d %d\n", - t4_2d_table[bits].param, - s->image_width, - s->t4_t6_rx.a0, - s->t4_t6_rx.b1, - s->t4_t6_rx.run_length); - 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 */ - if (t4_2d_table[bits].param >= 0) - { - s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++]; - } - else - { - if (s->t4_t6_rx.b_cursor) - s->t4_t6_rx.b1 -= s->ref_runs[--s->t4_t6_rx.b_cursor]; - } - break; - case S_Pass: - STATE_TRACE("Pass %d %d %d %d %d\n", - s->image_width, - s->t4_t6_rx.a0, - s->t4_t6_rx.b1, - 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++]; - 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: - /* We do not currently handle any kind of extension */ - STATE_TRACE("Ext %d %d %d 0x%x\n", - s->image_width, - s->t4_t6_rx.a0, - ((s->t4_t6_rx.rx_bitstream >> t4_2d_table[bits].width) & 0x7), - s->t4_t6_rx.rx_bitstream); - /* TODO: The uncompressed option should be implemented. */ - break; - case S_Null: - STATE_TRACE("Null\n"); - break; - default: - STATE_TRACE("Unexpected T.4 state\n"); - span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected T.4 state %d\n", t4_2d_table[bits].state); - break; - } - drop_rx_bits(s, t4_2d_table[bits].width); - } - else - { - if (s->t4_t6_rx.its_black) - { - bits = s->t4_t6_rx.rx_bitstream & 0x1FFF; - STATE_TRACE("State %d, %d - Black %d %d %d\n", - t4_1d_black_table[bits].state, - t4_1d_black_table[bits].width, - s->image_width, - s->t4_t6_rx.a0, - t4_1d_black_table[bits].param); - switch (t4_1d_black_table[bits].state) - { - case S_MakeUpB: - case S_MakeUp: - s->t4_t6_rx.run_length += t4_1d_black_table[bits].param; - s->t4_t6_rx.a0 += t4_1d_black_table[bits].param; - break; - case S_TermB: - s->t4_t6_rx.its_black = FALSE; - if (s->row_len < s->image_width) - { - s->t4_t6_rx.run_length += t4_1d_black_table[bits].param; - s->t4_t6_rx.a0 += t4_1d_black_table[bits].param; - add_run_to_row(s); - } - if (s->t4_t6_rx.black_white) - s->t4_t6_rx.black_white--; - break; - default: - /* Bad black */ - s->t4_t6_rx.black_white = 0; - break; - } - drop_rx_bits(s, t4_1d_black_table[bits].width); - } - else - { - bits = s->t4_t6_rx.rx_bitstream & 0xFFF; - STATE_TRACE("State %d, %d - White %d %d %d\n", - t4_1d_white_table[bits].state, - t4_1d_white_table[bits].width, - s->image_width, - s->t4_t6_rx.a0, - t4_1d_white_table[bits].param); - switch (t4_1d_white_table[bits].state) - { - case S_MakeUpW: - case S_MakeUp: - s->t4_t6_rx.run_length += t4_1d_white_table[bits].param; - s->t4_t6_rx.a0 += t4_1d_white_table[bits].param; - break; - case S_TermW: - s->t4_t6_rx.its_black = TRUE; - if (s->row_len < s->image_width) - { - s->t4_t6_rx.run_length += t4_1d_white_table[bits].param; - s->t4_t6_rx.a0 += t4_1d_white_table[bits].param; - add_run_to_row(s); - } - if (s->t4_t6_rx.black_white) - s->t4_t6_rx.black_white--; - break; - default: - /* Bad white */ - s->t4_t6_rx.black_white = 0; - break; - } - drop_rx_bits(s, t4_1d_white_table[bits].width); - } - } - if (s->t4_t6_rx.a0 >= s->image_width) - s->t4_t6_rx.a0 = s->image_width - 1; - - if (s->line_encoding == T4_COMPRESSION_ITU_T6) - { - /* T.6 has no EOL markers. We sense the end of a line by its length alone. */ - /* The last test here is a backstop protection, so a corrupt image cannot - cause us to do bad things. Bad encoders have actually been seen, which - demand such protection. */ - if (s->t4_t6_rx.black_white == 0 && s->row_len >= s->image_width) - { - STATE_TRACE("EOL T.6\n"); - if (s->t4_t6_rx.run_length > 0) - add_run_to_row(s); - update_row_bit_info(s); - if (put_decoded_row(s)) - return TRUE; - s->t4_t6_rx.its_black = FALSE; - s->t4_t6_rx.black_white = 0; - s->t4_t6_rx.run_length = 0; - s->row_len = 0; - } - } - } - return FALSE; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit) -{ - return rx_put_bits(s, bit & 1, 1); -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte) -{ - return rx_put_bits(s, byte & 0xFF, 8); -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len) -{ - int i; - uint8_t byte; - - for (i = 0; i < len; i++) - { - byte = buf[i]; - if (rx_put_bits(s, byte & 0xFF, 8)) - return TRUE; - } - return FALSE; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data) -{ - s->t4_t6_rx.row_write_handler = handler; - s->t4_t6_rx.row_write_user_data = user_data; - return 0; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding) -{ - if (s == NULL) - { - if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL) - return NULL; - } - memset(s, 0, sizeof(*s)); -#if defined(SPANDSP_SUPPORT_TIFF_FX) - TIFF_FX_init(); -#endif - span_log_init(&s->logging, SPAN_LOG_NONE, NULL); - span_log_set_protocol(&s->logging, "T.4"); - s->rx = TRUE; - - span_log(&s->logging, SPAN_LOG_FLOW, "Start rx document\n"); - - if (open_tiff_output_file(s, file) < 0) - return NULL; - - /* Save the file name for logging reports. */ - s->tiff.file = strdup(file); - /* Only provide for one form of coding throughout the file, even though the - coding on the wire could change between pages. */ - switch (output_encoding) - { - case T4_COMPRESSION_ITU_T4_1D: - s->tiff.output_compression = COMPRESSION_CCITT_T4; - s->tiff.output_t4_options = GROUP3OPT_FILLBITS; - break; - case T4_COMPRESSION_ITU_T4_2D: - s->tiff.output_compression = COMPRESSION_CCITT_T4; - s->tiff.output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING; - break; - case T4_COMPRESSION_ITU_T6: - s->tiff.output_compression = COMPRESSION_CCITT_T6; - s->tiff.output_t4_options = 0; - break; - } - - /* Until we have a valid figure for the bytes per row, we need it to be set to a suitable - value to ensure it will be seen as changing when the real value is used. */ - s->bytes_per_row = 0; - - s->current_page = 0; - s->tiff.pages_in_file = 0; - s->tiff.start_page = 0; - s->tiff.stop_page = INT_MAX; - - s->image_buffer = NULL; - s->image_buffer_size = 0; - - /* Set some default values */ - s->x_resolution = T4_X_RESOLUTION_R8; - s->y_resolution = T4_Y_RESOLUTION_FINE; - s->image_width = T4_WIDTH_R8_A4; - - return s; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s) -{ - int bytes_per_row; - int run_space; - uint32_t *bufptr; - - span_log(&s->logging, SPAN_LOG_FLOW, "Start rx page - compression %d\n", s->line_encoding); - if (s->tiff.tiff_file == NULL) - return -1; - - /* Calculate the scanline/tile width. */ - bytes_per_row = (s->image_width + 7)/8; - run_space = (s->image_width + 4)*sizeof(uint32_t); - if (bytes_per_row != s->bytes_per_row) - { - /* Allocate the space required for decoding the new row length. */ - s->bytes_per_row = bytes_per_row; - if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL) - return -1; - s->cur_runs = bufptr; - if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL) - return -1; - s->ref_runs = bufptr; - } - memset(s->cur_runs, 0, run_space); - memset(s->ref_runs, 0, run_space); - - s->t4_t6_rx.rx_bits = 0; - s->t4_t6_rx.rx_skip_bits = 0; - s->t4_t6_rx.rx_bitstream = 0; - s->row_bits = 0; - s->min_row_bits = INT_MAX; - s->max_row_bits = 0; - - s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6); - /* We start at -1 EOLs for 1D and 2D decoding, as an indication we are waiting for the - first EOL. T.6 coding starts without any preamble. */ - s->t4_t6_rx.consecutive_eols = (s->line_encoding == T4_COMPRESSION_ITU_T6) ? 0 : -1; - - s->t4_t6_rx.bad_rows = 0; - s->t4_t6_rx.longest_bad_row_run = 0; - s->t4_t6_rx.curr_bad_row_run = 0; - s->image_length = 0; - s->tx_bitstream = 0; - s->tx_bits = 8; - s->image_size = 0; - s->line_image_size = 0; - s->t4_t6_rx.last_row_starts_at = 0; - - s->row_len = 0; - s->t4_t6_rx.its_black = FALSE; - s->t4_t6_rx.black_white = 0; - - /* Initialise the reference line to all white */ - s->ref_runs[0] = - s->ref_runs[1] = - s->ref_runs[2] = - s->ref_runs[3] = s->image_width; - - s->t4_t6_rx.b_cursor = 1; - s->t4_t6_rx.a_cursor = 0; - s->t4_t6_rx.b1 = s->ref_runs[0]; - s->t4_t6_rx.a0 = 0; - - s->t4_t6_rx.run_length = 0; - - time (&s->page_start_time); - - return 0; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_release(t4_state_t *s) -{ - if (!s->rx) - return -1; - if (s->tiff.tiff_file) - close_tiff_output_file(s); - free_buffers(s); - return 0; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_rx_free(t4_state_t *s) -{ - int ret; - - ret = t4_rx_release(s); - free(s); - return ret; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding) -{ - s->line_encoding = encoding; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width) -{ - s->image_width = width; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution) -{ - s->y_resolution = resolution; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution) -{ - s->x_resolution = resolution; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs) -{ - s->tiff.dcs = (dcs && dcs[0]) ? dcs : NULL; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address) -{ - s->tiff.sub_address = (sub_address && sub_address[0]) ? sub_address : NULL; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident) -{ - s->tiff.far_ident = (ident && ident[0]) ? ident : NULL; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor) -{ - s->tiff.vendor = vendor; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model) -{ - s->tiff.model = model; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t) -{ - t->pages_transferred = s->current_page - s->tiff.start_page; - t->pages_in_file = s->tiff.pages_in_file; - t->width = s->image_width; - t->length = s->image_length; - t->bad_rows = s->t4_t6_rx.bad_rows; - t->longest_bad_row_run = s->t4_t6_rx.longest_bad_row_run; - t->x_resolution = s->x_resolution; - t->y_resolution = s->y_resolution; - t->encoding = s->line_encoding; - t->line_image_size = s->line_image_size/8; -} -/*- End of function --------------------------------------------------------*/ - SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding) { switch (encoding) @@ -1265,4 +111,679 @@ SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding) return "???"; } /*- End of function --------------------------------------------------------*/ + +static int set_tiff_directory_info(t4_rx_state_t *s) +{ + time_t now; + struct tm *tm; + char buf[256 + 1]; + uint16_t resunit; + float x_resolution; + float y_resolution; + t4_rx_tiff_state_t *t; + int32_t output_compression; + int32_t output_t4_options; + + t = &s->tiff; + /* Prepare the directory entry fully before writing the image, or libtiff complains */ + switch (t->output_encoding) + { + case T4_COMPRESSION_ITU_T6: + output_compression = COMPRESSION_CCITT_T6; + output_t4_options = 0; + break; + case T4_COMPRESSION_ITU_T4_2D: + output_compression = COMPRESSION_CCITT_T4; + output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING; + break; + default: + output_compression = COMPRESSION_CCITT_T4; + output_t4_options = GROUP3OPT_FILLBITS; + break; + } + + TIFFSetField(t->tiff_file, TIFFTAG_COMPRESSION, output_compression); + switch (output_compression) + { + case COMPRESSION_CCITT_T4: + TIFFSetField(t->tiff_file, TIFFTAG_T4OPTIONS, output_t4_options); + TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); + break; + case COMPRESSION_CCITT_T6: + TIFFSetField(t->tiff_file, TIFFTAG_T6OPTIONS, 0); + TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); + break; + } +#if defined(SPANDSP_SUPPORT_TIFF_FX) + TIFFSetField(t->tiff_file, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX); + TIFFSetField(t->tiff_file, TIFFTAG_FAXPROFILE, FAXPROFILE_S); + TIFFSetField(t->tiff_file, TIFFTAG_CODINGMETHODS, CODINGMETHODS_T4_1D | CODINGMETHODS_T4_2D | CODINGMETHODS_T6); + TIFFSetField(t->tiff_file, TIFFTAG_VERSIONYEAR, "1998"); + /* TIFFSetField(t->tiff_file, TIFFTAG_MODENUMBER, 0); */ +#endif + TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, 1); + TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1); + if (output_compression == COMPRESSION_CCITT_T4 + || + output_compression == COMPRESSION_CCITT_T6) + { + TIFFSetField(t->tiff_file, TIFFTAG_ROWSPERSTRIP, -1L); + } + else + { + TIFFSetField(t->tiff_file, + TIFFTAG_ROWSPERSTRIP, + TIFFDefaultStripSize(t->tiff_file, 0)); + } + TIFFSetField(t->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); + TIFFSetField(t->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB); + + x_resolution = s->metadata.x_resolution/100.0f; + y_resolution = s->metadata.y_resolution/100.0f; + /* Metric seems the sane thing to use in the 21st century, but a lot of lousy software + gets FAX resolutions wrong, and more get it wrong using metric than using inches. */ +#if 0 + TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, x_resolution); + TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, y_resolution); + resunit = RESUNIT_CENTIMETER; + TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); +#else + TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*CM_PER_INCH + 0.5f)); + TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*CM_PER_INCH + 0.5f)); + resunit = RESUNIT_INCH; + TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit); +#endif + TIFFSetField(t->tiff_file, TIFFTAG_SOFTWARE, "Spandsp " SPANDSP_RELEASE_DATETIME_STRING); + if (gethostname(buf, sizeof(buf)) == 0) + TIFFSetField(t->tiff_file, TIFFTAG_HOSTCOMPUTER, buf); + +#if defined(TIFFTAG_FAXDCS) + if (s->metadata.dcs) + TIFFSetField(t->tiff_file, TIFFTAG_FAXDCS, s->metadata.dcs); +#endif + if (s->metadata.sub_address) + TIFFSetField(t->tiff_file, TIFFTAG_FAXSUBADDRESS, s->metadata.sub_address); + if (s->metadata.far_ident) + TIFFSetField(t->tiff_file, TIFFTAG_IMAGEDESCRIPTION, s->metadata.far_ident); + if (s->metadata.vendor) + TIFFSetField(t->tiff_file, TIFFTAG_MAKE, s->metadata.vendor); + if (s->metadata.model) + TIFFSetField(t->tiff_file, TIFFTAG_MODEL, s->metadata.model); + + time(&now); + tm = localtime(&now); + sprintf(buf, + "%4d/%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); + TIFFSetField(t->tiff_file, TIFFTAG_DATETIME, buf); + TIFFSetField(t->tiff_file, TIFFTAG_FAXRECVTIME, now - s->tiff.page_start_time); + + TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width); + /* Set the total pages to 1. For any one page document we will get this + right. For multi-page documents we will need to come back and fill in + the right answer when we know it. */ + TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, s->current_page, 1); + /* TIFF page numbers start from zero, so the number of pages in the file + is always one greater than the highest page number in the file. */ + s->tiff.pages_in_file = s->current_page + 1; + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + /* We only get bad row info from pages received in non-ECM mode. */ + if (output_compression == COMPRESSION_CCITT_T4) + { + if (s->decoder.t4_t6.bad_rows) + { + TIFFSetField(t->tiff_file, TIFFTAG_BADFAXLINES, s->decoder.t4_t6.bad_rows); + TIFFSetField(t->tiff_file, TIFFTAG_CONSECUTIVEBADFAXLINES, s->decoder.t4_t6.longest_bad_row_run); + TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_REGENERATED); + } + else + { + TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN); + } + } + /* Fall through */ + case T4_COMPRESSION_ITU_T6: + TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t4_t6_decode_get_image_length(&s->decoder.t4_t6)); + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t42_decode_get_image_length(&s->decoder.t42)); + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t43_decode_get_image_length(&s->decoder.t43)); + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t85_decode_get_image_length(&s->decoder.t85)); + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int open_tiff_output_file(t4_rx_state_t *s, const char *file) +{ + if ((s->tiff.tiff_file = TIFFOpen(file, "w")) == NULL) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int write_tiff_image(t4_rx_state_t *s) +{ + if (s->tiff.image_buffer == NULL || s->tiff.image_size <= 0) + return -1; + /* Set up the TIFF directory info... */ + set_tiff_directory_info(s); + /* ...and then write the image... */ + if (TIFFWriteEncodedStrip(s->tiff.tiff_file, 0, s->tiff.image_buffer, s->tiff.image_size) < 0) + span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", s->tiff.file); + /* ...then the directory entry, and libtiff is happy. */ + TIFFWriteDirectory(s->tiff.tiff_file); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int close_tiff_output_file(t4_rx_state_t *s) +{ + int i; + t4_rx_tiff_state_t *t; + + t = &s->tiff; + /* Perform any operations needed to tidy up a written TIFF file before + closure. */ + if (s->current_page > 1) + { + /* We need to edit the TIFF directories. Until now we did not know + the total page count, so the TIFF file currently says one. Now we + need to set the correct total page count associated with each page. */ + for (i = 0; i < s->current_page; i++) + { + TIFFSetDirectory(t->tiff_file, (tdir_t) i); + TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, i, s->current_page); + TIFFWriteDirectory(t->tiff_file); + } + } + TIFFClose(t->tiff_file); + t->tiff_file = NULL; + if (s->tiff.file) + { + /* Try not to leave a file behind, if we didn't receive any pages to + put in it. */ + if (s->current_page == 0) + remove(s->tiff.file); + free((char *) s->tiff.file); + } + s->tiff.file = NULL; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static void tiff_rx_release(t4_rx_state_t *s) +{ + if (s->tiff.tiff_file) + close_tiff_output_file(s); + if (s->tiff.image_buffer) + { + free(s->tiff.image_buffer); + s->tiff.image_buffer = NULL; + s->tiff.image_size = 0; + s->tiff.image_buffer_size = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_put_bit(t4_rx_state_t *s, int bit) +{ + s->line_image_size += 1; + return t4_t6_decode_put_bit(&s->decoder.t4_t6, bit); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_put_byte(t4_rx_state_t *s, uint8_t byte) +{ + s->line_image_size += 8; + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_decode_put_byte(&s->decoder.t4_t6, byte); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_decode_put_byte(&s->decoder.t42, byte); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_decode_put_byte(&s->decoder.t43, byte); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_decode_put_byte(&s->decoder.t85, byte); + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len) +{ + s->line_image_size += 8*len; + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_decode_put_chunk(&s->decoder.t4_t6, buf, len); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_decode_put_chunk(&s->decoder.t42, buf, len); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_decode_put_chunk(&s->decoder.t43, buf, len); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_decode_put_chunk(&s->decoder.t85, buf, len); + } + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_rx_state_t *s, int resolution) +{ + s->metadata.y_resolution = resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_rx_state_t *s, int resolution) +{ + s->metadata.x_resolution = resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_dcs(t4_rx_state_t *s, const char *dcs) +{ + s->metadata.dcs = (dcs && dcs[0]) ? dcs : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_sub_address(t4_rx_state_t *s, const char *sub_address) +{ + s->metadata.sub_address = (sub_address && sub_address[0]) ? sub_address : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_far_ident(t4_rx_state_t *s, const char *ident) +{ + s->metadata.far_ident = (ident && ident[0]) ? ident : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_vendor(t4_rx_state_t *s, const char *vendor) +{ + s->metadata.vendor = vendor; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_model(t4_rx_state_t *s, const char *model) +{ + s->metadata.model = model; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding) +{ + switch (encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + break; + default: + t4_t6_decode_init(&s->decoder.t4_t6, encoding, s->image_width, s->row_handler, s->row_handler_user_data); + break; + } + s->line_encoding = encoding; + return t4_t6_decode_set_encoding(&s->decoder.t4_t6, encoding); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T42: + break; + default: + t42_decode_init(&s->decoder.t42, s->row_handler, s->row_handler_user_data); + /* Constrain received images to the maximum width of any FAX. This will + avoid one potential cause of trouble, where a bad received image has + a gigantic dimension that sucks our memory dry. */ + t42_decode_set_image_size_constraints(&s->decoder.t42, T4_WIDTH_1200_A3, 0); + break; + } + s->line_encoding = encoding; + return 0; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T43: + break; + default: + t43_decode_init(&s->decoder.t43, s->row_handler, s->row_handler_user_data); + /* Constrain received images to the maximum width of any FAX. This will + avoid one potential cause of trouble, where a bad received image has + a gigantic dimension that sucks our memory dry. */ + t43_decode_set_image_size_constraints(&s->decoder.t43, T4_WIDTH_1200_A3, 0); + break; + } + s->line_encoding = encoding; + return 0; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + break; + default: + t85_decode_init(&s->decoder.t85, s->row_handler, s->row_handler_user_data); + /* Constrain received images to the maximum width of any FAX. This will + avoid one potential cause of trouble, where a bad received image has + a gigantic dimension that sucks our memory dry. */ + t85_decode_set_image_size_constraints(&s->decoder.t85, T4_WIDTH_1200_A3, 0); + break; + } + s->line_encoding = encoding; + return 0; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_set_image_width(t4_rx_state_t *s, int width) +{ + s->image_width = width; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_handler_t handler, void *user_data) +{ + s->row_handler = handler; + s->row_handler_user_data = user_data; + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_decode_set_row_write_handler(&s->decoder.t4_t6, handler, user_data); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_decode_set_row_write_handler(&s->decoder.t42, handler, user_data); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_decode_set_row_write_handler(&s->decoder.t43, handler, user_data); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_decode_set_row_write_handler(&s->decoder.t85, handler, user_data); + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t) +{ + memset(t, 0, sizeof(*t)); + t->pages_transferred = s->current_page; + t->pages_in_file = s->tiff.pages_in_file; + t->x_resolution = s->metadata.x_resolution; + t->y_resolution = s->metadata.y_resolution; + t->encoding = s->line_encoding; + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t->width = t4_t6_decode_get_image_width(&s->decoder.t4_t6); + t->length = t4_t6_decode_get_image_length(&s->decoder.t4_t6); + t->line_image_size = t4_t6_decode_get_compressed_image_size(&s->decoder.t4_t6)/8; + t->bad_rows = s->decoder.t4_t6.bad_rows; + t->longest_bad_row_run = s->decoder.t4_t6.longest_bad_row_run; + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t->width = t42_decode_get_image_width(&s->decoder.t42); + t->length = t42_decode_get_image_length(&s->decoder.t42); + t->line_image_size = t42_decode_get_compressed_image_size(&s->decoder.t42)/8; + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t->width = t43_decode_get_image_width(&s->decoder.t43); + t->length = t43_decode_get_image_length(&s->decoder.t43); + t->line_image_size = t43_decode_get_compressed_image_size(&s->decoder.t43)/8; + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t->width = t85_decode_get_image_width(&s->decoder.t85); + t->length = t85_decode_get_image_length(&s->decoder.t85); + t->line_image_size = t85_decode_get_compressed_image_size(&s->decoder.t85)/8; + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Start rx page %d - compression %s\n", s->current_page, t4_encoding_to_str(s->line_encoding)); + + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t4_t6_decode_restart(&s->decoder.t4_t6, s->image_width); + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t42_decode_restart(&s->decoder.t42); + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t43_decode_restart(&s->decoder.t43); + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t85_decode_restart(&s->decoder.t85); + break; + } + s->line_image_size = 0; + s->tiff.image_size = 0; + + time (&s->tiff.page_start_time); + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tiff_row_write_handler(void *user_data, const uint8_t buf[], size_t len) +{ + t4_rx_state_t *s; + uint8_t *t; + + s = (t4_rx_state_t *) user_data; + if (buf && len > 0) + { + if (s->tiff.image_size + len >= s->tiff.image_buffer_size) + { + if ((t = realloc(s->tiff.image_buffer, s->tiff.image_buffer_size + 100*len)) == NULL) + return -1; + s->tiff.image_buffer_size += 100*len; + s->tiff.image_buffer = t; + } + memcpy(&s->tiff.image_buffer[s->tiff.image_size], buf, len); + s->tiff.image_size += len; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) +{ + int length; + + length = 0; + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t4_t6_decode_put_byte(&s->decoder.t4_t6, SIG_STATUS_END_OF_DATA); + length = t4_t6_decode_get_image_length(&s->decoder.t4_t6); + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t42_decode_put_byte(&s->decoder.t42, SIG_STATUS_END_OF_DATA); + length = t42_decode_get_image_length(&s->decoder.t42); + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t43_decode_put_byte(&s->decoder.t43, SIG_STATUS_END_OF_DATA); + length = t43_decode_get_image_length(&s->decoder.t43); + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t85_decode_put_byte(&s->decoder.t85, SIG_STATUS_END_OF_DATA); + length = t85_decode_get_image_length(&s->decoder.t85); + break; + } + + if (length == 0) + return -1; + + if (s->tiff.tiff_file) + { + if (write_tiff_image(s) == 0) + s->current_page++; + s->tiff.image_size = 0; + } + else + { + s->current_page++; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t4_rx_state_t *) t4_rx_init(t4_rx_state_t *s, const char *file, int output_encoding) +{ + int allocated; + + allocated = FALSE; + if (s == NULL) + { + if ((s = (t4_rx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + allocated = TRUE; + } +#if defined(SPANDSP_SUPPORT_TIFF_FX) + TIFF_FX_init(); +#endif + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.4"); + + span_log(&s->logging, SPAN_LOG_FLOW, "Start rx document\n"); + + /* Only provide for one form of coding throughout the file, even though the + coding on the wire could change between pages. */ + s->tiff.output_encoding = output_encoding; + + /* Set some default values */ + s->metadata.x_resolution = T4_X_RESOLUTION_R8; + s->metadata.y_resolution = T4_Y_RESOLUTION_FINE; + + s->current_page = 0; + + /* Default handler */ + s->row_handler = tiff_row_write_handler; + s->row_handler_user_data = s; + + if (file) + { + s->tiff.pages_in_file = 0; + if (open_tiff_output_file(s, file) < 0) + { + if (allocated) + free(s); + return NULL; + } + /* Save the file name for logging reports. */ + s->tiff.file = strdup(file); + } + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_release(t4_rx_state_t *s) +{ + if (s->tiff.file) + tiff_rx_release(s); + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_decode_release(&s->decoder.t4_t6); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_decode_release(&s->decoder.t42); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_decode_release(&s->decoder.t43); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_decode_release(&s->decoder.t85); + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_rx_free(t4_rx_state_t *s) +{ + int ret; + + ret = t4_rx_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t4_t6_decode.c b/libs/spandsp/src/t4_t6_decode.c new file mode 100644 index 0000000000..ceb2af28f6 --- /dev/null +++ b/libs/spandsp/src/t4_t6_decode.c @@ -0,0 +1,929 @@ +//#define T4_STATE_DEBUGGING +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_t6_encode.c - ITU T.4 and T.6 FAX image decompression + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * This file has origins in the T.4 and T.6 support in libtiff, which requires + * the following notice in any derived source code: + * + * Copyright (c) 1990-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + * Decoder support is derived from code in Frank Cringle's viewfax program; + * Copyright (C) 1990, 1995 Frank D. Cringle. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/async.h" +#include "spandsp/timezone.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#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/private/logging.h" +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#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" +#include "spandsp/private/t4_tx.h" + +/*! The number of centimetres in one inch */ +#define CM_PER_INCH 2.54f + +/*! The number of EOLs to expect at the end of a T.4 page */ +#define EOLS_TO_END_ANY_RX_PAGE 6 +/*! The number of EOLs to check at the end of a T.4 page */ +#define EOLS_TO_END_T4_RX_PAGE 5 +/*! The number of EOLs to check at the end of a T.6 page */ +#define EOLS_TO_END_T6_RX_PAGE 2 + +#include "t4_t6_decode_states.h" + +#if defined(T4_STATE_DEBUGGING) +static void STATE_TRACE(const char *format, ...) +{ + va_list arg_ptr; + + va_start(arg_ptr, format); + vprintf(format, arg_ptr); + va_end(arg_ptr); +} +/*- End of function --------------------------------------------------------*/ +#else +#define STATE_TRACE(...) /**/ +#endif + +static int free_buffers(t4_t6_decode_state_t *s) +{ + if (s->cur_runs) + { + free(s->cur_runs); + s->cur_runs = NULL; + } + if (s->ref_runs) + { + free(s->ref_runs); + s->ref_runs = NULL; + } + if (s->row_buf) + { + free(s->row_buf); + s->row_buf = NULL; + } + s->bytes_per_row = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__powerpc__) +static __inline__ int run_length(unsigned int bits) +{ + return 7 - top_bit(bits); +} +/*- End of function --------------------------------------------------------*/ +#else +static __inline__ int run_length(unsigned int bits) +{ + static const uint8_t run_len[256] = + { + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0F */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1F */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2F */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xAF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 - 0xBF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 - 0xCF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 - 0xDF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 - 0xEF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 - 0xFF */ + }; + + return run_len[bits]; +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ void add_run_to_row(t4_t6_decode_state_t *s) +{ + if (s->run_length >= 0) + { + s->row_len += s->run_length; + /* Don't allow rows to grow too long, and overflow the buffers */ + if (s->row_len <= s->image_width) + s->cur_runs[s->a_cursor++] = s->run_length; + } + s->run_length = 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void update_row_bit_info(t4_t6_decode_state_t *s) +{ + if (s->row_bits > s->max_row_bits) + s->max_row_bits = s->row_bits; + if (s->row_bits < s->min_row_bits) + s->min_row_bits = s->row_bits; + s->row_bits = 0; +} +/*- End of function --------------------------------------------------------*/ + +static int put_decoded_row(t4_t6_decode_state_t *s) +{ + static const int msbmask[9] = + { + 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff + }; + uint32_t i; + uint32_t *p; + int fudge; + int x; + int j; + int row_pos; + + if (s->run_length) + add_run_to_row(s); + update_row_bit_info(s); +#if defined(T4_STATE_DEBUGGING) + /* Dump the runs of black and white for analysis */ + { + int total; + + total = 0; + for (x = 0; x < s->b_cursor; x++) + total += s->ref_runs[x]; + printf("Ref (%d)", total); + for (x = 0; x < s->b_cursor; x++) + printf(" %" PRIu32, s->ref_runs[x]); + printf("\n"); + total = 0; + for (x = 0; x < s->a_cursor; x++) + total += s->cur_runs[x]; + printf("Cur (%d)", total); + for (x = 0; x < s->a_cursor; x++) + printf(" %" PRIu32, s->cur_runs[x]); + printf("\n"); + } +#endif + row_pos = 0; + if (s->row_len == s->image_width) + { + STATE_TRACE("%d Good row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d) ? "2D" : "1D"); + if (s->curr_bad_row_run) + { + if (s->curr_bad_row_run > s->longest_bad_row_run) + s->longest_bad_row_run = s->curr_bad_row_run; + s->curr_bad_row_run = 0; + } + /* Convert the runs to a bit image of the row */ + /* White/black/white... runs, always starting with white. That means the first run could be + zero length. */ + for (x = 0, fudge = 0; x < s->a_cursor; x++, fudge ^= 0xFF) + { + i = s->cur_runs[x]; + if ((int) i >= s->pixels) + { + s->pixel_stream = (s->pixel_stream << s->pixels) | (msbmask[s->pixels] & fudge); + for (i += (8 - s->pixels); i >= 8; i -= 8) + { + s->pixels = 8; + s->row_buf[row_pos++] = (uint8_t) s->pixel_stream; + s->pixel_stream = fudge; + } + } + s->pixel_stream = (s->pixel_stream << i) | (msbmask[i] & fudge); + s->pixels -= i; + } + s->image_length++; + } + else + { + STATE_TRACE("%d Bad row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d) ? "2D" : "1D"); + /* Try to clean up the bad runs, and produce something reasonable as the reference + row for the next row. Use a copy of the previous good row as the actual current + row. If the row only fell apart near the end, reusing it might be the best + solution. */ + for (j = 0, fudge = 0; j < s->a_cursor && fudge < s->image_width; j++) + fudge += s->cur_runs[j]; + if (fudge < s->image_width) + { + /* Try to pad with white, and avoid black, to minimise mess on the image. */ + if ((s->a_cursor & 1)) + { + /* We currently finish in white. We could extend that, but it is probably of + the right length. Changing it would only further mess up what happens in the + next row. It seems better to add a black spot, and an extra white run. */ + s->cur_runs[s->a_cursor++] = 1; + fudge++; + if (fudge < s->image_width) + s->cur_runs[s->a_cursor++] = s->image_width - fudge; + } + else + { + /* We currently finish on black, so we add an extra white run to fill out the line. */ + s->cur_runs[s->a_cursor++] = s->image_width - fudge; + } + } + else + { + /* Trim the last element to align with the proper image width */ + s->cur_runs[s->a_cursor] += (s->image_width - fudge); + } + /* Ensure there is a previous line to copy from. */ + /* Reuse the previous row as the current one. If this is the first row + the row buffer will already contain a suitable white row */ + s->image_length++; + s->bad_rows++; + s->curr_bad_row_run++; + } + + /* Pad the row as it becomes the reference row, so there are no odd runs to pick up if we + step off the end of the list. */ + s->cur_runs[s->a_cursor] = 0; + s->cur_runs[s->a_cursor + 1] = 0; + + /* Swap the buffers */ + p = s->cur_runs; + s->cur_runs = s->ref_runs; + s->ref_runs = p; + + s->b_cursor = 1; + s->a_cursor = 0; + s->b1 = s->ref_runs[0]; + s->a0 = 0; + + s->run_length = 0; + if (s->row_write_handler) + return s->row_write_handler(s->row_write_user_data, s->row_buf, s->bytes_per_row); + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void drop_rx_bits(t4_t6_decode_state_t *s, int bits) +{ + /* Only remove one bit right now. The rest need to be removed step by step, + checking for a misaligned EOL along the way. This is time consuming, but + if we don't do it a single bit error can severely damage an image. */ + s->row_bits += bits; + s->rx_skip_bits += (bits - 1); + s->rx_bits--; + s->rx_bitstream >>= 1; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void force_drop_rx_bits(t4_t6_decode_state_t *s, int bits) +{ + /* This should only be called to drop the bits of an EOL, as that is the + only place where it is safe to drop them all at once. */ + s->row_bits += bits; + s->rx_skip_bits = 0; + s->rx_bits -= bits; + s->rx_bitstream >>= bits; +} +/*- End of function --------------------------------------------------------*/ + +static int put_bits(t4_t6_decode_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. */ + s->rx_bitstream |= (bit_string << s->rx_bits); + /* The longest item we need to scan for is 13 bits long (a 2D EOL), so we + need a minimum of 13 bits in the buffer to proceed with any bit stream + analysis. */ + if ((s->rx_bits += quantity) < 13) + return FALSE; + if (s->consecutive_eols) + { + /* Check if the image has already terminated. */ + if (s->consecutive_eols >= EOLS_TO_END_ANY_RX_PAGE) + return TRUE; + /* Check if the image hasn't even started. */ + if (s->consecutive_eols < 0) + { + /* We are waiting for the very first EOL (1D or 2D only). */ + /* We need to take this bit by bit, as the EOL could be anywhere, + and any junk could preceed it. */ + while ((s->rx_bitstream & 0xFFF) != 0x800) + { + s->rx_bitstream >>= 1; + if (--s->rx_bits < 13) + return FALSE; + } + /* We have an EOL, so now the page begins and we can proceed to + process the bit stream as image data. */ + s->consecutive_eols = 0; + if (s->encoding == T4_COMPRESSION_ITU_T4_1D) + { + s->row_is_2d = FALSE; + force_drop_rx_bits(s, 12); + } + else + { + s->row_is_2d = !(s->rx_bitstream & 0x1000); + force_drop_rx_bits(s, 13); + } + } + } + + while (s->rx_bits >= 13) + { + /* We need to check for EOLs bit by bit through the whole stream. If + we just try looking between code words, we will miss an EOL when a bit + error has throw the code words completely out of step. The can mean + recovery takes many lines, and the image gets really messed up. */ + /* Although EOLs are not inserted at the end of each row of a T.6 image, + they are still perfectly valid, and can terminate an image. */ + if ((s->rx_bitstream & 0x0FFF) == 0x0800) + { + STATE_TRACE("EOL\n"); + if (s->row_len == 0) + { + /* A zero length row - i.e. 2 consecutive EOLs - is distinctly + the end of page condition. That's all we actually get on a + T.6 page. However, there are a minimum of 6 EOLs at the end of + any T.4 page. We can look for more than 2 EOLs in case bit + errors simulate the end of page condition at the wrong point. + Such robust checking is irrelevant for a T.6 page, as it should + be error free. */ + /* Note that for a T.6 page we should get here on the very first + EOL, as the row length should be zero at that point. Therefore + we should count up both EOLs, unless there is some bogus partial + row ahead of them. */ + s->consecutive_eols++; + if (s->encoding == T4_COMPRESSION_ITU_T6) + { + if (s->consecutive_eols >= EOLS_TO_END_T6_RX_PAGE) + { + s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; + return TRUE; + } + } + else + { + if (s->consecutive_eols >= EOLS_TO_END_T4_RX_PAGE) + { + s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; + return TRUE; + } + } + } + else + { + /* The EOLs are not back-to-back, so they are not part of the + end of page condition. */ + if (s->run_length > 0) + add_run_to_row(s); + s->consecutive_eols = 0; + if (put_decoded_row(s)) + return TRUE; + } + if (s->encoding == T4_COMPRESSION_ITU_T4_2D) + { + s->row_is_2d = !(s->rx_bitstream & 0x1000); + force_drop_rx_bits(s, 13); + } + else + { + force_drop_rx_bits(s, 12); + } + s->in_black = FALSE; + s->black_white = 0; + s->run_length = 0; + s->row_len = 0; + continue; + } + if (s->rx_skip_bits) + { + /* We are clearing out the remaining bits of the last code word we + absorbed. */ + s->rx_skip_bits--; + s->rx_bits--; + s->rx_bitstream >>= 1; + continue; + } + if (s->row_is_2d && s->black_white == 0) + { + bits = s->rx_bitstream & 0x7F; + STATE_TRACE("State %d, %d - ", + t4_2d_table[bits].state, + t4_2d_table[bits].width); + if (s->row_len >= s->image_width) + { + drop_rx_bits(s, t4_2d_table[bits].width); + continue; + } + if (s->a_cursor) + { + /* Move past a0, always staying on the current colour */ + for ( ; s->b1 <= s->a0; s->b_cursor += 2) + s->b1 += (s->ref_runs[s->b_cursor] + s->ref_runs[s->b_cursor + 1]); + } + switch (t4_2d_table[bits].state) + { + case S_Horiz: + STATE_TRACE("Horiz %d %d %d\n", + s->image_width, + s->a0, + s->a_cursor); + /* We now need to extract a white/black or black/white pair of runs, using the 1D + method. If the first of the pair takes us exactly to the end of the row, there + should still be a zero length element for the second of the pair. */ + s->in_black = s->a_cursor & 1; + s->black_white = 2; + break; + case S_Vert: + STATE_TRACE("Vert[%d] %d %d %d %d\n", + t4_2d_table[bits].param, + s->image_width, + s->a0, + s->b1, + s->run_length); + old_a0 = s->a0; + s->a0 = s->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->a0 <= old_a0) + { + if (s->a0 < old_a0 || s->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->a0 = old_a0; + break; + } + } + s->run_length += (s->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 */ + if (t4_2d_table[bits].param >= 0) + { + s->b1 += s->ref_runs[s->b_cursor++]; + } + else + { + if (s->b_cursor) + s->b1 -= s->ref_runs[--s->b_cursor]; + } + break; + case S_Pass: + STATE_TRACE("Pass %d %d %d %d %d\n", + s->image_width, + s->a0, + s->b1, + s->ref_runs[s->b_cursor], + s->ref_runs[s->b_cursor + 1]); + s->b1 += s->ref_runs[s->b_cursor++]; + old_a0 = s->a0; + s->a0 = s->b1; + s->run_length += (s->a0 - old_a0); + s->b1 += s->ref_runs[s->b_cursor++]; + break; + case S_Ext: + /* We do not currently handle any kind of extension */ + STATE_TRACE("Ext %d %d %d 0x%x\n", + s->image_width, + s->a0, + ((s->rx_bitstream >> t4_2d_table[bits].width) & 0x7), + s->rx_bitstream); + /* TODO: The uncompressed option should be implemented. */ + break; + case S_Null: + STATE_TRACE("Null\n"); + break; + default: + STATE_TRACE("Unexpected T.4 state\n"); + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected T.4 state %d\n", t4_2d_table[bits].state); + break; + } + drop_rx_bits(s, t4_2d_table[bits].width); + } + else + { + if (s->in_black) + { + bits = s->rx_bitstream & 0x1FFF; + STATE_TRACE("State %d, %d - Black %d %d %d\n", + t4_1d_black_table[bits].state, + t4_1d_black_table[bits].width, + s->image_width, + s->a0, + t4_1d_black_table[bits].param); + switch (t4_1d_black_table[bits].state) + { + case S_MakeUpB: + case S_MakeUp: + s->run_length += t4_1d_black_table[bits].param; + s->a0 += t4_1d_black_table[bits].param; + break; + case S_TermB: + s->in_black = FALSE; + if (s->row_len < s->image_width) + { + s->run_length += t4_1d_black_table[bits].param; + s->a0 += t4_1d_black_table[bits].param; + add_run_to_row(s); + } + if (s->black_white) + s->black_white--; + break; + default: + /* Bad black */ + s->black_white = 0; + break; + } + drop_rx_bits(s, t4_1d_black_table[bits].width); + } + else + { + bits = s->rx_bitstream & 0xFFF; + STATE_TRACE("State %d, %d - White %d %d %d\n", + t4_1d_white_table[bits].state, + t4_1d_white_table[bits].width, + s->image_width, + s->a0, + t4_1d_white_table[bits].param); + switch (t4_1d_white_table[bits].state) + { + case S_MakeUpW: + case S_MakeUp: + s->run_length += t4_1d_white_table[bits].param; + s->a0 += t4_1d_white_table[bits].param; + break; + case S_TermW: + s->in_black = TRUE; + if (s->row_len < s->image_width) + { + s->run_length += t4_1d_white_table[bits].param; + s->a0 += t4_1d_white_table[bits].param; + add_run_to_row(s); + } + if (s->black_white) + s->black_white--; + break; + default: + /* Bad white */ + s->black_white = 0; + break; + } + drop_rx_bits(s, t4_1d_white_table[bits].width); + } + } + if (s->a0 >= s->image_width) + s->a0 = s->image_width - 1; + + if (s->encoding == T4_COMPRESSION_ITU_T6) + { + /* T.6 has no EOL markers. We sense the end of a line by its length alone. */ + /* The last test here is a backstop protection, so a corrupt image cannot + cause us to do bad things. Bad encoders have actually been seen, which + demand such protection. */ + if (s->black_white == 0 && s->row_len >= s->image_width) + { + STATE_TRACE("EOL T.6\n"); + if (s->run_length > 0) + add_run_to_row(s); + if (put_decoded_row(s)) + return TRUE; + s->in_black = FALSE; + s->black_white = 0; + s->run_length = 0; + s->row_len = 0; + } + } + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +static void t4_t6_decode_rx_status(t4_t6_decode_state_t *s, int status) +{ + span_log(&s->logging, SPAN_LOG_FLOW, "Signal status is %s (%d)\n", signal_status_to_str(status), status); + switch (status) + { + case SIG_STATUS_TRAINING_IN_PROGRESS: + case SIG_STATUS_TRAINING_FAILED: + case SIG_STATUS_TRAINING_SUCCEEDED: + case SIG_STATUS_CARRIER_UP: + /* Ignore these */ + break; + case SIG_STATUS_CARRIER_DOWN: + case SIG_STATUS_END_OF_DATA: + /* Finalise the image */ + if (s->consecutive_eols != EOLS_TO_END_ANY_RX_PAGE) + { + /* Push enough zeros (13) through the decoder to flush out any remaining codes */ + put_bits(s, 0, 8); + put_bits(s, 0, 5); + } + if (s->curr_bad_row_run) + { + if (s->curr_bad_row_run > s->longest_bad_row_run) + s->longest_bad_row_run = s->curr_bad_row_run; + s->curr_bad_row_run = 0; + } + /* Don't worry about the return value here. We are finishing anyway. */ + if (s->row_write_handler) + s->row_write_handler(s->row_write_user_data, NULL, 0); + s->rx_bits = 0; + s->rx_skip_bits = 0; + s->rx_bitstream = 0; + s->consecutive_eols = EOLS_TO_END_ANY_RX_PAGE; + break; + default: + span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected rx status - %d!\n", status); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_put_bit(t4_t6_decode_state_t *s, int bit) +{ + if (bit < 0) + { + t4_t6_decode_rx_status(s, bit); + return TRUE; + } + s->compressed_image_size++; + return put_bits(s, bit & 1, 1); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_put_byte(t4_t6_decode_state_t *s, int byte) +{ + if (byte < 0) + { + t4_t6_decode_rx_status(s, byte); + return TRUE; + } + s->compressed_image_size += 8; + return put_bits(s, byte & 0xFF, 8); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_put_chunk(t4_t6_decode_state_t *s, const uint8_t buf[], int len) +{ + int i; + uint8_t byte; + + for (i = 0; i < len; i++) + { + s->compressed_image_size += 8; + byte = buf[i]; + if (put_bits(s, byte & 0xFF, 8)) + return TRUE; + } + return FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_set_row_write_handler(t4_t6_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data) +{ + s->row_write_handler = handler; + s->row_write_user_data = user_data; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_set_encoding(t4_t6_decode_state_t *s, int encoding) +{ + switch (encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + s->encoding = encoding; + return 0; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t4_t6_decode_get_image_width(t4_t6_decode_state_t *s) +{ + return s->image_width; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t4_t6_decode_get_image_length(t4_t6_decode_state_t *s) +{ + return s->image_length; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_get_compressed_image_size(t4_t6_decode_state_t *s) +{ + return s->compressed_image_size; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_restart(t4_t6_decode_state_t *s, int image_width) +{ + int bytes_per_row; + int run_space; + uint32_t *bufptr; + uint8_t *bufptr8; + + /* Calculate the scanline/tile width. */ + run_space = (image_width + 4)*sizeof(uint32_t); + if (s->bytes_per_row == 0 || image_width != s->image_width) + { + /* Allocate the space required for decoding the new row length. */ + if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL) + return -1; + s->cur_runs = bufptr; + if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL) + return -1; + s->ref_runs = bufptr; + s->image_width = image_width; + } + bytes_per_row = (image_width + 7)/8; + if (bytes_per_row != s->bytes_per_row) + { + if ((bufptr8 = (uint8_t *) realloc(s->row_buf, bytes_per_row)) == NULL) + return -1; + s->row_buf = bufptr8; + s->bytes_per_row = bytes_per_row; + } + + s->rx_bits = 0; + s->rx_skip_bits = 0; + s->rx_bitstream = 0; + s->row_bits = 0; + s->min_row_bits = INT_MAX; + s->max_row_bits = 0; + + s->compressed_image_size = 0; + s->bad_rows = 0; + s->longest_bad_row_run = 0; + s->curr_bad_row_run = 0; + s->image_length = 0; + s->pixel_stream = 0; + s->pixels = 8; + + s->row_len = 0; + s->in_black = FALSE; + s->black_white = 0; + s->b_cursor = 1; + s->a_cursor = 0; + s->b1 = s->image_width; + s->a0 = 0; + s->run_length = 0; + s->row_is_2d = (s->encoding == T4_COMPRESSION_ITU_T6); + /* We start at -1 EOLs for 1D and 2D decoding, as an indication we are waiting for the + first EOL. T.6 coding starts without any preamble. */ + s->consecutive_eols = (s->encoding == T4_COMPRESSION_ITU_T6) ? 0 : -1; + + if (s->cur_runs) + memset(s->cur_runs, 0, run_space); + /* Initialise the reference line to all white */ + if (s->ref_runs) + { + memset(s->ref_runs, 0, run_space); + s->ref_runs[0] = + s->ref_runs[1] = + s->ref_runs[2] = + s->ref_runs[3] = s->image_width; + } + if (s->row_buf) + memset(s->row_buf, 0, s->bytes_per_row); + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t4_t6_decode_state_t *) t4_t6_decode_init(t4_t6_decode_state_t *s, + int encoding, + int image_width, + t4_row_write_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (t4_t6_decode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.4/T.6"); + + s->encoding = encoding; + s->row_write_handler = handler; + s->row_write_user_data = user_data; + t4_t6_decode_restart(s, image_width); + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_release(t4_t6_decode_state_t *s) +{ + free_buffers(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_decode_free(t4_t6_decode_state_t *s) +{ + int ret; + + ret = t4_t6_decode_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t4_t6_encode.c b/libs/spandsp/src/t4_t6_encode.c new file mode 100644 index 0000000000..51103e522d --- /dev/null +++ b/libs/spandsp/src/t4_t6_encode.c @@ -0,0 +1,1154 @@ +//#define T4_STATE_DEBUGGING +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_t6_encode.c - ITU T.4 and T.6 FAX image compression + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2007 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * This file has origins in the T.4 and T.6 support in libtiff, which requires + * the following notice in any derived source code: + * + * Copyright (c) 1990-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include "floating_fudge.h" +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/bit_operations.h" +#include "spandsp/async.h" +#include "spandsp/timezone.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#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/private/logging.h" +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#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" +#include "spandsp/private/t4_tx.h" + +/*! The number of EOLs to be sent at the end of a T.4 page */ +#define EOLS_TO_END_T4_TX_PAGE 6 +/*! The number of EOLs to be sent at the end of a T.6 page */ +#define EOLS_TO_END_T6_TX_PAGE 2 + +#if defined(T4_STATE_DEBUGGING) +static void STATE_TRACE(const char *format, ...) +{ + va_list arg_ptr; + + va_start(arg_ptr, format); + vprintf(format, arg_ptr); + va_end(arg_ptr); +} +/*- End of function --------------------------------------------------------*/ +#else +#define STATE_TRACE(...) /**/ +#endif + +/*! T.4 run length table entry */ +typedef struct +{ + /*! Length of T.4 code, in bits */ + uint16_t length; + /*! T.4 code */ + uint16_t code; + /*! Run length, in bits */ + int16_t run_length; +} t4_run_table_entry_t; + +/* Legitimate runs of zero bits which are the tail end of one code + plus the start of the next code do not exceed 10 bits. */ + +/* + * Note that these tables are ordered such that the index into the table + * is known to be either the run length, or (run length / 64) + a fixed + * offset. + */ +static const t4_run_table_entry_t t4_white_codes[] = +{ + { 8, 0x00AC, 0}, /* 0011 0101 */ + { 6, 0x0038, 1}, /* 0001 11 */ + { 4, 0x000E, 2}, /* 0111 */ + { 4, 0x0001, 3}, /* 1000 */ + { 4, 0x000D, 4}, /* 1011 */ + { 4, 0x0003, 5}, /* 1100 */ + { 4, 0x0007, 6}, /* 1110 */ + { 4, 0x000F, 7}, /* 1111 */ + { 5, 0x0019, 8}, /* 1001 1 */ + { 5, 0x0005, 9}, /* 1010 0 */ + { 5, 0x001C, 10}, /* 0011 1 */ + { 5, 0x0002, 11}, /* 0100 0 */ + { 6, 0x0004, 12}, /* 0010 00 */ + { 6, 0x0030, 13}, /* 0000 11 */ + { 6, 0x000B, 14}, /* 1101 00 */ + { 6, 0x002B, 15}, /* 1101 01 */ + { 6, 0x0015, 16}, /* 1010 10 */ + { 6, 0x0035, 17}, /* 1010 11 */ + { 7, 0x0072, 18}, /* 0100 111 */ + { 7, 0x0018, 19}, /* 0001 100 */ + { 7, 0x0008, 20}, /* 0001 000 */ + { 7, 0x0074, 21}, /* 0010 111 */ + { 7, 0x0060, 22}, /* 0000 011 */ + { 7, 0x0010, 23}, /* 0000 100 */ + { 7, 0x000A, 24}, /* 0101 000 */ + { 7, 0x006A, 25}, /* 0101 011 */ + { 7, 0x0064, 26}, /* 0010 011 */ + { 7, 0x0012, 27}, /* 0100 100 */ + { 7, 0x000C, 28}, /* 0011 000 */ + { 8, 0x0040, 29}, /* 0000 0010 */ + { 8, 0x00C0, 30}, /* 0000 0011 */ + { 8, 0x0058, 31}, /* 0001 1010 */ + { 8, 0x00D8, 32}, /* 0001 1011 */ + { 8, 0x0048, 33}, /* 0001 0010 */ + { 8, 0x00C8, 34}, /* 0001 0011 */ + { 8, 0x0028, 35}, /* 0001 0100 */ + { 8, 0x00A8, 36}, /* 0001 0101 */ + { 8, 0x0068, 37}, /* 0001 0110 */ + { 8, 0x00E8, 38}, /* 0001 0111 */ + { 8, 0x0014, 39}, /* 0010 1000 */ + { 8, 0x0094, 40}, /* 0010 1001 */ + { 8, 0x0054, 41}, /* 0010 1010 */ + { 8, 0x00D4, 42}, /* 0010 1011 */ + { 8, 0x0034, 43}, /* 0010 1100 */ + { 8, 0x00B4, 44}, /* 0010 1101 */ + { 8, 0x0020, 45}, /* 0000 0100 */ + { 8, 0x00A0, 46}, /* 0000 0101 */ + { 8, 0x0050, 47}, /* 0000 1010 */ + { 8, 0x00D0, 48}, /* 0000 1011 */ + { 8, 0x004A, 49}, /* 0101 0010 */ + { 8, 0x00CA, 50}, /* 0101 0011 */ + { 8, 0x002A, 51}, /* 0101 0100 */ + { 8, 0x00AA, 52}, /* 0101 0101 */ + { 8, 0x0024, 53}, /* 0010 0100 */ + { 8, 0x00A4, 54}, /* 0010 0101 */ + { 8, 0x001A, 55}, /* 0101 1000 */ + { 8, 0x009A, 56}, /* 0101 1001 */ + { 8, 0x005A, 57}, /* 0101 1010 */ + { 8, 0x00DA, 58}, /* 0101 1011 */ + { 8, 0x0052, 59}, /* 0100 1010 */ + { 8, 0x00D2, 60}, /* 0100 1011 */ + { 8, 0x004C, 61}, /* 0011 0010 */ + { 8, 0x00CC, 62}, /* 0011 0011 */ + { 8, 0x002C, 63}, /* 0011 0100 */ + { 5, 0x001B, 64}, /* 1101 1 */ + { 5, 0x0009, 128}, /* 1001 0 */ + { 6, 0x003A, 192}, /* 0101 11 */ + { 7, 0x0076, 256}, /* 0110 111 */ + { 8, 0x006C, 320}, /* 0011 0110 */ + { 8, 0x00EC, 384}, /* 0011 0111 */ + { 8, 0x0026, 448}, /* 0110 0100 */ + { 8, 0x00A6, 512}, /* 0110 0101 */ + { 8, 0x0016, 576}, /* 0110 1000 */ + { 8, 0x00E6, 640}, /* 0110 0111 */ + { 9, 0x0066, 704}, /* 0110 0110 0 */ + { 9, 0x0166, 768}, /* 0110 0110 1 */ + { 9, 0x0096, 832}, /* 0110 1001 0 */ + { 9, 0x0196, 896}, /* 0110 1001 1 */ + { 9, 0x0056, 960}, /* 0110 1010 0 */ + { 9, 0x0156, 1024}, /* 0110 1010 1 */ + { 9, 0x00D6, 1088}, /* 0110 1011 0 */ + { 9, 0x01D6, 1152}, /* 0110 1011 1 */ + { 9, 0x0036, 1216}, /* 0110 1100 0 */ + { 9, 0x0136, 1280}, /* 0110 1100 1 */ + { 9, 0x00B6, 1344}, /* 0110 1101 0 */ + { 9, 0x01B6, 1408}, /* 0110 1101 1 */ + { 9, 0x0032, 1472}, /* 0100 1100 0 */ + { 9, 0x0132, 1536}, /* 0100 1100 1 */ + { 9, 0x00B2, 1600}, /* 0100 1101 0 */ + { 6, 0x0006, 1664}, /* 0110 00 */ + { 9, 0x01B2, 1728}, /* 0100 1101 1 */ + {11, 0x0080, 1792}, /* 0000 0001 000 */ + {11, 0x0180, 1856}, /* 0000 0001 100 */ + {11, 0x0580, 1920}, /* 0000 0001 101 */ + {12, 0x0480, 1984}, /* 0000 0001 0010 */ + {12, 0x0C80, 2048}, /* 0000 0001 0011 */ + {12, 0x0280, 2112}, /* 0000 0001 0100 */ + {12, 0x0A80, 2176}, /* 0000 0001 0101 */ + {12, 0x0680, 2240}, /* 0000 0001 0110 */ + {12, 0x0E80, 2304}, /* 0000 0001 0111 */ + {12, 0x0380, 2368}, /* 0000 0001 1100 */ + {12, 0x0B80, 2432}, /* 0000 0001 1101 */ + {12, 0x0780, 2496}, /* 0000 0001 1110 */ + {12, 0x0F80, 2560}, /* 0000 0001 1111 */ +}; + +static const t4_run_table_entry_t t4_black_codes[] = +{ + {10, 0x03B0, 0}, /* 0000 1101 11 */ + { 3, 0x0002, 1}, /* 010 */ + { 2, 0x0003, 2}, /* 11 */ + { 2, 0x0001, 3}, /* 10 */ + { 3, 0x0006, 4}, /* 011 */ + { 4, 0x000C, 5}, /* 0011 */ + { 4, 0x0004, 6}, /* 0010 */ + { 5, 0x0018, 7}, /* 0001 1 */ + { 6, 0x0028, 8}, /* 0001 01 */ + { 6, 0x0008, 9}, /* 0001 00 */ + { 7, 0x0010, 10}, /* 0000 100 */ + { 7, 0x0050, 11}, /* 0000 101 */ + { 7, 0x0070, 12}, /* 0000 111 */ + { 8, 0x0020, 13}, /* 0000 0100 */ + { 8, 0x00E0, 14}, /* 0000 0111 */ + { 9, 0x0030, 15}, /* 0000 1100 0 */ + {10, 0x03A0, 16}, /* 0000 0101 11 */ + {10, 0x0060, 17}, /* 0000 0110 00 */ + {10, 0x0040, 18}, /* 0000 0010 00 */ + {11, 0x0730, 19}, /* 0000 1100 111 */ + {11, 0x00B0, 20}, /* 0000 1101 000 */ + {11, 0x01B0, 21}, /* 0000 1101 100 */ + {11, 0x0760, 22}, /* 0000 0110 111 */ + {11, 0x00A0, 23}, /* 0000 0101 000 */ + {11, 0x0740, 24}, /* 0000 0010 111 */ + {11, 0x00C0, 25}, /* 0000 0011 000 */ + {12, 0x0530, 26}, /* 0000 1100 1010 */ + {12, 0x0D30, 27}, /* 0000 1100 1011 */ + {12, 0x0330, 28}, /* 0000 1100 1100 */ + {12, 0x0B30, 29}, /* 0000 1100 1101 */ + {12, 0x0160, 30}, /* 0000 0110 1000 */ + {12, 0x0960, 31}, /* 0000 0110 1001 */ + {12, 0x0560, 32}, /* 0000 0110 1010 */ + {12, 0x0D60, 33}, /* 0000 0110 1011 */ + {12, 0x04B0, 34}, /* 0000 1101 0010 */ + {12, 0x0CB0, 35}, /* 0000 1101 0011 */ + {12, 0x02B0, 36}, /* 0000 1101 0100 */ + {12, 0x0AB0, 37}, /* 0000 1101 0101 */ + {12, 0x06B0, 38}, /* 0000 1101 0110 */ + {12, 0x0EB0, 39}, /* 0000 1101 0111 */ + {12, 0x0360, 40}, /* 0000 0110 1100 */ + {12, 0x0B60, 41}, /* 0000 0110 1101 */ + {12, 0x05B0, 42}, /* 0000 1101 1010 */ + {12, 0x0DB0, 43}, /* 0000 1101 1011 */ + {12, 0x02A0, 44}, /* 0000 0101 0100 */ + {12, 0x0AA0, 45}, /* 0000 0101 0101 */ + {12, 0x06A0, 46}, /* 0000 0101 0110 */ + {12, 0x0EA0, 47}, /* 0000 0101 0111 */ + {12, 0x0260, 48}, /* 0000 0110 0100 */ + {12, 0x0A60, 49}, /* 0000 0110 0101 */ + {12, 0x04A0, 50}, /* 0000 0101 0010 */ + {12, 0x0CA0, 51}, /* 0000 0101 0011 */ + {12, 0x0240, 52}, /* 0000 0010 0100 */ + {12, 0x0EC0, 53}, /* 0000 0011 0111 */ + {12, 0x01C0, 54}, /* 0000 0011 1000 */ + {12, 0x0E40, 55}, /* 0000 0010 0111 */ + {12, 0x0140, 56}, /* 0000 0010 1000 */ + {12, 0x01A0, 57}, /* 0000 0101 1000 */ + {12, 0x09A0, 58}, /* 0000 0101 1001 */ + {12, 0x0D40, 59}, /* 0000 0010 1011 */ + {12, 0x0340, 60}, /* 0000 0010 1100 */ + {12, 0x05A0, 61}, /* 0000 0101 1010 */ + {12, 0x0660, 62}, /* 0000 0110 0110 */ + {12, 0x0E60, 63}, /* 0000 0110 0111 */ + {10, 0x03C0, 64}, /* 0000 0011 11 */ + {12, 0x0130, 128}, /* 0000 1100 1000 */ + {12, 0x0930, 192}, /* 0000 1100 1001 */ + {12, 0x0DA0, 256}, /* 0000 0101 1011 */ + {12, 0x0CC0, 320}, /* 0000 0011 0011 */ + {12, 0x02C0, 384}, /* 0000 0011 0100 */ + {12, 0x0AC0, 448}, /* 0000 0011 0101 */ + {13, 0x06C0, 512}, /* 0000 0011 0110 0 */ + {13, 0x16C0, 576}, /* 0000 0011 0110 1 */ + {13, 0x0A40, 640}, /* 0000 0010 0101 0 */ + {13, 0x1A40, 704}, /* 0000 0010 0101 1 */ + {13, 0x0640, 768}, /* 0000 0010 0110 0 */ + {13, 0x1640, 832}, /* 0000 0010 0110 1 */ + {13, 0x09C0, 896}, /* 0000 0011 1001 0 */ + {13, 0x19C0, 960}, /* 0000 0011 1001 1 */ + {13, 0x05C0, 1024}, /* 0000 0011 1010 0 */ + {13, 0x15C0, 1088}, /* 0000 0011 1010 1 */ + {13, 0x0DC0, 1152}, /* 0000 0011 1011 0 */ + {13, 0x1DC0, 1216}, /* 0000 0011 1011 1 */ + {13, 0x0940, 1280}, /* 0000 0010 1001 0 */ + {13, 0x1940, 1344}, /* 0000 0010 1001 1 */ + {13, 0x0540, 1408}, /* 0000 0010 1010 0 */ + {13, 0x1540, 1472}, /* 0000 0010 1010 1 */ + {13, 0x0B40, 1536}, /* 0000 0010 1101 0 */ + {13, 0x1B40, 1600}, /* 0000 0010 1101 1 */ + {13, 0x04C0, 1664}, /* 0000 0011 0010 0 */ + {13, 0x14C0, 1728}, /* 0000 0011 0010 1 */ + {11, 0x0080, 1792}, /* 0000 0001 000 */ + {11, 0x0180, 1856}, /* 0000 0001 100 */ + {11, 0x0580, 1920}, /* 0000 0001 101 */ + {12, 0x0480, 1984}, /* 0000 0001 0010 */ + {12, 0x0C80, 2048}, /* 0000 0001 0011 */ + {12, 0x0280, 2112}, /* 0000 0001 0100 */ + {12, 0x0A80, 2176}, /* 0000 0001 0101 */ + {12, 0x0680, 2240}, /* 0000 0001 0110 */ + {12, 0x0E80, 2304}, /* 0000 0001 0111 */ + {12, 0x0380, 2368}, /* 0000 0001 1100 */ + {12, 0x0B80, 2432}, /* 0000 0001 1101 */ + {12, 0x0780, 2496}, /* 0000 0001 1110 */ + {12, 0x0F80, 2560}, /* 0000 0001 1111 */ +}; + +static void update_row_bit_info(t4_t6_encode_state_t *s) +{ + if (s->row_bits > s->max_row_bits) + s->max_row_bits = s->row_bits; + if (s->row_bits < s->min_row_bits) + s->min_row_bits = s->row_bits; + s->row_bits = 0; +} +/*- End of function --------------------------------------------------------*/ + +static int free_buffers(t4_t6_encode_state_t *s) +{ + if (s->cur_runs) + { + free(s->cur_runs); + s->cur_runs = NULL; + } + if (s->ref_runs) + { + free(s->ref_runs); + s->ref_runs = NULL; + } + if (s->bitstream) + { + free(s->bitstream); + s->bitstream = NULL; + } + s->bytes_per_row = 0; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int put_encoded_bits(t4_t6_encode_state_t *s, uint32_t bits, int length) +{ + /* We might be called with a large length value, to spew out a mass of zero bits for + minimum row length padding. */ + s->tx_bitstream |= (bits << s->tx_bits); + s->tx_bits += length; + s->row_bits += length; + while (s->tx_bits >= 8) + { + s->bitstream[s->bitstream_iptr++] = (uint8_t) s->tx_bitstream; + s->tx_bitstream >>= 8; + s->tx_bits -= 8; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +/* + * Write the sequence of codes that describes the specified span of zero's or one's. + * The appropriate table that holds the make-up and terminating codes is supplied. + */ +static __inline__ int put_1d_span(t4_t6_encode_state_t *s, int32_t span, const t4_run_table_entry_t *tab) +{ + const t4_run_table_entry_t *te; + + te = &tab[63 + (2560 >> 6)]; + while (span >= 2560 + 64) + { + if (put_encoded_bits(s, te->code, te->length)) + return -1; + span -= te->run_length; + } + te = &tab[63 + (span >> 6)]; + if (span >= 64) + { + if (put_encoded_bits(s, te->code, te->length)) + return -1; + span -= te->run_length; + } + if (put_encoded_bits(s, tab[span].code, tab[span].length)) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int row_to_run_lengths(uint32_t list[], const uint8_t row[], int width) +{ + uint32_t flip; + uint32_t x; + int span; + int entry; + int frag; + int rem; + int limit; + int i; + int pos; + + /* Deal with whole words first. We know we are starting on a word boundary. */ + entry = 0; + flip = 0; + limit = (width >> 3) & ~3; + span = 0; + pos = 0; + for (i = 0; i < limit; i += sizeof(uint32_t)) + { + x = *((uint32_t *) &row[i]); + if (x != flip) + { + x = ((uint32_t) row[i] << 24) + | ((uint32_t) row[i + 1] << 16) + | ((uint32_t) row[i + 2] << 8) + | ((uint32_t) row[i + 3]); + /* We know we are going to find at least one transition. */ + frag = 31 - top_bit(x ^ flip); + pos += ((i << 3) - span + frag); + list[entry++] = pos; + x <<= frag; + flip ^= 0xFFFFFFFF; + rem = 32 - frag; + /* Now see if there are any more */ + while ((frag = 31 - top_bit(x ^ flip)) < rem) + { + pos += frag; + list[entry++] = pos; + x <<= frag; + flip ^= 0xFFFFFFFF; + rem -= frag; + } + /* Save the remainder of the word */ + span = (i << 3) + 32 - rem; + } + } + /* Now deal with some whole bytes, if there are any left. */ + limit = width >> 3; + flip &= 0xFF000000; + if (i < limit) + { + for ( ; i < limit; i++) + { + x = (uint32_t) row[i] << 24; + if (x != flip) + { + /* We know we are going to find at least one transition. */ + frag = 31 - top_bit(x ^ flip); + pos += ((i << 3) - span + frag); + list[entry++] = pos; + x <<= frag; + flip ^= 0xFF000000; + rem = 8 - frag; + /* Now see if there are any more */ + while ((frag = 31 - top_bit(x ^ flip)) < rem) + { + pos += frag; + list[entry++] = pos; + x <<= frag; + flip ^= 0xFF000000; + rem -= frag; + } + /* Save the remainder of the word */ + span = (i << 3) + 8 - rem; + } + } + } + /* Deal with any left over fractional byte. */ + span = (i << 3) - span; + if ((rem = width & 7)) + { + x = row[i]; + x <<= 24; + do + { + frag = 31 - top_bit(x ^ flip); + if (frag > rem) + frag = rem; + pos += (span + frag); + list[entry++] = pos; + x <<= frag; + span = 0; + flip ^= 0xFF000000; + rem -= frag; + } + while (rem > 0); + } + else + { + if (span) + { + pos += span; + list[entry++] = pos; + } + } + return entry; +} +/*- End of function --------------------------------------------------------*/ + +#define pixel_is_black(x,bit) (((x)[(bit) >> 3] << ((bit) & 7)) & 0x80) + +/* + * Write an EOL code to the output stream. We also handle writing the tag + * bit for the next scanline when doing 2D encoding. + */ +static void encode_eol(t4_t6_encode_state_t *s) +{ + uint32_t code; + int length; + + if (s->encoding == T4_COMPRESSION_ITU_T4_2D) + { + code = 0x0800 | ((!s->row_is_2d) << 12); + length = 13; + } + else + { + /* T.4 1D EOL, or T.6 EOFB */ + code = 0x800; + length = 12; + } + if (s->row_bits) + { + /* We may need to pad the row to a minimum length, unless we are in T.6 mode. + In T.6 we only come here at the end of the page to add the EOFB marker, which + is like two 1D EOLs. */ + if (s->encoding != T4_COMPRESSION_ITU_T6) + { + if (s->row_bits + length < s->min_bits_per_row) + put_encoded_bits(s, 0, s->min_bits_per_row - (s->row_bits + length)); + } + put_encoded_bits(s, code, length); + update_row_bit_info(s); + } + else + { + /* We don't pad zero length rows. They are the consecutive EOLs which end a page. */ + put_encoded_bits(s, code, length); + /* Don't do the full update row bit info, or the minimum suddenly drops to the + length of an EOL. Just clear the row bits, so we treat the next EOL as an + end of page EOL, with no padding. */ + s->row_bits = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +/* + * 2D-encode a row of pixels. Consult ITU specification T.4 for the algorithm. + */ +static void encode_2d_row(t4_t6_encode_state_t *s, const uint8_t *row_buf) +{ + static const t4_run_table_entry_t codes[] = + { + {7, 0x60, 0}, /* VR3 0000 011 */ + {6, 0x30, 0}, /* VR2 0000 11 */ + {3, 0x06, 0}, /* VR1 011 */ + {1, 0x01, 0}, /* V0 1 */ + {3, 0x02, 0}, /* VL1 010 */ + {6, 0x10, 0}, /* VL2 0000 10 */ + {7, 0x20, 0}, /* VL3 0000 010 */ + {3, 0x04, 0}, /* horizontal 001 */ + {4, 0x08, 0} /* pass 0001 */ + }; + + /* The reference or starting changing element on the coding line. At the start of the coding + line, a0 is set on an imaginary white changing element situated just before the first element + on the line. During the coding of the coding line, the position of a0 is defined by the + previous coding mode. (See T.4/4.2.1.3.2.) */ + int a0; + /* The next changing element to the right of a0 on the coding line. */ + int a1; + /* The next changing element to the right of a1 on the coding line. */ + int a2; + /* The first changing element on the reference line to the right of a0 and of opposite colour to a0. */ + int b1; + /* The next changing element to the right of b1 on the reference line. */ + int b2; + int diff; + int a_cursor; + int b_cursor; + int cur_steps; + uint32_t *p; + + /* + b1 b2 + XX XX XX XX XX -- -- -- -- -- XX XX XX -- -- -- -- -- + XX XX XX -- -- -- -- -- XX XX XX XX XX XX -- -- -- -- + a0 a1 a2 + + + a) Pass mode + This mode is identified when the position of b2 lies to the left of a1. When this mode + has been coded, a0 is set on the element of the coding line below b2 in preparation for + the next coding (i.e. on a0'). + + b1 b2 + XX XX XX XX -- -- XX XX XX -- -- -- -- -- + XX XX -- -- -- -- -- -- -- -- -- -- XX XX + a0 a0' a1 + Pass mode + + + However, the state where b2 occurs just above a1, as shown in the figure below, is not + considered as a pass mode. + + b1 b2 + XX XX XX XX -- -- XX XX XX -- -- -- -- -- + XX XX -- -- -- -- -- -- -- XX XX XX XX XX + a0 a1 + Not pass mode + + + b) Vertical mode + When this mode is identified, the position of a1 is coded relative to the position of b1. + The relative distance a1b1 can take on one of seven values V(0), VR(1), VR(2), VR(3), + VL(1), VL(2) and VL(3), each of which is represented by a separate code word. The + subscripts R and L indicate that a1 is to the right or left respectively of b1, and the + number in brackets indicates the value of the distance a1b1. After vertical mode coding + has occurred, the position of a0 is set on a1 (see figure below). + + c) Horizontal mode + When this mode is identified, both the run-lengths a0a1 and a1a2 are coded using the code + words H + M(a0a1) + M(a1a2). H is the flag code word 001 taken from the two-dimensional + code table. M(a0a1) and M(a1a2) are code words which represent the length and "colour" + of the runs a0a1 and a1a2 respectively and are taken from the appropriate white or black + one-dimensional code tables. After a horizontal mode coding, the position of a0 is set on + a2 (see figure below). + + Vertical + + b1 b2 + -- XX XX XX XX XX -- -- -- -- -- -- -- -- XX XX XX XX -- -- -- + -- -- -- -- -- -- -- -- -- -- -- -- XX XX XX XX XX XX XX -- -- + a0 a1 a2 + <-------- a0a1 --------><-------- a1a2 ------------> + Horizontal mode + Vertical and horizontal modes + */ + /* The following implements the 2-D encoding section of the flow chart in Figure7/T.4 */ + cur_steps = row_to_run_lengths(s->cur_runs, row_buf, s->image_width); + /* Stretch the row a little, so when we step by 2 we are guaranteed to + hit an entry showing the row length. */ + s->cur_runs[cur_steps] = + s->cur_runs[cur_steps + 1] = + s->cur_runs[cur_steps + 2] = s->cur_runs[cur_steps - 1]; + + a0 = 0; + a1 = s->cur_runs[0]; + b1 = s->ref_runs[0]; + a_cursor = 0; + b_cursor = 0; + for (;;) + { + b2 = s->ref_runs[b_cursor + 1]; + if (b2 >= a1) + { + diff = b1 - a1; + if (abs(diff) <= 3) + { + /* Vertical mode coding */ + put_encoded_bits(s, codes[diff + 3].code, codes[diff + 3].length); + a0 = a1; + a_cursor++; + } + else + { + /* Horizontal mode coding */ + a2 = s->cur_runs[a_cursor + 1]; + put_encoded_bits(s, codes[7].code, codes[7].length); + if (a0 + a1 == 0 || pixel_is_black(row_buf, a0) == 0) + { + put_1d_span(s, a1 - a0, t4_white_codes); + put_1d_span(s, a2 - a1, t4_black_codes); + } + else + { + put_1d_span(s, a1 - a0, t4_black_codes); + put_1d_span(s, a2 - a1, t4_white_codes); + } + a0 = a2; + a_cursor += 2; + } + if (a0 >= s->image_width) + break; + if (a_cursor >= cur_steps) + a_cursor = cur_steps - 1; + a1 = s->cur_runs[a_cursor]; + } + else + { + /* Pass mode coding */ + put_encoded_bits(s, codes[8].code, codes[8].length); + /* We now set a0 to somewhere in the middle of its current run, + but we know are aren't moving beyond that run. */ + a0 = b2; + if (a0 >= s->image_width) + break; + } + /* We need to hunt for the correct position in the reference row, as the + runs there have no particular alignment with the runs in the current + row. */ + if (pixel_is_black(row_buf, a0)) + b_cursor |= 1; + else + b_cursor &= ~1; + if (a0 < (int) s->ref_runs[b_cursor]) + { + for ( ; b_cursor >= 0; b_cursor -= 2) + { + if (a0 >= (int) s->ref_runs[b_cursor]) + break; + } + b_cursor += 2; + } + else + { + for ( ; b_cursor < s->ref_steps; b_cursor += 2) + { + if (a0 < (int) s->ref_runs[b_cursor]) + break; + } + if (b_cursor >= s->ref_steps) + b_cursor = s->ref_steps - 1; + } + b1 = s->ref_runs[b_cursor]; + } + /* Swap the buffers */ + s->ref_steps = cur_steps; + p = s->cur_runs; + s->cur_runs = s->ref_runs; + s->ref_runs = p; +} +/*- End of function --------------------------------------------------------*/ + +/* + * 1D-encode a row of pixels. The encoding is a sequence of all-white or + * all-black spans of pixels encoded with Huffman codes. + */ +static void encode_1d_row(t4_t6_encode_state_t *s, const uint8_t *row_buf) +{ + int i; + + /* Do our work in the reference row buffer, and it is already in place if + we need a reference row for a following 2D encoded row. */ + s->ref_steps = row_to_run_lengths(s->ref_runs, row_buf, s->image_width); + put_1d_span(s, s->ref_runs[0], t4_white_codes); + for (i = 1; i < s->ref_steps; i++) + put_1d_span(s, s->ref_runs[i] - s->ref_runs[i - 1], (i & 1) ? t4_black_codes : t4_white_codes); + /* Stretch the row a little, so when we step by 2 we are guaranteed to + hit an entry showing the row length */ + s->ref_runs[s->ref_steps] = + s->ref_runs[s->ref_steps + 1] = + s->ref_runs[s->ref_steps + 2] = s->ref_runs[s->ref_steps - 1]; +} +/*- End of function --------------------------------------------------------*/ + +static int encode_row(t4_t6_encode_state_t *s, const uint8_t *row_buf, size_t len) +{ + switch (s->encoding) + { + case T4_COMPRESSION_ITU_T6: + /* T.6 compression is a trivial step up from T.4 2D, so we just + throw it in here. T.6 is only used with error correction, + so it does not need independantly compressed (i.e. 1D) lines + to recover from data errors. It doesn't need EOLs, either. */ + encode_2d_row(s, row_buf); + break; + case T4_COMPRESSION_ITU_T4_2D: + encode_eol(s); + if (s->row_is_2d) + { + encode_2d_row(s, row_buf); + s->rows_to_next_1d_row--; + } + else + { + encode_1d_row(s, row_buf); + s->row_is_2d = TRUE; + } + if (s->rows_to_next_1d_row <= 0) + { + /* Insert a row of 1D encoding */ + s->row_is_2d = FALSE; + s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1; + } + break; + default: + case T4_COMPRESSION_ITU_T4_1D: + encode_eol(s); + encode_1d_row(s, row_buf); + break; + } + s->image_length++; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int finalise_page(t4_t6_encode_state_t *s) +{ + int i; + + if (s->encoding == T4_COMPRESSION_ITU_T6) + { + /* Attach an EOFB (end of facsimile block == 2 x EOLs) to the end of the page */ + for (i = 0; i < EOLS_TO_END_T6_TX_PAGE; i++) + encode_eol(s); + } + else + { + /* Attach an RTC (return to control == 6 x EOLs) to the end of the page */ + s->row_is_2d = FALSE; + for (i = 0; i < EOLS_TO_END_T4_TX_PAGE; i++) + encode_eol(s); + } + /* Force any partial byte in progress to flush using ones. Any post EOL padding when + sending is normally ones, so this is consistent. */ + put_encoded_bits(s, 0xFF, 7); + /* Flag that page generation has finished */ + s->row_bits = -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int get_next_row(t4_t6_encode_state_t *s) +{ + int len; +#if defined(_MSC_VER) + uint8_t *row_buf = (uint8_t *) _alloca(s->bytes_per_row); +#else + uint8_t row_buf[s->bytes_per_row]; +#endif + + if (s->row_bits < 0 || s->row_read_handler == NULL) + return -1; + len = -1; + s->bitstream_iptr = 0; + s->bitstream_optr = 0; + s->bit_pos = 7; + /* A row may not actually fill a byte of output buffer space in T.6 mode, + so we loop here until we have at least one byte of output bit stream, + and can continue outputting. */ + do + { + len = s->row_read_handler(s->row_read_user_data, row_buf, s->bytes_per_row); + if (len == s->bytes_per_row) + encode_row(s, row_buf, len); + else + finalise_page(s); + } + while (len > 0 && s->bitstream_iptr == 0); + s->compressed_image_size += 8*s->bitstream_iptr; + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_check_bit(t4_t6_encode_state_t *s) +{ + if (s->bitstream_optr >= s->bitstream_iptr) + { + if (get_next_row(s) < 0) + return SIG_STATUS_END_OF_DATA; + } + return (s->bitstream[s->bitstream_optr] >> (7 - s->bit_pos)) & 1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_get_bit(t4_t6_encode_state_t *s) +{ + int bit; + + if ((bit = t4_t6_encode_check_bit(s)) < 0) + return bit; + if (--s->bit_pos < 0) + { + s->bitstream_optr++; + s->bit_pos = 7; + } + return bit; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_get_byte(t4_t6_encode_state_t *s) +{ + if (s->bitstream_optr >= s->bitstream_iptr) + { + if (get_next_row(s) < 0) + return 0x100; + } + return s->bitstream[s->bitstream_optr++]; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_get_chunk(t4_t6_encode_state_t *s, uint8_t buf[], int max_len) +{ + int len; + int n; + + for (len = 0; len < max_len; len += n) + { + if (s->bitstream_optr >= s->bitstream_iptr) + { + if (get_next_row(s) < 0) + return len; + } + n = s->bitstream_iptr - s->bitstream_optr; + if (n > max_len - len) + n = max_len - len; + memcpy(&buf[len], &s->bitstream[s->bitstream_optr], n); + s->bitstream_optr += n; + } + return len; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_set_row_read_handler(t4_t6_encode_state_t *s, t4_row_read_handler_t handler, void *user_data) +{ + s->row_read_handler = handler; + s->row_read_user_data = user_data; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_set_encoding(t4_t6_encode_state_t *s, int encoding) +{ + switch (encoding) + { + case T4_COMPRESSION_ITU_T6: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T4_1D: + s->encoding = encoding; + /* Set this to the default value for the lowest resolution in the T.4 spec. */ + s->max_rows_to_next_1d_row = 2; + s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1; + s->row_is_2d = FALSE; + return 0; + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_t6_encode_set_min_bits_per_row(t4_t6_encode_state_t *s, int bits) +{ + s->min_bits_per_row = bits; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_set_image_width(t4_t6_encode_state_t *s, int image_width) +{ + int run_space; + uint32_t *bufptr; + uint8_t *bufptr8; + + /* TODO: Are we too late to change the width */ + if (s->bytes_per_row == 0 || image_width != s->image_width) + { + s->image_width = image_width; + s->bytes_per_row = (s->image_width + 7)/8; + run_space = (s->image_width + 4)*sizeof(uint32_t); + + if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL) + return -1; + s->cur_runs = bufptr; + if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL) + return -1; + s->ref_runs = bufptr; + if ((bufptr8 = (uint8_t *) realloc(s->bitstream, (s->image_width + 1)*sizeof(uint16_t))) == NULL) + return -1; + s->bitstream = bufptr8; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t4_t6_encode_get_image_width(t4_t6_encode_state_t *s) +{ + return s->image_width; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t4_t6_encode_get_image_length(t4_t6_encode_state_t *s) +{ + return s->image_length; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_get_compressed_image_size(t4_t6_encode_state_t *s) +{ + return s->compressed_image_size; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_t6_encode_set_max_2d_rows_per_1d_row(t4_t6_encode_state_t *s, int max) +{ + static const struct + { + int code; + int max_rows; + } y_res_table[] = + { + {T4_Y_RESOLUTION_STANDARD, 2}, + {T4_Y_RESOLUTION_FINE, 4}, + {T4_Y_RESOLUTION_300, 6}, + {T4_Y_RESOLUTION_SUPERFINE, 8}, + {T4_Y_RESOLUTION_600, 12}, + {T4_Y_RESOLUTION_800, 16}, + {T4_Y_RESOLUTION_1200, 24}, + {-1, -1} + }; + int i; + int res; + + if (max < 0) + { + /* Its actually a resolution code we need to translate into an appropriate + number of rows. Note that we only hit on exact known resolutions. */ + res = -max; + max = 2; + for (i = 0; y_res_table[i].code > 0; i++) + { + if (res == y_res_table[i].code) + { + max = y_res_table[i].max_rows; + break; + } + } + } + s->max_rows_to_next_1d_row = max; + s->rows_to_next_1d_row = max - 1; + s->row_is_2d = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_restart(t4_t6_encode_state_t *s, int image_width) +{ + /* Allow for pages being of different width. */ + t4_t6_encode_set_image_width(s, image_width); + s->row_is_2d = (s->encoding == T4_COMPRESSION_ITU_T6); + s->rows_to_next_1d_row = s->max_rows_to_next_1d_row - 1; + + s->tx_bitstream = 0; + s->bitstream_iptr = 0; + s->bitstream_optr = 0; + s->bit_pos = 7; + s->tx_bits = 0; + s->row_bits = 0; + s->min_row_bits = INT_MAX; + s->max_row_bits = 0; + s->image_length = 0; + s->compressed_image_size = 0; + + s->ref_runs[0] = + s->ref_runs[1] = + s->ref_runs[2] = + s->ref_runs[3] = s->image_width; + s->ref_steps = 1; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t4_t6_encode_state_t *) t4_t6_encode_init(t4_t6_encode_state_t *s, + int encoding, + int image_width, + t4_row_read_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (t4_t6_encode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.4/T.6"); + + s->encoding = encoding; + s->row_read_handler = handler; + s->row_read_user_data = user_data; + + s->max_rows_to_next_1d_row = 2; + t4_t6_encode_restart(s, image_width); + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_release(t4_t6_encode_state_t *s) +{ + free_buffers(s); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_t6_encode_free(t4_t6_encode_state_t *s) +{ + int ret; + + ret = t4_t6_encode_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 1c9f9a2b5e..3961bfa94d 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -1,4 +1,3 @@ -//#define T4_STATE_DEBUGGING /* * SpanDSP - a series of DSP components for telephony * @@ -6,7 +5,7 @@ * * Written by Steve Underwood * - * Copyright (C) 2003, 2007 Steve Underwood + * Copyright (C) 2003, 2007, 2010 Steve Underwood * * All rights reserved. * @@ -24,33 +23,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* - * Much of this file is based on the T.4 and T.6 support in libtiff, which requires - * the following notice in any derived source code: - * - * Copyright (c) 1990-1997 Sam Leffler - * Copyright (c) 1991-1997 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - /*! \file */ #if defined(HAVE_CONFIG_H) @@ -82,45 +54,36 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#if defined(SPANDSP_SUPPORT_T85) #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" +#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/private/logging.h" -#if defined(SPANDSP_SUPPORT_T85) #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" +#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" #include "spandsp/private/t4_tx.h" +#include "faxfont.h" + /*! The number of centimetres in one inch */ #define CM_PER_INCH 2.54f -/*! The number of EOLs to be sent at the end of a T.4 page */ -#define EOLS_TO_END_T4_TX_PAGE 6 -/*! The number of EOLs to be sent at the end of a T.6 page */ -#define EOLS_TO_END_T6_TX_PAGE 2 - -#if defined(T4_STATE_DEBUGGING) -static void STATE_TRACE(const char *format, ...) -{ - va_list arg_ptr; - - va_start(arg_ptr, format); - vprintf(format, arg_ptr); - va_end(arg_ptr); -} -/*- End of function --------------------------------------------------------*/ -#else -#define STATE_TRACE(...) /**/ -#endif - #if defined(SPANDSP_SUPPORT_TIFF_FX) /* TIFF-FX related extensions to the tag set supported by libtiff */ static const TIFFFieldInfo tiff_fx_tiff_field_info[] = @@ -167,271 +130,396 @@ SPAN_DECLARE(void) TIFF_FX_init(void) /*- End of function --------------------------------------------------------*/ #endif -/*! T.4 run length table entry */ -typedef struct +static int test_resolution(int res_unit, float actual, float expected) { - /*! Length of T.4 code, in bits */ - uint16_t length; - /*! T.4 code */ - uint16_t code; - /*! Run length, in bits */ - int16_t run_length; -} t4_run_table_entry_t; + if (res_unit == RESUNIT_INCH) + actual *= 1.0f/CM_PER_INCH; + return (expected*0.95f <= actual && actual <= expected*1.05f); +} +/*- End of function --------------------------------------------------------*/ -#include "faxfont.h" - -/* Legitimate runs of zero bits which are the tail end of one code - plus the start of the next code do not exceed 10 bits. */ - -/* - * Note that these tables are ordered such that the index into the table - * is known to be either the run length, or (run length / 64) + a fixed - * offset. - */ -static const t4_run_table_entry_t t4_white_codes[] = +static int get_tiff_directory_info(t4_tx_state_t *s) { - { 8, 0x00AC, 0}, /* 0011 0101 */ - { 6, 0x0038, 1}, /* 0001 11 */ - { 4, 0x000E, 2}, /* 0111 */ - { 4, 0x0001, 3}, /* 1000 */ - { 4, 0x000D, 4}, /* 1011 */ - { 4, 0x0003, 5}, /* 1100 */ - { 4, 0x0007, 6}, /* 1110 */ - { 4, 0x000F, 7}, /* 1111 */ - { 5, 0x0019, 8}, /* 1001 1 */ - { 5, 0x0005, 9}, /* 1010 0 */ - { 5, 0x001C, 10}, /* 0011 1 */ - { 5, 0x0002, 11}, /* 0100 0 */ - { 6, 0x0004, 12}, /* 0010 00 */ - { 6, 0x0030, 13}, /* 0000 11 */ - { 6, 0x000B, 14}, /* 1101 00 */ - { 6, 0x002B, 15}, /* 1101 01 */ - { 6, 0x0015, 16}, /* 1010 10 */ - { 6, 0x0035, 17}, /* 1010 11 */ - { 7, 0x0072, 18}, /* 0100 111 */ - { 7, 0x0018, 19}, /* 0001 100 */ - { 7, 0x0008, 20}, /* 0001 000 */ - { 7, 0x0074, 21}, /* 0010 111 */ - { 7, 0x0060, 22}, /* 0000 011 */ - { 7, 0x0010, 23}, /* 0000 100 */ - { 7, 0x000A, 24}, /* 0101 000 */ - { 7, 0x006A, 25}, /* 0101 011 */ - { 7, 0x0064, 26}, /* 0010 011 */ - { 7, 0x0012, 27}, /* 0100 100 */ - { 7, 0x000C, 28}, /* 0011 000 */ - { 8, 0x0040, 29}, /* 0000 0010 */ - { 8, 0x00C0, 30}, /* 0000 0011 */ - { 8, 0x0058, 31}, /* 0001 1010 */ - { 8, 0x00D8, 32}, /* 0001 1011 */ - { 8, 0x0048, 33}, /* 0001 0010 */ - { 8, 0x00C8, 34}, /* 0001 0011 */ - { 8, 0x0028, 35}, /* 0001 0100 */ - { 8, 0x00A8, 36}, /* 0001 0101 */ - { 8, 0x0068, 37}, /* 0001 0110 */ - { 8, 0x00E8, 38}, /* 0001 0111 */ - { 8, 0x0014, 39}, /* 0010 1000 */ - { 8, 0x0094, 40}, /* 0010 1001 */ - { 8, 0x0054, 41}, /* 0010 1010 */ - { 8, 0x00D4, 42}, /* 0010 1011 */ - { 8, 0x0034, 43}, /* 0010 1100 */ - { 8, 0x00B4, 44}, /* 0010 1101 */ - { 8, 0x0020, 45}, /* 0000 0100 */ - { 8, 0x00A0, 46}, /* 0000 0101 */ - { 8, 0x0050, 47}, /* 0000 1010 */ - { 8, 0x00D0, 48}, /* 0000 1011 */ - { 8, 0x004A, 49}, /* 0101 0010 */ - { 8, 0x00CA, 50}, /* 0101 0011 */ - { 8, 0x002A, 51}, /* 0101 0100 */ - { 8, 0x00AA, 52}, /* 0101 0101 */ - { 8, 0x0024, 53}, /* 0010 0100 */ - { 8, 0x00A4, 54}, /* 0010 0101 */ - { 8, 0x001A, 55}, /* 0101 1000 */ - { 8, 0x009A, 56}, /* 0101 1001 */ - { 8, 0x005A, 57}, /* 0101 1010 */ - { 8, 0x00DA, 58}, /* 0101 1011 */ - { 8, 0x0052, 59}, /* 0100 1010 */ - { 8, 0x00D2, 60}, /* 0100 1011 */ - { 8, 0x004C, 61}, /* 0011 0010 */ - { 8, 0x00CC, 62}, /* 0011 0011 */ - { 8, 0x002C, 63}, /* 0011 0100 */ - { 5, 0x001B, 64}, /* 1101 1 */ - { 5, 0x0009, 128}, /* 1001 0 */ - { 6, 0x003A, 192}, /* 0101 11 */ - { 7, 0x0076, 256}, /* 0110 111 */ - { 8, 0x006C, 320}, /* 0011 0110 */ - { 8, 0x00EC, 384}, /* 0011 0111 */ - { 8, 0x0026, 448}, /* 0110 0100 */ - { 8, 0x00A6, 512}, /* 0110 0101 */ - { 8, 0x0016, 576}, /* 0110 1000 */ - { 8, 0x00E6, 640}, /* 0110 0111 */ - { 9, 0x0066, 704}, /* 0110 0110 0 */ - { 9, 0x0166, 768}, /* 0110 0110 1 */ - { 9, 0x0096, 832}, /* 0110 1001 0 */ - { 9, 0x0196, 896}, /* 0110 1001 1 */ - { 9, 0x0056, 960}, /* 0110 1010 0 */ - { 9, 0x0156, 1024}, /* 0110 1010 1 */ - { 9, 0x00D6, 1088}, /* 0110 1011 0 */ - { 9, 0x01D6, 1152}, /* 0110 1011 1 */ - { 9, 0x0036, 1216}, /* 0110 1100 0 */ - { 9, 0x0136, 1280}, /* 0110 1100 1 */ - { 9, 0x00B6, 1344}, /* 0110 1101 0 */ - { 9, 0x01B6, 1408}, /* 0110 1101 1 */ - { 9, 0x0032, 1472}, /* 0100 1100 0 */ - { 9, 0x0132, 1536}, /* 0100 1100 1 */ - { 9, 0x00B2, 1600}, /* 0100 1101 0 */ - { 6, 0x0006, 1664}, /* 0110 00 */ - { 9, 0x01B2, 1728}, /* 0100 1101 1 */ - {11, 0x0080, 1792}, /* 0000 0001 000 */ - {11, 0x0180, 1856}, /* 0000 0001 100 */ - {11, 0x0580, 1920}, /* 0000 0001 101 */ - {12, 0x0480, 1984}, /* 0000 0001 0010 */ - {12, 0x0C80, 2048}, /* 0000 0001 0011 */ - {12, 0x0280, 2112}, /* 0000 0001 0100 */ - {12, 0x0A80, 2176}, /* 0000 0001 0101 */ - {12, 0x0680, 2240}, /* 0000 0001 0110 */ - {12, 0x0E80, 2304}, /* 0000 0001 0111 */ - {12, 0x0380, 2368}, /* 0000 0001 1100 */ - {12, 0x0B80, 2432}, /* 0000 0001 1101 */ - {12, 0x0780, 2496}, /* 0000 0001 1110 */ - {12, 0x0F80, 2560}, /* 0000 0001 1111 */ -}; + static const struct + { + float resolution; + int code; + } x_res_table[] = + { + { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4}, + { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8}, + { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300}, + { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16}, + { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600}, + { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800}, + {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200}, + { -1.00f, -1} + }; + static const struct + { + float resolution; + int code; + } y_res_table[] = + { + { 38.50f, T4_Y_RESOLUTION_STANDARD}, + { 77.00f, T4_Y_RESOLUTION_FINE}, + { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300}, + { 154.00f, T4_Y_RESOLUTION_SUPERFINE}, + { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600}, + { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800}, + {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200}, + { -1.00f, -1} + }; + uint16_t res_unit; + uint8_t parm8; + uint16_t parm16; + uint32_t parm32; + char *u; + char uu[10]; + float x_resolution; + float y_resolution; + int i; + t4_tx_tiff_state_t *t; -static const t4_run_table_entry_t t4_black_codes[] = + t = &s->tiff; + parm16 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16); + if (parm16 != 1) + return -1; + parm16 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16); + if (parm16 != 1) + return -1; + parm32 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); + s->image_width = parm32; + parm32 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_IMAGELENGTH, &parm32); + s->image_length = parm32; + x_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); + y_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution); + res_unit = RESUNIT_INCH; + TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); + t->photo_metric = PHOTOMETRIC_MINISWHITE; + TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &t->photo_metric); + /* TIFFGetField(t->tiff_file, TIFFTAG_COMPRESSION, &t->????); */ + + if (t->photo_metric != PHOTOMETRIC_MINISWHITE) + span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", s->tiff.file); + t->fill_order = FILLORDER_LSB2MSB; + + /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the + precise value. The other value should be exact. */ + /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */ + s->metadata.x_resolution = T4_X_RESOLUTION_R8; + for (i = 0; x_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution)) + { + s->metadata.x_resolution = x_res_table[i].code; + break; + } + } + + s->metadata.y_resolution = T4_Y_RESOLUTION_STANDARD; + for (i = 0; y_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution)) + { + s->metadata.y_resolution = y_res_table[i].code; + break; + } + } + t4_tx_set_image_width(s, s->image_width); + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t4_t6_encode_set_image_width(&s->encoder.t4_t6, s->image_width); + t4_t6_encode_set_max_2d_rows_per_1d_row(&s->encoder.t4_t6, -s->metadata.y_resolution); + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t42_encode_set_image_width(&s->encoder.t42, s->image_width); + t42_encode_set_image_length(&s->encoder.t42, s->image_length); + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t43_encode_set_image_width(&s->encoder.t43, s->image_width); + t43_encode_set_image_length(&s->encoder.t43, s->image_length); + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t85_encode_set_image_width(&s->encoder.t85, s->image_width); + t85_encode_set_image_length(&s->encoder.t85, s->image_length); + break; + } +#if defined(SPANDSP_SUPPORT_TIFF_FX) + if (TIFFGetField(t->tiff_file, TIFFTAG_PROFILETYPE, &parm32)) + printf("Profile type %u\n", parm32); + if (TIFFGetField(t->tiff_file, TIFFTAG_FAXPROFILE, &parm8)) + printf("FAX profile %u\n", parm8); + if (TIFFGetField(t->tiff_file, TIFFTAG_CODINGMETHODS, &parm32)) + printf("Coding methods 0x%x\n", parm32); + if (TIFFGetField(t->tiff_file, TIFFTAG_VERSIONYEAR, &u)) + { + memcpy(uu, u, 4); + uu[4] = '\0'; + printf("Version year \"%s\"\n", uu); + } + if (TIFFGetField(t->tiff_file, TIFFTAG_MODENUMBER, &parm8)) + printf("Mode number %u\n", parm8); +#endif + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int test_tiff_directory_info(t4_tx_state_t *s) { - {10, 0x03B0, 0}, /* 0000 1101 11 */ - { 3, 0x0002, 1}, /* 010 */ - { 2, 0x0003, 2}, /* 11 */ - { 2, 0x0001, 3}, /* 10 */ - { 3, 0x0006, 4}, /* 011 */ - { 4, 0x000C, 5}, /* 0011 */ - { 4, 0x0004, 6}, /* 0010 */ - { 5, 0x0018, 7}, /* 0001 1 */ - { 6, 0x0028, 8}, /* 0001 01 */ - { 6, 0x0008, 9}, /* 0001 00 */ - { 7, 0x0010, 10}, /* 0000 100 */ - { 7, 0x0050, 11}, /* 0000 101 */ - { 7, 0x0070, 12}, /* 0000 111 */ - { 8, 0x0020, 13}, /* 0000 0100 */ - { 8, 0x00E0, 14}, /* 0000 0111 */ - { 9, 0x0030, 15}, /* 0000 1100 0 */ - {10, 0x03A0, 16}, /* 0000 0101 11 */ - {10, 0x0060, 17}, /* 0000 0110 00 */ - {10, 0x0040, 18}, /* 0000 0010 00 */ - {11, 0x0730, 19}, /* 0000 1100 111 */ - {11, 0x00B0, 20}, /* 0000 1101 000 */ - {11, 0x01B0, 21}, /* 0000 1101 100 */ - {11, 0x0760, 22}, /* 0000 0110 111 */ - {11, 0x00A0, 23}, /* 0000 0101 000 */ - {11, 0x0740, 24}, /* 0000 0010 111 */ - {11, 0x00C0, 25}, /* 0000 0011 000 */ - {12, 0x0530, 26}, /* 0000 1100 1010 */ - {12, 0x0D30, 27}, /* 0000 1100 1011 */ - {12, 0x0330, 28}, /* 0000 1100 1100 */ - {12, 0x0B30, 29}, /* 0000 1100 1101 */ - {12, 0x0160, 30}, /* 0000 0110 1000 */ - {12, 0x0960, 31}, /* 0000 0110 1001 */ - {12, 0x0560, 32}, /* 0000 0110 1010 */ - {12, 0x0D60, 33}, /* 0000 0110 1011 */ - {12, 0x04B0, 34}, /* 0000 1101 0010 */ - {12, 0x0CB0, 35}, /* 0000 1101 0011 */ - {12, 0x02B0, 36}, /* 0000 1101 0100 */ - {12, 0x0AB0, 37}, /* 0000 1101 0101 */ - {12, 0x06B0, 38}, /* 0000 1101 0110 */ - {12, 0x0EB0, 39}, /* 0000 1101 0111 */ - {12, 0x0360, 40}, /* 0000 0110 1100 */ - {12, 0x0B60, 41}, /* 0000 0110 1101 */ - {12, 0x05B0, 42}, /* 0000 1101 1010 */ - {12, 0x0DB0, 43}, /* 0000 1101 1011 */ - {12, 0x02A0, 44}, /* 0000 0101 0100 */ - {12, 0x0AA0, 45}, /* 0000 0101 0101 */ - {12, 0x06A0, 46}, /* 0000 0101 0110 */ - {12, 0x0EA0, 47}, /* 0000 0101 0111 */ - {12, 0x0260, 48}, /* 0000 0110 0100 */ - {12, 0x0A60, 49}, /* 0000 0110 0101 */ - {12, 0x04A0, 50}, /* 0000 0101 0010 */ - {12, 0x0CA0, 51}, /* 0000 0101 0011 */ - {12, 0x0240, 52}, /* 0000 0010 0100 */ - {12, 0x0EC0, 53}, /* 0000 0011 0111 */ - {12, 0x01C0, 54}, /* 0000 0011 1000 */ - {12, 0x0E40, 55}, /* 0000 0010 0111 */ - {12, 0x0140, 56}, /* 0000 0010 1000 */ - {12, 0x01A0, 57}, /* 0000 0101 1000 */ - {12, 0x09A0, 58}, /* 0000 0101 1001 */ - {12, 0x0D40, 59}, /* 0000 0010 1011 */ - {12, 0x0340, 60}, /* 0000 0010 1100 */ - {12, 0x05A0, 61}, /* 0000 0101 1010 */ - {12, 0x0660, 62}, /* 0000 0110 0110 */ - {12, 0x0E60, 63}, /* 0000 0110 0111 */ - {10, 0x03C0, 64}, /* 0000 0011 11 */ - {12, 0x0130, 128}, /* 0000 1100 1000 */ - {12, 0x0930, 192}, /* 0000 1100 1001 */ - {12, 0x0DA0, 256}, /* 0000 0101 1011 */ - {12, 0x0CC0, 320}, /* 0000 0011 0011 */ - {12, 0x02C0, 384}, /* 0000 0011 0100 */ - {12, 0x0AC0, 448}, /* 0000 0011 0101 */ - {13, 0x06C0, 512}, /* 0000 0011 0110 0 */ - {13, 0x16C0, 576}, /* 0000 0011 0110 1 */ - {13, 0x0A40, 640}, /* 0000 0010 0101 0 */ - {13, 0x1A40, 704}, /* 0000 0010 0101 1 */ - {13, 0x0640, 768}, /* 0000 0010 0110 0 */ - {13, 0x1640, 832}, /* 0000 0010 0110 1 */ - {13, 0x09C0, 896}, /* 0000 0011 1001 0 */ - {13, 0x19C0, 960}, /* 0000 0011 1001 1 */ - {13, 0x05C0, 1024}, /* 0000 0011 1010 0 */ - {13, 0x15C0, 1088}, /* 0000 0011 1010 1 */ - {13, 0x0DC0, 1152}, /* 0000 0011 1011 0 */ - {13, 0x1DC0, 1216}, /* 0000 0011 1011 1 */ - {13, 0x0940, 1280}, /* 0000 0010 1001 0 */ - {13, 0x1940, 1344}, /* 0000 0010 1001 1 */ - {13, 0x0540, 1408}, /* 0000 0010 1010 0 */ - {13, 0x1540, 1472}, /* 0000 0010 1010 1 */ - {13, 0x0B40, 1536}, /* 0000 0010 1101 0 */ - {13, 0x1B40, 1600}, /* 0000 0010 1101 1 */ - {13, 0x04C0, 1664}, /* 0000 0011 0010 0 */ - {13, 0x14C0, 1728}, /* 0000 0011 0010 1 */ - {11, 0x0080, 1792}, /* 0000 0001 000 */ - {11, 0x0180, 1856}, /* 0000 0001 100 */ - {11, 0x0580, 1920}, /* 0000 0001 101 */ - {12, 0x0480, 1984}, /* 0000 0001 0010 */ - {12, 0x0C80, 2048}, /* 0000 0001 0011 */ - {12, 0x0280, 2112}, /* 0000 0001 0100 */ - {12, 0x0A80, 2176}, /* 0000 0001 0101 */ - {12, 0x0680, 2240}, /* 0000 0001 0110 */ - {12, 0x0E80, 2304}, /* 0000 0001 0111 */ - {12, 0x0380, 2368}, /* 0000 0001 1100 */ - {12, 0x0B80, 2432}, /* 0000 0001 1101 */ - {12, 0x0780, 2496}, /* 0000 0001 1110 */ - {12, 0x0F80, 2560}, /* 0000 0001 1111 */ -}; + static const struct + { + float resolution; + int code; + } x_res_table[] = + { + { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4}, + { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8}, + { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300}, + { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16}, + { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600}, + { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800}, + {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200}, + { -1.00f, -1} + }; + static const struct + { + float resolution; + int code; + } y_res_table[] = + { + { 38.50f, T4_Y_RESOLUTION_STANDARD}, + { 77.00f, T4_Y_RESOLUTION_FINE}, + { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300}, + { 154.00f, T4_Y_RESOLUTION_SUPERFINE}, + { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600}, + { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800}, + {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200}, + { -1.00f, -1} + }; + uint16_t res_unit; + uint16_t parm16; + uint32_t parm32; + float x_resolution; + float y_resolution; + int i; + t4_tx_tiff_state_t *t; -static int encode_row(t4_state_t *s); + t = &s->tiff; + parm16 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16); + if (parm16 != 1) + return -1; + parm16 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16); + if (parm16 != 1) + return -1; + parm32 = 0; + TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); + if (s->image_width != (int) parm32) + return 1; + x_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); + y_resolution = 0.0f; + TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution); + res_unit = RESUNIT_INCH; + TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); -static void make_header(t4_state_t *s, char *header) + /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the + precise value. The other value should be exact. */ + /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */ + for (i = 0; x_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution)) + break; + } + if (s->metadata.x_resolution != x_res_table[i].code) + return 1; + for (i = 0; y_res_table[i].code > 0; i++) + { + if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution)) + break; + } + if (s->metadata.y_resolution != y_res_table[i].code) + return 1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int get_tiff_total_pages(t4_tx_state_t *s) +{ + int max; + + /* Each page *should* contain the total number of pages, but can this be + trusted? Some files say 0. Actually searching for the last page is + more reliable. */ + max = 0; + while (TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) max)) + max++; + /* Back to the previous page */ + if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) + return -1; + return max; +} +/*- End of function --------------------------------------------------------*/ + +static int open_tiff_input_file(t4_tx_state_t *s, const char *file) +{ + if ((s->tiff.tiff_file = TIFFOpen(file, "r")) == NULL) + return -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int tiff_row_read_handler(void *user_data, uint8_t buf[], size_t len) +{ + t4_tx_state_t *s; + int i; + + s = (t4_tx_state_t *) user_data; + if (s->tiff.row >= s->image_length) + return 0; +#if 0 + if (TIFFReadScanline(s->tiff.tiff_file, buf, s->tiff.row, 0) < 0) + span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error reading TIFF row.\n", s->tiff.file); +#else + memcpy(buf, &s->tiff.image_buffer[s->tiff.row*len], len); +#endif + if (s->tiff.photo_metric != PHOTOMETRIC_MINISWHITE) + { + for (i = 0; i < len; i++) + buf[i] = ~buf[i]; + } + if (s->tiff.fill_order != FILLORDER_LSB2MSB) + bit_reverse(buf, buf, len); + s->tiff.row++; + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int read_tiff_image(t4_tx_state_t *s) +{ + int total_len; + int len; + int bytes_per_row; + int i; + uint8_t *t; + + s->image_width = 0; + TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGEWIDTH, &s->image_width); + s->image_length = 0; + TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGELENGTH, &s->image_length); + bytes_per_row = TIFFScanlineSize(s->tiff.tiff_file); + s->tiff.image_size = s->image_length*bytes_per_row; + if (s->tiff.image_size >= s->tiff.image_buffer_size) + { + if ((t = realloc(s->tiff.image_buffer, s->tiff.image_size)) == NULL) + return -1; + s->tiff.image_buffer_size += s->tiff.image_size; + s->tiff.image_buffer = t; + } + +#if 1 + for (i = 0, total_len = 0; total_len < s->tiff.image_size; i++, total_len += len) + { + if ((len = TIFFReadEncodedStrip(s->tiff.tiff_file, i, &s->tiff.image_buffer[total_len], s->tiff.image_size - total_len)) < 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error.\n", s->tiff.file); + return -1; + } + } +#endif + s->tiff.row = 0; + return s->image_length; +} +/*- End of function --------------------------------------------------------*/ + +static void tiff_tx_release(t4_tx_state_t *s) +{ + if (s->tiff.tiff_file) + { + TIFFClose(s->tiff.tiff_file); + s->tiff.tiff_file = NULL; + if (s->tiff.file) + free((char *) s->tiff.file); + s->tiff.file = NULL; + } + if (s->tiff.image_buffer) + { + free(s->tiff.image_buffer); + s->tiff.image_buffer = NULL; + s->tiff.image_size = 0; + s->tiff.image_buffer_size = 0; + } +} +/*- End of function --------------------------------------------------------*/ + +static int set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, void *user_data) +{ + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_encode_set_row_read_handler(&s->encoder.t4_t6, handler, user_data); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_encode_set_row_read_handler(&s->encoder.t42, handler, user_data); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_encode_set_row_read_handler(&s->encoder.t43, handler, user_data); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_encode_set_row_read_handler(&s->encoder.t85, handler, user_data); + } + return -1; +} +/*- End of function --------------------------------------------------------*/ + +static int make_header(t4_tx_state_t *s) { time_t now; struct tm tm; static const char *months[] = { - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; + if (s->header_text == NULL) + { + if ((s->header_text = malloc(132 + 1)) == NULL) + return -1; + } + /* This is very English oriented, but then most FAX machines are, too. Some + measure of i18n in the time and date, and even the header_info string, is + entirely possible, although the font area would need some serious work to + properly deal with East Asian script. There is no spec for what the header + should contain, or how much of the page it might occupy. The present format + follows the common practice of a few FAX machines. Nothing more. */ time(&now); if (s->tz) tz_localtime(s->tz, &tm, now); else tm = *localtime(&now); - snprintf(header, + + snprintf(s->header_text, 132, " %2d-%s-%d %02d:%02d %-50s %-21s p.%d", tm.tm_mday, @@ -439,25 +527,24 @@ static void make_header(t4_state_t *s, char *header) tm.tm_year + 1900, tm.tm_hour, tm.tm_min, - s->header_info, - (s->tiff.local_ident) ? s->tiff.local_ident : "", + (s->header_info) ? s->header_info : "", + (s->local_ident) ? s->local_ident : "", s->current_page + 1); + return 0; } /*- End of function --------------------------------------------------------*/ -static int t4_tx_put_fax_header(t4_state_t *s, int *rows) +static int header_row_read_handler(void *user_data, uint8_t buf[], size_t len) { - int row; - int i; int repeats; int pattern; - int row_bufptr; + int pos; + int row; char *t; - char header[132 + 1]; + t4_tx_state_t *s; - /* Modify the resulting image to include a header line, typical of hardware FAX machines */ - make_header(s, header); - switch (s->y_resolution) + s = (t4_tx_state_t *) user_data; + switch (s->metadata.y_resolution) { case T4_Y_RESOLUTION_1200: repeats = 12; @@ -481,1051 +568,492 @@ static int t4_tx_put_fax_header(t4_state_t *s, int *rows) repeats = 1; break; } - *rows = 16*repeats; - for (row = 0; row < 16; row++) + if (s->header_overlays_image) { - t = header; - row_bufptr = 0; - for (t = header; *t && row_bufptr <= s->bytes_per_row - 2; t++) + /* Read and dump a row of the real image, allowing for the possibility + that the real image might end within the header itself */ + if (len != s->row_handler(s->row_handler_user_data, buf, len)) { - pattern = header_font[(uint8_t) *t][row]; - s->row_buf[row_bufptr++] = (uint8_t) (pattern >> 8); - s->row_buf[row_bufptr++] = (uint8_t) (pattern & 0xFF); - } - for ( ; row_bufptr < s->bytes_per_row; ) - s->row_buf[row_bufptr++] = 0; - for (i = 0; i < repeats; i++) - { - if (encode_row(s)) - return -1; + set_row_read_handler(s, s->row_handler, s->row_handler_user_data); + return len; } } - return 0; + row = s->header_row/repeats; + pos = 0; + for (t = s->header_text; *t && pos <= len - 2; t++) + { + pattern = header_font[(uint8_t) *t][row]; + buf[pos++] = (uint8_t) (pattern >> 8); + buf[pos++] = (uint8_t) (pattern & 0xFF); + } + while (pos < len) + buf[pos++] = 0; + s->header_row++; + if (s->header_row >= 16*repeats) + set_row_read_handler(s, s->row_handler, s->row_handler_user_data); + return len; } /*- End of function --------------------------------------------------------*/ -static int test_resolution(int res_unit, float actual, float expected) +SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_tx_state_t *s) { - if (res_unit == RESUNIT_INCH) - actual *= 1.0f/CM_PER_INCH; - return (expected*0.95f <= actual && actual <= expected*1.05f); + span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existence of page %d\n", s->current_page + 1); + if (s->current_page >= s->stop_page) + return -1; + if (s->tiff.file) + { + if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page + 1)) + return -1; + return test_tiff_directory_info(s); + } + return -1; } /*- End of function --------------------------------------------------------*/ -static int get_tiff_directory_info(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, void *user_data) { - static const struct - { - float resolution; - int code; - } x_res_table[] = - { - { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4}, - { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8}, - { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300}, - { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16}, - { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600}, - { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800}, - {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200}, - { -1.00f, -1} - }; - static const struct - { - float resolution; - int code; - int max_rows_to_next_1d_row; - } y_res_table[] = - { - { 38.50f, T4_Y_RESOLUTION_STANDARD, 2}, - { 77.00f, T4_Y_RESOLUTION_FINE, 4}, - { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6}, - { 154.00f, T4_Y_RESOLUTION_SUPERFINE, 8}, - { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12}, - { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16}, - {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24}, - { -1.00f, -1, -1} - }; - uint16_t res_unit; - uint16_t parm16; - uint32_t parm32; - float x_resolution; - float y_resolution; - int i; - t4_tiff_state_t *t; + s->row_handler = handler; + s->row_handler_user_data = user_data; + return set_row_read_handler(s, handler, user_data); +} +/*- End of function --------------------------------------------------------*/ - t = &s->tiff; - parm16 = 0; - TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16); - if (parm16 != 1) - return -1; - TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16); - if (parm16 != 1) - return -1; - parm32 = 0; - TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); - s->image_width = parm32; - s->bytes_per_row = (s->image_width + 7)/8; - parm32 = 0; - TIFFGetField(t->tiff_file, TIFFTAG_IMAGELENGTH, &parm32); - s->image_length = parm32; - x_resolution = 0.0f; - TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); - y_resolution = 0.0f; - TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution); - res_unit = RESUNIT_INCH; - TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); - t->photo_metric = PHOTOMETRIC_MINISWHITE; - TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &t->photo_metric); - if (t->photo_metric != PHOTOMETRIC_MINISWHITE) - span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", t->file); - t->fill_order = FILLORDER_LSB2MSB; -#if 0 - TIFFGetField(t->tiff_file, TIFFTAG_FILLORDER, &t->fill_order); - if (t->fill_order != FILLORDER_LSB2MSB) - span_log(&s->logging, SPAN_LOG_FLOW, "%s: Fill order needs swapping.\n", t->file); +SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) +{ + switch (encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + break; + default: + t4_t6_encode_init(&s->encoder.t4_t6, encoding, s->image_width, s->row_handler, s->row_handler_user_data); + t4_t6_encode_set_max_2d_rows_per_1d_row(&s->encoder.t4_t6, -s->metadata.y_resolution); + break; + } + s->line_encoding = encoding; + return t4_t6_encode_set_encoding(&s->encoder.t4_t6, encoding); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T42: + break; + default: + t42_encode_init(&s->encoder.t42, s->image_width, s->image_length, s->row_handler, s->row_handler_user_data); + break; + } + s->line_encoding = encoding; + return 0; #endif - - /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the - precise value. The other value should be exact. */ - /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */ - s->x_resolution = T4_X_RESOLUTION_R8; - for (i = 0; x_res_table[i].code > 0; i++) - { - if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution)) +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + switch (s->line_encoding) { - s->x_resolution = x_res_table[i].code; + case T4_COMPRESSION_ITU_T43: + break; + default: + t43_encode_init(&s->encoder.t43, s->image_width, s->image_length, s->row_handler, s->row_handler_user_data); break; } - } - - s->y_resolution = T4_Y_RESOLUTION_STANDARD; - s->t4_t6_tx.max_rows_to_next_1d_row = 2; - for (i = 0; y_res_table[i].code > 0; i++) - { - if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution)) + s->line_encoding = encoding; + return 0; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + switch (s->line_encoding) { - s->y_resolution = y_res_table[i].code; - s->t4_t6_tx.max_rows_to_next_1d_row = y_res_table[i].max_rows_to_next_1d_row; + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + break; + default: + t85_encode_init(&s->encoder.t85, s->image_width, s->image_length, s->row_handler, s->row_handler_user_data); break; } + s->line_encoding = encoding; + return 0; } - - return 0; + return -1; } /*- End of function --------------------------------------------------------*/ -static int test_tiff_directory_info(t4_state_t *s) +SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits) { - static const struct + switch (s->line_encoding) { - float resolution; - int code; - } x_res_table[] = - { - { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4}, - { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8}, - { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300}, - { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16}, - { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600}, - { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800}, - {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200}, - { -1.00f, -1} - }; - static const struct - { - float resolution; - int code; - int max_rows_to_next_1d_row; - } y_res_table[] = - { - { 38.50f, T4_Y_RESOLUTION_STANDARD, 2}, - { 77.00f, T4_Y_RESOLUTION_FINE, 4}, - { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6}, - { 154.00f, T4_Y_RESOLUTION_SUPERFINE, 8}, - { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12}, - { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16}, - {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24}, - { -1.00f, -1, -1} - }; - uint16_t res_unit; - uint16_t parm16; - uint32_t parm32; - float x_resolution; - float y_resolution; - int i; - t4_tiff_state_t *t; - - t = &s->tiff; - parm16 = 0; - TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16); - if (parm16 != 1) - return -1; - parm32 = 0; - TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); - if (s->image_width != (int) parm32) - return 1; - x_resolution = 0.0f; - TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); - y_resolution = 0.0f; - TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution); - res_unit = RESUNIT_INCH; - TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); - - /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the - precise value. The other value should be exact. */ - /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */ - for (i = 0; x_res_table[i].code > 0; i++) - { - if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution)) - break; + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t4_t6_encode_set_min_bits_per_row(&s->encoder.t4_t6, bits); + break; } - if (s->x_resolution != x_res_table[i].code) - return 1; - for (i = 0; y_res_table[i].code > 0; i++) - { - if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution)) - break; - } - if (s->y_resolution != y_res_table[i].code) - return 1; - return 0; } /*- End of function --------------------------------------------------------*/ -static int get_tiff_total_pages(t4_state_t *s) +SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width) +{ + s->image_width = image_width; + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t4_t6_encode_set_image_width(&s->encoder.t4_t6, image_width); + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t42_encode_set_image_width(&s->encoder.t42, image_width); + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t43_encode_set_image_width(&s->encoder.t43, image_width); + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t85_encode_set_image_width(&s->encoder.t85, image_width); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_max_2d_rows_per_1d_row(t4_tx_state_t *s, int max) +{ + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t4_t6_encode_set_max_2d_rows_per_1d_row(&s->encoder.t4_t6, max); + break; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_image_width(t4_tx_state_t *s) +{ + return s->image_width; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_tx_state_t *s, int header_overlays_image) +{ + s->header_overlays_image = header_overlays_image; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_local_ident(t4_tx_state_t *s, const char *ident) +{ + s->local_ident = (ident && ident[0]) ? ident : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_header_info(t4_tx_state_t *s, const char *info) +{ + s->header_info = (info && info[0]) ? info : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_header_tz(t4_tx_state_t *s, struct tz_s *tz) +{ + s->tz = tz; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_tx_state_t *s) +{ + return s->metadata.y_resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_tx_state_t *s) +{ + return s->metadata.x_resolution; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_tx_state_t *s) { int max; - /* Each page *should* contain the total number of pages, but can this be - trusted? Some files say 0. Actually searching for the last page is - more reliable. */ - max = 0; - while (TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) max)) - max++; - /* Back to the previous page */ - if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) - return -1; + if (s->tiff.file) + max = get_tiff_total_pages(s); + else + max = 1; + if (max >= 0) + s->tiff.pages_in_file = max; return max; } /*- End of function --------------------------------------------------------*/ -static int open_tiff_input_file(t4_state_t *s, const char *file) +SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_tx_state_t *s) { - if ((s->tiff.tiff_file = TIFFOpen(file, "r")) == NULL) - return -1; - return 0; + return s->current_page; } /*- End of function --------------------------------------------------------*/ -static int read_tiff_image(t4_state_t *s) +SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t) { - int row; - int image_length; - int i; - - image_length = 0; - TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGELENGTH, &image_length); - for (row = 0; row < image_length; row++) + memset(t, 0, sizeof(*t)); + t->pages_transferred = s->current_page - s->start_page; + t->pages_in_file = s->tiff.pages_in_file; + t->x_resolution = s->metadata.x_resolution; + t->y_resolution = s->metadata.y_resolution; + t->encoding = s->line_encoding; + switch (s->line_encoding) { - if (TIFFReadScanline(s->tiff.tiff_file, s->row_buf, row, 0) <= 0) - { - span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->tiff.file, row); - break; - } - if (s->tiff.photo_metric != PHOTOMETRIC_MINISWHITE) - { - for (i = 0; i < s->bytes_per_row; i++) - s->row_buf[i] = ~s->row_buf[i]; - } - if (s->tiff.fill_order != FILLORDER_LSB2MSB) - bit_reverse(s->row_buf, s->row_buf, s->bytes_per_row); - if (encode_row(s)) - return -1; - } - return image_length; -} -/*- End of function --------------------------------------------------------*/ - -static int close_tiff_input_file(t4_state_t *s) -{ - TIFFClose(s->tiff.tiff_file); - s->tiff.tiff_file = NULL; - if (s->tiff.file) - free((char *) s->tiff.file); - s->tiff.file = NULL; - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static void update_row_bit_info(t4_state_t *s) -{ - if (s->row_bits > s->max_row_bits) - s->max_row_bits = s->row_bits; - if (s->row_bits < s->min_row_bits) - s->min_row_bits = s->row_bits; - s->row_bits = 0; -} -/*- End of function --------------------------------------------------------*/ - -static int free_buffers(t4_state_t *s) -{ - if (s->image_buffer) - { - free(s->image_buffer); - s->image_buffer = NULL; - s->image_buffer_size = 0; - } - if (s->cur_runs) - { - free(s->cur_runs); - s->cur_runs = NULL; - } - if (s->ref_runs) - { - free(s->ref_runs); - s->ref_runs = NULL; - } - if (s->row_buf) - { - free(s->row_buf); - s->row_buf = NULL; - } - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static int row_to_run_lengths(uint32_t list[], const uint8_t row[], int width) -{ - uint32_t flip; - uint32_t x; - int span; - int entry; - int frag; - int rem; - int limit; - int i; - int pos; - - /* Deal with whole words first. We know we are starting on a word boundary. */ - entry = 0; - flip = 0; - limit = (width >> 3) & ~3; - span = 0; - pos = 0; - for (i = 0; i < limit; i += sizeof(uint32_t)) - { - x = *((uint32_t *) &row[i]); - if (x != flip) - { - x = ((uint32_t) row[i] << 24) | ((uint32_t) row[i + 1] << 16) | ((uint32_t) row[i + 2] << 8) | ((uint32_t) row[i + 3]); - /* We know we are going to find at least one transition. */ - frag = 31 - top_bit(x ^ flip); - pos += ((i << 3) - span + frag); - list[entry++] = pos; - x <<= frag; - flip ^= 0xFFFFFFFF; - rem = 32 - frag; - /* Now see if there are any more */ - while ((frag = 31 - top_bit(x ^ flip)) < rem) - { - pos += frag; - list[entry++] = pos; - x <<= frag; - flip ^= 0xFFFFFFFF; - rem -= frag; - } - /* Save the remainder of the word */ - span = (i << 3) + 32 - rem; - } - } - /* Now deal with some whole bytes, if there are any left. */ - limit = width >> 3; - flip &= 0xFF000000; - if (i < limit) - { - for ( ; i < limit; i++) - { - x = (uint32_t) row[i] << 24; - if (x != flip) - { - /* We know we are going to find at least one transition. */ - frag = 31 - top_bit(x ^ flip); - pos += ((i << 3) - span + frag); - list[entry++] = pos; - x <<= frag; - flip ^= 0xFF000000; - rem = 8 - frag; - /* Now see if there are any more */ - while ((frag = 31 - top_bit(x ^ flip)) < rem) - { - pos += frag; - list[entry++] = pos; - x <<= frag; - flip ^= 0xFF000000; - rem -= frag; - } - /* Save the remainder of the word */ - span = (i << 3) + 8 - rem; - } - } - } - /* Deal with any left over fractional byte. */ - span = (i << 3) - span; - if ((rem = width & 7)) - { - x = row[i]; - x <<= 24; - do - { - frag = 31 - top_bit(x ^ flip); - if (frag > rem) - frag = rem; - pos += (span + frag); - list[entry++] = pos; - x <<= frag; - span = 0; - flip ^= 0xFF000000; - rem -= frag; - } - while (rem > 0); - } - else - { - if (span) - { - pos += span; - list[entry++] = pos; - } - } - return entry; -} -/*- End of function --------------------------------------------------------*/ - -static __inline__ int put_encoded_bits(t4_state_t *s, uint32_t bits, int length) -{ - uint8_t *t; - - /* We might be called with a large length value, to spew out a mass of zero bits for - minimum row length padding. */ - s->tx_bitstream |= (bits << s->tx_bits); - s->tx_bits += length; - s->row_bits += length; - if ((s->image_size + (s->tx_bits + 7)/8) >= s->image_buffer_size) - { - if ((t = realloc(s->image_buffer, s->image_buffer_size + 100*s->bytes_per_row)) == NULL) - return -1; - s->image_buffer = t; - s->image_buffer_size += 100*s->bytes_per_row; - } - while (s->tx_bits >= 8) - { - s->image_buffer[s->image_size++] = (uint8_t) (s->tx_bitstream & 0xFF); - s->tx_bitstream >>= 8; - s->tx_bits -= 8; - } - return 0; -} -/*- End of function --------------------------------------------------------*/ - -/* - * Write the sequence of codes that describes - * the specified span of zero's or one's. The - * appropriate table that holds the make-up and - * terminating codes is supplied. - */ -static __inline__ int put_1d_span(t4_state_t *s, int32_t span, const t4_run_table_entry_t *tab) -{ - const t4_run_table_entry_t *te; - - te = &tab[63 + (2560 >> 6)]; - while (span >= 2560 + 64) - { - if (put_encoded_bits(s, te->code, te->length)) - return -1; - span -= te->run_length; - } - te = &tab[63 + (span >> 6)]; - if (span >= 64) - { - if (put_encoded_bits(s, te->code, te->length)) - return -1; - span -= te->run_length; - } - if (put_encoded_bits(s, tab[span].code, tab[span].length)) - return -1; - return 0; -} -/*- End of function --------------------------------------------------------*/ - -#define pixel_is_black(x,bit) (((x)[(bit) >> 3] << ((bit) & 7)) & 0x80) - -/* - * Write an EOL code to the output stream. We also handle writing the tag - * bit for the next scanline when doing 2D encoding. - */ -static void encode_eol(t4_state_t *s) -{ - uint32_t code; - int length; - - if (s->line_encoding == T4_COMPRESSION_ITU_T4_2D) - { - code = 0x0800 | ((!s->row_is_2d) << 12); - length = 13; - } - else - { - /* T.4 1D EOL, or T.6 EOFB */ - code = 0x800; - length = 12; - } - if (s->row_bits) - { - /* We may need to pad the row to a minimum length, unless we are in T.6 mode. - In T.6 we only come here at the end of the page to add the EOFB marker, which - is like two 1D EOLs. */ - if (s->line_encoding != T4_COMPRESSION_ITU_T6) - { - if (s->row_bits + length < s->t4_t6_tx.min_bits_per_row) - put_encoded_bits(s, 0, s->t4_t6_tx.min_bits_per_row - (s->row_bits + length)); - } - put_encoded_bits(s, code, length); - update_row_bit_info(s); - } - else - { - /* We don't pad zero length rows. They are the consecutive EOLs which end a page. */ - put_encoded_bits(s, code, length); - /* Don't do the full update row bit info, or the minimum suddenly drops to the - length of an EOL. Just clear the row bits, so we treat the next EOL as an - end of page EOL, with no padding. */ - s->row_bits = 0; + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t->width = t4_t6_encode_get_image_width(&s->encoder.t4_t6); + t->length = t4_t6_encode_get_image_length(&s->encoder.t4_t6); + t->line_image_size = t4_t6_encode_get_compressed_image_size(&s->encoder.t4_t6)/8; + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t->width = t42_encode_get_image_width(&s->encoder.t42); + t->length = t42_encode_get_image_length(&s->encoder.t42); + t->line_image_size = t42_encode_get_compressed_image_size(&s->encoder.t42)/8; + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t->width = t43_encode_get_image_width(&s->encoder.t43); + t->length = t43_encode_get_image_length(&s->encoder.t43); + t->line_image_size = t43_encode_get_compressed_image_size(&s->encoder.t43)/8; + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t->width = t85_encode_get_image_width(&s->encoder.t85); + t->length = t85_encode_get_image_length(&s->encoder.t85); + t->line_image_size = t85_encode_get_compressed_image_size(&s->encoder.t85)/8; + break; } } /*- End of function --------------------------------------------------------*/ -/* - * 2D-encode a row of pixels. Consult ITU specification T.4 for the algorithm. - */ -static void encode_2d_row(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_check_bit(t4_tx_state_t *s) { - static const t4_run_table_entry_t codes[] = - { - { 7, 0x60, 0 }, /* VR3 0000 011 */ - { 6, 0x30, 0 }, /* VR2 0000 11 */ - { 3, 0x06, 0 }, /* VR1 011 */ - { 1, 0x01, 0 }, /* V0 1 */ - { 3, 0x02, 0 }, /* VL1 010 */ - { 6, 0x10, 0 }, /* VL2 0000 10 */ - { 7, 0x20, 0 }, /* VL3 0000 010 */ - { 3, 0x04, 0 }, /* horizontal 001 */ - { 4, 0x08, 0 } /* pass 0001 */ - }; - - /* The reference or starting changing element on the coding line. At the start of the coding - line, a0 is set on an imaginary white changing element situated just before the first element - on the line. During the coding of the coding line, the position of a0 is defined by the - previous coding mode. (See T.4/4.2.1.3.2.) */ - int a0; - /* The next changing element to the right of a0 on the coding line. */ - int a1; - /* The next changing element to the right of a1 on the coding line. */ - int a2; - /* The first changing element on the reference line to the right of a0 and of opposite colour to a0. */ - int b1; - /* The next changing element to the right of b1 on the reference line. */ - int b2; - int diff; - int a_cursor; - int b_cursor; - int cur_steps; - uint32_t *p; - - /* - b1 b2 - XX XX XX XX XX -- -- -- -- -- XX XX XX -- -- -- -- -- - XX XX XX -- -- -- -- -- XX XX XX XX XX XX -- -- -- -- - a0 a1 a2 - - - a) Pass mode - This mode is identified when the position of b2 lies to the left of a1. When this mode - has been coded, a0 is set on the element of the coding line below b2 in preparation for - the next coding (i.e. on a0'). - - b1 b2 - XX XX XX XX -- -- XX XX XX -- -- -- -- -- - XX XX -- -- -- -- -- -- -- -- -- -- XX XX - a0 a0' a1 - Pass mode - - - However, the state where b2 occurs just above a1, as shown in the figure below, is not - considered as a pass mode. - - b1 b2 - XX XX XX XX -- -- XX XX XX -- -- -- -- -- - XX XX -- -- -- -- -- -- -- XX XX XX XX XX - a0 a1 - Not pass mode - - - b) Vertical mode - When this mode is identified, the position of a1 is coded relative to the position of b1. - The relative distance a1b1 can take on one of seven values V(0), VR(1), VR(2), VR(3), - VL(1), VL(2) and VL(3), each of which is represented by a separate code word. The - subscripts R and L indicate that a1 is to the right or left respectively of b1, and the - number in brackets indicates the value of the distance a1b1. After vertical mode coding - has occurred, the position of a0 is set on a1 (see figure below). - - c) Horizontal mode - When this mode is identified, both the run-lengths a0a1 and a1a2 are coded using the code - words H + M(a0a1) + M(a1a2). H is the flag code word 001 taken from the two-dimensional - code table. M(a0a1) and M(a1a2) are code words which represent the length and "colour" - of the runs a0a1 and a1a2 respectively and are taken from the appropriate white or black - one-dimensional code tables. After a horizontal mode coding, the position of a0 is set on - a2 (see figure below). - - Vertical - - b1 b2 - -- XX XX XX XX XX -- -- -- -- -- -- -- -- XX XX XX XX -- -- -- - -- -- -- -- -- -- -- -- -- -- -- -- XX XX XX XX XX XX XX -- -- - a0 a1 a2 - <-------- a0a1 --------><-------- a1a2 ------------> - Horizontal mode - Vertical and horizontal modes - */ - /* The following implements the 2-D encoding section of the flow chart in Figure7/T.4 */ - cur_steps = row_to_run_lengths(s->cur_runs, s->row_buf, s->image_width); - /* Stretch the row a little, so when we step by 2 we are guaranteed to - hit an entry showing the row length */ - s->cur_runs[cur_steps] = - s->cur_runs[cur_steps + 1] = - s->cur_runs[cur_steps + 2] = s->cur_runs[cur_steps - 1]; - - a0 = 0; - a1 = s->cur_runs[0]; - b1 = s->ref_runs[0]; - a_cursor = 0; - b_cursor = 0; - for (;;) - { - b2 = s->ref_runs[b_cursor + 1]; - if (b2 >= a1) - { - diff = b1 - a1; - if (abs(diff) <= 3) - { - /* Vertical mode coding */ - put_encoded_bits(s, codes[diff + 3].code, codes[diff + 3].length); - a0 = a1; - a_cursor++; - } - else - { - /* Horizontal mode coding */ - a2 = s->cur_runs[a_cursor + 1]; - put_encoded_bits(s, codes[7].code, codes[7].length); - if (a0 + a1 == 0 || pixel_is_black(s->row_buf, a0) == 0) - { - put_1d_span(s, a1 - a0, t4_white_codes); - put_1d_span(s, a2 - a1, t4_black_codes); - } - else - { - put_1d_span(s, a1 - a0, t4_black_codes); - put_1d_span(s, a2 - a1, t4_white_codes); - } - a0 = a2; - a_cursor += 2; - } - if (a0 >= s->image_width) - break; - if (a_cursor >= cur_steps) - a_cursor = cur_steps - 1; - a1 = s->cur_runs[a_cursor]; - } - else - { - /* Pass mode coding */ - put_encoded_bits(s, codes[8].code, codes[8].length); - /* We now set a0 to somewhere in the middle of its current run, - but we know are aren't moving beyond that run. */ - a0 = b2; - if (a0 >= s->image_width) - break; - } - /* We need to hunt for the correct position in the reference row, as the - runs there have no particular alignment with the runs in the current - row. */ - if (pixel_is_black(s->row_buf, a0)) - b_cursor |= 1; - else - b_cursor &= ~1; - if (a0 < (int) s->ref_runs[b_cursor]) - { - for ( ; b_cursor >= 0; b_cursor -= 2) - { - if (a0 >= (int) s->ref_runs[b_cursor]) - break; - } - b_cursor += 2; - } - else - { - for ( ; b_cursor < s->t4_t6_tx.ref_steps; b_cursor += 2) - { - if (a0 < (int) s->ref_runs[b_cursor]) - break; - } - if (b_cursor >= s->t4_t6_tx.ref_steps) - b_cursor = s->t4_t6_tx.ref_steps - 1; - } - b1 = s->ref_runs[b_cursor]; - } - /* Swap the buffers */ - s->t4_t6_tx.ref_steps = cur_steps; - p = s->cur_runs; - s->cur_runs = s->ref_runs; - s->ref_runs = p; + return t4_t6_encode_check_bit(&s->encoder.t4_t6); } /*- End of function --------------------------------------------------------*/ -/* - * 1D-encode a row of pixels. The encoding is a sequence of all-white or - * all-black spans of pixels encoded with Huffman codes. - */ -static void encode_1d_row(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_get_bit(t4_tx_state_t *s) { - int i; - - /* Do our work in the reference row buffer, and it is already in place if - we need a reference row for a following 2D encoded row. */ - s->t4_t6_tx.ref_steps = row_to_run_lengths(s->ref_runs, s->row_buf, s->image_width); - put_1d_span(s, s->ref_runs[0], t4_white_codes); - for (i = 1; i < s->t4_t6_tx.ref_steps; i++) - put_1d_span(s, s->ref_runs[i] - s->ref_runs[i - 1], (i & 1) ? t4_black_codes : t4_white_codes); - /* Stretch the row a little, so when we step by 2 we are guaranteed to - hit an entry showing the row length */ - s->ref_runs[s->t4_t6_tx.ref_steps] = - s->ref_runs[s->t4_t6_tx.ref_steps + 1] = - s->ref_runs[s->t4_t6_tx.ref_steps + 2] = s->ref_runs[s->t4_t6_tx.ref_steps - 1]; + return t4_t6_encode_get_bit(&s->encoder.t4_t6); } /*- End of function --------------------------------------------------------*/ -static int encode_row(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_get_byte(t4_tx_state_t *s) { switch (s->line_encoding) { - case T4_COMPRESSION_ITU_T6: - /* T.6 compression is a trivial step up from T.4 2D, so we just - throw it in here. T.6 is only used with error correction, - so it does not need independantly compressed (i.e. 1D) lines - to recover from data errors. It doesn't need EOLs, either. */ - if (s->row_bits) - update_row_bit_info(s); - encode_2d_row(s); - break; - case T4_COMPRESSION_ITU_T4_2D: - encode_eol(s); - if (s->row_is_2d) - { - encode_2d_row(s); - s->t4_t6_tx.rows_to_next_1d_row--; - } - else - { - encode_1d_row(s); - s->row_is_2d = TRUE; - } - if (s->t4_t6_tx.rows_to_next_1d_row <= 0) - { - /* Insert a row of 1D encoding */ - s->row_is_2d = FALSE; - s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; - } - break; - default: case T4_COMPRESSION_ITU_T4_1D: - encode_eol(s); - encode_1d_row(s); - break; + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_encode_get_byte(&s->encoder.t4_t6); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_encode_get_byte(&s->encoder.t42); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_encode_get_byte(&s->encoder.t43); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_encode_get_byte(&s->encoder.t85); + } + return SIG_STATUS_END_OF_DATA; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len) +{ + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_encode_get_chunk(&s->encoder.t4_t6, buf, max_len); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_encode_get_chunk(&s->encoder.t42, buf, max_len); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_encode_get_chunk(&s->encoder.t43, buf, max_len); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_encode_get_chunk(&s->encoder.t85, buf, max_len); } - s->row++; return 0; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data) +SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) { - s->t4_t6_tx.row_read_handler = handler; - s->t4_t6_tx.row_read_user_data = user_data; - return 0; -} -/*- End of function --------------------------------------------------------*/ + uint32_t image_length; -SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page) -{ - int run_space; - - if (s == NULL) - { - if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL) - return NULL; - } - memset(s, 0, sizeof(*s)); - span_log_init(&s->logging, SPAN_LOG_NONE, NULL); - span_log_set_protocol(&s->logging, "T.4"); - s->rx = FALSE; - - span_log(&s->logging, SPAN_LOG_FLOW, "Start tx document\n"); - - if (open_tiff_input_file(s, file) < 0) - return NULL; - s->tiff.file = strdup(file); - s->current_page = - s->tiff.start_page = (start_page >= 0) ? start_page : 0; - s->tiff.stop_page = (stop_page >= 0) ? stop_page : INT_MAX; - - if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) - return NULL; - if (get_tiff_directory_info(s)) - { - close_tiff_input_file(s); - return NULL; - } - - s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; - - s->tiff.pages_in_file = -1; - - run_space = (s->image_width + 4)*sizeof(uint32_t); - if ((s->cur_runs = (uint32_t *) malloc(run_space)) == NULL) - return NULL; - if ((s->ref_runs = (uint32_t *) malloc(run_space)) == NULL) - { - free_buffers(s); - close_tiff_input_file(s); - return NULL; - } - if ((s->row_buf = malloc(s->bytes_per_row)) == NULL) - { - free_buffers(s); - close_tiff_input_file(s); - return NULL; - } - s->ref_runs[0] = - s->ref_runs[1] = - s->ref_runs[2] = - s->ref_runs[3] = s->image_width; - s->t4_t6_tx.ref_steps = 1; - s->image_buffer_size = 0; - return s; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s) -{ - int row; - int i; - int run_space; - int len; - int old_image_width; - int header_rows; - uint8_t *bufptr8; - uint32_t *bufptr; - - span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d\n", s->current_page); - if (s->current_page > s->tiff.stop_page) + span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d - compression %s\n", s->current_page, t4_encoding_to_str(s->line_encoding)); + if (s->current_page > s->stop_page) return -1; - if (s->tiff.tiff_file == NULL) - return -1; - old_image_width = s->image_width; - if (s->t4_t6_tx.row_read_handler == NULL) + if (s->tiff.file) { -#if defined(HAVE_LIBTIFF) if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) return -1; get_tiff_directory_info(s); -#endif - } - s->image_size = 0; - s->tx_bitstream = 0; - s->tx_bits = 0; - s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6); - s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; - - /* Allow for pages being of different width. */ - run_space = (s->image_width + 4)*sizeof(uint32_t); - if (old_image_width != s->image_width) - { - s->bytes_per_row = (s->image_width + 7)/8; - - if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL) + if ((image_length = read_tiff_image(s)) < 0) return -1; - s->cur_runs = bufptr; - if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL) - return -1; - s->ref_runs = bufptr; - if ((bufptr8 = realloc(s->row_buf, s->bytes_per_row)) == NULL) - return -1; - s->row_buf = bufptr8; - } - s->ref_runs[0] = - s->ref_runs[1] = - s->ref_runs[2] = - s->ref_runs[3] = s->image_width; - s->t4_t6_tx.ref_steps = 1; - - s->row_bits = 0; - s->min_row_bits = INT_MAX; - s->max_row_bits = 0; - - if (s->header_info && s->header_info[0]) - { - if (t4_tx_put_fax_header(s, &header_rows)) - return -1; - } - if (s->t4_t6_tx.row_read_handler) - { - for (row = 0; ; row++) - { - if ((len = s->t4_t6_tx.row_read_handler(s->t4_t6_tx.row_read_user_data, s->row_buf, s->bytes_per_row)) < 0) - { - span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->tiff.file, row); - break; - } - if (len == 0) - break; - if (encode_row(s)) - return -1; - } - s->image_length = row; } else { - if ((s->image_length = read_tiff_image(s)) < 0) - return -1; + s->image_length = UINT32_MAX; } - if (s->line_encoding == T4_COMPRESSION_ITU_T6) + + switch (s->line_encoding) { - /* Attach an EOFB (end of facsimile block == 2 x EOLs) to the end of the page */ - for (i = 0; i < EOLS_TO_END_T6_TX_PAGE; i++) - encode_eol(s); + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + t4_t6_encode_restart(&s->encoder.t4_t6, s->image_width); + break; +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t42_encode_restart(&s->encoder.t42, s->image_width, s->image_length); + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t43_encode_restart(&s->encoder.t43, s->image_width, s->image_length); + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t85_encode_restart(&s->encoder.t85, s->image_width, s->image_length); + break; + } + /* If there is a page header, create that first */ + if (s->header_info && s->header_info[0] && make_header(s) == 0) + { + s->header_row = 0; + set_row_read_handler(s, header_row_read_handler, (void *) s); } else { - /* Attach an RTC (return to control == 6 x EOLs) to the end of the page */ - s->row_is_2d = FALSE; - for (i = 0; i < EOLS_TO_END_T4_TX_PAGE; i++) - encode_eol(s); - } - - /* Force any partial byte in progress to flush using ones. Any post EOL padding when - sending is normally ones, so this is consistent. */ - put_encoded_bits(s, 0xFF, 7); - s->t4_t6_tx.bit_pos = 7; - s->t4_t6_tx.bit_ptr = 0; - s->line_image_size = s->image_size*8; - - return 0; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s) -{ - span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existance of page %d\n", s->current_page + 1); - if (s->current_page >= s->tiff.stop_page) - return -1; - if (s->t4_t6_tx.row_read_handler == NULL) - { -#if defined(HAVE_LIBTIFF) - if (s->tiff.tiff_file == NULL) - return -1; - if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page + 1)) - return -1; - return test_tiff_directory_info(s); -#endif + set_row_read_handler(s, s->row_handler, s->row_handler_user_data); } return 0; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_restart_page(t4_tx_state_t *s) { - s->t4_t6_tx.bit_pos = 7; - s->t4_t6_tx.bit_ptr = 0; - return 0; + /* This is currently the same as starting a page, but keep it a separate call, + as the two things might diverge a little in the future. */ + return t4_tx_start_page(s); } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_end_page(t4_tx_state_t *s) { s->current_page++; return 0; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s) +SPAN_DECLARE(t4_tx_state_t *) t4_tx_init(t4_tx_state_t *s, const char *file, int start_page, int stop_page) { - int bit; + int allocated; - if (s->t4_t6_tx.bit_ptr >= s->image_size) - return SIG_STATUS_END_OF_DATA; - bit = (s->image_buffer[s->t4_t6_tx.bit_ptr] >> (7 - s->t4_t6_tx.bit_pos)) & 1; - if (--s->t4_t6_tx.bit_pos < 0) + allocated = FALSE; + if (s == NULL) { - s->t4_t6_tx.bit_pos = 7; - s->t4_t6_tx.bit_ptr++; + if ((s = (t4_tx_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + allocated = TRUE; } - return bit; + memset(s, 0, sizeof(*s)); +#if defined(SPANDSP_SUPPORT_TIFF_FX) + TIFF_FX_init(); +#endif + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.4"); + + span_log(&s->logging, SPAN_LOG_FLOW, "Start tx document\n"); + + s->current_page = + s->start_page = (start_page >= 0) ? start_page : 0; + s->stop_page = (stop_page >= 0) ? stop_page : INT_MAX; + s->line_encoding = T4_COMPRESSION_NONE; + + s->row_handler = tiff_row_read_handler; + s->row_handler_user_data = (void *) s; + + if (file) + { + if (open_tiff_input_file(s, file) < 0) + { + if (allocated) + free(s); + return NULL; + } + s->tiff.file = strdup(file); + s->tiff.pages_in_file = -1; + if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page) + || + get_tiff_directory_info(s)) + { + tiff_tx_release(s); + if (allocated) + free(s); + return NULL; + } + } + return s; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_release(t4_tx_state_t *s) { - if (s->t4_t6_tx.bit_ptr >= s->image_size) - return 0x100; - return s->image_buffer[s->t4_t6_tx.bit_ptr++]; + if (s->tiff.file) + tiff_tx_release(s); + if (s->header_text) + { + free(s->header_text); + s->header_text = NULL; + } + switch (s->line_encoding) + { + case T4_COMPRESSION_ITU_T4_1D: + case T4_COMPRESSION_ITU_T4_2D: + case T4_COMPRESSION_ITU_T6: + return t4_t6_encode_release(&s->encoder.t4_t6); +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + return t42_encode_release(&s->encoder.t42); +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + return t43_encode_release(&s->encoder.t43); +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + return t85_encode_release(&s->encoder.t85); + } + return -1; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len) -{ - if (s->t4_t6_tx.bit_ptr >= s->image_size) - return 0; - if (s->t4_t6_tx.bit_ptr + max_len > s->image_size) - max_len = s->image_size - s->t4_t6_tx.bit_ptr; - memcpy(buf, &s->image_buffer[s->t4_t6_tx.bit_ptr], max_len); - s->t4_t6_tx.bit_ptr += max_len; - return max_len; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s) -{ - int bit; - - if (s->t4_t6_tx.bit_ptr >= s->image_size) - return SIG_STATUS_END_OF_DATA; - bit = (s->image_buffer[s->t4_t6_tx.bit_ptr] >> s->t4_t6_tx.bit_pos) & 1; - return bit; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_release(t4_state_t *s) -{ - if (s->rx) - return -1; - if (s->tiff.tiff_file) - close_tiff_input_file(s); - free_buffers(s); - return 0; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_free(t4_state_t *s) +SPAN_DECLARE(int) t4_tx_free(t4_tx_state_t *s) { int ret; @@ -1534,94 +1062,4 @@ SPAN_DECLARE(int) t4_tx_free(t4_state_t *s) return ret; } /*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding) -{ - s->line_encoding = encoding; - s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1; - s->row_is_2d = FALSE; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_state_t *s, int bits) -{ - s->t4_t6_tx.min_bits_per_row = bits; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_tx_set_header_overlays_image(t4_state_t *s, int header_overlays_image) -{ - s->header_overlays_image = header_overlays_image; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident) -{ - s->tiff.local_ident = (ident && ident[0]) ? ident : NULL; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info) -{ - s->header_info = (info && info[0]) ? info : NULL; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_tx_set_header_tz(t4_state_t *s, tz_t *tz) -{ - s->tz = tz; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s) -{ - return s->y_resolution; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s) -{ - return s->x_resolution; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s) -{ - return s->image_width; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s) -{ - int max; - - max = 0; - if (s->t4_t6_tx.row_read_handler == NULL) - max = get_tiff_total_pages(s); - if (max >= 0) - s->tiff.pages_in_file = max; - return max; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s) -{ - return s->current_page; -} -/*- End of function --------------------------------------------------------*/ - -SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t) -{ - t->pages_transferred = s->current_page - s->tiff.start_page; - t->pages_in_file = s->tiff.pages_in_file; - t->width = s->image_width; - t->length = s->image_length; - t->bad_rows = s->t4_t6_rx.bad_rows; - t->longest_bad_row_run = s->t4_t6_rx.longest_bad_row_run; - t->x_resolution = s->x_resolution; - t->y_resolution = s->y_resolution; - t->encoding = s->line_encoding; - t->line_image_size = s->line_image_size/8; -} -/*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/Makefile.am b/libs/spandsp/tests/Makefile.am index d4820d81d3..2b5e97afb1 100644 --- a/libs/spandsp/tests/Makefile.am +++ b/libs/spandsp/tests/Makefile.am @@ -109,6 +109,7 @@ noinst_PROGRAMS = ademco_contactid_tests \ t38_decode \ t38_non_ecm_buffer_tests \ t4_tests \ + t4_t6_tests \ t81_t82_arith_coding_tests \ t85_tests \ time_scale_tests \ @@ -125,8 +126,7 @@ noinst_PROGRAMS = ademco_contactid_tests \ v42bis_tests \ v8_tests \ vector_float_tests \ - vector_int_tests \ - tsb85_tests + vector_int_tests noinst_HEADERS = echo_monitor.h \ fax_tester.h \ @@ -314,6 +314,9 @@ t38_non_ecm_buffer_tests_LDADD = $(LIBDIR) -lspandsp t4_tests_SOURCES = t4_tests.c t4_tests_LDADD = $(LIBDIR) -lspandsp +t4_t6_tests_SOURCES = t4_t6_tests.c +t4_t6_tests_LDADD = $(LIBDIR) -lspandsp + t81_t82_arith_coding_tests_SOURCES = t81_t82_arith_coding_tests.c t81_t82_arith_coding_tests_LDADD = $(LIBDIR) -lspandsp diff --git a/libs/spandsp/tests/fax_decode.c b/libs/spandsp/tests/fax_decode.c index 4b8268cc01..4ad1410587 100644 --- a/libs/spandsp/tests/fax_decode.c +++ b/libs/spandsp/tests/fax_decode.c @@ -89,7 +89,7 @@ int decode_test = FALSE; int rx_bits = 0; t30_state_t t30_dummy; -t4_state_t t4_rx_state; +t4_rx_state_t t4_rx_state; int t4_up = FALSE; hdlc_rx_state_t hdlcrx; diff --git a/libs/spandsp/tests/regression_tests.sh b/libs/spandsp/tests/regression_tests.sh index f6a4fb9a10..173e38ad36 100755 --- a/libs/spandsp/tests/regression_tests.sh +++ b/libs/spandsp/tests/regression_tests.sh @@ -508,19 +508,18 @@ then fi echo t4_tests completed OK -#rm -f t4_t6_tests_receive.tif -#./t4_t6_tests >$STDOUT_DEST 2>$STDERR_DEST -#RETVAL=$? -#if [ $RETVAL != 0 ] -#then -# echo t4_t6_tests failed! -# exit $RETVAL -#fi -#echo t4_t6_tests completed OK -echo t4_t6_tests not enabled +rm -f t4_t6_tests_receive.tif +./t4_t6_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo t4_t6_tests failed! + exit $RETVAL +fi +echo t4_t6_tests completed OK rm -f t81_t82_arith_coding_tests_receive.tif -./t4_tests >$STDOUT_DEST 2>$STDERR_DEST +./t81_t82_arith_coding_tests >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? if [ $RETVAL != 0 ] then @@ -578,6 +577,22 @@ echo tone_detect_tests not enabled #echo tone_generate_tests completed OK echo tone_generate_tests not enabled +./tsb85_tests.sh >/dev/null +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo ./tsb85_tests.sh failed! + exit $RETVAL +fi +./tsb85_extra_tests.sh +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo ./tsb85_extra_tests.sh failed! + exit $RETVAL +fi +echo tsb85_tests.sh completed OK + for OPTS in "-b 14400 -s -42 -n -66" "-b 12000 -s -42 -n -61" "-b 9600 -s -42 -n -59" "-b 7200 -s -42 -n -56" do ./v17_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST @@ -615,7 +630,7 @@ do done echo v27ter_tests completed OK -for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -59" "-b 4800 -s -42 -n -55" +for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -59" "-b 4800 -s -42 -n -54" do ./v29_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? diff --git a/libs/spandsp/tests/t4_t6_tests.c b/libs/spandsp/tests/t4_t6_tests.c new file mode 100644 index 0000000000..38c4750f21 --- /dev/null +++ b/libs/spandsp/tests/t4_t6_tests.c @@ -0,0 +1,439 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t4_t6_tests.c - ITU T.4 and T.6 FAX image compression and decompression tests + * + * Written by Steve Underwood + * + * Copyright (C) 2003, 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +/*! \page t4_t6_tests_page T.4 and T.6 image compress and decompression tests +\section t4_t6_tests_page_sec_1 What does it do +These tests exercise the image compression and decompression methods defined +in ITU specifications T.4 and T.6. +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define XSIZE 1728 + +t4_t6_encode_state_t send_state; +t4_t6_decode_state_t receive_state; + +/* The following are some test cases from T.4 */ +#define FILL_70 " " +#define FILL_80 " " +#define FILL_100 " " +#define FILL_670 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_70 +#define FILL_980 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_100 FILL_80 + +#define TEST_ROWS 16 +static const char t4_t6_test_patterns[TEST_ROWS][XSIZE + 1] = +{ + "XXXXXX " FILL_980 " XXX XXX X " FILL_670 " XXXX", + "XXXXXX " FILL_980 " XXX X " FILL_670 " XXXX", + /* Line start should code to V(0). Line middle codes to VR(3) VL(2) V(0). Line end should code to V(0) V(0). */ + + " XXXX " FILL_980 " XXXXXXX " FILL_670 " XX ", + "XXXXX " FILL_980 "XX XX " FILL_670 " XXXX", + /* Line start should code to VL(1). Line middle codes to H(7,2). Line end should code to V(0) VR(2) */ + + "XXX " FILL_980 " XX XX XX XXX " FILL_670 " X ", + " " FILL_980 " X XXX XXXX " FILL_670 " X XX", + /* Line start should code to P. Line middle codes to P VL(1) V(0) H(3,4) P. Line end codes to V(0) VL(2) V(0). */ + + "XXXXX " FILL_980 " " FILL_670 " XXXX", + " XXX " FILL_980 " " FILL_670 " XX ", + /* Line start should code to VR(2). Line end codes to V(0) VL(2) V(0). */ + + " XX " FILL_980 " " FILL_670 " X XXX", + "XXX X " FILL_980 " " FILL_670 " X ", + /* Line start should code to H(0,3) VR(1). Line end codes to V(0) VR(3). */ + + " " FILL_980 " " FILL_670 " XX ", + " " FILL_980 " " FILL_670 " ", + /* Line end codes to P V(0) a'0. */ + + " " FILL_980 " " FILL_670 " XXXXXXXXXX", + " " FILL_980 " " FILL_670 " XXXXXX XXXXXX", + /* Line end codes to H(2,6). */ + + " " FILL_980 " " FILL_670 " XX XXXXX", + " " FILL_980 " " FILL_670 " XX ", + /* Line end codes to V(0) H(7,0). */ +}; + +#if 0 +static void dump_image_as_xxx(const uint8_t buf[], int bytes_per_row, int len) +{ + const uint8_t *s; + int i; + int j; + int k; + + /* Dump the entire image as text 'X's and spaces */ + printf("Image (%d pixels x %d pixels):\n", bytes_per_row*8, len/bytes_per_row); + s = buf; + for (i = 0; i < len; i++) + { + for (j = 0; j < bytes_per_row; j++) + { + for (k = 0; k < 8; k++) + printf((buf[i*bytes_per_row + j] & (0x80 >> k)) ? "X" : " "); + } + printf("\n"); + } +} +/*- End of function --------------------------------------------------------*/ +#endif + +static int row_read_handler(void *user_data, uint8_t buf[], size_t len) +{ + int i; + int j; + const char *s; + static int row = 0; + + /* Send the test pattern. */ + if (row >= TEST_ROWS) + { + row = 0; + return 0; + } + s = t4_t6_test_patterns[row++]; + memset(buf, 0, len); + for (i = 0; i < len; i++) + { + for (j = 0; j < 8; j++) + { + if (*s++ != ' ') + buf[i] |= (0x80 >> j); + } + } + if (*s) + printf("Oops - '%c' at end of row %d\n", *s, row); + return len; +} +/*- End of function --------------------------------------------------------*/ + +static int row_write_handler(void *user_data, const uint8_t buf[], size_t len) +{ + int i; + int j; + const char *s; + static int row = 0; + uint8_t ref[8192]; + + /* Verify that what is received matches the test pattern. */ + //printf("Row %d\n", row); + if (len == 0) + return 0; + s = t4_t6_test_patterns[row++]; + if (row >= TEST_ROWS) + row = 0; + memset(ref, 0, len); + for (i = 0; i < len; i++) + { + for (j = 0; j < 8; j++) + { + if (*s++ != ' ') + ref[i] |= (0x80 >> j); + } + } + if (*s) + printf("Oops - '%c' at end of row %d\n", *s, row); + if (memcmp(buf, ref, len)) + { + printf("Test failed at row %d\n", row); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int detect_page_end(int bit, int page_ended) +{ + static int consecutive_eols; + static int max_consecutive_eols; + static int consecutive_zeros; + static int consecutive_ones; + static int eol_zeros; + static int eol_ones; + static int expected_eols; + static int end_marks; + + /* Check the EOLs are added properly to the end of an image. We can't rely on the + decoder giving the right answer, as a full set of EOLs is not needed for the + decoder to work. */ + if (bit == -1000000) + { + /* Reset */ + consecutive_eols = 0; + max_consecutive_eols = 0; + consecutive_zeros = 0; + consecutive_ones = 0; + end_marks = 0; + + eol_zeros = 11; + eol_ones = (page_ended == T4_COMPRESSION_ITU_T4_2D) ? 2 : 1; + expected_eols = (page_ended == T4_COMPRESSION_ITU_T6) ? 2 : 6; + return 0; + } + + /* Monitor whether the EOLs are there in the correct amount */ + if (bit == 0) + { + consecutive_zeros++; + consecutive_ones = 0; + } + else if (bit == 1) + { + if (++consecutive_ones == eol_ones) + { + if (consecutive_eols == 0 && consecutive_zeros >= eol_zeros) + consecutive_eols++; + else if (consecutive_zeros == eol_zeros) + consecutive_eols++; + else + consecutive_eols = 0; + consecutive_zeros = 0; + consecutive_ones = 0; + } + if (max_consecutive_eols < consecutive_eols) + max_consecutive_eols = consecutive_eols; + } + else if (bit == SIG_STATUS_END_OF_DATA) + { + if (end_marks == 0) + { + if (max_consecutive_eols != expected_eols) + { + printf("Only %d EOLs (should be %d)\n", max_consecutive_eols, expected_eols); + return 2; + } + consecutive_zeros = 0; + consecutive_eols = 0; + max_consecutive_eols = 0; + } + if (!page_ended) + { + /* We might need to push a few bits to get the receiver to report the + end of page condition (at least with T.6). */ + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + return 2; + } + return 0; + } + return 1; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + static const int compression_sequence[] = + { + T4_COMPRESSION_ITU_T4_1D, + T4_COMPRESSION_ITU_T4_2D, + T4_COMPRESSION_ITU_T6, + -1 + }; + int bit; + int end_of_page; + int end_marks; + int compression; + int compression_step; + int min_row_bits; + int opt; + int tests_failed; + int block_size; + int len; + int res; + uint8_t chunk_buf[1024]; + + tests_failed = 0; + compression = -1; + compression_step = 0; + /* Use a non-zero default minimum row length to ensure we test the consecutive EOLs part + properly. */ + min_row_bits = 50; + block_size = 0; + while ((opt = getopt(argc, argv, "126b:m:")) != -1) + { + switch (opt) + { + case '1': + compression = T4_COMPRESSION_ITU_T4_1D; + compression_step = -1; + break; + case '2': + compression = T4_COMPRESSION_ITU_T4_2D; + compression_step = -1; + break; + case '6': + compression = T4_COMPRESSION_ITU_T6; + compression_step = -1; + break; + case 'b': + block_size = atoi(optarg); + if (block_size > 1024) + block_size = 1024; + break; + case 'm': + min_row_bits = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + /* Create a send and a receive end */ + memset(&send_state, 0, sizeof(send_state)); + memset(&receive_state, 0, sizeof(receive_state)); + + end_of_page = FALSE; +#if 1 + printf("Testing image_function->compress->decompress->image_function\n"); + /* Send end gets image from a function */ + if (t4_t6_encode_init(&send_state, compression, 1728, row_read_handler, NULL) == NULL) + { + printf("Failed to init T.4/T.6 encoder\n"); + exit(2); + } + span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + t4_t6_encode_set_min_bits_per_row(&send_state, min_row_bits); + t4_t6_encode_set_max_2d_rows_per_1d_row(&send_state, 2); + + /* Receive end puts TIFF to a function. */ + if (t4_t6_decode_init(&receive_state, compression, 1728, row_write_handler, NULL) == NULL) + { + printf("Failed to init T.4/T.6 decoder\n"); + exit(2); + } + span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + + /* Now send and receive the test data with all compression modes. */ + /* If we are stepping around the compression schemes, reset to the start of the sequence. */ + if (compression_step > 0) + compression_step = 0; + for (;;) + { + end_marks = 0; + if (compression_step >= 0) + { + compression = compression_sequence[compression_step++]; + if (compression < 0) + break; + } + t4_t6_encode_set_encoding(&send_state, compression); + t4_t6_decode_set_encoding(&receive_state, compression); + + if (t4_t6_encode_restart(&send_state, 1728)) + break; + if (t4_t6_decode_restart(&receive_state, 1728)) + break; + detect_page_end(-1000000, compression); + switch (block_size) + { + case 0: + end_of_page = FALSE; + for (;;) + { + bit = t4_t6_encode_get_bit(&send_state); + if ((res = detect_page_end(bit, end_of_page))) + { + if (res != 1) + { + printf("Test failed\n"); + exit(2); + } + break; + } + if (!end_of_page) + end_of_page = t4_t6_decode_put_bit(&receive_state, bit & 1); + } + break; + case 1: + do + { + bit = t4_t6_encode_get_byte(&send_state); + if ((bit & 0x100)) + { + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } + } + end_of_page = t4_t6_decode_put_byte(&receive_state, bit & 0xFF); + } + while (!end_of_page); + break; + default: + do + { + len = t4_t6_encode_get_chunk(&send_state, chunk_buf, block_size); + if (len == 0) + { + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } + chunk_buf[0] = 0xFF; + len = 1; + } + end_of_page = t4_t6_decode_put_chunk(&receive_state, chunk_buf, len); + } + while (!end_of_page); + break; + } + if (compression_step < 0) + break; + } + t4_t6_encode_release(&send_state); + t4_t6_decode_release(&receive_state); +#endif + printf("Tests passed\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index 2c07794196..5bbf0555ac 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -52,8 +52,8 @@ in ITU specifications T.4 and T.6. #define XSIZE 1728 -t4_state_t send_state; -t4_state_t receive_state; +t4_tx_state_t send_state; +t4_rx_state_t receive_state; /* The following are some test cases from T.4 */ #define FILL_70 " " @@ -100,27 +100,31 @@ static const char t4_t6_test_patterns[][1728 + 1] = int rows_written = 0; int rows_read = 0; -static void dump_image_as_xxx(t4_state_t *state) +static void dump_image_as_xxx(t4_rx_state_t *state) { +#if 0 + uint8_t *s; int i; int j; int k; /* Dump the entire image as text 'X's and spaces */ - printf("Image (%d x %d):\n", receive_state.image_width, receive_state.image_length); - for (i = 0; i < state->image_length; i++) + printf("Image (%d x %d):\n", state->t4_t6.image_width, state->t4_t6.image_length); + s = state->image_buffer; + for (i = 0; i < state->t4_t6.image_length; i++) { - for (j = 0; j < state->bytes_per_row; j++) + for (j = 0; j < state->t4_t6.bytes_per_row; j++) { for (k = 0; k < 8; k++) - printf((state->image_buffer[i*state->bytes_per_row + j] & (0x80 >> k)) ? "X" : " "); + printf((state->image_buffer[i*state->t4_t6.bytes_per_row + j] & (0x80 >> k)) ? "X" : " "); } printf("\n"); } +#endif } /*- End of function --------------------------------------------------------*/ -static void display_page_stats(t4_state_t *s) +static void display_page_stats(t4_rx_state_t *s) { t4_stats_t stats; @@ -132,7 +136,7 @@ static void display_page_stats(t4_state_t *s) printf("Image resolution = %d pels/m x %d pels/m\n", stats.x_resolution, stats.y_resolution); printf("Bad rows = %d\n", stats.bad_rows); printf("Longest bad row run = %d\n", stats.longest_bad_row_run); - printf("Bits per row - min %d, max %d\n", s->min_row_bits, s->max_row_bits); + printf("Bits per row - min %d, max %d\n", s->decoder.t4_t6.min_row_bits, s->decoder.t4_t6.max_row_bits); } /*- End of function --------------------------------------------------------*/ @@ -288,10 +292,8 @@ int main(int argc, char *argv[]) #if defined(SPANDSP_SUPPORT_T43x) T4_COMPRESSION_ITU_T43, #endif -#if defined(SPANDSP_SUPPORT_T85) T4_COMPRESSION_ITU_T85, T4_COMPRESSION_ITU_T85_L0, -#endif //T4_COMPRESSION_ITU_T45, -1 }; @@ -303,7 +305,7 @@ int main(int argc, char *argv[]) int compression; int compression_step; int add_page_headers; - //int overlay_page_headers; + int overlay_page_headers; int min_row_bits; int restart_pages; int block_size; @@ -327,7 +329,7 @@ int main(int argc, char *argv[]) compression = -1; compression_step = 0; add_page_headers = FALSE; - //overlay_page_headers = FALSE; + overlay_page_headers = FALSE; restart_pages = FALSE; in_file_name = IN_FILE_NAME; decode_file_name = NULL; @@ -377,13 +379,11 @@ int main(int argc, char *argv[]) compression_step = -1; } #endif -#if defined(SPANDSP_SUPPORT_T85) else if (strcmp(optarg, "T85") == 0) { compression = T4_COMPRESSION_ITU_T85; compression_step = -1; } -#endif break; case 'd': decode_file_name = optarg; @@ -393,11 +393,11 @@ int main(int argc, char *argv[]) break; case 'h': add_page_headers = TRUE; - //overlay_page_headers = FALSE; + overlay_page_headers = FALSE; break; case 'H': add_page_headers = TRUE; - //overlay_page_headers = TRUE; + overlay_page_headers = TRUE; break; case 'r': restart_pages = TRUE; @@ -542,18 +542,19 @@ int main(int argc, char *argv[]) #if 1 printf("Testing image_function->compress->decompress->image_function\n"); /* Send end gets image from a function */ - if (t4_tx_init(&send_state, in_file_name, -1, -1) == NULL) + if (t4_tx_init(&send_state, FALSE, -1, -1) == NULL) { printf("Failed to init T.4 tx\n"); exit(2); } span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); t4_tx_set_row_read_handler(&send_state, row_read_handler, NULL); + t4_tx_set_image_width(&send_state, 1728); t4_tx_set_min_bits_per_row(&send_state, min_row_bits); - t4_tx_set_local_ident(&send_state, "111 2222 3333"); + t4_tx_set_max_2d_rows_per_1d_row(&send_state, 2); /* Receive end puts TIFF to a function. */ - if (t4_rx_init(&receive_state, OUT_FILE_NAME, T4_COMPRESSION_ITU_T4_2D) == NULL) + if (t4_rx_init(&receive_state, NULL, T4_COMPRESSION_ITU_T4_2D) == NULL) { printf("Failed to init T.4 rx\n"); exit(2); @@ -701,7 +702,7 @@ int main(int argc, char *argv[]) if (tz_init(&tz, page_header_tz)) t4_tx_set_header_tz(&send_state, &tz); } - //t4_tx_set_header_overlays_image(&send_state, overlay_page_headers); + t4_tx_set_header_overlays_image(&send_state, overlay_page_headers); if (restart_pages && (sends & 1)) { /* Use restart, to send the page a second time */ diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index af557285ce..7899047cd3 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -630,7 +630,7 @@ static int next_step(faxtester_state_t *s) int compression_type; int timer; int len; - t4_state_t t4_tx_state; + t4_tx_state_t t4_tx_state; t30_state_t *t30; if (s->cur == NULL) diff --git a/libs/spandsp/tests/tsb85_tests.sh b/libs/spandsp/tests/tsb85_tests.sh index 5086904014..21634aa6ca 100755 --- a/libs/spandsp/tests/tsb85_tests.sh +++ b/libs/spandsp/tests/tsb85_tests.sh @@ -104,18 +104,12 @@ do run_tsb85_test done -#OTEN02 fails because ????? - -#for TEST in OTEN01 OTEN02 OTEN03 OTEN04 OTEN05 OTEN06 -for TEST in OTEN01 OTEN03 OTEN04 OTEN05 OTEN06 +for TEST in OTEN01 OTEN02 OTEN03 OTEN04 OTEN05 OTEN06 do run_tsb85_test done -#MTGX02 fails because ????? - -#for TEST in MTGX01 MTGX02 MTGX03 MTGX04 MTGX05 MTGX06 MTGX07 MTGX08 -for TEST in MTGX01 MTGX03 MTGX04 MTGX05 MTGX06 MTGX07 MTGX08 +for TEST in MTGX01 MTGX02 MTGX03 MTGX04 MTGX05 MTGX06 MTGX07 MTGX08 do run_tsb85_test done From 748c15221bc3f3232aeceaea9c0b1531fa474dcc Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 15 Jul 2012 15:28:45 +0800 Subject: [PATCH 0720/1057] enforce floor --- .../mod_conference/mod_conference.c | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 8a2dd2dc02..c8c9ad3de0 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -524,6 +524,7 @@ static switch_status_t conf_api_sub_undeaf(conference_member_t *member, switch_s static switch_status_t conference_add_event_data(conference_obj_t *conference, switch_event_t *event); static switch_status_t conference_add_event_member_data(conference_member_t *member, switch_event_t *event); static switch_status_t conf_api_sub_floor(conference_member_t *member, switch_stream_handle_t *stream, void *data); +static switch_status_t conf_api_sub_enforce_floor(conference_member_t *member, switch_stream_handle_t *stream, void *data); #define lock_member(_member) switch_mutex_lock(_member->write_mutex); switch_mutex_lock(_member->read_mutex) @@ -2446,6 +2447,13 @@ static void conference_loop_fn_floor_toggle(conference_member_t *member, caller_ conf_api_sub_floor(member, NULL, NULL); } +static void conference_loop_fn_enforce_floor(conference_member_t *member, caller_control_action_t *action) +{ + if (member == NULL) return; + + conf_api_sub_enforce_floor(member, NULL, NULL); +} + static void conference_loop_fn_mute_toggle(conference_member_t *member, caller_control_action_t *action) { if (member == NULL) @@ -5057,6 +5065,12 @@ static switch_status_t conf_api_sub_floor(conference_member_t *member, switch_st if (stream != NULL) { stream->write_function(stream, "OK floor %u\n", member->id); } + + if (switch_core_session_read_lock(member->session) == SWITCH_STATUS_SUCCESS) { + /* Tell the channel to request a fresh vid frame */ + switch_channel_set_flag(switch_core_session_get_channel(member->session), CF_VIDEO_REFRESH_REQ); + switch_core_session_rwunlock(member->session); + } } } else { if (stream != NULL) { @@ -5069,6 +5083,46 @@ static switch_status_t conf_api_sub_floor(conference_member_t *member, switch_st return SWITCH_STATUS_SUCCESS; } +static switch_status_t conf_api_sub_enforce_floor(conference_member_t *member, switch_stream_handle_t *stream, void *data) +{ + switch_event_t *event; + + if (member == NULL) + return SWITCH_STATUS_GENERR; + + switch_mutex_lock(member->conference->mutex); + + if (member->conference->floor_holder != member) { + conference_member_t *old_member = member->conference->floor_holder; + member->conference->floor_holder = member; + if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE)) { + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); + conference_add_event_data(member->conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "floor-change"); + if (old_member == NULL) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "none"); + } else { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d", old_member->id); + } + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", member->id); + switch_event_fire(&event); + if (stream != NULL) { + stream->write_function(stream, "OK floor %u\n", member->id); + } + } + + if (switch_core_session_read_lock(member->session) == SWITCH_STATUS_SUCCESS) { + /* Tell the channel to request a fresh vid frame */ + switch_channel_set_flag(switch_core_session_get_channel(member->session), CF_VIDEO_REFRESH_REQ); + switch_core_session_rwunlock(member->session); + } + } + + switch_mutex_unlock(member->conference->mutex); + + return SWITCH_STATUS_SUCCESS; +} + static switch_xml_t add_x_tag(switch_xml_t x_member, const char *name, const char *value, int off) { switch_size_t dlen = strlen(value) * 3 + 1; @@ -6180,7 +6234,8 @@ static api_command_t conf_api_sub_commands[] = { {"nopin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "nopin", ""}, {"get", (void_fn_t) & conf_api_sub_get, CONF_API_SUB_ARGS_SPLIT, "get", ""}, {"set", (void_fn_t) & conf_api_sub_set, CONF_API_SUB_ARGS_SPLIT, "set", " "}, - {"floor", (void_fn_t) & conf_api_sub_floor, CONF_API_SUB_MEMBER_TARGET, "floor", ""}, + {"floor", (void_fn_t) & conf_api_sub_floor, CONF_API_SUB_MEMBER_TARGET, "floor", ""}, + {"enforce_floor", (void_fn_t) & conf_api_sub_enforce_floor, CONF_API_SUB_MEMBER_TARGET, "enforce_floor", ""}, }; #define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0])) @@ -8645,6 +8700,7 @@ static struct _mapping control_mappings[] = { {"transfer", conference_loop_fn_transfer}, {"execute_application", conference_loop_fn_exec_app}, {"floor", conference_loop_fn_floor_toggle}, + {"enforce_floor", conference_loop_fn_enforce_floor}, }; #define MAPPING_LEN (sizeof(control_mappings)/sizeof(control_mappings[0])) From 5a0d9514db11360184db9bb6578cd12f9509d8db Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sun, 15 Jul 2012 18:48:51 +0800 Subject: [PATCH 0721/1057] set marker and ts, some endpoints depending on the marker bit to render correct video --- src/mod/applications/mod_fsv/mod_fsv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 5c52a352df..7a798ca1fa 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -411,6 +411,8 @@ SWITCH_STANDARD_APP(play_fsv_function) if (switch_channel_test_flag(channel, CF_VIDEO)) { switch_byte_t *data = (switch_byte_t *) vid_frame.packet; + vid_frame.m = hdr->m; + vid_frame.timestamp = ts; vid_frame.data = data + 12; vid_frame.datalen = vid_frame.packetlen - 12; switch_core_session_write_video_frame(session, &vid_frame, SWITCH_IO_FLAG_NONE, 0); From d2b940d9fc6ade0254925fa547853223770f3e20 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 15 Jul 2012 11:01:17 -0500 Subject: [PATCH 0722/1057] fix windows spandsp build for recent commits --- libs/spandsp/src/libspandsp.2008.vcproj | 1532 +++++++++++++---- libs/spandsp/src/libspandsp.2010.vcxproj | 9 + .../src/libspandsp.2010.vcxproj.filters | 27 + libs/spandsp/src/msvc/spandsp.h | 2 + libs/spandsp/src/t4_tx.c | 4 + libs/spandsp/src/t85_encode.c | 4 + 6 files changed, 1250 insertions(+), 328 deletions(-) diff --git a/libs/spandsp/src/libspandsp.2008.vcproj b/libs/spandsp/src/libspandsp.2008.vcproj index 027a6fc664..d5964ec4d6 100644 --- a/libs/spandsp/src/libspandsp.2008.vcproj +++ b/libs/spandsp/src/libspandsp.2008.vcproj @@ -8,18 +8,18 @@ Keyword="Win32Proj" TargetFrameworkVersion="131072" > - - + - - - - - - + + + + - + + + + + - + + + - - - - - - + + + + + + - + + + + + - + + + - - + + + + + + + + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj b/libs/spandsp/src/libspandsp.2010.vcxproj index 393a1b6d45..398b5dc7e0 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj +++ b/libs/spandsp/src/libspandsp.2010.vcxproj @@ -208,6 +208,8 @@ + + @@ -218,6 +220,9 @@ + + + @@ -282,6 +287,8 @@ + + @@ -304,6 +311,8 @@ + + diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj.filters b/libs/spandsp/src/libspandsp.2010.vcxproj.filters index c75936a851..fef56df81d 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj.filters +++ b/libs/spandsp/src/libspandsp.2010.vcxproj.filters @@ -259,6 +259,21 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + @@ -674,6 +689,18 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + diff --git a/libs/spandsp/src/msvc/spandsp.h b/libs/spandsp/src/msvc/spandsp.h index ba0bc280d6..0abd28068f 100644 --- a/libs/spandsp/src/msvc/spandsp.h +++ b/libs/spandsp/src/msvc/spandsp.h @@ -104,6 +104,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 3961bfa94d..7da6ea93a1 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -81,6 +81,10 @@ #include "faxfont.h" +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff +#endif + /*! The number of centimetres in one inch */ #define CM_PER_INCH 2.54f diff --git a/libs/spandsp/src/t85_encode.c b/libs/spandsp/src/t85_encode.c index 6bcb3441f5..7577f270d9 100644 --- a/libs/spandsp/src/t85_encode.c +++ b/libs/spandsp/src/t85_encode.c @@ -46,6 +46,10 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff +#endif + /* Image length update status */ enum { From a57669c30d9cf55867b65d4acff86c1f4fde6681 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 15 Jul 2012 13:38:30 -0500 Subject: [PATCH 0723/1057] FS-4407 --resolve --- src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c index 36626461a5..e07871b88d 100644 --- a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c +++ b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c @@ -130,6 +130,7 @@ static switch_status_t set_json_cdr_log_dirs() if ((path = switch_safe_strdup(globals.base_log_dir))) { switch_thread_rwlock_wrlock(globals.log_path_lock); switch_safe_free(globals.log_dir); + switch_dir_make_recursive(path, SWITCH_DEFAULT_DIR_PERMS, globals.pool); globals.log_dir = path; switch_thread_rwlock_unlock(globals.log_path_lock); } else { @@ -168,6 +169,7 @@ static switch_status_t set_json_cdr_log_dirs() if ((path = switch_safe_strdup(globals.base_err_log_dir[err_dir_index]))) { switch_thread_rwlock_wrlock(globals.log_path_lock); switch_safe_free(globals.err_log_dir[err_dir_index]); + switch_dir_make_recursive(path, SWITCH_DEFAULT_DIR_PERMS, globals.pool); globals.err_log_dir[err_dir_index] = path; switch_thread_rwlock_unlock(globals.log_path_lock); } else { From 2dda038ba016decbf18269548e1f8d0641e8e2f8 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 15 Jul 2012 21:52:02 -0500 Subject: [PATCH 0724/1057] FS-4416 -- resolve --- libs/esl/src/esl_event.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 7a0da29db3..60547b1be2 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -127,6 +127,7 @@ static const char *EVENT_NAMES[] = { "SERVER_DISCONNECTED", "SEND_INFO", "RECV_INFO", + "RECV_RTCP_MESSAGE", "CALL_SECURE", "NAT", "RECORD_START", @@ -137,11 +138,11 @@ static const char *EVENT_NAMES[] = { "FAILURE", "SOCKET_DATA", "MEDIA_BUG_START", - "MEDIA_BUG_START", + "MEDIA_BUG_STOP", "CONFERENCE_DATA_QUERY", + "CONFERENCE_DATA", "CALL_SETUP_REQ", "CALL_SETUP_RESULT", - "CONFERENCE_DATA", "ALL" }; From 68d9a83e8e565a23350abc6f9ae6894c53ab0e0b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Jul 2012 12:44:04 -0500 Subject: [PATCH 0725/1057] enable srtp for dingaling --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index c47f589d68..b7272d25f7 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -2491,6 +2491,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); + switch_channel_set_flag(tech_pvt->channel, TFLAG_SECURE); + + if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(mdl_profile->ip))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "No RTP port available!\n"); @@ -4098,6 +4101,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); + switch_channel_set_flag(tech_pvt->channel, TFLAG_SECURE); if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(profile->ip))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "No RTP port available!\n"); From 06046e34379e1f39b231c90fe969911a94e0c463 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Jul 2012 12:51:13 -0500 Subject: [PATCH 0726/1057] FS-4427 try this revision however i think its a problem with the remote client not properly preserving the headers of the srtp packets..... --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index fb7b0ae8ff..a477a24dbe 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2947,7 +2947,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t #endif #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->recv_msg.header.version == 2) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && (!rtp_session->ice.ice_user || rtp_session->recv_msg.header.version == 2)) { int sbytes = (int) *bytes; err_status_t stat = 0; @@ -3066,7 +3066,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t } #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->recv_msg.header.version == 2) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && (!rtp_session->ice.ice_user || rtp_session->recv_msg.header.version == 2)) { int sbytes = (int) *bytes; err_status_t stat = 0; From e81d31ce435769bc82ffccf1ca97a433cd048536 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Jul 2012 13:39:23 -0500 Subject: [PATCH 0727/1057] FS-4429 --resolve you guys should come to cluecon we would like to help you get bvtapi working really well --- src/switch_utils.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/switch_utils.c b/src/switch_utils.c index 07b02d37e7..157ce177f2 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2092,6 +2092,17 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char return 0; } + + if (*buf == '^' && *(buf+1) == '^') { + char *p = buf + 2; + + if (p && *p && *(p+1)) { + buf = p; + delim = *buf++; + } + } + + memset(array, 0, arraylen * sizeof(*array)); return (delim == ' ' ? separate_string_blank_delim(buf, array, arraylen) : separate_string_char_delim(buf, delim, array, arraylen)); From cbca8b348057977affd52c030826a2928f272ec9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Jul 2012 13:53:19 -0500 Subject: [PATCH 0728/1057] FS-4428 --resolve --- src/mod/endpoints/mod_sofia/sofia.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 5004fc8d27..fbd979c4b1 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5137,7 +5137,11 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status return; } - if (status >= 500 && sip->sip_reason && sip->sip_reason->re_protocol && (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") + if (status > 299) { + switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_refuse"); + } + + if (status >= 500 && sip->sip_reason && sip->sip_reason->re_protocol && (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH") || !strcasecmp(sip->sip_reason->re_protocol, profile->username)) && sip->sip_reason->re_cause) { tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause); From 7ec780ab305ac059589aeb402eca77643e4aecd5 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 16 Jul 2012 13:09:12 -0700 Subject: [PATCH 0729/1057] Update to-be-recorded sounds --- docs/phrase/phrase_en.xml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 2140cb5f16..6de26e36ad 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -527,7 +527,6 @@ - @@ -566,8 +565,15 @@ - - + + + + + + + + + @@ -590,6 +596,8 @@ + + From c359dc83e30e856c11e93015bf644fc38f05199a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Jul 2012 17:16:10 -0500 Subject: [PATCH 0730/1057] doh --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index b7272d25f7..5f7527bcb4 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -2491,8 +2491,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); - switch_channel_set_flag(tech_pvt->channel, TFLAG_SECURE); - + switch_set_flag(tech_pvt, TFLAG_SECURE); if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(mdl_profile->ip))) { @@ -4101,7 +4100,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); - switch_channel_set_flag(tech_pvt->channel, TFLAG_SECURE); + switch_set_flag(tech_pvt, TFLAG_SECURE); if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(profile->ip))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "No RTP port available!\n"); From 8ad5d8a6b0765debd75aba0cb17e2ba4439b8160 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Jul 2012 18:47:45 -0500 Subject: [PATCH 0731/1057] FS-4317 this might help, this fixes a regression cause by another recently altered code path and it sounds similar but I never got the new logs from you so this is a guess --- src/switch_rtp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index a477a24dbe..81eea2905f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4499,6 +4499,8 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra if (switch_test_flag(frame, SFF_PROXY_PACKET) || switch_test_flag(frame, SFF_UDPTL_PACKET) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { + + //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]; @@ -4512,11 +4514,13 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra send_msg = frame->packet; - /* - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { - send_msg->header.pt = rtp_session->payload; - } - */ + + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { + send_msg->header.pt = rtp_session->payload; + } + + + send_msg->header.ssrc = htonl(rtp_session->ssrc); if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, frame->packet, &bytes) != SWITCH_STATUS_SUCCESS) { return -1; From ac3e6ba140214e285e8f5ce8c2b946b2954b9ba1 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Tue, 17 Jul 2012 14:29:36 +0000 Subject: [PATCH 0732/1057] Forgot to allow https on http_tryget --- src/mod/applications/mod_http_cache/mod_http_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index d4117d0a69..4bb6376393 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -934,7 +934,7 @@ SWITCH_STANDARD_API(http_cache_tryget) switch_memory_pool_t *pool = NULL; char *filename; - if (zstr(cmd) || strncmp("http://", cmd, strlen("http://"))) { + if (!isUrl(cmd)) { stream->write_function(stream, "USAGE: %s\n", HTTP_GET_SYNTAX); return SWITCH_STATUS_SUCCESS; } From b27aad913e6630e9f214fe62f5532d4245acb720 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Jul 2012 10:32:31 -0500 Subject: [PATCH 0733/1057] typo --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 81eea2905f..727c5d5196 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3066,7 +3066,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t } #ifdef ENABLE_SRTP - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && (!rtp_session->ice.ice_user || rtp_session->recv_msg.header.version == 2)) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && (!rtp_session->ice.ice_user || rtp_session->rtcp_recv_msg.header.version == 2)) { int sbytes = (int) *bytes; err_status_t stat = 0; From f69573002cbe4fe1200312c688f6692808a089ef Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Jul 2012 13:54:39 -0500 Subject: [PATCH 0734/1057] set hard domain first --- 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 c8c9ad3de0..e527b22b31 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -8290,14 +8290,14 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c conference->name = switch_core_strdup(conference->pool, name); - if (presence_id && (name_domain = strchr(presence_id, '@'))) { - name_domain++; - conference->domain = switch_core_strdup(conference->pool, name_domain); - } else if ((name_domain = strchr(conference->name, '@'))) { + if ((name_domain = strchr(conference->name, '@'))) { name_domain++; conference->domain = switch_core_strdup(conference->pool, name_domain); } else if (domain) { conference->domain = switch_core_strdup(conference->pool, domain); + } else if (presence_id && (name_domain = strchr(presence_id, '@'))) { + name_domain++; + conference->domain = switch_core_strdup(conference->pool, name_domain); } else { conference->domain = "cluecon.com"; } From 19b7e30eea5d4ef8f546c252b7bd9a81cfda98f6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Jul 2012 14:02:36 -0500 Subject: [PATCH 0735/1057] crypto tweak for dingaling --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 5f7527bcb4..ebf3deafc2 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -2489,9 +2489,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi tech_pvt->transports[LDL_TPORT_RTP].codec_index = -1; tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index = -1; + switch_set_flag(tech_pvt, TFLAG_SECURE); mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); - switch_set_flag(tech_pvt, TFLAG_SECURE); + if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(mdl_profile->ip))) { From 223244d491f723ee7c6b3b0131464b6a5aefc40c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Jul 2012 17:01:10 -0500 Subject: [PATCH 0736/1057] FS-4435 looks ok at a glance, at least this code is isolated to the small few who actually use it so i will put it in for testing --- src/mod/endpoints/mod_sofia/mod_sofia.h | 4 +- src/mod/endpoints/mod_sofia/sofia.c | 22 ++++-- src/mod/endpoints/mod_sofia/sofia_presence.c | 8 +-- src/mod/endpoints/mod_sofia/sofia_reg.c | 72 ++++++++++---------- 4 files changed, 58 insertions(+), 48 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 219b7c7b2f..5782fa04d6 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -438,9 +438,11 @@ typedef enum { struct sofia_gateway_subscription { sofia_gateway_t *gateway; + nua_handle_t *nh; char *expires_str; char *event; /* eg, 'message-summary' to subscribe to MWI events */ char *content_type; /* eg, application/simple-message-summary in the case of MWI events */ + char *request_uri; uint32_t freq; int32_t retry_seconds; time_t expires; @@ -452,7 +454,6 @@ struct sofia_gateway_subscription { struct sofia_gateway { sofia_private_t *sofia_private; nua_handle_t *nh; - nua_handle_t *sub_nh; sofia_profile_t *profile; char *name; char *register_scheme; @@ -491,7 +492,6 @@ struct sofia_gateway { int32_t retry_seconds; int32_t reg_timeout_seconds; int32_t failure_status; - sub_state_t sub_state; reg_state_t state; switch_memory_pool_t *pool; int deleted; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index fbd979c4b1..554ded0e85 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2510,6 +2510,7 @@ static void parse_gateway_subscriptions(sofia_profile_t *profile, sofia_gateway_ if ((gw_sub = switch_core_alloc(profile->pool, sizeof(*gw_sub)))) { char *expire_seconds = "3600", *retry_seconds = "30", *content_type = "NO_CONTENT_TYPE"; + uint32_t username_in_request = 0; char *event = (char *) switch_xml_attr_soft(subscription_tag, "event"); gw_sub->event = switch_core_strdup(gateway->pool, event); gw_sub->gateway = gateway; @@ -2524,6 +2525,8 @@ static void parse_gateway_subscriptions(sofia_profile_t *profile, sofia_gateway_ retry_seconds = val; } else if (!strcmp(var, "content-type")) { content_type = val; + } else if (!strcmp(var, "username-in-request")) { + username_in_request = switch_true(val); } } @@ -2539,6 +2542,13 @@ static void parse_gateway_subscriptions(sofia_profile_t *profile, sofia_gateway_ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Freq: %d. Setting Register-Frequency to 3600\n", gw_sub->freq); gw_sub->freq = 3600; } + + if(username_in_request) { + gw_sub->request_uri = gateway->register_to; + } else { + gw_sub->request_uri = gateway->register_url; + } + gw_sub->freq -= 2; gw_sub->content_type = switch_core_strdup(gateway->pool, content_type); gw_sub->next = gateway->subscriptions; @@ -2741,12 +2751,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) su_guid_generate(guid); su_guid_sprintf(str_guid, su_guid_strlen + 1, guid); str_rfc_5626 = switch_core_sprintf(gateway->pool, ";reg-id=%s;+sip.instance=\"\"",reg_id,str_guid); - } - - - if ((gw_subs_tag = switch_xml_child(gateway_tag, "subscriptions"))) { - parse_gateway_subscriptions(profile, gateway, gw_subs_tag); - } + } if (zstr(realm)) { if (zstr(proxy)) { @@ -2960,7 +2965,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) gateway->freq = 3600; } - + if ((gw_subs_tag = switch_xml_child(gateway_tag, "subscriptions"))) { + parse_gateway_subscriptions(profile, gateway, gw_subs_tag); + } + sofia_reg_add_gateway(profile, gateway->name, gateway); } diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index a6024037b1..b4b1977100 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3979,10 +3979,10 @@ void sofia_presence_handle_sip_r_subscribe(int status, gw_sub_ptr->state = SUB_STATE_FAILED; if (sofia_private) { - if (sofia_private->gateway->sub_nh) { - nua_handle_bind(sofia_private->gateway->sub_nh, NULL); - nua_handle_destroy(sofia_private->gateway->sub_nh); - sofia_private->gateway->sub_nh = NULL; + if (gw_sub_ptr->nh) { + nua_handle_bind(gw_sub_ptr->nh, NULL); + nua_handle_destroy(gw_sub_ptr->nh); + gw_sub_ptr->nh = NULL; } } else { nua_handle_destroy(nh); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 1e17ad544e..ccc8a4c901 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -65,26 +65,27 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach) } } -static void sofia_reg_new_sub_handle(sofia_gateway_t *gateway_ptr, int attach) -{ +static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr, int attach) +{ + sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway; char *user_via = NULL; char *register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); int ss_state = nua_callstate_authenticating; - + /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); } - - if (gateway_ptr->sub_nh) { - nua_handle_bind(gateway_ptr->sub_nh, NULL); - nua_handle_destroy(gateway_ptr->sub_nh); - gateway_ptr->sub_nh = NULL; + + if (gw_sub_ptr->nh) { + nua_handle_bind(gw_sub_ptr->nh, NULL); + nua_handle_destroy(gw_sub_ptr->nh); + gw_sub_ptr->nh = NULL; sofia_private_free(gateway_ptr->sofia_private); } - - gateway_ptr->sub_nh = nua_handle(gateway_ptr->profile->nua, NULL, - NUTAG_URL(gateway_ptr->register_proxy), + + gw_sub_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL, + NUTAG_URL(gateway_ptr->register_proxy), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_TO_STR(gateway_ptr->register_to), NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); @@ -96,31 +97,32 @@ static void sofia_reg_new_sub_handle(sofia_gateway_t *gateway_ptr, int attach) memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private)); gateway_ptr->sofia_private->gateway = gateway_ptr; - nua_handle_bind(gateway_ptr->sub_nh, gateway_ptr->sofia_private); + nua_handle_bind(gw_sub_ptr->nh, gateway_ptr->sofia_private); } switch_safe_free(register_host); switch_safe_free(user_via); } -static void sofia_reg_kill_sub(sofia_gateway_t *gateway_ptr) -{ +static void sofia_reg_kill_sub(sofia_gateway_subscription_t *gw_sub_ptr) +{ + sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway; - if (gateway_ptr->sub_nh) { - nua_handle_bind(gateway_ptr->sub_nh, NULL); + if (gw_sub_ptr->nh) { + nua_handle_bind(gw_sub_ptr->nh, NULL); } - - if (gateway_ptr->sub_state != SUB_STATE_SUBED && gateway_ptr->sub_state != SUB_STATE_UNSUBSCRIBE) { - if (gateway_ptr->sub_nh) { - nua_handle_destroy(gateway_ptr->sub_nh); - gateway_ptr->sub_nh = NULL; + + if (gw_sub_ptr->state != SUB_STATE_SUBED && gw_sub_ptr->state != SUB_STATE_UNSUBSCRIBE) { + if (gw_sub_ptr->nh) { + nua_handle_destroy(gw_sub_ptr->nh); + gw_sub_ptr->nh = NULL; } return; } - if (gateway_ptr->sub_nh) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UN-Subbing %s\n", gateway_ptr->name); - nua_unsubscribe(gateway_ptr->sub_nh, NUTAG_URL(gateway_ptr->register_url), TAG_END()); + if (gw_sub_ptr->nh) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UN-Subbing %s %s\n", gateway_ptr->name, gw_sub_ptr->event); + nua_unsubscribe(gw_sub_ptr->nh, NUTAG_URL(gw_sub_ptr->request_uri), TAG_END()); } } @@ -182,7 +184,7 @@ void sofia_reg_unregister(sofia_profile_t *profile) for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) { if (gw_sub_ptr->state == SUB_STATE_SUBED) { - sofia_reg_kill_sub(gateway_ptr); + sofia_reg_kill_sub(gw_sub_ptr); } } @@ -211,7 +213,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) gw_sub_ptr->expires_str = "0"; } - gateway_ptr->sub_state = gw_sub_ptr->state; + //gateway_ptr->sub_state = gw_sub_ptr->state; switch (ostate) { case SUB_STATE_NOSUB: @@ -222,19 +224,19 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) break; case SUB_STATE_UNSUBSCRIBE: gw_sub_ptr->state = SUB_STATE_NOSUB; - sofia_reg_kill_sub(gateway_ptr); + sofia_reg_kill_sub(gw_sub_ptr); break; case SUB_STATE_UNSUBED: - sofia_reg_new_sub_handle(gateway_ptr, 1); + sofia_reg_new_sub_handle(gw_sub_ptr, 1); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name); - + if (now) { - nua_subscribe(gateway_ptr->sub_nh, - NUTAG_URL(gateway_ptr->register_url), + nua_subscribe(gw_sub_ptr->nh, + NUTAG_URL(gw_sub_ptr->request_uri), SIPTAG_EVENT_STR(gw_sub_ptr->event), - SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), + TAG_IF(strcmp(gw_sub_ptr->content_type, "NO_CONTENT_TYPE"), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type)), SIPTAG_TO_STR(gateway_ptr->register_from), SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), @@ -242,10 +244,10 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) TAG_NULL()); gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds; } else { - nua_unsubscribe(gateway_ptr->sub_nh, - NUTAG_URL(gateway_ptr->register_url), + nua_unsubscribe(gw_sub_ptr->nh, + NUTAG_URL(gw_sub_ptr->request_uri), SIPTAG_EVENT_STR(gw_sub_ptr->event), - SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), + TAG_IF(strcmp(gw_sub_ptr->content_type, "NO_CONTENT_TYPE"), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type)), SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_TO_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), TAG_NULL()); From 70c6e65e60eae04ddf5054a429a06623aa9202cb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Jul 2012 17:19:28 -0500 Subject: [PATCH 0737/1057] fix regression in spandsp_tone_detect caused by some revent core changes --- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index b3616c7892..c74069aac1 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -742,7 +742,7 @@ switch_status_t callprogress_detector_start(switch_core_session_t *session, cons /* start listening for tones */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Starting tone detection for '%s'\n", switch_channel_get_name(channel), name); switch_core_media_bug_add(session, "spandsp_tone_detect", NULL, - callprogress_detector_process_buffer, detector, 0 /* stop time */, SMBF_READ_STREAM, &bug); + callprogress_detector_process_buffer, detector, 0 /* stop time */, SMBF_READ_REPLACE, &bug); if (!bug) { return SWITCH_STATUS_FALSE; } @@ -761,28 +761,26 @@ switch_status_t callprogress_detector_start(switch_core_session_t *session, cons */ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { - uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; - switch_frame_t frame = { 0 }; tone_detector_t *detector = (tone_detector_t *)user_data; switch_core_session_t *session = switch_core_media_bug_get_session(bug); switch_channel_t *channel = switch_core_session_get_channel(session); - frame.data = data; - frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; - switch(type) { case SWITCH_ABC_TYPE_INIT: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) initializing tone detector\n", switch_channel_get_name(channel)); tone_detector_init(detector); break; - case SWITCH_ABC_TYPE_READ: + case SWITCH_ABC_TYPE_READ_REPLACE: { + switch_frame_t *frame; + + const char *detected_tone = NULL; if (!detector->spandsp_detector) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) detector is destroyed\n", switch_channel_get_name(channel)); return SWITCH_FALSE; } - if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { + if (!(frame = switch_core_media_bug_get_read_replace_frame(bug))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) error reading frame\n", switch_channel_get_name(channel)); return SWITCH_FALSE; } From 6a85ad31d2c7b5a5abef48a9f7e4af23e565bfd0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Jul 2012 17:32:46 -0500 Subject: [PATCH 0738/1057] fix regression in spandsp_tone_detect caused by some recent core changes (part 2) --- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index c74069aac1..576c7592d1 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -784,7 +784,7 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) error reading frame\n", switch_channel_get_name(channel)); return SWITCH_FALSE; } - tone_detector_process_buffer(detector, frame.data, frame.samples, &detected_tone); + tone_detector_process_buffer(detector, frame->data, frame->samples, &detected_tone); if (detected_tone) { switch_event_t *event = NULL; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) DETECTED TONE: %s\n", switch_channel_get_name(channel), detected_tone); @@ -796,20 +796,14 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu } break; } - case SWITCH_ABC_TYPE_WRITE: - break; - case SWITCH_ABC_TYPE_WRITE_REPLACE: - break; - case SWITCH_ABC_TYPE_READ_REPLACE: - break; - case SWITCH_ABC_TYPE_READ_PING: - break; case SWITCH_ABC_TYPE_CLOSE: if (detector->spandsp_detector) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) destroying tone detector\n", switch_channel_get_name(channel)); tone_detector_destroy(detector); } break; + default: + break; } return SWITCH_TRUE; } From ef3050f3a99c9b1dd6bb474f3c21d2c79e2c3368 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 17 Jul 2012 22:40:13 -0500 Subject: [PATCH 0739/1057] FS-4442 try this --- src/mod/endpoints/mod_sofia/sofia_presence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index b4b1977100..5c1f2d2442 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3732,7 +3732,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, now = switch_epoch_time_now(NULL); sql = switch_mprintf("insert into sip_dialogs (sip_from_user,sip_from_host,call_info,call_info_state,hostname,expires,rcd,profile_name) " - "values ('%q','%q','%q','seized','%q',%ld,%ld,'%q')", + "values ('%q','%q','%q','seized','%q',%"SWITCH_TIME_T_FMT",%ld,'%q')", to_user, to_host, switch_str_nil(p), mod_sofia_globals.hostname, switch_epoch_time_now(NULL) + exp_delta, (long)now, profile->name); From 682fb58bd5b69808fb912bba305c9d1cf5acd065 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 18 Jul 2012 08:16:35 -0500 Subject: [PATCH 0740/1057] OPENZAP-186 --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 e326618ee4..ef29a96b0e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4646,7 +4646,7 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const static ftdm_status_t load_config(void) { - const char const cfg_name[] = "freetdm.conf"; + const char cfg_name[] = "freetdm.conf"; ftdm_config_t cfg; char *var, *val; int catno = -1; From 12aec908bb9a350b6e43a3040d3020fb301dab06 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 18 Jul 2012 21:46:58 +0800 Subject: [PATCH 0741/1057] Various tweaks to spandsp. Cleaned up a few MSVC issues with spandsp --- libs/spandsp/src/fax_modems.c | 7 + libs/spandsp/src/msvc/inttypes.h | 3 + libs/spandsp/src/msvc/spandsp.h | 24 ++- libs/spandsp/src/spandsp/private/fax_modems.h | 7 +- libs/spandsp/src/spandsp/private/v17rx.h | 7 +- libs/spandsp/src/spandsp/private/v22bis.h | 13 +- libs/spandsp/src/spandsp/private/v27ter_rx.h | 4 +- libs/spandsp/src/spandsp/private/v29rx.h | 154 +++++++++--------- libs/spandsp/src/spandsp/private/v29tx.h | 16 +- libs/spandsp/src/spandsp/v17rx.h | 2 +- libs/spandsp/src/spandsp/v22bis.h | 6 +- libs/spandsp/src/spandsp/v27ter_rx.h | 4 + libs/spandsp/src/spandsp/v29rx.h | 4 + libs/spandsp/src/t30.c | 2 +- libs/spandsp/src/t31.c | 119 +++++++++++--- libs/spandsp/src/t4_tx.c | 4 - libs/spandsp/src/t85_encode.c | 4 - 17 files changed, 244 insertions(+), 136 deletions(-) diff --git a/libs/spandsp/src/fax_modems.c b/libs/spandsp/src/fax_modems.c index 6bc7e05ea8..c2d20df2b7 100644 --- a/libs/spandsp/src/fax_modems.c +++ b/libs/spandsp/src/fax_modems.c @@ -100,6 +100,7 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t am s->rx_handler = (span_rx_handler_t) &fsk_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; + s->rx_fillin_user_data = &s->v21_rx; } /*endif*/ return 0; @@ -131,6 +132,7 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t s->rx_handler = (span_rx_handler_t) &fsk_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; + s->rx_fillin_user_data = &s->v21_rx; } /*endif*/ return 0; @@ -162,6 +164,7 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t am s->rx_handler = (span_rx_handler_t) &fsk_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin; s->rx_user_data = &s->v21_rx; + s->rx_fillin_user_data = &s->v21_rx; } /*endif*/ return 0; @@ -201,6 +204,7 @@ static void v17_rx_status_handler(void *user_data, int status) s->rx_handler = (span_rx_handler_t) &v17_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &v17_rx_fillin; s->rx_user_data = &s->fast_modems.v17_rx; + s->rx_fillin_user_data = &s->fast_modems.v17_rx; break; } /*endswitch*/ @@ -219,6 +223,7 @@ static void v27ter_rx_status_handler(void *user_data, int status) s->rx_handler = (span_rx_handler_t) &v27ter_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &v27ter_rx_fillin; s->rx_user_data = &s->fast_modems.v27ter_rx; + s->rx_fillin_user_data = &s->fast_modems.v27ter_rx; break; } /*endswitch*/ @@ -237,6 +242,7 @@ static void v29_rx_status_handler(void *user_data, int status) s->rx_handler = (span_rx_handler_t) &v29_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &v29_rx_fillin; s->rx_user_data = &s->fast_modems.v29_rx; + s->rx_fillin_user_data = &s->fast_modems.v29_rx; break; } /*endswitch*/ @@ -326,6 +332,7 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, s->rx_handler = (span_rx_handler_t) &span_dummy_rx; s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx; s->rx_user_data = NULL; + s->rx_fillin_user_data = NULL; s->tx_handler = (span_tx_handler_t) &silence_gen; s->tx_user_data = &s->silence_gen; return s; diff --git a/libs/spandsp/src/msvc/inttypes.h b/libs/spandsp/src/msvc/inttypes.h index 81ab70dec4..beb93cae10 100644 --- a/libs/spandsp/src/msvc/inttypes.h +++ b/libs/spandsp/src/msvc/inttypes.h @@ -43,6 +43,9 @@ typedef __int64 int64_t; #if !defined(UINT16_MAX) #define UINT16_MAX 0xFFFF #endif +#if !defined(UINT32_MAX) +#define UINT32_MAX 0xFFFFFFFF +#endif #if !defined(INT16_MAX) #define INT16_MAX 0x7FFF diff --git a/libs/spandsp/src/msvc/spandsp.h b/libs/spandsp/src/msvc/spandsp.h index 0abd28068f..f6d7f0cd3b 100644 --- a/libs/spandsp/src/msvc/spandsp.h +++ b/libs/spandsp/src/msvc/spandsp.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: spandsp.h.in,v 1.19.4.1 2009/12/19 09:47:56 steveu Exp $ */ /*! \file */ @@ -38,6 +36,10 @@ #define SPANDSP_USE_EXPORT_CAPABILITY 1 +#undef SPANDSP_SUPPORT_T42 +#undef SPANDSP_SUPPORT_T43 +#undef SPANDSP_SUPPORT_V34 + #include #include #include @@ -56,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +91,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -95,17 +101,21 @@ #include #include #include -#include #include -#include -#include #include #include #include -#include +#include +#include #include -#include +#include #include +#if defined(SPANDSP_SUPPORT_T42) +#include +#endif +#if defined(SPANDSP_SUPPORT_T43) +#include +#endif #include #include #include diff --git a/libs/spandsp/src/spandsp/private/fax_modems.h b/libs/spandsp/src/spandsp/private/fax_modems.h index f45969bb94..90aa47367a 100644 --- a/libs/spandsp/src/spandsp/private/fax_modems.h +++ b/libs/spandsp/src/spandsp/private/fax_modems.h @@ -99,6 +99,7 @@ struct fax_modems_state_s /*! \brief The current receive missing signal fill-in handler */ span_rx_fillin_handler_t rx_fillin_handler; void *rx_user_data; + void *rx_fillin_user_data; /*! \brief The current transmit signal handler */ span_tx_handler_t tx_handler; @@ -109,12 +110,12 @@ struct fax_modems_state_s span_tx_handler_t next_tx_handler; void *next_tx_user_data; - /*! The current bit rate of the transmitter. */ + /*! \brief The current bit rate of the transmitter. */ int tx_bit_rate; - /*! The current bit rate of the receiver. */ + /*! \brief The current bit rate of the receiver. */ int rx_bit_rate; - /*! If TRUE, transmission is in progress */ + /*! \brief If TRUE, transmission is in progress */ int transmit; /*! \brief Audio logging file handle for received audio. */ int audio_rx_log; diff --git a/libs/spandsp/src/spandsp/private/v17rx.h b/libs/spandsp/src/spandsp/private/v17rx.h index 8da0967a4a..81c7027cb2 100644 --- a/libs/spandsp/src/spandsp/private/v17rx.h +++ b/libs/spandsp/src/spandsp/private/v17rx.h @@ -73,7 +73,7 @@ struct v17_rx_state_s void *qam_user_data; #if defined(SPANDSP_USE_FIXED_POINTx) - /*! \brief The scaling factor accessed by the AGC algorithm. */ + /*! \brief The scaling factor assessed by the AGC algorithm. */ float agc_scaling; /*! \brief The previous value of agc_scaling, needed to reuse old training. */ float agc_scaling_save; @@ -110,7 +110,7 @@ struct v17_rx_state_s /*! \brief A pointer to the current constellation. */ const complexi16_t *constellation; #else - /*! \brief The scaling factor accessed by the AGC algorithm. */ + /*! \brief The scaling factor assessed by the AGC algorithm. */ float agc_scaling; /*! \brief The previous value of agc_scaling, needed to reuse old training. */ float agc_scaling_save; @@ -150,7 +150,7 @@ struct v17_rx_state_s /*! \brief Current offset into the RRC pulse shaping filter buffer. */ int rrc_filter_step; - /*! \brief The state of the differential decoder */ + /*! \brief The current state of the differential decoder */ int diff; /*! \brief The register for the data scrambler. */ uint32_t scramble_reg; @@ -228,7 +228,6 @@ struct v17_rx_state_s from the last states of the trellis. */ float distances[8]; #endif - /*! \brief Error and flow logging control */ logging_state_t logging; }; diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h index dca574df77..48e4c42714 100644 --- a/libs/spandsp/src/spandsp/private/v22bis.h +++ b/libs/spandsp/src/spandsp/private/v22bis.h @@ -65,6 +65,12 @@ enum V22BIS_TX_TRAINING_STAGE_PARKED }; +#if defined(SPANDSP_USE_FIXED_POINTx) +extern const complexi16_t v22bis_constellation[16]; +#else +extern const complexf_t v22bis_constellation[16]; +#endif + /*! V.22bis modem descriptor. This defines the working state for a single instance of a V.22bis modem. @@ -93,10 +99,11 @@ struct v22bis_state_s /* Receive section */ struct { - /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ #if defined(SPANDSP_USE_FIXED_POINTx) + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ int16_t rrc_filter[V22BIS_RX_FILTER_STEPS]; #else + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ float rrc_filter[V22BIS_RX_FILTER_STEPS]; #endif /*! \brief Current offset into the RRC pulse shaping filter buffer. */ @@ -156,7 +163,9 @@ struct v22bis_state_s /*! \brief The equalizer signal buffer. */ complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; #else + /*! \brief The adaptive equalizer coefficients. */ complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1]; + /*! \brief The equalizer signal buffer. */ complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; #endif /*! \brief Current offset into the equalizer buffer. */ @@ -186,7 +195,7 @@ struct v22bis_state_s /*! \brief The gain factor needed to achieve the specified output power. */ float gain; - /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ complexf_t rrc_filter[2*V22BIS_TX_FILTER_STEPS]; /*! \brief Current offset into the RRC pulse shaping filter buffer. */ int rrc_filter_step; diff --git a/libs/spandsp/src/spandsp/private/v27ter_rx.h b/libs/spandsp/src/spandsp/private/v27ter_rx.h index 4a991ba3f5..c491c905df 100644 --- a/libs/spandsp/src/spandsp/private/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/private/v27ter_rx.h @@ -70,7 +70,7 @@ struct v27ter_rx_state_s void *qam_user_data; #if defined(SPANDSP_USE_FIXED_POINT) - /*! \brief The scaling factor accessed by the AGC algorithm. */ + /*! \brief The scaling factor assessed by the AGC algorithm. */ int16_t agc_scaling; /*! \brief The previous value of agc_scaling, needed to reuse old training. */ int16_t agc_scaling_save; @@ -95,7 +95,7 @@ struct v27ter_rx_state_s /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ int16_t rrc_filter[V27TER_RX_FILTER_STEPS]; #else - /*! \brief The scaling factor accessed by the AGC algorithm. */ + /*! \brief The scaling factor assessed by the AGC algorithm. */ float agc_scaling; /*! \brief The previous value of agc_scaling, needed to reuse old training. */ float agc_scaling_save; diff --git a/libs/spandsp/src/spandsp/private/v29rx.h b/libs/spandsp/src/spandsp/private/v29rx.h index ee7cd9932c..c86c87fe2e 100644 --- a/libs/spandsp/src/spandsp/private/v29rx.h +++ b/libs/spandsp/src/spandsp/private/v29rx.h @@ -61,82 +61,8 @@ struct v29_rx_state_s routine. */ void *qam_user_data; - /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ #if defined(SPANDSP_USE_FIXED_POINT) - int16_t rrc_filter[V29_RX_FILTER_STEPS]; -#else - float rrc_filter[V29_RX_FILTER_STEPS]; -#endif - /*! \brief Current offset into the RRC pulse shaping filter buffer. */ - int rrc_filter_step; - - /*! \brief The register for the data scrambler. */ - uint32_t scramble_reg; - /*! \brief The register for the training scrambler. */ - uint8_t training_scramble_reg; - /*! \brief The current step in the table of CD constellation positions. */ - int training_cd; - /*! \brief TRUE if the previous trained values are to be reused. */ - int old_train; - /*! \brief The section of the training data we are currently in. */ - int training_stage; - /*! \brief A count of how far through the current training step we are. */ - int training_count; - /*! \brief A measure of how much mismatch there is between the real constellation, - and the decoded symbol positions. */ - float training_error; - /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */ - int16_t last_sample; - /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */ - int signal_present; - /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */ - int carrier_drop_pending; - /*! \brief A count of the current consecutive samples below the carrier off threshold. */ - int low_samples; - /*! \brief A highest magnitude sample seen. */ - int16_t high_sample; - - /*! \brief The position of the current symbol in the constellation, used for - differential decoding. */ - int constellation_state; - - /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ - uint32_t carrier_phase; - /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ - int32_t carrier_phase_rate; - /*! \brief The carrier update rate saved for reuse when using short training. */ - int32_t carrier_phase_rate_save; -#if defined(SPANDSP_USE_FIXED_POINT) - /*! \brief The proportional part of the carrier tracking filter. */ - int32_t carrier_track_p; - /*! \brief The integral part of the carrier tracking filter. */ - int32_t carrier_track_i; -#else - /*! \brief The proportional part of the carrier tracking filter. */ - float carrier_track_p; - /*! \brief The integral part of the carrier tracking filter. */ - float carrier_track_i; -#endif - - /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */ - power_meter_t power; - /*! \brief The power meter level at which carrier on is declared. */ - int32_t carrier_on_power; - /*! \brief The power meter level at which carrier off is declared. */ - int32_t carrier_off_power; - - /*! \brief Current read offset into the equalizer buffer. */ - int eq_step; - /*! \brief Current write offset into the equalizer buffer. */ - int eq_put_step; - /*! \brief Symbol counter to the next equalizer update. */ - int eq_skip; - - /*! \brief The current half of the baud. */ - int baud_half; - -#if defined(SPANDSP_USE_FIXED_POINT) - /*! \brief The scaling factor accessed by the AGC algorithm. */ + /*! \brief The scaling factor assessed by the AGC algorithm. */ int16_t agc_scaling; /*! \brief The previous value of agc_scaling, needed to reuse old training. */ int16_t agc_scaling_save; @@ -158,8 +84,19 @@ struct v29_rx_state_s int32_t symbol_sync_dc_filter[2]; /*! Baud phase for symbol sync. */ int32_t baud_phase; + + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + + /*! \brief The proportional part of the carrier tracking filter. */ + int32_t carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + int32_t carrier_track_i; + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ + int16_t rrc_filter[V29_RX_FILTER_STEPS]; #else - /*! \brief The scaling factor accessed by the AGC algorithm. */ + /*! \brief The scaling factor assessed by the AGC algorithm. */ float agc_scaling; /*! \brief The previous value of agc_scaling, needed to reuse old training. */ float agc_scaling_save; @@ -181,7 +118,67 @@ struct v29_rx_state_s float symbol_sync_dc_filter[2]; /*! Baud phase for symbol sync. */ float baud_phase; + + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ + float rrc_filter[V29_RX_FILTER_STEPS]; #endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ + int rrc_filter_step; + + /*! \brief The register for the data scrambler. */ + uint32_t scramble_reg; + /*! \brief The register for the training scrambler. */ + uint8_t training_scramble_reg; + /*! \brief The current step in the table of CD constellation positions. */ + int training_cd; + /*! \brief TRUE if the previous trained values are to be reused. */ + int old_train; + /*! \brief The section of the training data we are currently in. */ + int training_stage; + /*! \brief A count of how far through the current training step we are. */ + int training_count; + /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */ + int16_t last_sample; + /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */ + int signal_present; + /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */ + int carrier_drop_pending; + /*! \brief A count of the current consecutive samples below the carrier off threshold. */ + int low_samples; + /*! \brief A highest magnitude sample seen. */ + int16_t high_sample; + + /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ + uint32_t carrier_phase; + /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ + int32_t carrier_phase_rate; + /*! \brief The carrier update rate saved for reuse when using short training. */ + int32_t carrier_phase_rate_save; + + /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */ + power_meter_t power; + /*! \brief The power meter level at which carrier on is declared. */ + int32_t carrier_on_power; + /*! \brief The power meter level at which carrier off is declared. */ + int32_t carrier_off_power; + + /*! \brief Current read offset into the equalizer buffer. */ + int eq_step; + /*! \brief Current write offset into the equalizer buffer. */ + int eq_put_step; + /*! \brief Symbol counter to the next equalizer update. */ + int eq_skip; + + /*! \brief The current half of the baud. */ + int baud_half; /*! \brief The total symbol timing correction since the carrier came up. This is only for performance analysis purposes. */ @@ -191,6 +188,11 @@ struct v29_rx_state_s int32_t start_angles[2]; /*! \brief History list of phase angles for the coarse carrier aquisition step. */ int32_t angles[16]; + + /*! \brief The position of the current symbol in the constellation, used for + differential decoding. */ + int constellation_state; + /*! \brief Error and flow logging control */ logging_state_t logging; }; diff --git a/libs/spandsp/src/spandsp/private/v29tx.h b/libs/spandsp/src/spandsp/private/v29tx.h index 062ef7ee5c..034631ef87 100644 --- a/libs/spandsp/src/spandsp/private/v29tx.h +++ b/libs/spandsp/src/spandsp/private/v29tx.h @@ -47,21 +47,23 @@ struct v29_tx_state_s /*! \brief A user specified opaque pointer passed to the status function. */ void *status_user_data; +#if defined(SPANDSP_USE_FIXED_POINT) /*! \brief Gain required to achieve the specified output power, not allowing for the size of the current constellation. */ float base_gain; /*! \brief Gain required to achieve the specified output power, allowing for the size of the current constellation. */ -#if defined(SPANDSP_USE_FIXED_POINT) int32_t gain; -#else - float gain; -#endif - - /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ -#if defined(SPANDSP_USE_FIXED_POINT) + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS]; #else + /*! \brief Gain required to achieve the specified output power, not allowing + for the size of the current constellation. */ + float base_gain; + /*! \brief Gain required to achieve the specified output power, allowing + for the size of the current constellation. */ + float gain; + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ complexf_t rrc_filter[2*V29_TX_FILTER_STEPS]; #endif /*! \brief Current offset into the RRC pulse shaping filter buffer. */ diff --git a/libs/spandsp/src/spandsp/v17rx.h b/libs/spandsp/src/spandsp/v17rx.h index d6ac46caa1..4c01befd37 100644 --- a/libs/spandsp/src/spandsp/v17rx.h +++ b/libs/spandsp/src/spandsp/v17rx.h @@ -293,7 +293,7 @@ SPAN_DECLARE_NONSTD(int) v17_rx_fillin(v17_rx_state_t *s, int len); \param coeffs The vector of complex coefficients. \return The number of coefficients in the vector. */ #if defined(SPANDSP_USE_FIXED_POINTx) -SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi_t **coeffs); +SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi16_t **coeffs); #else SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs); #endif diff --git a/libs/spandsp/src/spandsp/v22bis.h b/libs/spandsp/src/spandsp/v22bis.h index 073fb7135a..6ecd91773e 100644 --- a/libs/spandsp/src/spandsp/v22bis.h +++ b/libs/spandsp/src/spandsp/v22bis.h @@ -61,8 +61,6 @@ enum */ typedef struct v22bis_state_s v22bis_state_t; -extern const complexf_t v22bis_constellation[16]; - #if defined(__cplusplus) extern "C" { @@ -88,7 +86,11 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx_fillin(v22bis_state_t *s, int len); \brief Get a snapshot of the current equalizer coefficients. \param coeffs The vector of complex coefficients. \return The number of coefficients in the vector. */ +#if defined(SPANDSP_USE_FIXED_POINTx) +SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexi16_t **coeffs); +#else SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs); +#endif /*! Get the current received carrier frequency. \param s The modem context. diff --git a/libs/spandsp/src/spandsp/v27ter_rx.h b/libs/spandsp/src/spandsp/v27ter_rx.h index bb12801b50..8e8de0d073 100644 --- a/libs/spandsp/src/spandsp/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/v27ter_rx.h @@ -126,7 +126,11 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len); \brief Get a snapshot of the current equalizer coefficients. \param coeffs The vector of complex coefficients. \return The number of coefficients in the vector. */ +#if defined(SPANDSP_USE_FIXED_POINTx) +SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t **coeffs); +#else SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs); +#endif /*! Get the current received carrier frequency. \param s The modem context. diff --git a/libs/spandsp/src/spandsp/v29rx.h b/libs/spandsp/src/spandsp/v29rx.h index d7874b68dc..8c89407ce3 100644 --- a/libs/spandsp/src/spandsp/v29rx.h +++ b/libs/spandsp/src/spandsp/v29rx.h @@ -118,7 +118,11 @@ scrambler register) cannot be trusted for the test. The receive modem, therefore, only tests that bits starting at bit 24 are really ones. */ +#if defined(SPANDSP_USE_FIXED_POINTx) +typedef void (*qam_report_handler_t)(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol); +#else typedef void (*qam_report_handler_t)(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol); +#endif /*! V.29 modem receive side descriptor. This defines the working state for a diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 5db995ddc7..e25e77b41a 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -5633,7 +5633,7 @@ SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_ break; default: span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get_chunk in bad state %d\n", s->state); - len = 0; + len = -1; break; } return len; diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c index 2ed6a9e24d..a1af29d577 100644 --- a/libs/spandsp/src/t31.c +++ b/libs/spandsp/src/t31.c @@ -724,13 +724,21 @@ static int stream_non_ecm(t31_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) + { + /* ???????? */ + } + } fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2; fe->next_tx_samples = fe->samples; break; case T38_TIMED_STEP_NON_ECM_MODEM_2: /* Switch on a fast modem, and give the training time to complete */ - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); + if ((delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator)) < 0) + { + /* ???????? */ + } fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; break; case T38_TIMED_STEP_NON_ECM_MODEM_3: @@ -762,12 +770,18 @@ static int stream_non_ecm(t31_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 (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) + { + /* ???????? */ + } fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; delay = 0; } } - 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 (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) + { + /* ???????? */ + } delay = bits_to_us(s, 8*len); break; case T38_TIMED_STEP_NON_ECM_MODEM_4: @@ -778,7 +792,10 @@ static int stream_non_ecm(t31_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 (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) + { + /* ???????? */ + } 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. */ @@ -789,13 +806,19 @@ static int stream_non_ecm(t31_state_t *s) break; } 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 (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) + { + /* ???????? */ + } delay = bits_to_us(s, 8*len); break; case T38_TIMED_STEP_NON_ECM_MODEM_5: /* This should not be needed, since the message above indicates the end of the signal, but it seems like it can improve compatibility with quirky implementations. */ - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0) + { + /* ???????? */ + } fe->timed_step = T38_TIMED_STEP_NONE; return delay; } @@ -822,13 +845,21 @@ static int stream_hdlc(t31_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) + { + /* ???????? */ + } + } fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2; fe->next_tx_samples = fe->samples + ms_to_samples(75); break; case T38_TIMED_STEP_HDLC_MODEM_2: /* Send HDLC preambling */ - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); + if ((delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator)) < 0) + { + /* ???????? */ + } delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; @@ -864,7 +895,10 @@ static int stream_hdlc(t31_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 (t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category) < 0) + { + /* ???????? */ + } 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. */ @@ -880,7 +914,10 @@ static int stream_hdlc(t31_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 (t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category) < 0) + { + /* ???????? */ + } fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); @@ -888,14 +925,20 @@ static int stream_hdlc(t31_state_t *s) break; } 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, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category); + if (t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category) < 0) + { + /* ???????? */ + } 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, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category); + if (t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category) < 0) + { + /* ???????? */ + } s->hdlc_tx.ptr += i; } delay = bits_to_us(s, i*8); @@ -911,7 +954,10 @@ static int stream_hdlc(t31_state_t *s) s->hdlc_tx.len = 0; s->hdlc_tx.final = FALSE; 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 (t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category) < 0) + { + /* ???????? */ + } 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. */ @@ -923,7 +969,10 @@ static int stream_hdlc(t31_state_t *s) } /* 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 (t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category) < 0) + { + /* ???????? */ + } fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); /* We should now wait enough time for everything to clear through an analogue modem at the far end. */ @@ -935,8 +984,14 @@ static int stream_hdlc(t31_state_t *s) /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point. A T38_IND_NO_SIGNAL should always be OK. */ 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, fe->current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category); - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + if (t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category) < 0) + { + /* ???????? */ + } + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0) + { + /* ???????? */ + } fe->timed_step = T38_TIMED_STEP_NONE; at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); @@ -963,14 +1018,20 @@ static int stream_ced(t31_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) + { + /* ???????? */ + } 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) + { + /* ???????? */ + } fe->current_tx_data_type = T38_DATA_NONE; break; case T38_TIMED_STEP_CED_3: @@ -1000,7 +1061,10 @@ static int stream_cng(t31_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) + { + /* ???????? */ + } delay = 200000; fe->next_tx_samples = fe->samples; break; @@ -1009,7 +1073,10 @@ static int stream_cng(t31_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) + { + /* ???????? */ + } fe->current_tx_data_type = T38_DATA_NONE; return delay; } @@ -1775,7 +1842,10 @@ static int restart_modem(t31_state_t *s, int new_modem) case FAX_MODEM_SILENCE_TX: if (s->t38_mode) { - t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); + if (t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL) < 0) + { + /* ???????? */ + } s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(700); s->t38_fe.timed_step = T38_TIMED_STEP_PAUSE; s->t38_fe.current_tx_data_type = T38_DATA_NONE; @@ -1802,7 +1872,10 @@ static int restart_modem(t31_state_t *s, int new_modem) /* Send 200ms of silence to "push" the last audio out */ if (s->t38_mode) { - t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); + if (t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL) < 0) + { + /* ???????? */ + } } else { diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 7da6ea93a1..3961bfa94d 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -81,10 +81,6 @@ #include "faxfont.h" -#ifndef UINT32_MAX -#define UINT32_MAX 0xffffffff -#endif - /*! The number of centimetres in one inch */ #define CM_PER_INCH 2.54f diff --git a/libs/spandsp/src/t85_encode.c b/libs/spandsp/src/t85_encode.c index 7577f270d9..6bcb3441f5 100644 --- a/libs/spandsp/src/t85_encode.c +++ b/libs/spandsp/src/t85_encode.c @@ -46,10 +46,6 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#ifndef UINT32_MAX -#define UINT32_MAX 0xffffffff -#endif - /* Image length update status */ enum { From d63323977fa611b141441f12af9a94ec19b5f829 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Jul 2012 12:19:47 -0500 Subject: [PATCH 0742/1057] turn on send_silence_when_idle whenever we engage srtp --- src/switch_rtp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 727c5d5196..16b5d6d38c 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1688,6 +1688,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess memset(policy, 0, sizeof(*policy)); + switch_channel_set_variable(channel, "send_silence_when_idle", "true"); + switch (crypto_key->type) { case AES_CM_128_HMAC_SHA1_80: crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy->rtp); From d3f1eeea61e745cf5a8b152f37e6c0260d5e5a7b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Jul 2012 12:37:08 -0500 Subject: [PATCH 0743/1057] FS-4378 actually fire the event --- src/mod/endpoints/mod_sofia/sofia.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 554ded0e85..b787a76d61 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7414,6 +7414,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Transfer-Exten", exten); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Full-Refer-To", full_ref_to); switch_channel_event_set_data(channel, event); + switch_event_fire(&event); } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n"); From 67442974b29913c2873d3a4dcf41434763716afa Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 18 Jul 2012 13:27:33 +0200 Subject: [PATCH 0744/1057] ftmod_libpri: Fix type-punned pointer warning in msn_filter_foreach(). cc1: warnings being treated as errors ./src/ftmod/ftmod_libpri/ftmod_libpri.c: In function 'msn_filter_foreach': ./src/ftmod/ftmod_libpri/ftmod_libpri.c:422: warning: dereferencing type-punned pointer will break strict-aliasing rules make: *** [ftmod_libpri_la-ftmod_libpri.lo] Error 1 Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index edfd8132a1..01abf1e5a0 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -417,11 +417,11 @@ static int msn_filter_foreach(ftdm_libpri_data_t *isdn_data, int (* func)(const ftdm_mutex_lock(isdn_data->msn_mutex); for (iter = hashtable_first(isdn_data->msn_hash); iter; iter = hashtable_next(iter)) { - const char *msn = NULL; + const void *msn = NULL; - hashtable_this(iter, (const void **)&msn, NULL, NULL); + hashtable_this(iter, &msn, NULL, NULL); - if (ftdm_strlen_zero(msn)) + if (ftdm_strlen_zero((const char *)msn)) break; if ((ret = func(msn, data)) != FTDM_SUCCESS) break; From 797bdf3edcd9202064bfa11406577f37b449c763 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Wed, 18 Jul 2012 20:41:07 +0000 Subject: [PATCH 0745/1057] Added debug-level param for spandsp tone detector --- .../conf/autoload_configs/spandsp.conf.xml | 2 +- src/mod/applications/mod_spandsp/mod_spandsp.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml index 6f062cc731..c2c943bf30 100644 --- a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml +++ b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml @@ -34,7 +34,7 @@ - + diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index f79bea68ac..8a382cfcb1 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -492,8 +492,6 @@ switch_status_t load_configuration(switch_bool_t reload) spandsp_globals.ident = "SpanDSP Fax Ident"; spandsp_globals.header = "SpanDSP Fax Header"; spandsp_globals.timezone = ""; - - /* TODO make configuration param */ spandsp_globals.tonedebug = 0; if ((xml = switch_xml_open_cfg("spandsp.conf", &cfg, NULL)) || (xml = switch_xml_open_cfg("fax.conf", &cfg, NULL))) { @@ -592,6 +590,16 @@ switch_status_t load_configuration(switch_bool_t reload) /* Configure call progress detector */ if ((callprogress = switch_xml_child(cfg, "descriptors"))) { + /* check if debugging is enabled */ + const char *debug = switch_xml_attr(callprogress, "debug-level"); + if (!zstr(debug) && switch_is_number(debug)) { + int debug_val = atoi(debug); + if (debug_val > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting tone detector debug-level to : %d\n", debug_val); + spandsp_globals.tonedebug = debug_val; + } + } + for (xdescriptor = switch_xml_child(callprogress, "descriptor"); xdescriptor; xdescriptor = switch_xml_next(xdescriptor)) { const char *name = switch_xml_attr(xdescriptor, "name"); const char *tone_name = NULL; From 7a167f838340339bd67b98a37ad98540f851887e Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Wed, 18 Jul 2012 16:29:36 -0700 Subject: [PATCH 0746/1057] Update phrase_en.xml to have other misc sound files --- docs/phrase/phrase_en.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 6de26e36ad..a1d968ae23 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -382,6 +382,7 @@ + @@ -567,9 +568,9 @@ - - - + + + From 913b39830f67854bd0c5e1643899ba8496323d20 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Thu, 19 Jul 2012 00:03:47 +0000 Subject: [PATCH 0747/1057] replace spaces with tabs in mod_spandsp --- .../applications/mod_spandsp/mod_spandsp.c | 608 +++---- .../applications/mod_spandsp/mod_spandsp.h | 10 +- .../mod_spandsp/mod_spandsp_dsp.c | 248 ++- .../mod_spandsp/mod_spandsp_fax.c | 1481 ++++++++--------- .../mod_spandsp/mod_spandsp_modem.c | 186 +-- 5 files changed, 1265 insertions(+), 1268 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 8a382cfcb1..33a06a067a 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2012, Anthony Minessale II * @@ -77,24 +77,24 @@ SWITCH_STANDARD_APP(stop_dtmf_session_function) SWITCH_STANDARD_APP(tdd_encode_function) { - char *text = (char *) data; + char *text = (char *) data; - if (!zstr(text)) { - spandsp_tdd_encode_session(session, text); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing text data\n"); - } + if (!zstr(text)) { + spandsp_tdd_encode_session(session, text); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing text data\n"); + } } SWITCH_STANDARD_APP(tdd_send_function) { - char *text = (char *) data; + char *text = (char *) data; - if (!zstr(text)) { - spandsp_tdd_send_session(session, text); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing text data\n"); - } + if (!zstr(text)) { + spandsp_tdd_send_session(session, text); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing text data\n"); + } } SWITCH_STANDARD_APP(stop_tdd_encode_function) @@ -107,7 +107,7 @@ SWITCH_STANDARD_APP(stop_tdd_encode_function) SWITCH_STANDARD_APP(tdd_decode_function) { - spandsp_tdd_decode_session(session); + spandsp_tdd_decode_session(session); } SWITCH_STANDARD_APP(stop_tdd_decode_function) @@ -118,17 +118,17 @@ SWITCH_STANDARD_APP(stop_tdd_decode_function) SWITCH_STANDARD_APP(spandsp_fax_detect_session_function) { - int argc = 0; + int argc = 0; char *argv[4] = { 0 }; - char *dupdata; - const char *app = NULL, *arg = NULL; - int timeout = 0; + char *dupdata; + const char *app = NULL, *arg = NULL; + int timeout = 0; int tone_type = MODEM_CONNECT_TONES_FAX_CNG; - if (!zstr(data) && (dupdata = switch_core_session_strdup(session, data))) { + if (!zstr(data) && (dupdata = switch_core_session_strdup(session, data))) { if ((argc = switch_split(dupdata, ' ', argv)) >= 2) { - app = argv[0]; - arg = argv[1]; + app = argv[0]; + arg = argv[1]; if (argc > 2) { timeout = atoi(argv[2]); if (timeout < 0) { @@ -142,101 +142,101 @@ SWITCH_STANDARD_APP(spandsp_fax_detect_session_function) tone_type = MODEM_CONNECT_TONES_FAX_CNG; } } - } - } - - if (app) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Enabling fax detection '%s' '%s'\n", argv[0], argv[1]); + } + } + + 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, tone_type, 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]); - } + } 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); + spandsp_fax_stop_detect_session(session); } static void tdd_event_handler(switch_event_t *event) { - const char *uuid = switch_event_get_header(event, "tdd-uuid"); - const char *message = switch_event_get_body(event); - switch_core_session_t *session; + const char *uuid = switch_event_get_header(event, "tdd-uuid"); + const char *message = switch_event_get_body(event); + switch_core_session_t *session; - if (zstr(message)) { - message = switch_event_get_header(event, "tdd-message"); - } + if (zstr(message)) { + message = switch_event_get_header(event, "tdd-message"); + } - if (zstr(message)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No message for tdd handler\n"); - return; - } + if (zstr(message)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No message for tdd handler\n"); + return; + } - if (zstr(uuid)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No uuid for tdd handler\n"); - return; - } + if (zstr(uuid)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No uuid for tdd handler\n"); + return; + } - if ((session = switch_core_session_locate(uuid))) { + if ((session = switch_core_session_locate(uuid))) { - spandsp_tdd_encode_session(session, message); + spandsp_tdd_encode_session(session, message); - switch_core_session_rwunlock(session); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No session for supplied uuid.\n"); - } + switch_core_session_rwunlock(session); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No session for supplied uuid.\n"); + } } static void event_handler(switch_event_t *event) { - load_configuration(1); + load_configuration(1); } 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 = NULL, *flags = NULL; - - 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]; - } - } - } + 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 = NULL, *flags = NULL; - if (zstr(direction) || strcasecmp(direction, "self")) { - direction = "peer"; - } - - switch_channel_set_variable(channel, "t38_leg", direction); + if (!zstr(data) && (dupdata = switch_core_session_strdup(session, data))) { + if ((argc = switch_split(dupdata, ' ', argv))) { + if (argc > 0) { + direction = argv[0]; + } - 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)); - } - } + if (argc > 1) { + flags = argv[1]; + } + } + } - //switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start); + if (zstr(direction) || strcasecmp(direction, "self")) { + direction = "peer"; + } + + 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); spandsp_fax_detect_session(session, "rw", timeout, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, 1, direction, NULL, t38_gateway_start); - } + } } /** @@ -265,17 +265,17 @@ SWITCH_STANDARD_APP(start_tone_detect_app) SWITCH_STANDARD_API(start_tone_detect_api) { switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_core_session_t *psession = NULL; + switch_core_session_t *psession = NULL; if (zstr(cmd)) { stream->write_function(stream, "-ERR missing descriptor name\n"); return SWITCH_STATUS_SUCCESS; } - if (!(psession = switch_core_session_locate(cmd))) { - stream->write_function(stream, "-ERR Cannot locate session\n"); - return SWITCH_STATUS_SUCCESS; - } + if (!(psession = switch_core_session_locate(cmd))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + return SWITCH_STATUS_SUCCESS; + } status = callprogress_detector_start(psession, cmd); @@ -285,8 +285,8 @@ SWITCH_STANDARD_API(start_tone_detect_api) } else { stream->write_function(stream, "-ERR failed to start tone detector\n"); } - - switch_core_session_rwunlock(psession); + + switch_core_session_rwunlock(psession); return status; } @@ -316,22 +316,22 @@ SWITCH_STANDARD_APP(stop_tone_detect_app) SWITCH_STANDARD_API(stop_tone_detect_api) { switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_core_session_t *psession = NULL; + switch_core_session_t *psession = NULL; if (zstr(cmd)) { stream->write_function(stream, "-ERR missing descriptor name\n"); return SWITCH_STATUS_SUCCESS; } - if (!(psession = switch_core_session_locate(cmd))) { - stream->write_function(stream, "-ERR Cannot locate session\n"); - return SWITCH_STATUS_SUCCESS; - } + if (!(psession = switch_core_session_locate(cmd))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + return SWITCH_STATUS_SUCCESS; + } + + callprogress_detector_stop(psession); + stream->write_function(stream, "+OK stopped\n"); + switch_core_session_rwunlock(psession); - callprogress_detector_stop(psession); - stream->write_function(stream, "+OK stopped\n"); - switch_core_session_rwunlock(psession); - return status; } @@ -340,22 +340,22 @@ SWITCH_STANDARD_API(stop_tone_detect_api) SWITCH_STANDARD_API(start_tdd_detect_api) { switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_core_session_t *psession = NULL; + switch_core_session_t *psession = NULL; - if (!(psession = switch_core_session_locate(cmd))) { - stream->write_function(stream, "-ERR Cannot locate session\n"); - return SWITCH_STATUS_SUCCESS; - } + if (!(psession = switch_core_session_locate(cmd))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + return SWITCH_STATUS_SUCCESS; + } - spandsp_tdd_decode_session(psession); + spandsp_tdd_decode_session(psession); if (status == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK started\n"); } else { stream->write_function(stream, "-ERR failed to start tdd detector\n"); } - - switch_core_session_rwunlock(psession); + + switch_core_session_rwunlock(psession); return status; } @@ -364,94 +364,94 @@ SWITCH_STANDARD_API(start_tdd_detect_api) SWITCH_STANDARD_API(stop_tdd_detect_api) { switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_core_session_t *psession = NULL; + switch_core_session_t *psession = NULL; - if (!(psession = switch_core_session_locate(cmd))) { - stream->write_function(stream, "-ERR Cannot locate session\n"); - return SWITCH_STATUS_SUCCESS; - } + if (!(psession = switch_core_session_locate(cmd))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + return SWITCH_STATUS_SUCCESS; + } - spandsp_stop_tdd_decode_session(psession); + spandsp_stop_tdd_decode_session(psession); + + stream->write_function(stream, "+OK stopped\n"); + switch_core_session_rwunlock(psession); - stream->write_function(stream, "+OK stopped\n"); - switch_core_session_rwunlock(psession); - return status; } SWITCH_STANDARD_API(start_send_tdd_api) { - switch_core_session_t *psession = NULL; - char *puuid = NULL, *text = NULL; + switch_core_session_t *psession = NULL; + char *puuid = NULL, *text = NULL; if (zstr(cmd)) { stream->write_function(stream, "-ERR missing uuid\n"); return SWITCH_STATUS_SUCCESS; } - puuid = strdup((char *)cmd); + puuid = strdup((char *)cmd); - if ((text = strchr(puuid, ' '))) { - *text++ = '\0'; - } + if ((text = strchr(puuid, ' '))) { + *text++ = '\0'; + } if (zstr(text)) { stream->write_function(stream, "-ERR missing text\n"); - goto end; + goto end; } - if (!(psession = switch_core_session_locate(puuid))) { - stream->write_function(stream, "-ERR Cannot locate session\n"); - goto end; - } + if (!(psession = switch_core_session_locate(puuid))) { + stream->write_function(stream, "-ERR Cannot locate session\n"); + goto end; + } - spandsp_tdd_encode_session(psession, text); + spandsp_tdd_encode_session(psession, text); + + stream->write_function(stream, "+OK\n"); + switch_core_session_rwunlock(psession); - stream->write_function(stream, "+OK\n"); - switch_core_session_rwunlock(psession); - end: - switch_safe_free(puuid); + switch_safe_free(puuid); return SWITCH_STATUS_SUCCESS; } void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on) { - switch_core_session_t *target_session = NULL; - int locked = 0; + switch_core_session_t *target_session = NULL; + int locked = 0; - if (self) { - target_session = session; - } else { - if (switch_core_session_get_partner(session, &target_session) == SWITCH_STATUS_SUCCESS) { - locked = 1; - } else { - target_session = NULL; - } - } + if (self) { + target_session = session; + } else { + if (switch_core_session_get_partner(session, &target_session) == SWITCH_STATUS_SUCCESS) { + locked = 1; + } else { + target_session = NULL; + } + } - if (target_session) { - switch_core_session_message_t *msg; - - msg = switch_core_session_alloc(target_session, sizeof(*msg)); - MESSAGE_STAMP_FFL(msg); - msg->message_id = SWITCH_MESSAGE_INDICATE_AUDIO_DATA; - msg->from = __FILE__; - msg->numeric_arg = on; - - switch_core_session_queue_message(target_session, msg); + if (target_session) { + switch_core_session_message_t *msg; - if (locked) { - switch_core_session_rwunlock(target_session); - locked = 0; - } - } + msg = switch_core_session_alloc(target_session, sizeof(*msg)); + MESSAGE_STAMP_FFL(msg); + msg->message_id = SWITCH_MESSAGE_INDICATE_AUDIO_DATA; + msg->from = __FILE__; + msg->numeric_arg = on; + + switch_core_session_queue_message(target_session, msg); + + if (locked) { + switch_core_session_rwunlock(target_session); + locked = 0; + } + } } @@ -462,46 +462,46 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel switch_status_t load_configuration(switch_bool_t reload) { switch_xml_t xml = NULL, x_lists = NULL, x_list = NULL, cfg = NULL, callprogress = NULL, xdescriptor = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; + switch_status_t status = SWITCH_STATUS_FALSE; - switch_mutex_lock(spandsp_globals.mutex); + switch_mutex_lock(spandsp_globals.mutex); if (spandsp_globals.tones) { - switch_core_hash_destroy(&spandsp_globals.tones); - } - - if (spandsp_globals.config_pool) { - switch_core_destroy_memory_pool(&spandsp_globals.config_pool); - } + switch_core_hash_destroy(&spandsp_globals.tones); + } - switch_core_new_memory_pool(&spandsp_globals.config_pool); + if (spandsp_globals.config_pool) { + switch_core_destroy_memory_pool(&spandsp_globals.config_pool); + } + + switch_core_new_memory_pool(&spandsp_globals.config_pool); switch_core_hash_init(&spandsp_globals.tones, spandsp_globals.config_pool); - spandsp_globals.modem_dialplan = "XML"; - spandsp_globals.modem_context = "default"; - spandsp_globals.modem_count = 0; + spandsp_globals.modem_dialplan = "XML"; + spandsp_globals.modem_context = "default"; + spandsp_globals.modem_count = 0; - spandsp_globals.enable_t38 = 1; + spandsp_globals.enable_t38 = 1; spandsp_globals.total_sessions = 0; spandsp_globals.verbose = 0; spandsp_globals.use_ecm = 1; spandsp_globals.disable_v17 = 0; spandsp_globals.prepend_string = switch_core_strdup(spandsp_globals.config_pool, "fax"); spandsp_globals.spool = switch_core_strdup(spandsp_globals.config_pool, "/tmp"); - spandsp_globals.ident = "SpanDSP Fax Ident"; - spandsp_globals.header = "SpanDSP Fax Header"; - spandsp_globals.timezone = ""; + spandsp_globals.ident = "SpanDSP Fax Ident"; + spandsp_globals.header = "SpanDSP Fax Header"; + spandsp_globals.timezone = ""; spandsp_globals.tonedebug = 0; if ((xml = switch_xml_open_cfg("spandsp.conf", &cfg, NULL)) || (xml = switch_xml_open_cfg("fax.conf", &cfg, NULL))) { - status = SWITCH_STATUS_SUCCESS; + status = SWITCH_STATUS_SUCCESS; if ((x_lists = switch_xml_child(cfg, "modem-settings"))) { for (x_list = switch_xml_child(x_lists, "param"); x_list; x_list = x_list->next) { const char *name = switch_xml_attr(x_list, "name"); const char *value = switch_xml_attr(x_list, "value"); - + if (zstr(name)) { continue; } @@ -510,28 +510,28 @@ switch_status_t load_configuration(switch_bool_t reload) continue; } - - if (!reload && !strcmp(name, "total-modems")) { - int tmp = atoi(value); - if (tmp > -1 && tmp < MAX_MODEMS) { - spandsp_globals.modem_count = tmp; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%d] for total-modems\n", tmp); - } + if (!reload && !strcmp(name, "total-modems")) { + int tmp = atoi(value); + + if (tmp > -1 && tmp < MAX_MODEMS) { + spandsp_globals.modem_count = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%d] for total-modems\n", tmp); + } } else if (!strcmp(name, "dialplan")) { - spandsp_globals.modem_dialplan = switch_core_strdup(spandsp_globals.config_pool, value); + spandsp_globals.modem_dialplan = switch_core_strdup(spandsp_globals.config_pool, value); } else if (!strcmp(name, "context")) { - spandsp_globals.modem_context = switch_core_strdup(spandsp_globals.config_pool, value); + spandsp_globals.modem_context = switch_core_strdup(spandsp_globals.config_pool, value); } else if (!strcmp(name, "verbose")) { - if (switch_true(value)) { - spandsp_globals.modem_verbose = 1; - } else { - spandsp_globals.modem_verbose = 0; - } - } - } - } + if (switch_true(value)) { + spandsp_globals.modem_verbose = 1; + } else { + spandsp_globals.modem_verbose = 0; + } + } + } + } if ((x_lists = switch_xml_child(cfg, "fax-settings")) || (x_lists = switch_xml_child(cfg, "settings"))) { for (x_list = switch_xml_child(x_lists, "param"); x_list; x_list = x_list->next) { @@ -564,19 +564,19 @@ switch_status_t load_configuration(switch_bool_t reload) } else if (!strcmp(name, "enable-t38")) { if (switch_true(value)) { spandsp_globals.enable_t38= 1; - } else { + } else { spandsp_globals.enable_t38 = 0; - } + } } else if (!strcmp(name, "enable-t38-request")) { if (switch_true(value)) { spandsp_globals.enable_t38_request = 1; - } else { + } else { spandsp_globals.enable_t38_request = 0; - } + } } else if (!strcmp(name, "ident")) { - spandsp_globals.ident = switch_core_strdup(spandsp_globals.config_pool, value); + spandsp_globals.ident = switch_core_strdup(spandsp_globals.config_pool, value); } else if (!strcmp(name, "header")) { - spandsp_globals.header = switch_core_strdup(spandsp_globals.config_pool, value); + spandsp_globals.header = switch_core_strdup(spandsp_globals.config_pool, value); } else if (!strcmp(name, "spool-dir")) { spandsp_globals.spool = switch_core_strdup(spandsp_globals.config_pool, value); } else if (!strcmp(name, "file-prefix")) { @@ -588,8 +588,8 @@ switch_status_t load_configuration(switch_bool_t reload) } } - /* Configure call progress detector */ - if ((callprogress = switch_xml_child(cfg, "descriptors"))) { + /* Configure call progress detector */ + if ((callprogress = switch_xml_child(cfg, "descriptors"))) { /* check if debugging is enabled */ const char *debug = switch_xml_attr(callprogress, "debug-level"); if (!zstr(debug) && switch_is_number(debug)) { @@ -600,89 +600,89 @@ switch_status_t load_configuration(switch_bool_t reload) } } - for (xdescriptor = switch_xml_child(callprogress, "descriptor"); xdescriptor; xdescriptor = switch_xml_next(xdescriptor)) { - const char *name = switch_xml_attr(xdescriptor, "name"); - const char *tone_name = NULL; - switch_xml_t tone = NULL, element = NULL; - tone_descriptor_t *descriptor = NULL; + for (xdescriptor = switch_xml_child(callprogress, "descriptor"); xdescriptor; xdescriptor = switch_xml_next(xdescriptor)) { + const char *name = switch_xml_attr(xdescriptor, "name"); + const char *tone_name = NULL; + switch_xml_t tone = NULL, element = NULL; + tone_descriptor_t *descriptor = NULL; - /* create descriptor */ - if (zstr(name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing name\n"); - switch_goto_status(SWITCH_STATUS_FALSE, done); - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding tone_descriptor: %s\n", name); - if (tone_descriptor_create(&descriptor, name, spandsp_globals.config_pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to allocate tone_descriptor: %s\n", name); - switch_goto_status(SWITCH_STATUS_FALSE, done); - } - switch_core_hash_insert(spandsp_globals.tones, name, descriptor); + /* create descriptor */ + if (zstr(name)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing name\n"); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding tone_descriptor: %s\n", name); + if (tone_descriptor_create(&descriptor, name, spandsp_globals.config_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to allocate tone_descriptor: %s\n", name); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + switch_core_hash_insert(spandsp_globals.tones, name, descriptor); + + /* add tones to descriptor */ + for (tone = switch_xml_child(xdescriptor, "tone"); tone; tone = switch_xml_next(tone)) { + int id = 0; + tone_name = switch_xml_attr(tone, "name"); + if (zstr(tone_name)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing name for %s\n", name); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + id = tone_descriptor_add_tone(descriptor, tone_name); + if (id == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Unable to add tone_descriptor: %s, tone: %s. (too many tones)\n", name, tone_name); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "Adding tone_descriptor: %s, tone: %s(%d)\n", name, tone_name, id); + /* add elements to tone */ + for (element = switch_xml_child(tone, "element"); element; element = switch_xml_next(element)) { + const char *freq1_attr = switch_xml_attr(element, "freq1"); + const char *freq2_attr = switch_xml_attr(element, "freq2"); + const char *min_attr = switch_xml_attr(element, "min"); + const char *max_attr = switch_xml_attr(element, "max"); + int freq1, freq2, min, max; + if (zstr(freq1_attr)) { + freq1 = 0; + } else { + freq1 = atoi(freq1_attr); + } + if (zstr(freq2_attr)) { + freq2 = 0; + } else { + freq2 = atoi(freq2_attr); + } + if (zstr(min_attr)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Missing min in of %s %s(%d)\n", name, tone_name, id); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + min = atoi(min_attr); + if (zstr(max_attr)) { + max = 0; + } else { + max = atoi(max_attr); + } + /* check params */ + if ((freq1 < 0 || freq2 < 0 || min < 0 || max < 0) || (freq1 == 0 && min == 0 && max == 0)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid element param.\n"); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "Adding tone_descriptor: %s, tone: %s(%d), element (%d, %d, %d, %d)\n", name, tone_name, id, freq1, freq2, min, max); + tone_descriptor_add_tone_element(descriptor, id, freq1, freq2, min, max); + } + } + } + } + + done: - /* add tones to descriptor */ - for (tone = switch_xml_child(xdescriptor, "tone"); tone; tone = switch_xml_next(tone)) { - int id = 0; - tone_name = switch_xml_attr(tone, "name"); - if (zstr(tone_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing name for %s\n", name); - switch_goto_status(SWITCH_STATUS_FALSE, done); - } - id = tone_descriptor_add_tone(descriptor, tone_name); - if (id == -1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Unable to add tone_descriptor: %s, tone: %s. (too many tones)\n", name, tone_name); - switch_goto_status(SWITCH_STATUS_FALSE, done); - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Adding tone_descriptor: %s, tone: %s(%d)\n", name, tone_name, id); - /* add elements to tone */ - for (element = switch_xml_child(tone, "element"); element; element = switch_xml_next(element)) { - const char *freq1_attr = switch_xml_attr(element, "freq1"); - const char *freq2_attr = switch_xml_attr(element, "freq2"); - const char *min_attr = switch_xml_attr(element, "min"); - const char *max_attr = switch_xml_attr(element, "max"); - int freq1, freq2, min, max; - if (zstr(freq1_attr)) { - freq1 = 0; - } else { - freq1 = atoi(freq1_attr); - } - if (zstr(freq2_attr)) { - freq2 = 0; - } else { - freq2 = atoi(freq2_attr); - } - if (zstr(min_attr)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Missing min in of %s %s(%d)\n", name, tone_name, id); - switch_goto_status(SWITCH_STATUS_FALSE, done); - } - min = atoi(min_attr); - if (zstr(max_attr)) { - max = 0; - } else { - max = atoi(max_attr); - } - /* check params */ - if ((freq1 < 0 || freq2 < 0 || min < 0 || max < 0) || (freq1 == 0 && min == 0 && max == 0)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid element param.\n"); - switch_goto_status(SWITCH_STATUS_FALSE, done); - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Adding tone_descriptor: %s, tone: %s(%d), element (%d, %d, %d, %d)\n", name, tone_name, id, freq1, freq2, min, max); - tone_descriptor_add_tone_element(descriptor, id, freq1, freq2, min, max); - } - } - } - } - - done: - switch_xml_free(xml); } - switch_mutex_unlock(spandsp_globals.mutex); + switch_mutex_unlock(spandsp_globals.mutex); - return status; + return status; } @@ -698,7 +698,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) switch_mutex_init(&spandsp_globals.mutex, SWITCH_MUTEX_NESTED, pool); SWITCH_ADD_APP(app_interface, "t38_gateway", "Convert to T38 Gateway if tones are heard", "Convert to T38 Gateway if tones are heard", - t38_gateway_function, "", SAF_MEDIA_TAP); + t38_gateway_function, "", SAF_MEDIA_TAP); SWITCH_ADD_APP(app_interface, "rxfax", "FAX Receive Application", "FAX Receive Application", spanfax_rx_function, SPANFAX_RX_USAGE, SAF_SUPPORT_NOMEDIA); @@ -722,27 +722,27 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) "[ ][ ][ ]", 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); - - load_configuration(0); + + load_configuration(0); mod_spandsp_fax_load(pool); - mod_spandsp_codecs_load(module_interface, pool); + mod_spandsp_codecs_load(module_interface, pool); + - if (mod_spandsp_dsp_load(module_interface, pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load or process spandsp.conf, not adding tone_detect applications\n"); - } else { - SWITCH_ADD_APP(app_interface, "start_tone_detect", "Start background tone detection with cadence", "", start_tone_detect_app, "[name]", SAF_NONE); - SWITCH_ADD_APP(app_interface, "stop_tone_detect", "Stop background tone detection with cadence", "", stop_tone_detect_app, "", SAF_NONE); - SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, "[name]"); - SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, ""); + } else { + SWITCH_ADD_APP(app_interface, "start_tone_detect", "Start background tone detection with cadence", "", start_tone_detect_app, "[name]", SAF_NONE); + SWITCH_ADD_APP(app_interface, "stop_tone_detect", "Stop background tone detection with cadence", "", stop_tone_detect_app, "", SAF_NONE); + SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, "[name]"); + SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, ""); } - - SWITCH_ADD_API(api_interface, "start_tdd_detect", "Start background tdd detection", start_tdd_detect_api, ""); - SWITCH_ADD_API(api_interface, "stop_tdd_detect", "Stop background tdd detection", stop_tdd_detect_api, ""); - SWITCH_ADD_API(api_interface, "uuid_send_tdd", "send tdd data to a uuid", start_send_tdd_api, " "); + SWITCH_ADD_API(api_interface, "start_tdd_detect", "Start background tdd detection", start_tdd_detect_api, ""); + SWITCH_ADD_API(api_interface, "stop_tdd_detect", "Stop background tdd detection", stop_tdd_detect_api, ""); + + SWITCH_ADD_API(api_interface, "uuid_send_tdd", "send tdd data to a uuid", start_send_tdd_api, " "); switch_console_set_complete("add uuid_send_tdd ::console::list_uuid"); @@ -776,13 +776,13 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown) mod_spandsp_dsp_shutdown(); modem_global_shutdown(); - if (spandsp_globals.tones) { - switch_core_hash_destroy(&spandsp_globals.tones); - } + if (spandsp_globals.tones) { + switch_core_hash_destroy(&spandsp_globals.tones); + } - if (spandsp_globals.config_pool) { - switch_core_destroy_memory_pool(&spandsp_globals.config_pool); - } + if (spandsp_globals.config_pool) { + switch_core_destroy_memory_pool(&spandsp_globals.config_pool); + } return SWITCH_STATUS_UNLOAD; } diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 68152ffdf9..0d40b43c88 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -60,9 +60,9 @@ struct spandsp_globals { short int use_ecm; short int verbose; short int disable_v17; - short int enable_t38; - short int enable_t38_request; - short int enable_t38_insist; + short int enable_t38; + short int enable_t38_request; + short int enable_t38_insist; char *ident; char *header; char *timezone; @@ -84,7 +84,7 @@ extern struct spandsp_globals spandsp_globals; typedef enum { FUNCTION_TX, FUNCTION_RX, - FUNCTION_GW + FUNCTION_GW } mod_spandsp_fax_application_mode_t; /****************************************************************************** @@ -107,7 +107,7 @@ struct tone_descriptor { /** The mapping of tone id to key */ char tone_keys[MAX_TONES][STRLEN]; - int idx; + int idx; }; typedef struct tone_descriptor tone_descriptor_t; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 576c7592d1..ddf833dd94 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -40,8 +40,8 @@ typedef struct { switch_core_session_t *session; v18_state_t *tdd_state; - int head_lead; - int tail_lead; + int head_lead; + int tail_lead; } switch_tdd_t; static switch_bool_t tdd_encode_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) @@ -63,22 +63,22 @@ static switch_bool_t tdd_encode_callback(switch_media_bug_t *bug, void *user_dat if ((frame = switch_core_media_bug_get_write_replace_frame(bug))) { int len; - if (pvt->tail_lead) { - if (!--pvt->tail_lead) { - r = SWITCH_FALSE; - } - memset(frame->data, 0, frame->datalen); + if (pvt->tail_lead) { + if (!--pvt->tail_lead) { + r = SWITCH_FALSE; + } + memset(frame->data, 0, frame->datalen); - } else if (pvt->head_lead) { - pvt->head_lead--; - memset(frame->data, 0, frame->datalen); - } else { - len = v18_tx(pvt->tdd_state, frame->data, frame->samples); + } else if (pvt->head_lead) { + pvt->head_lead--; + memset(frame->data, 0, frame->datalen); + } else { + len = v18_tx(pvt->tdd_state, frame->data, frame->samples); - if (!len) { - pvt->tail_lead = TDD_LEAD; - } - } + if (!len) { + pvt->tail_lead = TDD_LEAD; + } + } switch_core_media_bug_set_write_replace_frame(bug, frame); } @@ -106,135 +106,135 @@ switch_status_t spandsp_stop_tdd_encode_session(switch_core_session_t *session) static void put_text_msg(void *user_data, const uint8_t *msg, int len) { - switch_tdd_t *pvt = (switch_tdd_t *) user_data; - switch_event_t *event, *clone; - switch_channel_t *channel = switch_core_session_get_channel(pvt->session); - switch_core_session_t *other_session; + switch_tdd_t *pvt = (switch_tdd_t *) user_data; + switch_event_t *event, *clone; + switch_channel_t *channel = switch_core_session_get_channel(pvt->session); + switch_core_session_t *other_session; - switch_channel_add_variable_var_check(channel, "tdd_messages", (char *)msg, SWITCH_FALSE, SWITCH_STACK_PUSH); - - - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TDD_RECV_MESSAGE) == SWITCH_STATUS_SUCCESS) { - - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", "mod_spandsp"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "TDD MESSAGE"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "TDD-Data", (char *)msg); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(pvt->session)); - switch_event_add_body(event, "%s\n\n", (char *)msg); - - if (switch_core_session_get_partner(pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) { - - if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { - switch_core_session_receive_event(other_session, &clone); - } - - if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { - switch_core_session_queue_event(other_session, &clone); - } - - switch_core_session_rwunlock(other_session); - } - - switch_event_fire(&event); + switch_channel_add_variable_var_check(channel, "tdd_messages", (char *)msg, SWITCH_FALSE, SWITCH_STACK_PUSH); - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s got TDD Message [%s]\n", switch_channel_get_name(channel), (char *)msg); + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TDD_RECV_MESSAGE) == SWITCH_STATUS_SUCCESS) { + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", "mod_spandsp"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "tdd"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "TDD MESSAGE"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "TDD-Data", (char *)msg); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(pvt->session)); + switch_event_add_body(event, "%s\n\n", (char *)msg); + + if (switch_core_session_get_partner(pvt->session, &other_session) == SWITCH_STATUS_SUCCESS) { + + if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { + switch_core_session_receive_event(other_session, &clone); + } + + if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { + switch_core_session_queue_event(other_session, &clone); + } + + switch_core_session_rwunlock(other_session); + } + + switch_event_fire(&event); + + + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s got TDD Message [%s]\n", switch_channel_get_name(channel), (char *)msg); } static int get_v18_mode(switch_core_session_t *session) { - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *var; - int r = V18_MODE_5BIT_45; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *var; + int r = V18_MODE_5BIT_45; - if ((var = switch_channel_get_variable(channel, "v18_mode"))) { - if (!strcasecmp(var, "5BIT_45") || !strcasecmp(var, "baudot")) { - r = V18_MODE_5BIT_45; - } else if (!strcasecmp(var, "5BIT_50")) { - r = V18_MODE_5BIT_50; - } else if (!strcasecmp(var, "DTMF")) { - r = V18_MODE_DTMF; - } else if (!strcasecmp(var, "EDT")) { - r = V18_MODE_EDT; - } else if (!strcasecmp(var, "BELL103") || !strcasecmp(var, "ascii")) { - r = V18_MODE_BELL103; - } else if (!strcasecmp(var, "V23VIDEOTEX")) { - r = V18_MODE_V23VIDEOTEX; - } else if (!strcasecmp(var, "V21TEXTPHONE")) { - r = V18_MODE_V21TEXTPHONE; - } else if (!strcasecmp(var, "V18TEXTPHONE")) { - r = V18_MODE_V18TEXTPHONE; - } - } + if ((var = switch_channel_get_variable(channel, "v18_mode"))) { + if (!strcasecmp(var, "5BIT_45") || !strcasecmp(var, "baudot")) { + r = V18_MODE_5BIT_45; + } else if (!strcasecmp(var, "5BIT_50")) { + r = V18_MODE_5BIT_50; + } else if (!strcasecmp(var, "DTMF")) { + r = V18_MODE_DTMF; + } else if (!strcasecmp(var, "EDT")) { + r = V18_MODE_EDT; + } else if (!strcasecmp(var, "BELL103") || !strcasecmp(var, "ascii")) { + r = V18_MODE_BELL103; + } else if (!strcasecmp(var, "V23VIDEOTEX")) { + r = V18_MODE_V23VIDEOTEX; + } else if (!strcasecmp(var, "V21TEXTPHONE")) { + r = V18_MODE_V21TEXTPHONE; + } else if (!strcasecmp(var, "V18TEXTPHONE")) { + r = V18_MODE_V18TEXTPHONE; + } + } - return r; + return r; } switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const char *text) { - v18_state_t *tdd_state; - switch_frame_t *read_frame, write_frame = { 0 }; - uint8_t write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]; + v18_state_t *tdd_state; + switch_frame_t *read_frame, write_frame = { 0 }; + uint8_t write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]; switch_codec_implementation_t read_impl = { 0 }; switch_codec_t write_codec = { 0 }; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_status_t status; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status; switch_core_session_get_read_impl(session, &read_impl); - - if (switch_core_codec_init(&write_codec, - "L16", - NULL, - read_impl.actual_samples_per_second, - read_impl.microseconds_per_packet / 1000, - read_impl.number_of_channels, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, - switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { - write_frame.data = write_buf; - write_frame.buflen = sizeof(write_buf); - write_frame.datalen = read_impl.decoded_bytes_per_packet; - write_frame.samples = write_frame.datalen / 2; - write_frame.codec = &write_codec; - switch_core_session_set_read_codec(session, &write_codec); - } else { - return SWITCH_STATUS_FALSE; - } - tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL); + if (switch_core_codec_init(&write_codec, + "L16", + NULL, + read_impl.actual_samples_per_second, + read_impl.microseconds_per_packet / 1000, + read_impl.number_of_channels, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, + switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + write_frame.data = write_buf; + write_frame.buflen = sizeof(write_buf); + write_frame.datalen = read_impl.decoded_bytes_per_packet; + write_frame.samples = write_frame.datalen / 2; + write_frame.codec = &write_codec; + switch_core_session_set_read_codec(session, &write_codec); + } else { + return SWITCH_STATUS_FALSE; + } + + tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL); + - v18_put(tdd_state, text, -1); - while(switch_channel_ready(channel)) { + while(switch_channel_ready(channel)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; } - - if (!v18_tx(tdd_state, (void *)write_buf, write_frame.samples)) { - break; - } - if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - break; - } + if (!v18_tx(tdd_state, (void *)write_buf, write_frame.samples)) { + break; + } - } + if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + break; + } - switch_core_codec_destroy(&write_codec); - switch_core_session_set_read_codec(session, NULL); + } - v18_free(tdd_state); + switch_core_codec_destroy(&write_codec); + switch_core_session_set_read_codec(session, NULL); - return SWITCH_STATUS_SUCCESS; + v18_free(tdd_state); + + return SWITCH_STATUS_SUCCESS; } @@ -254,12 +254,12 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const pvt->session = session; pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL); - pvt->head_lead = TDD_LEAD; + pvt->head_lead = TDD_LEAD; v18_put(pvt->tdd_state, text, -1); if ((status = switch_core_media_bug_add(session, "spandsp_tdd_encode", NULL, - tdd_encode_callback, pvt, 0, SMBF_WRITE_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { + tdd_encode_callback, pvt, 0, SMBF_WRITE_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { v18_free(pvt->tdd_state); return status; } @@ -290,7 +290,7 @@ static switch_bool_t tdd_decode_callback(switch_media_bug_t *bug, void *user_dat case SWITCH_ABC_TYPE_READ_REPLACE: if ((frame = switch_core_media_bug_get_read_replace_frame(bug))) { - v18_rx(pvt->tdd_state, frame->data, frame->samples); + v18_rx(pvt->tdd_state, frame->data, frame->samples); switch_core_media_bug_set_read_replace_frame(bug, frame); } @@ -334,7 +334,7 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session) pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), put_text_msg, pvt); if ((status = switch_core_media_bug_add(session, "spandsp_tdd_decode", NULL, - tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { + tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { v18_free(pvt->tdd_state); return status; } @@ -505,7 +505,7 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session) } if ((status = switch_core_media_bug_add(session, "spandsp_dtmf_detect", NULL, - inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { + inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { return status; } @@ -584,9 +584,9 @@ int tone_descriptor_add_tone(tone_descriptor_t *descriptor, const char *key) } switch_set_string(descriptor->tone_keys[id], key); - if (id > descriptor->idx) { - descriptor->idx = id; - } + if (id > descriptor->idx) { + descriptor->idx = id; + } return id; } @@ -742,7 +742,7 @@ switch_status_t callprogress_detector_start(switch_core_session_t *session, cons /* start listening for tones */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Starting tone detection for '%s'\n", switch_channel_get_name(channel), name); switch_core_media_bug_add(session, "spandsp_tone_detect", NULL, - callprogress_detector_process_buffer, detector, 0 /* stop time */, SMBF_READ_REPLACE, &bug); + callprogress_detector_process_buffer, detector, 0 /* stop time */, SMBF_READ_REPLACE, &bug); if (!bug) { return SWITCH_STATUS_FALSE; } @@ -772,9 +772,7 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu break; case SWITCH_ABC_TYPE_READ_REPLACE: { - switch_frame_t *frame; - - + switch_frame_t *frame; const char *detected_tone = NULL; if (!detector->spandsp_detector) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) detector is destroyed\n", switch_channel_get_name(channel)); @@ -802,8 +800,8 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu tone_detector_destroy(detector); } break; - default: - break; + default: + break; } return SWITCH_TRUE; } @@ -838,7 +836,7 @@ switch_status_t mod_spandsp_dsp_load(switch_loadable_module_interface_t **module */ void mod_spandsp_dsp_shutdown(void) { - return; + return; } diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 975aca1fc8..c79043a846 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -59,14 +59,14 @@ typedef enum { T38_MODE, AUDIO_MODE, - T38_GATEWAY_MODE + T38_GATEWAY_MODE } transport_mode_t; typedef enum { - T38_MODE_UNKNOWN = 0, - T38_MODE_NEGOTIATED = 1, - T38_MODE_REQUESTED = 2, - T38_MODE_REFUSED = -1, + T38_MODE_UNKNOWN = 0, + T38_MODE_NEGOTIATED = 1, + T38_MODE_REQUESTED = 2, + T38_MODE_REFUSED = -1, } t38_mode_t; @@ -78,9 +78,9 @@ struct pvt_s { fax_state_t *fax_state; t38_terminal_state_t *t38_state; t38_gateway_state_t *t38_gateway_state; - t38_core_state_t *t38_core; + t38_core_state_t *t38_core; - udptl_state_t *udptl_state; + udptl_state_t *udptl_state; char *filename; char *ident; @@ -96,10 +96,10 @@ struct pvt_s { int tx_page_end; int done; - - t38_mode_t t38_mode; - struct pvt_s *next; + t38_mode_t t38_mode; + + struct pvt_s *next; }; typedef struct pvt_s pvt_t; @@ -107,10 +107,10 @@ typedef struct pvt_s pvt_t; static void launch_timer_thread(void); static struct { - pvt_t *head; - switch_mutex_t *mutex; - switch_thread_t *thread; - int thread_running; + pvt_t *head; + switch_mutex_t *mutex; + switch_thread_t *thread; + int thread_running; } t38_state_list; @@ -118,7 +118,7 @@ static struct { static void wake_thread(int force) { if (force) { - switch_thread_cond_signal(spandsp_globals.cond); + switch_thread_cond_signal(spandsp_globals.cond); return; } @@ -130,111 +130,111 @@ static void wake_thread(int force) static int add_pvt(pvt_t *pvt) { - int r = 0; - - if (t38_state_list.thread_running) { - switch_mutex_lock(t38_state_list.mutex); - pvt->next = t38_state_list.head; - t38_state_list.head = pvt; - switch_mutex_unlock(t38_state_list.mutex); - r = 1; - wake_thread(0); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error launching thread\n"); - } + int r = 0; - return r; + if (t38_state_list.thread_running) { + switch_mutex_lock(t38_state_list.mutex); + pvt->next = t38_state_list.head; + t38_state_list.head = pvt; + switch_mutex_unlock(t38_state_list.mutex); + r = 1; + wake_thread(0); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error launching thread\n"); + } + + return r; } static int del_pvt(pvt_t *del_pvt) { - pvt_t *p, *l = NULL; - int r = 0; + pvt_t *p, *l = NULL; + int r = 0; - switch_mutex_lock(t38_state_list.mutex); + switch_mutex_lock(t38_state_list.mutex); - for (p = t38_state_list.head; p; p = p->next) { - if (p == del_pvt) { - if (l) { - l->next = p->next; - } else { - t38_state_list.head = p->next; - } - p->next = NULL; - r = 1; - break; - } + for (p = t38_state_list.head; p; p = p->next) { + if (p == del_pvt) { + if (l) { + l->next = p->next; + } else { + t38_state_list.head = p->next; + } + p->next = NULL; + r = 1; + break; + } + + l = p; + } - l = p; - } + switch_mutex_unlock(t38_state_list.mutex); - switch_mutex_unlock(t38_state_list.mutex); + wake_thread(0); - wake_thread(0); - - return r; + return r; } static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void *obj) { - switch_timer_t timer = { 0 }; - pvt_t *pvt; - int samples = 160; - int ms = 20; + switch_timer_t timer = { 0 }; + pvt_t *pvt; + int samples = 160; + int ms = 20; - switch_mutex_lock(t38_state_list.mutex); - t38_state_list.thread_running = 1; - switch_mutex_unlock(t38_state_list.mutex); + switch_mutex_lock(t38_state_list.mutex); + t38_state_list.thread_running = 1; + switch_mutex_unlock(t38_state_list.mutex); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread started.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread started.\n"); if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); - goto end; - } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); + goto end; + } - switch_mutex_lock(spandsp_globals.cond_mutex); + switch_mutex_lock(spandsp_globals.cond_mutex); - while(t38_state_list.thread_running) { + while(t38_state_list.thread_running) { - switch_mutex_lock(t38_state_list.mutex); + switch_mutex_lock(t38_state_list.mutex); - if (!t38_state_list.head) { - switch_mutex_unlock(t38_state_list.mutex); + if (!t38_state_list.head) { + switch_mutex_unlock(t38_state_list.mutex); switch_thread_cond_wait(spandsp_globals.cond, spandsp_globals.cond_mutex); - switch_core_timer_sync(&timer); - continue; - } + switch_core_timer_sync(&timer); + continue; + } - for (pvt = t38_state_list.head; pvt; pvt = pvt->next) { - if (pvt->udptl_state && pvt->session && switch_channel_ready(switch_core_session_get_channel(pvt->session))) { - t38_terminal_send_timeout(pvt->t38_state, samples); - } - } + for (pvt = t38_state_list.head; pvt; pvt = pvt->next) { + if (pvt->udptl_state && pvt->session && switch_channel_ready(switch_core_session_get_channel(pvt->session))) { + t38_terminal_send_timeout(pvt->t38_state, samples); + } + } - switch_mutex_unlock(t38_state_list.mutex); + switch_mutex_unlock(t38_state_list.mutex); - switch_core_timer_next(&timer); - } + switch_core_timer_next(&timer); + } + + switch_mutex_unlock(spandsp_globals.cond_mutex); - switch_mutex_unlock(spandsp_globals.cond_mutex); - end: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread ended.\n"); - - switch_mutex_lock(t38_state_list.mutex); - t38_state_list.thread_running = 0; - switch_mutex_unlock(t38_state_list.mutex); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread ended.\n"); - if (timer.timer_interface) { - switch_core_timer_destroy(&timer); - } - - return NULL; + switch_mutex_lock(t38_state_list.mutex); + t38_state_list.thread_running = 0; + switch_mutex_unlock(t38_state_list.mutex); + + if (timer.timer_interface) { + switch_core_timer_destroy(&timer); + } + + return NULL; } static void launch_timer_thread(void) @@ -472,8 +472,8 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result) char *fax_transfer_rate = NULL; char *fax_result_code = NULL; switch_event_t *event; - const char *var; - char *expanded; + const char *var; + char *expanded; pvt = (pvt_t *) user_data; switch_assert(pvt); @@ -590,80 +590,79 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result) switch_event_fire(&event); } - if ((var = switch_channel_get_variable(channel, "system_on_fax_result"))) { - expanded = switch_channel_expand_variables(channel, var); - switch_system(expanded, SWITCH_FALSE); - if (expanded != var) { - free(expanded); - } - } + if ((var = switch_channel_get_variable(channel, "system_on_fax_result"))) { + expanded = switch_channel_expand_variables(channel, var); + switch_system(expanded, SWITCH_FALSE); + if (expanded != var) { + free(expanded); + } + } - switch_channel_execute_on(channel, "execute_on_fax_result"); + switch_channel_execute_on(channel, "execute_on_fax_result"); - if (result == T30_ERR_OK) { - if ((var = switch_channel_get_variable(channel, "system_on_fax_success"))) { - expanded = switch_channel_expand_variables(channel, var); - switch_system(expanded, SWITCH_FALSE); - if (expanded != var) { - free(expanded); - } - } - switch_channel_execute_on(channel, "execute_on_fax_success"); - } else { - if ((var = switch_channel_get_variable(channel, "system_on_fax_failure"))) { - expanded = switch_channel_expand_variables(channel, var); - switch_system(expanded, SWITCH_FALSE); - if (expanded != var) { - free(expanded); - } - } - switch_channel_execute_on(channel, "execute_on_fax_failure"); - } - + if (result == T30_ERR_OK) { + if ((var = switch_channel_get_variable(channel, "system_on_fax_success"))) { + expanded = switch_channel_expand_variables(channel, var); + switch_system(expanded, SWITCH_FALSE); + if (expanded != var) { + free(expanded); + } + } + switch_channel_execute_on(channel, "execute_on_fax_success"); + } else { + if ((var = switch_channel_get_variable(channel, "system_on_fax_failure"))) { + expanded = switch_channel_expand_variables(channel, var); + switch_system(expanded, SWITCH_FALSE); + if (expanded != var) { + free(expanded); + } + } + switch_channel_execute_on(channel, "execute_on_fax_failure"); + } } static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) { - switch_frame_t out_frame = { 0 }; - switch_core_session_t *session; - pvt_t *pvt; - uint8_t pkt[LOCAL_FAX_MAX_DATAGRAM]; - int x; - int r = 0; + switch_frame_t out_frame = { 0 }; + switch_core_session_t *session; + pvt_t *pvt; + uint8_t pkt[LOCAL_FAX_MAX_DATAGRAM]; + int x; + int r = 0; - pvt = (pvt_t *) user_data; - session = pvt->session; + pvt = (pvt_t *) user_data; + session = pvt->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; - out_frame.packet = pkt; - 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); + /* 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; + 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) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID WRITE: %d:%d\n", out_frame.packetlen, count); - r = -1; - break; - } - } - } 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; + 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; + } + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID PACKETLEN: %d PASSED: %d:%d\n", r, len, count); + } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TERMINATING T30 STATE\n"); + 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); + } - if (pvt->t38_state && (t30 = t38_terminal_get_t30_state(pvt->t38_state))) { - t30_terminate(t30); - } - switch_yield(10000); - } - - return r < 0 ? r : 0; + return r < 0 ? r : 0; } static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) @@ -722,130 +721,130 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } break; case T38_MODE: - { - switch_core_session_message_t msg = { 0 }; + { + switch_core_session_message_t msg = { 0 }; - if (pvt->t38_state == NULL) { - pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); - } - if (pvt->t38_state == NULL) { - return SWITCH_STATUS_FALSE; - } - if (pvt->udptl_state == NULL) { - pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); - } - if (pvt->udptl_state == NULL) { - t38_terminal_free(pvt->t38_state); - pvt->t38_state = NULL; - return SWITCH_STATUS_FALSE; - } + if (pvt->t38_state == NULL) { + pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); + } + if (pvt->t38_state == NULL) { + return SWITCH_STATUS_FALSE; + } + if (pvt->udptl_state == NULL) { + pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); + } + if (pvt->udptl_state == NULL) { + t38_terminal_free(pvt->t38_state); + pvt->t38_state = NULL; + return SWITCH_STATUS_FALSE; + } - t38 = pvt->t38_state; - t30 = t38_terminal_get_t30_state(t38); + t38 = pvt->t38_state; + t30 = t38_terminal_get_t30_state(t38); - memset(t38, 0, sizeof(t38_terminal_state_t)); + memset(t38, 0, sizeof(t38_terminal_state_t)); - if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); - return SWITCH_STATUS_FALSE; - } + if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); + return SWITCH_STATUS_FALSE; + } - pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); + pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, - (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); - return SWITCH_STATUS_FALSE; - } + if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, + (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); + return SWITCH_STATUS_FALSE; + } - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; - switch_core_session_receive_message(pvt->session, &msg); - - /* add to timer thread processing */ - if (!add_pvt(pvt)) { - if (channel) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - } - } - - span_log_set_message_handler(&t38->logging, spanfax_log_message, NULL); - span_log_set_message_handler(&t30->logging, spanfax_log_message, NULL); + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; + switch_core_session_receive_message(pvt->session, &msg); - if (pvt->verbose) { - span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - } - } - break; - case T38_GATEWAY_MODE: - if (pvt->t38_gateway_state == NULL) { - pvt->t38_gateway_state = (t38_gateway_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_gateway_state_t)); - } + /* add to timer thread processing */ + if (!add_pvt(pvt)) { + if (channel) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + } - if (pvt->udptl_state == NULL) { - pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); - } + span_log_set_message_handler(&t38->logging, spanfax_log_message, NULL); + span_log_set_message_handler(&t30->logging, spanfax_log_message, NULL); - if (t38_gateway_init(pvt->t38_gateway_state, t38_tx_packet_handler, pvt) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); - t38_gateway_free(pvt->t38_gateway_state); - pvt->t38_gateway_state = NULL; - - return SWITCH_STATUS_FALSE; - } + if (pvt->verbose) { + span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + } + } + break; + case T38_GATEWAY_MODE: + if (pvt->t38_gateway_state == NULL) { + pvt->t38_gateway_state = (t38_gateway_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_gateway_state_t)); + } - pvt->t38_core = t38_gateway_get_t38_core_state(pvt->t38_gateway_state); + if (pvt->udptl_state == NULL) { + pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); + } - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, - (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); - t38_gateway_free(pvt->t38_gateway_state); - udptl_release(pvt->udptl_state); - pvt->udptl_state = NULL; - return SWITCH_STATUS_FALSE; - } + if (t38_gateway_init(pvt->t38_gateway_state, t38_tx_packet_handler, pvt) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); + t38_gateway_free(pvt->t38_gateway_state); + pvt->t38_gateway_state = NULL; + + return SWITCH_STATUS_FALSE; + } - t38_gateway_set_transmit_on_idle(pvt->t38_gateway_state, TRUE); + pvt->t38_core = t38_gateway_get_t38_core_state(pvt->t38_gateway_state); - if (switch_true(switch_channel_get_variable(channel, "fax_v17_disabled"))) { - t38_gateway_set_supported_modems(pvt->t38_gateway_state, T30_SUPPORT_V29 | T30_SUPPORT_V27TER); - } else { - t38_gateway_set_supported_modems(pvt->t38_gateway_state, T30_SUPPORT_V17 | T30_SUPPORT_V29 | T30_SUPPORT_V27TER); - } + if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, + (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); + t38_gateway_free(pvt->t38_gateway_state); + udptl_release(pvt->udptl_state); + pvt->udptl_state = NULL; + return SWITCH_STATUS_FALSE; + } - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, pvt->use_ecm); - switch_channel_set_variable(channel, "fax_ecm_requested", pvt->use_ecm ? "true" : "false"); - - if (switch_true(switch_channel_get_variable(channel, "FAX_DISABLE_ECM"))) { - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, FALSE); - } else { - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, TRUE); - } - + t38_gateway_set_transmit_on_idle(pvt->t38_gateway_state, TRUE); - span_log_set_message_handler(&pvt->t38_gateway_state->logging, spanfax_log_message, NULL); - span_log_set_message_handler(&pvt->t38_core->logging, spanfax_log_message, NULL); + if (switch_true(switch_channel_get_variable(channel, "fax_v17_disabled"))) { + t38_gateway_set_supported_modems(pvt->t38_gateway_state, T30_SUPPORT_V29 | T30_SUPPORT_V27TER); + } else { + t38_gateway_set_supported_modems(pvt->t38_gateway_state, T30_SUPPORT_V17 | T30_SUPPORT_V29 | T30_SUPPORT_V27TER); + } - if (pvt->verbose) { - span_log_set_level(&pvt->t38_gateway_state->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_level(&pvt->t38_core->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - } + t38_gateway_set_ecm_capability(pvt->t38_gateway_state, pvt->use_ecm); + switch_channel_set_variable(channel, "fax_ecm_requested", pvt->use_ecm ? "true" : "false"); - t38_set_t38_version(pvt->t38_core, 0); - t38_gateway_set_ecm_capability(pvt->t38_gateway_state, 1); + if (switch_true(switch_channel_get_variable(channel, "FAX_DISABLE_ECM"))) { + t38_gateway_set_ecm_capability(pvt->t38_gateway_state, FALSE); + } else { + t38_gateway_set_ecm_capability(pvt->t38_gateway_state, TRUE); + } - return SWITCH_STATUS_SUCCESS; + + span_log_set_message_handler(&pvt->t38_gateway_state->logging, spanfax_log_message, NULL); + span_log_set_message_handler(&pvt->t38_core->logging, spanfax_log_message, NULL); + + if (pvt->verbose) { + span_log_set_level(&pvt->t38_gateway_state->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_level(&pvt->t38_core->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + } + + t38_set_t38_version(pvt->t38_core, 0); + t38_gateway_set_ecm_capability(pvt->t38_gateway_state, 1); + + return SWITCH_STATUS_SUCCESS; default: assert(0); /* What? */ return SWITCH_STATUS_SUCCESS; } /* Switch trans mode */ - + /* All the things which are common to audio and T.38 FAX setup */ t30_set_tx_ident(t30, pvt->ident); t30_set_tx_page_header_info(t30, pvt->header); - if (pvt->timezone && pvt->timezone[0]) + if (pvt->timezone && pvt->timezone[0]) t30_set_tx_page_header_tz(t30, pvt->timezone); t30_set_phase_e_handler(t30, phase_e_handler, pvt); @@ -891,7 +890,7 @@ static switch_status_t spanfax_destroy(pvt_t *pvt) int terminate; t30_state_t *t30; - if (!pvt) return SWITCH_STATUS_FALSE; + if (!pvt) return SWITCH_STATUS_FALSE; if (pvt->fax_state) { if (pvt->t38_state) { @@ -910,8 +909,8 @@ static switch_status_t spanfax_destroy(pvt_t *pvt) if (pvt->t38_state) { - /* remove from timer thread processing */ - del_pvt(pvt); + /* remove from timer thread processing */ + del_pvt(pvt); if (pvt->t38_state) { terminate = 1; @@ -928,135 +927,135 @@ static switch_status_t spanfax_destroy(pvt_t *pvt) t38_terminal_release(pvt->t38_state); } - if (pvt->t38_gateway_state) { - t38_gateway_release(pvt->t38_gateway_state); - } + if (pvt->t38_gateway_state) { + t38_gateway_release(pvt->t38_gateway_state); + } if (pvt->udptl_state) { udptl_release(pvt->udptl_state); - } + } return SWITCH_STATUS_SUCCESS; } static t38_mode_t configure_t38(pvt_t *pvt) { - switch_core_session_t *session = pvt->session; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_t38_options_t *t38_options = switch_channel_get_private(channel, "t38_options"); - int method = 2; + switch_core_session_t *session = pvt->session; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_t38_options_t *t38_options = switch_channel_get_private(channel, "t38_options"); + int method = 2; - if (!t38_options || !pvt || !pvt->t38_core) { - pvt->t38_mode = T38_MODE_REFUSED; - return pvt->t38_mode; - } + if (!t38_options || !pvt || !pvt->t38_core) { + pvt->t38_mode = T38_MODE_REFUSED; + return pvt->t38_mode; + } - t38_set_t38_version(pvt->t38_core, t38_options->T38FaxVersion); - t38_set_max_buffer_size(pvt->t38_core, t38_options->T38FaxMaxBuffer); - t38_set_fastest_image_data_rate(pvt->t38_core, t38_options->T38MaxBitRate); - t38_set_fill_bit_removal(pvt->t38_core, t38_options->T38FaxFillBitRemoval); - t38_set_mmr_transcoding(pvt->t38_core, t38_options->T38FaxTranscodingMMR); - t38_set_jbig_transcoding(pvt->t38_core, t38_options->T38FaxTranscodingJBIG); - t38_set_max_datagram_size(pvt->t38_core, t38_options->T38FaxMaxDatagram); + t38_set_t38_version(pvt->t38_core, t38_options->T38FaxVersion); + t38_set_max_buffer_size(pvt->t38_core, t38_options->T38FaxMaxBuffer); + t38_set_fastest_image_data_rate(pvt->t38_core, t38_options->T38MaxBitRate); + t38_set_fill_bit_removal(pvt->t38_core, t38_options->T38FaxFillBitRemoval); + t38_set_mmr_transcoding(pvt->t38_core, t38_options->T38FaxTranscodingMMR); + t38_set_jbig_transcoding(pvt->t38_core, t38_options->T38FaxTranscodingJBIG); + t38_set_max_datagram_size(pvt->t38_core, t38_options->T38FaxMaxDatagram); - if (t38_options->T38FaxRateManagement) { - if (!strcasecmp(t38_options->T38FaxRateManagement, "transferredTCF")) { - method = 2; - } else { - method = 1; - } - } + if (t38_options->T38FaxRateManagement) { + if (!strcasecmp(t38_options->T38FaxRateManagement, "transferredTCF")) { + method = 2; + } else { + method = 1; + } + } - t38_set_data_rate_management_method(pvt->t38_core, method); + t38_set_data_rate_management_method(pvt->t38_core, method); - //t38_set_data_transport_protocol(pvt->t38_core, int data_transport_protocol); - //t38_set_redundancy_control(pvt->t38_core, int category, int setting); + //t38_set_data_transport_protocol(pvt->t38_core, int data_transport_protocol); + //t38_set_redundancy_control(pvt->t38_core, int category, int setting); - return pvt->t38_mode; + return pvt->t38_mode; } static t38_mode_t negotiate_t38(pvt_t *pvt) { - switch_core_session_t *session = pvt->session; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_core_session_message_t msg = { 0 }; - switch_t38_options_t *t38_options = switch_channel_get_private(channel, "t38_options"); - int enabled = 0, insist = 0; - const char *v; + switch_core_session_t *session = pvt->session; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_core_session_message_t msg = { 0 }; + switch_t38_options_t *t38_options = switch_channel_get_private(channel, "t38_options"); + int enabled = 0, insist = 0; + const char *v; - pvt->t38_mode = T38_MODE_REFUSED; + pvt->t38_mode = T38_MODE_REFUSED; - if (pvt->app_mode == FUNCTION_GW) { - enabled = 1; - } else if ((v = switch_channel_get_variable(channel, "fax_enable_t38"))) { - enabled = switch_true(v); - } else { - enabled = spandsp_globals.enable_t38; - } + if (pvt->app_mode == FUNCTION_GW) { + enabled = 1; + } else if ((v = switch_channel_get_variable(channel, "fax_enable_t38"))) { + enabled = switch_true(v); + } else { + enabled = spandsp_globals.enable_t38; + } - if (!(enabled && t38_options)) { - /* if there is no t38_options the endpoint will refuse the transition */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s NO T38 options detected.\n", switch_channel_get_name(channel)); - switch_channel_set_private(channel, "t38_options", NULL); - } else { - pvt->t38_mode = T38_MODE_NEGOTIATED; - switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); + if (!(enabled && t38_options)) { + /* if there is no t38_options the endpoint will refuse the transition */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s NO T38 options detected.\n", switch_channel_get_name(channel)); + switch_channel_set_private(channel, "t38_options", NULL); + } else { + pvt->t38_mode = T38_MODE_NEGOTIATED; + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38 SDP Origin = %s\n", t38_options->sdp_o_line); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxVersion = %d\n", t38_options->T38FaxVersion); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38MaxBitRate = %d\n", t38_options->T38MaxBitRate); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxFillBitRemoval = %d\n", t38_options->T38FaxFillBitRemoval); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingMMR = %d\n", t38_options->T38FaxTranscodingMMR); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingJBIG = %d\n", t38_options->T38FaxTranscodingJBIG); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxRateManagement = '%s'\n", t38_options->T38FaxRateManagement); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxBuffer = %d\n", t38_options->T38FaxMaxBuffer); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxDatagram = %d\n", t38_options->T38FaxMaxDatagram); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxUdpEC = '%s'\n", t38_options->T38FaxUdpEC); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38VendorInfo = '%s'\n", switch_str_nil(t38_options->T38VendorInfo)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ip = '%s'\n", - t38_options->remote_ip ? t38_options->remote_ip : "Not specified"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "port = %d\n", t38_options->remote_port); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38 SDP Origin = %s\n", t38_options->sdp_o_line); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxVersion = %d\n", t38_options->T38FaxVersion); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38MaxBitRate = %d\n", t38_options->T38MaxBitRate); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxFillBitRemoval = %d\n", t38_options->T38FaxFillBitRemoval); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingMMR = %d\n", t38_options->T38FaxTranscodingMMR); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxTranscodingJBIG = %d\n", t38_options->T38FaxTranscodingJBIG); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxRateManagement = '%s'\n", t38_options->T38FaxRateManagement); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxBuffer = %d\n", t38_options->T38FaxMaxBuffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxMaxDatagram = %d\n", t38_options->T38FaxMaxDatagram); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38FaxUdpEC = '%s'\n", t38_options->T38FaxUdpEC); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "T38VendorInfo = '%s'\n", switch_str_nil(t38_options->T38VendorInfo)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ip = '%s'\n", + t38_options->remote_ip ? t38_options->remote_ip : "Not specified"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "port = %d\n", t38_options->remote_port); - /* Time to practice our negotiating skills, by editing the t38_options */ + /* Time to practice our negotiating skills, by editing the t38_options */ - if (t38_options->T38FaxVersion > 3) { - t38_options->T38FaxVersion = 3; - } - t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400; + if (t38_options->T38FaxVersion > 3) { + t38_options->T38FaxVersion = 3; + } + t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400; - /* cisco gets mad when we set this to one in a response where they set it to 0, are we allowed to hardcode this to 1 on responses? */ - /* - if (!zstr(t38_options->sdp_o_line) && !switch_stristr("cisco", t38_options->sdp_o_line)) { - t38_options->T38FaxFillBitRemoval = 1; - } - */ + /* cisco gets mad when we set this to one in a response where they set it to 0, are we allowed to hardcode this to 1 on responses? */ + /* + if (!zstr(t38_options->sdp_o_line) && !switch_stristr("cisco", t38_options->sdp_o_line)) { + t38_options->T38FaxFillBitRemoval = 1; + } + */ - t38_options->T38FaxTranscodingMMR = 0; - t38_options->T38FaxTranscodingJBIG = 0; - t38_options->T38FaxRateManagement = "transferredTCF"; - t38_options->T38FaxMaxBuffer = 2000; - t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; - if (!zstr(t38_options->T38FaxUdpEC) && - (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 || - strcasecmp(t38_options->T38FaxUdpEC, "t38UDPFEC") == 0)) { - t38_options->T38FaxUdpEC = "t38UDPRedundancy"; - } else { - t38_options->T38FaxUdpEC = NULL; - } - t38_options->T38VendorInfo = "0 0 0"; - } + t38_options->T38FaxTranscodingMMR = 0; + t38_options->T38FaxTranscodingJBIG = 0; + t38_options->T38FaxRateManagement = "transferredTCF"; + t38_options->T38FaxMaxBuffer = 2000; + t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; + if (!zstr(t38_options->T38FaxUdpEC) && + (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 || + strcasecmp(t38_options->T38FaxUdpEC, "t38UDPFEC") == 0)) { + t38_options->T38FaxUdpEC = "t38UDPRedundancy"; + } else { + t38_options->T38FaxUdpEC = NULL; + } + t38_options->T38VendorInfo = "0 0 0"; + } - if ((v = switch_channel_get_variable(channel, "fax_enable_t38_insist"))) { - insist = switch_true(v); - } else { - insist = spandsp_globals.enable_t38_insist; - } + if ((v = switch_channel_get_variable(channel, "fax_enable_t38_insist"))) { + insist = switch_true(v); + } else { + insist = spandsp_globals.enable_t38_insist; + } - /* This will send the options back in a response */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION; - msg.numeric_arg = insist; - switch_core_session_receive_message(session, &msg); + /* This will send the options back in a response */ + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION; + msg.numeric_arg = insist; + switch_core_session_receive_message(session, &msg); return pvt->t38_mode; } @@ -1065,68 +1064,68 @@ static t38_mode_t negotiate_t38(pvt_t *pvt) static t38_mode_t request_t38(pvt_t *pvt) { - switch_core_session_t *session = pvt->session; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_core_session_message_t msg = { 0 }; - switch_t38_options_t *t38_options = NULL; - int enabled = 0, insist = 0; - const char *v; + switch_core_session_t *session = pvt->session; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_core_session_message_t msg = { 0 }; + switch_t38_options_t *t38_options = NULL; + int enabled = 0, insist = 0; + const char *v; - pvt->t38_mode = T38_MODE_UNKNOWN; + pvt->t38_mode = T38_MODE_UNKNOWN; - if (pvt->app_mode == FUNCTION_GW) { - enabled = 1; - } else if ((v = switch_channel_get_variable(channel, "fax_enable_t38"))) { - enabled = switch_true(v); - } else { - enabled = spandsp_globals.enable_t38; - } + if (pvt->app_mode == FUNCTION_GW) { + enabled = 1; + } else if ((v = switch_channel_get_variable(channel, "fax_enable_t38"))) { + enabled = switch_true(v); + } else { + enabled = spandsp_globals.enable_t38; + } - if (enabled) { - if ((v = switch_channel_get_variable(channel, "fax_enable_t38_request"))) { - enabled = switch_true(v); - } else { - enabled = spandsp_globals.enable_t38_request; - } - } + if (enabled) { + if ((v = switch_channel_get_variable(channel, "fax_enable_t38_request"))) { + enabled = switch_true(v); + } else { + enabled = spandsp_globals.enable_t38_request; + } + } - if ((v = switch_channel_get_variable(channel, "fax_enable_t38_insist"))) { - insist = switch_true(v); - } else { - insist = spandsp_globals.enable_t38_insist; - } + if ((v = switch_channel_get_variable(channel, "fax_enable_t38_insist"))) { + insist = switch_true(v); + } else { + insist = spandsp_globals.enable_t38_insist; + } - if ((t38_options = switch_channel_get_private(channel, "t38_options"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "%s already has T.38 data\n", switch_channel_get_name(channel)); - enabled = 0; - } + if ((t38_options = switch_channel_get_private(channel, "t38_options"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "%s already has T.38 data\n", switch_channel_get_name(channel)); + enabled = 0; + } - if (enabled) { - t38_options = switch_core_session_alloc(session, sizeof(*t38_options)); - - t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400; - t38_options->T38FaxVersion = 0; - t38_options->T38FaxFillBitRemoval = 1; - t38_options->T38FaxTranscodingMMR = 0; - t38_options->T38FaxTranscodingJBIG = 0; - t38_options->T38FaxRateManagement = "transferredTCF"; - t38_options->T38FaxMaxBuffer = 2000; - t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; - t38_options->T38FaxUdpEC = "t38UDPRedundancy"; - t38_options->T38VendorInfo = "0 0 0"; - - switch_channel_set_private(channel, "t38_options", t38_options); - pvt->t38_mode = T38_MODE_REQUESTED; - switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_REQ); + if (enabled) { + t38_options = switch_core_session_alloc(session, sizeof(*t38_options)); - /* This will send a request for t.38 mode */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA; - msg.numeric_arg = insist; - switch_core_session_receive_message(session, &msg); - } + t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400; + t38_options->T38FaxVersion = 0; + t38_options->T38FaxFillBitRemoval = 1; + t38_options->T38FaxTranscodingMMR = 0; + t38_options->T38FaxTranscodingJBIG = 0; + t38_options->T38FaxRateManagement = "transferredTCF"; + t38_options->T38FaxMaxBuffer = 2000; + t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; + t38_options->T38FaxUdpEC = "t38UDPRedundancy"; + t38_options->T38VendorInfo = "0 0 0"; + + switch_channel_set_private(channel, "t38_options", t38_options); + pvt->t38_mode = T38_MODE_REQUESTED; + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_REQ); + + /* This will send a request for t.38 mode */ + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA; + msg.numeric_arg = insist; + switch_core_session_receive_message(session, &msg); + } return pvt->t38_mode; } @@ -1137,9 +1136,9 @@ static t38_mode_t request_t38(pvt_t *pvt) static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_application_mode_t app_mode) { - switch_channel_t *channel; - pvt_t *pvt = NULL; - const char *tmp; + switch_channel_t *channel; + pvt_t *pvt = NULL; + const char *tmp; /* Make sure we have a valid channel when starting the FAX application */ channel = switch_core_session_get_channel(session); @@ -1151,25 +1150,25 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati /* Allocate our structs */ pvt = switch_core_session_alloc(session, sizeof(pvt_t)); - pvt->session = session; + pvt->session = session; - pvt->app_mode = app_mode; + pvt->app_mode = app_mode; - pvt->tx_page_start = -1; - pvt->tx_page_end = -1; + pvt->tx_page_start = -1; + pvt->tx_page_end = -1; - switch(pvt->app_mode) { + switch(pvt->app_mode) { - case FUNCTION_TX: - pvt->caller = 1; - break; - case FUNCTION_RX: - pvt->caller = 0; - break; - case FUNCTION_GW: - break; - } + case FUNCTION_TX: + pvt->caller = 1; + break; + case FUNCTION_RX: + pvt->caller = 0; + break; + case FUNCTION_GW: + break; + } /* Retrieving our settings from the channel variables */ @@ -1200,37 +1199,37 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati } if ((tmp = switch_channel_get_variable(channel, "fax_ident"))) { - char *data = NULL; + char *data = NULL; - data = strdup(tmp); - switch_url_decode(data); + data = strdup(tmp); + switch_url_decode(data); pvt->ident = switch_core_session_strdup(session, data); - switch_safe_free(data); + switch_safe_free(data); } else { pvt->ident = switch_core_session_strdup(session, spandsp_globals.ident); } if ((tmp = switch_channel_get_variable(channel, "fax_header"))) { - char *data = NULL; + char *data = NULL; - data = strdup(tmp); - switch_url_decode(data); - pvt->header = switch_core_session_strdup(session, data); + data = strdup(tmp); + switch_url_decode(data); + pvt->header = switch_core_session_strdup(session, data); - switch_safe_free(data); + switch_safe_free(data); } else { pvt->header = switch_core_session_strdup(session, spandsp_globals.header); } if ((tmp = switch_channel_get_variable(channel, "fax_timezone"))) { - char *data = NULL; + char *data = NULL; - data = strdup(tmp); - switch_url_decode(data); - pvt->timezone = switch_core_session_strdup(session, data); + data = strdup(tmp); + switch_url_decode(data); + pvt->timezone = switch_core_session_strdup(session, data); - switch_safe_free(data); + switch_safe_free(data); } else { pvt->timezone = switch_core_session_strdup(session, spandsp_globals.timezone); } @@ -1255,9 +1254,9 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati if ((pvt->tx_page_end < pvt->tx_page_start) && (pvt->tx_page_end != -1)) { pvt->tx_page_end = pvt->tx_page_start; } - } + } - return pvt; + return pvt; } void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *data, mod_spandsp_fax_application_mode_t app_mode) @@ -1270,15 +1269,15 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_frame_t write_frame = { 0 }; switch_codec_implementation_t read_impl = { 0 }; int16_t *buf = NULL; - uint32_t req_counter = 0; + uint32_t req_counter = 0; switch_core_session_get_read_impl(session, &read_impl); counter_increment(); - - pvt = pvt_init(session, app_mode); - + + pvt = pvt_init(session, app_mode); + buf = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); @@ -1327,7 +1326,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat return; } - /* + /* Note: Disable echocan on the channel, remember to call app "disable_ec" in the dialplan before invoking fax applications */ @@ -1381,11 +1380,11 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_ivr_sleep(session, 250, SWITCH_TRUE, NULL); - if (pvt->app_mode == FUNCTION_TX) { - req_counter = 100; - } else { - req_counter = 50; - } + if (pvt->app_mode == FUNCTION_TX) { + req_counter = 100; + } else { + req_counter = 50; + } while (switch_channel_ready(channel)) { int tx = 0; @@ -1400,7 +1399,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat - call t38_terminal_send_timeout(), sleep for a while The T.38 stuff can be placed here (and the audio stuff can be skipped) - */ + */ /* read new audio frame from the channel */ status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); @@ -1410,72 +1409,72 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat goto done; } - switch (pvt->t38_mode) { - case T38_MODE_REQUESTED: - { - if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38_FAIL)) { - pvt->t38_mode = T38_MODE_REFUSED; - continue; - } else if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - switch_core_session_message_t msg = { 0 }; - pvt->t38_mode = T38_MODE_NEGOTIATED; - switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); - spanfax_init(pvt, T38_MODE); - configure_t38(pvt); - - /* This will change the rtp stack to udptl mode */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; - switch_core_session_receive_message(session, &msg); - } - continue; - } - break; - case T38_MODE_UNKNOWN: - { - if (req_counter) { - if (!--req_counter) { - /* If you have the means, I highly recommend picking one up. ...*/ - request_t38(pvt); - } - } - - if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - if (negotiate_t38(pvt) == T38_MODE_NEGOTIATED) { - /* is is safe to call this again, it was already called above in AUDIO_MODE */ - /* but this is the only way to set up the t38 stuff */ - spanfax_init(pvt, T38_MODE); - continue; - } - } - } - break; - case T38_MODE_NEGOTIATED: - { - /* do what we need to do when we are in t38 mode */ - if (switch_test_flag(read_frame, SFF_CNG)) { - /* dunno what to do, most likely you will not get too many of these since we turn off the timer in udptl mode */ - continue; - } - - if (switch_test_flag(read_frame, SFF_UDPTL_PACKET)) { - /* now we know we can cast frame->packet to a udptl structure */ - //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "READ %d udptl bytes\n", read_frame->packetlen); - - udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); - } - } - continue; - default: - break; - } + switch (pvt->t38_mode) { + case T38_MODE_REQUESTED: + { + if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38_FAIL)) { + pvt->t38_mode = T38_MODE_REFUSED; + continue; + } else if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { + switch_core_session_message_t msg = { 0 }; + pvt->t38_mode = T38_MODE_NEGOTIATED; + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); + spanfax_init(pvt, T38_MODE); + configure_t38(pvt); + + /* This will change the rtp stack to udptl mode */ + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; + switch_core_session_receive_message(session, &msg); + } + continue; + } + break; + case T38_MODE_UNKNOWN: + { + if (req_counter) { + if (!--req_counter) { + /* If you have the means, I highly recommend picking one up. ...*/ + request_t38(pvt); + } + } + + if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { + if (negotiate_t38(pvt) == T38_MODE_NEGOTIATED) { + /* is is safe to call this again, it was already called above in AUDIO_MODE */ + /* but this is the only way to set up the t38 stuff */ + spanfax_init(pvt, T38_MODE); + continue; + } + } + } + break; + case T38_MODE_NEGOTIATED: + { + /* do what we need to do when we are in t38 mode */ + if (switch_test_flag(read_frame, SFF_CNG)) { + /* dunno what to do, most likely you will not get too many of these since we turn off the timer in udptl mode */ + continue; + } + + if (switch_test_flag(read_frame, SFF_UDPTL_PACKET)) { + /* now we know we can cast frame->packet to a udptl structure */ + //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "READ %d udptl bytes\n", read_frame->packetlen); + + udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); + } + } + continue; + default: + break; + } if (switch_test_flag(read_frame, SFF_CNG)) { /* We have no real signal data for the FAX software, but we have a space in time if we have a CNG indication. Do a fill-in operation in the FAX machine, to keep things rolling along. */ if (fax_rx_fillin(pvt->fax_state, read_impl.samples_per_packet)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx_fillin reported an error\n"); - continue; + continue; } } else { /* Pass the new incoming audio frame to the fax_rx function */ @@ -1524,30 +1523,30 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat void mod_spandsp_fax_load(switch_memory_pool_t *pool) { - uint32_t sanity = 200; + uint32_t sanity = 200; - memset(&t38_state_list, 0, sizeof(t38_state_list)); + memset(&t38_state_list, 0, sizeof(t38_state_list)); switch_mutex_init(&spandsp_globals.mutex, SWITCH_MUTEX_NESTED, spandsp_globals.pool); switch_mutex_init(&t38_state_list.mutex, SWITCH_MUTEX_NESTED, spandsp_globals.pool); switch_mutex_init(&spandsp_globals.cond_mutex, SWITCH_MUTEX_NESTED, spandsp_globals.pool); switch_thread_cond_create(&spandsp_globals.cond, spandsp_globals.pool); - - launch_timer_thread(); - while(--sanity && !t38_state_list.thread_running) { - switch_yield(20000); - } + launch_timer_thread(); + + while(--sanity && !t38_state_list.thread_running) { + switch_yield(20000); + } } void mod_spandsp_fax_shutdown(void) { - switch_status_t tstatus = SWITCH_STATUS_SUCCESS; + switch_status_t tstatus = SWITCH_STATUS_SUCCESS; - t38_state_list.thread_running = 0; - wake_thread(1); - switch_thread_join(&tstatus, t38_state_list.thread); + t38_state_list.thread_running = 0; + wake_thread(1); + switch_thread_join(&tstatus, t38_state_list.thread); memset(&spandsp_globals, 0, sizeof(spandsp_globals)); } @@ -1555,83 +1554,83 @@ static const switch_state_handler_table_t t38_gateway_state_handlers; static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *session) { - switch_core_session_t *other_session; + switch_core_session_t *other_session; - switch_channel_t *other_channel, *channel = switch_core_session_get_channel(session); - pvt_t *pvt; - const char *peer_uuid = switch_channel_get_variable(channel, "t38_peer"); - switch_core_session_message_t msg = { 0 }; - switch_status_t status; - switch_frame_t *read_frame = { 0 }; + switch_channel_t *other_channel, *channel = switch_core_session_get_channel(session); + pvt_t *pvt; + const char *peer_uuid = switch_channel_get_variable(channel, "t38_peer"); + switch_core_session_message_t msg = { 0 }; + switch_status_t status; + switch_frame_t *read_frame = { 0 }; - if (!(other_session = switch_core_session_locate(peer_uuid))) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot locate channel with uuid %s", - switch_channel_get_name(channel), peer_uuid); - goto end; - } + if (!(other_session = switch_core_session_locate(peer_uuid))) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot locate channel with uuid %s", + switch_channel_get_name(channel), peer_uuid); + goto end; + } - other_channel = switch_core_session_get_channel(other_session); + other_channel = switch_core_session_get_channel(other_session); - pvt = pvt_init(session, FUNCTION_GW); - request_t38(pvt); + pvt = pvt_init(session, FUNCTION_GW); + request_t38(pvt); - msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); + msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; + msg.from = __FILE__; + msg.string_arg = peer_uuid; + switch_core_session_receive_message(session, &msg); - while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { + while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status) || pvt->done) { /* Our duty is over */ - goto end_unlock; + goto end_unlock; } - if (switch_test_flag(read_frame, SFF_CNG)) { - continue; - } + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } - if (switch_core_session_write_frame(other_session, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - goto end_unlock; - } - } + if (switch_core_session_write_frame(other_session, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + goto end_unlock; + } + } if (!(switch_channel_ready(channel) && switch_channel_up(other_channel))) { - goto end_unlock; - } + goto end_unlock; + } - if (!switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel)); - goto end_unlock; - } + if (!switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel)); + goto end_unlock; + } - if (pvt->t38_mode == T38_MODE_REQUESTED) { - spanfax_init(pvt, T38_GATEWAY_MODE); - configure_t38(pvt); - pvt->t38_mode = T38_MODE_NEGOTIATED; - switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); - } else { - if (negotiate_t38(pvt) != T38_MODE_NEGOTIATED) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel)); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end_unlock; - } - switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); - spanfax_init(pvt, T38_GATEWAY_MODE); - } + if (pvt->t38_mode == T38_MODE_REQUESTED) { + spanfax_init(pvt, T38_GATEWAY_MODE); + configure_t38(pvt); + pvt->t38_mode = T38_MODE_NEGOTIATED; + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); + } else { + if (negotiate_t38(pvt) != T38_MODE_NEGOTIATED) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Could not negotiate T38\n", switch_channel_get_name(channel)); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + goto end_unlock; + } + switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_NEGOTIATED); + spanfax_init(pvt, T38_GATEWAY_MODE); + } - /* This will change the rtp stack to udptl mode */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; - switch_core_session_receive_message(session, &msg); + /* This will change the rtp stack to udptl mode */ + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; + switch_core_session_receive_message(session, &msg); - /* wake up the audio side */ - switch_channel_set_private(channel, "_t38_pvt", pvt); - switch_channel_set_app_flag_key("T38", other_channel, CF_APP_T38); + /* wake up the audio side */ + switch_channel_set_private(channel, "_t38_pvt", pvt); + switch_channel_set_app_flag_key("T38", other_channel, CF_APP_T38); while (switch_channel_ready(channel) && switch_channel_up(other_channel)) { @@ -1642,111 +1641,111 @@ static switch_status_t t38_gateway_on_soft_execute(switch_core_session_t *sessio /* Our duty is over */ goto end_unlock; } - - if (switch_test_flag(read_frame, SFF_CNG)) { - continue; - } - - if (switch_test_flag(read_frame, SFF_UDPTL_PACKET)) { - udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); - } - } + + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } + + if (switch_test_flag(read_frame, SFF_UDPTL_PACKET)) { + udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); + } + } end_unlock: - msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); + msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; + msg.from = __FILE__; + msg.string_arg = peer_uuid; + switch_core_session_receive_message(session, &msg); - switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(other_session); + switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(other_session); end: - switch_channel_clear_state_handler(channel, &t38_gateway_state_handlers); - switch_channel_set_variable(channel, "t38_peer", NULL); + switch_channel_clear_state_handler(channel, &t38_gateway_state_handlers); + switch_channel_set_variable(channel, "t38_peer", NULL); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - return SWITCH_STATUS_SUCCESS; + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + return SWITCH_STATUS_SUCCESS; } static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *session) { - switch_core_session_t *other_session; - switch_channel_t *other_channel, *channel = switch_core_session_get_channel(session); - const char *peer_uuid = switch_channel_get_variable(channel, "t38_peer"); - pvt_t *pvt = NULL; - switch_codec_t read_codec = { 0 }; + switch_core_session_t *other_session; + switch_channel_t *other_channel, *channel = switch_core_session_get_channel(session); + const char *peer_uuid = switch_channel_get_variable(channel, "t38_peer"); + pvt_t *pvt = NULL; + switch_codec_t read_codec = { 0 }; switch_codec_t write_codec = { 0 }; switch_frame_t *read_frame = { 0 }; switch_frame_t write_frame = { 0 }; switch_codec_implementation_t read_impl = { 0 }; int16_t *buf = NULL; - switch_status_t status; - int tx; - const char *t38_trace = switch_channel_get_variable(channel, "t38_trace"); - char *trace_read, *trace_write; - zap_socket_t read_fd = FAX_INVALID_SOCKET, write_fd = FAX_INVALID_SOCKET; - switch_core_session_message_t msg = { 0 }; - switch_event_t *event; + switch_status_t status; + int tx; + const char *t38_trace = switch_channel_get_variable(channel, "t38_trace"); + char *trace_read, *trace_write; + zap_socket_t read_fd = FAX_INVALID_SOCKET, write_fd = FAX_INVALID_SOCKET; + switch_core_session_message_t msg = { 0 }; + switch_event_t *event; switch_core_session_get_read_impl(session, &read_impl); - - buf = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); - if (!(other_session = switch_core_session_locate(peer_uuid))) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end; - } + buf = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); - other_channel = switch_core_session_get_channel(other_session); - - msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); + if (!(other_session = switch_core_session_locate(peer_uuid))) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + goto end; + } + + other_channel = switch_core_session_get_channel(other_session); + + msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; + msg.from = __FILE__; + msg.string_arg = peer_uuid; + switch_core_session_receive_message(session, &msg); if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid); switch_channel_event_set_data(channel, event); switch_event_fire(&event); } - while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { + while (switch_channel_ready(channel) && switch_channel_up(other_channel) && !switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - + if (!SWITCH_READ_ACCEPTABLE(status)) { /* Our duty is over */ goto end_unlock; } - if (switch_test_flag(read_frame, SFF_CNG)) { - continue; - } + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } - if (switch_core_session_write_frame(other_session, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - goto end_unlock; - } - } + if (switch_core_session_write_frame(other_session, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + goto end_unlock; + } + } if (!(switch_channel_ready(channel) && switch_channel_up(other_channel))) { - goto end_unlock; - } + goto end_unlock; + } - if (!switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end_unlock; - } - - if (!(pvt = switch_channel_get_private(other_channel, "_t38_pvt"))) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end_unlock; - } - - if (switch_core_codec_init(&read_codec, + if (!switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + goto end_unlock; + } + + if (!(pvt = switch_channel_get_private(other_channel, "_t38_pvt"))) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + goto end_unlock; + } + + if (switch_core_codec_init(&read_codec, "L16", NULL, read_impl.samples_per_second, @@ -1781,27 +1780,27 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi switch_ivr_sleep(session, 0, SWITCH_TRUE, NULL); - if (switch_true(t38_trace)) { - trace_read = switch_core_session_sprintf(session, "%s%s%s_read.raw", SWITCH_GLOBAL_dirs.temp_dir, - SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); + if (switch_true(t38_trace)) { + trace_read = switch_core_session_sprintf(session, "%s%s%s_read.raw", SWITCH_GLOBAL_dirs.temp_dir, + SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing inbound audio to %s\n", trace_read); - switch_channel_set_variable(channel, "t38_trace_read", trace_read); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing inbound audio to %s\n", trace_read); + switch_channel_set_variable(channel, "t38_trace_read", trace_read); - trace_write = switch_core_session_sprintf(session, "%s%s%s_write.raw", SWITCH_GLOBAL_dirs.temp_dir, - SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing outbound audio to %s\n", trace_write); - switch_channel_set_variable(channel, "t38_trace_read", trace_write); - + trace_write = switch_core_session_sprintf(session, "%s%s%s_write.raw", SWITCH_GLOBAL_dirs.temp_dir, + SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)); - if ((write_fd = open(trace_read, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) != FAX_INVALID_SOCKET) { - if ((read_fd = open(trace_write, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == FAX_INVALID_SOCKET) { - close(write_fd); - write_fd = FAX_INVALID_SOCKET; - } - } - } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Tracing outbound audio to %s\n", trace_write); + switch_channel_set_variable(channel, "t38_trace_read", trace_write); + + + if ((write_fd = open(trace_read, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) != FAX_INVALID_SOCKET) { + if ((read_fd = open(trace_write, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == FAX_INVALID_SOCKET) { + close(write_fd); + write_fd = FAX_INVALID_SOCKET; + } + } + } while (switch_channel_ready(channel) && switch_channel_up(other_channel)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); @@ -1811,16 +1810,16 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi goto end_unlock; } - if (switch_test_flag(read_frame, SFF_CNG)) { + if (switch_test_flag(read_frame, SFF_CNG)) { /* We have no real signal data for the FAX software, but we have a space in time if we have a CNG indication. Do a fill-in operation in the FAX machine, to keep things rolling along. */ - t38_gateway_rx_fillin(pvt->t38_gateway_state, read_impl.samples_per_packet); - } else { - if (read_fd != FAX_INVALID_SOCKET) { - switch_ssize_t rv; - do { rv = write(read_fd, read_frame->data, read_frame->datalen); } while (rv == -1 && errno == EINTR); - } - if (t38_gateway_rx(pvt->t38_gateway_state, (int16_t *) read_frame->data, read_frame->samples)) { + t38_gateway_rx_fillin(pvt->t38_gateway_state, read_impl.samples_per_packet); + } else { + if (read_fd != FAX_INVALID_SOCKET) { + switch_ssize_t rv; + do { rv = write(read_fd, read_frame->data, read_frame->datalen); } while (rv == -1 && errno == EINTR); + } + if (t38_gateway_rx(pvt->t38_gateway_state, (int16_t *) read_frame->data, read_frame->samples)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx reported an error\n"); goto end_unlock; } @@ -1840,22 +1839,22 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi write_frame.samples = tx; } - if (write_fd != FAX_INVALID_SOCKET) { - switch_ssize_t rv; - do { rv = write(write_fd, write_frame.data, write_frame.datalen); } while (rv == -1 && errno == EINTR); - } + if (write_fd != FAX_INVALID_SOCKET) { + switch_ssize_t rv; + do { rv = write(write_fd, write_frame.data, write_frame.datalen); } while (rv == -1 && errno == EINTR); + } if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { goto end_unlock; } - } + } end_unlock: - msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; - msg.from = __FILE__; - msg.string_arg = peer_uuid; - switch_core_session_receive_message(session, &msg); + msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; + msg.from = __FILE__; + msg.string_arg = peer_uuid; + switch_core_session_receive_message(session, &msg); if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { @@ -1863,19 +1862,19 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi switch_event_fire(&event); } - if (read_fd != FAX_INVALID_SOCKET) { - close(read_fd); - read_fd = FAX_INVALID_SOCKET; - } + if (read_fd != FAX_INVALID_SOCKET) { + close(read_fd); + read_fd = FAX_INVALID_SOCKET; + } - if (write_fd != FAX_INVALID_SOCKET) { - close(write_fd); - write_fd = FAX_INVALID_SOCKET; - } + if (write_fd != FAX_INVALID_SOCKET) { + close(write_fd); + write_fd = FAX_INVALID_SOCKET; + } - switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(other_session); + switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(other_session); switch_core_session_set_read_codec(session, NULL); @@ -1890,29 +1889,29 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi end: - switch_channel_clear_state_handler(channel, &t38_gateway_state_handlers); - switch_channel_set_variable(channel, "t38_peer", NULL); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - - return SWITCH_STATUS_SUCCESS; + switch_channel_clear_state_handler(channel, &t38_gateway_state_handlers); + switch_channel_set_variable(channel, "t38_peer", NULL); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + + return SWITCH_STATUS_SUCCESS; } static switch_status_t t38_gateway_on_reset(switch_core_session_t *session) { - switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_t *channel = switch_core_session_get_channel(session); - switch_channel_set_variable(channel, "rtp_autoflush_during_bridge", "false"); - - switch_channel_clear_flag(channel, CF_REDIRECT); + switch_channel_set_variable(channel, "rtp_autoflush_during_bridge", "false"); - if (switch_channel_test_app_flag_key("T38", channel, CF_APP_TAGGED)) { - switch_channel_clear_app_flag_key("T38", channel, CF_APP_TAGGED); - switch_channel_set_state(channel, CS_CONSUME_MEDIA); - } else { - switch_channel_set_state(channel, CS_SOFT_EXECUTE); - } + switch_channel_clear_flag(channel, CF_REDIRECT); - return SWITCH_STATUS_SUCCESS; + if (switch_channel_test_app_flag_key("T38", channel, CF_APP_TAGGED)) { + switch_channel_clear_app_flag_key("T38", channel, CF_APP_TAGGED); + switch_channel_set_state(channel, CS_CONSUME_MEDIA); + } else { + switch_channel_set_state(channel, CS_SOFT_EXECUTE); + } + + return SWITCH_STATUS_SUCCESS; } static const switch_state_handler_table_t t38_gateway_state_handlers = { @@ -1925,53 +1924,53 @@ static const switch_state_handler_table_t t38_gateway_state_handlers = { /*.on_consume_media */ t38_gateway_on_consume_media, /*.on_hibernate */ NULL, /*.on_reset */ t38_gateway_on_reset, - /*.on_park */ NULL, - /*.on_reporting */ NULL, - /*.on_destroy */ NULL, - SSH_FLAG_STICKY + /*.on_park */ NULL, + /*.on_reporting */ NULL, + /*.on_destroy */ NULL, + SSH_FLAG_STICKY }; switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, const char *data) { - switch_channel_t *other_channel = NULL, *channel = switch_core_session_get_channel(session); - switch_core_session_t *other_session = NULL; - int peer = app && !strcasecmp(app, "peer"); - - if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { - other_channel = switch_core_session_get_channel(other_session); + switch_channel_t *other_channel = NULL, *channel = switch_core_session_get_channel(session); + switch_core_session_t *other_session = NULL; + int peer = app && !strcasecmp(app, "peer"); - 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)); + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { + other_channel = switch_core_session_get_channel(other_session); - 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_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", "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", - switch_channel_get_name(peer ? channel : other_channel), - switch_channel_get_name(peer ? other_channel : channel)); - - - switch_channel_clear_state_handler(channel, NULL); - switch_channel_clear_state_handler(other_channel, NULL); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s starting gateway mode to %s\n", + switch_channel_get_name(peer ? channel : other_channel), + switch_channel_get_name(peer ? other_channel : channel)); - switch_channel_add_state_handler(channel, &t38_gateway_state_handlers); - switch_channel_add_state_handler(other_channel, &t38_gateway_state_handlers); - switch_channel_set_app_flag_key("T38", peer ? channel : other_channel, CF_APP_TAGGED); - switch_channel_clear_app_flag_key("T38", peer ? other_channel : channel, CF_APP_TAGGED); - - switch_channel_set_flag(channel, CF_REDIRECT); - switch_channel_set_state(channel, CS_RESET); + switch_channel_clear_state_handler(channel, NULL); + switch_channel_clear_state_handler(other_channel, NULL); - switch_channel_set_flag(other_channel, CF_REDIRECT); - switch_channel_set_state(other_channel, CS_RESET); - - switch_core_session_rwunlock(other_session); + switch_channel_add_state_handler(channel, &t38_gateway_state_handlers); + switch_channel_add_state_handler(other_channel, &t38_gateway_state_handlers); - } - - return SWITCH_FALSE; + switch_channel_set_app_flag_key("T38", peer ? channel : other_channel, CF_APP_TAGGED); + switch_channel_clear_app_flag_key("T38", peer ? other_channel : channel, CF_APP_TAGGED); + + switch_channel_set_flag(channel, CF_REDIRECT); + switch_channel_set_state(channel, CS_RESET); + + switch_channel_set_flag(other_channel, CF_REDIRECT); + switch_channel_set_state(other_channel, CS_RESET); + + switch_core_session_rwunlock(other_session); + + } + + return SWITCH_FALSE; } typedef struct { diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index f1a1fdb7b0..58a3638aa5 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -72,7 +72,7 @@ static modem_t *acquire_modem(int index); static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, size_t len) -{ +{ modem_t *modem = user_data; #ifndef WIN32 @@ -95,10 +95,10 @@ static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, CloseHandle (o.hEvent); #endif - if (wrote != len) { + if (wrote != len) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to pass the full buffer onto the device file. " "%"SWITCH_SSIZE_T_FMT " bytes of " "%"SWITCH_SIZE_T_FMT " written: %s\n", wrote, len, strerror(errno)); - + if (wrote == -1) wrote = 0; #ifndef WIN32 @@ -110,8 +110,8 @@ static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Successfully flushed pty buffer\n"); } #endif - } - return wrote; + } + return wrote; } @@ -126,7 +126,7 @@ static int t31_call_control_handler(t31_state_t *s, void *user_data, int op, con switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DOH! NO CONTROL HANDLER INSTALLED\n"); } - return ret; + return ret; } @@ -193,7 +193,7 @@ int modem_close(modem_t *modem) } - if (modem->t31_state) { + if (modem->t31_state) { t31_free(modem->t31_state); modem->t31_state = NULL; } @@ -228,7 +228,7 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl */ #if USE_OPENPTY - if (openpty(&modem->master, &modem->slave, NULL, NULL, NULL)) { + if (openpty(&modem->master, &modem->slave, NULL, NULL, NULL)) { if (modem->master < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to initialize pty\n"); @@ -260,44 +260,44 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl goto end; } #elif !defined(HAVE_POSIX_OPENPT) - modem->master = open("/dev/ptmx", O_RDWR); + modem->master = open("/dev/ptmx", O_RDWR); #else - modem->master = posix_openpt(O_RDWR | O_NOCTTY); + modem->master = posix_openpt(O_RDWR | O_NOCTTY); #endif #ifndef WIN32 - if (modem->master < 0) { + if (modem->master < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to initialize UNIX98 master pty\n"); - } + } - if (grantpt(modem->master) < 0) { + if (grantpt(modem->master) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to grant access to slave pty\n"); - } + } - if (unlockpt(modem->master) < 0) { + if (unlockpt(modem->master) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to unlock slave pty\n"); - } + } - modem->stty = ptsname(modem->master); + modem->stty = ptsname(modem->master); - if (modem->stty == NULL) { + if (modem->stty == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to obtain slave pty filename\n"); - } + } - modem->slave = open(modem->stty, O_RDWR); + modem->slave = open(modem->stty, O_RDWR); - if (modem->slave < 0) { + if (modem->slave < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to open slave pty %s\n", modem->stty); - } + } #endif #ifdef SOLARIS - ioctl(modem->slave, I_PUSH, "ptem"); /* push ptem */ - ioctl(modem->slave, I_PUSH, "ldterm"); /* push ldterm*/ + ioctl(modem->slave, I_PUSH, "ptem"); /* push ptem */ + ioctl(modem->slave, I_PUSH, "ldterm"); /* push ldterm*/ #endif #endif @@ -305,21 +305,21 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl modem->slot = globals.NEXT_ID++; snprintf(modem->devlink, sizeof(modem->devlink), "/dev/FS%d", modem->slot); - unlink(modem->devlink); + unlink(modem->devlink); - if (symlink(modem->stty, modem->devlink)) { + if (symlink(modem->stty, modem->devlink)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to create %s symbolic link\n", modem->devlink); modem_close(modem); status = SWITCH_STATUS_FALSE; goto end; - } + } - if (fcntl(modem->master, F_SETFL, fcntl(modem->master, F_GETFL, 0) | O_NONBLOCK)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set up non-blocking read on %s\n", ttyname(modem->master)); - modem_close(modem); - status = SWITCH_STATUS_FALSE; - goto end; - } + if (fcntl(modem->master, F_SETFL, fcntl(modem->master, F_GETFL, 0) | O_NONBLOCK)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set up non-blocking read on %s\n", ttyname(modem->master)); + modem_close(modem); + status = SWITCH_STATUS_FALSE; + goto end; + } #else timeouts.ReadIntervalTimeout=50; timeouts.ReadTotalTimeoutConstant=50; @@ -1032,14 +1032,14 @@ static int control_handler(modem_t *modem, const char *num, int op) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Control Handler op:%d state:[%s] %s\n", op, modem_state2name(modem_get_state(modem)), modem->devlink); - switch (op) { + switch (op) { - case AT_MODEM_CONTROL_ANSWER: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + case AT_MODEM_CONTROL_ANSWER: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - Answering\n", modem->devlink, modem_state2name(modem_get_state(modem))); modem_set_state(modem, MODEM_STATE_ANSWERED); - break; - case AT_MODEM_CONTROL_CALL: + break; + case AT_MODEM_CONTROL_CALL: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - Dialing '%s'\n", modem->devlink, modem_state2name(modem_get_state(modem)), num); @@ -1056,13 +1056,13 @@ static int control_handler(modem_t *modem, const char *num, int op) } } break; - case AT_MODEM_CONTROL_OFFHOOK: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + case AT_MODEM_CONTROL_OFFHOOK: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - Going off hook\n", modem->devlink, modem_state2name(modem_get_state(modem))); modem_set_state(modem, MODEM_STATE_OFFHOOK); break; - case AT_MODEM_CONTROL_ONHOOK: - case AT_MODEM_CONTROL_HANGUP: + case AT_MODEM_CONTROL_ONHOOK: + case AT_MODEM_CONTROL_HANGUP: { if (modem_get_state(modem) != MODEM_STATE_RINGING) { int set_state = 1; @@ -1096,16 +1096,16 @@ static int control_handler(modem_t *modem, const char *num, int op) } } } - break; - case AT_MODEM_CONTROL_DTR: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + break; + case AT_MODEM_CONTROL_DTR: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - DTR %d\n", modem->devlink, modem_state2name(modem_get_state(modem)), (int) (intptr_t) num); - break; - case AT_MODEM_CONTROL_RTS: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + break; + case AT_MODEM_CONTROL_RTS: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - RTS %d\n", modem->devlink, modem_state2name(modem_get_state(modem)), (int) (intptr_t) num); - break; - case AT_MODEM_CONTROL_CTS: + break; + case AT_MODEM_CONTROL_CTS: { u_char x[1]; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, @@ -1122,26 +1122,26 @@ static int control_handler(modem_t *modem, const char *num, int op) switch_set_flag(modem, MODEM_FLAG_XOFF); } } - break; - case AT_MODEM_CONTROL_CAR: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + break; + case AT_MODEM_CONTROL_CAR: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - CAR %d\n", modem->devlink, modem_state2name(modem_get_state(modem)), (int) (intptr_t) num); - break; - case AT_MODEM_CONTROL_RNG: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + break; + case AT_MODEM_CONTROL_RNG: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - RNG %d\n", modem->devlink, modem_state2name(modem_get_state(modem)), (int) (intptr_t) num); - break; - case AT_MODEM_CONTROL_DSR: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + break; + case AT_MODEM_CONTROL_DSR: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - DSR %d\n", modem->devlink, modem_state2name(modem_get_state(modem)), (int) (intptr_t) num); - break; - default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Modem %s [%s] - operation %d\n", modem->devlink, modem_state2name(modem_get_state(modem)), op); - break; - } - /*endswitch*/ - return 0; + break; + } + /*endswitch*/ + return 0; } typedef enum { @@ -1370,14 +1370,14 @@ static void activate_modems(void) static void deactivate_modems(void) { int max = globals.SOFT_MAX_MODEMS; - int x; + int x; switch_mutex_lock(globals.mutex); - for(x = 0; x < max; x++) { + for(x = 0; x < max; x++) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stopping Modem SLOT %d\n", x); modem_close(&globals.MODEM_POOL[x]); - } + } switch_mutex_unlock(globals.mutex); @@ -1390,39 +1390,39 @@ static void deactivate_modems(void) static modem_t *acquire_modem(int index) { - modem_t *modem = NULL; + modem_t *modem = NULL; switch_time_t now = switch_time_now(); int64_t idle_debounce = 2000000; - switch_mutex_lock(globals.mutex); - if (index > -1 && index < globals.SOFT_MAX_MODEMS) { - modem = &globals.MODEM_POOL[index]; - } else { - int x; + switch_mutex_lock(globals.mutex); + if (index > -1 && index < globals.SOFT_MAX_MODEMS) { + modem = &globals.MODEM_POOL[index]; + } else { + int x; - for(x = 0; x < globals.SOFT_MAX_MODEMS; x++) { - if (globals.MODEM_POOL[x].state == MODEM_STATE_ONHOOK && (now - globals.MODEM_POOL[x].last_event) > idle_debounce) { - modem = &globals.MODEM_POOL[x]; - break; - } - } - } + for(x = 0; x < globals.SOFT_MAX_MODEMS; x++) { + if (globals.MODEM_POOL[x].state == MODEM_STATE_ONHOOK && (now - globals.MODEM_POOL[x].last_event) > idle_debounce) { + modem = &globals.MODEM_POOL[x]; + break; + } + } + } - if (modem && (modem->state != MODEM_STATE_ONHOOK || (now - modem->last_event) < idle_debounce)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Modem %s In Use!\n", modem->devlink); - modem = NULL; - } + if (modem && (modem->state != MODEM_STATE_ONHOOK || (now - modem->last_event) < idle_debounce)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Modem %s In Use!\n", modem->devlink); + modem = NULL; + } - if (modem) { - modem_set_state(modem, MODEM_STATE_ACQUIRED); + if (modem) { + modem_set_state(modem, MODEM_STATE_ACQUIRED); modem->last_event = switch_time_now(); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Modems Available!\n"); - } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Modems Available!\n"); + } - switch_mutex_unlock(globals.mutex); + switch_mutex_unlock(globals.mutex); - return modem; + return modem; } switch_status_t modem_global_init(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) From 0ac014da6e895d9705046a9e9caa4ba9e7791cf2 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Thu, 19 Jul 2012 00:17:26 +0000 Subject: [PATCH 0748/1057] use SWITCH_CHANNEL_SESSION_LOG in mod_spandsp call progress detector --- .../mod_spandsp/mod_spandsp_dsp.c | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index ddf833dd94..43b739ff39 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2012, Anthony Minessale II * @@ -538,10 +538,13 @@ struct tone_detector { /** The debug level */ int debug; + + /** The session that owns this detector */ + switch_core_session_t *session; }; typedef struct tone_detector tone_detector_t; -static switch_status_t tone_detector_create(tone_detector_t **detector, tone_descriptor_t *descriptor, switch_memory_pool_t *memory_pool); +static switch_status_t tone_detector_create(switch_core_session_t *session, tone_detector_t **detector, tone_descriptor_t *descriptor); static switch_bool_t tone_detector_process_buffer(tone_detector_t *detector, void *data, unsigned int len, const char **key); static void tone_detector_destroy(tone_detector_t *detector); @@ -622,7 +625,7 @@ static void tone_report_callback(void *user_data, int code, int level, int delay { tone_detector_t *detector = (tone_detector_t *)user_data; if (detector->debug > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Tone report: code = %d, level = %d, delay = %d\n", code, level, delay); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(detector->session), SWITCH_LOG_DEBUG, "Tone report: code = %d, level = %d, delay = %d\n", code, level, delay); } detector->detected_tone = code; } @@ -639,28 +642,30 @@ static void tone_segment_callback(void *user_data, int f1, int f2, int duration) { tone_detector_t *detector = (tone_detector_t *)user_data; if (detector->debug > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Tone segment: f1 = %d, f2 = %d, duration = %d\n", f1, f2, duration); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(detector->session), SWITCH_LOG_DEBUG, "Tone segment: f1 = %d, f2 = %d, duration = %d\n", f1, f2, duration); } } /** * Allocate the tone detector * + * @param session the session that owns the detector * @param detector the detector to create * @param descriptor the descriptor to use * @param memory_pool the pool to use * @return SWITCH_STATUS_SUCCESS if successful */ -static switch_status_t tone_detector_create(tone_detector_t **detector, tone_descriptor_t *descriptor, switch_memory_pool_t *memory_pool) +static switch_status_t tone_detector_create(switch_core_session_t *session, tone_detector_t **detector, tone_descriptor_t *descriptor) { tone_detector_t *ldetector = NULL; - ldetector = switch_core_alloc(memory_pool, sizeof(tone_detector_t)); + ldetector = switch_core_session_alloc(session, sizeof(tone_detector_t)); if (!ldetector) { return SWITCH_STATUS_FALSE; } memset(ldetector, 0, sizeof(tone_detector_t)); ldetector->descriptor = descriptor; ldetector->debug = spandsp_globals.tonedebug; + ldetector->session = session; *detector = ldetector; return SWITCH_STATUS_SUCCESS; } @@ -734,13 +739,13 @@ switch_status_t callprogress_detector_start(switch_core_session_t *session, cons /* find the tone descriptor with the matching name and create the detector */ descriptor = switch_core_hash_find(spandsp_globals.tones, name); if (!descriptor) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) no tone descriptor defined with name '%s'. Update configuration. \n", switch_channel_get_name(channel), name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "no tone descriptor defined with name '%s'. Update configuration. \n", name); return SWITCH_STATUS_FALSE; } - tone_detector_create(&detector, descriptor, switch_core_session_get_pool(session)); + tone_detector_create(session, &detector, descriptor); /* start listening for tones */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Starting tone detection for '%s'\n", switch_channel_get_name(channel), name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Starting tone detection for '%s'\n", name); switch_core_media_bug_add(session, "spandsp_tone_detect", NULL, callprogress_detector_process_buffer, detector, 0 /* stop time */, SMBF_READ_REPLACE, &bug); if (!bug) { @@ -762,12 +767,11 @@ switch_status_t callprogress_detector_start(switch_core_session_t *session, cons static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { tone_detector_t *detector = (tone_detector_t *)user_data; - switch_core_session_t *session = switch_core_media_bug_get_session(bug); - switch_channel_t *channel = switch_core_session_get_channel(session); + switch_core_session_t *session = detector->session; switch(type) { case SWITCH_ABC_TYPE_INIT: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) initializing tone detector\n", switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "initializing tone detector\n"); tone_detector_init(detector); break; case SWITCH_ABC_TYPE_READ_REPLACE: @@ -775,17 +779,17 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu switch_frame_t *frame; const char *detected_tone = NULL; if (!detector->spandsp_detector) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) detector is destroyed\n", switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "detector is destroyed\n"); return SWITCH_FALSE; } if (!(frame = switch_core_media_bug_get_read_replace_frame(bug))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) error reading frame\n", switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "error reading frame\n"); return SWITCH_FALSE; } tone_detector_process_buffer(detector, frame->data, frame->samples, &detected_tone); if (detected_tone) { switch_event_t *event = NULL; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) DETECTED TONE: %s\n", switch_channel_get_name(channel), detected_tone); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "DETECTED TONE: %s\n", detected_tone); if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detected-Tone", detected_tone); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session)); @@ -796,7 +800,7 @@ static switch_bool_t callprogress_detector_process_buffer(switch_media_bug_t *bu } case SWITCH_ABC_TYPE_CLOSE: if (detector->spandsp_detector) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) destroying tone detector\n", switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "destroying tone detector\n"); tone_detector_destroy(detector); } break; From 338c1737522ebb86d44118bc2c17e28973b413b4 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Thu, 19 Jul 2012 00:29:26 +0000 Subject: [PATCH 0749/1057] parse uuid and descriptor name in start_tone_detect API --- .../applications/mod_spandsp/mod_spandsp.c | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 33a06a067a..7fd5fedfb4 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -266,19 +266,30 @@ SWITCH_STANDARD_API(start_tone_detect_api) { switch_status_t status = SWITCH_STATUS_SUCCESS; switch_core_session_t *psession = NULL; + char *puuid = NULL, *descriptor = NULL; if (zstr(cmd)) { + stream->write_function(stream, "-ERR missing uuid\n"); + return SWITCH_STATUS_SUCCESS; + } + + puuid = strdup((char *)cmd); + + if ((descriptor = strchr(puuid, ' '))) { + *descriptor++ = '\0'; + } + + if (zstr(descriptor)) { stream->write_function(stream, "-ERR missing descriptor name\n"); - return SWITCH_STATUS_SUCCESS; + goto end; } - if (!(psession = switch_core_session_locate(cmd))) { + if (!(psession = switch_core_session_locate(puuid))) { stream->write_function(stream, "-ERR Cannot locate session\n"); - return SWITCH_STATUS_SUCCESS; + goto end; } - - status = callprogress_detector_start(psession, cmd); + status = callprogress_detector_start(psession, descriptor); if (status == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK started\n"); @@ -288,11 +299,13 @@ SWITCH_STANDARD_API(start_tone_detect_api) switch_core_session_rwunlock(psession); + end: + + switch_safe_free(puuid); + return status; } - - /** * Stop tone detector application * @@ -319,7 +332,7 @@ SWITCH_STANDARD_API(stop_tone_detect_api) switch_core_session_t *psession = NULL; if (zstr(cmd)) { - stream->write_function(stream, "-ERR missing descriptor name\n"); + stream->write_function(stream, "-ERR missing session UUID\n"); return SWITCH_STATUS_SUCCESS; } @@ -732,10 +745,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) if (mod_spandsp_dsp_load(module_interface, pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load or process spandsp.conf, not adding tone_detect applications\n"); } else { - SWITCH_ADD_APP(app_interface, "start_tone_detect", "Start background tone detection with cadence", "", start_tone_detect_app, "[name]", SAF_NONE); + SWITCH_ADD_APP(app_interface, "start_tone_detect", "Start background tone detection with cadence", "", start_tone_detect_app, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "stop_tone_detect", "Stop background tone detection with cadence", "", stop_tone_detect_app, "", SAF_NONE); - SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, "[name]"); - SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, ""); + SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, " "); + SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, ""); } From da18061744d7933b852b14820521af313240743e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Jul 2012 21:46:15 -0500 Subject: [PATCH 0750/1057] FS-4444 --- conf/vanilla/autoload_configs/spandsp.conf.xml | 15 ++++++++++----- .../conf/autoload_configs/spandsp.conf.xml | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/conf/vanilla/autoload_configs/spandsp.conf.xml b/conf/vanilla/autoload_configs/spandsp.conf.xml index 6f062cc731..f70416bc66 100644 --- a/conf/vanilla/autoload_configs/spandsp.conf.xml +++ b/conf/vanilla/autoload_configs/spandsp.conf.xml @@ -42,20 +42,25 @@ - + + + + - - + + + - - + + + diff --git a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml index c2c943bf30..24ef4ed26d 100644 --- a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml +++ b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml @@ -42,20 +42,25 @@ - + + + + - - + + + - - + + + From 5867d0424d299ec4bd5225e7f3ebc9dce143a31a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Jul 2012 21:47:31 -0500 Subject: [PATCH 0751/1057] FS-4079 please try this --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/nua/nua_server.c | 40 ++++++++++++------- src/mod/endpoints/mod_sofia/mod_sofia.c | 24 ----------- 3 files changed, 27 insertions(+), 39 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 7a0987854e..9521702c60 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Jul 11 16:48:51 CDT 2012 +Wed Jul 18 21:45:15 CDT 2012 diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c index f27c83fb92..deae102ca2 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c @@ -295,31 +295,43 @@ int nua_base_server_preprocess(nua_server_request_t *sr) void nua_server_request_destroy(nua_server_request_t *sr) { + nua_server_request_t *sr0 = NULL; + if (sr == NULL) return; if (SR_HAS_SAVED_SIGNAL(sr)) nua_destroy_signal(sr->sr_signal); - if (sr->sr_irq) { - if (sr->sr_method == sip_method_bye && sr->sr_status < 200) { - nta_incoming_treply(sr->sr_irq, SIP_200_OK, TAG_END()); - } - nta_incoming_destroy(sr->sr_irq), sr->sr_irq = NULL; - } - - if (sr->sr_request.msg) - msg_destroy(sr->sr_request.msg), sr->sr_request.msg = NULL; - - if (sr->sr_response.msg) - msg_destroy(sr->sr_response.msg), sr->sr_response.msg = NULL; - if (sr->sr_prev) { /* Allocated from heap */ if ((*sr->sr_prev = sr->sr_next)) sr->sr_next->sr_prev = sr->sr_prev; - su_free(sr->sr_owner->nh_home, sr); + sr0 = sr; } + + if (sr->sr_irq) { + nta_incoming_t *irq = sr->sr_irq; + if (sr->sr_method == sip_method_bye && sr->sr_status < 200) { + nta_incoming_treply(sr->sr_irq, SIP_200_OK, TAG_END()); + } + sr->sr_irq = NULL; + nta_incoming_destroy(irq); + } + + if (sr->sr_request.msg) { + msg_t *msg = sr->sr_request.msg; + sr->sr_request.msg = NULL; + msg_destroy(msg); + } + + if (sr->sr_response.msg) { + msg_t *msg = sr->sr_response.msg; + sr->sr_response.msg = NULL; + msg_destroy(msg); + } + + if (sr0) su_free(sr->sr_owner->nh_home, sr0); } /**@fn void nua_respond(nua_handle_t *nh, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index e158e48318..0bcb383421 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2321,19 +2321,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (!zstr(msg->string_arg)) { - int status = 0; - - if (tech_pvt->nh && tech_pvt->nh->nh_ds && tech_pvt->nh->nh_ds->ds_sr && nua_server_request_is_pending(tech_pvt->nh->nh_ds->ds_sr)) { - status = tech_pvt->nh->nh_ds->ds_sr->sr_status; - } - - if (status == 0 || status > 199 || tech_pvt->nh->nh_destroyed) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot call respond on handle at status %d\n", - switch_channel_get_name(channel), status); - goto end_lock; - } - - if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) { char *dest = (char *) msg->string_arg; char *argv[128] = { 0 }; @@ -2417,17 +2404,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi case SWITCH_MESSAGE_INDICATE_RESPOND: { - int status = 0; - - if (tech_pvt->nh && tech_pvt->nh->nh_ds && tech_pvt->nh->nh_ds->ds_sr && nua_server_request_is_pending(tech_pvt->nh->nh_ds->ds_sr)) { - status = tech_pvt->nh->nh_ds->ds_sr->sr_status; - } - - if (status == 0 || status > 199 || tech_pvt->nh->nh_destroyed) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Cannot call respond on handle at status %d\n", - switch_channel_get_name(channel), status); - goto end_lock; - } if (msg->numeric_arg || msg->string_arg) { int code = msg->numeric_arg; From f4715781dc60293f89027ddf5ae4cc41badb5979 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Jul 2012 22:01:41 -0500 Subject: [PATCH 0752/1057] FS-4382 reverse this so you have to enable instead of disable, this patch has been causing srtp issues because the change in ssrc --- src/include/switch_types.h | 2 +- src/mod/endpoints/mod_sofia/sofia_glue.c | 8 ++++---- src/switch_rtp.c | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 86c7ab2f06..20ee478bf5 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -727,7 +727,7 @@ typedef enum { */ - RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER = (1 << 9) + RTP_BUG_CHANGE_SSRC_ON_MARKER = (1 << 9) /* By default FS will change the SSRC when the marker is set and it detects a timestamp reset. diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 78beb73624..878bf73a7f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -7021,12 +7021,12 @@ void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str *flag_pole &= ~RTP_BUG_GEN_ONE_GEN_ALL; } - if (switch_stristr("NEVER_CHANGE_SSRC_ON_MARKER", str)) { - *flag_pole |= RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER; + if (switch_stristr("CHANGE_SSRC_ON_MARKER", str)) { + *flag_pole |= RTP_BUG_CHANGE_SSRC_ON_MARKER; } - if (switch_stristr("~NEVER_CHANGE_SSRC_ON_MARKER", str)) { - *flag_pole &= ~RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER; + if (switch_stristr("~CHANGE_SSRC_ON_MARKER", str)) { + *flag_pole &= ~RTP_BUG_CHANGE_SSRC_ON_MARKER; } } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 16b5d6d38c..f6bc364773 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4130,7 +4130,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, send_msg->header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; /* If the marker was set, and the timestamp seems to have started over - set a new SSRC, to indicate this is a new stream */ - if (send_msg->header.m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_CHANGE_SSRC_ON_MARKER) && (rtp_session->last_write_ts == RTP_TS_RESET || + if (send_msg->header.m && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) && + (rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER) && (rtp_session->last_write_ts == RTP_TS_RESET || (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->last_write_ts > 0))) { switch_rtp_set_ssrc(rtp_session, (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL))); } From ec412c07d23693aedf8247a32510080d7ab48841 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Jul 2012 23:02:32 -0500 Subject: [PATCH 0753/1057] typo --- 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 b787a76d61..74ff8c6e3e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7410,7 +7410,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_event_t *event; if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR)) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Error-Type", "attended_transfer"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Error-Type", "blind_transfer"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Transfer-Exten", exten); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Full-Refer-To", full_ref_to); switch_channel_event_set_data(channel, event); From 1dbb05b690f5a50975703b34c0a1a8a13f611898 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Thu, 19 Jul 2012 13:32:42 +0000 Subject: [PATCH 0754/1057] more spacing fixes to mod_spandsp. --- .../applications/mod_spandsp/mod_spandsp.c | 14 +-- .../applications/mod_spandsp/mod_spandsp.h | 11 ++ .../mod_spandsp/mod_spandsp_fax.c | 106 +++++++++--------- .../mod_spandsp/mod_spandsp_modem.c | 49 ++++---- .../mod_spandsp/mod_spandsp_modem.h | 11 ++ 5 files changed, 112 insertions(+), 79 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 7fd5fedfb4..d50628c37b 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -227,12 +227,12 @@ SWITCH_STANDARD_APP(t38_gateway_function) } 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)); + 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); spandsp_fax_detect_session(session, "rw", timeout, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, 1, direction, NULL, t38_gateway_start); @@ -461,8 +461,8 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel switch_core_session_queue_message(target_session, msg); if (locked) { - switch_core_session_rwunlock(target_session); - locked = 0; + switch_core_session_rwunlock(target_session); + locked = 0; } } } diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 0d40b43c88..ce9618f5e0 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -151,3 +151,14 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const switch_status_t spandsp_stop_tdd_decode_session(switch_core_session_t *session); switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session); switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const char *text); + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:nil + * 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_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index c79043a846..c1d60895e2 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -685,11 +685,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) switch_assert(channel); if ((tmp = switch_channel_get_variable(channel, "t38_gateway_redundancy"))) { - int tmp_value; - tmp_value = atoi(tmp); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX changing redundancy from %d:%d to %d:%d\n", fec_span, fec_entries, tmp_value, tmp_value ); - fec_entries = tmp_value; - fec_span = tmp_value; + int tmp_value; + tmp_value = atoi(tmp); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX changing redundancy from %d:%d to %d:%d\n", fec_span, fec_entries, tmp_value, tmp_value ); + fec_entries = tmp_value; + fec_span = tmp_value; } switch (trans_mode) { @@ -721,62 +721,62 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } break; case T38_MODE: - { - switch_core_session_message_t msg = { 0 }; + { + switch_core_session_message_t msg = { 0 }; - if (pvt->t38_state == NULL) { - pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); - } - if (pvt->t38_state == NULL) { - return SWITCH_STATUS_FALSE; - } - if (pvt->udptl_state == NULL) { - pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); - } - if (pvt->udptl_state == NULL) { - t38_terminal_free(pvt->t38_state); - pvt->t38_state = NULL; - return SWITCH_STATUS_FALSE; - } + if (pvt->t38_state == NULL) { + pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); + } + if (pvt->t38_state == NULL) { + return SWITCH_STATUS_FALSE; + } + if (pvt->udptl_state == NULL) { + pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); + } + if (pvt->udptl_state == NULL) { + t38_terminal_free(pvt->t38_state); + pvt->t38_state = NULL; + return SWITCH_STATUS_FALSE; + } - t38 = pvt->t38_state; - t30 = t38_terminal_get_t30_state(t38); + t38 = pvt->t38_state; + t30 = t38_terminal_get_t30_state(t38); - memset(t38, 0, sizeof(t38_terminal_state_t)); + memset(t38, 0, sizeof(t38_terminal_state_t)); - if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); - return SWITCH_STATUS_FALSE; - } + if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); + return SWITCH_STATUS_FALSE; + } - pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); + pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, - (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); - return SWITCH_STATUS_FALSE; - } + if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries, + (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); + return SWITCH_STATUS_FALSE; + } - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; - switch_core_session_receive_message(pvt->session, &msg); + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; + switch_core_session_receive_message(pvt->session, &msg); - /* add to timer thread processing */ - if (!add_pvt(pvt)) { - if (channel) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + /* add to timer thread processing */ + if (!add_pvt(pvt)) { + if (channel) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + } + + span_log_set_message_handler(&t38->logging, spanfax_log_message, NULL); + span_log_set_message_handler(&t30->logging, spanfax_log_message, NULL); + + if (pvt->verbose) { + span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); } } - - span_log_set_message_handler(&t38->logging, spanfax_log_message, NULL); - span_log_set_message_handler(&t30->logging, spanfax_log_message, NULL); - - if (pvt->verbose) { - span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - } - } - break; + break; case T38_GATEWAY_MODE: if (pvt->t38_gateway_state == NULL) { pvt->t38_gateway_state = (t38_gateway_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_gateway_state_t)); @@ -959,9 +959,9 @@ static t38_mode_t configure_t38(pvt_t *pvt) if (t38_options->T38FaxRateManagement) { if (!strcasecmp(t38_options->T38FaxRateManagement, "transferredTCF")) { - method = 2; + method = 2; } else { - method = 1; + method = 1; } } diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index 58a3638aa5..f7fd57ba23 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -79,20 +79,20 @@ static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, switch_size_t wrote; wrote = write(modem->master, buf, len); #else - DWORD wrote; - OVERLAPPED o; - o.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + DWORD wrote; + OVERLAPPED o; + o.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - /* Initialize the rest of the OVERLAPPED structure to zero. */ - o.Internal = 0; - o.InternalHigh = 0; - o.Offset = 0; - o.OffsetHigh = 0; - assert(o.hEvent); - if (!WriteFile(modem->master, buf, (DWORD)len, &wrote, &o)) { - GetOverlappedResult(modem->master, &o, &wrote, TRUE); - } - CloseHandle (o.hEvent); + /* Initialize the rest of the OVERLAPPED structure to zero. */ + o.Internal = 0; + o.InternalHigh = 0; + o.Offset = 0; + o.OffsetHigh = 0; + assert(o.hEvent); + if (!WriteFile(modem->master, buf, (DWORD)len, &wrote, &o)) { + GetOverlappedResult(modem->master, &o, &wrote, TRUE); + } + CloseHandle (o.hEvent); #endif if (wrote != len) { @@ -244,12 +244,12 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl snprintf(modem->devlink, sizeof(modem->devlink), "COM%d", modem->slot); modem->master = CreateFile(modem->devlink, - GENERIC_READ | GENERIC_WRITE, - 0, - 0, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED, - 0); + GENERIC_READ | GENERIC_WRITE, + 0, + 0, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + 0); if(modem->master==INVALID_HANDLE_VALUE) { status = SWITCH_STATUS_FALSE; if(GetLastError()==ERROR_FILE_NOT_FOUND) { @@ -1463,3 +1463,14 @@ void modem_global_shutdown(void) } #endif + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:nil + * 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_spandsp/mod_spandsp_modem.h b/src/mod/applications/mod_spandsp/mod_spandsp_modem.h index f04797e017..d02a5fdc8f 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.h @@ -155,3 +155,14 @@ switch_status_t modem_global_init(switch_loadable_module_interface_t **module_in void modem_global_shutdown(void); #endif //_MOD_SPANDSP_MODEM_H + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:nil + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ From d5fda5ea7623022ccbb5a349ed794edad439adb7 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Thu, 19 Jul 2012 23:23:05 +0800 Subject: [PATCH 0755/1057] Made mod_spandsp default to enabling T.85 compression --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index c1d60895e2..d5b80b6e09 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -867,7 +867,7 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } if (pvt->use_ecm) { - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION | T30_SUPPORT_T85_COMPRESSION | T30_SUPPORT_T85_L0_COMPRESSION); t30_set_ecm_capability(t30, TRUE); switch_channel_set_variable(channel, "fax_ecm_requested", "1"); } else { From fa991a47313effb6d22df9051e5270702a955ab6 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 19 Jul 2012 10:17:19 -0500 Subject: [PATCH 0756/1057] Fix the API --- src/mod/applications/mod_enum/mod_enum.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 0abd27b601..c40e6443f0 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -464,6 +464,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n char *name = NULL; struct timeval to = { 0, 0}; int inameserver = 0; + int added_server = 0; if (!(name = reverse_number(number, root))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n"); @@ -473,22 +474,24 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n if (!(domain = ldns_dname_new_frm_str(name))) { goto end; } - + if (server_name) { res = ldns_resolver_new(); switch_assert(res); for(inameserver=0; inameserver Date: Thu, 19 Jul 2012 11:09:30 -0500 Subject: [PATCH 0757/1057] FS-4378 --resolve 0 is success, thats the missing bit, this will work --- 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 74ff8c6e3e..3533c29d49 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7409,7 +7409,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } else { switch_event_t *event; - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR)) { + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Error-Type", "blind_transfer"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Transfer-Exten", exten); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Full-Refer-To", full_ref_to); From f4e1fc4bc6c31ae3040ae07800b2b5ca4138c915 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Jul 2012 11:30:00 -0500 Subject: [PATCH 0758/1057] FS-4382 --resolve missing \! --- src/switch_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index f6bc364773..dcc5e09e48 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4130,7 +4130,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, send_msg->header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; /* If the marker was set, and the timestamp seems to have started over - set a new SSRC, to indicate this is a new stream */ - if (send_msg->header.m && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) && + if (send_msg->header.m && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND) && (rtp_session->rtp_bugs & RTP_BUG_CHANGE_SSRC_ON_MARKER) && (rtp_session->last_write_ts == RTP_TS_RESET || (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->last_write_ts > 0))) { switch_rtp_set_ssrc(rtp_session, (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL))); From db0cca3bf44db42b332eeafc0c5fcdec4bd1c82c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Jul 2012 12:40:34 -0500 Subject: [PATCH 0759/1057] FS-4437 try this revision --- src/switch_rtp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index dcc5e09e48..538a44fe16 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4517,13 +4517,14 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra send_msg = frame->packet; + if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { + send_msg->header.pt = rtp_session->payload; + } - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { - send_msg->header.pt = rtp_session->payload; + send_msg->header.ssrc = htonl(rtp_session->ssrc); } - - send_msg->header.ssrc = htonl(rtp_session->ssrc); if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, frame->packet, &bytes) != SWITCH_STATUS_SUCCESS) { return -1; From 890da63554a782d63ca0e4123765cc276fdada85 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 18 Jul 2012 22:18:35 +0200 Subject: [PATCH 0760/1057] ftmod_skel: Add -shared libtool flag. Do not build static versions of modules. Signed-off-by: Stefan Knoblich --- libs/freetdm/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 55d8865dec..03477ad359 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -151,7 +151,7 @@ ftmod_zt_la_LIBADD = libfreetdm.la ftmod_skel_la_SOURCES = $(SRC)/ftmod/ftmod_skel/ftmod_skel.c ftmod_skel_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -ftmod_skel_la_LDFLAGS = -module -avoid-version +ftmod_skel_la_LDFLAGS = -shared -module -avoid-version ftmod_skel_la_LIBADD = libfreetdm.la ftmod_analog_la_SOURCES = $(SRC)/ftmod/ftmod_analog/ftmod_analog.c From 0e51786a884fc247974c39907b5ea68d37344049 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 18 Jul 2012 22:21:07 +0200 Subject: [PATCH 0761/1057] FreeTDM: Add ftmod_analog(_em) and ftmod_zt to summary screen (always built). Signed-off-by: Stefan Knoblich --- libs/freetdm/configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index f72a6268a8..93e30f6d40 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -459,6 +459,8 @@ AC_MSG_RESULT([ + Modules Signalling: + ftmod_analog....................... yes + ftmod_analog_em.................... yes ftmod_isdn......................... ${HAVE_LIBISDN} ftmod_libpri....................... ${HAVE_LIBPRI} ftmod_sangoma_isdn................. ${HAVE_SNG_ISDN} @@ -467,6 +469,7 @@ AC_MSG_RESULT([ ftmod_gsm.......................... ${HAVE_WAT} ftmod_pritap....................... ${HAVE_PRITAP} I/O: + ftmod_zt........................... yes ftmod_wanpipe...................... ${HAVE_LIBSANGOMA} ftmod_misdn........................ ${HAVE_MISDN} From b434cac526b48030f78e6854a2d73a4439fcbb55 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Jul 2012 15:49:34 -0500 Subject: [PATCH 0762/1057] wait forever when you call a pickup endpoint by itself --- src/switch_ivr_originate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 0a9c82eff7..f2ae8f0f71 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -753,7 +753,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat } } - if (oglobals->hups + pickups == len) { + if (oglobals->hups > 0 && oglobals->hups + pickups == len) { rval = 0; } else { rval = 1; From c55ac6c9009d114030562ef9f2d32bb721e3e618 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 19 Jul 2012 16:55:13 -0400 Subject: [PATCH 0763/1057] freetdm: OPENZAP-187 --resolve Add ability to set called party subaddress --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 1 + .../ftmod_sangoma_isdn_stack_out.c | 1 + .../ftmod_sangoma_isdn_support.c | 20 +++++++++++++++++++ 3 files changed, 22 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 92054b8869..51cb0b02fd 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 @@ -507,6 +507,7 @@ ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); +ftdm_status_t set_called_subaddr(ftdm_channel_t *ftdmchan, CdPtySad *cdPtySad); ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap); ftdm_status_t set_network_specific_fac(ftdm_channel_t *ftdmchan, NetFac *netFac); 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 f528333634..f705d717ab 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 @@ -67,6 +67,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); set_calling_num2(ftdmchan, &conEvnt.cgPtyNmb2); set_calling_subaddr(ftdmchan, &conEvnt.cgPtySad); + set_called_subaddr(ftdmchan, &conEvnt.cdPtySad); set_redir_num(ftdmchan, &conEvnt.redirNmb); set_calling_name(ftdmchan, &conEvnt); set_network_specific_fac(ftdmchan, &conEvnt.netFac[0]); 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 df7e7b1667..0606f79643 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 @@ -847,6 +847,26 @@ ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) return FTDM_SUCCESS; } +ftdm_status_t set_called_subaddr(ftdm_channel_t *ftdmchan, CdPtySad *cdPtySad) +{ + const char* cld_subaddr = NULL; + cld_subaddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.called_subaddr"); + if (!ftdm_strlen_zero(cld_subaddr)) { + unsigned len = strlen (cld_subaddr); + cdPtySad->eh.pres = PRSNT_NODEF; + cdPtySad->typeSad.pres = 1; + cdPtySad->typeSad.val = 0; /* NSAP */ + cdPtySad->oddEvenInd.pres = 1; + cdPtySad->oddEvenInd.val = 0; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Called Party Subaddress:%s\n", cld_subaddr); + cdPtySad->sadInfo.pres = 1; + cdPtySad->sadInfo.len = len; + memcpy(cdPtySad->sadInfo.val, cld_subaddr, len); + } + return FTDM_SUCCESS; +} + ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) { ftdm_status_t status; From 4f7122c866005c9313fa3a1efd461878d4172748 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Jul 2012 16:12:06 -0500 Subject: [PATCH 0764/1057] followup --- src/switch_ivr_originate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index f2ae8f0f71..efe855b565 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -701,6 +701,9 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat !switch_channel_test_flag(originate_status[i].peer_channel, CF_ORIGINATING) ) { (oglobals->hups)++; + if (switch_channel_test_flag(originate_status[i].peer_channel, CF_PICKUP)) { + pickups--; + } } else if ((switch_channel_test_flag(originate_status[i].peer_channel, CF_ANSWERED) || (oglobals->early_ok && switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_MEDIA)) || (oglobals->ring_ready && oglobals->return_ring_ready && len == 1 && From f50d14a7d14e982a3e45af4390420f7e95caffaf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Jul 2012 17:03:23 -0500 Subject: [PATCH 0765/1057] treate no method as INVITE --- src/mod/endpoints/mod_sofia/sofia.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 3533c29d49..e331e6d4f6 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1204,14 +1204,17 @@ static void our_sofia_event_callback(nua_event_t event, refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to); if ((params = strchr(refer_to, ';'))) { *params++ = '\0'; - if ((method = switch_find_parameter(params, "method", NULL))) { - if (!strcasecmp(method, "INVITE")) { - action = "call"; - } else if (!strcasecmp(method, "BYE")) { - action = "end"; - } else { - action = method; - } + + if (!(method = switch_find_parameter(params, "method", NULL))) { + method = strdup("INVITE"); + } + + if (!strcasecmp(method, "INVITE")) { + action = "call"; + } else if (!strcasecmp(method, "BYE")) { + action = "end"; + } else { + action = method; } } From 42f296de9bf79e277f9859dd5224c07e973fb59c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Jul 2012 17:39:12 -0500 Subject: [PATCH 0766/1057] FS-4331 FS-4424 --resolve 2 for one sale --- src/mod/applications/mod_dptools/mod_dptools.c | 6 ++++-- src/switch_ivr_originate.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 2aa5679b7b..02f988f6cf 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3510,7 +3510,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio tech_pvt = switch_core_session_alloc(nsession, sizeof(*tech_pvt)); tech_pvt->key = switch_core_session_strdup(nsession, pickup); - switch_event_dup(&tech_pvt->vars, var_event); + switch_core_session_set_private(nsession, tech_pvt); @@ -3534,7 +3534,9 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio pickup_add_session(nsession, pickup); switch_channel_set_flag(nchannel, CF_PICKUP); switch_channel_set_flag(nchannel, CF_NO_PRESENCE); - + + switch_event_dup(&tech_pvt->vars, var_event); + goto done; error: diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index efe855b565..9bddf694d9 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2580,6 +2580,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess local_clobber = switch_true(lc); } + if (switch_channel_test_flag(originate_status[i].peer_channel, CF_NO_PRESENCE)) { + if (var_event) { + switch_event_del_header(var_event, "presence_id"); + } + if (local_var_event) { + switch_event_del_header(local_var_event, "presence_id"); + } + } + + if (local_clobber) { if (var_event) { switch_event_header_t *header; From 52bf168b567d3889a5f899a581291713bd248299 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Fri, 20 Jul 2012 02:38:12 +0200 Subject: [PATCH 0767/1057] Abort module load if config can't be opened. Refs FS-4438 --- .../mod_cdr_mongodb/conf/autoload_configs/cdr_mongodb.conf.xml | 2 +- src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_cdr_mongodb/conf/autoload_configs/cdr_mongodb.conf.xml b/src/mod/event_handlers/mod_cdr_mongodb/conf/autoload_configs/cdr_mongodb.conf.xml index ce366d1bd0..e1daf62ada 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/conf/autoload_configs/cdr_mongodb.conf.xml +++ b/src/mod/event_handlers/mod_cdr_mongodb/conf/autoload_configs/cdr_mongodb.conf.xml @@ -1,6 +1,6 @@ - + diff --git a/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c b/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c index 35ab4cba2f..fec5b516ef 100644 --- a/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c +++ b/src/mod/event_handlers/mod_cdr_mongodb/mod_cdr_mongodb.c @@ -360,7 +360,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_mongodb_load) memset(&globals, 0, sizeof(globals)); globals.pool = pool; if (load_config(pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Unable to load or parse config!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load or parse config!\n"); + return SWITCH_STATUS_FALSE; } db_status = mongo_connect(globals.mongo_conn, globals.mongo_host, globals.mongo_port); From 30c009b30ee763fb91fdcd1bd843613e26e294ef Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 20 Jul 2012 08:43:05 +0800 Subject: [PATCH 0768/1057] fsv file formate audio only at this time video is possible when add a file_write_video interface to core only tested/working with 8000hz at this time --- src/mod/applications/mod_fsv/mod_fsv.c | 269 +++++++++++++++++++++++++ 1 file changed, 269 insertions(+) diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 7a798ca1fa..e3c47cfe76 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -24,10 +24,13 @@ * Contributor(s): * * Anthony Minessale II + * Seven Du * * mod_fsv -- FS Video File Format * + * */ + #include @@ -489,13 +492,279 @@ SWITCH_STANDARD_APP(play_fsv_function) } } +struct fsv_file_context { + switch_file_t *fd; + char *path; + switch_mutex_t *mutex; +}; + +typedef struct fsv_file_context fsv_file_context; + +static switch_status_t fsv_file_open(switch_file_handle_t *handle, const char *path) +{ + fsv_file_context *context; + char *ext; + unsigned int flags = 0; + + if ((ext = strrchr(path, '.')) == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); + return SWITCH_STATUS_GENERR; + } + ext++; + + if ((context = switch_core_alloc(handle->memory_pool, sizeof(*context))) == 0) { + return SWITCH_STATUS_MEMERR; + } + + switch_mutex_init(&context->mutex, SWITCH_MUTEX_NESTED, handle->memory_pool); + + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { + flags |= SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE; + if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) { + flags |= SWITCH_FOPEN_READ; + } else { + flags |= SWITCH_FOPEN_TRUNCATE; + } + + } + + if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) { + flags |= SWITCH_FOPEN_READ; + } + + if (switch_file_open(&context->fd, path, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path); + return SWITCH_STATUS_GENERR; + } + + context->path = switch_core_strdup(handle->memory_pool, path); + + if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) { + int64_t samples = 0; + switch_file_seek(context->fd, SEEK_END, &samples); + handle->pos = samples; + } + + handle->samples = 0; + handle->samplerate = 8000; + handle->channels = 1; + handle->format = 0; + handle->sections = 0; + handle->seekable = 0; + handle->speed = 0; + handle->pos = 0; + handle->private_info = context; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening File [%s] %dhz\n", path, handle->samplerate); + + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { + struct file_header h; + size_t len = sizeof(h); + + memset(&h, 0, sizeof(h)); + + h.version = VERSION; + h.created = switch_micro_time_now(); + + switch_set_string(h.video_codec_name, "H264"); /* FIXME: hard coded */ + + h.audio_rate = handle->samplerate; + h.audio_ptime = 20; /* FIXME: hard coded */ + + if (switch_file_write(context->fd, &h, &len) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File write failed\n"); + return SWITCH_STATUS_GENERR; + } + } else if (switch_test_flag(handle, SWITCH_FILE_FLAG_READ)) { + struct file_header h; + size_t size = sizeof(h); + + if (switch_file_read(context->fd, &h, &size) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error reading file header\n"); + return SWITCH_STATUS_GENERR; + } + + if (h.version != VERSION) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "File version does not match!\n"); + return SWITCH_STATUS_GENERR; + } + + handle->samplerate = h.audio_rate; + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t fsv_file_truncate(switch_file_handle_t *handle, int64_t offset) +{ + fsv_file_context *context = handle->private_info; + switch_status_t status; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "truncate file [%s]\n", context->path); + + if ((status = switch_file_trunc(context->fd, offset)) == SWITCH_STATUS_SUCCESS) { + handle->pos = 0; + } + + return status; + +} + +static switch_status_t fsv_file_close(switch_file_handle_t *handle) +{ + fsv_file_context *context = handle->private_info; + + if (context->fd) { + switch_file_close(context->fd); + context->fd = NULL; + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t fsv_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) +{ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Seek not implemented\n"); + return SWITCH_STATUS_FALSE; +} + +static switch_status_t fsv_file_read(switch_file_handle_t *handle, void *data, size_t *len) +{ + switch_status_t status; + size_t need = *len; + uint32_t size; + size_t bytes = sizeof(size); + fsv_file_context *context = handle->private_info; + +again: + + status = switch_file_read(context->fd, &size, &bytes); + + if (status != SWITCH_STATUS_SUCCESS) { + goto end; + } + + if (size & VID_BIT) { /* video */ + *len = size & ~VID_BIT; + /* TODO: read video data */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "discarding video data %d\n", (int)*len); + status = switch_file_read(context->fd, data, len); + + if (status != SWITCH_STATUS_SUCCESS) { + goto end; + } + + handle->pos += *len + bytes; + goto again; + } + + if (size > need) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "size %u > need %u\n", (unsigned int)size, (int)need); + goto end; + } + + *len = size; + + status = switch_file_read(context->fd, data, len); + + *len /= 2; + +end: + + return status; +} + +static switch_status_t fsv_file_write(switch_file_handle_t *handle, void *data, size_t *len) +{ + uint32_t datalen = *len * 2; + size_t size; + switch_status_t status; + + fsv_file_context *context = handle->private_info; + + /* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "writing: %ld\n", (long)(*len)); */ + + if (*len > 160) { /* when sample rate is 8000 */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You are asking to write %d bytes of data which is not supported. Please set enable_file_write_buffering=false to use .fsv format\n", (int)(*len)); + return SWITCH_STATUS_GENERR; + } + + switch_mutex_lock(context->mutex); + + size = sizeof(datalen); + if (switch_file_write(context->fd, &datalen, &size) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "write error\n"); + return SWITCH_STATUS_FALSE; + } + + *len = datalen; + status = switch_file_write(context->fd, data, len); + switch_mutex_unlock(context->mutex); + + return status; +} + +// static switch_status_t fsv_file_write_video(switch_file_handle_t *handle, void *data, size_t *len) +// { +// uint32_t datalen = *len; +// uint32_t bytes = datalen | VID_BIT; +// size_t size; +// switch_status_t status = SWITCH_STATUS_SUCCESS; + +// fsv_file_context *context = handle->private_info; +// /* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "writing: %ld\n", (long)(*len)); */ + +// switch_mutex_lock(context->mutex); + +// size = sizeof(bytes); +// if (switch_file_write(context->fd, &bytes, &size) != SWITCH_STATUS_SUCCESS) { +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "write error\n"); +// return SWITCH_STATUS_FALSE; +// } + +// *len = datalen; +// status = switch_file_write(context->fd, data, len); +// switch_mutex_unlock(context->mutex); + +// return status; +// } + +static switch_status_t fsv_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string) +{ + return SWITCH_STATUS_FALSE; +} + +static switch_status_t fsv_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col, const char **string) +{ + return SWITCH_STATUS_FALSE; +} + +/* Registration */ + +static char *supported_formats[2] = { 0 }; + SWITCH_MODULE_LOAD_FUNCTION(mod_fsv_load) { switch_application_interface_t *app_interface; + switch_file_interface_t *file_interface; + + supported_formats[0] = "fsv"; /* 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); + file_interface->interface_name = modname; + file_interface->extens = supported_formats; + file_interface->file_open = fsv_file_open; + file_interface->file_close = fsv_file_close; + file_interface->file_truncate = fsv_file_truncate; + file_interface->file_read = fsv_file_read; + file_interface->file_write = fsv_file_write; + // file_interface->file_write_video = fsv_file_write_video; + file_interface->file_seek = fsv_file_seek; + file_interface->file_set_string = fsv_file_set_string; + file_interface->file_get_string = fsv_file_get_string; + SWITCH_ADD_APP(app_interface, "play_fsv", "play an fsv file", "play an fsv file", play_fsv_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "record_fsv", "record an fsv file", "record an fsv file", record_fsv_function, "", SAF_NONE); From 14cb9af607e5c6dec35f03255cd55ce6c54441c0 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 20 Jul 2012 11:38:20 +0800 Subject: [PATCH 0769/1057] add switch_core_file_write_video open a door to write video data so it is possible to record a .fsv file also possible to write to .mp4 with proper file format support --- src/include/switch_core.h | 9 ++++++ src/include/switch_module_interfaces.h | 4 +++ src/mod/applications/mod_fsv/mod_fsv.c | 40 +++++++++++++------------- src/switch_core_file.c | 17 +++++++++++ 4 files changed, 50 insertions(+), 20 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index ae7e621539..f37280f3e7 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1648,6 +1648,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(_In_ switch_file_handle_t SWITCH_DECLARE(switch_status_t) switch_core_file_write(_In_ switch_file_handle_t *fh, void *data, switch_size_t *len); /*! + \brief Write media to a file handle + \param fh the file handle to write to + \param data the buffer to write + \param len the amount of data to write from the buffer + \return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful +*/ +SWITCH_DECLARE(switch_status_t) switch_core_file_write_video(_In_ switch_file_handle_t *fh, void *data, switch_size_t *len); + +/*! \brief Seek a position in a file \param fh the file handle to seek \param cur_pos the current position in the file diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index af85e3ed7c..7e024530c5 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -273,6 +273,10 @@ struct switch_file_interface { /*! function to write from the file */ switch_status_t (*file_write) (switch_file_handle_t *, void *data, switch_size_t *len); /*! function to seek to a certian position in the file */ + switch_status_t (*file_read_video) (switch_file_handle_t *, void *data, switch_size_t *len); + /*! function to write from the file */ + switch_status_t (*file_write_video) (switch_file_handle_t *, void *data, switch_size_t *len); + /*! function to seek to a certian position in the file */ switch_status_t (*file_seek) (switch_file_handle_t *, unsigned int *cur_pos, int64_t samples, int whence); /*! function to set meta data */ switch_status_t (*file_set_string) (switch_file_handle_t *fh, switch_audio_col_t col, const char *string); diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index e3c47cfe76..01160f6f7f 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -703,30 +703,30 @@ static switch_status_t fsv_file_write(switch_file_handle_t *handle, void *data, return status; } -// static switch_status_t fsv_file_write_video(switch_file_handle_t *handle, void *data, size_t *len) -// { -// uint32_t datalen = *len; -// uint32_t bytes = datalen | VID_BIT; -// size_t size; -// switch_status_t status = SWITCH_STATUS_SUCCESS; +static switch_status_t fsv_file_write_video(switch_file_handle_t *handle, void *data, size_t *len) +{ + uint32_t datalen = *len; + uint32_t bytes = datalen | VID_BIT; + size_t size; + switch_status_t status = SWITCH_STATUS_SUCCESS; -// fsv_file_context *context = handle->private_info; -// /* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "writing: %ld\n", (long)(*len)); */ + fsv_file_context *context = handle->private_info; + /* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "writing: %ld\n", (long)(*len)); */ -// switch_mutex_lock(context->mutex); + switch_mutex_lock(context->mutex); -// size = sizeof(bytes); -// if (switch_file_write(context->fd, &bytes, &size) != SWITCH_STATUS_SUCCESS) { -// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "write error\n"); -// return SWITCH_STATUS_FALSE; -// } + size = sizeof(bytes); + if (switch_file_write(context->fd, &bytes, &size) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "write error\n"); + return SWITCH_STATUS_FALSE; + } -// *len = datalen; -// status = switch_file_write(context->fd, data, len); -// switch_mutex_unlock(context->mutex); + *len = datalen; + status = switch_file_write(context->fd, data, len); + switch_mutex_unlock(context->mutex); -// return status; -// } + return status; +} static switch_status_t fsv_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string) { @@ -760,7 +760,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fsv_load) file_interface->file_truncate = fsv_file_truncate; file_interface->file_read = fsv_file_read; file_interface->file_write = fsv_file_write; - // file_interface->file_write_video = fsv_file_write_video; + file_interface->file_write_video = fsv_file_write_video; file_interface->file_seek = fsv_file_seek; file_interface->file_set_string = fsv_file_set_string; file_interface->file_get_string = fsv_file_get_string; diff --git a/src/switch_core_file.c b/src/switch_core_file.c index ed1a03f76b..b1a1effc85 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -406,6 +406,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh, } } +SWITCH_DECLARE(switch_status_t) switch_core_file_write_video(switch_file_handle_t *fh, void *data, switch_size_t *len) +{ + switch_assert(fh != NULL); + switch_assert(fh->file_interface != NULL); + + if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) { + return SWITCH_STATUS_GENERR; + } + + if (!fh->file_interface->file_write_video) { + return SWITCH_STATUS_FALSE; + } + + return fh->file_interface->file_write_video(fh, data, len); + +} + SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence) { switch_status_t status; From 5e3c5db727c135757d2f7309bbfcae4d579bb709 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 20 Jul 2012 05:12:11 +0000 Subject: [PATCH 0770/1057] Don't show unclean in version string for now Showing whether the git repository is clean at the time of build will be useful, but currently something in our bootstrap/configure/early make process is causing the tree to look unclean at just the wrong moment and clean builds are showing up as unclean. --- build/print_git_revision.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/print_git_revision.c b/build/print_git_revision.c index 6b11646c8e..7358003832 100644 --- a/build/print_git_revision.c +++ b/build/print_git_revision.c @@ -9,6 +9,8 @@ #include #include +static int show_unclean = 0; + static int sys(char *buf, int buflen, char *cmd) { int i, p[2]; if (pipe(p)) return 255; @@ -50,7 +52,7 @@ int main(int argc, char **argv) { if ((sys1(xcommit,sizeof(xcommit),"git rev-list -n1 --abbrev=10 --abbrev-commit HEAD"))) return 1; snprintf(xver,sizeof(xver),"+git~%s~%s",xfdate,xcommit); - if ((sys(NULL,0,"git diff-index --quiet HEAD"))) { + if (show_unclean && (sys(NULL,0,"git diff-index --quiet HEAD"))) { char buf[256], now[256]; time_t now_t=time(NULL); struct tm *now_tm; if (!(now_tm=gmtime(&now_t))) return 1; strftime(now,sizeof(now),"%Y%m%dT%H%M%SZ",now_tm); From cae357e784518fdf44dab384510f9c4fff20c751 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 20 Jul 2012 05:18:04 +0000 Subject: [PATCH 0771/1057] gitignore some build products --- libs/.gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/.gitignore b/libs/.gitignore index 48bfc1f814..786ae26637 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -523,6 +523,11 @@ missing /spandsp/doc/Makefile.in /spandsp/Makefile /spandsp/Makefile.in +/spandsp/m4/libtool.m4 +/spandsp/m4/ltoptions.m4 +/spandsp/m4/ltsugar.m4 +/spandsp/m4/ltversion.m4 +/spandsp/m4/lt~obsolete.m4 /spandsp/spandsp-sim/Makefile /spandsp/spandsp-sim/Makefile.in /spandsp/src/at_interpreter_dictionary.h From a8019d803cf0219016cece570a50a20f80951b06 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 20 Jul 2012 07:33:40 +0000 Subject: [PATCH 0772/1057] Make version output more human-friendly Our main version string is designed for release engineering purposes: it matches file name conventions used for versioned tarballs and the versions sort lexicographically while containing all pertinent information. With this commit we add in parentheses a more human-friendly rendering of the version string: we spell out the meaning of each field and render the datetime in RFC 822 notation. --- Makefile.am | 5 +++- build/print_git_revision.c | 30 ++++++++++++++++++- configure.in | 1 + scripts/ci/common.sh | 5 +++- scripts/dailys.sh | 2 ++ src/include/switch_version.h.cmake | 2 ++ src/include/switch_version.h.template | 2 ++ .../applications/mod_commands/mod_commands.c | 2 +- src/switch.c | 2 +- src/switch_core.c | 3 +- 10 files changed, 48 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1aa424f754..1a0759b166 100644 --- a/Makefile.am +++ b/Makefile.am @@ -422,7 +422,10 @@ src/include/switch_version.h: src/include/switch_version.h.in Makefile build/pri @cat $< > $@; \ if [ -d .git ] && [ -n "$$(which git)" ]; then \ xver="$$(./build/print_git_revision)"; \ - sed -e "/#define *SWITCH_VERSION_REVISION/{s/\"\([^\"]*\)\"/\"\1$$xver\"/;}" \ + xhver="$$(./build/print_git_revision -h)"; \ + sed \ + -e "/#define *SWITCH_VERSION_REVISION\W/{s/\"\([^\"]*\)\"/\"\1$$xver\"/;}" \ + -e "/#define *SWITCH_VERSION_REVISION_HUMAN\W/{s/\"\([^\"]*\)\"/\"\1$$xhver\"/;}" \ $< > $@; \ fi; diff --git a/build/print_git_revision.c b/build/print_git_revision.c index 7358003832..0f8e680b37 100644 --- a/build/print_git_revision.c +++ b/build/print_git_revision.c @@ -42,7 +42,7 @@ static int sys1(char *buf, int buflen, char *cmd) { return 0; } -int main(int argc, char **argv) { +static int print_version(void) { char xver[256], xdate[256], xfdate[256], xcommit[256]; time_t xdate_t; struct tm *xdate_tm; if ((sys1(xdate,sizeof(xdate),"git log -n1 --format='%ct' HEAD"))) return 1; @@ -63,3 +63,31 @@ int main(int argc, char **argv) { return 0; } +static int print_human_version(void) { + char xver[256], xdate[256], xfdate[256], xcommit[256]; + time_t xdate_t; struct tm *xdate_tm; + if ((sys1(xdate,sizeof(xdate),"git log -n1 --format='%ct' HEAD"))) return 1; + xdate_t=(time_t)atoi(xdate); + if (!(xdate_tm=gmtime(&xdate_t))) return 1; + strftime(xfdate,sizeof(xfdate),"%a, %d %b %Y %H:%M:%S Z",xdate_tm); + if ((sys1(xcommit,sizeof(xcommit),"git rev-list -n1 --abbrev=10 --abbrev-commit HEAD"))) + return 1; + snprintf(xver,sizeof(xver),"; git at commit %s on %s",xcommit,xfdate); + if (show_unclean && (sys(NULL,0,"git diff-index --quiet HEAD"))) { + char buf[256], now[256]; time_t now_t=time(NULL); struct tm *now_tm; + if (!(now_tm=gmtime(&now_t))) return 1; + strftime(now,sizeof(now),"%a, %d %b %Y %H:%M:%S Z",now_tm); + snprintf(buf,sizeof(buf),"%s; unclean git build on %s",xver,now); + strncpy(xver,buf,sizeof(xver)); + } + printf("%s\n",xver); + return 0; +} + +int main(int argc, char **argv) { + if (argc > 1 && !strcasecmp(argv[1],"-h")) + return print_human_version(); + else + return print_version(); +} + diff --git a/configure.in b/configure.in index 514a9151e4..899b0b83c2 100644 --- a/configure.in +++ b/configure.in @@ -8,6 +8,7 @@ AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [2]) AC_SUBST(SWITCH_VERSION_MICRO, [0]) AC_SUBST(SWITCH_VERSION_REVISION, [-rc2]) +AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [-rc2]) AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template]) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index 3aa6bb3441..059def200e 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -98,15 +98,18 @@ parse_version () { } set_fs_ver () { - local ver="$1" major="$2" minor="$3" micro="$4" rev="$5" + local ver="$1" major="$2" minor="$3" micro="$4" rev="$5" hrev="$6" sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$ver\2|" \ -i configure.in if [ -n "$rev" ]; then + [ -n "$hrev" ] || hrev="$rev" sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, \[\).*\(\])\)|\1$hrev\2|" \ -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ + -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN\)|\1|" \ -i configure.in fi } diff --git a/scripts/dailys.sh b/scripts/dailys.sh index 9d0e639cf5..430de62d22 100755 --- a/scripts/dailys.sh +++ b/scripts/dailys.sh @@ -44,7 +44,9 @@ sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ if [ -n "$rev" ]; then sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, \[\).*\(\])\)|\1$rev\2|" \ -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ + -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN\)|\1|" \ -i configure.in fi diff --git a/src/include/switch_version.h.cmake b/src/include/switch_version.h.cmake index 7cec6489b3..c722c2221d 100644 --- a/src/include/switch_version.h.cmake +++ b/src/include/switch_version.h.cmake @@ -41,7 +41,9 @@ extern "C" { #define SWITCH_VERSION_MINOR "@freeswitch_MINOR_VERSION@" #define SWITCH_VERSION_MICRO "@freeswitch_PATCH_LEVEL@" #define SWITCH_VERSION_REVISION "@Project_WC_REVISION@" +#define SWITCH_VERSION_REVISION_HUMAN "@Project_WC_REVISION@" #define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION +#define SWITCH_VERSION_FULL_HUMAN SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION_HUMAN #ifdef __cplusplus } diff --git a/src/include/switch_version.h.template b/src/include/switch_version.h.template index e0c13811d8..dfec6e091e 100644 --- a/src/include/switch_version.h.template +++ b/src/include/switch_version.h.template @@ -41,7 +41,9 @@ extern "C" { #define SWITCH_VERSION_MINOR "@SWITCH_VERSION_MINOR@" #define SWITCH_VERSION_MICRO "@SWITCH_VERSION_MICRO@" #define SWITCH_VERSION_REVISION "@SWITCH_VERSION_REVISION@" +#define SWITCH_VERSION_REVISION_HUMAN "@SWITCH_VERSION_REVISION_HUMAN@" #define SWITCH_VERSION_FULL SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION +#define SWITCH_VERSION_FULL_HUMAN SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO SWITCH_VERSION_REVISION_HUMAN #ifdef __cplusplus } diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 21a1cb3138..1cde9b30ce 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -285,7 +285,7 @@ SWITCH_STANDARD_API(shutdown_function) SWITCH_STANDARD_API(version_function) { - stream->write_function(stream, "FreeSWITCH Version %s\n", SWITCH_VERSION_FULL); + stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN); return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch.c b/src/switch.c index 4f25701671..e1b602356e 100644 --- a/src/switch.c +++ b/src/switch.c @@ -577,7 +577,7 @@ int main(int argc, char *argv[]) } else if (!strcmp(local_argv[x], "-version")) { - fprintf(stdout, "FreeSWITCH version: %s\n", SWITCH_VERSION_FULL); + fprintf(stdout, "FreeSWITCH version: %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN); exit(EXIT_SUCCESS); } #endif diff --git a/src/switch_core.c b/src/switch_core.c index 789b2d2c12..c00f13ab78 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1959,7 +1959,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, - "\nFreeSWITCH Version %s Started.\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", SWITCH_VERSION_FULL, + "\nFreeSWITCH Version %s (%s) Started.\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", + SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN, switch_core_session_limit(0), switch_core_sessions_per_second(0), switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled"); From e3a6366782ae644d0e32662313035bc37ed1a823 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 20 Jul 2012 11:17:22 -0500 Subject: [PATCH 0773/1057] FS-4420 --resolve --- src/mod/endpoints/mod_sofia/sofia_presence.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5c1f2d2442..8a6b1297bc 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2846,7 +2846,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (!zstr(op)) { //switch_snprintf(status_line, sizeof(status_line), "%sing", what); //} else { - switch_snprintf(status_line, sizeof(status_line), "%s %s", what, op); + if (sofia_test_pflag(profile, PFLAG_PRESENCE_PRIVACY)) { + switch_snprintf(status_line, sizeof(status_line), "%s", what); + } else { + switch_snprintf(status_line, sizeof(status_line), "%s %s", what, op); + } } rpid = "on-the-phone"; @@ -2875,7 +2879,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (!term && !strcmp(status, "hold")) { rpid = "on-the-phone"; if (!zstr(op)) { - switch_snprintf(status_line, sizeof(status_line), "Hold %s", op); + if (sofia_test_pflag(profile, PFLAG_PRESENCE_PRIVACY)) { + switch_snprintf(status_line, sizeof(status_line), "Hold"); + } else { + switch_snprintf(status_line, sizeof(status_line), "Hold %s", op); + } force_status = 1; } } From 9fe08675a1d3f0a8ba9c777befed7d6cc8a921f9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 20 Jul 2012 12:11:02 -0500 Subject: [PATCH 0774/1057] add tags to allow crypto in avp --- src/mod/endpoints/mod_sofia/mod_sofia.h | 3 ++- src/mod/endpoints/mod_sofia/sofia.c | 6 ++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 11 +++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5782fa04d6..5ef35315e7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -279,7 +279,8 @@ typedef enum { PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1), PFLAG_NDLB_SENDRECV_IN_SESSION = (1 << 2), PFLAG_NDLB_ALLOW_BAD_IANANAME = (1 << 3), - PFLAG_NDLB_ALLOW_NONDUP_SDP = (1 << 4) + PFLAG_NDLB_ALLOW_NONDUP_SDP = (1 << 4), + PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP = (1 << 5) } sofia_NDLB_t; typedef enum { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e331e6d4f6..d7758e7371 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3456,6 +3456,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { profile->ndlb &= ~PFLAG_NDLB_ALLOW_BAD_IANANAME; } + } else if (!strcasecmp(var, "NDLB-allow-crypto-in-avp")) { + if (switch_true(val)) { + profile->ndlb |= PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP; + } else { + profile->ndlb &= ~PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP; + } } else if (!strcasecmp(var, "NDLB-allow-nondup-sdp")) { if (switch_true(val)) { profile->ndlb |= PFLAG_NDLB_ALLOW_NONDUP_SDP; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 878bf73a7f..dd8a365f88 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4831,10 +4831,13 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) { int crypto_tag; - if (m->m_proto != sdp_proto_srtp) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n"); - match = 0; - goto done; + if (!(tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP) && + !switch_true(switch_channel_get_variable(tech_pvt->channel, "sip_allow_crypto_in_sdp"))) { + if (m->m_proto != sdp_proto_srtp) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n"); + match = 0; + goto done; + } } crypto = attr->a_value; From b5f74435249c983cd705b48bcad5067679187758 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 21 Jul 2012 04:05:40 +0800 Subject: [PATCH 0775/1057] Started introducing T.42 JPEG support for FAXing, but its not plumbed into the FAX engine yet. --- libs/spandsp/src/Makefile.am | 11 +- libs/spandsp/src/spandsp.h.in | 2 +- libs/spandsp/src/spandsp/expose.h | 2 +- libs/spandsp/src/spandsp/private/t42.h | 86 ++ libs/spandsp/src/spandsp/t42.h | 158 ++++ libs/spandsp/src/t42.c | 1199 ++++++++++++++++++++++++ libs/spandsp/tests/Makefile.am | 4 + libs/spandsp/tests/t42_tests.c | 625 ++++++++++++ 8 files changed, 2081 insertions(+), 6 deletions(-) create mode 100644 libs/spandsp/src/spandsp/private/t42.h create mode 100644 libs/spandsp/src/spandsp/t42.h create mode 100644 libs/spandsp/src/t42.c create mode 100644 libs/spandsp/tests/t42_tests.c diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index 039c8a6c9c..685e3d9328 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -143,10 +143,6 @@ libspandsp_la_SOURCES = ademco_contactid.c \ super_tone_rx.c \ super_tone_tx.c \ swept_tone.c \ - t4_t6_decode.c \ - t4_t6_encode.c \ - t4_rx.c \ - t4_tx.c \ t30.c \ t30_api.c \ t30_logging.c \ @@ -156,6 +152,11 @@ libspandsp_la_SOURCES = ademco_contactid.c \ t38_gateway.c \ t38_non_ecm_buffer.c \ t38_terminal.c \ + t4_t6_decode.c \ + t4_t6_encode.c \ + t4_rx.c \ + t4_tx.c \ + t42.c \ t81_t82_arith_coding.c \ t85_decode.c \ t85_encode.c \ @@ -246,6 +247,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \ spandsp/t4_tx.h \ spandsp/t4_t6_decode.h \ spandsp/t4_t6_encode.h \ + spandsp/t42.h \ spandsp/t81_t82_arith_coding.h \ spandsp/t85.h \ spandsp/telephony.h \ @@ -312,6 +314,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.h \ spandsp/private/t4_tx.h \ spandsp/private/t4_t6_decode.h \ spandsp/private/t4_t6_encode.h \ + spandsp/private/t42.h \ spandsp/private/t81_t82_arith_coding.h \ spandsp/private/t85.h \ spandsp/private/time_scale.h \ diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index 0cb5fd3a73..0b1f7aec9b 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -109,7 +109,7 @@ #include #include #include -/*#include */ +#include /*#include */ #include #include diff --git a/libs/spandsp/src/spandsp/expose.h b/libs/spandsp/src/spandsp/expose.h index f4696d2688..2f90c7f2d4 100644 --- a/libs/spandsp/src/spandsp/expose.h +++ b/libs/spandsp/src/spandsp/expose.h @@ -80,7 +80,7 @@ #include #include #include -/*#include */ +#include /*#include */ #include #include diff --git a/libs/spandsp/src/spandsp/private/t42.h b/libs/spandsp/src/spandsp/private/t42.h new file mode 100644 index 0000000000..7dedfa7ee1 --- /dev/null +++ b/libs/spandsp/src/spandsp/private/t42.h @@ -0,0 +1,86 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * private/t42.h - ITU T.42 JPEG for FAX image processing + * + * Written by Steve Underwood + * + * Copyright (C) 2011 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if !defined(_SPANDSP_PRIVATE_T42_H_) +#define _SPANDSP_PRIVATE_T42_H_ + +struct lab_params_s +{ + /* Lab gamut */ + float range_L; + float range_a; + float range_b; + float offset_L; + float offset_a; + float offset_b; + int ab_are_signed; + + /* Illuminant */ + float x_n; + float y_n; + float z_n; +}; + +/* State of a working instance of the T.42 JPEG FAX encoder */ +struct t42_encode_state_s +{ + /*! \brief Callback function to read a row of pixels from the image source. */ + t4_row_read_handler_t row_read_handler; + /*! \brief Opaque pointer passed to row_read_handler. */ + void *row_read_user_data; + + lab_params_t lab_params; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +/* State of a working instance of the T.42 JPEG FAX decoder */ +struct t42_decode_state_s +{ + /*! A callback routine to handle decoded pixel rows */ + t4_row_write_handler_t row_write_handler; + /*! An opaque pointer passed to row_write_handler() */ + void *row_write_user_data; + /*! A callback routine to handle decoded comments */ + t4_row_write_handler_t comment_handler; + /*! An opaque pointer passed to comment_handler() */ + void *comment_user_data; + + lab_params_t lab_params; + + /*! The contents for a COMMENT marker segment, to be added to the + image at the next opportunity. This is set to NULL when nothing is + pending. */ + uint8_t *comment; + /*! Length of data pointed to by comment */ + size_t comment_len; + + /*! \brief Error and flow logging control */ + logging_state_t logging; +}; + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/t42.h b/libs/spandsp/src/spandsp/t42.h new file mode 100644 index 0000000000..d6785cba23 --- /dev/null +++ b/libs/spandsp/src/spandsp/t42.h @@ -0,0 +1,158 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t42.h - ITU T.42 JPEG for FAX image processing + * + * Written by Steve Underwood + * + * Copyright (C) 2011 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_SPANDSP_T42_H_) +#define _SPANDSP_T42_H_ + +/*! \page t42_page T.42 (JPEG for FAX) image compression and decompression + +\section t42_page_sec_1 What does it do? + +\section t42_page_sec_1 How does it work? +*/ + +/*! State of a working instance of the T.42 encoder */ +typedef struct t42_encode_state_s t42_encode_state_t; + +/*! State of a working instance of the T.42 decoder */ +typedef struct t42_decode_state_s t42_decode_state_t; + +typedef struct lab_params_s lab_params_t; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srgb[], int pixels); + +SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t lab[], int pixels); + +SPAN_DECLARE(void) set_lab_illuminant(lab_params_t *s, float new_xn, float new_yn, float new_zn); + +SPAN_DECLARE(void) set_lab_gamut(lab_params_t *s, int L_min, int L_max, int a_min, int a_max, int b_min, int b_max, int ab_are_signed); + +SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, int a_Q, int b_P, int b_Q); + +SPAN_DECLARE(void) set_illuminant_from_code(lab_params_t *s, const uint8_t code[4]); + +SPAN_DECLARE(void) set_gamut_from_code(lab_params_t *s, const uint8_t code[12]); + +SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes); + +SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes); + +SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes); + +SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes); + +SPAN_DECLARE(int) t42_itulab_to_srgb(lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height, char *emsg, size_t max_emsg_bytes); + +SPAN_DECLARE(void) t42_encode_set_options(t42_encode_state_t *s, + uint32_t l0, + int mx, + int options); + +SPAN_DECLARE(int) t42_encode_set_image_width(t42_encode_state_t *s, uint32_t image_width); + +SPAN_DECLARE(int) t42_encode_set_image_length(t42_encode_state_t *s, uint32_t length); + +SPAN_DECLARE(void) t42_encode_abort(t42_encode_state_t *s); + +SPAN_DECLARE(void) t42_encode_comment(t42_encode_state_t *s, const uint8_t comment[], size_t len); + +SPAN_DECLARE(int) t42_encode_get_byte(t42_encode_state_t *s); + +SPAN_DECLARE(int) t42_encode_get_chunk(t42_encode_state_t *s, uint8_t buf[], int max_len); + +SPAN_DECLARE(uint32_t) t42_encode_get_image_width(t42_encode_state_t *s); + +SPAN_DECLARE(uint32_t) t42_encode_get_image_length(t42_encode_state_t *s); + +SPAN_DECLARE(int) t42_encode_get_compressed_image_size(t42_encode_state_t *s); + +SPAN_DECLARE(int) t42_encode_set_row_read_handler(t42_encode_state_t *s, + t4_row_read_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t42_encode_restart(t42_encode_state_t *s, uint32_t image_width, uint32_t image_length); + +SPAN_DECLARE(t42_encode_state_t *) t42_encode_init(t42_encode_state_t *s, + uint32_t image_width, + uint32_t image_length, + t4_row_read_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t42_encode_release(t42_encode_state_t *s); + +SPAN_DECLARE(int) t42_encode_free(t42_encode_state_t *s); + +SPAN_DECLARE(void) t42_decode_rx_status(t42_decode_state_t *s, int status); + +SPAN_DECLARE(int) t42_decode_put_byte(t42_decode_state_t *s, int byte); + +SPAN_DECLARE(int) t42_decode_put_chunk(t42_decode_state_t *s, + const uint8_t data[], + size_t len); + +SPAN_DECLARE(int) t42_decode_set_row_write_handler(t42_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t42_decode_set_comment_handler(t42_decode_state_t *s, + uint32_t max_comment_len, + t4_row_write_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t42_decode_set_image_size_constraints(t42_decode_state_t *s, + uint32_t max_xd, + uint32_t max_yd); + +SPAN_DECLARE(uint32_t) t42_decode_get_image_width(t42_decode_state_t *s); + +SPAN_DECLARE(uint32_t) t42_decode_get_image_length(t42_decode_state_t *s); + +SPAN_DECLARE(int) t42_decode_get_compressed_image_size(t42_decode_state_t *s); + +SPAN_DECLARE(int) t42_decode_new_plane(t42_decode_state_t *s); + +SPAN_DECLARE(int) t42_decode_restart(t42_decode_state_t *s); + +SPAN_DECLARE(t42_decode_state_t *) t42_decode_init(t42_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data); + +SPAN_DECLARE(int) t42_decode_release(t42_decode_state_t *s); + +SPAN_DECLARE(int) t42_decode_free(t42_decode_state_t *s); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t42.c b/libs/spandsp/src/t42.c new file mode 100644 index 0000000000..608341fd4c --- /dev/null +++ b/libs/spandsp/src/t42.c @@ -0,0 +1,1199 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t42.c - ITU T.42 JPEG for FAX image processing + * + * Written by Steve Underwood + * + * Copyright (C) 2011 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif +#include +#include "floating_fudge.h" +#include +#include + +#include "spandsp/telephony.h" +#include "spandsp/logging.h" +#include "spandsp/async.h" +#include "spandsp/timezone.h" +#include "spandsp/t4_rx.h" +#include "spandsp/t4_tx.h" +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#include "spandsp/t42.h" + +#include "spandsp/private/logging.h" +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#include "spandsp/private/t42.h" + +#define T42_USE_LUTS + +#include "cielab_luts.h" + +typedef struct +{ + float L; + float a; + float b; +} cielab_t; + +typedef struct +{ + uint8_t tag[5]; + const char *name; + float xn; + float yn; + float zn; +} illuminant_t; + +typedef struct +{ + jmp_buf escape; + char error_message[JMSG_LENGTH_MAX]; +} escape_route_t; + +static const illuminant_t illuminants[] = +{ + {"\0D50", "CIE D50/2°", 96.422f, 100.000f, 82.521f}, + {"", "CIE D50/10°", 96.720f, 100.000f, 81.427f}, + {"", "CIE D55/2°", 95.682f, 100.000f, 92.149f}, + {"", "CIE D55/10°", 95.799f, 100.000f, 90.926f}, + {"\0D65", "CIE D65/2°", 95.047f, 100.000f, 108.883f}, + {"", "CIE D65/10°", 94.811f, 100.000f, 107.304f}, + {"\0D75", "CIE D75/2°", 94.972f, 100.000f, 122.638f}, + {"", "CIE D75/10°", 94.416f, 100.000f, 120.641f}, + {"\0\0F2", "F02/2°", 99.186f, 100.000f, 67.393f}, + {"", "F02/10°", 103.279f, 100.000f, 69.027f}, + {"\0\0F7", "F07/2°", 95.041f, 100.000f, 108.747f}, + {"", "F07/10°", 95.792f, 100.000f, 107.686f}, + {"\0F11", "F11/2°", 100.962f, 100.000f, 64.350f}, + {"", "F11/10°", 103.863f, 100.000f, 65.607f}, + {"\0\0SA", "A/2°", 109.850f, 100.000f, 35.585f}, + {"", "A/10°", 111.144f, 100.000f, 35.200f}, + {"\0\0SC", "C/2°", 98.074f, 100.000f, 118.232f}, + {"", "C/10°", 97.285f, 100.000f, 116.145f}, + {"", "", 0.000f, 0.000f, 0.000f} +}; + +/* This is the error catcher */ +static struct jpeg_error_mgr error_handler; + +static __inline__ uint16_t pack_16(const uint8_t *s) +{ + uint16_t value; + + value = ((uint16_t) s[0] << 8) | (uint16_t) s[1]; + return value; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ uint32_t pack_32(const uint8_t *s) +{ + uint32_t value; + + value = ((uint32_t) s[0] << 24) | ((uint32_t) s[1] << 16) | ((uint32_t) s[2] << 8) | (uint32_t) s[3]; + return value; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int unpack_16(uint8_t *s, uint16_t value) +{ + s[0] = (value >> 8) & 0xFF; + s[1] = value & 0xFF; + return sizeof(uint16_t); +} +/*- End of function --------------------------------------------------------*/ + +/* Error handler for IJG library */ +static void jpg_error_exit(j_common_ptr cinfo) +{ + escape_route_t *escape; + + escape = (escape_route_t *) cinfo->client_data; + (*cinfo->err->format_message)(cinfo, escape->error_message); + longjmp(escape->escape, 1); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) set_lab_illuminant(lab_params_t *s, float new_xn, float new_yn, float new_zn) +{ + if (new_yn > 10.0f) + { + s->x_n = new_xn/100.0f; + s->y_n = new_yn/100.0f; + s->z_n = new_zn/100.0f; + } + else + { + s->x_n = new_xn; + s->y_n = new_yn; + s->z_n = new_zn; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) set_lab_gamut(lab_params_t *s, int L_min, int L_max, int a_min, int a_max, int b_min, int b_max, int ab_are_signed) +{ + s->range_L = L_max - L_min; + s->range_a = a_max - a_min; + s->range_b = b_max - b_min; + + s->offset_L = -256.0f*L_min/s->range_L; + s->offset_a = -256.0f*a_min/s->range_a; + s->offset_b = -256.0f*b_min/s->range_b; + + s->range_L /= (256.0f - 1.0f); + s->range_a /= (256.0f - 1.0f); + s->range_b /= (256.0f - 1.0f); + + s->ab_are_signed = ab_are_signed; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, int a_Q, int b_P, int b_Q) +{ + s->range_L = L_Q/(256.0f - 1.0f); + s->range_a = a_Q/(256.0f - 1.0f); + s->range_b = b_Q/(256.0f - 1.0f); + + s->offset_L = L_P; + s->offset_a = a_P; + s->offset_b = b_P; + + s->ab_are_signed = FALSE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) set_illuminant_from_code(lab_params_t *s, const uint8_t code[4]) +{ + int i; + int colour_temp; + + if (code[0] == 'C' && code[1] == 'T') + { + colour_temp = pack_16(&code[2]); + printf("Illuminant colour temp %dK\n", colour_temp); + return; + } + for (i = 0; illuminants[i].name[0]; i++) + { + if (memcmp(code, illuminants[i].tag, 4) == 0) + { + printf("Illuminant %s\n", illuminants[i].name); + set_lab_illuminant(s, illuminants[i].xn, illuminants[i].yn, illuminants[i].zn); + break; + } + } + if (illuminants[i].name[0] == '\0') + printf("Unrecognised illuminant 0x%x 0x%x 0x%x 0x%x\n", code[0], code[1], code[2], code[3]); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) set_gamut_from_code(lab_params_t *s, const uint8_t code[12]) +{ + int i; + int val[6]; + + for (i = 0; i < 6; i++) + val[i] = pack_16(&code[2*i]); + printf("Gamut L=[%d,%d], a*=[%d,%d], b*=[%d,%d]\n", + val[0], + val[1], + val[2], + val[3], + val[4], + val[5]); + set_lab_gamut2(s, val[0], val[1], val[2], val[3], val[4], val[5]); +} +/*- End of function --------------------------------------------------------*/ + +static int isITUfax(lab_params_t *s, jpeg_saved_marker_ptr ptr) +{ + const uint8_t *data; + int ok; + int val[2]; + int i; + + ok = FALSE; + while (ptr) + { + if (ptr->marker == (JPEG_APP0 + 1) && ptr->data_length >= 6) + { + data = (const uint8_t *) ptr->data; + if (strncmp((const char *) data, "G3FAX", 5) == 0) + { + switch (data[5]) + { + case 0: + for (i = 0; i < 2; i++) + val[i] = pack_16(&data[6 + 2*i]); + printf("Version %d, resolution %d dpi\n", val[0], val[1]); + ok = TRUE; + break; + case 1: + printf("Set gamut\n"); + set_gamut_from_code(s, &data[6]); + ok = TRUE; + break; + case 2: + printf("Set illuminant\n"); + set_illuminant_from_code(s, &data[6]); + ok = TRUE; + break; + case 3: + /* Colour palette table */ + printf("Set colour palette\n"); + val[0] = pack_16(&data[6]); + printf("Colour palette %d\n", val[0]); + break; + } + } + } + + ptr = ptr->next; + } + + return ok; +} +/*- End of function --------------------------------------------------------*/ + +static void SetITUFax(j_compress_ptr cinfo) +{ + uint8_t marker[10] = + { + 'G', '3', 'F', 'A', 'X', '\x00', '\x07', '\xCA', '\x00', '\x00' + }; + + unpack_16(marker + 8, 200); + + jpeg_write_marker(cinfo, (JPEG_APP0 + 1), marker, 10); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void itu_to_lab(lab_params_t *s, cielab_t *lab, const uint8_t in[3]) +{ + uint8_t a; + uint8_t b; + + /* T.4 E.6.4 */ + lab->L = s->range_L*(in[0] - s->offset_L); + a = in[1]; + b = in[2]; + if (s->ab_are_signed) + { + a += 128; + b += 128; + } + lab->a = s->range_a*(a - s->offset_a); + lab->b = s->range_b*(b - s->offset_b); +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ void lab_to_itu(lab_params_t *s, uint8_t out[3], const cielab_t *lab) +{ + float val; + + /* T.4 E.6.4 */ + val = floorf(lab->L/s->range_L + s->offset_L); + out[0] = (uint8_t) (val < 0.0) ? 0 : (val < 256.0) ? val : 255; + val = floorf(lab->a/s->range_a + s->offset_a); + out[1] = (uint8_t) (val < 0.0) ? 0 : (val < 256.0) ? val : 255; + val = floorf(lab->b/s->range_b + s->offset_b); + out[2] = (uint8_t) (val < 0.0) ? 0 : (val < 256.0) ? val : 255; + if (s->ab_are_signed) + { + out[1] -= 128; + out[2] -= 128; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srgb[], int pixels) +{ + float x; + float y; + float z; + float r; + float g; + float b; + float xx; + float yy; + float zz; + cielab_t l; + int i; + + for (i = 0; i < pixels; i++) + { +#if defined(T42_USE_LUTS) + r = sRGB_to_linear[srgb[0]]; + g = sRGB_to_linear[srgb[1]]; + b = sRGB_to_linear[srgb[2]]; +#else + r = srgb[0]/256.0f; + g = srgb[1]/256.0f; + b = srgb[2]/256.0f; + + /* sRGB to linear RGB */ + r = (r > 0.04045f) ? powf((r + 0.055f)/1.055f, 2.4f) : r/12.92f; + g = (g > 0.04045f) ? powf((g + 0.055f)/1.055f, 2.4f) : g/12.92f; + b = (b > 0.04045f) ? powf((b + 0.055f)/1.055f, 2.4f) : b/12.92f; +#endif + + /* Linear RGB to XYZ */ + x = 0.4124f*r + 0.3576f*g + 0.1805f*b; + y = 0.2126f*r + 0.7152f*g + 0.0722f*b; + z = 0.0193f*r + 0.1192f*g + 0.9505f*b; + + /* Normalise for the illuminant */ + x /= s->x_n; + y /= s->y_n; + z /= s->z_n; + + /* XYZ to Lab */ + xx = (x <= 0.008856f) ? (7.787f*x + 0.1379f) : cbrtf(x); + yy = (y <= 0.008856f) ? (7.787f*y + 0.1379f) : cbrtf(y); + zz = (z <= 0.008856f) ? (7.787f*z + 0.1379f) : cbrtf(z); + l.L = 116.0f*yy - 16.0f; + l.a = 500.0f*(xx - yy); + l.b = 200.0f*(yy - zz); + + lab_to_itu(s, lab, &l); + + srgb += 3; + lab += 3; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t lab[], int pixels) +{ + float x; + float y; + float z; + float r; + float g; + float b; + float ll; + cielab_t l; + int val; + int i; + + for (i = 0; i < pixels; i++) + { + itu_to_lab(s, &l, lab); + + /* Lab to XYZ */ + ll = (1.0f/116.0f)*(l.L + 16.0f); + y = ll; + y = (y <= 0.2068f) ? (0.1284f*(y - 0.1379f)) : y*y*y; + x = ll + (1.0f/500.0f)*l.a; + x = (x <= 0.2068f) ? (0.1284f*(x - 0.1379f)) : x*x*x; + z = ll - (1.0f/200.0f)*l.b; + z = (z <= 0.2068f) ? (0.1284f*(z - 0.1379f)) : z*z*z; + + /* Normalise for the illuminant */ + x *= s->x_n; + y *= s->y_n; + z *= s->z_n; + + /* XYZ to linear RGB */ + r = 3.2406f*x - 1.5372f*y - 0.4986f*z; + g = -0.9689f*x + 1.8758f*y + 0.0415f*z; + b = 0.0557f*x - 0.2040f*y + 1.0570f*z; + +#if defined(T42_USE_LUTS) + val = r*4096.0f; + srgb[0] = linear_to_sRGB[(val < 0) ? 0 : (val < 4095) ? val : 4095]; + val = g*4096.0f; + srgb[1] = linear_to_sRGB[(val < 0) ? 0 : (val < 4095) ? val : 4095]; + val = b*4096.0f; + srgb[2] = linear_to_sRGB[(val < 0) ? 0 : (val < 4095) ? val : 4095]; +#else + /* Linear RGB to sRGB */ + r = (r > 0.0031308f) ? (1.055f*powf(r, 1.0f/2.4f) - 0.055f) : r*12.92f; + g = (g > 0.0031308f) ? (1.055f*powf(g, 1.0f/2.4f) - 0.055f) : g*12.92f; + b = (b > 0.0031308f) ? (1.055f*powf(b, 1.0f/2.4f) - 0.055f) : b*12.92f; + + r = floorf(r*256.0f); + g = floorf(g*256.0f); + b = floorf(b*256.0f); + + srgb[0] = (r < 0) ? 0 : (r <= 255) ? r : 255; + srgb[1] = (g < 0) ? 0 : (g <= 255) ? g : 255; + srgb[2] = (b < 0) ? 0 : (b <= 255) ? b : 255; +#endif + srgb += 3; + lab += 3; + } +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes) +{ + struct jpeg_decompress_struct decompressor; + struct jpeg_compress_struct compressor; + char *outptr; + size_t outsize; + FILE *in; + FILE *out; + int m; + JSAMPROW scan_line_in; + JSAMPROW scan_line_out; + escape_route_t escape; + + escape.error_message[0] = '\0'; + emsg[0] = '\0'; + +#if defined(HAVE_OPEN_MEMSTREAM) + in = fmemopen(src, srclen, "r"); +#else + in = tmpfile(); + fwrite(src, 1, srclen, in); + rewind(in); +#endif + if (in == NULL) + { + if (emsg[0] == '\0') + strcpy(emsg, "Failed to fmemopen()."); + return FALSE; + } + +#if defined(HAVE_OPEN_MEMSTREAM) + out = open_memstream(&outptr, &outsize); +#else + out = tmpfile(); +#endif + if (out == NULL) + { + if (emsg[0] == '\0') + strcpy(emsg, "Failed to open_memstream()."); + return FALSE; + } + + if (setjmp(escape.escape)) + { + strncpy(emsg, escape.error_message, max_emsg_bytes - 1); + emsg[max_emsg_bytes - 1] = '\0'; + if (emsg[0] == '\0') + strcpy(emsg, "Unspecified libjpeg error."); + return FALSE; + } + + /* Create input decompressor. */ + decompressor.err = jpeg_std_error(&error_handler); + decompressor.client_data = (void *) &escape; + error_handler.error_exit = jpg_error_exit; + error_handler.output_message = jpg_error_exit; + + jpeg_create_decompress(&decompressor); + jpeg_stdio_src(&decompressor, in); + + /* Needed in the case of ITU Lab input */ + for (m = 0; m < 16; m++) + jpeg_save_markers(&decompressor, JPEG_APP0 + m, 0xFFFF); + + /* Rewind the file */ + if (fseek(in, 0, SEEK_SET) != 0) + return FALSE; + + /* Take the header */ + jpeg_read_header(&decompressor, TRUE); + + /* Now we can force the input colorspace. For ITULab, we will use YCbCr as a "don't touch" marker */ + decompressor.out_color_space = JCS_YCbCr; + + /* Sanity check and parameter check */ + if (!isITUfax(s, decompressor.marker_list)) + { + if (emsg[0] == '\0') + strcpy(emsg, "Is not ITUFAX."); + return FALSE; + } + + /* Create compressor */ + compressor.err = jpeg_std_error(&error_handler); + compressor.client_data = (void *) &escape; + error_handler.error_exit = jpg_error_exit; + error_handler.output_message = jpg_error_exit; + + jpeg_create_compress(&compressor); + jpeg_stdio_dest(&compressor, out); + + /* Force the destination color space */ + compressor.in_color_space = JCS_RGB; + compressor.input_components = 3; + + jpeg_set_defaults(&compressor); + //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + + /* Copy size, resolution, etc */ + jpeg_copy_critical_parameters(&decompressor, &compressor); + + /* We need to keep these */ + compressor.density_unit = decompressor.density_unit; + compressor.X_density = decompressor.X_density; + compressor.Y_density = decompressor.Y_density; + + jpeg_start_decompress(&decompressor); + jpeg_start_compress(&compressor, TRUE); + + if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL) + return FALSE; + + if ((scan_line_out = (JSAMPROW) malloc(compressor.image_width*compressor.num_components)) == NULL) + { + free(scan_line_in); + return FALSE; + } + + while (decompressor.output_scanline < decompressor.output_height) + { + jpeg_read_scanlines(&decompressor, &scan_line_in, 1); + lab_to_srgb(s, scan_line_out, scan_line_in, decompressor.output_width); + jpeg_write_scanlines(&compressor, &scan_line_out, 1); + } + free(scan_line_in); + free(scan_line_out); + jpeg_finish_decompress(&decompressor); + jpeg_finish_compress(&compressor); + jpeg_destroy_decompress(&decompressor); + jpeg_destroy_compress(&compressor); + fclose(in); + fclose(out); + + *dst = outptr; + *dstlen = outsize; + + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes) +{ + struct jpeg_decompress_struct decompressor; + struct jpeg_compress_struct compressor; + char *outptr; + size_t outsize; + FILE *in; + FILE *out; + int m; + JSAMPROW scan_line_in; + JSAMPROW scan_line_out; + escape_route_t escape; + + escape.error_message[0] = '\0'; + emsg[0] = '\0'; + +#if defined(HAVE_OPEN_MEMSTREAM) + in = fmemopen(src, srclen, "r"); +#else + in = tmpfile(); + fwrite(src, 1, srclen, in); + rewind(in); +#endif + if (in == NULL) + { + if (emsg[0] == '\0') + strcpy(emsg, "Failed to fmemopen()."); + return FALSE; + } + +#if defined(HAVE_OPEN_MEMSTREAM) + out = open_memstream(&outptr, &outsize); +#else + out = tmpfile(); +#endif + if (out == NULL) + { + if (emsg[0] == '\0') + strcpy(emsg, "Failed to open_memstream()."); + return FALSE; + } + + if (setjmp(escape.escape)) + { + strncpy(emsg, escape.error_message, max_emsg_bytes - 1); + emsg[max_emsg_bytes - 1] = '\0'; + return FALSE; + } + + decompressor.err = jpeg_std_error(&error_handler); + decompressor.client_data = (void *) &escape; + error_handler.error_exit = jpg_error_exit; + error_handler.output_message = jpg_error_exit; + + jpeg_create_decompress(&decompressor); + jpeg_stdio_src(&decompressor, in); + + /* Needed in the case of ITU Lab input */ + for (m = 0; m < 16; m++) + jpeg_save_markers(&decompressor, JPEG_APP0 + m, 0xFFFF); + + /* Rewind the file */ + if (fseek(in, 0, SEEK_SET) != 0) + return FALSE; + + /* Take the header */ + jpeg_read_header(&decompressor, TRUE); + + /* Now we can force the input colorspace. For ITULab, we will use YCbCr as a "don't touch" marker */ + decompressor.out_color_space = JCS_RGB; + + compressor.err = jpeg_std_error(&error_handler); + compressor.client_data = (void *) &escape; + error_handler.error_exit = jpg_error_exit; + error_handler.output_message = jpg_error_exit; + + jpeg_create_compress(&compressor); + jpeg_stdio_dest(&compressor, out); + + /* Force the destination color space */ + compressor.in_color_space = JCS_YCbCr; + compressor.input_components = 3; + + jpeg_set_defaults(&compressor); + //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + + jpeg_copy_critical_parameters(&decompressor, &compressor); + + /* We need to keep these */ + compressor.density_unit = decompressor.density_unit; + compressor.X_density = decompressor.X_density; + compressor.Y_density = decompressor.Y_density; + + jpeg_start_decompress(&decompressor); + jpeg_start_compress(&compressor, TRUE); + + SetITUFax(&compressor); + + if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL) + return FALSE; + + if ((scan_line_out = (JSAMPROW) malloc(compressor.image_width*compressor.num_components)) == NULL) + { + free(scan_line_in); + return FALSE; + } + + while (decompressor.output_scanline < decompressor.output_height) + { + jpeg_read_scanlines(&decompressor, &scan_line_in, 1); + srgb_to_lab(s, scan_line_out, scan_line_in, decompressor.output_width); + jpeg_write_scanlines(&compressor, &scan_line_out, 1); + } + + free(scan_line_in); + free(scan_line_out); + jpeg_finish_decompress(&decompressor); + jpeg_finish_compress(&compressor); + jpeg_destroy_decompress(&decompressor); + jpeg_destroy_compress(&compressor); + fclose(in); + fclose(out); + + *dst = outptr; + *dstlen = outsize; + + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes) +{ + struct jpeg_compress_struct compressor; + FILE *out; + char *outptr; + size_t outsize; + JSAMPROW scan_line_out; + JSAMPROW scan_line_in; + tsize_t pos; + escape_route_t escape; + + escape.error_message[0] = '\0'; + emsg[0] = '\0'; + +#if defined(HAVE_OPEN_MEMSTREAM) + out = open_memstream(&outptr, &outsize); +#else + out = tmpfile(); +#endif + if (out == NULL) + { + if (emsg[0] == '\0') + strcpy(emsg, "Failed to open_memstream()."); + return FALSE; + } + + if (setjmp(escape.escape)) + { + strncpy(emsg, escape.error_message, max_emsg_bytes - 1); + emsg[max_emsg_bytes - 1] = '\0'; + return FALSE; + } + + compressor.err = jpeg_std_error(&error_handler); + compressor.client_data = (void *) &escape; + error_handler.error_exit = jpg_error_exit; + error_handler.output_message = jpg_error_exit; + + jpeg_create_compress(&compressor); + jpeg_stdio_dest(&compressor, out); + + /* Force the destination color space */ + compressor.in_color_space = JCS_YCbCr; + compressor.input_components = 3; + + jpeg_set_defaults(&compressor); + //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + + /* Size, resolution, etc */ + compressor.image_width = width; + compressor.image_height = height; + + jpeg_start_compress(&compressor, TRUE); + + SetITUFax(&compressor); + + if ((scan_line_out = (JSAMPROW) malloc(compressor.image_width*compressor.num_components)) == NULL) + return FALSE; + + for (pos = 0; pos < srclen; pos += compressor.image_width*compressor.num_components) + { + scan_line_in = src + pos; + srgb_to_lab(s, scan_line_out, scan_line_in, compressor.image_width); + jpeg_write_scanlines(&compressor, &scan_line_out, 1); + } + + free(scan_line_out); + jpeg_finish_compress(&compressor); + jpeg_destroy_compress(&compressor); + fclose(out); + + *dst = outptr; + *dstlen = outsize; + + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes) +{ + struct jpeg_compress_struct compressor; + FILE *out; + char *outptr; + size_t outsize; + JSAMPROW scan_line_in; + tsize_t pos; + escape_route_t escape; + + escape.error_message[0] = '\0'; + emsg[0] = '\0'; + +#if defined(HAVE_OPEN_MEMSTREAM) + out = open_memstream(&outptr, &outsize); +#else + out = tmpfile(); +#endif + if (out == NULL) + { + if (emsg[0] == '\0') + strcpy(emsg, "Failed to open_memstream()."); + return FALSE; + } + + if (setjmp(escape.escape)) + { + strncpy(emsg, escape.error_message, max_emsg_bytes - 1); + emsg[max_emsg_bytes - 1] = '\0'; + return FALSE; + } + + compressor.err = jpeg_std_error(&error_handler); + compressor.client_data = (void *) &escape; + error_handler.error_exit = jpg_error_exit; + error_handler.output_message = jpg_error_exit; + + jpeg_create_compress(&compressor); + jpeg_stdio_dest(&compressor, out); + + /* Force the destination color space */ + compressor.in_color_space = JCS_YCbCr; + compressor.input_components = 3; + + jpeg_set_defaults(&compressor); + //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + + /* Size, resolution, etc */ + compressor.image_width = width; + compressor.image_height = height; + + jpeg_start_compress(&compressor, TRUE); + + SetITUFax(&compressor); + + for (pos = 0; pos < srclen; pos += compressor.image_width*compressor.num_components) + { + scan_line_in = src + pos; + jpeg_write_scanlines(&compressor, &scan_line_in, 1); + } + + jpeg_finish_compress(&compressor); + jpeg_destroy_compress(&compressor); + fclose(out); + + *dst = outptr; + *dstlen = outsize; + + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_itulab_to_srgb(lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height, char *emsg, size_t max_emsg_bytes) +{ + struct jpeg_decompress_struct decompressor; + JSAMPROW scan_line_out; + JSAMPROW scan_line_in; + tsize_t pos; + FILE *in; + int m; + escape_route_t escape; + + escape.error_message[0] = '\0'; + emsg[0] = '\0'; + +#if defined(HAVE_OPEN_MEMSTREAM) + in = fmemopen(src, srclen, "r"); +#else + in = tmpfile(); + fwrite(src, 1, srclen, in); + rewind(in); +#endif + if (in == NULL) + { + if (emsg[0] == '\0') + strcpy(emsg, "Failed to fmemopen()."); + return FALSE; + } + + if (setjmp(escape.escape)) + { + strncpy(emsg, escape.error_message, max_emsg_bytes - 1); + emsg[max_emsg_bytes - 1] = '\0'; + if (emsg[0] == '\0') + strcpy(emsg, "Unspecified libjpeg error."); + return FALSE; + } + /* Create input decompressor. */ + decompressor.err = jpeg_std_error(&error_handler); + decompressor.client_data = (void *) &escape; + error_handler.error_exit = jpg_error_exit; + error_handler.output_message = jpg_error_exit; + + jpeg_create_decompress(&decompressor); + jpeg_stdio_src(&decompressor, in); + + /* Needed in the case of ITU Lab input */ + for (m = 0; m < 16; m++) + jpeg_save_markers(&decompressor, JPEG_APP0 + m, 0xFFFF); + + /* Rewind the file */ + if (fseek(in, 0, SEEK_SET) != 0) + return FALSE; +printf("XXXX 10\n"); + /* Take the header */ + jpeg_read_header(&decompressor, FALSE); +printf("XXXX 11\n"); + /* Now we can force the input colorspace. For ITULab, we will use YCbCr as a "don't touch" marker */ + decompressor.out_color_space = JCS_YCbCr; +printf("XXXX 12\n"); + /* Sanity check and parameter check */ + if (!isITUfax(s, decompressor.marker_list)) + { + if (emsg[0] == '\0') + strcpy(emsg, "Is not ITUFAX."); + //return FALSE; + } +printf("XXXX 13\n"); + /* Copy size, resolution, etc */ + *width = decompressor.image_width; + *height = decompressor.image_height; + + jpeg_start_decompress(&decompressor); + + if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL) + return FALSE; + + for (pos = 0; decompressor.output_scanline < decompressor.output_height; pos += decompressor.output_width*decompressor.num_components) + { + scan_line_out = dst + pos; + jpeg_read_scanlines(&decompressor, &scan_line_in, 1); + lab_to_srgb(s, scan_line_out, scan_line_in, decompressor.output_width); + } + + free(scan_line_in); + jpeg_finish_decompress(&decompressor); + jpeg_destroy_decompress(&decompressor); + fclose(in); + + *dstlen = pos; + + return TRUE; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t42_encode_set_options(t42_encode_state_t *s, + uint32_t l0, + int mx, + int options) +{ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_set_image_width(t42_encode_state_t *s, uint32_t image_width) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_set_image_length(t42_encode_state_t *s, uint32_t length) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t42_encode_abort(t42_encode_state_t *s) +{ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t42_encode_comment(t42_encode_state_t *s, const uint8_t comment[], size_t len) +{ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_get_byte(t42_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_get_chunk(t42_encode_state_t *s, uint8_t buf[], int max_len) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t42_encode_get_image_width(t42_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t42_encode_get_image_length(t42_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_get_compressed_image_size(t42_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_set_row_read_handler(t42_encode_state_t *s, + t4_row_read_handler_t handler, + void *user_data) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_restart(t42_encode_state_t *s, uint32_t image_width, uint32_t image_length) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t42_encode_state_t *) t42_encode_init(t42_encode_state_t *s, + uint32_t image_width, + uint32_t image_length, + t4_row_read_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (t42_encode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.42"); + + s->row_read_handler = handler; + s->row_read_user_data = user_data; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_release(t42_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_encode_free(t42_encode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t42_decode_rx_status(t42_decode_state_t *s, int status) +{ +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_put_byte(t42_decode_state_t *s, int byte) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_put_chunk(t42_decode_state_t *s, + const uint8_t data[], + size_t len) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_set_row_write_handler(t42_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_set_comment_handler(t42_decode_state_t *s, + uint32_t max_comment_len, + t4_row_write_handler_t handler, + void *user_data) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_set_image_size_constraints(t42_decode_state_t *s, + uint32_t max_xd, + uint32_t max_yd) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t42_decode_get_image_width(t42_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(uint32_t) t42_decode_get_image_length(t42_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_get_compressed_image_size(t42_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_new_plane(t42_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_restart(t42_decode_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(t42_decode_state_t *) t42_decode_init(t42_decode_state_t *s, + t4_row_write_handler_t handler, + void *user_data) +{ + if (s == NULL) + { + if ((s = (t42_decode_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "T.42"); + + s->row_write_handler = handler; + s->row_write_user_data = user_data; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_release(t42_decode_state_t *s) +{ + if (s->comment) + { + free(s->comment); + s->comment = NULL; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t42_decode_free(t42_decode_state_t *s) +{ + int ret; + + ret = t42_decode_release(s); + free(s); + return ret; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/Makefile.am b/libs/spandsp/tests/Makefile.am index 2b5e97afb1..8a0503fe62 100644 --- a/libs/spandsp/tests/Makefile.am +++ b/libs/spandsp/tests/Makefile.am @@ -110,6 +110,7 @@ noinst_PROGRAMS = ademco_contactid_tests \ t38_non_ecm_buffer_tests \ t4_tests \ t4_t6_tests \ + t42_tests \ t81_t82_arith_coding_tests \ t85_tests \ time_scale_tests \ @@ -317,6 +318,9 @@ t4_tests_LDADD = $(LIBDIR) -lspandsp t4_t6_tests_SOURCES = t4_t6_tests.c t4_t6_tests_LDADD = $(LIBDIR) -lspandsp +t42_tests_SOURCES = t42_tests.c +t42_tests_LDADD = $(LIBDIR) -lspandsp + t81_t82_arith_coding_tests_SOURCES = t81_t82_arith_coding_tests.c t81_t82_arith_coding_tests_LDADD = $(LIBDIR) -lspandsp diff --git a/libs/spandsp/tests/t42_tests.c b/libs/spandsp/tests/t42_tests.c new file mode 100644 index 0000000000..1ccefed9f0 --- /dev/null +++ b/libs/spandsp/tests/t42_tests.c @@ -0,0 +1,625 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t42_tests.c - ITU T.42 JPEG for FAX image processing + * + * Written by Steve Underwood + * + * Copyright (C) 2011 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +/*! \page t42_tests_page T.42 tests +\section t42_tests_page_sec_1 What does it do +*/ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +//#if defined(WITH_SPANDSP_INTERNALS) +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +//#endif + +#include "spandsp.h" + +#define IN_FILE_NAME "../test-data/itu/t24/F21_200.TIF" +#define OUT_FILE_NAME "t42_tests_receive.tif" + +uint8_t data5[50000000]; +int data5_ptr = 0; +int plane = 0; +int bit_mask; + +uint8_t xxx[3*256]; + +lab_params_t lab_param; + +int write_row = 0; + +typedef struct +{ + float L; + float a; + float b; +} cielab_t; + +#if 0 +static void generate_luts(void) +{ + float r; + uint8_t srgb; + int i; + + printf("static const float srgb_to_linear[256] =\n"); + printf("{\n"); + for (i = 0; i < 256; i++) + { + /* Start with "i" as the sRGB value */ + r = i/256.0f; + + /* sRGB to Linear RGB */ + r = (r > 0.04045f) ? powf((r + 0.055f)/1.055f, 2.4f) : r/12.92f; + + printf((i < 255) ? " %f,\n" : " %f\n", r); + } + printf("};\n"); + + printf("static const uint8_t linear_to_srgb[4096] =\n"); + printf("{\n"); + for (i = 0; i < 4096; i++) + { + /* Start with "i" as the linear RGB value */ + /* Linear RGB to sRGB */ + r = i/4096.0f; + + r = (r > 0.0031308f) ? (1.055f*powf(r, 1.0f/2.4f) - 0.055f) : r*12.92f; + + r = floorf(r*256.0f); + + srgb = (r < 0) ? 0 : (r <= 255) ? r : 255; + + printf((i < 4095) ? " %d,\n" : " %d\n", srgb); + } + printf("};\n"); +} +/*- End of function --------------------------------------------------------*/ +#endif + +static __inline__ uint16_t pack_16(uint8_t *s) +{ + uint16_t value; + + value = ((uint16_t) s[0] << 8) | (uint16_t) s[1]; + return value; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ uint32_t pack_32(uint8_t *s) +{ + uint32_t value; + + value = ((uint32_t) s[0] << 24) | ((uint32_t) s[1] << 16) | ((uint32_t) s[2] << 8) | (uint32_t) s[3]; + return value; +} +/*- End of function --------------------------------------------------------*/ + +static int t85_row_write_handler(void *user_data, const uint8_t buf[], size_t len) +{ + int i; + int j; + + for (i = 0; i < len; i++) + { + for (j = 0; j < 8; j++) + { + if ((buf[i] & (0x80 >> j))) + data5[data5_ptr + 3*(8*i + j)] |= bit_mask; + else + data5[data5_ptr + 3*(8*i + j)] &= ~bit_mask; + } + } + data5_ptr += 3*8*len; + write_row++; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int t85_comment_handler(void *user_data, const uint8_t buf[], size_t len) +{ + if (buf) + printf("Comment (%lu): %s\n", (unsigned long int) len, buf); + else + printf("Comment (%lu): ---\n", (unsigned long int) len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + char kk[256]; + TIFF *tif; + uint32_t w; + uint32_t h; + tstrip_t nstrips; + uint32_t totdata; + tsize_t off; + uint8_t *data; + uint8_t *data2; + int row; + uint16_t compression; + int16_t photometric; + int16_t YCbCrSubsampleHoriz; + int16_t YCbCrSubsampleVert; + int16_t bits_per_pixel; + int16_t samples_per_pixel; + int16_t planar_config; + int bytes_per_row; + tsize_t outsize; + char *outptr; + const char *source_file; + int i; + int j; + int len; + tsize_t total_image_len; + tsize_t total_len; + int process_raw; + int result; + t85_decode_state_t t85_dec; + uint64_t start; + uint64_t end; + uint16_t *yyyL; + uint16_t *yyya; + uint16_t *yyyb; + uint16_t *yyyz; + + printf("Demo of ITU/Lab library.\n"); + + TIFF_FX_init(); + + set_lab_illuminant(&lab_param, 0.9638f, 1.0f, 0.8245f); + set_lab_gamut(&lab_param, 0, 100, -85, 85, -75, 125, FALSE); + +#if 0 + generate_luts(); +#endif + + source_file = (argc > 1) ? argv[1] : IN_FILE_NAME; + /* sRGB to ITU */ + if ((tif = TIFFOpen(source_file, "r")) == NULL) + { + printf("Unable to open '%s'!\n", source_file); + return 1; + } + if (TIFFSetDirectory(tif, (tdir_t) 0) < 0) + { + printf("Unable to set directory '%s'!\n", source_file); + return 1; + } + + w = 0; + TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); + h = 0; + TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); + bits_per_pixel = 0; + TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bits_per_pixel); + samples_per_pixel = 0; + TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel); + compression = 0; + TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression); + photometric = 0; + TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric); + YCbCrSubsampleHoriz = 0; + YCbCrSubsampleVert = 0; + TIFFGetField(tif, TIFFTAG_YCBCRSUBSAMPLING, &YCbCrSubsampleHoriz, &YCbCrSubsampleVert); + planar_config = 0; + TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planar_config); + off = 0; + yyyL = NULL; + yyya = NULL; + yyyb = NULL; + yyyz = NULL; + if (TIFFGetField(tif, TIFFTAG_COLORMAP, &yyyL, &yyya, &yyyb, &yyyz)) + { +#if 0 + /* Sweep the colormap in the proper order */ + for (i = 0; i < (1 << bits_per_pixel); i++) + { + xxx[3*i] = (yyyL[i] >> 8) & 0xFF; + xxx[3*i + 1] = (yyya[i] >> 8) & 0xFF; + xxx[3*i + 2] = (yyyb[i] >> 8) & 0xFF; + printf("Map %3d - %5d %5d %5d\n", i, xxx[3*i], xxx[3*i + 1], xxx[3*i + 2]); + } +#else + /* Sweep the colormap in the order that seems to work for l04x_02x.tif */ + for (i = 0; i < (1 << bits_per_pixel); i++) + { + xxx[i] = (yyyL[i] >> 8) & 0xFF; + xxx[256 + i] = (yyya[i] >> 8) & 0xFF; + xxx[2*256 + i] = (yyyb[i] >> 8) & 0xFF; + } +#endif + lab_params_t lab; + + set_lab_illuminant(&lab, 0.9638f, 1.0f, 0.8245f); + set_lab_gamut(&lab, 0, 100, -85, 85, -75, 125, FALSE); + lab_to_srgb(&lab, xxx, xxx, 256); + for (i = 0; i < (1 << bits_per_pixel); i++) + printf("Map %3d - %5d %5d %5d\n", i, xxx[3*i], xxx[3*i + 1], xxx[3*i + 2]); + } + else + { + printf("There is no colour map\n"); + } + process_raw = FALSE; + printf("Compression is "); + switch (compression) + { + case COMPRESSION_CCITT_T4: + printf("T.4\n"); + return 0; + case COMPRESSION_CCITT_T6: + printf("T.6\n"); + return 0; + case COMPRESSION_T85: + printf("T.85\n"); + process_raw = TRUE; + break; + case COMPRESSION_T43: + printf("T.43\n"); + process_raw = TRUE; + break; + case COMPRESSION_JPEG: + printf("JPEG"); + if (photometric == PHOTOMETRIC_ITULAB) + { + printf(" ITULAB"); + process_raw = TRUE; + } + printf("\n"); + break; + case COMPRESSION_NONE: + printf("No compression\n"); + break; + default: + printf("Unexpected compression %d\n", compression); + break; + } + if (process_raw) + { + nstrips = TIFFNumberOfStrips(tif); + for (i = 0, total_image_len = 0; i < nstrips; i++) + total_image_len += TIFFRawStripSize(tif, i); + data = malloc(total_image_len); + for (i = 0, total_len = 0; i < nstrips; i++, total_len += len) + { + if ((len = TIFFReadRawStrip(tif, i, &data[total_len], total_image_len - total_len)) < 0) + { + printf("TIFF read error.\n"); + return -1; + } + } + if (total_len != total_image_len) + printf("Size mismatch %d %d\n", total_len, total_image_len); + off = total_len; + switch (compression) + { + case COMPRESSION_CCITT_T4: + break; + case COMPRESSION_CCITT_T6: + break; + case COMPRESSION_T85: + printf("T.85 image %d bytes\n", total_len); + for (i = 0; i < 16; i++) + printf("0x%02x\n", data[i]); + t85_decode_init(&t85_dec, t85_row_write_handler, NULL); + t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL); + result = t85_decode_put_chunk(&t85_dec, data, total_len); + if (result == T85_MORE_DATA) + result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); + len = t85_decode_get_compressed_image_size(&t85_dec); + printf("Compressed image is %d bytes, %d rows\n", len/8, write_row); + t85_decode_release(&t85_dec); + return 0; + case COMPRESSION_T43: + printf("T.43 image %d bytes\n", total_len); + if (pack_16(data) == 0xFFA8) + { + data += 2; + total_len -= 2; + for (;;) + { + if (pack_16(data) == 0xFFE1) + { + data += 2; + total_len -= 2; + len = pack_16(data); + data += len; + total_len -= len; + } + else if (pack_16(data) == 0xFFE3) + { + data += 2; + total_len -= 2; + len = pack_32(data); + data += len; + total_len -= len; + } + else + { + break; + } + } + } + + bit_mask = 0x80; + t85_decode_init(&t85_dec, t85_row_write_handler, NULL); + t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL); + t85_dec.min_bit_planes = 1; + t85_dec.max_bit_planes = 8; + data5_ptr = 0; + result = t85_decode_put_chunk(&t85_dec, data, total_len); + len = t85_decode_get_compressed_image_size(&t85_dec); + printf("Compressed image is %d bytes, %d rows\n", len/8, write_row); + + for (j = 1; j < t85_dec.bit_planes; j++) + { + bit_mask >>= 1; + data += len/8; + total_len -= len/8; + t85_decode_new_plane(&t85_dec); + data5_ptr = 0; + t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL); + result = t85_decode_put_chunk(&t85_dec, data, total_len); + len = t85_decode_get_compressed_image_size(&t85_dec); + printf("Compressed image is %d bytes, %d rows\n", len/8, write_row); + } + if (result == T85_MORE_DATA) + { + printf("More\n"); + result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); + } + len = t85_decode_get_compressed_image_size(&t85_dec); + printf("Compressed image is %d bytes, %d rows\n", len/8, write_row); + t85_decode_release(&t85_dec); + + for (j = 0; j < data5_ptr; j += 3) + { + i = data5[j] & 0xFF; +//printf("%d %d %d %d %d %d\n", data5_ptr, j, i, xxx[3*i], xxx[3*i + 1], xxx[3*i + 2]); + data5[j] = xxx[3*i]; + data5[j + 1] = xxx[3*i + 1]; + data5[j + 2] = xxx[3*i + 2]; + } + + if ((tif = TIFFOpen(OUT_FILE_NAME, "w")) == NULL) + { + printf("Unable to open '%s'!\n", OUT_FILE_NAME); + return 1; + } + TIFFSetField(tif, TIFFTAG_SUBFILETYPE, FILETYPE_PAGE); + TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, w); + // libtiff requires IMAGELENGTH to be set before SAMPLESPERPIXEL, + // or StripOffsets and StripByteCounts will have SAMPLESPERPIXEL values + TIFFSetField(tif, TIFFTAG_IMAGELENGTH, h); + TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_JPEG); + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3); + TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, (uint32) -1); + TIFFSetField(tif, TIFFTAG_XRESOLUTION, 200.0f); + TIFFSetField(tif, TIFFTAG_YRESOLUTION, 200.0f); + TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); + TIFFSetField(tif, TIFFTAG_SOFTWARE, "spandsp"); + TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "Test"); + TIFFSetField(tif, TIFFTAG_DATETIME, "2011/02/03 12:30:45"); + TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org"); + TIFFSetField(tif, TIFFTAG_MODEL, "spandsp"); + TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org"); + + for (off = 0, i = 0; i < h; off += w*3, i++) + { + TIFFWriteScanline(tif, data5 + off, i, 0); + } + TIFFWriteDirectory(tif); + TIFFClose(tif); + return 0; + case COMPRESSION_JPEG: + break; + } + } + else + { + printf("Width %d, height %d, bits %d, samples %d\n", w, h, bits_per_pixel, samples_per_pixel); + + bytes_per_row = (bits_per_pixel + 7)/8; + bytes_per_row *= w*samples_per_pixel; + totdata = h*bytes_per_row; + printf("total %d\n", totdata); + + /* Read the image into memory. */ + data = malloc(totdata); + off = 0; + for (row = 0; row < h; row++) + { + if (TIFFReadScanline(tif, data + off, row, 0) < 0) + return 1; + off += bytes_per_row; + } + printf("total %d, off %d\n", totdata, off); + + /* We now have the image in memory in RGB form */ + + if (photometric == PHOTOMETRIC_ITULAB) + { + printf("YYY ITULAB\n"); + + if (!t42_itulab_to_itulab((tdata_t) &outptr, &outsize, data, off, w, h, kk, 256)) + { + printf("Failed to convert to ITULAB - %s\n", kk); + return 1; + } + free(data); + data = (uint8_t *) outptr; + off = outsize; + } + else + { + start = rdtscll(); + if (photometric == PHOTOMETRIC_CIELAB) + { + printf("CIELAB\n"); + /* The default luminant is D50 */ + set_lab_illuminant(&lab_param, 96.422f, 100.000f, 82.521f); + set_lab_gamut(&lab_param, 0, 100, -128, 127, -128, 127, TRUE); + lab_to_srgb(&lab_param, data, data, w*h); + } + + set_lab_illuminant(&lab_param, 0.9638f, 1.0f, 0.8245f); + set_lab_gamut(&lab_param, 0, 100, -85, 85, -75, 125, FALSE); + if (!t42_srgb_to_itulab(&lab_param, (tdata_t) &outptr, &outsize, data, off, w, h, kk, 256)) + { + printf("Failed to convert to ITULAB - %s\n", kk); + return 1; + } + end = rdtscll(); + printf("Duration %" PRIu64 "\n", end - start); + free(data); + data = (uint8_t *) outptr; + off = outsize; + } + } + TIFFClose(tif); + + printf("XXX - image is %d by %d, %d bytes\n", w, h, off); + + /* We now have the image in memory in ITULAB form */ + + if ((tif = TIFFOpen(OUT_FILE_NAME, "w")) == NULL) + { + printf("Unable to open '%s'!\n", OUT_FILE_NAME); + return 1; + } + TIFFSetField(tif, TIFFTAG_SUBFILETYPE, FILETYPE_PAGE); + TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, w); + // libtiff requires IMAGELENGTH to be set before SAMPLESPERPIXEL, + // or StripOffsets and StripByteCounts will have SAMPLESPERPIXEL values + TIFFSetField(tif, TIFFTAG_IMAGELENGTH, h); + TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_JPEG); + TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3); + TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); + TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); + TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, (uint32) -1); + TIFFSetField(tif, TIFFTAG_XRESOLUTION, 200.0f); + TIFFSetField(tif, TIFFTAG_YRESOLUTION, 200.0f); + TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); + TIFFSetField(tif, TIFFTAG_SOFTWARE, "spandsp"); + TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "Test"); + TIFFSetField(tif, TIFFTAG_DATETIME, "2011/02/03 12:30:45"); + TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org"); + TIFFSetField(tif, TIFFTAG_MODEL, "spandsp"); + TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org"); + + if (1) + { + /* Most image processors won't know what to do with the ITULAB colorspace. + So we'll be converting it to RGB for portability. */ +#if 1 + TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); +#else + TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR); +#endif + if (YCbCrSubsampleHoriz || YCbCrSubsampleVert) + TIFFSetField(tif, TIFFTAG_YCBCRSUBSAMPLING, YCbCrSubsampleHoriz, YCbCrSubsampleVert); + bytes_per_row = (bits_per_pixel + 7)/8; + bytes_per_row *= w*samples_per_pixel; + totdata = h*bytes_per_row; + set_lab_illuminant(&lab_param, 0.9638f, 1.0f, 0.8245f); + set_lab_gamut(&lab_param, 0, 100, -85, 85, -75, 125, FALSE); +#if 0 + start = rdtscll(); + data2 = NULL; + totdata = 0; + t42_itulab_to_JPEG(&lab_param, (void **) &data2, &totdata, data, off, kk, 256); + end = rdtscll(); + printf("Duration %" PRIu64 "\n", end - start); + printf("Compressed length %d (%p)\n", totdata, data2); + if (TIFFWriteRawStrip(tif, 0, data2, totdata) < 0) + { + printf("Failed to convert from ITULAB - %s\n", kk); + return 1; + } + free(data); +#else + data2 = malloc(totdata); + start = rdtscll(); + if (!t42_itulab_to_srgb(&lab_param, data2, &off, data, off, &w, &h, kk, 256)) + { + printf("Failed to convert from ITULAB - %s\n", kk); + return 1; + } + end = rdtscll(); + printf("Duration %" PRIu64 "\n", end - start); + free(data); + + off = 0; + bytes_per_row = (8 + 7)/8; + bytes_per_row *= (w*3); + for (row = 0; row < h; row++) + { + if (TIFFWriteScanline(tif, data2 + off, row, 0) < 0) + return 1; + off += bytes_per_row; + } +#endif + free(data2); + } + else + { +#if 1 + /* If PHOTOMETRIC_ITULAB is not available the admin cannot enable color fax anyway. + This is done so that older libtiffs without it can build fine. */ + TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_ITULAB); +#else + TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR); +#endif + if (YCbCrSubsampleHoriz || YCbCrSubsampleVert) + TIFFSetField(tif, TIFFTAG_YCBCRSUBSAMPLING, YCbCrSubsampleHoriz, YCbCrSubsampleVert); + if (TIFFWriteRawStrip(tif, 0, (tdata_t) data, off) == -1) + { + printf("Write error to TIFF file\n"); + return 1; + } + free(data); + } + TIFFWriteDirectory(tif); + TIFFClose(tif); + printf("Done!\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ From e9b4a497cc2a301d2d09cfde20085101bd9fe85f Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 21 Jul 2012 07:18:27 +0800 Subject: [PATCH 0776/1057] Tweaks --- libs/spandsp/src/spandsp/fax_modems.h | 1 + .../spandsp/src/spandsp/private/t38_gateway.h | 4 +- libs/spandsp/src/spandsp/private/v22bis.h | 66 ++++++--- libs/spandsp/src/spandsp/private/v27ter_tx.h | 7 +- libs/spandsp/src/spandsp/private/v29tx.h | 11 +- libs/spandsp/src/v22bis_tx.c | 139 +++++++++++++----- libs/spandsp/src/v27ter_tx.c | 101 ++++++------- libs/spandsp/src/v29tx.c | 67 +++++---- 8 files changed, 240 insertions(+), 156 deletions(-) diff --git a/libs/spandsp/src/spandsp/fax_modems.h b/libs/spandsp/src/spandsp/fax_modems.h index 100e57eb5c..a3f77dcc00 100644 --- a/libs/spandsp/src/spandsp/fax_modems.h +++ b/libs/spandsp/src/spandsp/fax_modems.h @@ -64,6 +64,7 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t am SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len); SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len); SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len); + SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which); SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep); diff --git a/libs/spandsp/src/spandsp/private/t38_gateway.h b/libs/spandsp/src/spandsp/private/t38_gateway.h index d7cd549264..af72e78213 100644 --- a/libs/spandsp/src/spandsp/private/t38_gateway.h +++ b/libs/spandsp/src/spandsp/private/t38_gateway.h @@ -86,8 +86,8 @@ typedef struct uint16_t crc; /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */ int fill_bit_removal; - /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current - rate and the current specified packet interval. */ + /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at + the current rate and the current specified packet interval. */ int octets_per_data_packet; /*! \brief Bits into the non-ECM buffer */ diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h index 48e4c42714..01c37e9aea 100644 --- a/libs/spandsp/src/spandsp/private/v22bis.h +++ b/libs/spandsp/src/spandsp/private/v22bis.h @@ -99,13 +99,6 @@ struct v22bis_state_s /* Receive section */ struct { -#if defined(SPANDSP_USE_FIXED_POINTx) - /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ - int16_t rrc_filter[V22BIS_RX_FILTER_STEPS]; -#else - /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ - float rrc_filter[V22BIS_RX_FILTER_STEPS]; -#endif /*! \brief Current offset into the RRC pulse shaping filter buffer. */ int rrc_filter_step; @@ -123,20 +116,11 @@ struct v22bis_state_s /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.22bis signal. */ int signal_present; - /*! \brief A measure of how much mismatch there is between the real constellation, - and the decoded symbol positions. */ - float training_error; - /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ uint32_t carrier_phase; /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ int32_t carrier_phase_rate; - /*! \brief The proportional part of the carrier tracking filter. */ - float carrier_track_p; - /*! \brief The integral part of the carrier tracking filter. */ - float carrier_track_i; - /*! \brief A callback function which may be enabled to report every symbol's constellation position. */ qam_report_handler_t qam_report; @@ -150,23 +134,49 @@ struct v22bis_state_s int32_t carrier_on_power; /*! \brief The power meter level at which carrier off is declared. */ int32_t carrier_off_power; + + int constellation_state; + +#if defined(SPANDSP_USE_FIXED_POINTx) /*! \brief The scaling factor accessed by the AGC algorithm. */ float agc_scaling; - - int constellation_state; + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ + int16_t rrc_filter[V22BIS_RX_FILTER_STEPS]; /*! \brief The current delta factor for updating the equalizer coefficients. */ float eq_delta; -#if defined(SPANDSP_USE_FIXED_POINTx) /*! \brief The adaptive equalizer coefficients. */ complexi_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1]; /*! \brief The equalizer signal buffer. */ complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; + + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; #else + /*! \brief The scaling factor accessed by the AGC algorithm. */ + float agc_scaling; + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ + float rrc_filter[V22BIS_RX_FILTER_STEPS]; + + /*! \brief The current delta factor for updating the equalizer coefficients. */ + float eq_delta; /*! \brief The adaptive equalizer coefficients. */ complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1]; /*! \brief The equalizer signal buffer. */ complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; + + /*! \brief A measure of how much mismatch there is between the real constellation, + and the decoded symbol positions. */ + float training_error; + /*! \brief The proportional part of the carrier tracking filter. */ + float carrier_track_p; + /*! \brief The integral part of the carrier tracking filter. */ + float carrier_track_i; #endif /*! \brief Current offset into the equalizer buffer. */ int eq_step; @@ -192,11 +202,24 @@ struct v22bis_state_s /* Transmit section */ struct { +#if defined(SPANDSP_USE_FIXED_POINTx) + /*! \brief The guard tone level. */ + int16_t guard_tone_gain; + /*! \brief The gain factor needed to achieve the specified output power. */ + int16_t gain; + /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ + int16_t rrc_filter_re[V22BIS_TX_FILTER_STEPS]; + int16_t rrc_filter_im[V22BIS_TX_FILTER_STEPS]; +#else + /*! \brief The guard tone level. */ + float guard_tone_gain; /*! \brief The gain factor needed to achieve the specified output power. */ float gain; - /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ - complexf_t rrc_filter[2*V22BIS_TX_FILTER_STEPS]; + float rrc_filter_re[V22BIS_TX_FILTER_STEPS]; + float rrc_filter_im[V22BIS_TX_FILTER_STEPS]; +#endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ int rrc_filter_step; @@ -218,7 +241,6 @@ struct v22bis_state_s uint32_t guard_phase; /*! \brief The update rate for the phase of the guard tone (i.e. the DDS increment). */ int32_t guard_phase_rate; - float guard_tone_gain; /*! \brief The current fractional phase of the baud timing. */ int baud_phase; /*! \brief The code number for the current position in the constellation. */ diff --git a/libs/spandsp/src/spandsp/private/v27ter_tx.h b/libs/spandsp/src/spandsp/private/v27ter_tx.h index 18e27e1277..5d8d41f842 100644 --- a/libs/spandsp/src/spandsp/private/v27ter_tx.h +++ b/libs/spandsp/src/spandsp/private/v27ter_tx.h @@ -53,15 +53,18 @@ struct v27ter_tx_state_s /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */ int16_t gain_4800; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ - complexi16_t rrc_filter[2*V27TER_TX_FILTER_STEPS]; + int16_t rrc_filter_re[V27TER_TX_FILTER_STEPS]; + int16_t rrc_filter_im[V27TER_TX_FILTER_STEPS]; #else /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */ float gain_2400; /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */ float gain_4800; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ - complexf_t rrc_filter[2*V27TER_TX_FILTER_STEPS]; + float rrc_filter_re[V27TER_TX_FILTER_STEPS]; + float rrc_filter_im[V27TER_TX_FILTER_STEPS]; #endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ int rrc_filter_step; diff --git a/libs/spandsp/src/spandsp/private/v29tx.h b/libs/spandsp/src/spandsp/private/v29tx.h index 034631ef87..67c2b7098d 100644 --- a/libs/spandsp/src/spandsp/private/v29tx.h +++ b/libs/spandsp/src/spandsp/private/v29tx.h @@ -50,12 +50,13 @@ struct v29_tx_state_s #if defined(SPANDSP_USE_FIXED_POINT) /*! \brief Gain required to achieve the specified output power, not allowing for the size of the current constellation. */ - float base_gain; + int16_t base_gain; /*! \brief Gain required to achieve the specified output power, allowing for the size of the current constellation. */ - int32_t gain; + int16_t gain; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ - complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS]; + int16_t rrc_filter_re[V29_TX_FILTER_STEPS]; + int16_t rrc_filter_im[V29_TX_FILTER_STEPS]; #else /*! \brief Gain required to achieve the specified output power, not allowing for the size of the current constellation. */ @@ -64,8 +65,10 @@ struct v29_tx_state_s for the size of the current constellation. */ float gain; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ - complexf_t rrc_filter[2*V29_TX_FILTER_STEPS]; + float rrc_filter_re[V29_TX_FILTER_STEPS]; + float rrc_filter_im[V29_TX_FILTER_STEPS]; #endif + /*! \brief Current offset into the RRC pulse shaping filter buffer. */ int rrc_filter_step; diff --git a/libs/spandsp/src/v22bis_tx.c b/libs/spandsp/src/v22bis_tx.c index 41c7ed2f38..2f8c724f6b 100644 --- a/libs/spandsp/src/v22bis_tx.c +++ b/libs/spandsp/src/v22bis_tx.c @@ -63,8 +63,10 @@ #include "spandsp/private/v22bis.h" #if defined(SPANDSP_USE_FIXED_POINTx) +#define FP_SCALE FP_Q_6_10 #include "v22bis_tx_fixed_rrc.h" #else +#define FP_SCALE(x) (x) #include "v22bis_tx_floating_rrc.h" #endif @@ -246,24 +248,28 @@ static const int phase_steps[4] = 1, 0, 2, 3 }; +#if defined(SPANDSP_USE_FIXED_POINTx) +const complexi16_t v22bis_constellation[16] = +#else const complexf_t v22bis_constellation[16] = +#endif { - { 1.0f, 1.0f}, - { 3.0f, 1.0f}, /* 1200bps 00 */ - { 1.0f, 3.0f}, - { 3.0f, 3.0f}, - {-1.0f, 1.0f}, - {-1.0f, 3.0f}, /* 1200bps 01 */ - {-3.0f, 1.0f}, - {-3.0f, 3.0f}, - {-1.0f, -1.0f}, - {-3.0f, -1.0f}, /* 1200bps 10 */ - {-1.0f, -3.0f}, - {-3.0f, -3.0f}, - { 1.0f, -1.0f}, - { 1.0f, -3.0f}, /* 1200bps 11 */ - { 3.0f, -1.0f}, - { 3.0f, -3.0f} + {FP_SCALE( 1.0f), FP_SCALE( 1.0f)}, + {FP_SCALE( 3.0f), FP_SCALE( 1.0f)}, /* 1200bps 00 */ + {FP_SCALE( 1.0f), FP_SCALE( 3.0f)}, + {FP_SCALE( 3.0f), FP_SCALE( 3.0f)}, + {FP_SCALE(-1.0f), FP_SCALE( 1.0f)}, + {FP_SCALE(-1.0f), FP_SCALE( 3.0f)}, /* 1200bps 01 */ + {FP_SCALE(-3.0f), FP_SCALE( 1.0f)}, + {FP_SCALE(-3.0f), FP_SCALE( 3.0f)}, + {FP_SCALE(-1.0f), FP_SCALE(-1.0f)}, + {FP_SCALE(-3.0f), FP_SCALE(-1.0f)}, /* 1200bps 10 */ + {FP_SCALE(-1.0f), FP_SCALE(-3.0f)}, + {FP_SCALE(-3.0f), FP_SCALE(-3.0f)}, + {FP_SCALE( 1.0f), FP_SCALE(-1.0f)}, + {FP_SCALE( 1.0f), FP_SCALE(-3.0f)}, /* 1200bps 11 */ + {FP_SCALE( 3.0f), FP_SCALE(-1.0f)}, + {FP_SCALE( 3.0f), FP_SCALE(-3.0f)} }; static int fake_get_bit(void *user_data) @@ -308,10 +314,18 @@ static __inline__ int get_scrambled_bit(v22bis_state_t *s) } /*- End of function --------------------------------------------------------*/ +#if defined(SPANDSP_USE_FIXED_POINTx) +static complexi16_t training_get(v22bis_state_t *s) +#else static complexf_t training_get(v22bis_state_t *s) +#endif { - int bits; +#if defined(SPANDSP_USE_FIXED_POINT) + static const complexi16_t zero = {0, 0}; +#else static const complexf_t zero = {0.0f, 0.0f}; +#endif + int bits; /* V.22bis training sequence */ switch (s->tx.training) @@ -403,8 +417,17 @@ static complexf_t training_get(v22bis_state_t *s) } /*- End of function --------------------------------------------------------*/ +#if defined(SPANDSP_USE_FIXED_POINTx) +static complexi16_t getbaud(v22bis_state_t *s) +#else static complexf_t getbaud(v22bis_state_t *s) +#endif { +#if defined(SPANDSP_USE_FIXED_POINTx) + static const complexi16_t zero = {0, 0}; +#else + static const complexf_t zero = {0.0f, 0.0f}; +#endif int bits; if (s->tx.training) @@ -419,7 +442,7 @@ static complexf_t getbaud(v22bis_state_t *s) if (s->tx.shutdown) { if (++s->tx.shutdown > 10) - return complex_setf(0.0f, 0.0f); + return zero; } /* The first two bits define the quadrant */ bits = get_scrambled_bit(s); @@ -441,11 +464,18 @@ static complexf_t getbaud(v22bis_state_t *s) SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) { +#if defined(SPANDSP_USE_FIXED_POINTx) + complexi16_t v; + complexi32_t x; + complexi32_t z; + int16_t iamp; +#else + complexf_t v; complexf_t x; complexf_t z; - int i; - int sample; float famp; +#endif + int sample; if (s->tx.shutdown > 10) return 0; @@ -454,28 +484,42 @@ SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) if ((s->tx.baud_phase += 3) >= 40) { s->tx.baud_phase -= 40; - s->tx.rrc_filter[s->tx.rrc_filter_step] = - s->tx.rrc_filter[s->tx.rrc_filter_step + V22BIS_TX_FILTER_STEPS] = getbaud(s); + v = getbaud(s); + s->tx.rrc_filter_re[s->tx.rrc_filter_step] = v.re; + s->tx.rrc_filter_im[s->tx.rrc_filter_step] = v.im; if (++s->tx.rrc_filter_step >= V22BIS_TX_FILTER_STEPS) s->tx.rrc_filter_step = 0; } +#if defined(SPANDSP_USE_FIXED_POINTx) /* Root raised cosine pulse shaping at baseband */ - x = complex_setf(0.0f, 0.0f); - for (i = 0; i < V22BIS_TX_FILTER_STEPS; i++) + x.re = vec_circular_dot_prodi16(s->tx.rrc_filter_re, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->tx.baud_phase], V22BIS_TX_FILTER_STEPS, s->tx.rrc_filter_step) >> 14; + x.im = vec_circular_dot_prodi16(s->tx.rrc_filter_im, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->tx.baud_phase], V22BIS_TX_FILTER_STEPS, s->tx.rrc_filter_step) >> 14; + /* Now create and modulate the carrier */ + z = dds_complexi32(&s->tx.carrier_phase, s->tx.carrier_phase_rate); + iamp = (x.re*z.re - x.im*z.im) >> 15; + iamp = (int16_t) (((int32_t) iamp*s->tx.gain) >> 11); + if (s->tx.guard_phase_rate && (s->tx.rrc_filter_re[s->tx.rrc_filter_step] != 0 || s->tx.rrc_filter_im[s->tx.rrc_filter_step] != 0)) { - x.re += tx_pulseshaper[39 - s->tx.baud_phase][i]*s->tx.rrc_filter[i + s->tx.rrc_filter_step].re; - x.im += tx_pulseshaper[39 - s->tx.baud_phase][i]*s->tx.rrc_filter[i + s->tx.rrc_filter_step].im; + /* Add the guard tone */ + iamp += dds_mod(&s->tx.guard_phase, s->tx.guard_phase_rate, s->tx.guard_tone_gain, 0); } + /* Don't bother saturating. We should never clip. */ + amp[sample] = iamp; +#else + /* Root raised cosine pulse shaping at baseband */ + x.re = vec_circular_dot_prodf(s->tx.rrc_filter_re, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->tx.baud_phase], V22BIS_TX_FILTER_STEPS, s->tx.rrc_filter_step); + x.im = vec_circular_dot_prodf(s->tx.rrc_filter_im, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->tx.baud_phase], V22BIS_TX_FILTER_STEPS, s->tx.rrc_filter_step); /* Now create and modulate the carrier */ z = dds_complexf(&s->tx.carrier_phase, s->tx.carrier_phase_rate); famp = (x.re*z.re - x.im*z.im)*s->tx.gain; - if (s->tx.guard_phase_rate && (s->tx.rrc_filter[s->tx.rrc_filter_step].re != 0.0f || s->tx.rrc_filter[s->tx.rrc_filter_step].im != 0.0f)) + if (s->tx.guard_phase_rate && (s->tx.rrc_filter_re[s->tx.rrc_filter_step] != 0.0f || s->tx.rrc_filter_im[s->tx.rrc_filter_step] != 0.0f)) { /* Add the guard tone */ famp += dds_modf(&s->tx.guard_phase, s->tx.guard_phase_rate, s->tx.guard_tone_gain, 0); } /* Don't bother saturating. We should never clip. */ amp[sample] = (int16_t) lfastrintf(famp); +#endif } return sample; } @@ -483,34 +527,49 @@ SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power) { - float l; + float sig_power; + float guard_tone_power; + float sig_gain; + float guard_tone_gain; + /* If is there is a guard tone we need to scale down the signal power a bit, so the aggregate of the signal + and guard tone power is the specified power. */ if (s->tx.guard_phase_rate == dds_phase_ratef(550.0f)) { - l = 1.6f*powf(10.0f, (power - 1.0f - DBM0_MAX_POWER)/20.0f); - s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); - l = powf(10.0f, (power - 1.0f - 3.0f - DBM0_MAX_POWER)/20.0f); - s->tx.guard_tone_gain = l*32768.0f; + sig_power = power - 1.0f; + guard_tone_power = sig_power - 3.0f; } else if(s->tx.guard_phase_rate == dds_phase_ratef(1800.0f)) { - l = 1.6f*powf(10.0f, (power - 1.0f - 1.0f - DBM0_MAX_POWER)/20.0f); - s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); - l = powf(10.0f, (power - 1.0f - 6.0f - DBM0_MAX_POWER)/20.0f); - s->tx.guard_tone_gain = l*32768.0f; + sig_power = power - 0.55f; + guard_tone_power = sig_power - 6.0f; } else { - l = 1.6f*powf(10.0f, (power - DBM0_MAX_POWER)/20.0f); - s->tx.gain = l*32768.0f/(TX_PULSESHAPER_GAIN*3.0f); - s->tx.guard_tone_gain = 0; + sig_power = power; + guard_tone_power = -9999.0f; } + sig_gain = 0.4490f*powf(10.0f, (sig_power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN; + guard_tone_gain = powf(10.0f, (guard_tone_power - DBM0_MAX_POWER)/20.0f)*32768.0f; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->tx.gain = (int16_t) sig_gain; + s->tx.guard_tone_gain = (int16_t) guard_tone_gain; +#else + s->tx.gain = sig_gain; + s->tx.guard_tone_gain = guard_tone_gain; +#endif } /*- End of function --------------------------------------------------------*/ static int v22bis_tx_restart(v22bis_state_t *s) { - cvec_zerof(s->tx.rrc_filter, sizeof(s->tx.rrc_filter)/sizeof(s->tx.rrc_filter[0])); +#if defined(SPANDSP_USE_FIXED_POINTx) + vec_zeroi16(s->tx.rrc_filter_re, sizeof(s->tx.rrc_filter_re)/sizeof(s->tx.rrc_filter_re[0])); + vec_zeroi16(s->tx.rrc_filter_im, sizeof(s->tx.rrc_filter_im)/sizeof(s->tx.rrc_filter_im[0])); +#else + vec_zerof(s->tx.rrc_filter_re, sizeof(s->tx.rrc_filter_re)/sizeof(s->tx.rrc_filter_re[0])); + vec_zerof(s->tx.rrc_filter_im, sizeof(s->tx.rrc_filter_im)/sizeof(s->tx.rrc_filter_im[0])); +#endif s->tx.rrc_filter_step = 0; s->tx.scramble_reg = 0; s->tx.scrambler_pattern_count = 0; diff --git a/libs/spandsp/src/v27ter_tx.c b/libs/spandsp/src/v27ter_tx.c index f2673444ee..99d534e25c 100644 --- a/libs/spandsp/src/v27ter_tx.c +++ b/libs/spandsp/src/v27ter_tx.c @@ -247,13 +247,16 @@ static complexf_t getbaud(v27ter_tx_state_t *s) SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) { #if defined(SPANDSP_USE_FIXED_POINT) - complexi_t x; - complexi_t z; + complexi16_t v; + complexi32_t x; + complexi32_t z; + int16_t iamp; #else + complexf_t v; complexf_t x; complexf_t z; + float famp; #endif - int i; int sample; if (s->training_step >= V27TER_TRAINING_SHUTDOWN_END) @@ -271,37 +274,30 @@ SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) if (++s->baud_phase >= 5) { s->baud_phase -= 5; - s->rrc_filter[s->rrc_filter_step] = - s->rrc_filter[s->rrc_filter_step + V27TER_TX_FILTER_STEPS] = getbaud(s); + v = getbaud(s);; + s->rrc_filter_re[s->rrc_filter_step] = v.re; + s->rrc_filter_im[s->rrc_filter_step] = v.im; if (++s->rrc_filter_step >= V27TER_TX_FILTER_STEPS) s->rrc_filter_step = 0; } - /* Root raised cosine pulse shaping at baseband */ #if defined(SPANDSP_USE_FIXED_POINT) - x = complex_seti(0, 0); - for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) - { - x.re += (int32_t) tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re; - x.im += (int32_t) tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im; - } + /* Root raised cosine pulse shaping at baseband */ + x.re = vec_circular_dot_prodi16(s->rrc_filter_re, tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step) >> (10 + 4); + x.im = vec_circular_dot_prodi16(s->rrc_filter_im, tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step) >> (10 + 4); /* Now create and modulate the carrier */ - x.re >>= 14; - x.im >>= 14; - z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate); + z = dds_complexi32(&s->carrier_phase, s->carrier_phase_rate); + iamp = ((int32_t) x.re*z.re - x.im*z.im) >> 15; /* Don't bother saturating. We should never clip. */ - i = (x.re*z.re - x.im*z.im) >> 15; - amp[sample] = (int16_t) ((i*s->gain_4800) >> 15); + amp[sample] = (int16_t) (((int32_t) iamp*s->gain_4800) >> 11); #else - x = complex_setf(0.0f, 0.0f); - for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) - { - x.re += tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re; - x.im += tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im; - } + /* Root raised cosine pulse shaping at baseband */ + x.re = vec_circular_dot_prodf(s->rrc_filter_re, tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step); + x.im = vec_circular_dot_prodf(s->rrc_filter_im, tx_pulseshaper_4800[TX_PULSESHAPER_4800_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step); /* Now create and modulate the carrier */ - z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); + z = dds_complexf(&s->carrier_phase, s->carrier_phase_rate); + famp = x.re*z.re - x.im*z.im; /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_4800); + amp[sample] = (int16_t) lfastrintf(famp*s->gain_4800); #endif } } @@ -312,37 +308,30 @@ SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) if ((s->baud_phase += 3) >= 20) { s->baud_phase -= 20; - s->rrc_filter[s->rrc_filter_step] = - s->rrc_filter[s->rrc_filter_step + V27TER_TX_FILTER_STEPS] = getbaud(s); + v = getbaud(s); + s->rrc_filter_re[s->rrc_filter_step] = v.re; + s->rrc_filter_im[s->rrc_filter_step] = v.im; if (++s->rrc_filter_step >= V27TER_TX_FILTER_STEPS) s->rrc_filter_step = 0; } - /* Root raised cosine pulse shaping at baseband */ #if defined(SPANDSP_USE_FIXED_POINT) - x = complex_seti(0, 0); - for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) - { - x.re += (int32_t) tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re; - x.im += (int32_t) tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im; - } + /* Root raised cosine pulse shaping at baseband */ + x.re = vec_circular_dot_prodi16(s->rrc_filter_re, tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step) >> (10 + 4); + x.im = vec_circular_dot_prodi16(s->rrc_filter_im, tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step) >> (10 + 4); /* Now create and modulate the carrier */ - x.re >>= 14; - x.im >>= 14; - z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate); + z = dds_complexi32(&s->carrier_phase, s->carrier_phase_rate); + iamp = ((int32_t) x.re*z.re - x.im*z.im) >> 15; /* Don't bother saturating. We should never clip. */ - i = (x.re*z.re - x.im*z.im) >> 15; - amp[sample] = (int16_t) ((i*s->gain_2400) >> 15); + amp[sample] = (int16_t) (((int32_t) iamp*s->gain_2400) >> 11); #else - x = complex_setf(0.0f, 0.0f); - for (i = 0; i < V27TER_TX_FILTER_STEPS; i++) - { - x.re += tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re; - x.im += tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im; - } + /* Root raised cosine pulse shaping at baseband */ + x.re = vec_circular_dot_prodf(s->rrc_filter_re, tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step); + x.im = vec_circular_dot_prodf(s->rrc_filter_im, tx_pulseshaper_2400[TX_PULSESHAPER_2400_COEFF_SETS - 1 - s->baud_phase], V27TER_TX_FILTER_STEPS, s->rrc_filter_step); /* Now create and modulate the carrier */ - z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); + z = dds_complexf(&s->carrier_phase, s->carrier_phase_rate); + famp = x.re*z.re - x.im*z.im; /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_2400); + amp[sample] = (int16_t) lfastrintf(famp*s->gain_2400); #endif } } @@ -352,15 +341,15 @@ SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) SPAN_DECLARE(void) v27ter_tx_power(v27ter_tx_state_t *s, float power) { - float l; + float gain; - l = powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f; + gain = powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f; #if defined(SPANDSP_USE_FIXED_POINT) - s->gain_2400 = 16.0f*1.024f*(32767.0f/28828.51f)*l/TX_PULSESHAPER_2400_GAIN; - s->gain_4800 = 16.0f*1.024f*(32767.0f/28828.46f)*l/TX_PULSESHAPER_4800_GAIN; + s->gain_2400 = (int16_t) (gain/TX_PULSESHAPER_2400_GAIN); + s->gain_4800 = (int16_t) (gain/TX_PULSESHAPER_4800_GAIN); #else - s->gain_2400 = l/TX_PULSESHAPER_2400_GAIN; - s->gain_4800 = l/TX_PULSESHAPER_4800_GAIN; + s->gain_2400 = gain/TX_PULSESHAPER_2400_GAIN; + s->gain_4800 = gain/TX_PULSESHAPER_4800_GAIN; #endif } /*- End of function --------------------------------------------------------*/ @@ -393,9 +382,11 @@ SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep) return -1; s->bit_rate = bit_rate; #if defined(SPANDSP_USE_FIXED_POINT) - cvec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + vec_zeroi16(s->rrc_filter_re, sizeof(s->rrc_filter_re)/sizeof(s->rrc_filter_re[0])); + vec_zeroi16(s->rrc_filter_im, sizeof(s->rrc_filter_im)/sizeof(s->rrc_filter_im[0])); #else - cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + vec_zerof(s->rrc_filter_re, sizeof(s->rrc_filter_re)/sizeof(s->rrc_filter_re[0])); + vec_zerof(s->rrc_filter_im, sizeof(s->rrc_filter_im)/sizeof(s->rrc_filter_im[0])); #endif s->rrc_filter_step = 0; s->scramble_reg = 0x3C; diff --git a/libs/spandsp/src/v29tx.c b/libs/spandsp/src/v29tx.c index 10007a93fb..7604ae4ac1 100644 --- a/libs/spandsp/src/v29tx.c +++ b/libs/spandsp/src/v29tx.c @@ -205,13 +205,16 @@ static __inline__ complexf_t getbaud(v29_tx_state_t *s) SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len) { #if defined(SPANDSP_USE_FIXED_POINT) - complexi_t x; - complexi_t z; + complexi16_t v; + complexi32_t x; + complexi32_t z; + int16_t iamp; #else + complexf_t v; complexf_t x; complexf_t z; + float famp; #endif - int i; int sample; if (s->training_step >= V29_TRAINING_SHUTDOWN_END) @@ -224,37 +227,30 @@ SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len) if ((s->baud_phase += 3) >= 10) { s->baud_phase -= 10; - s->rrc_filter[s->rrc_filter_step] = - s->rrc_filter[s->rrc_filter_step + V29_TX_FILTER_STEPS] = getbaud(s); + v = getbaud(s); + s->rrc_filter_re[s->rrc_filter_step] = v.re; + s->rrc_filter_im[s->rrc_filter_step] = v.im; if (++s->rrc_filter_step >= V29_TX_FILTER_STEPS) s->rrc_filter_step = 0; } - /* Root raised cosine pulse shaping at baseband */ #if defined(SPANDSP_USE_FIXED_POINT) - x = complex_seti(0, 0); - for (i = 0; i < V29_TX_FILTER_STEPS; i++) - { - x.re += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].re; - x.im += (int32_t) tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*(int32_t) s->rrc_filter[i + s->rrc_filter_step].im; - } + /* Root raised cosine pulse shaping at baseband */ + x.re = vec_circular_dot_prodi16(s->rrc_filter_re, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V29_TX_FILTER_STEPS, s->rrc_filter_step) >> 4; + x.im = vec_circular_dot_prodi16(s->rrc_filter_im, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V29_TX_FILTER_STEPS, s->rrc_filter_step) >> 4; /* Now create and modulate the carrier */ - x.re >>= 4; - x.im >>= 4; - z = dds_complexi(&(s->carrier_phase), s->carrier_phase_rate); + z = dds_complexi32(&s->carrier_phase, s->carrier_phase_rate); + iamp = ((int32_t) x.re*z.re - x.im*z.im) >> 15; /* Don't bother saturating. We should never clip. */ - i = (x.re*z.re - x.im*z.im) >> 15; - amp[sample] = (int16_t) ((i*s->gain) >> 15); + amp[sample] = (int16_t) (((int32_t) iamp*s->gain) >> 11); #else - x = complex_setf(0.0f, 0.0f); - for (i = 0; i < V29_TX_FILTER_STEPS; i++) - { - x.re += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].re; - x.im += tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase][i]*s->rrc_filter[i + s->rrc_filter_step].im; - } + /* Root raised cosine pulse shaping at baseband */ + x.re = vec_circular_dot_prodf(s->rrc_filter_re, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V29_TX_FILTER_STEPS, s->rrc_filter_step); + x.im = vec_circular_dot_prodf(s->rrc_filter_im, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->baud_phase], V29_TX_FILTER_STEPS, s->rrc_filter_step); /* Now create and modulate the carrier */ - z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); + z = dds_complexf(&s->carrier_phase, s->carrier_phase_rate); + famp = x.re*z.re - x.im*z.im; /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain); + amp[sample] = (int16_t) lfastrintf(famp*s->gain); #endif } return sample; @@ -267,13 +263,13 @@ static void set_working_gain(v29_tx_state_t *s) switch (s->bit_rate) { case 9600: - s->gain = 0.387f*s->base_gain*16.0f*32767.0f/30672.52f; + s->gain = ((int32_t) FP_Q_4_12(0.387f)*s->base_gain) >> 12; break; case 7200: - s->gain = 0.605f*s->base_gain*16.0f*32767.0f/30672.52f; + s->gain = ((int32_t) FP_Q_4_12(0.605f)*s->base_gain) >> 12; break; case 4800: - s->gain = 0.470f*s->base_gain*16.0f*32767.0f/30672.52f; + s->gain = ((int32_t) FP_Q_4_12(0.470f)*s->base_gain) >> 12; break; default: break; @@ -299,10 +295,17 @@ static void set_working_gain(v29_tx_state_t *s) SPAN_DECLARE(void) v29_tx_power(v29_tx_state_t *s, float power) { + float gain; + /* The constellation does not maintain constant average power as we change bit rates. We need to scale the gain we get here by a bit rate specific scaling factor each time we restart the modem. */ - s->base_gain = powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN; + gain = powf(10.0f, (power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN; +#if defined(SPANDSP_USE_FIXED_POINT) + s->base_gain = (int16_t) gain; +#else + s->base_gain = gain; +#endif set_working_gain(s); } /*- End of function --------------------------------------------------------*/ @@ -349,9 +352,11 @@ SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep) return -1; } #if defined(SPANDSP_USE_FIXED_POINT) - cvec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + vec_zeroi16(s->rrc_filter_re, sizeof(s->rrc_filter_re)/sizeof(s->rrc_filter_re[0])); + vec_zeroi16(s->rrc_filter_im, sizeof(s->rrc_filter_im)/sizeof(s->rrc_filter_im[0])); #else - cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + vec_zerof(s->rrc_filter_re, sizeof(s->rrc_filter_re)/sizeof(s->rrc_filter_re[0])); + vec_zerof(s->rrc_filter_im, sizeof(s->rrc_filter_im)/sizeof(s->rrc_filter_im[0])); #endif s->rrc_filter_step = 0; s->scramble_reg = 0; From 6ec4514c682f906de4fbf8bfb5ff9b2d9848d245 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 20 Jul 2012 19:15:04 -0500 Subject: [PATCH 0777/1057] FS-4450 this is pre-emptive, This is the only way I can see an endless loop here --- src/switch_ivr_originate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 9bddf694d9..fd47ffdc08 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2380,8 +2380,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess while (*chan_type == '[') { char *parsed = NULL; - - for (p = chan_type; p && *p && *p != ']'; p++) { + char *bend = switch_find_end_paren(chan_type, '[', ']'); + + for (p = chan_type + 1; p && p < bend && *p; p++) { if (*p == QUOTED_ESC_COMMA) { *p = ','; } @@ -2392,8 +2393,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n"); switch_goto_status(SWITCH_STATUS_GENERR, done); } - - chan_type = parsed; + + if (chan_type == parsed) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n"); + switch_goto_status(SWITCH_STATUS_GENERR, done); + } else { + chan_type = parsed; + } } From e58b2e7d9719751e50c4a0aced65e6eba310a55e Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 21 Jul 2012 19:47:45 +0800 Subject: [PATCH 0778/1057] Some modem cleanups, and movement towards efficient fixed point modem implementations for platforms with slow floating point --- libs/spandsp/src/spandsp/private/v22bis.h | 28 +- libs/spandsp/src/spandsp/private/v27ter_rx.h | 14 +- libs/spandsp/src/spandsp/private/v29rx.h | 2 +- libs/spandsp/src/spandsp/v27ter_rx.h | 2 +- libs/spandsp/src/spandsp/v29rx.h | 2 +- libs/spandsp/src/v17tx.c | 19 +- libs/spandsp/src/v22bis_rx.c | 353 +++++++++++++------ libs/spandsp/src/v22bis_tx.c | 18 +- libs/spandsp/src/v27ter_rx.c | 232 ++++++------ libs/spandsp/src/v29rx.c | 163 ++++----- 10 files changed, 462 insertions(+), 371 deletions(-) diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h index 01c37e9aea..9ac200d44e 100644 --- a/libs/spandsp/src/spandsp/private/v22bis.h +++ b/libs/spandsp/src/spandsp/private/v22bis.h @@ -26,10 +26,10 @@ #if !defined(_SPANDSP_PRIVATE_V22BIS_H_) #define _SPANDSP_PRIVATE_V22BIS_H_ -/*! The number of steps to the left and to the right of the target position in the equalizer buffer. */ -#define V22BIS_EQUALIZER_LEN 7 -/*! One less than a power of 2 >= (2*V22BIS_EQUALIZER_LEN + 1) */ -#define V22BIS_EQUALIZER_MASK 15 +/*! The length of the equalizer buffer */ +#define V22BIS_EQUALIZER_LEN 17 +/*! Samples before the target position in the equalizer buffer */ +#define V22BIS_EQUALIZER_PRE_LEN 8 /*! The number of taps in the transmit pulse shaping filter */ #define V22BIS_TX_FILTER_STEPS 9 @@ -139,24 +139,24 @@ struct v22bis_state_s #if defined(SPANDSP_USE_FIXED_POINTx) /*! \brief The scaling factor accessed by the AGC algorithm. */ - float agc_scaling; + int16_t agc_scaling; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ int16_t rrc_filter[V22BIS_RX_FILTER_STEPS]; /*! \brief The current delta factor for updating the equalizer coefficients. */ - float eq_delta; + int16_t eq_delta; /*! \brief The adaptive equalizer coefficients. */ - complexi_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1]; + complexi16_t eq_coeff[V22BIS_EQUALIZER_LEN]; /*! \brief The equalizer signal buffer. */ - complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; + complexi16_t eq_buf[V22BIS_EQUALIZER_LEN]; /*! \brief A measure of how much mismatch there is between the real constellation, and the decoded symbol positions. */ - float training_error; + int32_t training_error; /*! \brief The proportional part of the carrier tracking filter. */ - float carrier_track_p; + int32_t carrier_track_p; /*! \brief The integral part of the carrier tracking filter. */ - float carrier_track_i; + int32_t carrier_track_i; #else /*! \brief The scaling factor accessed by the AGC algorithm. */ float agc_scaling; @@ -166,9 +166,9 @@ struct v22bis_state_s /*! \brief The current delta factor for updating the equalizer coefficients. */ float eq_delta; /*! \brief The adaptive equalizer coefficients. */ - complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1]; + complexf_t eq_coeff[V22BIS_EQUALIZER_LEN]; /*! \brief The equalizer signal buffer. */ - complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1]; + complexf_t eq_buf[V22BIS_EQUALIZER_LEN]; /*! \brief A measure of how much mismatch there is between the real constellation, and the decoded symbol positions. */ @@ -202,7 +202,7 @@ struct v22bis_state_s /* Transmit section */ struct { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) /*! \brief The guard tone level. */ int16_t guard_tone_gain; /*! \brief The gain factor needed to achieve the specified output power. */ diff --git a/libs/spandsp/src/spandsp/private/v27ter_rx.h b/libs/spandsp/src/spandsp/private/v27ter_rx.h index c491c905df..92bf937d83 100644 --- a/libs/spandsp/src/spandsp/private/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/private/v27ter_rx.h @@ -76,22 +76,22 @@ struct v27ter_rx_state_s int16_t agc_scaling_save; /*! \brief The current delta factor for updating the equalizer coefficients. */ - float eq_delta; + int16_t eq_delta; /*! \brief The adaptive equalizer coefficients. */ - /*complexi16_t*/ complexf_t eq_coeff[V27TER_EQUALIZER_LEN]; + complexi16_t eq_coeff[V27TER_EQUALIZER_LEN]; /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ - /*complexi16_t*/ complexf_t eq_coeff_save[V27TER_EQUALIZER_LEN]; + complexi16_t eq_coeff_save[V27TER_EQUALIZER_LEN]; /*! \brief The equalizer signal buffer. */ - /*complexi16_t*/ complexf_t eq_buf[V27TER_EQUALIZER_LEN]; + complexi16_t eq_buf[V27TER_EQUALIZER_LEN]; /*! \brief A measure of how much mismatch there is between the real constellation, and the decoded symbol positions. */ - float training_error; + int32_t training_error; /*! \brief The proportional part of the carrier tracking filter. */ - float carrier_track_p; + int32_t carrier_track_p; /*! \brief The integral part of the carrier tracking filter. */ - float carrier_track_i; + int32_t carrier_track_i; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ int16_t rrc_filter[V27TER_RX_FILTER_STEPS]; #else diff --git a/libs/spandsp/src/spandsp/private/v29rx.h b/libs/spandsp/src/spandsp/private/v29rx.h index c86c87fe2e..17e900582e 100644 --- a/libs/spandsp/src/spandsp/private/v29rx.h +++ b/libs/spandsp/src/spandsp/private/v29rx.h @@ -87,7 +87,7 @@ struct v29_rx_state_s /*! \brief A measure of how much mismatch there is between the real constellation, and the decoded symbol positions. */ - float training_error; + int32_t training_error; /*! \brief The proportional part of the carrier tracking filter. */ int32_t carrier_track_p; diff --git a/libs/spandsp/src/spandsp/v27ter_rx.h b/libs/spandsp/src/spandsp/v27ter_rx.h index 8e8de0d073..6b464b3d42 100644 --- a/libs/spandsp/src/spandsp/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/v27ter_rx.h @@ -126,7 +126,7 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len); \brief Get a snapshot of the current equalizer coefficients. \param coeffs The vector of complex coefficients. \return The number of coefficients in the vector. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t **coeffs); #else SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs); diff --git a/libs/spandsp/src/spandsp/v29rx.h b/libs/spandsp/src/spandsp/v29rx.h index 8c89407ce3..bdcd23f944 100644 --- a/libs/spandsp/src/spandsp/v29rx.h +++ b/libs/spandsp/src/spandsp/v29rx.h @@ -118,7 +118,7 @@ scrambler register) cannot be trusted for the test. The receive modem, therefore, only tests that bits starting at bit 24 are really ones. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) typedef void (*qam_report_handler_t)(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol); #else typedef void (*qam_report_handler_t)(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol); diff --git a/libs/spandsp/src/v17tx.c b/libs/spandsp/src/v17tx.c index ca4eba1c68..56d3fa13a0 100644 --- a/libs/spandsp/src/v17tx.c +++ b/libs/spandsp/src/v17tx.c @@ -53,13 +53,19 @@ #include "spandsp/dds.h" #include "spandsp/power_meter.h" +#if defined(SPANDSP_USE_FIXED_POINT) +#define SPANDSP_USE_FIXED_POINTx +#endif + #include "spandsp/v17tx.h" #include "spandsp/private/logging.h" #include "spandsp/private/v17tx.h" #if defined(SPANDSP_USE_FIXED_POINT) -#define SPANDSP_USE_FIXED_POINTx +#define FP_SCALE(x) ((int16_t) x) +#else +#define FP_SCALE(x) (x) #endif #include "v17_v32bis_tx_constellation_maps.h" @@ -229,6 +235,11 @@ static __inline__ complexf_t getbaud(v17_tx_state_t *s) int i; int bit; int bits; +#if defined(SPANDSP_USE_FIXED_POINT) + static const complexi16_t zero = {0, 0}; +#else + static const complexf_t zero = {0.0f, 0.0f}; +#endif if (s->in_training) { @@ -251,11 +262,7 @@ static __inline__ complexf_t getbaud(v17_tx_state_t *s) { /* The shutdown sequence is 32 bauds of all 1's, then 48 bauds of silence */ -#if defined(SPANDSP_USE_FIXED_POINT) - return complex_seti16(0, 0); -#else - return complex_setf(0.0f, 0.0f); -#endif + return zero; } if (s->training_step == V17_TRAINING_SHUTDOWN_END) { diff --git a/libs/spandsp/src/v22bis_rx.c b/libs/spandsp/src/v22bis_rx.c index 85c0b9e10c..85303220f5 100644 --- a/libs/spandsp/src/v22bis_rx.c +++ b/libs/spandsp/src/v22bis_rx.c @@ -73,9 +73,12 @@ #include "spandsp/private/v22bis.h" #if defined(SPANDSP_USE_FIXED_POINTx) -#include "v22bis_rx_1200_floating_rrc.h" -#include "v22bis_rx_2400_floating_rrc.h" +#define FP_SHIFT_FACTOR 10 +#define FP_SCALE FP_Q_6_10 +#include "v22bis_rx_1200_fixed_rrc.h" +#include "v22bis_rx_2400_fixed_rrc.h" #else +#define FP_SCALE(x) (x) #include "v22bis_rx_1200_floating_rrc.h" #include "v22bis_rx_2400_floating_rrc.h" #endif @@ -170,10 +173,14 @@ void v22bis_report_status_change(v22bis_state_t *s, int status) } /*- End of function --------------------------------------------------------*/ +#if defined(SPANDSP_USE_FIXED_POINT) +SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexi16_t **coeffs) +#else SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs) +#endif { *coeffs = s->rx.eq_coeff; - return 2*V22BIS_EQUALIZER_LEN + 1; + return V22BIS_EQUALIZER_LEN; } /*- End of function --------------------------------------------------------*/ @@ -181,13 +188,17 @@ void v22bis_equalizer_coefficient_reset(v22bis_state_t *s) { /* Start with an equalizer based on everything being perfect */ #if defined(SPANDSP_USE_FIXED_POINTx) - cvec_zeroi16(s->rx.eq_coeff, 2*V22BIS_EQUALIZER_LEN + 1); - s->rx.eq_coeff[V22BIS_EQUALIZER_LEN] = complex_seti16(3*FP_FACTOR, 0*FP_FACTOR); - s->rx.eq_delta = 32768.0f*EQUALIZER_DELTA/(2*V22BIS_EQUALIZER_LEN + 1); + static const complexi16_t x = {FP_Q_6_10(3.0f), FP_Q_6_10(0.0f)}; + + cvec_zeroi16(s->rx.eq_coeff, V22BIS_EQUALIZER_LEN); + s->rx.eq_coeff[V22BIS_EQUALIZER_PRE_LEN] = x; + s->rx.eq_delta = 32.0f*EQUALIZER_DELTA/V22BIS_EQUALIZER_LEN; #else - cvec_zerof(s->rx.eq_coeff, 2*V22BIS_EQUALIZER_LEN + 1); - s->rx.eq_coeff[V22BIS_EQUALIZER_LEN] = complex_setf(3.0f, 0.0f); - s->rx.eq_delta = EQUALIZER_DELTA/(2*V22BIS_EQUALIZER_LEN + 1); + static const complexf_t x = {3.0f, 0.0f}; + + cvec_zerof(s->rx.eq_coeff, V22BIS_EQUALIZER_LEN); + s->rx.eq_coeff[V22BIS_EQUALIZER_PRE_LEN] = x; + s->rx.eq_delta = EQUALIZER_DELTA/V22BIS_EQUALIZER_LEN; #endif } /*- End of function --------------------------------------------------------*/ @@ -196,73 +207,99 @@ static void equalizer_reset(v22bis_state_t *s) { v22bis_equalizer_coefficient_reset(s); #if defined(SPANDSP_USE_FIXED_POINTx) - cvec_zeroi16(s->rx.eq_buf, V22BIS_EQUALIZER_MASK + 1); + cvec_zeroi16(s->rx.eq_buf, V22BIS_EQUALIZER_LEN); #else - cvec_zerof(s->rx.eq_buf, V22BIS_EQUALIZER_MASK + 1); + cvec_zerof(s->rx.eq_buf, V22BIS_EQUALIZER_LEN); #endif s->rx.eq_put_step = 20 - 1; s->rx.eq_step = 0; } /*- End of function --------------------------------------------------------*/ -static complexf_t equalizer_get(v22bis_state_t *s) +#if defined(SPANDSP_USE_FIXED_POINT) +static __inline__ complexi16_t equalizer_get(v22bis_state_t *s) { - int i; - int p; - complexf_t z; - complexf_t z1; + complexi32_t zz; + complexi16_t z; /* Get the next equalized value. */ - z = complex_setf(0.0f, 0.0f); - p = s->rx.eq_step - 1; - for (i = 0; i < 2*V22BIS_EQUALIZER_LEN + 1; i++) - { - p = (p - 1) & V22BIS_EQUALIZER_MASK; - z1 = complex_mulf(&s->rx.eq_coeff[i], &s->rx.eq_buf[p]); - z = complex_addf(&z, &z1); - } + zz = cvec_circular_dot_prodi16(s->rx.eq_buf, s->rx.eq_coeff, V22BIS_EQUALIZER_LEN, s->rx.eq_step); + z.re = zz.re >> FP_SHIFT_FACTOR; + z.im = zz.im >> FP_SHIFT_FACTOR; return z; } +#else +static __inline__ complexf_t equalizer_get(v22bis_state_t *s) +{ + /* Get the next equalized value. */ + return cvec_circular_dot_prodf(s->rx.eq_buf, s->rx.eq_coeff, V22BIS_EQUALIZER_LEN, s->rx.eq_step); +} +#endif /*- End of function --------------------------------------------------------*/ -static void tune_equalizer(v22bis_state_t *s, const complexf_t *z, const complexf_t *target) +#if defined(SPANDSP_USE_FIXED_POINTx) +static void tune_equalizer(v22bis_state_t *s, const complexi16_t *z, const complexi16_t *target) { - int i; - int p; - complexf_t ez; - complexf_t z1; + complexi16_t err; /* Find the x and y mismatch from the exact constellation position. */ - ez = complex_subf(target, z); - ez.re *= s->rx.eq_delta; - ez.im *= s->rx.eq_delta; - - p = s->rx.eq_step - 1; - for (i = 0; i < 2*V22BIS_EQUALIZER_LEN + 1; i++) - { - p = (p - 1) & V22BIS_EQUALIZER_MASK; - z1 = complex_conjf(&s->rx.eq_buf[p]); - z1 = complex_mulf(&ez, &z1); - s->rx.eq_coeff[i] = complex_addf(&s->rx.eq_coeff[i], &z1); - /* If we don't leak a little bit we seem to get some wandering adaption */ - s->rx.eq_coeff[i].re *= 0.9999f; - s->rx.eq_coeff[i].im *= 0.9999f; - } + err = complex_subi16(target, z); + err.re = ((int32_t) err.re*s->rx.eq_delta) >> 5; + err.im = ((int32_t) err.im*s->rx.eq_delta) >> 5; + //cvec_circular_lmsi16(s->rx.eq_buf, s->rx.eq_coeff, V22BIS_EQUALIZER_LEN, s->rx.eq_step, &err); } +#else +static void tune_equalizer(v22bis_state_t *s, const complexf_t *z, const complexf_t *target) +{ + complexf_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err = complex_subf(target, z); + err.re *= s->rx.eq_delta; + err.im *= s->rx.eq_delta; + cvec_circular_lmsf(s->rx.eq_buf, s->rx.eq_coeff, V22BIS_EQUALIZER_LEN, s->rx.eq_step, &err); +} +#endif /*- End of function --------------------------------------------------------*/ +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ void track_carrier(v22bis_state_t *s, const complexi16_t *z, const complexi16_t *target) +#else static __inline__ void track_carrier(v22bis_state_t *s, const complexf_t *z, const complexf_t *target) +#endif { +#if defined(SPANDSP_USE_FIXED_POINTx) + int32_t error; +#else float error; +#endif /* For small errors the imaginary part of the difference between the actual and the target positions is proportional to the phase error, for any particular target. However, the different amplitudes of the various target positions scale things. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + error = ((int32_t) z->im*target->re - (int32_t) z->re*target->im) >> FP_SHIFT_FACTOR; + s->rx.carrier_phase_rate += (s->rx.carrier_track_i*error); + s->rx.carrier_phase += (s->rx.carrier_track_p*error); + //span_log(&s->logging, + // SPAN_LOG_FLOW, + // "CARR: Im = %15.5f f = %15.5f - %10d %10d\n", + // error/1024.0f, + // dds_frequency(s->rx.carrier_phase_rate), + // (s->rx.carrier_track_i*error), + // (s->rx.carrier_track_p*error)); +#else error = z->im*target->re - z->re*target->im; - s->rx.carrier_phase_rate += (int32_t) (s->rx.carrier_track_i*error); s->rx.carrier_phase += (int32_t) (s->rx.carrier_track_p*error); - //span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->rx.carrier_phase_rate)); + //span_log(&s->logging, + // SPAN_LOG_FLOW, + // "CARR: Im = %15.5f f = %15.5f - %10d %10d\n", + // error, + // dds_frequencyf(s->rx.carrier_phase_rate), + // (int32_t) (s->rx.carrier_track_i*error), + // (int32_t) (s->rx.carrier_track_p*error)); +#endif } /*- End of function --------------------------------------------------------*/ @@ -339,40 +376,61 @@ static int decode_baudx(v22bis_state_t *s, int nearest) static __inline__ void symbol_sync(v22bis_state_t *s) { +#if defined(SPANDSP_USE_FIXED_POINTx) + int32_t p; + int32_t q; + complexi16_t a; + complexi16_t b; + complexi16_t c; + static const complexi16_t x = {FP_Q_1_15(0.894427f), FP_Q_1_15(0.44721f)}; +#else float p; float q; - complexf_t zz; complexf_t a; complexf_t b; complexf_t c; + static const complexf_t x = {0.894427f, 0.44721f}; +#endif + int aa[3]; + int i; + int j; /* This routine adapts the position of the half baud samples entering the equalizer. */ /* Perform a Gardner test for baud alignment on the three most recent samples. */ + for (i = 0, j = s->rx.eq_step; i < 3; i++) + { + if (--j < 0) + j = V22BIS_EQUALIZER_LEN - 1; + aa[i] = j; + } if (s->rx.sixteen_way_decisions) { - p = s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK].re - - s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK].re; - p *= s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK].re; + p = s->rx.eq_buf[aa[2]].re - s->rx.eq_buf[aa[0]].re; + p *= s->rx.eq_buf[aa[1]].re; - q = s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK].im - - s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK].im; - q *= s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK].im; + q = s->rx.eq_buf[aa[2]].im - s->rx.eq_buf[aa[0]].im; + q *= s->rx.eq_buf[aa[1]].im; } else { /* Rotate the points to the 45 degree positions, to maximise the effectiveness of the Gardner algorithm. This is particularly significant at the start of operation to pull things in quickly. */ - zz = complex_setf(0.894427, 0.44721f); - a = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 3) & V22BIS_EQUALIZER_MASK], &zz); - b = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 2) & V22BIS_EQUALIZER_MASK], &zz); - c = complex_mulf(&s->rx.eq_buf[(s->rx.eq_step - 1) & V22BIS_EQUALIZER_MASK], &zz); +#if defined(SPANDSP_USE_FIXED_POINT) + a = complex_mul_q1_15(&s->rx.eq_buf[aa[2]], &x); + b = complex_mul_q1_15(&s->rx.eq_buf[aa[1]], &x); + c = complex_mul_q1_15(&s->rx.eq_buf[aa[0]], &x); +#else + a = complex_mulf(&s->rx.eq_buf[aa[2]], &x); + b = complex_mulf(&s->rx.eq_buf[aa[1]], &x); + c = complex_mulf(&s->rx.eq_buf[aa[0]], &x); +#endif p = (a.re - c.re)*b.re; q = (a.im - c.im)*b.im; } - s->rx.gardner_integrate += (p + q > 0.0f) ? s->rx.gardner_step : -s->rx.gardner_step; + s->rx.gardner_integrate += (p + q > 0) ? s->rx.gardner_step : -s->rx.gardner_step; if (abs(s->rx.gardner_integrate) >= 16) { @@ -389,11 +447,23 @@ static __inline__ void symbol_sync(v22bis_state_t *s) } /*- End of function --------------------------------------------------------*/ -static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ void process_half_baud(v22bis_state_t *s, const complexi16_t *sample) +#else +static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sample) +#endif { +#if defined(SPANDSP_USE_FIXED_POINTx) + complexi16_t z; + complexi16_t zz; + const complexi16_t *target; + static const complexi16_t x = {FP_Q_1_15(0.894427f), FP_Q_1_15(0.44721f)}; +#else complexf_t z; complexf_t zz; const complexf_t *target; + static const complexf_t x = {0.894427f, 0.44721f}; +#endif int re; int im; int nearest; @@ -406,7 +476,8 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */ s->rx.eq_buf[s->rx.eq_step] = z; - s->rx.eq_step = (s->rx.eq_step + 1) & V22BIS_EQUALIZER_MASK; + if (++s->rx.eq_step >= V22BIS_EQUALIZER_LEN) + s->rx.eq_step = 0; /* On alternate insertions we have a whole baud and must process it. */ if ((s->rx.baud_phase ^= 1)) @@ -419,12 +490,17 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) /* Find the constellation point */ if (s->rx.sixteen_way_decisions) { +#if defined(SPANDSP_USE_FIXED_POINTx) + re = (z.re + FP_Q_6_10(3.0f)) >> FP_SHIFT_FACTOR; + im = (z.im + FP_Q_6_10(3.0f)) >> FP_SHIFT_FACTOR; +#else re = (int) (z.re + 3.0f); + im = (int) (z.im + 3.0f); +#endif if (re > 5) re = 5; else if (re < 0) re = 0; - im = (int) (z.im + 3.0f); if (im > 5) im = 5; else if (im < 0) @@ -433,13 +509,16 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) } else { - /* Rotate to 45 degrees, to make the slicing trivial */ - zz = complex_setf(0.894427, 0.44721f); - zz = complex_mulf(&z, &zz); + /* Rotate to 45 degrees, to make the slicing trivial. */ +#if defined(SPANDSP_USE_FIXED_POINT) + zz = complex_mul_q1_15(&z, &x); +#else + zz = complex_mulf(&z, &x); +#endif nearest = 0x01; - if (zz.re < 0.0f) + if (zz.re < 0) nearest |= 0x04; - if (zz.im < 0.0f) + if (zz.im < 0) { nearest ^= 0x04; nearest |= 0x08; @@ -493,10 +572,7 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) error could be higher. */ s->rx.gardner_step = 4; s->rx.pattern_repeats = 0; - if (s->calling_party) - s->rx.training = V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES; - else - s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200; + s->rx.training = (s->calling_party) ? V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES : V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200; /* Be pessimistic and see what the handshake brings */ s->negotiated_bit_rate = 1200; break; @@ -612,7 +688,11 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11; /* Normal reception starts immediately */ s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->rx.carrier_track_i = 8; +#else s->rx.carrier_track_i = 8000.0f; +#endif } else { @@ -636,7 +716,11 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) s->rx.sixteen_way_decisions = TRUE; s->rx.training = V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400; s->rx.pattern_repeats = 0; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->rx.carrier_track_i = 8; +#else s->rx.carrier_track_i = 8000.0f; +#endif } } else @@ -698,12 +782,20 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l { int i; int step; +#if defined(SPANDSP_USE_FIXED_POINTx) + complexi16_t z; + complexi16_t zz; + complexi16_t sample; + int32_t ii; + int32_t qq; +#else complexf_t z; complexf_t zz; - int32_t power; complexf_t sample; float ii; float qq; +#endif + int32_t power; for (i = 0; i < len; i++) { @@ -720,7 +812,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l if (s->calling_party) { #if defined(SPANDSP_USE_FIXED_POINT) - ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; #else ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); #endif @@ -728,12 +820,12 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l else { #if defined(SPANDSP_USE_FIXED_POINT) - ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; #else ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); #endif } - power = power_meter_update(&(s->rx.rx_power), (int16_t) ii); + power = power_meter_update(&s->rx.rx_power, (int16_t) ii); if (s->rx.signal_present) { /* Look for power below the carrier off point */ @@ -752,58 +844,75 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l s->rx.signal_present = TRUE; v22bis_report_status_change(s, SIG_STATUS_CARRIER_UP); } - if (s->rx.training != V22BIS_RX_TRAINING_STAGE_PARKED) + /* Only spend effort processing this data if the modem is not parked, after + a training failure. */ + if (s->rx.training == V22BIS_RX_TRAINING_STAGE_PARKED) + continue; + + /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm + will fiddle the step to align this with the symbols. */ + if ((s->rx.eq_put_step -= PULSESHAPER_COEFF_SETS) <= 0) { - /* Only spend effort processing this data if the modem is not - parked, after a training failure. */ - z = dds_complexf(&s->rx.carrier_phase, s->rx.carrier_phase_rate); if (s->rx.training == V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION) { /* Only AGC during the initial symbol acquisition, and then lock the gain. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + s->rx.agc_scaling = saturate16(((int32_t) (1024.0f*1024.0f*0.18f*3.60f))/fixed_sqrt32(power)); +#else s->rx.agc_scaling = 0.18f*3.60f/sqrtf(power); +#endif } - /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm - will fiddle the step to align this with the symbols. */ - if ((s->rx.eq_put_step -= PULSESHAPER_COEFF_SETS) <= 0) + /* Pulse shape while still at the carrier frequency, using a quadrature + pair of filters. This results in a properly bandpass filtered complex + signal, which can be brought directly to bandband by complex mixing. + No further filtering, to remove mixer harmonics, is needed. */ + step = -s->rx.eq_put_step; + if (step > PULSESHAPER_COEFF_SETS - 1) + step = PULSESHAPER_COEFF_SETS - 1; + s->rx.eq_put_step += PULSESHAPER_COEFF_SETS*40/(3*2); + if (s->calling_party) { - /* Pulse shape while still at the carrier frequency, using a quadrature - pair of filters. This results in a properly bandpass filtered complex - signal, which can be brought directly to bandband by complex mixing. - No further filtering, to remove mixer harmonics, is needed. */ - step = -s->rx.eq_put_step; - if (step > PULSESHAPER_COEFF_SETS - 1) - step = PULSESHAPER_COEFF_SETS - 1; - s->rx.eq_put_step += PULSESHAPER_COEFF_SETS*40/(3*2); - if (s->calling_party) - { -#if defined(SPANDSP_USE_FIXED_POINT) - ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); - qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#if defined(SPANDSP_USE_FIXED_POINTx) + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; + qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; #else - ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); - qq = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + qq = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); #endif - } - else - { -#if defined(SPANDSP_USE_FIXED_POINT) - ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); - qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); -#else - ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); - qq = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); -#endif - } - sample.re = ii*s->rx.agc_scaling; - sample.im = qq*s->rx.agc_scaling; - /* Shift to baseband - since this is done in a full complex form, the - result is clean, and requires no further filtering apart from the - equalizer. */ - zz.re = sample.re*z.re - sample.im*z.im; - zz.im = -sample.re*z.im - sample.im*z.re; - process_half_baud(s, &zz); } + else + { +#if defined(SPANDSP_USE_FIXED_POINTx) + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; + qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; +#else + ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + qq = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#endif + } + /* Shift to baseband - since this is done in a full complex form, the + result is clean, and requires no further filtering apart from the + equalizer. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + sample.re = (ii*s->rx.agc_scaling) >> FP_SHIFT_FACTOR; + sample.im = (qq*s->rx.agc_scaling) >> FP_SHIFT_FACTOR; + z = dds_lookup_complexi16(s->rx.carrier_phase); + zz.re = ((int32_t) sample.re*z.re - (int32_t) sample.im*z.im) >> 15; + zz.im = ((int32_t) -sample.re*z.im - (int32_t) sample.im*z.re) >> 15; +#else + sample.re = ii*s->rx.agc_scaling; + sample.im = qq*s->rx.agc_scaling; + z = dds_lookup_complexf(s->rx.carrier_phase); + zz.re = sample.re*z.re - sample.im*z.im; + zz.im = -sample.re*z.im - sample.im*z.re; +#endif + process_half_baud(s, &zz); } +#if defined(SPANDSP_USE_FIXED_POINT) + dds_advance(&s->rx.carrier_phase, s->rx.carrier_phase_rate); +#else + dds_advancef(&s->rx.carrier_phase, s->rx.carrier_phase_rate); +#endif } return 0; } @@ -835,8 +944,10 @@ int v22bis_rx_restart(v22bis_state_t *s) { #if defined(SPANDSP_USE_FIXED_POINTx) vec_zeroi16(s->rx.rrc_filter, sizeof(s->rx.rrc_filter)/sizeof(s->rx.rrc_filter[0])); + s->rx.training_error = 0; #else vec_zerof(s->rx.rrc_filter, sizeof(s->rx.rrc_filter)/sizeof(s->rx.rrc_filter[0])); + s->rx.training_error = 0.0f; #endif s->rx.rrc_filter_step = 0; s->rx.scramble_reg = 0; @@ -847,9 +958,13 @@ int v22bis_rx_restart(v22bis_state_t *s) s->rx.carrier_phase_rate = dds_phase_ratef((s->calling_party) ? 2400.0f : 1200.0f); s->rx.carrier_phase = 0; - power_meter_init(&(s->rx.rx_power), 5); + power_meter_init(&s->rx.rx_power, 5); v22bis_rx_signal_cutoff(s, -45.5f); +#if defined(SPANDSP_USE_FIXED_POINT) + s->rx.agc_scaling = (float) (1024.0f*1024.0f)*0.0005f*0.025f; +#else s->rx.agc_scaling = 0.0005f*0.025f; +#endif s->rx.constellation_state = 0; s->rx.sixteen_way_decisions = FALSE; @@ -861,11 +976,15 @@ int v22bis_rx_restart(v22bis_state_t *s) s->rx.gardner_integrate = 0; s->rx.gardner_step = 256; s->rx.baud_phase = 0; - s->rx.training_error = 0.0f; s->rx.total_baud_timing_correction = 0; /* We want the carrier to pull in faster on the answerer side, as it has very little time to adapt. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + s->rx.carrier_track_i = (s->calling_party) ? 8 : 40; + s->rx.carrier_track_p = 8000; +#else s->rx.carrier_track_i = (s->calling_party) ? 8000.0f : 40000.0f; s->rx.carrier_track_p = 8000000.0f; +#endif s->negotiated_bit_rate = 1200; diff --git a/libs/spandsp/src/v22bis_tx.c b/libs/spandsp/src/v22bis_tx.c index 2f8c724f6b..5cbef4d7d8 100644 --- a/libs/spandsp/src/v22bis_tx.c +++ b/libs/spandsp/src/v22bis_tx.c @@ -62,7 +62,7 @@ #include "spandsp/private/logging.h" #include "spandsp/private/v22bis.h" -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) #define FP_SCALE FP_Q_6_10 #include "v22bis_tx_fixed_rrc.h" #else @@ -248,7 +248,7 @@ static const int phase_steps[4] = 1, 0, 2, 3 }; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) const complexi16_t v22bis_constellation[16] = #else const complexf_t v22bis_constellation[16] = @@ -314,7 +314,7 @@ static __inline__ int get_scrambled_bit(v22bis_state_t *s) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static complexi16_t training_get(v22bis_state_t *s) #else static complexf_t training_get(v22bis_state_t *s) @@ -417,13 +417,13 @@ static complexf_t training_get(v22bis_state_t *s) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static complexi16_t getbaud(v22bis_state_t *s) #else static complexf_t getbaud(v22bis_state_t *s) #endif { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static const complexi16_t zero = {0, 0}; #else static const complexf_t zero = {0.0f, 0.0f}; @@ -464,7 +464,7 @@ static complexf_t getbaud(v22bis_state_t *s) SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t v; complexi32_t x; complexi32_t z; @@ -490,7 +490,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) if (++s->tx.rrc_filter_step >= V22BIS_TX_FILTER_STEPS) s->tx.rrc_filter_step = 0; } -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) /* Root raised cosine pulse shaping at baseband */ x.re = vec_circular_dot_prodi16(s->tx.rrc_filter_re, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->tx.baud_phase], V22BIS_TX_FILTER_STEPS, s->tx.rrc_filter_step) >> 14; x.im = vec_circular_dot_prodi16(s->tx.rrc_filter_im, tx_pulseshaper[TX_PULSESHAPER_COEFF_SETS - 1 - s->tx.baud_phase], V22BIS_TX_FILTER_STEPS, s->tx.rrc_filter_step) >> 14; @@ -551,7 +551,7 @@ SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power) } sig_gain = 0.4490f*powf(10.0f, (sig_power - DBM0_MAX_POWER)/20.0f)*32768.0f/TX_PULSESHAPER_GAIN; guard_tone_gain = powf(10.0f, (guard_tone_power - DBM0_MAX_POWER)/20.0f)*32768.0f; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) s->tx.gain = (int16_t) sig_gain; s->tx.guard_tone_gain = (int16_t) guard_tone_gain; #else @@ -563,7 +563,7 @@ SPAN_DECLARE(void) v22bis_tx_power(v22bis_state_t *s, float power) static int v22bis_tx_restart(v22bis_state_t *s) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) vec_zeroi16(s->tx.rrc_filter_re, sizeof(s->tx.rrc_filter_re)/sizeof(s->tx.rrc_filter_re[0])); vec_zeroi16(s->tx.rrc_filter_im, sizeof(s->tx.rrc_filter_im)/sizeof(s->tx.rrc_filter_im[0])); #else diff --git a/libs/spandsp/src/v27ter_rx.c b/libs/spandsp/src/v27ter_rx.c index 5ae87dc44d..b38481b87a 100644 --- a/libs/spandsp/src/v27ter_rx.c +++ b/libs/spandsp/src/v27ter_rx.c @@ -65,11 +65,13 @@ #include "spandsp/private/v27ter_rx.h" #if defined(SPANDSP_USE_FIXED_POINT) -#define FP_SCALE FP_Q_6_10 +#define FP_SCALE FP_Q_6_10 +#define FP_FACTOR 4096 +#define FP_SHIFT_FACTOR 12 #include "v27ter_rx_4800_fixed_rrc.h" #include "v27ter_rx_2400_fixed_rrc.h" #else -#define FP_SCALE(x) (x) +#define FP_SCALE(x) (x) #include "v27ter_rx_4800_floating_rrc.h" #include "v27ter_rx_2400_floating_rrc.h" #endif @@ -87,11 +89,6 @@ /*! The adaption rate coefficient for the equalizer */ #define EQUALIZER_DELTA 0.25f -#if defined(SPANDSP_USE_FIXED_POINT) -#define FP_FACTOR 4096 -#define FP_SHIFT_FACTOR 12 -#endif - /* Segments of the training sequence */ /* V.27ter defines a long and a short sequence. FAX doesn't use the short sequence, so it is not implemented here. */ @@ -113,7 +110,7 @@ enum TRAINING_STAGE_PARKED }; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static const complexi16_t v27ter_constellation[8] = #else static const complexf_t v27ter_constellation[8] = @@ -167,7 +164,7 @@ static void report_status_change(v27ter_rx_state_t *s, int status) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t **coeffs) #else SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs) @@ -180,7 +177,7 @@ SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **c static void equalizer_save(v27ter_rx_state_t *s) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) cvec_copyi16(s->eq_coeff_save, s->eq_coeff, V27TER_EQUALIZER_LEN); #else cvec_copyf(s->eq_coeff_save, s->eq_coeff, V27TER_EQUALIZER_LEN); @@ -190,7 +187,7 @@ static void equalizer_save(v27ter_rx_state_t *s) static void equalizer_restore(v27ter_rx_state_t *s) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) cvec_copyi16(s->eq_coeff, s->eq_coeff_save, V27TER_EQUALIZER_LEN); cvec_zeroi16(s->eq_buf, V27TER_EQUALIZER_LEN); s->eq_delta = 32768.0f*EQUALIZER_DELTA/V27TER_EQUALIZER_LEN; @@ -208,7 +205,7 @@ static void equalizer_restore(v27ter_rx_state_t *s) static void equalizer_reset(v27ter_rx_state_t *s) { /* Start with an equalizer based on everything being perfect. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static const complexi16_t x = {FP_SCALE(1.414f), FP_SCALE(0.0f)}; cvec_zeroi16(s->eq_coeff, V27TER_EQUALIZER_LEN); @@ -229,50 +226,36 @@ static void equalizer_reset(v27ter_rx_state_t *s) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) -static __inline__ complexi16_t complex_mul_q4_12(const complexi16_t *x, const complexi16_t *y) -{ - complexi16_t z; - - z.re = ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> 12; - z.im = ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> 12; - return z; -} -/*- End of function --------------------------------------------------------*/ -#endif - -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static __inline__ complexi16_t equalizer_get(v27ter_rx_state_t *s) -#else -static __inline__ complexf_t equalizer_get(v27ter_rx_state_t *s) -#endif { -#if defined(SPANDSP_USE_FIXED_POINTx) complexi32_t zz; complexi16_t z; /* Get the next equalized value. */ zz = cvec_circular_dot_prodi16(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step); - z.re = zz.re >> FP_SHIFT_FACTOR; - z.im = zz.im >> FP_SHIFT_FACTOR; + z.re = zz.re >> 14; + z.im = zz.im >> 14; return z; +} #else +static __inline__ complexf_t equalizer_get(v27ter_rx_state_t *s) +{ /* Get the next equalized value. */ return cvec_circular_dot_prodf(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step); -#endif } +#endif /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static void tune_equalizer(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) { complexi16_t err; /* Find the x and y mismatch from the exact constellation position. */ - err.re = target->re*FP_FACTOR - z->re; - err.im = target->im*FP_FACTOR - z->im; - err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; - err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; + err = complex_subi16(target, z); + err.re = ((int32_t) err.re*s->eq_delta) >> 13; + err.im = ((int32_t) err.im*s->eq_delta) >> 13; cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step, &err); } #else @@ -289,7 +272,7 @@ static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const comp #endif /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static __inline__ int find_quadrant(const complexi16_t *z) #else static __inline__ int find_quadrant(const complexf_t *z) @@ -305,25 +288,36 @@ static __inline__ int find_quadrant(const complexf_t *z) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static __inline__ int find_octant(complexi16_t *z) #else static __inline__ int find_octant(complexf_t *z) #endif { +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t abs_re; + int32_t abs_im; +#else float abs_re; float abs_im; +#endif int b1; int b2; int bits; /* Are we near an axis or a diagonal? */ +#if defined(SPANDSP_USE_FIXED_POINT) + abs_re = abs(z->re); + abs_im = abs(z->im); + if (abs_im*1000 > abs_re*414 && abs_im*1000 < abs_re*2414) +#else abs_re = fabsf(z->re); abs_im = fabsf(z->im); if (abs_im > abs_re*0.4142136f && abs_im < abs_re*2.4142136f) +#endif { /* Split the space along the two axes. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) b1 = (z->re < 0); b2 = (z->im < 0); #else @@ -343,13 +337,13 @@ static __inline__ int find_octant(complexf_t *z) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) #else static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target) #endif { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) int32_t error; #else float error; @@ -358,13 +352,12 @@ static __inline__ void track_carrier(v27ter_rx_state_t *s, const complexf_t *z, /* For small errors the imaginary part of the difference between the actual and the target positions is proportional to the phase error, for any particular target. However, the different amplitudes of the various target positions scale things. */ - error = z->im*target->re - z->re*target->im; - -#if defined(SPANDSP_USE_FIXED_POINTx) - error /= (float) FP_FACTOR; - s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error); - s->carrier_phase += (int32_t) (s->carrier_track_p*error); +#if defined(SPANDSP_USE_FIXED_POINT) + error = ((int32_t) z->im*target->re - (int32_t) z->re*target->im) >> 10; + s->carrier_phase_rate += ((s->carrier_track_i*error) >> FP_SHIFT_FACTOR); + s->carrier_phase += ((s->carrier_track_p*error) >> FP_SHIFT_FACTOR); #else + error = z->im*target->re - z->re*target->im; s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error); s->carrier_phase += (int32_t) (s->carrier_track_p*error); //span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->carrier_phase_rate)); @@ -429,7 +422,7 @@ static __inline__ void put_bit(v27ter_rx_state_t *s, int bit) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static void decode_baud(v27ter_rx_state_t *s, complexi16_t *z) #else static void decode_baud(v27ter_rx_state_t *s, complexf_t *z) @@ -478,8 +471,13 @@ static void decode_baud(v27ter_rx_state_t *s, complexf_t *z) static __inline__ void symbol_sync(v27ter_rx_state_t *s) { +#if defined(SPANDSP_USE_FIXED_POINT) + int32_t p; + int32_t q; +#else float p; float q; +#endif /* This routine adapts the position of the half baud samples entering the equalizer. */ @@ -492,7 +490,7 @@ static __inline__ void symbol_sync(v27ter_rx_state_t *s) - s->eq_buf[(s->eq_step - 1) & (V27TER_EQUALIZER_LEN - 1)].im; q *= s->eq_buf[(s->eq_step - 2) & (V27TER_EQUALIZER_LEN - 1)].im; - s->gardner_integrate += (p + q > 0.0f) ? s->gardner_step : -s->gardner_step; + s->gardner_integrate += (p + q > 0) ? s->gardner_step : -s->gardner_step; if (abs(s->gardner_integrate) >= 256) { @@ -516,22 +514,19 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexi16_ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t *sample) #endif { - static const int abab_pos[2] = - { - 0, 4 - }; - complexf_t zz; -#if defined(SPANDSP_USE_FIXED_POINTx) - complexf_t z1; + static const int abab_pos[2] = {0, 4}; +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t z; + complexi16_t z16; const complexi16_t *target; static const complexi16_t zero = {0, 0}; #else + float p; complexf_t z; + complexf_t zz; const complexf_t *target; static const complexf_t zero = {0.0f, 0.0f}; #endif - float p; int i; int j; int32_t angle; @@ -540,12 +535,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */ -#if defined(SPANDSP_USE_FIXED_POINT) - s->eq_buf[s->eq_step].re = sample->re/(float) FP_FACTOR; - s->eq_buf[s->eq_step].im = sample->im/(float) FP_FACTOR; -#else s->eq_buf[s->eq_step] = *sample; -#endif if (++s->eq_step >= V27TER_EQUALIZER_LEN) s->eq_step = 0; @@ -583,9 +573,8 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t case TRAINING_STAGE_LOG_PHASE: /* Record the current alternate phase angle */ target = &zero; - angle = arctan2(z.im, z.re); s->angles[1] = - s->start_angles[1] = angle; + s->start_angles[1] = arctan2(z.im, z.re); s->training_count = 1; s->training_stage = TRAINING_STAGE_WAIT_FOR_HOP; break; @@ -609,8 +598,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t if (i) { j = i & 0xF; - ang = (s->angles[j] - s->start_angles[0])/i - + (s->angles[j | 0x1] - s->start_angles[1])/i; + ang = (s->angles[j] - s->start_angles[0])/i + (s->angles[j | 0x1] - s->start_angles[1])/i; if (s->bit_rate == 4800) s->carrier_phase_rate += ang/10; else @@ -622,27 +610,22 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t || s->carrier_phase_rate > dds_phase_ratef(CARRIER_NOMINAL_FREQ + 20.0f)) { - span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); - /* Park this modem */ - s->training_stage = TRAINING_STAGE_PARKED; - report_status_change(s, SIG_STATUS_TRAINING_FAILED); - break; + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); + /* Park this modem */ + s->training_stage = TRAINING_STAGE_PARKED; + report_status_change(s, SIG_STATUS_TRAINING_FAILED); + break; } /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer buffer, as well as the carrier phase, for this to play out nicely. */ angle += 0x80000000; - p = angle*2.0f*3.14159f/(65536.0f*65536.0f); -#if defined(SPANDSP_USE_FIXED_POINTx) - zz = complex_setf(cosf(p), -sinf(p)); +#if defined(SPANDSP_USE_FIXED_POINT) + z16 = complex_seti16(fixed_cos(angle >> 16), -fixed_sin(angle >> 16)); for (i = 0; i < V27TER_EQUALIZER_LEN; i++) - { - z1 = complex_setf(s->eq_buf[i].re, s->eq_buf[i].im); - z1 = complex_mulf(&z1, &zz); - s->eq_buf[i].re = z1.re; - s->eq_buf[i].im = z1.im; - } + s->eq_buf[i] = complex_mul_q1_15(&s->eq_buf[i], &z16); #else + p = angle*2.0f*3.14159f/(65536.0f*65536.0f); zz = complex_setf(cosf(p), -sinf(p)); for (i = 0; i < V27TER_EQUALIZER_LEN; i++) s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); @@ -682,7 +665,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t track_carrier(s, &z, target); tune_equalizer(s, &z, target); -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) s->carrier_track_i = 400 + (200000 - 400)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN; s->carrier_track_p = 1000000 + (10000000 - 1000000)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN; #else @@ -702,13 +685,9 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t constellation_state = (s->bit_rate == 4800) ? s->constellation_state : (s->constellation_state << 1); target = &v27ter_constellation[constellation_state]; /* Measure the training error */ -#if defined(SPANDSP_USE_FIXED_POINTx) - z1.re = z.re/(float) FP_FACTOR; - z1.im = z.im/(float) FP_FACTOR; - zz.re = target->re; - zz.im = target->im; - zz = complex_subf(&z1, &zz); - s->training_error += powerf(&zz); +#if defined(SPANDSP_USE_FIXED_POINT) + z16 = complex_subi16(&z, target); + s->training_error += poweri16(&z16); #else zz = complex_subf(&z, target); s->training_error += powerf(&zz); @@ -717,12 +696,20 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t { /* At 4800bps the symbols are 1.08238 (Euclidian) apart. At 2400bps the symbols are 2.0 (Euclidian) apart. */ +#if defined(SPANDSP_USE_FIXED_POINT) + if ((s->bit_rate == 4800 && s->training_error < V27TER_TRAINING_SEG_6_LEN*FP_FACTOR*FP_FACTOR/4) + || + (s->bit_rate == 2400 && s->training_error < V27TER_TRAINING_SEG_6_LEN*FP_FACTOR*FP_FACTOR/2)) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %d)\n", s->bit_rate, s->training_error); +#else if ((s->bit_rate == 4800 && s->training_error < V27TER_TRAINING_SEG_6_LEN*0.25f) || (s->bit_rate == 2400 && s->training_error < V27TER_TRAINING_SEG_6_LEN*0.5f)) { - /* We are up and running */ span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error); +#endif + /* We are up and running */ report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through the processing. */ @@ -735,7 +722,11 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t else { /* Training has failed */ +#if defined(SPANDSP_USE_FIXED_POINT) + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %d)\n", s->training_error); +#else span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %f)\n", s->training_error); +#endif /* Park this modem */ s->training_stage = TRAINING_STAGE_PARKED; report_status_change(s, SIG_STATUS_TRAINING_FAILED); @@ -750,17 +741,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t break; } if (s->qam_report) - { -#if defined(SPANDSP_USE_FIXED_POINTx) - z1.re = z.re/(float) FP_FACTOR; - z1.im = z.im/(float) FP_FACTOR; - zz.re = target->re; - zz.im = target->im; - s->qam_report(s->qam_user_data, &z1, &zz, s->constellation_state); -#else s->qam_report(s->qam_user_data, &z, target, s->constellation_state); -#endif - } } /*- End of function --------------------------------------------------------*/ @@ -777,7 +758,7 @@ static __inline__ int signal_detect(v27ter_rx_state_t *s, int16_t amp) /* There could be overflow here, but it isn't a problem in practice */ diff = x - s->last_sample; s->last_sample = x; - power = power_meter_update(&(s->power), diff); + power = power_meter_update(&s->power, diff); #if defined(IAXMODEM_STUFF) /* Quick power drop fudge */ diff = abs(diff); @@ -785,7 +766,7 @@ static __inline__ int signal_detect(v27ter_rx_state_t *s, int16_t amp) { if (++s->low_samples > 120) { - power_meter_init(&(s->power), 4); + power_meter_init(&s->power, 4); s->high_sample = 0; s->low_samples = 0; } @@ -797,7 +778,7 @@ static __inline__ int signal_detect(v27ter_rx_state_t *s, int16_t amp) s->high_sample = diff; } #endif - //span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power))); + //span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&s->power)); if (s->signal_present > 0) { /* Look for power below turn-off threshold to turn the carrier off */ @@ -867,7 +848,7 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in parked, after training failure. */ if (s->training_stage == TRAINING_STAGE_PARKED) continue; - + /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm will fiddle the step to align this with the symbols. */ if ((s->eq_put_step -= RX_PULSESHAPER_4800_COEFF_SETS) <= 0) @@ -876,7 +857,7 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in { /* Only AGC during the initial training */ #if defined(SPANDSP_USE_FIXED_POINT) - s->agc_scaling = (float) FP_FACTOR*32768.0f*(1.0f/RX_PULSESHAPER_4800_GAIN)*1.414f/sqrtf(power); + s->agc_scaling = saturate16(((int32_t) (1024.0f*FP_FACTOR*1.414f))/fixed_sqrt32(power)); #else s->agc_scaling = (1.0f/RX_PULSESHAPER_4800_GAIN)*1.414f/sqrtf(power); #endif @@ -890,13 +871,13 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in step = RX_PULSESHAPER_4800_COEFF_SETS - 1; s->eq_put_step += RX_PULSESHAPER_4800_COEFF_SETS*5/2; #if defined(SPANDSP_USE_FIXED_POINT) - v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_4800_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); - sample.re = (v*(int32_t) s->agc_scaling) >> 15; - v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_4800_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); - sample.im = (v*(int32_t) s->agc_scaling) >> 15; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_4800_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.re = (v*s->agc_scaling) >> 10; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_4800_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.im = (v*s->agc_scaling) >> 10; z = dds_lookup_complexi16(s->carrier_phase); - zz.re = ((int32_t) sample.re*(int32_t) z.re - (int32_t) sample.im*(int32_t) z.im) >> 15; - zz.im = ((int32_t) -sample.re*(int32_t) z.im - (int32_t) sample.im*(int32_t) z.re) >> 15; + zz.re = ((int32_t) sample.re*z.re - (int32_t) sample.im*z.im) >> 15; + zz.im = ((int32_t) -sample.re*z.im - (int32_t) sample.im*z.re) >> 15; #else v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_4800_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); sample.re = v*s->agc_scaling; @@ -929,7 +910,7 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in parked, after training failure. */ if (s->training_stage == TRAINING_STAGE_PARKED) continue; - + /* Put things into the equalization buffer at T/2 rate. The Gardner algorithm will fiddle the step to align this with the symbols. */ if ((s->eq_put_step -= RX_PULSESHAPER_2400_COEFF_SETS) <= 0) @@ -938,7 +919,7 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in { /* Only AGC during the initial training */ #if defined(SPANDSP_USE_FIXED_POINT) - s->agc_scaling = (float) FP_FACTOR*32768.0f*(1.0f/RX_PULSESHAPER_2400_GAIN)*1.414f/sqrtf(power); + s->agc_scaling = saturate16(((int32_t) (1024.0f*FP_FACTOR*1.414f))/fixed_sqrt32(power)); #else s->agc_scaling = (1.0f/RX_PULSESHAPER_2400_GAIN)*1.414f/sqrtf(power); #endif @@ -952,13 +933,13 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in step = RX_PULSESHAPER_2400_COEFF_SETS - 1; s->eq_put_step += RX_PULSESHAPER_2400_COEFF_SETS*20/(3*2); #if defined(SPANDSP_USE_FIXED_POINT) - v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_2400_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); - sample.re = (v*(int32_t) s->agc_scaling) >> 15; - v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_2400_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); - sample.im = (v*(int32_t) s->agc_scaling) >> 15; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_2400_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.re = (v*s->agc_scaling) >> 10; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_2400_im[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.im = (v*s->agc_scaling) >> 10; z = dds_lookup_complexi16(s->carrier_phase); - zz.re = ((int32_t) sample.re*(int32_t) z.re - (int32_t) sample.im*(int32_t) z.im) >> 15; - zz.im = ((int32_t) -sample.re*(int32_t) z.im - (int32_t) sample.im*(int32_t) z.re) >> 15; + zz.re = ((int32_t) sample.re*z.re - (int32_t) sample.im*z.im) >> 15; + zz.im = ((int32_t) -sample.re*z.im - (int32_t) sample.im*z.re) >> 15; #else v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_2400_re[step], V27TER_RX_FILTER_STEPS, s->rrc_filter_step); sample.re = v*s->agc_scaling; @@ -1045,8 +1026,10 @@ SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_ #if defined(SPANDSP_USE_FIXED_POINT) vec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + s->training_error = 0; #else vec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + s->training_error = 0.0f; #endif s->rrc_filter_step = 0; @@ -1055,7 +1038,6 @@ SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_ s->training_stage = TRAINING_STAGE_SYMBOL_ACQUISITION; s->training_bc = 0; s->training_count = 0; - s->training_error = 0.0f; s->signal_present = 0; #if defined(IAXMODEM_STUFF) s->high_sample = 0; @@ -1064,14 +1046,14 @@ SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_ #endif s->carrier_phase = 0; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) s->carrier_track_i = 200000; s->carrier_track_p = 10000000; #else s->carrier_track_i = 200000.0f; s->carrier_track_p = 10000000.0f; #endif - power_meter_init(&(s->power), 4); + power_meter_init(&s->power, 4); s->constellation_state = 0; @@ -1084,10 +1066,10 @@ SPAN_DECLARE(int) v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_ else { s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); -#if defined(SPANDSP_USE_FIXED_POINTx) - s->agc_scaling = (float) FP_FACTOR*32768.0f*0.005f/RX_PULSESHAPER_4800_GAIN; +#if defined(SPANDSP_USE_FIXED_POINT) + s->agc_scaling = (float) (1024.0f*FP_FACTOR)*1.414f/283.0f; #else - s->agc_scaling = 0.005f/RX_PULSESHAPER_4800_GAIN; + s->agc_scaling = (1.0f/RX_PULSESHAPER_4800_GAIN)*1.414f/283.0f; #endif equalizer_reset(s); } diff --git a/libs/spandsp/src/v29rx.c b/libs/spandsp/src/v29rx.c index cfc60aeabb..a8a1ed9c94 100644 --- a/libs/spandsp/src/v29rx.c +++ b/libs/spandsp/src/v29rx.c @@ -63,10 +63,15 @@ #include "spandsp/private/logging.h" #include "spandsp/private/v29rx.h" -#include "v29tx_constellation_maps.h" #if defined(SPANDSP_USE_FIXED_POINT) +#define FP_SCALE FP_Q_4_12 +#define FP_FACTOR 4096 +#define FP_SHIFT_FACTOR 12 +#include "v29tx_constellation_maps.h" #include "v29rx_fixed_rrc.h" #else +#define FP_SCALE(x) (x) +#include "v29tx_constellation_maps.h" #include "v29rx_floating_rrc.h" #endif @@ -77,11 +82,6 @@ /*! The adaption rate coefficient for the equalizer */ #define EQUALIZER_DELTA 0.21f -#if defined(SPANDSP_USE_FIXED_POINT) -#define FP_FACTOR 4096 -#define FP_SHIFT_FACTOR 12 -#endif - /* Segments of the training sequence */ /*! The length of training segment 2, in symbols */ #define V29_TRAINING_SEG_2_LEN 128 @@ -136,13 +136,13 @@ static const uint8_t space_map_9600[20][20] = #define ALPHA 0.99f #if defined(SPANDSP_USE_FIXED_POINT) -#define SYNC_LOW_BAND_EDGE_COEFF_0 ((int)(FP_FACTOR*(2.0f*ALPHA*COS_LOW_BAND_EDGE))) -#define SYNC_LOW_BAND_EDGE_COEFF_1 ((int)(FP_FACTOR*(-ALPHA*ALPHA))) -#define SYNC_LOW_BAND_EDGE_COEFF_2 ((int)(FP_FACTOR*(-ALPHA*SIN_LOW_BAND_EDGE))) -#define SYNC_HIGH_BAND_EDGE_COEFF_0 ((int)(FP_FACTOR*(2.0f*ALPHA*COS_HIGH_BAND_EDGE))) -#define SYNC_HIGH_BAND_EDGE_COEFF_1 ((int)(FP_FACTOR*(-ALPHA*ALPHA))) -#define SYNC_HIGH_BAND_EDGE_COEFF_2 ((int)(FP_FACTOR*(-ALPHA*SIN_HIGH_BAND_EDGE))) -#define SYNC_MIXED_EDGES_COEFF_3 ((int)(FP_FACTOR*(-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE)))) +#define SYNC_LOW_BAND_EDGE_COEFF_0 FP_Q_6_10(2.0f*ALPHA*COS_LOW_BAND_EDGE) +#define SYNC_LOW_BAND_EDGE_COEFF_1 FP_Q_6_10(-ALPHA*ALPHA) +#define SYNC_LOW_BAND_EDGE_COEFF_2 FP_Q_6_10(-ALPHA*SIN_LOW_BAND_EDGE) +#define SYNC_HIGH_BAND_EDGE_COEFF_0 FP_Q_6_10(2.0f*ALPHA*COS_HIGH_BAND_EDGE) +#define SYNC_HIGH_BAND_EDGE_COEFF_1 FP_Q_6_10(-ALPHA*ALPHA) +#define SYNC_HIGH_BAND_EDGE_COEFF_2 FP_Q_6_10(-ALPHA*SIN_HIGH_BAND_EDGE) +#define SYNC_MIXED_EDGES_COEFF_3 FP_Q_6_10(-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE)) #else #define SYNC_LOW_BAND_EDGE_COEFF_0 (2.0f*ALPHA*COS_LOW_BAND_EDGE) #define SYNC_LOW_BAND_EDGE_COEFF_1 (-ALPHA*ALPHA) @@ -230,7 +230,7 @@ static void equalizer_reset(v29_rx_state_t *s) { /* Start with an equalizer based on everything being perfect */ #if defined(SPANDSP_USE_FIXED_POINT) - static const complexi16_t x = {3*FP_FACTOR, 0*FP_FACTOR}; + static const complexi16_t x = {FP_SCALE(3.0f), FP_SCALE(0.0f)}; cvec_zeroi16(s->eq_coeff, V29_EQUALIZER_LEN); s->eq_coeff[V29_EQUALIZER_PRE_LEN] = x; @@ -250,25 +250,9 @@ static void equalizer_reset(v29_rx_state_t *s) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINT) -static __inline__ complexi16_t complex_mul_q4_12(const complexi16_t *x, const complexi16_t *y) -{ - complexi16_t z; - - z.re = ((int32_t) x->re*(int32_t) y->re - (int32_t) x->im*(int32_t) y->im) >> FP_SHIFT_FACTOR; - z.im = ((int32_t) x->re*(int32_t) y->im + (int32_t) x->im*(int32_t) y->re) >> FP_SHIFT_FACTOR; - return z; -} -/*- End of function --------------------------------------------------------*/ -#endif - #if defined(SPANDSP_USE_FIXED_POINT) static __inline__ complexi16_t equalizer_get(v29_rx_state_t *s) -#else -static __inline__ complexf_t equalizer_get(v29_rx_state_t *s) -#endif { -#if defined(SPANDSP_USE_FIXED_POINT) complexi32_t zz; complexi16_t z; @@ -277,11 +261,14 @@ static __inline__ complexf_t equalizer_get(v29_rx_state_t *s) z.re = zz.re >> FP_SHIFT_FACTOR; z.im = zz.im >> FP_SHIFT_FACTOR; return z; +} #else +static __inline__ complexf_t equalizer_get(v29_rx_state_t *s) +{ /* Get the next equalized value. */ return cvec_circular_dot_prodf(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step); -#endif } +#endif /*- End of function --------------------------------------------------------*/ #if defined(SPANDSP_USE_FIXED_POINT) @@ -290,10 +277,9 @@ static void tune_equalizer(v29_rx_state_t *s, const complexi16_t *z, const compl complexi16_t err; /* Find the x and y mismatch from the exact constellation position. */ - err.re = target->re*FP_FACTOR - z->re; - err.im = target->im*FP_FACTOR - z->im; - err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; - err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; + err = complex_subi16(target, z); + err.re = ((int32_t) err.re*s->eq_delta) >> 15; + err.im = ((int32_t) err.im*s->eq_delta) >> 15; cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step, &err); } #else @@ -365,8 +351,11 @@ static __inline__ void track_carrier(v29_rx_state_t *s, const complexf_t *z, con different amplitudes of the various target positions scale things. This isn't all bad, as the angular error for the larger amplitude constellation points is probably a more reliable indicator, and we are weighting it as such. */ +#if defined(SPANDSP_USE_FIXED_POINT) + error = (((int32_t) z->im*target->re) >> FP_SHIFT_FACTOR) - (((int32_t) z->re*target->im) >> FP_SHIFT_FACTOR); +#else error = z->im*target->re - z->re*target->im; - +#endif /* Use a proportional-integral approach to tracking the carrier. The PI parameters are coarser at first, until we get precisely on target. Then, the filter will be damped more to keep us on target. */ @@ -562,18 +551,19 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample) 0, 3, 0, 2 }; - complexf_t zz; #if defined(SPANDSP_USE_FIXED_POINT) - complexf_t z1; + uint16_t ip; complexi16_t z; + complexi16_t z16; const complexi16_t *target; static const complexi16_t zero = {0, 0}; #else + float p; complexf_t z; + complexf_t zz; const complexf_t *target; static const complexf_t zero = {0.0f, 0.0f}; #endif - float p; int bit; int i; int j; @@ -671,17 +661,15 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample) } /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer buffer, as well as the carrier phase, for this to play out nicely. */ - p = angle*2.0f*3.14159f/(65536.0f*65536.0f); #if defined(SPANDSP_USE_FIXED_POINT) - zz = complex_setf(cosf(p), -sinf(p)); + ip = angle >> 16; + span_log(&s->logging, SPAN_LOG_FLOW, "Spin by %d\n", ip); + z16 = complex_seti16(fixed_cos(ip), -fixed_sin(ip)); for (i = 0; i < V29_EQUALIZER_LEN; i++) - { - z1 = complex_setf(s->eq_buf[i].re, s->eq_buf[i].im); - z1 = complex_mulf(&z1, &zz); - s->eq_buf[i].re = z1.re; - s->eq_buf[i].im = z1.im; - } + s->eq_buf[i] = complex_mul_q1_15(&s->eq_buf[i], &z16); #else + p = angle*2.0f*3.14159f/(65536.0f*65536.0f); + span_log(&s->logging, SPAN_LOG_FLOW, "Spin by %.5f rads\n", p); zz = complex_setf(cosf(p), -sinf(p)); for (i = 0; i < V29_EQUALIZER_LEN; i++) s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); @@ -743,23 +731,26 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample) tune_equalizer(s, &z, target); /* Measure the training error */ #if defined(SPANDSP_USE_FIXED_POINT) - z1.re = z.re/(float) FP_FACTOR; - z1.im = z.im/(float) FP_FACTOR; - zz.re = target->re; - zz.im = target->im; - zz = complex_subf(&z1, &zz); - s->training_error += powerf(&zz); + z16 = complex_subi16(&z, target); + s->training_error += poweri16(&z16); #else zz = complex_subf(&z, target); s->training_error += powerf(&zz); #endif if (++s->training_count >= V29_TRAINING_SEG_3_LEN) { +#if defined(SPANDSP_USE_FIXED_POINT) + span_log(&s->logging, SPAN_LOG_FLOW, "Constellation mismatch %d\n", s->training_error); + if (s->training_error < 48*2*FP_FACTOR*FP_FACTOR) + { + s->training_error = 0; +#else span_log(&s->logging, SPAN_LOG_FLOW, "Constellation mismatch %f\n", s->training_error); if (s->training_error < 48.0f*2.0f) { - s->training_count = 0; s->training_error = 0.0f; +#endif + s->training_count = 0; s->constellation_state = 0; s->training_stage = TRAINING_STAGE_TEST_ONES; } @@ -785,22 +776,26 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample) target = &v29_9600_constellation[s->constellation_state]; /* Measure the training error */ #if defined(SPANDSP_USE_FIXED_POINT) - z1.re = z.re/(float) FP_FACTOR; - z1.im = z.im/(float) FP_FACTOR; - zz.re = target->re; - zz.im = target->im; - zz = complex_subf(&z1, &zz); - s->training_error += powerf(&zz); + z16 = complex_subi16(&z, target); + s->training_error += poweri16(&z16); #else zz = complex_subf(&z, target); s->training_error += powerf(&zz); #endif if (++s->training_count >= V29_TRAINING_SEG_4_LEN) { +#if defined(SPANDSP_USE_FIXED_POINT) + if (s->training_error < 48*FP_FACTOR*FP_FACTOR) +#else if (s->training_error < 48.0f) +#endif { /* We are up and running */ +#if defined(SPANDSP_USE_FIXED_POINT) + span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %d)\n", s->bit_rate, s->training_error); +#else span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error); +#endif report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through the processing. */ @@ -812,12 +807,12 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample) } else { - /* Training has failed */ - span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %f)\n", s->training_error); - /* Park this modem */ + /* Training has failed. Park this modem */ #if defined(SPANDSP_USE_FIXED_POINT) + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %d)\n", s->training_error); s->agc_scaling_save = 0; #else + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %f)\n", s->training_error); s->agc_scaling_save = 0.0f; #endif s->training_stage = TRAINING_STAGE_PARKED; @@ -833,17 +828,7 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample) break; } if (s->qam_report) - { -#if defined(SPANDSP_USE_FIXED_POINT) - z1.re = z.re/(float) FP_FACTOR; - z1.im = z.im/(float) FP_FACTOR; - zz.re = target->re; - zz.im = target->im; - s->qam_report(s->qam_user_data, &z1, &zz, s->constellation_state); -#else s->qam_report(s->qam_user_data, &z, target, s->constellation_state); -#endif - } } /*- End of function --------------------------------------------------------*/ @@ -860,7 +845,7 @@ static __inline__ int signal_detect(v29_rx_state_t *s, int16_t amp) /* There could be overflow here, but it isn't a problem in practice */ diff = x - s->last_sample; s->last_sample = x; - power = power_meter_update(&(s->power), diff); + power = power_meter_update(&s->power, diff); #if defined(IAXMODEM_STUFF) /* Quick power drop fudge */ diff = abs(diff); @@ -868,7 +853,7 @@ static __inline__ int signal_detect(v29_rx_state_t *s, int16_t amp) { if (++s->low_samples > 120) { - power_meter_init(&(s->power), 4); + power_meter_init(&s->power, 4); s->high_sample = 0; s->low_samples = 0; } @@ -957,21 +942,20 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len) else if (step > RX_PULSESHAPER_COEFF_SETS - 1) step = RX_PULSESHAPER_COEFF_SETS - 1; #if defined(SPANDSP_USE_FIXED_POINT) - v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_re[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); - sample.re = (v*s->agc_scaling) >> 15; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_re[step], V29_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.re = (v*s->agc_scaling) >> 10; #else v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_re[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); sample.re = v*s->agc_scaling; #endif - /* Symbol timing synchronisation band edge filters */ #if defined(SPANDSP_USE_FIXED_POINT) /* Low Nyquist band edge filter */ - v = ((s->symbol_sync_low[0]*SYNC_LOW_BAND_EDGE_COEFF_0) >> FP_SHIFT_FACTOR) + ((s->symbol_sync_low[1]*SYNC_LOW_BAND_EDGE_COEFF_1) >> FP_SHIFT_FACTOR) + sample.re; + v = ((s->symbol_sync_low[0]*SYNC_LOW_BAND_EDGE_COEFF_0) >> 10) + ((s->symbol_sync_low[1]*SYNC_LOW_BAND_EDGE_COEFF_1) >> 10) + sample.re; s->symbol_sync_low[1] = s->symbol_sync_low[0]; s->symbol_sync_low[0] = v; /* High Nyquist band edge filter */ - v = ((s->symbol_sync_high[0]*SYNC_HIGH_BAND_EDGE_COEFF_0) >> FP_SHIFT_FACTOR) + ((s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_1) >> FP_SHIFT_FACTOR) + sample.re; + v = ((s->symbol_sync_high[0]*SYNC_HIGH_BAND_EDGE_COEFF_0) >> 10) + ((s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_1) >> 10) + sample.re; s->symbol_sync_high[1] = s->symbol_sync_high[0]; s->symbol_sync_high[0] = v; #else @@ -991,10 +975,10 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len) /* Only AGC until we have locked down the setting. */ #if defined(SPANDSP_USE_FIXED_POINT) if (s->agc_scaling_save == 0) - s->agc_scaling = (float) FP_FACTOR*32768.0f*(1.0f/RX_PULSESHAPER_GAIN)*5.0f*0.25f/sqrtf(power); + s->agc_scaling = saturate16(((int32_t) (1024.0f*FP_FACTOR*1.25f))/fixed_sqrt32(power)); #else if (s->agc_scaling_save == 0.0f) - s->agc_scaling = (1.0f/RX_PULSESHAPER_GAIN)*5.0f*0.25f/sqrtf(power); + s->agc_scaling = (1.0f/RX_PULSESHAPER_GAIN)*1.25f/sqrtf(power); #endif /* Pulse shape while still at the carrier frequency, using a quadrature pair of filters. This results in a properly bandpass filtered complex @@ -1002,11 +986,11 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len) No further filtering, to remove mixer harmonics, is needed. */ s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2); #if defined(SPANDSP_USE_FIXED_POINT) - v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_im[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); - sample.im = (v*s->agc_scaling) >> 15; + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_im[step], V29_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.im = (v*s->agc_scaling) >> 10; z = dds_lookup_complexi16(s->carrier_phase); - zz.re = ((int32_t) sample.re*(int32_t) z.re - (int32_t) sample.im*(int32_t) z.im) >> 15; - zz.im = ((int32_t) -sample.re*(int32_t) z.im - (int32_t) sample.im*(int32_t) z.re) >> 15; + zz.re = ((int32_t) sample.re*z.re - (int32_t) sample.im*z.im) >> 15; + zz.im = ((int32_t) -sample.re*z.im - (int32_t) sample.im*z.re) >> 15; #else v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_im[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); sample.im = v*s->agc_scaling; @@ -1115,7 +1099,7 @@ SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train) s->carrier_phase = 0; - power_meter_init(&(s->power), 4); + power_meter_init(&s->power, 4); s->constellation_state = 0; @@ -1131,10 +1115,10 @@ SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train) equalizer_reset(s); #if defined(SPANDSP_USE_FIXED_POINT) s->agc_scaling_save = 0; - s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN; + s->agc_scaling = (float) (1024.0f*FP_FACTOR)*1.25f/735.0f; #else s->agc_scaling_save = 0.0f; - s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; + s->agc_scaling = (1.0f/RX_PULSESHAPER_GAIN)*1.25f/735.0f; #endif } #if defined(SPANDSP_USE_FIXED_POINT) @@ -1168,7 +1152,6 @@ SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train) s->baud_half = 0; s->total_baud_timing_correction = 0; - return 0; } /*- End of function --------------------------------------------------------*/ From fd8c576c6692c1b9dbd66e69046293ee3f48fb4e Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 21 Jul 2012 21:17:11 +0800 Subject: [PATCH 0779/1057] Some tidying of the V.17 modem. Brought the modem test programs up to date --- libs/spandsp/src/spandsp/private/v17rx.h | 12 +- libs/spandsp/src/spandsp/v17rx.h | 2 +- libs/spandsp/src/v17rx.c | 380 +++++++++++++++++------ libs/spandsp/src/v27ter_tx.c | 36 +-- libs/spandsp/tests/fax_tests.c | 16 +- libs/spandsp/tests/v17_tests.c | 39 ++- libs/spandsp/tests/v22bis_tests.c | 25 +- libs/spandsp/tests/v27ter_tests.c | 36 ++- libs/spandsp/tests/v29_tests.c | 6 +- 9 files changed, 399 insertions(+), 153 deletions(-) diff --git a/libs/spandsp/src/spandsp/private/v17rx.h b/libs/spandsp/src/spandsp/private/v17rx.h index 81c7027cb2..a968290010 100644 --- a/libs/spandsp/src/spandsp/private/v17rx.h +++ b/libs/spandsp/src/spandsp/private/v17rx.h @@ -74,12 +74,12 @@ struct v17_rx_state_s #if defined(SPANDSP_USE_FIXED_POINTx) /*! \brief The scaling factor assessed by the AGC algorithm. */ - float agc_scaling; + int16_t agc_scaling; /*! \brief The previous value of agc_scaling, needed to reuse old training. */ - float agc_scaling_save; + int16_t agc_scaling_save; /*! \brief The current delta factor for updating the equalizer coefficients. */ - float eq_delta; + int16_t eq_delta; /*! \brief The adaptive equalizer coefficients. */ complexi16_t eq_coeff[V17_EQUALIZER_LEN]; /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ @@ -98,12 +98,12 @@ struct v17_rx_state_s /*! \brief A measure of how much mismatch there is between the real constellation, and the decoded symbol positions. */ - float training_error; + int32_t training_error; /*! \brief The proportional part of the carrier tracking filter. */ - float carrier_track_p; + int32_t carrier_track_p; /*! \brief The integral part of the carrier tracking filter. */ - float carrier_track_i; + int32_t carrier_track_i; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ int16_t rrc_filter[V17_RX_FILTER_STEPS]; diff --git a/libs/spandsp/src/spandsp/v17rx.h b/libs/spandsp/src/spandsp/v17rx.h index 4c01befd37..892217889a 100644 --- a/libs/spandsp/src/spandsp/v17rx.h +++ b/libs/spandsp/src/spandsp/v17rx.h @@ -292,7 +292,7 @@ SPAN_DECLARE_NONSTD(int) v17_rx_fillin(v17_rx_state_t *s, int len); \param s The modem context. \param coeffs The vector of complex coefficients. \return The number of coefficients in the vector. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi16_t **coeffs); #else SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs); diff --git a/libs/spandsp/src/v17rx.c b/libs/spandsp/src/v17rx.c index 62256eb3b4..27c568c46a 100644 --- a/libs/spandsp/src/v17rx.c +++ b/libs/spandsp/src/v17rx.c @@ -65,9 +65,13 @@ #include "spandsp/private/logging.h" #include "spandsp/private/v17rx.h" -#if defined(SPANDSP_USE_FIXED_POINT) +#if defined(SPANDSP_USE_FIXED_POINTx) +#define FP_SCALE(x) FP_Q_6_10(x) +#define FP_FACTOR 1024 +#define FP_SHIFT_FACTOR 12 #include "v17_v32bis_rx_fixed_rrc.h" #else +#define FP_SCALE(x) (x) #include "v17_v32bis_rx_floating_rrc.h" #endif #include "v17_v32bis_tx_constellation_maps.h" @@ -144,22 +148,16 @@ enum #endif #if defined(SPANDSP_USE_FIXED_POINTx) -static const int constellation_spacing[4] = -{ - FP_Q_6_10(1.414f), - FP_Q_6_10(2.0f), - FP_Q_6_10(2.828f), - FP_Q_6_10(4.0f) -}; +static const int16_t constellation_spacing[4] = #else static const float constellation_spacing[4] = -{ - 1.414f, - 2.0f, - 2.828f, - 4.0f -}; #endif +{ + FP_SCALE(1.414f), + FP_SCALE(2.0f), + FP_SCALE(2.828f), + FP_SCALE(4.0f) +}; SPAN_DECLARE(float) v17_rx_carrier_frequency(v17_rx_state_t *s) { @@ -196,13 +194,17 @@ static void report_status_change(v17_rx_state_t *s, int status) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi16_t **coeffs) #else SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs) #endif { +#if defined(SPANDSP_USE_FIXED_POINT) + *coeffs = NULL; +#else *coeffs = s->eq_coeff; +#endif return V17_EQUALIZER_LEN; } /*- End of function --------------------------------------------------------*/ @@ -239,13 +241,17 @@ static void equalizer_reset(v17_rx_state_t *s) { /* Start with an equalizer based on everything being perfect */ #if defined(SPANDSP_USE_FIXED_POINTx) + static const complexi16_t x = {FP_SCALE(3.0f), FP_SCALE(0.0f)}; + cvec_zeroi16(s->eq_coeff, V17_EQUALIZER_LEN); - s->eq_coeff[V17_EQUALIZER_PRE_LEN] = complex_seti16(3*FP_FACTOR, 0); + s->eq_coeff[V17_EQUALIZER_PRE_LEN] = x; cvec_zeroi16(s->eq_buf, V17_EQUALIZER_LEN); s->eq_delta = 32768.0f*EQUALIZER_DELTA/V17_EQUALIZER_LEN; #else + static const complexf_t x = {3.0f, 0.0f}; + cvec_zerof(s->eq_coeff, V17_EQUALIZER_LEN); - s->eq_coeff[V17_EQUALIZER_PRE_LEN] = complex_setf(3.0f, 0.0f); + s->eq_coeff[V17_EQUALIZER_PRE_LEN] = x; cvec_zerof(s->eq_buf, V17_EQUALIZER_LEN); s->eq_delta = EQUALIZER_DELTA/V17_EQUALIZER_LEN; #endif @@ -258,12 +264,23 @@ static void equalizer_reset(v17_rx_state_t *s) #if defined(SPANDSP_USE_FIXED_POINTx) static __inline__ complexi16_t equalizer_get(v17_rx_state_t *s) +{ + complexi32_t zz; + complexi16_t z; + + /* Get the next equalized value. */ + zz = cvec_circular_dot_prodi16(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step); + z.re = zz.re >> FP_SHIFT_FACTOR; + z.im = zz.im >> FP_SHIFT_FACTOR; + return z; +} #else static __inline__ complexf_t equalizer_get(v17_rx_state_t *s) -#endif { + /* Get the next equalized value. */ return cvec_circular_dot_prodf(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step); } +#endif /*- End of function --------------------------------------------------------*/ #if defined(SPANDSP_USE_FIXED_POINTx) @@ -272,11 +289,9 @@ static void tune_equalizer(v17_rx_state_t *s, const complexi16_t *z, const compl complexi16_t err; /* Find the x and y mismatch from the exact constellation position. */ - err.re = target->re*FP_FACTOR - z->re; - err.im = target->im*FP_FACTOR - z->im; - //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(err.re*err.re + err.im*err.im)); - err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; - err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; + err = complex_subi16(target, z); + err.re = ((int32_t) err.re*s->eq_delta) >> 15; + err.im = ((int32_t) err.im*s->eq_delta) >> 15; cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err); } #else @@ -308,19 +323,31 @@ static int descramble(v17_rx_state_t *s, int in_bit) } /*- End of function --------------------------------------------------------*/ -static void track_carrier(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target) +#if defined(SPANDSP_USE_FIXED_POINTx) +static __inline__ void track_carrier(v17_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) +#else +static __inline__ void track_carrier(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target) +#endif { +#if defined(SPANDSP_USE_FIXED_POINTx) + int32_t error; +#else float error; +#endif /* For small errors the imaginary part of the difference between the actual and the target positions is proportional to the phase error, for any particular target. However, the different amplitudes of the various target positions scale things. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + error = z->im*(target->re >> FP_SHIFT_FACTOR) - z->re*(target->im >> FP_SHIFT_FACTOR); + s->carrier_phase_rate += ((s->carrier_track_i*error) >> FP_SHIFT_FACTOR); + s->carrier_phase += ((s->carrier_track_p*error) >> FP_SHIFT_FACTOR); +#else error = z->im*target->re - z->re*target->im; - s->carrier_phase_rate += (int32_t) (s->carrier_track_i*error); s->carrier_phase += (int32_t) (s->carrier_track_p*error); //span_log(&s->logging, SPAN_LOG_FLOW, "Im = %15.5f f = %15.5f\n", error, dds_frequencyf(s->carrier_phase_rate)); - //printf("XXX Im = %15.5f f = %15.5f %f %f %f %f (%f %f)\n", error, dds_frequencyf(s->carrier_phase_rate), target->re, target->im, z->re, z->im, s->carrier_track_i, s->carrier_track_p); +#endif } /*- End of function --------------------------------------------------------*/ @@ -347,7 +374,7 @@ static __inline__ void put_bit(v17_rx_state_t *s, int bit) /*- End of function --------------------------------------------------------*/ #if defined(SPANDSP_USE_FIXED_POINTx) -static __inline__ uint32_t dist_sq(const complexi_t *x, const complexi_t *y) +static __inline__ uint32_t dist_sq(const complexi32_t *x, const complexi32_t *y) { return (x->re - y->re)*(x->re - y->re) + (x->im - y->im)*(x->im - y->im); } @@ -360,7 +387,11 @@ static __inline__ float dist_sq(const complexf_t *x, const complexf_t *y) /*- End of function --------------------------------------------------------*/ #endif +#if defined(SPANDSP_USE_FIXED_POINTx) +static int decode_baud(v17_rx_state_t *s, complexi16_t *z) +#else static int decode_baud(v17_rx_state_t *s, complexf_t *z) +#endif { static const uint8_t v32bis_4800_differential_decoder[4][4] = { @@ -396,29 +427,33 @@ static int decode_baud(v17_rx_state_t *s, complexf_t *z) int raw; int constellation_state; #if defined(SPANDSP_USE_FIXED_POINTx) -#define DIST_FACTOR 2048 /* Something less than sqrt(0xFFFFFFFF/10)/10 */ - complexi_t zi; +#define DIST_FACTOR 1024 /* Something less than sqrt(0xFFFFFFFF/10)/10 */ + complexi32_t zi; uint32_t distances[8]; uint32_t new_distances[8]; uint32_t min; - complexi_t ci; + complexi32_t ci; #else float distances[8]; float new_distances[8]; float min; #endif +#if defined(SPANDSP_USE_FIXED_POINTx) + re = (z->re + 9*FP_FACTOR) >> (FP_SHIFT_FACTOR - 1); + im = (z->im + 9*FP_FACTOR) >> (FP_SHIFT_FACTOR - 1); +#else re = (int) ((z->re + 9.0f)*2.0f); + im = (int) ((z->im + 9.0f)*2.0f); +#endif if (re > 35) re = 35; else if (re < 0) re = 0; - im = (int) ((z->im + 9.0f)*2.0f); if (im > 35) im = 35; else if (im < 0) im = 0; - if (s->bits_per_symbol == 2) { /* 4800bps V.32bis mode, without trellis coding */ @@ -434,7 +469,7 @@ static int decode_baud(v17_rx_state_t *s, complexf_t *z) to the target, with different patterns in the last 3 bits. */ #if defined(SPANDSP_USE_FIXED_POINTx) min = 0xFFFFFFFF; - zi = complex_seti(z->re*DIST_FACTOR, z->im*DIST_FACTOR); + zi = complex_seti32(z->re*DIST_FACTOR, z->im*DIST_FACTOR); #else min = 9999999.0f; #endif @@ -443,8 +478,8 @@ static int decode_baud(v17_rx_state_t *s, complexf_t *z) { nearest = constel_maps[s->space_map][re][im][i]; #if defined(SPANDSP_USE_FIXED_POINTx) - ci = complex_seti(s->constellation[nearest].re*DIST_FACTOR, - s->constellation[nearest].im*DIST_FACTOR); + ci = complex_seti32(s->constellation[nearest].re*DIST_FACTOR, + s->constellation[nearest].im*DIST_FACTOR); distances[i] = dist_sq(&ci, &zi); #else distances[i] = dist_sq(&s->constellation[nearest], z); @@ -594,7 +629,7 @@ static __inline__ void symbol_sync(v17_rx_state_t *s) v = s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_LOW_BAND_EDGE_COEFF_2 - s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_2 + s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_MIXED_EDGES_COEFF_3; - /* Filter away any DC component */ + /* Filter away any DC component */ p = v - s->symbol_sync_dc_filter[1]; s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0]; s->symbol_sync_dc_filter[0] = v; @@ -614,28 +649,40 @@ static __inline__ void symbol_sync(v17_rx_state_t *s) } /*- End of function --------------------------------------------------------*/ -static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) -{ - static const complexf_t cdba[4] = - { - { 6.0f, 2.0f}, - {-2.0f, 6.0f}, - { 2.0f, -6.0f}, - {-6.0f, -2.0f} - }; - complexf_t z; - complexf_t zz; #if defined(SPANDSP_USE_FIXED_POINTx) - const complexi_t *target; +static void process_half_baud(v17_rx_state_t *s, const complexi16_t *sample) +#else +static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) +#endif +{ +#if defined(SPANDSP_USE_FIXED_POINTx) + static const complexi16_t cdba[4] = +#else + static const complexf_t cdba[4] = +#endif + { + {FP_SCALE( 6.0f), FP_SCALE( 2.0f)}, + {FP_SCALE(-2.0f), FP_SCALE( 6.0f)}, + {FP_SCALE( 2.0f), FP_SCALE(-6.0f)}, + {FP_SCALE(-6.0f), FP_SCALE(-2.0f)} + }; +#if defined(SPANDSP_USE_FIXED_POINTx) + uint16_t ip; + complexi16_t z; + complexi16_t z16; + const complexi16_t *target; static const complexi16_t zero = {0, 0}; #else - const complexf_t *target; - static const complexf_t zero = {0, 0}; -#endif float p; + complexf_t z; + complexf_t zz; + const complexf_t *target; + static const complexf_t zero = {0.0f, 0.0f}; +#endif int bit; int i; int j; + uint32_t phase_step; int32_t angle; int32_t ang; int constellation_state; @@ -673,8 +720,13 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) s->angles[0] = s->start_angles[0] = arctan2(z.im, z.re); s->training_stage = TRAINING_STAGE_LOG_PHASE; +#if defined(SPANDSP_USE_FIXED_POINTx) + if (s->agc_scaling_save == 0) + s->agc_scaling_save = s->agc_scaling; +#else if (s->agc_scaling_save == 0.0f) s->agc_scaling_save = s->agc_scaling; +#endif } break; case TRAINING_STAGE_LOG_PHASE: @@ -701,15 +753,23 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer buffer, as well as the carrier phase, for this to play out nicely. */ /* angle is now the difference between where A is, and where it should be */ - p = 3.14159f + angle*2.0f*3.14159f/(65536.0f*65536.0f) - 0.321751f; + phase_step = 0x80000000 + angle - 219937506; +#if defined(SPANDSP_USE_FIXED_POINTx) + ip = phase_step >> 16; + span_log(&s->logging, SPAN_LOG_FLOW, "Spin (short) by %d\n", ip); + z16 = complex_seti16(fixed_cos(ip), -fixed_sin(ip)); + for (i = 0; i < V17_EQUALIZER_LEN; i++) + s->eq_buf[i] = complex_mul_q1_15(&s->eq_buf[i], &z16); + s->carrier_track_p = 500000; +#else + p = phase_step*2.0f*3.14159f/(65536.0f*65536.0f); span_log(&s->logging, SPAN_LOG_FLOW, "Spin (short) by %.5f rads\n", p); zz = complex_setf(cosf(p), -sinf(p)); for (i = 0; i < V17_EQUALIZER_LEN; i++) s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); - s->carrier_phase += (0x80000000 + angle - 219937506); - s->carrier_track_p = 500000.0f; - +#endif + s->carrier_phase += phase_step; s->training_stage = TRAINING_STAGE_SHORT_WAIT_FOR_CDBA; } else @@ -776,7 +836,11 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) { span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); /* Park this modem */ +#if defined(SPANDSP_USE_FIXED_POINTx) + s->agc_scaling_save = 0; +#else s->agc_scaling_save = 0.0f; +#endif s->training_stage = TRAINING_STAGE_PARKED; report_status_change(s, SIG_STATUS_TRAINING_FAILED); break; @@ -785,12 +849,21 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) /* Make a step shift in the phase, to pull it into line. We need to rotate the equalizer buffer, as well as the carrier phase, for this to play out nicely. */ /* angle is now the difference between where C is, and where it should be */ - p = angle*2.0f*3.14159f/(65536.0f*65536.0f) - 0.321751f; + phase_step = angle - 219937506; +#if defined(SPANDSP_USE_FIXED_POINTx) + ip = phase_step >> 16; + span_log(&s->logging, SPAN_LOG_FLOW, "Spin (long) by %d\n", ip); + z16 = complex_seti16(fixed_cos(ip), -fixed_sin(ip)); + for (i = 0; i < V17_EQUALIZER_LEN; i++) + s->eq_buf[i] = complex_mul_q1_15(&s->eq_buf[i], &z16); +#else + p = phase_step*2.0f*3.14159f/(65536.0f*65536.0f); span_log(&s->logging, SPAN_LOG_FLOW, "Spin (long) by %.5f rads\n", p); zz = complex_setf(cosf(p), -sinf(p)); for (i = 0; i < V17_EQUALIZER_LEN; i++) s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz); - s->carrier_phase += (angle - 219937506); +#endif + s->carrier_phase += phase_step; /* We have just seen the first symbol of the scrambled sequence, so skip it. */ bit = descramble(s, 1); @@ -807,7 +880,11 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) of a real training sequence. Note that this might be TEP. */ span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (sequence failed)\n"); /* Park this modem */ +#if defined(SPANDSP_USE_FIXED_POINTx) + s->agc_scaling_save = 0; +#else s->agc_scaling_save = 0.0f; +#endif s->training_stage = TRAINING_STAGE_PARKED; report_status_change(s, SIG_STATUS_TRAINING_FAILED); } @@ -820,9 +897,15 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) track_carrier(s, &z, target); tune_equalizer(s, &z, target); #if defined(IAXMODEM_STUFF) +#if defined(SPANDSP_USE_FIXED_POINTx) + z16 = complex_subi16(&z, target); + s->training_error += poweri16(&z16); + if (++s->training_count == V17_TRAINING_SEG_2_LEN - 2000 || s->training_error < 1*FP_FACTOR*FP_FACTOR || s->training_error > 200*FP_FACTOR*FP_FACTOR) +#else zz = complex_subf(&z, target); s->training_error = powerf(&zz); if (++s->training_count == V17_TRAINING_SEG_2_LEN - 2000 || s->training_error < 1.0f || s->training_error > 200.0f) +#endif #else if (++s->training_count == V17_TRAINING_SEG_2_LEN - 2000) #endif @@ -830,7 +913,11 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) /* Now the equaliser adaption should be getting somewhere, slow it down, or it will never tune very well on a noisy signal. */ s->eq_delta *= EQUALIZER_SLOW_ADAPT_RATIO; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->carrier_track_i = 1000; +#else s->carrier_track_i = 1000.0f; +#endif s->training_stage = TRAINING_STAGE_FINE_TRAIN_ON_CDBA; } break; @@ -844,9 +931,15 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) tune_equalizer(s, &z, target); if (++s->training_count >= V17_TRAINING_SEG_2_LEN - 48) { +#if defined(SPANDSP_USE_FIXED_POINTx) + s->training_error = 0; + s->carrier_track_i = 100; + s->carrier_track_p = 500000; +#else s->training_error = 0.0f; s->carrier_track_i = 100.0f; s->carrier_track_p = 500000.0f; +#endif s->training_stage = TRAINING_STAGE_TRAIN_ON_CDBA_AND_TEST; } break; @@ -863,23 +956,39 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) track_carrier(s, &z, target); tune_equalizer(s, &z, target); /* Measure the training error */ - zz = complex_subf(&z, &cdba[bit]); +#if defined(SPANDSP_USE_FIXED_POINTx) + z16 = complex_subi16(&z, target); + s->training_error += poweri16(&z16); +#else + zz = complex_subf(&z, target); s->training_error += powerf(&zz); +#endif } else if (s->training_count >= V17_TRAINING_SEG_2_LEN) { +#if defined(SPANDSP_USE_FIXED_POINTx) + span_log(&s->logging, SPAN_LOG_FLOW, "Long training error %d\n", s->training_error); + if (s->training_error < 20.0f*1.414f*FP_FACTOR*FP_FACTOR*constellation_spacing[s->space_map]) + { + s->training_error = 0; +#else span_log(&s->logging, SPAN_LOG_FLOW, "Long training error %f\n", s->training_error); if (s->training_error < 20.0f*1.414f*constellation_spacing[s->space_map]) { - s->training_count = 0; s->training_error = 0.0f; +#endif + s->training_count = 0; s->training_stage = TRAINING_STAGE_BRIDGE; } else { span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (convergence failed)\n"); /* Park this modem */ +#if defined(SPANDSP_USE_FIXED_POINTx) + s->agc_scaling_save = 0; +#else s->agc_scaling_save = 0.0f; +#endif s->training_stage = TRAINING_STAGE_PARKED; report_status_change(s, SIG_STATUS_TRAINING_FAILED); } @@ -891,8 +1000,12 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) target = &z; if (++s->training_count >= V17_TRAINING_SEG_3_LEN) { - s->training_count = 0; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->training_error = 0; +#else s->training_error = 0.0f; +#endif + s->training_count = 0; if (s->bits_per_symbol == 2) { /* Restart the differential decoder */ @@ -919,8 +1032,12 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) bit = descramble(s, 1); bit = (bit << 1) | descramble(s, 1); target = &cdba[bit]; - s->training_count = 1; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->training_error = 0; +#else s->training_error = 0.0f; +#endif + s->training_count = 1; s->training_stage = TRAINING_STAGE_SHORT_TRAIN_ON_CDBA_AND_TEST; break; } @@ -947,18 +1064,33 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) /* Measure the training error */ if (s->training_count > 8) { +#if defined(SPANDSP_USE_FIXED_POINTx) + z16 = complex_subi16(&z, &cdba[bit]); + s->training_error += poweri16(&z16); +#else zz = complex_subf(&z, &cdba[bit]); s->training_error += powerf(&zz); +#endif } if (++s->training_count >= V17_TRAINING_SHORT_SEG_2_LEN) { +#if defined(SPANDSP_USE_FIXED_POINTx) + span_log(&s->logging, SPAN_LOG_FLOW, "Short training error %d\n", s->training_error); + s->carrier_track_i = 100; + s->carrier_track_p = 500000; +#else span_log(&s->logging, SPAN_LOG_FLOW, "Short training error %f\n", s->training_error); s->carrier_track_i = 100.0f; s->carrier_track_p = 500000.0f; +#endif /* TODO: This was increased by a factor of 10 after studying real world failures. However, it is not clear why this is an improvement, If something gives a huge training error, surely it shouldn't decode too well? */ +#if defined(SPANDSP_USE_FIXED_POINTx) + if (s->training_error < (V17_TRAINING_SHORT_SEG_2_LEN - 8)*4.0f*FP_FACTOR*FP_FACTOR*constellation_spacing[s->space_map]) +#else if (s->training_error < (V17_TRAINING_SHORT_SEG_2_LEN - 8)*4.0f*constellation_spacing[s->space_map]) +#endif { s->training_count = 0; if (s->bits_per_symbol == 2) @@ -966,7 +1098,11 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) /* There is no trellis, so go straight to processing decoded data */ /* Restart the differential decoder */ s->diff = (s->short_train) ? 0 : 1; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->training_error = 0; +#else s->training_error = 0.0f; +#endif s->training_stage = TRAINING_STAGE_TEST_ONES; } else @@ -991,12 +1127,21 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) constellation_state = decode_baud(s, &z); target = &s->constellation[constellation_state]; /* Measure the training error */ +#if defined(SPANDSP_USE_FIXED_POINTx) + z16 = complex_subi16(&z, target); + s->training_error += poweri16(&z16); +#else zz = complex_subf(&z, target); s->training_error += powerf(&zz); +#endif if (++s->training_count >= V17_TRAINING_SEG_4A_LEN) { - s->training_count = 0; +#if defined(SPANDSP_USE_FIXED_POINTx) + s->training_error = 0; +#else s->training_error = 0.0f; +#endif + s->training_count = 0; /* Restart the differential decoder */ s->diff = (s->short_train) ? 0 : 1; s->training_stage = TRAINING_STAGE_TEST_ONES; @@ -1009,14 +1154,25 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) constellation_state = decode_baud(s, &z); target = &s->constellation[constellation_state]; /* Measure the training error */ +#if defined(SPANDSP_USE_FIXED_POINTx) + z16 = complex_subi16(&z, target); + s->training_error += poweri16(&z16); +#else zz = complex_subf(&z, target); s->training_error += powerf(&zz); +#endif if (++s->training_count >= V17_TRAINING_SEG_4_LEN) { +#if defined(SPANDSP_USE_FIXED_POINTx) + if (s->training_error < V17_TRAINING_SEG_4_LEN*FP_FACTOR*FP_FACTOR*constellation_spacing[s->space_map]) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %d)\n", s->bit_rate, s->training_error); +#else if (s->training_error < V17_TRAINING_SEG_4_LEN*constellation_spacing[s->space_map]) { - /* We are up and running */ span_log(&s->logging, SPAN_LOG_FLOW, "Training succeeded at %dbps (constellation mismatch %f)\n", s->bit_rate, s->training_error); +#endif + /* We are up and running */ report_status_change(s, SIG_STATUS_TRAINING_SUCCEEDED); /* Apply some lag to the carrier off condition, to ensure the last few bits get pushed through the processing. */ @@ -1028,11 +1184,16 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) } else { - /* Training has failed */ + /* Training has failed. Park this modem. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %d)\n", s->training_error); + if (!s->short_train) + s->agc_scaling_save = 0; +#else span_log(&s->logging, SPAN_LOG_FLOW, "Training failed (constellation mismatch %f)\n", s->training_error); - /* Park this modem */ if (!s->short_train) s->agc_scaling_save = 0.0f; +#endif s->training_stage = TRAINING_STAGE_PARKED; report_status_change(s, SIG_STATUS_TRAINING_FAILED); } @@ -1046,7 +1207,20 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) break; } if (s->qam_report) + { +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t zi; + complexi16_t targeti; + + zi.re = z.re*1024.0f; + zi.im = z.im*1024.0f; + targeti.re = target->re*1024.0f; + targeti.im = target->im*1024.0f; + s->qam_report(s->qam_user_data, &zi, &targeti, constellation_state); +#else s->qam_report(s->qam_user_data, &z, target, constellation_state); +#endif + } } /*- End of function --------------------------------------------------------*/ @@ -1125,15 +1299,15 @@ SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len) { int i; int step; +#if defined(SPANDSP_USE_FIXED_POINTx) + complexi16_t z; + complexi16_t zz; + complexi16_t sample; + int32_t v; +#else complexf_t z; complexf_t zz; complexf_t sample; -#if defined(SPANDSP_USE_FIXED_POINT) - int32_t vi; -#endif -#if defined(SPANDSP_USE_FIXED_POINTx) - int32_t v; -#else float v; #endif int32_t power; @@ -1152,18 +1326,27 @@ SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len) parked, after training failure. */ s->eq_put_step -= RX_PULSESHAPER_COEFF_SETS; step = -s->eq_put_step; - if (step > RX_PULSESHAPER_COEFF_SETS - 1) - step = RX_PULSESHAPER_COEFF_SETS - 1; if (step < 0) step += RX_PULSESHAPER_COEFF_SETS; -#if defined(SPANDSP_USE_FIXED_POINT) - vi = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_re[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); - //sample.re = (vi*(int32_t) s->agc_scaling) >> 15; - sample.re = vi*s->agc_scaling; + if (step < 0) + step = 0; + else if (step > RX_PULSESHAPER_COEFF_SETS - 1) + step = RX_PULSESHAPER_COEFF_SETS - 1; +#if defined(SPANDSP_USE_FIXED_POINTx) + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_re[step], V17_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.re = (v*s->agc_scaling) >> 10; + /* Symbol timing synchronisation band edge filters */ + /* Low Nyquist band edge filter */ + v = ((s->symbol_sync_low[0]*SYNC_LOW_BAND_EDGE_COEFF_0) >> 10) + ((s->symbol_sync_low[1]*SYNC_LOW_BAND_EDGE_COEFF_1) >> 10) + sample.re; + s->symbol_sync_low[1] = s->symbol_sync_low[0]; + s->symbol_sync_low[0] = v; + /* High Nyquist band edge filter */ + v = ((s->symbol_sync_high[0]*SYNC_HIGH_BAND_EDGE_COEFF_0) >> 10) + ((s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_1) >> 10) + sample.re; + s->symbol_sync_high[1] = s->symbol_sync_high[0]; + s->symbol_sync_high[0] = v; #else v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_re[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); sample.re = v*s->agc_scaling; -#endif /* Symbol timing synchronisation band edge filters */ /* Low Nyquist band edge filter */ v = s->symbol_sync_low[0]*SYNC_LOW_BAND_EDGE_COEFF_0 + s->symbol_sync_low[1]*SYNC_LOW_BAND_EDGE_COEFF_1 + sample.re; @@ -1173,29 +1356,30 @@ SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len) v = s->symbol_sync_high[0]*SYNC_HIGH_BAND_EDGE_COEFF_0 + s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_1 + sample.re; s->symbol_sync_high[1] = s->symbol_sync_high[0]; s->symbol_sync_high[0] = v; - - /* Put things into the equalization buffer at T/2 rate. The symbol sync. +#endif + /* Put things into the equalization buffer at T/2 rate. The symbol synchronisation will fiddle the step to align this with the symbols. */ if (s->eq_put_step <= 0) { /* Only AGC until we have locked down the setting. */ +#if defined(SPANDSP_USE_FIXED_POINTx) + if (s->agc_scaling_save == 0) + s->agc_scaling = saturate16(((int32_t) (1024.0f*FP_FACTOR*2.17f))/fixed_sqrt32(power)); +#else if (s->agc_scaling_save == 0.0f) s->agc_scaling = (1.0f/RX_PULSESHAPER_GAIN)*2.17f/sqrtf(power); +#endif /* Pulse shape while still at the carrier frequency, using a quadrature pair of filters. This results in a properly bandpass filtered complex signal, which can be brought directly to baseband by complex mixing. No further filtering, to remove mixer harmonics, is needed. */ - step = -s->eq_put_step; - if (step > RX_PULSESHAPER_COEFF_SETS - 1) - step = RX_PULSESHAPER_COEFF_SETS - 1; s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2); -#if defined(SPANDSP_USE_FIXED_POINT) - vi = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_im[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); - //sample.im = (vi*(int32_t) s->agc_scaling) >> 15; - sample.im = vi*s->agc_scaling; - z = dds_lookup_complexf(s->carrier_phase); - zz.re = sample.re*z.re - sample.im*z.im; - zz.im = -sample.re*z.im - sample.im*z.re; +#if defined(SPANDSP_USE_FIXED_POINTx) + v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_im[step], V17_RX_FILTER_STEPS, s->rrc_filter_step) >> 15; + sample.im = (v*s->agc_scaling) >> 10; + z = dds_lookup_complexi16(s->carrier_phase); + zz.re = ((int32_t) sample.re*z.re - (int32_t) sample.im*z.im) >> 15; + zz.im = ((int32_t) -sample.re*z.im - (int32_t) sample.im*z.re) >> 15; #else v = vec_circular_dot_prodf(s->rrc_filter, rx_pulseshaper_im[step], V17_RX_FILTER_STEPS, s->rrc_filter_step); sample.im = v*s->agc_scaling; @@ -1301,10 +1485,12 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai return -1; } s->bit_rate = bit_rate; -#if defined(SPANDSP_USE_FIXED_POINT) +#if defined(SPANDSP_USE_FIXED_POINTx) vec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + s->training_error = 0; #else vec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); + s->training_error = 0.0f; #endif s->rrc_filter_step = 0; @@ -1312,7 +1498,6 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai s->scramble_reg = 0x2ECDD5; s->training_stage = TRAINING_STAGE_SYMBOL_ACQUISITION; s->training_count = 0; - s->training_error = 0.0f; s->signal_present = 0; #if defined(IAXMODEM_STUFF) s->high_sample = 0; @@ -1362,18 +1547,21 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai equalizer_reset(s); #if defined(SPANDSP_USE_FIXED_POINTx) s->agc_scaling_save = 0; - s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN; + s->agc_scaling = (float) (1024.0f*FP_FACTOR)*2.17f/735.0f; +#else + s->agc_scaling_save = 0.0f; + s->agc_scaling = (1.0f/RX_PULSESHAPER_GAIN)*2.17f/735.0f; +#endif +#if defined(SPANDSP_USE_FIXED_POINTx) s->carrier_track_i = 5000; s->carrier_track_p = 40000; #else - s->agc_scaling_save = 0.0f; - s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; s->carrier_track_i = 5000.0f; s->carrier_track_p = 40000.0f; #endif } s->last_sample = 0; - span_log(&s->logging, SPAN_LOG_FLOW, "Gains %f %f\n", s->agc_scaling_save, s->agc_scaling); + span_log(&s->logging, SPAN_LOG_FLOW, "Gains %f %f\n", (float) s->agc_scaling_save, (float) s->agc_scaling); span_log(&s->logging, SPAN_LOG_FLOW, "Phase rates %f %f\n", dds_frequencyf(s->carrier_phase_rate), dds_frequencyf(s->carrier_phase_rate_save)); /* Initialise the working data for symbol timing synchronisation */ diff --git a/libs/spandsp/src/v27ter_tx.c b/libs/spandsp/src/v27ter_tx.c index 99d534e25c..7c05aa2f6e 100644 --- a/libs/spandsp/src/v27ter_tx.c +++ b/libs/spandsp/src/v27ter_tx.c @@ -59,9 +59,11 @@ #include "spandsp/private/v27ter_tx.h" #if defined(SPANDSP_USE_FIXED_POINT) +#define FP_SCALE FP_Q_6_10 #include "v27ter_tx_4800_fixed_rrc.h" #include "v27ter_tx_2400_fixed_rrc.h" #else +#define FP_SCALE(x) (x) #include "v27ter_tx_4800_floating_rrc.h" #include "v27ter_tx_2400_floating_rrc.h" #endif @@ -149,32 +151,22 @@ static complexf_t getbaud(v27ter_tx_state_t *s) 0, 2, 6, 4 }; #if defined(SPANDSP_USE_FIXED_POINT) - static const complexi16_t constellation[8] = - { - {FP_Q_6_10( 1.414f), FP_Q_6_10( 0.0f)}, /* 0deg */ - {FP_Q_6_10( 1.0f), FP_Q_6_10( 1.0f)}, /* 45deg */ - {FP_Q_6_10( 0.0f), FP_Q_6_10( 1.414f)}, /* 90deg */ - {FP_Q_6_10(-1.0f), FP_Q_6_10( 1.0f)}, /* 135deg */ - {FP_Q_6_10(-1.414f), FP_Q_6_10( 0.0f)}, /* 180deg */ - {FP_Q_6_10(-1.0f), FP_Q_6_10(-1.0f)}, /* 225deg */ - {FP_Q_6_10( 0.0f), FP_Q_6_10(-1.414f)}, /* 270deg */ - {FP_Q_6_10( 1.0f), FP_Q_6_10(-1.0f)} /* 315deg */ - }; static const complexi16_t zero = {0, 0}; + static const complexi16_t constellation[8] = #else - static const complexf_t constellation[8] = - { - { 1.414f, 0.0f}, /* 0deg */ - { 1.0f, 1.0f}, /* 45deg */ - { 0.0f, 1.414f}, /* 90deg */ - {-1.0f, 1.0f}, /* 135deg */ - {-1.414f, 0.0f}, /* 180deg */ - {-1.0f, -1.0f}, /* 225deg */ - { 0.0f, -1.414f}, /* 270deg */ - { 1.0f, -1.0f} /* 315deg */ - }; static const complexf_t zero = {0.0f, 0.0f}; + static const complexf_t constellation[8] = #endif + { + {FP_SCALE( 1.414f), FP_SCALE( 0.0f)}, /* 0deg */ + {FP_SCALE( 1.0f), FP_SCALE( 1.0f)}, /* 45deg */ + {FP_SCALE( 0.0f), FP_SCALE( 1.414f)}, /* 90deg */ + {FP_SCALE(-1.0f), FP_SCALE( 1.0f)}, /* 135deg */ + {FP_SCALE(-1.414f), FP_SCALE( 0.0f)}, /* 180deg */ + {FP_SCALE(-1.0f), FP_SCALE(-1.0f)}, /* 225deg */ + {FP_SCALE( 0.0f), FP_SCALE(-1.414f)}, /* 270deg */ + {FP_SCALE( 1.0f), FP_SCALE(-1.0f)} /* 315deg */ + }; int bits; if (s->in_training) diff --git a/libs/spandsp/tests/fax_tests.c b/libs/spandsp/tests/fax_tests.c index 2d92767533..4584a0da35 100644 --- a/libs/spandsp/tests/fax_tests.c +++ b/libs/spandsp/tests/fax_tests.c @@ -863,10 +863,22 @@ int main(int argc, char *argv[]) | T30_SUPPORT_300_600_RESOLUTION | T30_SUPPORT_400_800_RESOLUTION | T30_SUPPORT_600_1200_RESOLUTION); - t30_set_ecm_capability(t30_state[i], use_ecm); if (use_ecm) - t30_set_supported_compressions(t30_state[i], T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + { + t30_set_supported_compressions(t30_state[i], + T30_SUPPORT_T4_1D_COMPRESSION + | T30_SUPPORT_T4_2D_COMPRESSION + | T30_SUPPORT_T6_COMPRESSION + | T30_SUPPORT_T85_COMPRESSION + | T30_SUPPORT_T85_L0_COMPRESSION); + } + else + { + t30_set_supported_compressions(t30_state[i], + T30_SUPPORT_T4_1D_COMPRESSION + | T30_SUPPORT_T4_2D_COMPRESSION); + } t30_set_minimum_scan_line_time(t30_state[i], scan_line_time); if (mode[i] == T38_GATEWAY_FAX) diff --git a/libs/spandsp/tests/v17_tests.c b/libs/spandsp/tests/v17_tests.c index 940e7f0751..a974049a29 100644 --- a/libs/spandsp/tests/v17_tests.c +++ b/libs/spandsp/tests/v17_tests.c @@ -122,7 +122,7 @@ static void v17_rx_status(void *user_data, int status) v17_rx_state_t *s; int i; int len; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; #else complexf_t *coeffs; @@ -136,7 +136,7 @@ static void v17_rx_status(void *user_data, int status) len = v17_rx_equalizer_state(s, &coeffs); printf("Equalizer:\n"); for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); #else printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); @@ -173,7 +173,7 @@ static int v17getbit(void *user_data) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol) #else static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) @@ -181,7 +181,12 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex { int i; int len; +#if defined(SPANDSP_USE_FIXED_POINT) + complexi16_t *coeffs; + complexf_t constel_point; +#else complexf_t *coeffs; +#endif float fpower; v17_rx_state_t *rx; static float smooth_power = 0.0f; @@ -190,37 +195,53 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex rx = (v17_rx_state_t *) user_data; if (constel) { + fpower = (constel->re - target->re)*(constel->re - target->re) + + (constel->im - target->im)*(constel->im - target->im); +#if defined(SPANDSP_USE_FIXED_POINT) + fpower /= 4096.0*4096.0; +#endif + smooth_power = 0.95f*smooth_power + 0.05f*fpower; #if defined(ENABLE_GUI) if (use_gui) { +#if defined(SPANDSP_USE_FIXED_POINT) + constel_point.re = constel->re/4096.0; + constel_point.im = constel->im/4096.0; + qam_monitor_update_constel(qam_monitor, &constel_point); +#else qam_monitor_update_constel(qam_monitor, constel); +#endif qam_monitor_update_carrier_tracking(qam_monitor, v17_rx_carrier_frequency(rx)); qam_monitor_update_symbol_tracking(qam_monitor, v17_rx_symbol_timing_correction(rx)); } #endif - fpower = (constel->re - target->re)*(constel->re - target->re) - + (constel->im - target->im)*(constel->im - target->im); - smooth_power = 0.95f*smooth_power + 0.05f*fpower; printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", symbol_no, +#if defined(SPANDSP_USE_FIXED_POINT) + constel->re/4096.0, + constel->im/4096.0, + target->re/4096.0, + target->im/4096.0, +#else constel->re, constel->im, target->re, target->im, +#endif symbol, fpower, smooth_power, v17_rx_carrier_frequency(rx), v17_rx_signal_power(rx), v17_rx_symbol_timing_correction(rx)); - printf("Carrier %d %f %f\n", symbol_no, v17_rx_carrier_frequency(rx), v17_rx_symbol_timing_correction(rx)); + //printf("Carrier %d %f %f\n", symbol_no, v17_rx_carrier_frequency(rx), v17_rx_symbol_timing_correction(rx)); symbol_no++; if (--update_interval <= 0) { len = v17_rx_equalizer_state(rx, &coeffs); printf("Equalizer A:\n"); for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); #else printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); @@ -228,7 +249,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(qam_monitor, coeffs, len); diff --git a/libs/spandsp/tests/v22bis_tests.c b/libs/spandsp/tests/v22bis_tests.c index f070dd709c..23515f4038 100644 --- a/libs/spandsp/tests/v22bis_tests.c +++ b/libs/spandsp/tests/v22bis_tests.c @@ -115,7 +115,7 @@ static void v22bis_rx_status(void *user_data, int status) int bit_rate; int i; int len; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; #else complexf_t *coeffs; @@ -132,7 +132,7 @@ static void v22bis_rx_status(void *user_data, int status) len = v22bis_rx_equalizer_state(s->v22bis, &coeffs); printf("Equalizer:\n"); for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); #else printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); @@ -171,7 +171,7 @@ static int v22bis_getbit(void *user_data) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol) #else static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) @@ -179,7 +179,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex { int i; int len; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; complexf_t constel_point; #else @@ -194,7 +194,13 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #if defined(ENABLE_GUI) if (use_gui) { +#if defined(SPANDSP_USE_FIXED_POINT) + constel_point.re = constel->re/1024.0; + constel_point.im = constel->im/1024.0; + qam_monitor_update_constel(s->qam_monitor, &constel_point); +#else qam_monitor_update_constel(s->qam_monitor, constel); +#endif qam_monitor_update_carrier_tracking(s->qam_monitor, v22bis_rx_carrier_frequency(s->v22bis)); qam_monitor_update_symbol_tracking(s->qam_monitor, v22bis_rx_symbol_timing_correction(s->v22bis)); } @@ -205,10 +211,17 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %8.4f\n", s->symbol_no, +#if defined(SPANDSP_USE_FIXED_POINT) + constel->re/1024.0, + constel->im/1024.0, + target->re/1024.0, + target->im/1024.0, +#else constel->re, constel->im, target->re, target->im, +#endif symbol, fpower, s->smooth_power, @@ -221,7 +234,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex len = v22bis_rx_equalizer_state(s->v22bis, &coeffs); printf("Equalizer A:\n"); for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); #else printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); @@ -229,7 +242,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(s->qam_monitor, coeffs, len); diff --git a/libs/spandsp/tests/v27ter_tests.c b/libs/spandsp/tests/v27ter_tests.c index ca0e710ae3..0d63023cc0 100644 --- a/libs/spandsp/tests/v27ter_tests.c +++ b/libs/spandsp/tests/v27ter_tests.c @@ -118,7 +118,7 @@ static void v27ter_rx_status(void *user_data, int status) v27ter_rx_state_t *s; int i; int len; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; #else complexf_t *coeffs; @@ -132,7 +132,7 @@ static void v27ter_rx_status(void *user_data, int status) len = v27ter_rx_equalizer_state(s, &coeffs); printf("Equalizer:\n"); for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); #else printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); @@ -169,7 +169,7 @@ static int v27tergetbit(void *user_data) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol) #else static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) @@ -177,7 +177,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex { int i; int len; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; complexf_t constel_point; #else @@ -196,23 +196,43 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex { fpower = (constel->re - target->re)*(constel->re - target->re) + (constel->im - target->im)*(constel->im - target->im); +#if defined(SPANDSP_USE_FIXED_POINT) + fpower /= 1024.0*1024.0; +#endif smooth_power = 0.95f*smooth_power + 0.05f*fpower; #if defined(ENABLE_GUI) if (use_gui) { +#if defined(SPANDSP_USE_FIXED_POINT) + constel_point.re = constel->re/1024.0; + constel_point.im = constel->im/1024.0; + qam_monitor_update_constel(qam_monitor, &constel_point); +#else qam_monitor_update_constel(qam_monitor, constel); +#endif qam_monitor_update_carrier_tracking(qam_monitor, v27ter_rx_carrier_frequency(rx)); qam_monitor_update_symbol_tracking(qam_monitor, v27ter_rx_symbol_timing_correction(rx)); } #endif error = constel->im*target->re - constel->re*target->im; +#if defined(SPANDSP_USE_FIXED_POINT) + printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re/1024.0, constel->im/1024.0, target->re/1024.0, target->im/1024.0); +#else printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re, constel->im, target->re, target->im); +#endif printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", symbol_no, +#if defined(SPANDSP_USE_FIXED_POINT) + constel->re/1024.0, + constel->im/1024.0, + target->re/1024.0, + target->im/1024.0, +#else constel->re, constel->im, target->re, target->im, +#endif symbol, fpower, smooth_power, @@ -222,7 +242,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex len = v27ter_rx_equalizer_state(rx, &coeffs); printf("Equalizer B:\n"); for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); #else printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); @@ -236,7 +256,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex { if (++reports >= 1000) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(qam_monitor, coeffs, len); @@ -253,7 +273,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex len = v27ter_rx_equalizer_state(rx, &coeffs); printf("Equalizer A:\n"); for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); #else printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); @@ -261,7 +281,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(qam_monitor, coeffs, len); diff --git a/libs/spandsp/tests/v29_tests.c b/libs/spandsp/tests/v29_tests.c index dd1ac1bae5..1252a4fc4b 100644 --- a/libs/spandsp/tests/v29_tests.c +++ b/libs/spandsp/tests/v29_tests.c @@ -169,7 +169,7 @@ static int v29getbit(void *user_data) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static void qam_report(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol) #else static void qam_report(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol) @@ -200,7 +200,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) constel_point.re = constel->re/4096.0; constel_point.im = constel->im/4096.0; qam_monitor_update_constel(qam_monitor, &constel_point); @@ -214,7 +214,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #endif printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", symbol_no, -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) constel->re/4096.0, constel->im/4096.0, target->re/4096.0, From be6739e19856c0e84b7d973dc46c4f40cef3ecac Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 21 Jul 2012 21:46:07 +0800 Subject: [PATCH 0780/1057] Updates to spands test data --- libs/spandsp/spandsp/tones.dtd | 2 + libs/spandsp/spandsp/tsb85.xml | 150 +++--- .../src/v17_v32bis_tx_constellation_maps.h | 496 +++++++++--------- libs/spandsp/src/v29tx_constellation_maps.h | 64 ++- 4 files changed, 363 insertions(+), 349 deletions(-) diff --git a/libs/spandsp/spandsp/tones.dtd b/libs/spandsp/spandsp/tones.dtd index 6f0fe46ba6..023f8d0783 100644 --- a/libs/spandsp/spandsp/tones.dtd +++ b/libs/spandsp/spandsp/tones.dtd @@ -35,6 +35,7 @@ diff --git a/libs/spandsp/spandsp/tsb85.xml b/libs/spandsp/spandsp/tsb85.xml index cd0d5db807..af38a9a3fe 100644 --- a/libs/spandsp/spandsp/tsb85.xml +++ b/libs/spandsp/spandsp/tsb85.xml @@ -13,7 +13,7 @@ - @@ -1253,7 +1253,7 @@ - + @@ -1265,7 +1265,7 @@ - + @@ -1287,7 +1287,7 @@ - + @@ -1335,7 +1335,7 @@ - + @@ -1347,7 +1347,7 @@ - + @@ -1359,7 +1359,7 @@ - + @@ -1371,7 +1371,7 @@ - + @@ -1384,7 +1384,7 @@ - + @@ -1396,7 +1396,7 @@ - + @@ -1440,7 +1440,7 @@ - + @@ -1462,7 +1462,7 @@ - + @@ -1484,7 +1484,7 @@ - + @@ -1506,7 +1506,7 @@ - + @@ -1536,7 +1536,7 @@ - + @@ -1583,7 +1583,7 @@ - + @@ -1605,7 +1605,7 @@ - + @@ -1627,7 +1627,7 @@ - + @@ -1649,7 +1649,7 @@ - + @@ -1679,7 +1679,7 @@ - + @@ -1726,7 +1726,7 @@ - + @@ -1748,11 +1748,11 @@ - + - + @@ -1765,16 +1765,16 @@ - + - + - + @@ -1787,16 +1787,16 @@ - + - + - + @@ -1809,16 +1809,16 @@ - + - + - + @@ -1831,7 +1831,7 @@ - + @@ -1869,7 +1869,7 @@ - + @@ -1891,7 +1891,7 @@ - + @@ -1913,7 +1913,7 @@ - + @@ -1935,7 +1935,7 @@ - + @@ -1965,7 +1965,7 @@ - + @@ -2011,7 +2011,7 @@ - + @@ -2033,7 +2033,7 @@ - + @@ -2055,7 +2055,7 @@ - + @@ -2077,7 +2077,7 @@ - + @@ -2132,7 +2132,7 @@ - + @@ -2154,7 +2154,7 @@ - + @@ -2201,7 +2201,7 @@ - + @@ -2213,7 +2213,7 @@ - + @@ -4982,7 +4982,7 @@ - + @@ -4990,7 +4990,7 @@ - + @@ -4998,7 +4998,7 @@ - + @@ -5028,15 +5028,17 @@ - + + - + + - + @@ -5044,15 +5046,16 @@ - + + - + - + @@ -5060,15 +5063,16 @@ - + + - + - + @@ -5098,7 +5102,7 @@ - + @@ -5290,7 +5294,7 @@ - + @@ -5299,7 +5303,7 @@ - + @@ -5308,7 +5312,7 @@ - + @@ -5317,7 +5321,7 @@ - + @@ -5334,7 +5338,7 @@ - + @@ -5343,7 +5347,7 @@ - + @@ -5352,7 +5356,7 @@ - + @@ -5361,7 +5365,7 @@ - + @@ -5402,7 +5406,7 @@ - + @@ -5411,7 +5415,7 @@ - + @@ -5420,7 +5424,7 @@ - + @@ -5429,7 +5433,7 @@ - + @@ -5446,7 +5450,7 @@ - + @@ -5476,7 +5480,7 @@ - + diff --git a/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h b/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h index 4abe80d93d..8044ad1e32 100644 --- a/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h +++ b/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h @@ -31,134 +31,134 @@ static const complexi16_t v17_v32bis_14400_constellation[128] = static const complexf_t v17_v32bis_14400_constellation[128] = #endif { - {-8, -3}, /* 0x00 */ - { 9, 2}, /* 0x01 */ - { 2, -9}, /* 0x02 */ - {-3, 8}, /* 0x03 */ - { 8, 3}, /* 0x04 */ - {-9, -2}, /* 0x05 */ - {-2, 9}, /* 0x06 */ - { 3, -8}, /* 0x07 */ - {-8, 1}, /* 0x08 */ - { 9, -2}, /* 0x09 */ - {-2, -9}, /* 0x0A */ - { 1, 8}, /* 0x0B */ - { 8, -1}, /* 0x0C */ - {-9, 2}, /* 0x0D */ - { 2, 9}, /* 0x0E */ - {-1, -8}, /* 0x0F */ - {-4, -3}, /* 0x10 */ - { 5, 2}, /* 0x11 */ - { 2, -5}, /* 0x12 */ - {-3, 4}, /* 0x13 */ - { 4, 3}, /* 0x14 */ - {-5, -2}, /* 0x15 */ - {-2, 5}, /* 0x16 */ - { 3, -4}, /* 0x17 */ - {-4, 1}, /* 0x18 */ - { 5, -2}, /* 0x19 */ - {-2, -5}, /* 0x1A */ - { 1, 4}, /* 0x1B */ - { 4, -1}, /* 0x1C */ - {-5, 2}, /* 0x1D */ - { 2, 5}, /* 0x1E */ - {-1, -4}, /* 0x1F */ - { 4, -3}, /* 0x20 */ - {-3, 2}, /* 0x21 */ - { 2, 3}, /* 0x22 */ - {-3, -4}, /* 0x23 */ - {-4, 3}, /* 0x24 */ - { 3, -2}, /* 0x25 */ - {-2, -3}, /* 0x26 */ - { 3, 4}, /* 0x27 */ - { 4, 1}, /* 0x28 */ - {-3, -2}, /* 0x29 */ - {-2, 3}, /* 0x2A */ - { 1, -4}, /* 0x2B */ - {-4, -1}, /* 0x2C */ - { 3, 2}, /* 0x2D */ - { 2, -3}, /* 0x2E */ - {-1, 4}, /* 0x2F */ - { 0, -3}, /* 0x30 */ - { 1, 2}, /* 0x31 */ - { 2, -1}, /* 0x32 */ - {-3, 0}, /* 0x33 */ - { 0, 3}, /* 0x34 */ - {-1, -2}, /* 0x35 */ - {-2, 1}, /* 0x36 */ - { 3, 0}, /* 0x37 */ - { 0, 1}, /* 0x38 */ - { 1, -2}, /* 0x39 */ - {-2, -1}, /* 0x3A */ - { 1, 0}, /* 0x3B */ - { 0, -1}, /* 0x3C */ - {-1, 2}, /* 0x3D */ - { 2, 1}, /* 0x3E */ - {-1, 0}, /* 0x3F */ - { 8, -3}, /* 0x40 */ - {-7, 2}, /* 0x41 */ - { 2, 7}, /* 0x42 */ - {-3, -8}, /* 0x43 */ - {-8, 3}, /* 0x44 */ - { 7, -2}, /* 0x45 */ - {-2, -7}, /* 0x46 */ - { 3, 8}, /* 0x47 */ - { 8, 1}, /* 0x48 */ - {-7, -2}, /* 0x49 */ - {-2, 7}, /* 0x4A */ - { 1, -8}, /* 0x4B */ - {-8, -1}, /* 0x4C */ - { 7, 2}, /* 0x4D */ - { 2, -7}, /* 0x4E */ - {-1, 8}, /* 0x4F */ - {-4, -7}, /* 0x50 */ - { 5, 6}, /* 0x51 */ - { 6, -5}, /* 0x52 */ - {-7, 4}, /* 0x53 */ - { 4, 7}, /* 0x54 */ - {-5, -6}, /* 0x55 */ - {-6, 5}, /* 0x56 */ - { 7, -4}, /* 0x57 */ - {-4, 5}, /* 0x58 */ - { 5, -6}, /* 0x59 */ - {-6, -5}, /* 0x5A */ - { 5, 4}, /* 0x5B */ - { 4, -5}, /* 0x5C */ - {-5, 6}, /* 0x5D */ - { 6, 5}, /* 0x5E */ - {-5, -4}, /* 0x5F */ - { 4, -7}, /* 0x60 */ - {-3, 6}, /* 0x61 */ - { 6, 3}, /* 0x62 */ - {-7, -4}, /* 0x63 */ - {-4, 7}, /* 0x64 */ - { 3, -6}, /* 0x65 */ - {-6, -3}, /* 0x66 */ - { 7, 4}, /* 0x67 */ - { 4, 5}, /* 0x68 */ - {-3, -6}, /* 0x69 */ - {-6, 3}, /* 0x6A */ - { 5, -4}, /* 0x6B */ - {-4, -5}, /* 0x6C */ - { 3, 6}, /* 0x6D */ - { 6, -3}, /* 0x6E */ - {-5, 4}, /* 0x6F */ - { 0, -7}, /* 0x70 */ - { 1, 6}, /* 0x71 */ - { 6, -1}, /* 0x72 */ - {-7, 0}, /* 0x73 */ - { 0, 7}, /* 0x74 */ - {-1, -6}, /* 0x75 */ - {-6, 1}, /* 0x76 */ - { 7, 0}, /* 0x77 */ - { 0, 5}, /* 0x78 */ - { 1, -6}, /* 0x79 */ - {-6, -1}, /* 0x7A */ - { 5, 0}, /* 0x7B */ - { 0, -5}, /* 0x7C */ - {-1, 6}, /* 0x7D */ - { 6, 1}, /* 0x7E */ - {-5, 0} /* 0x7F */ + {FP_SCALE(-8.0f), FP_SCALE(-3.0f)}, /* 0x00 */ + {FP_SCALE( 9.0f), FP_SCALE( 2.0f)}, /* 0x01 */ + {FP_SCALE( 2.0f), FP_SCALE(-9.0f)}, /* 0x02 */ + {FP_SCALE(-3.0f), FP_SCALE( 8.0f)}, /* 0x03 */ + {FP_SCALE( 8.0f), FP_SCALE( 3.0f)}, /* 0x04 */ + {FP_SCALE(-9.0f), FP_SCALE(-2.0f)}, /* 0x05 */ + {FP_SCALE(-2.0f), FP_SCALE( 9.0f)}, /* 0x06 */ + {FP_SCALE( 3.0f), FP_SCALE(-8.0f)}, /* 0x07 */ + {FP_SCALE(-8.0f), FP_SCALE( 1.0f)}, /* 0x08 */ + {FP_SCALE( 9.0f), FP_SCALE(-2.0f)}, /* 0x09 */ + {FP_SCALE(-2.0f), FP_SCALE(-9.0f)}, /* 0x0A */ + {FP_SCALE( 1.0f), FP_SCALE( 8.0f)}, /* 0x0B */ + {FP_SCALE( 8.0f), FP_SCALE(-1.0f)}, /* 0x0C */ + {FP_SCALE(-9.0f), FP_SCALE( 2.0f)}, /* 0x0D */ + {FP_SCALE( 2.0f), FP_SCALE( 9.0f)}, /* 0x0E */ + {FP_SCALE(-1.0f), FP_SCALE(-8.0f)}, /* 0x0F */ + {FP_SCALE(-4.0f), FP_SCALE(-3.0f)}, /* 0x10 */ + {FP_SCALE( 5.0f), FP_SCALE( 2.0f)}, /* 0x11 */ + {FP_SCALE( 2.0f), FP_SCALE(-5.0f)}, /* 0x12 */ + {FP_SCALE(-3.0f), FP_SCALE( 4.0f)}, /* 0x13 */ + {FP_SCALE( 4.0f), FP_SCALE( 3.0f)}, /* 0x14 */ + {FP_SCALE(-5.0f), FP_SCALE(-2.0f)}, /* 0x15 */ + {FP_SCALE(-2.0f), FP_SCALE( 5.0f)}, /* 0x16 */ + {FP_SCALE( 3.0f), FP_SCALE(-4.0f)}, /* 0x17 */ + {FP_SCALE(-4.0f), FP_SCALE( 1.0f)}, /* 0x18 */ + {FP_SCALE( 5.0f), FP_SCALE(-2.0f)}, /* 0x19 */ + {FP_SCALE(-2.0f), FP_SCALE(-5.0f)}, /* 0x1A */ + {FP_SCALE( 1.0f), FP_SCALE( 4.0f)}, /* 0x1B */ + {FP_SCALE( 4.0f), FP_SCALE(-1.0f)}, /* 0x1C */ + {FP_SCALE(-5.0f), FP_SCALE( 2.0f)}, /* 0x1D */ + {FP_SCALE( 2.0f), FP_SCALE( 5.0f)}, /* 0x1E */ + {FP_SCALE(-1.0f), FP_SCALE(-4.0f)}, /* 0x1F */ + {FP_SCALE( 4.0f), FP_SCALE(-3.0f)}, /* 0x20 */ + {FP_SCALE(-3.0f), FP_SCALE( 2.0f)}, /* 0x21 */ + {FP_SCALE( 2.0f), FP_SCALE( 3.0f)}, /* 0x22 */ + {FP_SCALE(-3.0f), FP_SCALE(-4.0f)}, /* 0x23 */ + {FP_SCALE(-4.0f), FP_SCALE( 3.0f)}, /* 0x24 */ + {FP_SCALE( 3.0f), FP_SCALE(-2.0f)}, /* 0x25 */ + {FP_SCALE(-2.0f), FP_SCALE(-3.0f)}, /* 0x26 */ + {FP_SCALE( 3.0f), FP_SCALE( 4.0f)}, /* 0x27 */ + {FP_SCALE( 4.0f), FP_SCALE( 1.0f)}, /* 0x28 */ + {FP_SCALE(-3.0f), FP_SCALE(-2.0f)}, /* 0x29 */ + {FP_SCALE(-2.0f), FP_SCALE( 3.0f)}, /* 0x2A */ + {FP_SCALE( 1.0f), FP_SCALE(-4.0f)}, /* 0x2B */ + {FP_SCALE(-4.0f), FP_SCALE(-1.0f)}, /* 0x2C */ + {FP_SCALE( 3.0f), FP_SCALE( 2.0f)}, /* 0x2D */ + {FP_SCALE( 2.0f), FP_SCALE(-3.0f)}, /* 0x2E */ + {FP_SCALE(-1.0f), FP_SCALE( 4.0f)}, /* 0x2F */ + {FP_SCALE( 0.0f), FP_SCALE(-3.0f)}, /* 0x30 */ + {FP_SCALE( 1.0f), FP_SCALE( 2.0f)}, /* 0x31 */ + {FP_SCALE( 2.0f), FP_SCALE(-1.0f)}, /* 0x32 */ + {FP_SCALE(-3.0f), FP_SCALE( 0.0f)}, /* 0x33 */ + {FP_SCALE( 0.0f), FP_SCALE( 3.0f)}, /* 0x34 */ + {FP_SCALE(-1.0f), FP_SCALE(-2.0f)}, /* 0x35 */ + {FP_SCALE(-2.0f), FP_SCALE( 1.0f)}, /* 0x36 */ + {FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0x37 */ + {FP_SCALE( 0.0f), FP_SCALE( 1.0f)}, /* 0x38 */ + {FP_SCALE( 1.0f), FP_SCALE(-2.0f)}, /* 0x39 */ + {FP_SCALE(-2.0f), FP_SCALE(-1.0f)}, /* 0x3A */ + {FP_SCALE( 1.0f), FP_SCALE( 0.0f)}, /* 0x3B */ + {FP_SCALE( 0.0f), FP_SCALE(-1.0f)}, /* 0x3C */ + {FP_SCALE(-1.0f), FP_SCALE( 2.0f)}, /* 0x3D */ + {FP_SCALE( 2.0f), FP_SCALE( 1.0f)}, /* 0x3E */ + {FP_SCALE(-1.0f), FP_SCALE( 0.0f)}, /* 0x3F */ + {FP_SCALE( 8.0f), FP_SCALE(-3.0f)}, /* 0x40 */ + {FP_SCALE(-7.0f), FP_SCALE( 2.0f)}, /* 0x41 */ + {FP_SCALE( 2.0f), FP_SCALE( 7.0f)}, /* 0x42 */ + {FP_SCALE(-3.0f), FP_SCALE(-8.0f)}, /* 0x43 */ + {FP_SCALE(-8.0f), FP_SCALE( 3.0f)}, /* 0x44 */ + {FP_SCALE( 7.0f), FP_SCALE(-2.0f)}, /* 0x45 */ + {FP_SCALE(-2.0f), FP_SCALE(-7.0f)}, /* 0x46 */ + {FP_SCALE( 3.0f), FP_SCALE( 8.0f)}, /* 0x47 */ + {FP_SCALE( 8.0f), FP_SCALE( 1.0f)}, /* 0x48 */ + {FP_SCALE(-7.0f), FP_SCALE(-2.0f)}, /* 0x49 */ + {FP_SCALE(-2.0f), FP_SCALE( 7.0f)}, /* 0x4A */ + {FP_SCALE( 1.0f), FP_SCALE(-8.0f)}, /* 0x4B */ + {FP_SCALE(-8.0f), FP_SCALE(-1.0f)}, /* 0x4C */ + {FP_SCALE( 7.0f), FP_SCALE( 2.0f)}, /* 0x4D */ + {FP_SCALE( 2.0f), FP_SCALE(-7.0f)}, /* 0x4E */ + {FP_SCALE(-1.0f), FP_SCALE( 8.0f)}, /* 0x4F */ + {FP_SCALE(-4.0f), FP_SCALE(-7.0f)}, /* 0x50 */ + {FP_SCALE( 5.0f), FP_SCALE( 6.0f)}, /* 0x51 */ + {FP_SCALE( 6.0f), FP_SCALE(-5.0f)}, /* 0x52 */ + {FP_SCALE(-7.0f), FP_SCALE( 4.0f)}, /* 0x53 */ + {FP_SCALE( 4.0f), FP_SCALE( 7.0f)}, /* 0x54 */ + {FP_SCALE(-5.0f), FP_SCALE(-6.0f)}, /* 0x55 */ + {FP_SCALE(-6.0f), FP_SCALE( 5.0f)}, /* 0x56 */ + {FP_SCALE( 7.0f), FP_SCALE(-4.0f)}, /* 0x57 */ + {FP_SCALE(-4.0f), FP_SCALE( 5.0f)}, /* 0x58 */ + {FP_SCALE( 5.0f), FP_SCALE(-6.0f)}, /* 0x59 */ + {FP_SCALE(-6.0f), FP_SCALE(-5.0f)}, /* 0x5A */ + {FP_SCALE( 5.0f), FP_SCALE( 4.0f)}, /* 0x5B */ + {FP_SCALE( 4.0f), FP_SCALE(-5.0f)}, /* 0x5C */ + {FP_SCALE(-5.0f), FP_SCALE( 6.0f)}, /* 0x5D */ + {FP_SCALE( 6.0f), FP_SCALE( 5.0f)}, /* 0x5E */ + {FP_SCALE(-5.0f), FP_SCALE(-4.0f)}, /* 0x5F */ + {FP_SCALE( 4.0f), FP_SCALE(-7.0f)}, /* 0x60 */ + {FP_SCALE(-3.0f), FP_SCALE( 6.0f)}, /* 0x61 */ + {FP_SCALE( 6.0f), FP_SCALE( 3.0f)}, /* 0x62 */ + {FP_SCALE(-7.0f), FP_SCALE(-4.0f)}, /* 0x63 */ + {FP_SCALE(-4.0f), FP_SCALE( 7.0f)}, /* 0x64 */ + {FP_SCALE( 3.0f), FP_SCALE(-6.0f)}, /* 0x65 */ + {FP_SCALE(-6.0f), FP_SCALE(-3.0f)}, /* 0x66 */ + {FP_SCALE( 7.0f), FP_SCALE( 4.0f)}, /* 0x67 */ + {FP_SCALE( 4.0f), FP_SCALE( 5.0f)}, /* 0x68 */ + {FP_SCALE(-3.0f), FP_SCALE(-6.0f)}, /* 0x69 */ + {FP_SCALE(-6.0f), FP_SCALE( 3.0f)}, /* 0x6A */ + {FP_SCALE( 5.0f), FP_SCALE(-4.0f)}, /* 0x6B */ + {FP_SCALE(-4.0f), FP_SCALE(-5.0f)}, /* 0x6C */ + {FP_SCALE( 3.0f), FP_SCALE( 6.0f)}, /* 0x6D */ + {FP_SCALE( 6.0f), FP_SCALE(-3.0f)}, /* 0x6E */ + {FP_SCALE(-5.0f), FP_SCALE( 4.0f)}, /* 0x6F */ + {FP_SCALE( 0.0f), FP_SCALE(-7.0f)}, /* 0x70 */ + {FP_SCALE( 1.0f), FP_SCALE( 6.0f)}, /* 0x71 */ + {FP_SCALE( 6.0f), FP_SCALE(-1.0f)}, /* 0x72 */ + {FP_SCALE(-7.0f), FP_SCALE( 0.0f)}, /* 0x73 */ + {FP_SCALE( 0.0f), FP_SCALE( 7.0f)}, /* 0x74 */ + {FP_SCALE(-1.0f), FP_SCALE(-6.0f)}, /* 0x75 */ + {FP_SCALE(-6.0f), FP_SCALE( 1.0f)}, /* 0x76 */ + {FP_SCALE( 7.0f), FP_SCALE( 0.0f)}, /* 0x77 */ + {FP_SCALE( 0.0f), FP_SCALE( 5.0f)}, /* 0x78 */ + {FP_SCALE( 1.0f), FP_SCALE(-6.0f)}, /* 0x79 */ + {FP_SCALE(-6.0f), FP_SCALE(-1.0f)}, /* 0x7A */ + {FP_SCALE( 5.0f), FP_SCALE( 0.0f)}, /* 0x7B */ + {FP_SCALE( 0.0f), FP_SCALE(-5.0f)}, /* 0x7C */ + {FP_SCALE(-1.0f), FP_SCALE( 6.0f)}, /* 0x7D */ + {FP_SCALE( 6.0f), FP_SCALE( 1.0f)}, /* 0x7E */ + {FP_SCALE(-5.0f), FP_SCALE( 0.0f)} /* 0x7F */ }; #if defined(SPANDSP_USE_FIXED_POINTx) @@ -167,70 +167,70 @@ static const complexi16_t v17_v32bis_12000_constellation[64] = static const complexf_t v17_v32bis_12000_constellation[64] = #endif { - { 7, 1}, /* 0x00 */ - {-5, -1}, /* 0x01 */ - {-1, 5}, /* 0x02 */ - { 1, -7}, /* 0x03 */ - {-7, -1}, /* 0x04 */ - { 5, 1}, /* 0x05 */ - { 1, -5}, /* 0x06 */ - {-1, 7}, /* 0x07 */ - { 3, -3}, /* 0x08 */ - {-1, 3}, /* 0x09 */ - { 3, 1}, /* 0x0A */ - {-3, -3}, /* 0x0B */ - {-3, 3}, /* 0x0C */ - { 1, -3}, /* 0x0D */ - {-3, -1}, /* 0x0E */ - { 3, 3}, /* 0x0F */ - { 7, -7}, /* 0x10 */ - {-5, 7}, /* 0x11 */ - { 7, 5}, /* 0x12 */ - {-7, -7}, /* 0x13 */ - {-7, 7}, /* 0x14 */ - { 5, -7}, /* 0x15 */ - {-7, -5}, /* 0x16 */ - { 7, 7}, /* 0x17 */ - {-1, -7}, /* 0x18 */ - { 3, 7}, /* 0x19 */ - { 7, -3}, /* 0x1A */ - {-7, 1}, /* 0x1B */ - { 1, 7}, /* 0x1C */ - {-3, -7}, /* 0x1D */ - {-7, 3}, /* 0x1E */ - { 7, -1}, /* 0x1F */ - { 3, 5}, /* 0x20 */ - {-1, -5}, /* 0x21 */ - {-5, 1}, /* 0x22 */ - { 5, -3}, /* 0x23 */ - {-3, -5}, /* 0x24 */ - { 1, 5}, /* 0x25 */ - { 5, -1}, /* 0x26 */ - {-5, 3}, /* 0x27 */ - {-1, 1}, /* 0x28 */ - { 3, -1}, /* 0x29 */ - {-1, -3}, /* 0x2A */ - { 1, 1}, /* 0x2B */ - { 1, -1}, /* 0x2C */ - {-3, 1}, /* 0x2D */ - { 1, 3}, /* 0x2E */ - {-1, -1}, /* 0x2F */ - {-5, 5}, /* 0x30 */ - { 7, -5}, /* 0x31 */ - {-5, -7}, /* 0x32 */ - { 5, 5}, /* 0x33 */ - { 5, -5}, /* 0x34 */ - {-7, 5}, /* 0x35 */ - { 5, 7}, /* 0x36 */ - {-5, -5}, /* 0x37 */ - {-5, -3}, /* 0x38 */ - { 7, 3}, /* 0x39 */ - { 3, -7}, /* 0x3A */ - {-3, 5}, /* 0x3B */ - { 5, 3}, /* 0x3C */ - {-7, -3}, /* 0x3D */ - {-3, 7}, /* 0x3E */ - { 3, -5} /* 0x3F */ + {FP_SCALE( 7.0f), FP_SCALE( 1.0f)}, /* 0x00 */ + {FP_SCALE(-5.0f), FP_SCALE(-1.0f)}, /* 0x01 */ + {FP_SCALE(-1.0f), FP_SCALE( 5.0f)}, /* 0x02 */ + {FP_SCALE( 1.0f), FP_SCALE(-7.0f)}, /* 0x03 */ + {FP_SCALE(-7.0f), FP_SCALE(-1.0f)}, /* 0x04 */ + {FP_SCALE( 5.0f), FP_SCALE( 1.0f)}, /* 0x05 */ + {FP_SCALE( 1.0f), FP_SCALE(-5.0f)}, /* 0x06 */ + {FP_SCALE(-1.0f), FP_SCALE( 7.0f)}, /* 0x07 */ + {FP_SCALE( 3.0f), FP_SCALE(-3.0f)}, /* 0x08 */ + {FP_SCALE(-1.0f), FP_SCALE( 3.0f)}, /* 0x09 */ + {FP_SCALE( 3.0f), FP_SCALE( 1.0f)}, /* 0x0A */ + {FP_SCALE(-3.0f), FP_SCALE(-3.0f)}, /* 0x0B */ + {FP_SCALE(-3.0f), FP_SCALE( 3.0f)}, /* 0x0C */ + {FP_SCALE( 1.0f), FP_SCALE(-3.0f)}, /* 0x0D */ + {FP_SCALE(-3.0f), FP_SCALE(-1.0f)}, /* 0x0E */ + {FP_SCALE( 3.0f), FP_SCALE( 3.0f)}, /* 0x0F */ + {FP_SCALE( 7.0f), FP_SCALE(-7.0f)}, /* 0x10 */ + {FP_SCALE(-5.0f), FP_SCALE( 7.0f)}, /* 0x11 */ + {FP_SCALE( 7.0f), FP_SCALE( 5.0f)}, /* 0x12 */ + {FP_SCALE(-7.0f), FP_SCALE(-7.0f)}, /* 0x13 */ + {FP_SCALE(-7.0f), FP_SCALE( 7.0f)}, /* 0x14 */ + {FP_SCALE( 5.0f), FP_SCALE(-7.0f)}, /* 0x15 */ + {FP_SCALE(-7.0f), FP_SCALE(-5.0f)}, /* 0x16 */ + {FP_SCALE( 7.0f), FP_SCALE( 7.0f)}, /* 0x17 */ + {FP_SCALE(-1.0f), FP_SCALE(-7.0f)}, /* 0x18 */ + {FP_SCALE( 3.0f), FP_SCALE( 7.0f)}, /* 0x19 */ + {FP_SCALE( 7.0f), FP_SCALE(-3.0f)}, /* 0x1A */ + {FP_SCALE(-7.0f), FP_SCALE( 1.0f)}, /* 0x1B */ + {FP_SCALE( 1.0f), FP_SCALE( 7.0f)}, /* 0x1C */ + {FP_SCALE(-3.0f), FP_SCALE(-7.0f)}, /* 0x1D */ + {FP_SCALE(-7.0f), FP_SCALE( 3.0f)}, /* 0x1E */ + {FP_SCALE( 7.0f), FP_SCALE(-1.0f)}, /* 0x1F */ + {FP_SCALE( 3.0f), FP_SCALE( 5.0f)}, /* 0x20 */ + {FP_SCALE(-1.0f), FP_SCALE(-5.0f)}, /* 0x21 */ + {FP_SCALE(-5.0f), FP_SCALE( 1.0f)}, /* 0x22 */ + {FP_SCALE( 5.0f), FP_SCALE(-3.0f)}, /* 0x23 */ + {FP_SCALE(-3.0f), FP_SCALE(-5.0f)}, /* 0x24 */ + {FP_SCALE( 1.0f), FP_SCALE( 5.0f)}, /* 0x25 */ + {FP_SCALE( 5.0f), FP_SCALE(-1.0f)}, /* 0x26 */ + {FP_SCALE(-5.0f), FP_SCALE( 3.0f)}, /* 0x27 */ + {FP_SCALE(-1.0f), FP_SCALE( 1.0f)}, /* 0x28 */ + {FP_SCALE( 3.0f), FP_SCALE(-1.0f)}, /* 0x29 */ + {FP_SCALE(-1.0f), FP_SCALE(-3.0f)}, /* 0x2A */ + {FP_SCALE( 1.0f), FP_SCALE( 1.0f)}, /* 0x2B */ + {FP_SCALE( 1.0f), FP_SCALE(-1.0f)}, /* 0x2C */ + {FP_SCALE(-3.0f), FP_SCALE( 1.0f)}, /* 0x2D */ + {FP_SCALE( 1.0f), FP_SCALE( 3.0f)}, /* 0x2E */ + {FP_SCALE(-1.0f), FP_SCALE(-1.0f)}, /* 0x2F */ + {FP_SCALE(-5.0f), FP_SCALE( 5.0f)}, /* 0x30 */ + {FP_SCALE( 7.0f), FP_SCALE(-5.0f)}, /* 0x31 */ + {FP_SCALE(-5.0f), FP_SCALE(-7.0f)}, /* 0x32 */ + {FP_SCALE( 5.0f), FP_SCALE( 5.0f)}, /* 0x33 */ + {FP_SCALE( 5.0f), FP_SCALE(-5.0f)}, /* 0x34 */ + {FP_SCALE(-7.0f), FP_SCALE( 5.0f)}, /* 0x35 */ + {FP_SCALE( 5.0f), FP_SCALE( 7.0f)}, /* 0x36 */ + {FP_SCALE(-5.0f), FP_SCALE(-5.0f)}, /* 0x37 */ + {FP_SCALE(-5.0f), FP_SCALE(-3.0f)}, /* 0x38 */ + {FP_SCALE( 7.0f), FP_SCALE( 3.0f)}, /* 0x39 */ + {FP_SCALE( 3.0f), FP_SCALE(-7.0f)}, /* 0x3A */ + {FP_SCALE(-3.0f), FP_SCALE( 5.0f)}, /* 0x3B */ + {FP_SCALE( 5.0f), FP_SCALE( 3.0f)}, /* 0x3C */ + {FP_SCALE(-7.0f), FP_SCALE(-3.0f)}, /* 0x3D */ + {FP_SCALE(-3.0f), FP_SCALE( 7.0f)}, /* 0x3E */ + {FP_SCALE( 3.0f), FP_SCALE(-5.0f)} /* 0x3F */ }; #if defined(SPANDSP_USE_FIXED_POINTx) @@ -239,38 +239,38 @@ static const complexi16_t v17_v32bis_9600_constellation[32] = static const complexf_t v17_v32bis_9600_constellation[32] = #endif { - {-8, 2}, /* 0x00 */ - {-6, -4}, /* 0x01 */ - {-4, 6}, /* 0x02 */ - { 2, 8}, /* 0x03 */ - { 8, -2}, /* 0x04 */ - { 6, 4}, /* 0x05 */ - { 4, -6}, /* 0x06 */ - {-2, -8}, /* 0x07 */ - { 0, 2}, /* 0x08 */ - {-6, 4}, /* 0x09 */ - { 4, 6}, /* 0x0A */ - { 2, 0}, /* 0x0B */ - { 0, -2}, /* 0x0C */ - { 6, -4}, /* 0x0D */ - {-4, -6}, /* 0x0E */ - {-2, 0}, /* 0x0F */ - { 0, -6}, /* 0x10 */ - { 2, -4}, /* 0x11 */ - {-4, -2}, /* 0x12 */ - {-6, 0}, /* 0x13 */ - { 0, 6}, /* 0x14 */ - {-2, 4}, /* 0x15 */ - { 4, 2}, /* 0x16 */ - { 6, 0}, /* 0x17 */ - { 8, 2}, /* 0x18 */ - { 2, 4}, /* 0x19 */ - { 4, -2}, /* 0x1A */ - { 2, -8}, /* 0x1B */ - {-8, -2}, /* 0x1C */ - {-2, -4}, /* 0x1D */ - {-4, 2}, /* 0x1E */ - {-2, 8} /* 0x1F */ + {FP_SCALE(-8.0f), FP_SCALE( 2.0f)}, /* 0x00 */ + {FP_SCALE(-6.0f), FP_SCALE(-4.0f)}, /* 0x01 */ + {FP_SCALE(-4.0f), FP_SCALE( 6.0f)}, /* 0x02 */ + {FP_SCALE( 2.0f), FP_SCALE( 8.0f)}, /* 0x03 */ + {FP_SCALE( 8.0f), FP_SCALE(-2.0f)}, /* 0x04 */ + {FP_SCALE( 6.0f), FP_SCALE( 4.0f)}, /* 0x05 */ + {FP_SCALE( 4.0f), FP_SCALE(-6.0f)}, /* 0x06 */ + {FP_SCALE(-2.0f), FP_SCALE(-8.0f)}, /* 0x07 */ + {FP_SCALE( 0.0f), FP_SCALE( 2.0f)}, /* 0x08 */ + {FP_SCALE(-6.0f), FP_SCALE( 4.0f)}, /* 0x09 */ + {FP_SCALE( 4.0f), FP_SCALE( 6.0f)}, /* 0x0A */ + {FP_SCALE( 2.0f), FP_SCALE( 0.0f)}, /* 0x0B */ + {FP_SCALE( 0.0f), FP_SCALE(-2.0f)}, /* 0x0C */ + {FP_SCALE( 6.0f), FP_SCALE(-4.0f)}, /* 0x0D */ + {FP_SCALE(-4.0f), FP_SCALE(-6.0f)}, /* 0x0E */ + {FP_SCALE(-2.0f), FP_SCALE( 0.0f)}, /* 0x0F */ + {FP_SCALE( 0.0f), FP_SCALE(-6.0f)}, /* 0x10 */ + {FP_SCALE( 2.0f), FP_SCALE(-4.0f)}, /* 0x11 */ + {FP_SCALE(-4.0f), FP_SCALE(-2.0f)}, /* 0x12 */ + {FP_SCALE(-6.0f), FP_SCALE( 0.0f)}, /* 0x13 */ + {FP_SCALE( 0.0f), FP_SCALE( 6.0f)}, /* 0x14 */ + {FP_SCALE(-2.0f), FP_SCALE( 4.0f)}, /* 0x15 */ + {FP_SCALE( 4.0f), FP_SCALE( 2.0f)}, /* 0x16 */ + {FP_SCALE( 6.0f), FP_SCALE( 0.0f)}, /* 0x17 */ + {FP_SCALE( 8.0f), FP_SCALE( 2.0f)}, /* 0x18 */ + {FP_SCALE( 2.0f), FP_SCALE( 4.0f)}, /* 0x19 */ + {FP_SCALE( 4.0f), FP_SCALE(-2.0f)}, /* 0x1A */ + {FP_SCALE( 2.0f), FP_SCALE(-8.0f)}, /* 0x1B */ + {FP_SCALE(-8.0f), FP_SCALE(-2.0f)}, /* 0x1C */ + {FP_SCALE(-2.0f), FP_SCALE(-4.0f)}, /* 0x1D */ + {FP_SCALE(-4.0f), FP_SCALE( 2.0f)}, /* 0x1E */ + {FP_SCALE(-2.0f), FP_SCALE( 8.0f)} /* 0x1F */ }; #if defined(SPANDSP_USE_FIXED_POINTx) @@ -279,22 +279,22 @@ static const complexi16_t v17_v32bis_7200_constellation[16] = static const complexf_t v17_v32bis_7200_constellation[16] = #endif { - { 6, -6}, /* 0x00 */ - {-2, 6}, /* 0x01 */ - { 6, 2}, /* 0x02 */ - {-6, -6}, /* 0x03 */ - {-6, 6}, /* 0x04 */ - { 2, -6}, /* 0x05 */ - {-6, -2}, /* 0x06 */ - { 6, 6}, /* 0x07 */ - {-2, 2}, /* 0x08 */ - { 6, -2}, /* 0x09 */ - {-2, -6}, /* 0x0A */ - { 2, 2}, /* 0x0B */ - { 2, -2}, /* 0x0C */ - {-6, 2}, /* 0x0D */ - { 2, 6}, /* 0x0E */ - {-2, -2} /* 0x0F */ + {FP_SCALE( 6.0f), FP_SCALE(-6.0f)}, /* 0x00 */ + {FP_SCALE(-2.0f), FP_SCALE( 6.0f)}, /* 0x01 */ + {FP_SCALE( 6.0f), FP_SCALE( 2.0f)}, /* 0x02 */ + {FP_SCALE(-6.0f), FP_SCALE(-6.0f)}, /* 0x03 */ + {FP_SCALE(-6.0f), FP_SCALE( 6.0f)}, /* 0x04 */ + {FP_SCALE( 2.0f), FP_SCALE(-6.0f)}, /* 0x05 */ + {FP_SCALE(-6.0f), FP_SCALE(-2.0f)}, /* 0x06 */ + {FP_SCALE( 6.0f), FP_SCALE( 6.0f)}, /* 0x07 */ + {FP_SCALE(-2.0f), FP_SCALE( 2.0f)}, /* 0x08 */ + {FP_SCALE( 6.0f), FP_SCALE(-2.0f)}, /* 0x09 */ + {FP_SCALE(-2.0f), FP_SCALE(-6.0f)}, /* 0x0A */ + {FP_SCALE( 2.0f), FP_SCALE( 2.0f)}, /* 0x0B */ + {FP_SCALE( 2.0f), FP_SCALE(-2.0f)}, /* 0x0C */ + {FP_SCALE(-6.0f), FP_SCALE( 2.0f)}, /* 0x0D */ + {FP_SCALE( 2.0f), FP_SCALE( 6.0f)}, /* 0x0E */ + {FP_SCALE(-2.0f), FP_SCALE(-2.0f)} /* 0x0F */ }; /* This one does not exist in V.17 as a data constellation. It is only @@ -305,10 +305,10 @@ static const complexi16_t v17_v32bis_4800_constellation[4] = static const complexf_t v17_v32bis_4800_constellation[4] = #endif { - {-6, -2}, /* 0x00 */ - {-2, 6}, /* 0x01 */ - { 2, -6}, /* 0x02 */ - { 6, 2} /* 0x03 */ + {FP_SCALE(-6.0f), FP_SCALE(-2.0f)}, /* 0x00 */ + {FP_SCALE(-2.0f), FP_SCALE( 6.0f)}, /* 0x01 */ + {FP_SCALE( 2.0f), FP_SCALE(-6.0f)}, /* 0x02 */ + {FP_SCALE( 6.0f), FP_SCALE( 2.0f)} /* 0x03 */ }; #if defined(SPANDSP_USE_FIXED_POINTx) @@ -317,10 +317,10 @@ static const complexi16_t v17_v32bis_abcd_constellation[4] = static const complexf_t v17_v32bis_abcd_constellation[4] = #endif { - {-6, -2}, /* A */ - { 2, -6}, /* B */ - { 6, 2}, /* C */ - {-2, 6} /* D */ + {FP_SCALE(-6.0f), FP_SCALE(-2.0f)}, /* A */ + {FP_SCALE( 2.0f), FP_SCALE(-6.0f)}, /* B */ + {FP_SCALE( 6.0f), FP_SCALE( 2.0f)}, /* C */ + {FP_SCALE(-2.0f), FP_SCALE( 6.0f)} /* D */ }; /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/v29tx_constellation_maps.h b/libs/spandsp/src/v29tx_constellation_maps.h index 01da53e71f..f141b336bb 100644 --- a/libs/spandsp/src/v29tx_constellation_maps.h +++ b/libs/spandsp/src/v29tx_constellation_maps.h @@ -24,18 +24,26 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#if !defined(FP_SCALE) +#if defined(SPANDSP_USE_FIXED_POINT) +#define FP_SCALE(x) ((int16_t) x) +#else +#define FP_SCALE(x) (x) +#endif +#endif + #if defined(SPANDSP_USE_FIXED_POINT) static const complexi16_t v29_abab_constellation[6] = #else static const complexf_t v29_abab_constellation[6] = #endif { - { 3, -3}, /* 315deg high 9600 */ - {-3, 0}, /* 180deg low */ - { 1, -1}, /* 315deg low 7200 */ - {-3, 0}, /* 180deg low */ - { 0, -3}, /* 270deg low 4800 */ - {-3, 0} /* 180deg low */ + {FP_SCALE( 3.0f), FP_SCALE(-3.0f)}, /* 315deg high 9600 */ + {FP_SCALE(-3.0f), FP_SCALE( 0.0f)}, /* 180deg low */ + {FP_SCALE( 1.0f), FP_SCALE(-1.0f)}, /* 315deg low 7200 */ + {FP_SCALE(-3.0f), FP_SCALE( 0.0f)}, /* 180deg low */ + {FP_SCALE( 0.0f), FP_SCALE(-3.0f)}, /* 270deg low 4800 */ + {FP_SCALE(-3.0f), FP_SCALE( 0.0f)} /* 180deg low */ }; #if defined(SPANDSP_USE_FIXED_POINT) @@ -44,12 +52,12 @@ static const complexi16_t v29_cdcd_constellation[6] = static const complexf_t v29_cdcd_constellation[6] = #endif { - { 3, 0}, /* 0deg low 9600 */ - {-3, 3}, /* 135deg high */ - { 3, 0}, /* 0deg low 7200 */ - {-1, 1}, /* 135deg low */ - { 3, 0}, /* 0deg low 4800 */ - { 0, 3} /* 90deg low */ + {FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low 9600 */ + {FP_SCALE(-3.0f), FP_SCALE( 3.0f)}, /* 135deg high */ + {FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low 7200 */ + {FP_SCALE(-1.0f), FP_SCALE( 1.0f)}, /* 135deg low */ + {FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low 4800 */ + {FP_SCALE( 0.0f), FP_SCALE( 3.0f)} /* 90deg low */ }; #if defined(SPANDSP_USE_FIXED_POINT) @@ -58,22 +66,22 @@ static const complexi16_t v29_9600_constellation[16] = static const complexf_t v29_9600_constellation[16] = #endif { - { 3, 0}, /* 0deg low */ - { 1, 1}, /* 45deg low */ - { 0, 3}, /* 90deg low */ - {-1, 1}, /* 135deg low */ - {-3, 0}, /* 180deg low */ - {-1, -1}, /* 225deg low */ - { 0, -3}, /* 270deg low */ - { 1, -1}, /* 315deg low */ - { 5, 0}, /* 0deg high */ - { 3, 3}, /* 45deg high */ - { 0, 5}, /* 90deg high */ - {-3, 3}, /* 135deg high */ - {-5, 0}, /* 180deg high */ - {-3, -3}, /* 225deg high */ - { 0, -5}, /* 270deg high */ - { 3, -3} /* 315deg high */ + {FP_SCALE( 3.0f), FP_SCALE( 0.0f)}, /* 0deg low */ + {FP_SCALE( 1.0f), FP_SCALE( 1.0f)}, /* 45deg low */ + {FP_SCALE( 0.0f), FP_SCALE( 3.0f)}, /* 90deg low */ + {FP_SCALE(-1.0f), FP_SCALE( 1.0f)}, /* 135deg low */ + {FP_SCALE(-3.0f), FP_SCALE( 0.0f)}, /* 180deg low */ + {FP_SCALE(-1.0f), FP_SCALE(-1.0f)}, /* 225deg low */ + {FP_SCALE( 0.0f), FP_SCALE(-3.0f)}, /* 270deg low */ + {FP_SCALE( 1.0f), FP_SCALE(-1.0f)}, /* 315deg low */ + {FP_SCALE( 5.0f), FP_SCALE( 0.0f)}, /* 0deg high */ + {FP_SCALE( 3.0f), FP_SCALE( 3.0f)}, /* 45deg high */ + {FP_SCALE( 0.0f), FP_SCALE( 5.0f)}, /* 90deg high */ + {FP_SCALE(-3.0f), FP_SCALE( 3.0f)}, /* 135deg high */ + {FP_SCALE(-5.0f), FP_SCALE( 0.0f)}, /* 180deg high */ + {FP_SCALE(-3.0f), FP_SCALE(-3.0f)}, /* 225deg high */ + {FP_SCALE( 0.0f), FP_SCALE(-5.0f)}, /* 270deg high */ + {FP_SCALE( 3.0f), FP_SCALE(-3.0f)} /* 315deg high */ }; /*- End of file ------------------------------------------------------------*/ From b2e28d68b516467145c4145122fc284d738d83f1 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sat, 21 Jul 2012 10:18:27 -0500 Subject: [PATCH 0781/1057] fix windows build for last spandsp changes - trivial --- libs/spandsp/src/libspandsp.2008.vcproj | 12 ++++++++++-- libs/spandsp/src/libspandsp.2010.vcxproj | 2 ++ libs/spandsp/src/libspandsp.2010.vcxproj.filters | 6 ++++++ libs/spandsp/src/msvc/spandsp.h | 2 -- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libs/spandsp/src/libspandsp.2008.vcproj b/libs/spandsp/src/libspandsp.2008.vcproj index d5964ec4d6..9793cc6f61 100644 --- a/libs/spandsp/src/libspandsp.2008.vcproj +++ b/libs/spandsp/src/libspandsp.2008.vcproj @@ -1243,7 +1243,11 @@ > + + + + + @@ -297,6 +298,7 @@ + diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj.filters b/libs/spandsp/src/libspandsp.2010.vcxproj.filters index fef56df81d..d79f7d1201 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj.filters +++ b/libs/spandsp/src/libspandsp.2010.vcxproj.filters @@ -701,6 +701,12 @@ Header Files + + Header Files + + + Header Files + diff --git a/libs/spandsp/src/msvc/spandsp.h b/libs/spandsp/src/msvc/spandsp.h index f6d7f0cd3b..6ba0b82cec 100644 --- a/libs/spandsp/src/msvc/spandsp.h +++ b/libs/spandsp/src/msvc/spandsp.h @@ -110,9 +110,7 @@ #include #include #include -#if defined(SPANDSP_SUPPORT_T42) #include -#endif #if defined(SPANDSP_SUPPORT_T43) #include #endif From 49dcd8c88993b3a9a0b3d7b44b275f20e0ef8836 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 23 Jul 2012 20:26:48 +0800 Subject: [PATCH 0782/1057] make erlang log less verbose and add erlang debug on|off to control --- .../mod_erlang_event/mod_erlang_event.c | 17 +++++++++++++++-- .../mod_erlang_event/mod_erlang_event.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 8d7b239282..bf20478cf0 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -501,7 +501,9 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c ei_decode_string_or_binary(rep->buff, &rep->index, size, xmlstr); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds from %s for %s!\n", xmlstr, (int) (switch_micro_time_now() - now) / 1000, p->winner, uuid_str); + if (globals.debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds from %s for %s!\n", xmlstr, (int) (switch_micro_time_now() - now) / 1000, p->winner, uuid_str); + } if (zstr(xmlstr)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n"); @@ -1677,9 +1679,20 @@ SWITCH_STANDARD_API(erlang_cmd) if (!found) stream->write_function(stream, "Could not find a listener for %s\n", argv[1]); + } else if (!strcasecmp(argv[0], "debug")) { + if (argc == 2) { + if (!strcasecmp(argv[1], "on")) { + globals.debug = 1; + } else { + globals.debug = 0; + } + } + stream->write_function(stream, "+OK debug %s\n", globals.debug ? "on" : "off"); + } else { stream->write_function(stream, "USAGE: erlang sessions \n" - " erlang listeners\n"); + " erlang listeners\n" + " erlang debug \n"); goto done; } diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index c1730b5dba..6730a64a3a 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -174,6 +174,7 @@ struct globals_struct { unsigned int reference2; char TIMEOUT; /* marker for a timed out request */ char WAITING; /* marker for a request waiting for a response */ + int debug; }; typedef struct globals_struct globals_t; From bd66d7eaa624f193d7caa8abdd1ca73ffd424df7 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 23 Jul 2012 21:15:53 +0800 Subject: [PATCH 0783/1057] show bindings and handlers --- .../mod_erlang_event/mod_erlang_event.c | 78 ++++++++++++++++++- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index bf20478cf0..c462cf30e1 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1612,7 +1612,12 @@ SWITCH_STANDARD_API(erlang_cmd) const char *usage_string = "USAGE:\n" "--------------------------------------------------------------------------------\n" - "erlang listeners\n" "erlang sessions \n" "--------------------------------------------------------------------------------\n"; + "erlang listeners\n" + "erlang sessions \n" + "erlang bindings\n" + "erlang handlers\n" + "erlang debug \n" + "--------------------------------------------------------------------------------\n"; if (zstr(cmd)) { stream->write_function(stream, "%s", usage_string); @@ -1679,6 +1684,73 @@ SWITCH_STANDARD_API(erlang_cmd) if (!found) stream->write_function(stream, "Could not find a listener for %s\n", argv[1]); + } else if (!strcasecmp(argv[0], "handlers")) { + listener_t *l; + + switch_thread_rwlock_rdlock(globals.listener_rwlock); + + if (listen_list.listeners) { + for (l = listen_list.listeners; l; l = l->next) { + int x; + switch_hash_index_t *iter; + const void *key; + void *val; + + stream->write_function(stream, "Listener %s:\n--------------------------------\n", l->peer_nodename); + + for (x = SWITCH_EVENT_CUSTOM + 1; x < SWITCH_EVENT_ALL; x++) { + if (l->event_list[x] == 1) { + stream->write_function(stream, "%s\n", switch_event_name(x)); + } + } + stream->write_function(stream, "CUSTOM:\n", switch_event_name(x)); + + for (iter = switch_hash_first(NULL, l->event_hash); iter; iter = switch_hash_next(iter)) { + switch_hash_this(iter, &key, NULL, &val); + stream->write_function(stream, "\t%s\n", (char *)key); + } + stream->write_function(stream, "\n", (char *)key); + } + } else { + stream->write_function(stream, "No active handlers\n"); + } + + switch_thread_rwlock_unlock(globals.listener_rwlock); + + } else if (!strcasecmp(argv[0], "bindings")) { + int found = 0; + struct erlang_binding *ptr; + switch_thread_rwlock_wrlock(globals.bindings_rwlock); + switch_xml_set_binding_sections(bindings.search_binding, SWITCH_XML_SECTION_MAX); + + for (ptr = bindings.head; ptr; ptr = ptr->next) { + + if (ptr->process.type == ERLANG_PID) { + stream->write_function(stream, "%s ", ptr->process.pid.node); + } + + if (ptr->section == SWITCH_XML_SECTION_CONFIG) { + stream->write_function(stream, "config\n"); + }else if (ptr->section == SWITCH_XML_SECTION_DIRECTORY) { + stream->write_function(stream, "directory\n"); + } else if (ptr->section == SWITCH_XML_SECTION_DIALPLAN) { + stream->write_function(stream, "dialplan\n"); + } else if (ptr->section == SWITCH_XML_SECTION_PHRASES) { + stream->write_function(stream, "phrases\n"); + } else if (ptr->section == SWITCH_XML_SECTION_CHATPLAN) { + stream->write_function(stream, "chatplan\n"); + } else { + stream->write_function(stream, "unknown %d\n", ptr->section); + } + found++; + } + + switch_thread_rwlock_unlock(globals.bindings_rwlock); + + if (!found) { + stream->write_function(stream, "No bindings\n"); + } + } else if (!strcasecmp(argv[0], "debug")) { if (argc == 2) { if (!strcasecmp(argv[1], "on")) { @@ -1690,9 +1762,7 @@ SWITCH_STANDARD_API(erlang_cmd) stream->write_function(stream, "+OK debug %s\n", globals.debug ? "on" : "off"); } else { - stream->write_function(stream, "USAGE: erlang sessions \n" - " erlang listeners\n" - " erlang debug \n"); + stream->write_function(stream, usage_string); goto done; } From 524468be7ba5ee0887d2e975e4f131171c601a54 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Jul 2012 11:36:19 -0500 Subject: [PATCH 0784/1057] FS-4373 --resolve this is probably the same issue nobody would file a bug about on the mailing list even after I begged them to from last weekend --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 4 ++-- src/switch_core_port_allocator.c | 8 +++++++- src/switch_rtp.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index ebf3deafc2..367d97b3bc 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1682,7 +1682,7 @@ static void setup_codecs(struct private_object *tech_pvt) } - if (!payloads[1].id) { + if (!payloads[1].id && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = 0; } @@ -2846,7 +2846,7 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val) } else if (val && !strcasecmp(val, "md5")) { profile->user_flags |= LDL_FLAG_SASL_MD5; } - } else if (!strcasecmp(var, "use-jingle") && !zstr(val)) { + } else if (!strcasecmp(var, "use-jingle") && switch_true(val)) { profile->user_flags |= LDL_FLAG_JINGLE; } else if (!strcasecmp(var, "exten") && !zstr(val)) { profile->exten = switch_core_strdup(module_pool, val); diff --git a/src/switch_core_port_allocator.c b/src/switch_core_port_allocator.c index 4b15318274..5863fddafe 100644 --- a/src/switch_core_port_allocator.c +++ b/src/switch_core_port_allocator.c @@ -174,7 +174,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(switch_core switch_status_t status = SWITCH_STATUS_FALSE; int even = switch_test_flag(alloc, SPF_EVEN); int odd = switch_test_flag(alloc, SPF_ODD); - int index = port - alloc->start; + int index; + + if (port < alloc->start) { + return SWITCH_STATUS_GENERR; + } + + index = port - alloc->start; if (!(even && odd)) { index /= 2; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 538a44fe16..f0749d8087 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1229,7 +1229,7 @@ SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port) { switch_core_port_allocator_t *alloc = NULL; - if (!ip) { + if (!ip || !port) { return; } From 9c0538773525e37b23cee3588b9526597f5f49e3 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Mon, 23 Jul 2012 19:45:58 +0200 Subject: [PATCH 0785/1057] ftmod_isdn: Fix format string warning(/error). Use %p for printing pointer address in hex. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index be5ab50965..c3bd175328 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -815,7 +815,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic ftdmchan = isdn_data->channels_remote_crv[gen->CRV]; } - ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %x (%d:%d) source isdn_data->channels_%s_crv[%#hx]\n", + ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %p (%d:%d) source isdn_data->channels_%s_crv[%#hx]\n", ftdmchan, ((ftdmchan) ? ftdm_channel_get_span_id(ftdmchan) : -1), ((ftdmchan) ? ftdm_channel_get_id(ftdmchan) : -1), From ac7e45400fd9f3ff1e1e493300ab7112a763f6d2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Jul 2012 13:20:06 -0500 Subject: [PATCH 0786/1057] typo --- 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 dd8a365f88..54221aef31 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4832,7 +4832,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s int crypto_tag; if (!(tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_CRYPTO_IN_AVP) && - !switch_true(switch_channel_get_variable(tech_pvt->channel, "sip_allow_crypto_in_sdp"))) { + !switch_true(switch_channel_get_variable(tech_pvt->channel, "sip_allow_crypto_in_avp"))) { if (m->m_proto != sdp_proto_srtp) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "a=crypto in RTP/AVP, refer to rfc3711\n"); match = 0; From 134973187a9438d873ed6726386484cb8baee02f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Jul 2012 14:03:53 -0500 Subject: [PATCH 0787/1057] FS-4092 --resolve --- build/modules.conf.in | 1 + .../autoload_configs/modules.conf.xml | 1 + conf/sbc/autoload_configs/modules.conf.xml | 1 + .../vanilla/autoload_configs/modules.conf.xml | 1 + src/mod/codecs/mod_vp8/mod_vp8.c | 102 ++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 src/mod/codecs/mod_vp8/mod_vp8.c diff --git a/build/modules.conf.in b/build/modules.conf.in index fdb631927a..436ada7879 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -58,6 +58,7 @@ codecs/mod_bv codecs/mod_g723_1 codecs/mod_g729 codecs/mod_h26x +codecs/mod_vp8 #codecs/mod_ilbc #codecs/mod_isac #codecs/mod_opus diff --git a/conf/insideout/autoload_configs/modules.conf.xml b/conf/insideout/autoload_configs/modules.conf.xml index 3c864aec1c..7f17362509 100644 --- a/conf/insideout/autoload_configs/modules.conf.xml +++ b/conf/insideout/autoload_configs/modules.conf.xml @@ -63,6 +63,7 @@ + diff --git a/conf/sbc/autoload_configs/modules.conf.xml b/conf/sbc/autoload_configs/modules.conf.xml index fb59b386be..71d7a110f6 100644 --- a/conf/sbc/autoload_configs/modules.conf.xml +++ b/conf/sbc/autoload_configs/modules.conf.xml @@ -42,6 +42,7 @@ + diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index f88bb7b7c0..a12b9684ba 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -85,6 +85,7 @@ + diff --git a/src/mod/codecs/mod_vp8/mod_vp8.c b/src/mod/codecs/mod_vp8/mod_vp8.c new file mode 100644 index 0000000000..a0e75771f3 --- /dev/null +++ b/src/mod/codecs/mod_vp8/mod_vp8.c @@ -0,0 +1,102 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2012, 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 + * Seven Du + * + * mod_vp8.c -- VP8 Video Codec + * + */ + +#include + +SWITCH_MODULE_LOAD_FUNCTION(mod_vp8_load); +SWITCH_MODULE_DEFINITION(mod_vp8, mod_vp8_load, NULL, NULL); + +static switch_status_t switch_vp8_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) +{ + int encoding, decoding; + + encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); + decoding = (flags & SWITCH_CODEC_FLAG_DECODE); + + if (!(encoding || decoding)) { + return SWITCH_STATUS_FALSE; + } else { + if (codec->fmtp_in) { + codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in); + } + return SWITCH_STATUS_SUCCESS; + } +} + +static switch_status_t switch_vp8_encode(switch_codec_t *codec, + switch_codec_t *other_codec, + void *decoded_data, + uint32_t decoded_data_len, + uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, + unsigned int *flag) +{ + return SWITCH_STATUS_FALSE; +} + +static switch_status_t switch_vp8_decode(switch_codec_t *codec, + switch_codec_t *other_codec, + void *encoded_data, + uint32_t encoded_data_len, + uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, + unsigned int *flag) +{ + return SWITCH_STATUS_FALSE; +} + +static switch_status_t switch_vp8_destroy(switch_codec_t *codec) +{ + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_vp8_load) +{ + switch_codec_interface_t *codec_interface; + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + SWITCH_ADD_CODEC(codec_interface, "VP8 Video (passthru)"); + switch_core_codec_add_implementation(pool, codec_interface, + SWITCH_CODEC_TYPE_VIDEO, 99, "VP8", NULL, 90000, 90000, 0, + 0, 0, 0, 0, 1, 1, switch_vp8_init, switch_vp8_encode, switch_vp8_decode, switch_vp8_destroy); + /* 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: + */ From fc9ea9eab096c5f8c04c82ccc8d7b8e1372a48dd Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 24 Jul 2012 00:00:01 +0200 Subject: [PATCH 0788/1057] ftmod_isdn: Handle zero length read correctly. ftmod_misdn currently returns len == 0 if the incoming message, that triggered the read() call, does not contain any data. Users of ftdm_channel_read() need to handle this case, or they may possibly end up in an endless loop. This patch reworks the ftdm_channel_read() handling in ftmod_isdn and prevents it from entering an endless loop. The read error counter is reset on first sucessful read w/ data. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 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 c3bd175328..4d6c2dcb79 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -2055,10 +2055,13 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) break; default: { - errs = 0; if (flags & FTDM_READ) { len = sizeof(frame); - if (ftdm_channel_read(isdn_data->dchan, frame, &len) == FTDM_SUCCESS) { + if (ftdm_channel_read(isdn_data->dchan, frame, &len) != FTDM_SUCCESS) { + ftdm_log_chan_msg(isdn_data->dchan, FTDM_LOG_ERROR, "Failed to read from D-Channel\n"); + continue; + } + if (len > 0) { #ifdef HAVE_PCAP if (isdn_pcap_capture_both(isdn_data)) { isdn_pcap_write(isdn_data, frame, len, ISDN_PCAP_INCOMING); @@ -2066,6 +2069,9 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) #endif Q921QueueHDLCFrame(&isdn_data->q921, frame, (int)len); Q921Rx12(&isdn_data->q921); + + /* Successful read, reset error counter */ + errs = 0; } } else { ftdm_log(FTDM_LOG_DEBUG, "No Read FLAG!\n"); From 44f74eabb4baaef6a0251a4f187db5f162b4c934 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 23 Jul 2012 21:44:34 -0500 Subject: [PATCH 0789/1057] FS-4455 try this --- .../mod_managed/freeswitch_wrap.2010.cxx | 152 ++++++++++++++++++ .../mod_managed/managed/swig.2010.cs | 122 +++++++++++++- 2 files changed, 272 insertions(+), 2 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index e60919b028..2d2779d1a4 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1170,6 +1170,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABL } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("execute_on_post_originate"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1230,6 +1240,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE_ge } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("api_on_post_originate"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -3126,6 +3146,28 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtcp_numbers_t_octet_count_ge } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtcp_numbers_t_peer_ssrc_set(void * jarg1, unsigned long jarg2) { + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->peer_ssrc = arg2; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtcp_numbers_t_peer_ssrc_get(void * jarg1) { + unsigned long jresult ; + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t result; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + result = (uint32_t) ((arg1)->peer_ssrc); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtcp_numbers_t() { void * jresult ; switch_rtcp_numbers_t *result = 0 ; @@ -9434,6 +9476,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_write(void * jarg1, void * ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_write_video(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ; + void *arg2 = (void *) 0 ; + switch_size_t *arg3 = (switch_size_t *) 0 ; + switch_status_t result; + + arg1 = (switch_file_handle_t *)jarg1; + arg2 = (void *)jarg2; + arg3 = (switch_size_t *)jarg3; + result = (switch_status_t)switch_core_file_write_video(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_seek(void * jarg1, void * jarg2, long long jarg3, int jarg4) { int jresult ; switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ; @@ -10255,6 +10313,16 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_micro_time_now() { } +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_mono_micro_time_now() { + void * jresult ; + switch_time_t result; + + result = switch_mono_micro_time_now(); + jresult = new switch_time_t((const switch_time_t &)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim() { switch_core_memory_reclaim(); } @@ -10419,6 +10487,14 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_cond_yield(int jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_use_system_time(int jarg1) { + switch_bool_t arg1 ; + + arg1 = (switch_bool_t)jarg1; + switch_time_set_use_system_time(arg1); +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_min_dtmf_duration(unsigned long jarg1) { unsigned long jresult ; uint32_t arg1 ; @@ -10616,6 +10692,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_preprocess_session(void * jarg1, ch } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_sqldb_stop_thread() { + switch_core_sqldb_stop_thread(); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_sqldb_start_thread() { + switch_core_sqldb_start_thread(); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_CACHE_DB_LEN_get() { int jresult ; int result; @@ -11334,6 +11420,20 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_os_yield() { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_get_stacksizes(void * jarg1, void * jarg2) { + int jresult ; + switch_size_t *arg1 = (switch_size_t *) 0 ; + switch_size_t *arg2 = (switch_size_t *) 0 ; + switch_status_t result; + + arg1 = (switch_size_t *)jarg1; + arg2 = (switch_size_t *)jarg2; + result = (switch_status_t)switch_core_get_stacksizes(arg1,arg2); + jresult = result; + return jresult; +} + + 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 ; @@ -17897,6 +17997,50 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_write_get(void * } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_read_video_set(void * jarg1, void * jarg2) { + switch_file_interface *arg1 = (switch_file_interface *) 0 ; + switch_status_t (*arg2)(switch_file_handle_t *,void *,switch_size_t *) = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) 0 ; + + arg1 = (switch_file_interface *)jarg1; + arg2 = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *))jarg2; + if (arg1) (arg1)->file_read_video = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_read_video_get(void * jarg1) { + void * jresult ; + switch_file_interface *arg1 = (switch_file_interface *) 0 ; + switch_status_t (*result)(switch_file_handle_t *,void *,switch_size_t *) = 0 ; + + arg1 = (switch_file_interface *)jarg1; + result = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) ((arg1)->file_read_video); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_write_video_set(void * jarg1, void * jarg2) { + switch_file_interface *arg1 = (switch_file_interface *) 0 ; + switch_status_t (*arg2)(switch_file_handle_t *,void *,switch_size_t *) = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) 0 ; + + arg1 = (switch_file_interface *)jarg1; + arg2 = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *))jarg2; + if (arg1) (arg1)->file_write_video = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_write_video_get(void * jarg1) { + void * jresult ; + switch_file_interface *arg1 = (switch_file_interface *) 0 ; + switch_status_t (*result)(switch_file_handle_t *,void *,switch_size_t *) = 0 ; + + arg1 = (switch_file_interface *)jarg1; + result = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) ((arg1)->file_write_video); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_seek_set(void * jarg1, void * jarg2) { switch_file_interface *arg1 = (switch_file_interface *) 0 ; switch_status_t (*arg2)(switch_file_handle_t *,unsigned int *,int64_t,int) = (switch_status_t (*)(switch_file_handle_t *,unsigned int *,int64_t,int)) 0 ; @@ -27238,6 +27382,14 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_add_presence_data_cols(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_launch_dispatch_threads(unsigned long jarg1) { + uint32_t arg1 ; + + arg1 = (uint32_t)jarg1; + switch_event_launch_dispatch_threads(arg1); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RESAMPLE_QUALITY_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 3b447ca5d2..a2f3291302 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2125,6 +2125,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_file_write_video(switch_file_handle fh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t len) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_write_video(switch_file_handle.getCPtr(fh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(len)); + return ret; + } + public static switch_status_t switch_core_file_seek(switch_file_handle fh, SWIGTYPE_p_unsigned_int cur_pos, long samples, int whence) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_seek(switch_file_handle.getCPtr(fh), SWIGTYPE_p_unsigned_int.getCPtr(cur_pos), samples, whence); return ret; @@ -2427,6 +2432,11 @@ public class freeswitch { return ret; } + public static SWIGTYPE_p_switch_time_t switch_mono_micro_time_now() { + SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_mono_micro_time_now(), true); + return ret; + } + public static void switch_core_memory_reclaim() { freeswitchPINVOKE.switch_core_memory_reclaim(); } @@ -2502,6 +2512,10 @@ public class freeswitch { freeswitchPINVOKE.switch_time_set_cond_yield((int)enable); } + public static void switch_time_set_use_system_time(switch_bool_t enable) { + freeswitchPINVOKE.switch_time_set_use_system_time((int)enable); + } + public static uint switch_core_min_dtmf_duration(uint duration) { uint ret = freeswitchPINVOKE.switch_core_min_dtmf_duration(duration); return ret; @@ -2576,6 +2590,14 @@ public class freeswitch { return ret; } + public static void switch_core_sqldb_stop_thread() { + freeswitchPINVOKE.switch_core_sqldb_stop_thread(); + } + + public static void switch_core_sqldb_start_thread() { + freeswitchPINVOKE.switch_core_sqldb_start_thread(); + } + public static string switch_cache_db_type_name(switch_cache_db_handle_type_t type) { string ret = freeswitchPINVOKE.switch_cache_db_type_name((int)type); return ret; @@ -2732,6 +2754,11 @@ public class freeswitch { freeswitchPINVOKE.switch_os_yield(); } + public static switch_status_t switch_core_get_stacksizes(SWIGTYPE_p_switch_size_t cur, SWIGTYPE_p_switch_size_t max) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_get_stacksizes(SWIGTYPE_p_switch_size_t.getCPtr(cur), SWIGTYPE_p_switch_size_t.getCPtr(max)); + return ret; + } + 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; @@ -4417,6 +4444,10 @@ public class freeswitch { freeswitchPINVOKE.switch_event_add_presence_data_cols(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1), prefix); } + public static void switch_event_launch_dispatch_threads(uint max) { + freeswitchPINVOKE.switch_event_launch_dispatch_threads(max); + } + public static switch_status_t switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, uint from_rate, uint to_rate, uint to_size, int quality, uint channels, string file, string func, int line) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, to_rate, to_size, quality, channels, file, func, line); return ret; @@ -6106,12 +6137,14 @@ public class freeswitch { 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_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE_get(); + public static readonly string SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_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_API_ON_PRE_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_API_ON_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_MEDIA_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_API_ON_RING_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_RING_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE_get(); + public static readonly string SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_POST_ORIGINATE_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(); @@ -6681,6 +6714,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE_get")] public static extern string SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE_get")] + public static extern string SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get")] public static extern string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get(); @@ -6699,6 +6735,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE_get")] public static extern string SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE_get")] + public static extern string SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")] public static extern string SWITCH_CALL_TIMEOUT_VARIABLE_get(); @@ -7194,6 +7233,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_octet_count_get")] public static extern uint switch_rtcp_numbers_t_octet_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_peer_ssrc_set")] + public static extern void switch_rtcp_numbers_t_peer_ssrc_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_peer_ssrc_get")] + public static extern uint switch_rtcp_numbers_t_peer_ssrc_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtcp_numbers_t")] public static extern IntPtr new_switch_rtcp_numbers_t(); @@ -8709,6 +8754,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_write")] public static extern int switch_core_file_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_write_video")] + public static extern int switch_core_file_write_video(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_seek")] public static extern int switch_core_file_seek(HandleRef jarg1, HandleRef jarg2, long jarg3, int jarg4); @@ -8892,6 +8940,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_micro_time_now")] public static extern IntPtr switch_micro_time_now(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_mono_micro_time_now")] + public static extern IntPtr switch_mono_micro_time_now(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim")] public static extern void switch_core_memory_reclaim(); @@ -8943,6 +8994,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_cond_yield")] public static extern void switch_time_set_cond_yield(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_use_system_time")] + public static extern void switch_time_set_use_system_time(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_min_dtmf_duration")] public static extern uint switch_core_min_dtmf_duration(uint jarg1); @@ -8988,6 +9042,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_preprocess_session")] public static extern int switch_ivr_preprocess_session(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_sqldb_stop_thread")] + public static extern void switch_core_sqldb_stop_thread(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_sqldb_start_thread")] + public static extern void switch_core_sqldb_start_thread(); + [DllImport("mod_managed", EntryPoint="CSharp_CACHE_DB_LEN_get")] public static extern int CACHE_DB_LEN_get(); @@ -9162,6 +9222,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_os_yield")] public static extern void switch_os_yield(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_stacksizes")] + public static extern int switch_core_get_stacksizes(HandleRef jarg1, HandleRef 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); @@ -10728,6 +10791,18 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_write_get")] public static extern IntPtr switch_file_interface_file_write_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_read_video_set")] + public static extern void switch_file_interface_file_read_video_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_read_video_get")] + public static extern IntPtr switch_file_interface_file_read_video_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_write_video_set")] + public static extern void switch_file_interface_file_write_video_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_write_video_get")] + public static extern IntPtr switch_file_interface_file_write_video_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_seek_set")] public static extern void switch_file_interface_file_seek_set(HandleRef jarg1, HandleRef jarg2); @@ -13035,6 +13110,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_event_add_presence_data_cols")] public static extern void switch_event_add_presence_data_cols(HandleRef jarg1, HandleRef jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_launch_dispatch_threads")] + public static extern void switch_event_launch_dispatch_threads(uint jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RESAMPLE_QUALITY_get")] public static extern int SWITCH_RESAMPLE_QUALITY_get(); @@ -23293,6 +23371,8 @@ public enum switch_channel_flag_t { CF_CHANNEL_SWAP, CF_PICKUP, CF_CONFIRM_BLIND_TRANSFER, + CF_NO_PRESENCE, + CF_CONFERENCE, CF_FLAG_MAX } @@ -26714,6 +26794,10 @@ public enum switch_event_types_t { SWITCH_EVENT_SOCKET_DATA, SWITCH_EVENT_MEDIA_BUG_START, SWITCH_EVENT_MEDIA_BUG_STOP, + SWITCH_EVENT_CONFERENCE_DATA_QUERY, + SWITCH_EVENT_CONFERENCE_DATA, + SWITCH_EVENT_CALL_SETUP_REQ, + SWITCH_EVENT_CALL_SETUP_RESULT, SWITCH_EVENT_ALL } @@ -27317,6 +27401,28 @@ public class switch_file_interface : IDisposable { } } + public SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t file_read_video { + set { + freeswitchPINVOKE.switch_file_interface_file_read_video_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_read_video_get(swigCPtr); + SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t file_write_video { + set { + freeswitchPINVOKE.switch_file_interface_file_write_video_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_write_video_get(swigCPtr); + SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t file_seek { set { freeswitchPINVOKE.switch_file_interface_file_seek_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t.getCPtr(value)); @@ -30475,6 +30581,16 @@ public class switch_rtcp_numbers_t : IDisposable { } } + public uint peer_ssrc { + set { + freeswitchPINVOKE.switch_rtcp_numbers_t_peer_ssrc_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_rtcp_numbers_t_peer_ssrc_get(swigCPtr); + return ret; + } + } + public switch_rtcp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtcp_numbers_t(), true) { } @@ -30501,7 +30617,8 @@ public enum switch_rtp_bug_flag_t { RTP_BUG_NEVER_SEND_MARKER = (1 << 5), RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6), RTP_BUG_ACCEPT_ANY_PACKETS = (1 << 7), - RTP_BUG_GEN_ONE_GEN_ALL = (1 << 8) + RTP_BUG_GEN_ONE_GEN_ALL = (1 << 8), + RTP_BUG_CHANGE_SSRC_ON_MARKER = (1 << 9) } } @@ -31583,7 +31700,8 @@ public enum switch_session_ctl_t { SCSC_READY_CHECK, SCSC_THREADED_SYSTEM_EXEC, SCSC_SYNC_CLOCK_WHEN_IDLE, - SCSC_DEBUG_SQL + SCSC_DEBUG_SQL, + SCSC_SQL } } From 7f525d5ca9e01e85fd92a0c5087c9b87a70ddf2c Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 24 Jul 2012 13:24:44 -0500 Subject: [PATCH 0790/1057] tcp too yo --- conf/vanilla/autoload_configs/enum.conf.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/vanilla/autoload_configs/enum.conf.xml b/conf/vanilla/autoload_configs/enum.conf.xml index 6cd198050b..d67f60f7dd 100644 --- a/conf/vanilla/autoload_configs/enum.conf.xml +++ b/conf/vanilla/autoload_configs/enum.conf.xml @@ -15,6 +15,7 @@ + From d832b5dfef6073276df541ece05236a89921b072 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 24 Jul 2012 13:45:05 -0500 Subject: [PATCH 0791/1057] FS-4453 --resolve this will now cause up to a 20 second timeout waiting for the response and the call will be blocking --- src/include/switch_core.h | 2 +- .../mod_conference/mod_conference.c | 4 +-- .../applications/mod_dptools/mod_dptools.c | 4 +-- src/mod/endpoints/mod_sofia/sofia.c | 18 +++++++++++++ src/mod/endpoints/mod_sofia/sofia_presence.c | 25 ++++++++++++++++++- src/switch_loadable_module.c | 19 +++++++++----- 6 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index f37280f3e7..007f6a85ad 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2153,7 +2153,7 @@ SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t SWITCH_DECLARE(void) switch_cond_yield(switch_interval_time_t t); SWITCH_DECLARE(void) switch_cond_next(void); SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_proto, const char *proto, const char *from, const char *to, - const char *subject, const char *body, const char *type, const char *hint); + const char *subject, const char *body, const char *type, const char *hint, switch_bool_t blocking); SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *dest_proto, switch_event_t *message_event); SWITCH_DECLARE(switch_status_t) switch_core_chat_deliver(const char *dest_proto, switch_event_t **message_event); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index e527b22b31..779feb393d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -7764,7 +7764,7 @@ static switch_status_t chat_send(switch_event_t *message_event) } if (!(conference = conference_find(name, NULL))) { - switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL, NULL); + switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL, NULL, SWITCH_FALSE); return SWITCH_STATUS_FALSE; } @@ -7782,7 +7782,7 @@ static switch_status_t chat_send(switch_event_t *message_event) switch_safe_free(lbuf); - switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", stream.data, NULL, NULL); + switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", stream.data, NULL, NULL, SWITCH_FALSE); switch_safe_free(stream.data); switch_thread_rwlock_unlock(conference->rwlock); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 02f988f6cf..7abd30a6bb 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1720,7 +1720,7 @@ SWITCH_STANDARD_API(chat_api_function) if (!zstr(cmd) && (lbuf = strdup(cmd)) && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) { - if (switch_core_chat_send_args(argv[0], "global", argv[1], argv[2], "", argv[3], !zstr(argv[4]) ? argv[4] : NULL, "") == SWITCH_STATUS_SUCCESS) { + if (switch_core_chat_send_args(argv[0], "global", argv[1], argv[2], "", argv[3], !zstr(argv[4]) ? argv[4] : NULL, "", SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "Sent"); } else { stream->write_function(stream, "Error! Message Not Sent"); @@ -4105,7 +4105,7 @@ static switch_status_t api_chat_send(switch_event_t *message_event) switch_api_execute(cmd, arg, NULL, &stream); if (proto) { - switch_core_chat_send_args(proto, "api", to, hint && strchr(hint, '/') ? hint : from, !zstr(type) ? type : NULL, (char *) stream.data, NULL, NULL); + switch_core_chat_send_args(proto, "api", to, hint && strchr(hint, '/') ? hint : from, !zstr(type) ? type : NULL, (char *) stream.data, NULL, NULL, SWITCH_TRUE); } switch_safe_free(stream.data); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d7758e7371..11a5c8d0fc 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -745,6 +745,24 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip) { + const char *call_id; + int *mstatus; + + if (!sip && sip->sip_call_id) { + return; + } + + call_id = sip->sip_call_id->i_id; + + + switch_mutex_lock(profile->flag_mutex); + mstatus = switch_core_hash_find(profile->chat_hash, call_id); + switch_mutex_unlock(profile->flag_mutex); + + if (mstatus) { + *mstatus = status; + } + } void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 8a6b1297bc..594cb4c61e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -128,6 +128,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) char *route_uri = NULL; const char *network_ip = NULL, *network_port = NULL, *from_proto; char *extra_headers = NULL; + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + int mstatus = 0, sanity = 0; + proto = switch_event_get_header(message_event, "proto"); from_proto = switch_event_get_header(message_event, "from_proto"); @@ -324,6 +327,12 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) switch_snprintf(header, sizeof(header), "X-FS-Sending-Message: %s", switch_core_get_uuid()); + switch_uuid_str(uuid_str, sizeof(uuid_str)); + + switch_mutex_lock(profile->flag_mutex); + switch_core_hash_insert(profile->chat_hash, uuid_str, &mstatus); + switch_mutex_unlock(profile->flag_mutex); + nua_message(msg_nh, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), @@ -331,7 +340,7 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) SIPTAG_FROM_STR(from), TAG_IF(contact, NUTAG_URL(contact)), SIPTAG_TO_STR(dup_dest), - + SIPTAG_CALL_ID_STR(uuid_str), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), @@ -339,6 +348,20 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); + + sanity = 200; + while(!mstatus && --sanity) { + switch_yield(100000); + } + + if (!(mstatus > 199 && mstatus < 300)) { + status = SWITCH_STATUS_FALSE; + } + + switch_mutex_lock(profile->flag_mutex); + switch_core_hash_delete(profile->chat_hash, uuid_str); + switch_mutex_unlock(profile->flag_mutex); + sofia_glue_free_destination(dst); switch_safe_free(dup_dest); switch_safe_free(remote_host); diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 537e1a2550..045733dfa5 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -580,7 +580,6 @@ static switch_status_t do_chat_send(switch_event_t *message_event) if (!do_skip && !switch_stristr("GLOBAL", dest_proto)) { if ((ci = switch_loadable_module_get_chat_interface(dest_proto)) && ci->chat_send) { status = ci->chat_send(message_event); - UNPROTECT_INTERFACE(ci); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid chat interface [%s]!\n", dest_proto); @@ -599,17 +598,20 @@ static switch_status_t do_chat_send(switch_event_t *message_event) return status; } -static void chat_process_event(switch_event_t **eventp) +static switch_status_t chat_process_event(switch_event_t **eventp) { switch_event_t *event; + switch_status_t status; switch_assert(eventp); event = *eventp; *eventp = NULL; - do_chat_send(event); + status = do_chat_send(event); switch_event_destroy(&event); + + return status; } @@ -743,7 +745,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_execute_chat_app(switch_event_t *mes SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_proto, const char *proto, const char *from, const char *to, - const char *subject, const char *body, const char *type, const char *hint) + const char *subject, const char *body, const char *type, const char *hint, switch_bool_t blocking) { switch_event_t *message_event; switch_status_t status; @@ -768,8 +770,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_prot switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "dest_proto", dest_proto); } - chat_queue_message(&message_event); - status = SWITCH_STATUS_SUCCESS; + + if (blocking) { + status = chat_process_event(&message_event); + } else { + chat_queue_message(&message_event); + status = SWITCH_STATUS_SUCCESS; + } return status; From 17a85ec467138a24abb83a49f0aa68d60df10811 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 24 Jul 2012 14:02:02 -0500 Subject: [PATCH 0792/1057] vs2010 reswig --- src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx | 6 ++++-- src/mod/languages/mod_managed/managed/swig.2010.cs | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 2d2779d1a4..21b9a0764b 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -10624,7 +10624,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_cond_next() { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_send_args(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_send_args(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, int jarg9) { int jresult ; char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; @@ -10634,6 +10634,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_send_args(char * jarg1, char char *arg6 = (char *) 0 ; char *arg7 = (char *) 0 ; char *arg8 = (char *) 0 ; + switch_bool_t arg9 ; switch_status_t result; arg1 = (char *)jarg1; @@ -10644,7 +10645,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_send_args(char * jarg1, char arg6 = (char *)jarg6; arg7 = (char *)jarg7; arg8 = (char *)jarg8; - result = (switch_status_t)switch_core_chat_send_args((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8); + arg9 = (switch_bool_t)jarg9; + result = (switch_status_t)switch_core_chat_send_args((char const *)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; } diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index a2f3291302..c3183c0a47 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2570,8 +2570,8 @@ public class freeswitch { freeswitchPINVOKE.switch_cond_next(); } - public static switch_status_t switch_core_chat_send_args(string dest_proto, string proto, string from, string to, string subject, string body, string type, string hint) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_chat_send_args(dest_proto, proto, from, to, subject, body, type, hint); + public static switch_status_t switch_core_chat_send_args(string dest_proto, string proto, string from, string to, string subject, string body, string type, string hint, switch_bool_t blocking) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_chat_send_args(dest_proto, proto, from, to, subject, body, type, hint, (int)blocking); return ret; } @@ -9031,7 +9031,7 @@ class freeswitchPINVOKE { public static extern void switch_cond_next(); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_chat_send_args")] - public static extern int switch_core_chat_send_args(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8); + public static extern int switch_core_chat_send_args(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, int jarg9); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_chat_send")] public static extern int switch_core_chat_send(string jarg1, HandleRef jarg2); From c1c8ddf0bc59de1469f9909637aea1e7c7e12be8 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 24 Jul 2012 16:36:45 -0700 Subject: [PATCH 0793/1057] Create new demo IVR XML and phrases. (New sound files needed.) Update phrase_en.xml to-be-recorded sound files. --- conf/vanilla/ivr_menus/new_demo_ivr.xml | 69 +++++++++ conf/vanilla/lang/en/demo/new-demo-ivr.xml | 171 +++++++++++++++++++++ docs/phrase/phrase_en.xml | 23 ++- 3 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 conf/vanilla/ivr_menus/new_demo_ivr.xml create mode 100644 conf/vanilla/lang/en/demo/new-demo-ivr.xml diff --git a/conf/vanilla/ivr_menus/new_demo_ivr.xml b/conf/vanilla/ivr_menus/new_demo_ivr.xml new file mode 100644 index 0000000000..f2ca7dc68e --- /dev/null +++ b/conf/vanilla/ivr_menus/new_demo_ivr.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/vanilla/lang/en/demo/new-demo-ivr.xml b/conf/vanilla/lang/en/demo/new-demo-ivr.xml new file mode 100644 index 0000000000..619d9921e9 --- /dev/null +++ b/conf/vanilla/lang/en/demo/new-demo-ivr.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index a1d968ae23..fe3244a0ac 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -571,7 +571,27 @@ - + + + + + + + + + + + + + + + + + + + + + @@ -599,6 +619,7 @@ + From 76ad8c549ba22769ff86d84a0b8ba97a8e98fca8 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 24 Jul 2012 19:56:48 -0500 Subject: [PATCH 0794/1057] preserve transport from records lookup --- conf/vanilla/autoload_configs/enum.conf.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/vanilla/autoload_configs/enum.conf.xml b/conf/vanilla/autoload_configs/enum.conf.xml index d67f60f7dd..b9813efa27 100644 --- a/conf/vanilla/autoload_configs/enum.conf.xml +++ b/conf/vanilla/autoload_configs/enum.conf.xml @@ -14,8 +14,8 @@ - - + + From 9883035bec7eee2cfd7716cfd2a341aff351b3e6 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 10:46:37 +0200 Subject: [PATCH 0795/1057] ftmod_isdn: OpenZAP -> FreeTDM API updates. Store call CRV in caller_data.call_reference and use call private to hold the FreeTDM channel object. Remove isdn_data->channels_{local,remote,outbound}_crv arrays. Allow (and force) inbound call state transition DIALTONE -> DOWN for incoming RELEASE COMPLETE messages in NT mode. Dialtone in NT mode works, everything else needs more testing. Signed-off-by: Stefan Knoblich --- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 152 ++++++++---------- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h | 3 - 2 files changed, 64 insertions(+), 91 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 4d6c2dcb79..e9dcd41bfb 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -469,10 +469,15 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) } if (new_chan && new_chan->state == FTDM_CHANNEL_STATE_DOWN) { - isdn_data->channels_local_crv[gen->CRV] = new_chan; + struct Q931_Call *call = NULL; + memset(&new_chan->caller_data, 0, sizeof(new_chan->caller_data)); ftdm_set_flag(new_chan, FTDM_CHANNEL_OUTBOUND); ftdm_set_state_locked(new_chan, FTDM_CHANNEL_STATE_DIALING); + + call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); + Q931CallSetPrivate(call, new_chan); + switch(gen->MesType) { case Q931mes_ALERTING: new_chan->init_state = FTDM_CHANNEL_STATE_PROGRESS_MEDIA; @@ -539,21 +544,17 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * { Q931_TrunkInfo_t *trunk = NULL; ftdm_isdn_data_t *isdn_data = NULL; - ftdm_span_t *zspan = NULL; + ftdm_span_t *span = priv; + + assert(span); assert(call); assert(event); trunk = Q931CallGetTrunk(call); assert(trunk); - zspan = Q931CallGetPrivate(call); - if (!zspan) { - zspan = priv; - Q931CallSetPrivate(call, zspan); - } - assert(zspan); - - isdn_data = zspan->signal_data; + isdn_data = span->signal_data; + assert(isdn_data); if (Q931CallIsGlobal(call)) { /* @@ -575,7 +576,7 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * * Try to get associated zap channel * and init sigmsg struct if there is one */ - ftdmchan = Q931CallIsOutgoing(call) ? isdn_data->channels_local_crv[call_crv] : isdn_data->channels_remote_crv[call_crv]; + ftdmchan = Q931CallGetPrivate(call); if (ftdmchan) { memset(&sig, 0, sizeof(ftdm_sigmsg_t)); sig.chan_id = ftdmchan->chan_id; @@ -763,29 +764,23 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic assert(span != NULL); assert(isdn_data != NULL); - /* - * Support code for the new event handling system - * Remove this as soon as we have the new api to set up calls - */ -#ifdef __OLD__ - if (gen->CRV) { - struct Q931_Call *call; - - call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); - if (call && !Q931CallGetPrivate(call)) { - ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); - Q931CallSetPrivate(call, span); + /* ftdm channel is stored in call private */ + if (call) { + ftdmchan = Q931CallGetPrivate(call); + if (!ftdmchan) { + ftdm_log(FTDM_LOG_DEBUG, "[s%d] No channel associated to call [%#x] private\n", + ftdm_span_get_id(span), Q931CallGetCRV(call)); } } -#else - if (call && !Q931CallGetPrivate(call)) { - ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); - Q931CallSetPrivate(call, span); - } -#endif - ftdm_log(FTDM_LOG_DEBUG, "Yay I got an event! Type:[%02x] Size:[%d] CRV: %d (%#hx, CTX: %s)\n", gen->MesType, gen->Size, gen->CRV, gen->CRV, gen->CRVFlag ? "Terminator" : "Originator"); -#ifdef __TODO_OR_REMOVE__ + ftdm_log(FTDM_LOG_DEBUG, "Yay I got an event! Type:[%02x] Size:[%d] CRV: %d (%#hx, CTX: %s)\n", + gen->MesType, gen->Size, gen->CRV, gen->CRV, gen->CRVFlag ? "Terminator" : "Originator"); + +#ifdef __TODO__ + /* + * This code block is needed for isdn_channel_request() + * isdn_data->outbound_crv has been removed so another way to pass data around is required + */ if (gen->CRVFlag && (caller_data = isdn_data->outbound_crv[gen->CRV])) { if (chan_id) { caller_data->chan_id = chan_id; @@ -808,18 +803,10 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic return 0; } #endif - - if (gen->CRVFlag) { - ftdmchan = isdn_data->channels_local_crv[gen->CRV]; - } else { - ftdmchan = isdn_data->channels_remote_crv[gen->CRV]; - } - - ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %p (%d:%d) source isdn_data->channels_%s_crv[%#hx]\n", + ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %p (%d:%d) via CRV[%#hx]\n", ftdmchan, ((ftdmchan) ? ftdm_channel_get_span_id(ftdmchan) : -1), ((ftdmchan) ? ftdm_channel_get_id(ftdmchan) : -1), - ((gen->CRVFlag) ? "local" : "remote"), gen->CRV); if (gen->ProtDisc == 3) { @@ -874,12 +861,14 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic uint32_t i; for (i = 1; i < ftdm_span_get_chan_count(span); i++) { + ftdmchan = ftdm_span_get_channel(span, chan_id); + /* Skip channels that are down and D-Channels (#OpenZAP-39) */ - if (ftdm_channel_get_state(span->channels[i]) == FTDM_CHANNEL_STATE_DOWN || - ftdm_channel_get_type(span->channels[i]) == FTDM_CHAN_TYPE_DQ921) + if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN || + ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_DQ921) continue; - ftdm_set_state_locked(span->channels[i], FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); } } } @@ -898,6 +887,10 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } } + else if (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALTONE) { + /* Go DOWN */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } else if ((gen->MesType == Q931mes_RELEASE && ftdm_channel_get_state(ftdmchan) <= FTDM_CHANNEL_STATE_UP) || (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALING)) { @@ -983,7 +976,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic int fail_cause = 0; int fail = 1; - if (ftdmchan && ftdmchan == isdn_data->channels_remote_crv[gen->CRV]) { + if (ftdmchan && ftdmchan == Q931CallGetPrivate(call)) { ftdm_log(FTDM_LOG_INFO, "Duplicate SETUP message(?) for Channel %d:%d ~ %d:%d in state %s [ignoring]\n", ftdm_channel_get_span_id(ftdmchan), ftdm_channel_get_id(ftdmchan), @@ -1080,7 +1073,6 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic if (ftdmchan && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN) { ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); - isdn_data->channels_remote_crv[gen->CRV] = ftdmchan; memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); if (ftdmchan->call_data) { @@ -1095,19 +1087,12 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic if (!overlap_dial) { isdn_get_number(callednum, caller_data->dnis.digits); } -#ifdef __TODO_OR_REMOVE__ - ftdmchan->caller_data.CRV = gen->CRV; -#endif -#if 0 /* FIXME */ - if (cplen > sizeof(caller_data->raw_data)) { - cplen = sizeof(caller_data->raw_data); - } -#endif + + ftdmchan->caller_data.call_reference = gen->CRV; + Q931CallSetPrivate(call, ftdmchan); + gen->CRVFlag = !(gen->CRVFlag); -#if 0 /* FIXME */ - memcpy(caller_data->raw_data, msg, cplen); - caller_data->raw_data_len = cplen; -#endif + fail = 0; } } @@ -1305,19 +1290,25 @@ static int ftdm_isdn_921_21(void *pvt, L2UCHAR *msg, L2INT mlen) static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { - ftdm_isdn_data_t *isdn_data = ftdmchan->span->signal_data; ftdm_span_t *span = ftdm_channel_get_span(ftdmchan); + ftdm_isdn_data_t *isdn_data = NULL; ftdm_sigmsg_t sig; ftdm_status_t status; -#if 1 /* FIXME caller_data.raw_data does not exist anymore, see docs/variables.txt for more info */ Q931mes_Generic empty_gen; Q931mes_Generic *gen = &empty_gen; - - memset(&empty_gen, 0, sizeof(empty_gen)) ; -#else - Q931mes_Generic *gen = (Q931mes_Generic *) ftdmchan->caller_data.raw_data; -#endif + struct Q931_Call *call = NULL; + + Q931InitMesGeneric(gen); + + isdn_data = span->signal_data; + assert(isdn_data); + + call = Q931GetCallByCRV(&isdn_data->q931, ftdmchan->caller_data.call_reference); + if (call) { + gen->CRV = Q931CallGetCRV(call); + gen->CRVFlag = Q931CallGetDirection(call) == Q931_DIRECTION_INBOUND ? 1 : 0; + } ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", ftdm_channel_get_span_id(ftdmchan), @@ -1333,13 +1324,10 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_DOWN: { if (gen->CRV) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - isdn_data->channels_local_crv[gen->CRV] = NULL; - } else { - isdn_data->channels_remote_crv[gen->CRV] = NULL; - } + Q931CallSetPrivate(call, NULL); Q931ReleaseCRV(&isdn_data->q931, gen->CRV); } + ftdmchan->caller_data.call_reference = 0; ftdm_channel_close(&ftdmchan); } break; @@ -1351,12 +1339,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { - int crv = gen->CRV; - - Q931InitMesGeneric(gen); gen->MesType = Q931mes_CALL_PROCEEDING; - gen->CRV = crv; - gen->CRVFlag = 1; /* inbound */ if (FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan))) { Q931ie_ChanID ChanID; @@ -1424,7 +1407,6 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } } gen->MesType = Q931mes_ALERTING; - gen->CRVFlag = 1; /* inbound call */ Q931Rx43(&isdn_data->q931, gen, gen->Size); } } @@ -1443,12 +1425,10 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) return; } } + gen->MesType = Q931mes_CONNECT; - gen->BearerCap = 0; - gen->CRVFlag = 1; /* inbound call */ -#if 0 /* FIXME */ - Q931Rx43(&isdn_data->q931, gen, ftdmchan->caller_data.raw_data_len); -#endif + + Q931Rx43(&isdn_data->q931, gen, gen->Size); } } break; @@ -1560,19 +1540,18 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) gen->HLComp = Q931AppendIE(gen, (L3UCHAR *) &HLComp); Q931Rx43(&isdn_data->q931, gen, gen->Size); - isdn_data->channels_local_crv[gen->CRV] = ftdmchan; /* * Support code for the new event handling system * Remove this as soon as we have the new api to set up calls */ if (gen->CRV) { - struct Q931_Call *call; - call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); if (call) { ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); - Q931CallSetPrivate(call, ftdm_channel_get_span(ftdmchan)); + + Q931CallSetPrivate(call, ftdmchan); + ftdmchan->caller_data.call_reference = gen->CRV; } } } @@ -1595,8 +1574,6 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_log(FTDM_LOG_DEBUG, "Hangup: Direction %s\n", ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); - gen->CRVFlag = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? 0 : 1; - cause.IEId = Q931ie_CAUSE; cause.Size = sizeof(Q931ie_Cause); cause.CodStand = Q931_CODING_ITU; /* ITU */ @@ -1659,7 +1636,6 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) status = ftdm_span_send_signal(span, &sig); gen->MesType = Q931mes_RELEASE; - gen->CRVFlag = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? 0 : 1; Q931Rx43(&isdn_data->q931, gen, gen->Size); } default: @@ -2215,7 +2191,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DIALTONE, FTDM_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_INBOUND, diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h index dff3d21276..c8788cf9b0 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h @@ -67,9 +67,6 @@ struct ftdm_isdn_data { int32_t mode; int32_t digit_timeout; ftdm_isdn_opts_t opts; - ftdm_caller_data_t *outbound_crv[32768]; - ftdm_channel_t *channels_local_crv[32768]; - ftdm_channel_t *channels_remote_crv[32768]; #ifdef HAVE_PCAP struct pcap_context *pcap; #endif From 200438d18fd5db8e08fa8622137940756ab33f9c Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 11:01:43 +0200 Subject: [PATCH 0796/1057] ftmod_isdn: Use ftmod_log_chan(_msg)() and ftdm_strlen_zero(). Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index e9dcd41bfb..f5b957e7ae 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -915,7 +915,8 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic ftdm_channel_get_span_id(ftdmchan), ftdm_channel_get_id(ftdmchan)); } else { - ftdm_log(FTDM_LOG_DEBUG, "Ignoring %s on channel %d\n", what, ftdm_channel_get_id(ftdmchan)); + ftdm_log(FTDM_LOG_DEBUG, "Ignoring %s on channel %d in state %s\n", what, + ftdm_channel_get_id(ftdmchan), ftdm_channel_get_state_str(ftdmchan)); } } else { ftdm_log(FTDM_LOG_CRIT, "Received %s with no matching channel %d\n", what, chan_id); @@ -1032,7 +1033,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic } } - if (!callednum || !strlen((char *)callednum->Digit)) { + if (!callednum || ftdm_strlen_zero((char *)callednum->Digit)) { if (FTDM_SPAN_IS_NT(span)) { ftdm_log(FTDM_LOG_NOTICE, "No destination number found, assuming overlap dial\n"); overlap_dial++; @@ -1119,7 +1120,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic } if (ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Channel is busy\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Channel is busy\n"); } else { ftdm_log(FTDM_LOG_CRIT, "Failed to open channel for new setup message\n"); } @@ -1176,7 +1177,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_CALL_PROCEEDING: { if (ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING message for channel %d\n", ftdm_channel_get_id(ftdmchan)); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Received CALL PROCEEDING message for channel\n"); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } else { ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING with no matching channel %d\n", chan_id); @@ -1186,7 +1187,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_CONNECT_ACKNOWLEDGE: { if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK message for channel %d\n", ftdm_channel_get_id(ftdmchan)); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Received CONNECT_ACK message for channel\n"); } else { ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK with no matching channel %d\n", chan_id); } @@ -1196,7 +1197,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_INFORMATION: { if (ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Received INFORMATION message for channel %d\n", ftdm_channel_get_id(ftdmchan)); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Received INFORMATION message for channel\n"); if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALTONE) { char digit = '\0'; From 890ecc6d45935421523f0f1ee463739ca64d4637 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 11:03:41 +0200 Subject: [PATCH 0797/1057] ftmod_isdn: Use span trunk_mode to select default mode and print warning if final modes do not match. Same as ftmod_libpri. Signed-off-by: Stefan Knoblich --- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 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 f5b957e7ae..153f380cdd 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -2659,11 +2659,24 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) isdn_data = malloc(sizeof(*isdn_data)); assert(isdn_data != NULL); - memset(isdn_data, 0, sizeof(*isdn_data)); - isdn_data->mode = Q931_TE; + memset(isdn_data, 0, sizeof(*isdn_data)); dialect = Q931_Dialect_Q931; + /* Use trunk_mode span parameter to set default */ + switch (ftdm_span_get_trunk_mode(span)) { + case FTDM_TRUNK_MODE_NET: + ftdm_log(FTDM_LOG_INFO, "Span '%s' [s%d] defaulting to NET mode\n", + ftdm_span_get_name(span), ftdm_span_get_id(span)); + isdn_data->mode = Q931_NT; + break; + default: + ftdm_log(FTDM_LOG_INFO, "Span '%s' [s%d] defaulting to USER mode\n", + ftdm_span_get_name(span), ftdm_span_get_id(span)); + isdn_data->mode = Q931_TE; + break; + } + for (i = 0; ftdm_parameters[i].var; i++) { const char *var = ftdm_parameters[i].var; const char *val = ftdm_parameters[i].val; @@ -2727,6 +2740,16 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) digit_timeout = DEFAULT_DIGIT_TIMEOUT; } + /* Check if modes match and log a message if they do not. Just to be on the safe side. */ + if (isdn_data->mode == Q931_TE && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) { + ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for TE/CPE/USER mode, while port is running in NT/NET mode. You may want to check your 'trunk_mode' settings.\n", + ftdm_span_get_name(span)); + } + else if (isdn_data->mode == Q931_NT && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_CPE) { + ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for NT/NET mode, while port is running in TE/CPE/USER mode. You may want to check your 'trunk_mode' settings.\n", + ftdm_span_get_name(span)); + } + /* allocate per b-chan data */ if (isdn_data->mode == Q931_NT) { ftdm_isdn_bchan_data_t *data; From 7d0dcb6175770b1c04ae0b0b4e012aad26418c5a Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 11:21:29 +0200 Subject: [PATCH 0798/1057] ftmod_misdn: Rework mISDN channel de-/activation. Remove the 'state' variable of per-channel data, use active flag exclusively to track open/close state. Add misdn_activate_channel()/misdn_deactivate_channel() helper functions, rename old one to _misdn_toggle_channel() (internal). Add _nowait variant of channel de-/activation function, that just sends the mISDN request message. Signed-off-by: Stefan Knoblich --- .../src/ftmod/ftmod_misdn/ftmod_misdn.c | 138 ++++++++++++++---- 1 file changed, 106 insertions(+), 32 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c index c2c1abfb2c..337bbdf409 100644 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c @@ -245,14 +245,10 @@ struct misdn_span_private { pthread_cond_t event_cond; }; -#define MISDN_CHAN_STATE_CLOSED 0 -#define MISDN_CHAN_STATE_OPEN 1 - struct misdn_event_queue; struct misdn_chan_private { /* */ - int state; int debugfd; int active; @@ -470,7 +466,50 @@ static inline int ts_before(struct timespec *a, struct timespec *b) return 0; } -static ftdm_status_t misdn_activate_channel(ftdm_channel_t *chan, int activate) +/* + * Asynchronous channel (de-)activation + */ +static ftdm_status_t _misdn_toggle_channel_nowait(ftdm_channel_t *chan, int activate) +{ + struct misdn_chan_private *priv = ftdm_chan_io_private(chan); + char buf[MAX_DATA_MEM] = { 0 }; + struct mISDNhead *hh = (struct mISDNhead *) buf; + int retval; + + /* NOTE: sending PH_DEACTIVATE_REQ to closed b-channels kills the d-channel (hfcsusb)... */ + if ((activate && priv->active) || (!activate && !priv->active)) + return FTDM_SUCCESS; + + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN sending %s request\n", + (activate) ? "activation" : "deactivation"); + + /* prepare + send request primitive */ + hh->prim = (activate) ? PH_ACTIVATE_REQ : PH_DEACTIVATE_REQ; + hh->id = MISDN_ID_ANY; + + if ((retval = sendto(chan->sockfd, hh, sizeof(*hh), 0, NULL, 0)) < sizeof(*hh)) { + ftdm_log_chan(chan, FTDM_LOG_ERROR, "mISDN failed to send activation request: %s\n", + strerror(errno)); + return FTDM_FAIL; + } + + return FTDM_SUCCESS; +} + +static ftdm_status_t misdn_activate_channel_nowait(ftdm_channel_t *chan) +{ + return _misdn_toggle_channel_nowait(chan, 1); +} + +static ftdm_status_t misdn_deactivate_channel_nowait(ftdm_channel_t *chan) +{ + return _misdn_toggle_channel_nowait(chan, 0); +} + +/* + * Synchronous channel (de-)activation + */ +static ftdm_status_t _misdn_toggle_channel(ftdm_channel_t *chan, int activate) { struct misdn_chan_private *priv = ftdm_chan_io_private(chan); char buf[MAX_DATA_MEM] = { 0 }; @@ -590,6 +629,16 @@ out: return FTDM_SUCCESS; } +static ftdm_status_t misdn_activate_channel(ftdm_channel_t *chan) +{ + return _misdn_toggle_channel(chan, 1); +} + +static ftdm_status_t misdn_deactivate_channel(ftdm_channel_t *chan) +{ + return _misdn_toggle_channel(chan, 0); +} + #if 0 /* unused for now */ static ftdm_status_t misdn_get_ph_info(ftdm_channel_t *chan, struct ph_info *info) @@ -917,7 +966,7 @@ static FIO_OPEN_FUNCTION(misdn_open) assert(chan_priv); assert(span_priv); - if (chan_priv->state == MISDN_CHAN_STATE_OPEN) { + if (chan_priv->active) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "mISDN channel is already open, skipping activation\n"); return FTDM_SUCCESS; } @@ -928,24 +977,27 @@ static FIO_OPEN_FUNCTION(misdn_open) /* * Send activation request */ - ret = misdn_activate_channel(ftdmchan, 1); + ret = misdn_activate_channel(ftdmchan); if (ret != FTDM_SUCCESS) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to activate channel (socket: %d)\n", ftdmchan->sockfd); - return FTDM_FAIL; - } + /* + * Ignore error, ftdm_channel_open() does not correctly handle return FTDM_FAIL cases. + * We will try to activate the channel later. + */ + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel activation request sent\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel activation request sent\n"); - - switch (ftdmchan->type) { - case FTDM_CHAN_TYPE_B: - case FTDM_CHAN_TYPE_DQ921: - chan_priv->state = MISDN_CHAN_STATE_OPEN; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN invalid channel type '%s'\n", - ftdm_channel_get_type_str(ftdmchan)); - break; + switch (ftdmchan->type) { + case FTDM_CHAN_TYPE_B: + case FTDM_CHAN_TYPE_DQ921: + chan_priv->active = 1; + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN invalid channel type '%s'\n", + ftdm_channel_get_type_str(ftdmchan)); + break; + } } return FTDM_SUCCESS; } @@ -964,21 +1016,25 @@ static FIO_CLOSE_FUNCTION(misdn_close) ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "mISDN trying to close %c-channel\n", ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); - /* deactivate b-channels on close */ - if (ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B) { - /* - * Send deactivation request (don't wait for answer) - */ - ret = misdn_activate_channel(ftdmchan, 0); + if (chan_priv->active) { + + if (ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B) { + ret = misdn_deactivate_channel(ftdmchan); + } else { + /* Don't wait for D-Channel deactivation */ + ret = misdn_deactivate_channel_nowait(ftdmchan); + } + if (ret != FTDM_SUCCESS) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to deactivate %c-channel\n", ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); - return FTDM_FAIL; + /* Ignore error, channel might be closed already */ + } else { + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "mISDN %c-channel deactivated\n", + ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); } - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "mISDN %c-channel deactivated\n", - ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B ? 'B' : 'D'); - chan_priv->state = MISDN_CHAN_STATE_CLOSED; + chan_priv->active = 0; } return FTDM_SUCCESS; @@ -1214,7 +1270,7 @@ static FIO_READ_FUNCTION(misdn_read) int retval; int maxretry = 10; - if (priv->state == MISDN_CHAN_STATE_CLOSED) { + if (!priv->active) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN ignoring read on closed channel\n"); /* ignore */ *datalen = 0; @@ -1369,6 +1425,13 @@ static FIO_WRITE_FUNCTION(misdn_write) switch (ftdm_channel_get_type(ftdmchan)) { case FTDM_CHAN_TYPE_B: + /* + * Check state, send activation request (async) if channel is not open + */ + if (!priv->active) { + misdn_activate_channel_nowait(ftdmchan); + return FTDM_SUCCESS; /* eat data */ + } /* * Write to audio pipe, misdn_read() will pull * from there as needed and send it to the b-channel @@ -1393,6 +1456,17 @@ static FIO_WRITE_FUNCTION(misdn_write) memcpy(wbuf + MISDN_HEADER_LEN, data, size); size += MISDN_HEADER_LEN; + /* + * Check state, send activation request (sync) if channel is not open + */ + if (!priv->active) { + retval = misdn_activate_channel(ftdmchan); + if (retval) { + *datalen = 0; + return FTDM_FAIL; + } + } + /* wait for channel to get ready */ wflags = FTDM_WRITE; retval = misdn_wait(ftdmchan, &wflags, 20); @@ -1563,7 +1637,7 @@ static ftdm_status_t misdn_open_range(ftdm_span_t *span, ftdm_chan_type_t type, } else { /* early activate D-Channel */ - misdn_activate_channel(ftdmchan, 1); + misdn_activate_channel(ftdmchan); ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; } num_configured++; From e71bacb2f58d9bdd4131ac1e3461e7ca78de2aa6 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 13:54:32 +0200 Subject: [PATCH 0799/1057] FreeTDM: Add convenience macros ftdm_min(), ftdm_max() and ftdm_clamp(). ftdm_min(x,y) - Returns the smaller of the two values x and y. ftdm_max(x,y) - Returns the larger of the two values x and y. ftdm_clamp(val, min, max) - Returns value that is in the range [vmin,vmax]. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/include/ftdm_os.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/freetdm/src/include/ftdm_os.h b/libs/freetdm/src/include/ftdm_os.h index 151f8d935e..f8681111b6 100644 --- a/libs/freetdm/src/include/ftdm_os.h +++ b/libs/freetdm/src/include/ftdm_os.h @@ -78,6 +78,16 @@ typedef uint64_t ftdm_time_t; /*! \brief array len helper */ #define ftdm_array_len(array) sizeof(array)/sizeof(array[0]) +/*! \brief Get smaller value */ +#define ftdm_min(x,y) ((x) < (y) ? (x) : (y)) + +/*! \brief Get larger value */ +#define ftdm_max(x,y) ((x) > (y) ? (x) : (y)) + +/*! \brief Get value that is in range [vmin,vmax] */ +#define ftdm_clamp(val,vmin,vmax) ftdm_max(vmin,ftdm_min(val,vmax)) + + /*! \brief The memory handler. Do not use directly this variable, use the memory macros and ftdm_global_set_memory_handler to override */ FT_DECLARE_DATA extern ftdm_memory_handler_t g_ftdm_mem_handler; From c3d13d5e00fecbe3c7302dfaa8baa469691aacc4 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 16:07:39 +0200 Subject: [PATCH 0800/1057] ftmod_libpri: Drop custom MIN() macro and use common ftdm_min() Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 6 +----- 1 file changed, 1 insertion(+), 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 01abf1e5a0..41f6718353 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -34,10 +34,6 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" -#ifndef MIN -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) -#endif - static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); static ftdm_io_interface_t ftdm_libpri_interface; @@ -1236,7 +1232,7 @@ static int on_info(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event if (!ftdm_strlen_zero(pevent->ring.callednum)) { int digits = strlen(pevent->ring.callednum); int offset = strlen(caller_data->dnis.digits); - int len = MIN(sizeof(caller_data->dnis.digits) - 1 - offset, digits); /* max. length without terminator */ + int len = ftdm_min(sizeof(caller_data->dnis.digits) - 1 - offset, digits); /* max. length without terminator */ if (len < digits) { ftdm_log_chan(chan, FTDM_LOG_WARNING, "Length %d of digit string exceeds available space %d of DNIS, truncating!\n", From fb57605df7f6ad5238662fe041bab51448c39a0c Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 16:08:51 +0200 Subject: [PATCH 0801/1057] ftmod_misdn: Drop custom MIN(),MAX(),CLAMP() macros and use the common ones. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c index 337bbdf409..2e56c3f39c 100644 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c @@ -70,18 +70,6 @@ //#define MISDN_DEBUG_EVENTS //#define MISDN_DEBUG_IO -#ifndef MIN -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) -#endif - -#ifndef MAX -#define MAX(x,y) (((x) > (y)) ? (x) : (y)) -#endif - -#ifndef CLAMP -#define CLAMP(val,min,max) (MIN(max,MAX(min,val))) -#endif - typedef enum { MISDN_CAPS_NONE = 0, @@ -1302,7 +1290,7 @@ static FIO_READ_FUNCTION(misdn_read) } if (hh->prim == PH_DATA_IND) { - *datalen = CLAMP(retval - MISDN_HEADER_LEN, 0, bytes); + *datalen = ftdm_clamp(retval - MISDN_HEADER_LEN, 0, bytes); #ifdef MISDN_DEBUG_IO ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "misdn_read() received '%s', id: %#x, with %d bytes from channel socket %d [dev.ch: %d.%d]\n", misdn_event2str(hh->prim), hh->id, retval - MISDN_HEADER_LEN, ftdmchan->sockfd, addr.dev, addr.channel); @@ -1451,7 +1439,7 @@ static FIO_WRITE_FUNCTION(misdn_write) hh->id = MISDN_ID_ANY; /* Avoid buffer overflow */ - size = MIN(size, MAX_DATA_MEM - MISDN_HEADER_LEN); + size = ftdm_min(size, MAX_DATA_MEM - MISDN_HEADER_LEN); memcpy(wbuf + MISDN_HEADER_LEN, data, size); size += MISDN_HEADER_LEN; From 7a93ae2d95fb857f009e35751b3e3aef32605d67 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 25 Jul 2012 16:10:35 +0200 Subject: [PATCH 0802/1057] FreeTDM: Add ftdm_offset_of() and ftdm_container_of() macros. Might as well import these too... ftdm_offset_of() - Get offset of member in structure. ftdm_container_of() - Get pointer to enclosing structure from pointer to structure member. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/include/ftdm_os.h | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/libs/freetdm/src/include/ftdm_os.h b/libs/freetdm/src/include/ftdm_os.h index f8681111b6..39afec94be 100644 --- a/libs/freetdm/src/include/ftdm_os.h +++ b/libs/freetdm/src/include/ftdm_os.h @@ -87,6 +87,45 @@ typedef uint64_t ftdm_time_t; /*! \brief Get value that is in range [vmin,vmax] */ #define ftdm_clamp(val,vmin,vmax) ftdm_max(vmin,ftdm_min(val,vmax)) +/*! + * \brief Get offset of member in structure + * \param[in] type Type of struct + * \param[in] member Name of struct member + * \code + * struct a { + * int foo; + * int bar; + * }; + * + * int offset_a_bar = ftdm_offset_of(struct a, bar); // 4 byte offset + * \endcode + */ +#define ftdm_offset_of(type,member) (uintptr_t)&(((type *)0)->member) + +/*! + * \brief Get pointer to enclosing structrure from pointer to embedded member + * \param[in] ptr Pointer to embedded member + * \param[in] type Type of parent/container structure + * \param[in] member Name of embedded member in parent/container struct + * \code + * struct engine { + * int nr_cyl; + * }; + * + * struct car { + * char model[10]; + * struct engine eng; // struct engine embedded in car(!) + * }; + * + * int somefunc(struct engine *e) { + * struct car *c = ftdm_container_of(e, struct car, eng); + * + * ... do something with car ... + * } + * \endcode + */ +#define ftdm_container_of(ptr,type,member) (type *)((uintptr_t)(ptr) - ftdm_offset_of(type, member)) + /*! \brief The memory handler. Do not use directly this variable, use the memory macros and ftdm_global_set_memory_handler to override */ From c9e172789cb7f77cd9d6b52b6f6264395d6ac91d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 25 Jul 2012 16:34:43 -0500 Subject: [PATCH 0803/1057] FS-4467 try this patch that will sanity check for dups to catch this case when the ambigous method is used --- src/mod/endpoints/mod_sofia/mod_sofia.c | 32 +++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 0bcb383421..8669be4c7b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2779,6 +2779,7 @@ struct cb_helper { uint32_t row_process; sofia_profile_t *profile; switch_stream_handle_t *stream; + switch_bool_t dedup; }; @@ -3771,11 +3772,20 @@ static int contact_callback(void *pArg, int argc, char **argv, char **columnName { struct cb_helper *cb = (struct cb_helper *) pArg; char *contact; - + cb->row_process++; - + if (!zstr(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1))) { - cb->stream->write_function(cb->stream, "%ssofia/%s/sip:%s,", argv[2], argv[1], sofia_glue_strip_proto(contact)); + if (cb->dedup) { + char *tmp = switch_mprintf("%ssofia/%s/sip:%s", argv[2], argv[1], sofia_glue_strip_proto(contact)); + + if (!strstr((char *)cb->stream->data, tmp)) { + cb->stream->write_function(cb->stream, "%s,", tmp); + free(tmp); + } + } else { + cb->stream->write_function(cb->stream, "%ssofia/%s/sip:%s,", argv[2], argv[1], sofia_glue_strip_proto(contact)); + } free(contact); } @@ -3978,7 +3988,8 @@ static void select_from_profile(sofia_profile_t *profile, const char *domain, const char *concat, const char *exclude_contact, - switch_stream_handle_t *stream) + switch_stream_handle_t *stream, + switch_bool_t dedup) { struct cb_helper cb; char *sql; @@ -3987,15 +3998,16 @@ static void select_from_profile(sofia_profile_t *profile, cb.profile = profile; cb.stream = stream; + cb.dedup = dedup; if (exclude_contact) { sql = switch_mprintf("select contact, profile_name, '%q' " - "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); + "from sip_registrations where profile_name='%q' and sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') " + "and contact not like '%%%s%%'", (concat != NULL) ? concat : "", profile->name, user, domain, domain, exclude_contact); } else { sql = switch_mprintf("select contact, profile_name, '%q' " - "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", - (concat != NULL) ? concat : "", user, domain, domain); + "from sip_registrations where profile_name='%q' and sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", + (concat != NULL) ? concat : "", profile->name, user, domain, domain); } switch_assert(sql); @@ -4080,7 +4092,7 @@ SWITCH_STANDARD_API(sofia_contact_function) domain = profile->domain_name; } - select_from_profile(profile, user, domain, concat, exclude_contact, &mystream); + select_from_profile(profile, user, domain, concat, exclude_contact, &mystream, SWITCH_FALSE); sofia_glue_release_profile(profile); } else if (!zstr(domain)) { @@ -4093,7 +4105,7 @@ SWITCH_STANDARD_API(sofia_contact_function) for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &var, NULL, &val); if ((profile = (sofia_profile_t *) val) && !strcmp((char *)var, profile->name)) { - select_from_profile(profile, user, domain, concat, exclude_contact, &mystream); + select_from_profile(profile, user, domain, concat, exclude_contact, &mystream, SWITCH_TRUE); profile = NULL; } } From 5367b9615330144e86459701d12de07b6c0d9a28 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 26 Jul 2012 01:05:36 +0200 Subject: [PATCH 0804/1057] ftmod_isdn: Rework teletone buffer offset handling in isdn_tones_run(). Store the offset in the teletone buffer in the b-channel private data. An NT-mode setup with ftmod_misdn showed severe (dial-)tone distortions in a sound editor (330Hz sine wave phase errors), caused by using a global teletone buffer offset. Switching to a per-channel offset, that is advanced by the amount of data actually written to the channel, removes (almost) all distortions. There is still a minimal phase error every ~500ms (audible) that needs more investigating. Signed-off-by: Stefan Knoblich --- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 27 ++++++++++++------- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 153f380cdd..bd00789248 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1797,7 +1797,6 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) teletone_generation_session_t ts = {{{{0}}}};; unsigned char frame[1024]; int x, interval; - int offset = 0; ftdm_log(FTDM_LOG_DEBUG, "ISDN tones thread starting.\n"); ftdm_set_flag(isdn_data, FTDM_ISDN_TONES_RUNNING); @@ -1842,6 +1841,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { ftdm_channel_t *chan = ftdm_span_get_channel(span, x); ftdm_size_t len = sizeof(frame), rlen; + ftdm_isdn_bchan_data_t *data = chan->call_data; if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_DQ921) { continue; @@ -1855,7 +1855,6 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DIALTONE: { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)chan->call_data; ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); /* check overlap dial timeout first before generating tone */ @@ -1933,7 +1932,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) } /* seek to current offset */ - ftdm_buffer_seek(dt_buffer, offset); + ftdm_buffer_seek(dt_buffer, data->offset); rlen = ftdm_buffer_read_loop(dt_buffer, frame, len); @@ -1953,7 +1952,22 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) goto done; } } - ftdm_channel_write(chan, frame, sizeof(frame), &rlen); + + if (ftdm_channel_write(chan, frame, sizeof(frame), &rlen) == FTDM_SUCCESS) { + /* + * Advance offset in teletone buffer by amount + * of data actually written to channel. + */ + if (chan->effective_codec != FTDM_CODEC_SLIN) { + data->offset += rlen << 1; /* teletone buffer is slin (= len * 2) */ + } else { + data->offset += rlen; + } + + if (data->offset >= ts.rate) { + data->offset = 0; + } + } } /* @@ -1962,11 +1976,6 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) if (!gated) { ftdm_sleep(interval); } - - offset += (ts.rate / (1000 / interval)) << 1; - if (offset >= ts.rate) { - offset = 0; - } } done: diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h index c8788cf9b0..57e1d5386d 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h @@ -79,6 +79,7 @@ typedef struct ftdm_isdn_data ftdm_isdn_data_t; struct ftdm_isdn_bchan_data { int32_t digit_timeout; + int offset; /* offset in teletone buffer */ }; typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t; From 32b3f3e22430b54e0ffc237f2c3fe5997ae4c868 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 25 Jul 2012 19:09:03 -0500 Subject: [PATCH 0805/1057] doh --- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8669be4c7b..c2a256de14 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3781,8 +3781,10 @@ static int contact_callback(void *pArg, int argc, char **argv, char **columnName if (!strstr((char *)cb->stream->data, tmp)) { cb->stream->write_function(cb->stream, "%s,", tmp); - free(tmp); } + + free(tmp); + } else { cb->stream->write_function(cb->stream, "%ssofia/%s/sip:%s,", argv[2], argv[1], sofia_glue_strip_proto(contact)); } From 5ebc68fb51a76efc8574a4b6d92b05340e7c2c72 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 26 Jul 2012 09:06:08 +0200 Subject: [PATCH 0806/1057] ftmod_isdn: Fix per-channel teletone buffer offset wraparound. Do a "soft" wraparound with modulo, removes the ~0.5s tone glitch. (Multiply ts.rate (samples) by two to match the offset unit (bytes, 2 per sample).) Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index bd00789248..de53002b79 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1964,9 +1964,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) data->offset += rlen; } - if (data->offset >= ts.rate) { - data->offset = 0; - } + data->offset %= (ts.rate << 1); } } From 1d5b5f218a1996a50954b4e1c39116bb1e93bc44 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 11:38:02 -0500 Subject: [PATCH 0807/1057] add core_uuid global variable to expose the runtime uuid --- src/switch_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_core.c b/src/switch_core.c index c00f13ab78..534edf6303 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1570,6 +1570,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_uuid_get(&uuid); switch_uuid_format(runtime.uuid_str, &uuid); + switch_core_set_variable("core_uuid", runtime.uuid_str); return SWITCH_STATUS_SUCCESS; From 1dd4bd492673aa31ecefe82a1d17b4f4ca26cc32 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 11:45:06 -0500 Subject: [PATCH 0808/1057] add core-uuid attr to xml cdr tag --- src/switch_ivr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index fb3852a353..69f77808c1 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2196,6 +2196,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ } } + switch_xml_set_attr_d(cdr, "core-uuid", switch_core_get_uuid()); + if (!(x_channel_data = switch_xml_add_child_d(cdr, "channel_data", cdr_off++))) { goto error; } From 93f96addc3e2ac889927ba4d0cae7126242e0e02 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 12:32:51 -0500 Subject: [PATCH 0809/1057] FS-4453 confirm this fixes your problem please --- src/mod/endpoints/mod_sofia/sofia.c | 1 + src/mod/endpoints/mod_sofia/sofia_presence.c | 48 ++++++++++++-------- src/switch_loadable_module.c | 3 ++ 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 11a5c8d0fc..628bd81d1f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -755,6 +755,7 @@ void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle call_id = sip->sip_call_id->i_id; + switch_mutex_lock(profile->flag_mutex); mstatus = switch_core_hash_find(profile->chat_hash, call_id); switch_mutex_unlock(profile->flag_mutex); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 594cb4c61e..f147d6d471 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -130,8 +130,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) char *extra_headers = NULL; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; int mstatus = 0, sanity = 0; + const char *blocking; + int is_blocking = 0; - proto = switch_event_get_header(message_event, "proto"); from_proto = switch_event_get_header(message_event, "from_proto"); from = switch_event_get_header(message_event, "from"); @@ -140,7 +141,9 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) body = switch_event_get_body(message_event); type = switch_event_get_header(message_event, "type"); from_full = switch_event_get_header(message_event, "from_full"); - + blocking = switch_event_get_header(message_event, "blocking"); + is_blocking = switch_true(blocking); + network_ip = switch_event_get_header(message_event, "to_sip_ip"); network_port = switch_event_get_header(message_event, "to_sip_port"); @@ -328,11 +331,13 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) switch_snprintf(header, sizeof(header), "X-FS-Sending-Message: %s", switch_core_get_uuid()); switch_uuid_str(uuid_str, sizeof(uuid_str)); - - switch_mutex_lock(profile->flag_mutex); - switch_core_hash_insert(profile->chat_hash, uuid_str, &mstatus); - switch_mutex_unlock(profile->flag_mutex); - + + if (is_blocking) { + switch_mutex_lock(profile->flag_mutex); + switch_core_hash_insert(profile->chat_hash, uuid_str, &mstatus); + switch_mutex_unlock(profile->flag_mutex); + } + nua_message(msg_nh, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), @@ -347,20 +352,23 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) SIPTAG_HEADER_STR(header), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END()); - - - sanity = 200; - while(!mstatus && --sanity) { - switch_yield(100000); - } - - if (!(mstatus > 199 && mstatus < 300)) { - status = SWITCH_STATUS_FALSE; - } - switch_mutex_lock(profile->flag_mutex); - switch_core_hash_delete(profile->chat_hash, uuid_str); - switch_mutex_unlock(profile->flag_mutex); + + if (is_blocking) { + sanity = 200; + + while(!mstatus && --sanity) { + switch_yield(100000); + } + + if (!(mstatus > 199 && mstatus < 300)) { + status = SWITCH_STATUS_FALSE; + } + + switch_mutex_lock(profile->flag_mutex); + switch_core_hash_delete(profile->chat_hash, uuid_str); + switch_mutex_unlock(profile->flag_mutex); + } sofia_glue_free_destination(dst); switch_safe_free(dup_dest); diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 045733dfa5..15c4739775 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -758,6 +758,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_chat_send_args(const char *dest_prot switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "type", type); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "hint", hint); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "skip_global_process", "true"); + if (blocking) { + switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "blocking", "true"); + } if (body) { switch_event_add_body(message_event, "%s", body); From 696fb9c28b41ec11480b3c5a0658846573802044 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 13:17:39 -0500 Subject: [PATCH 0810/1057] expand vars in hold music variable --- src/switch_channel.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/switch_channel.c b/src/switch_channel.c index 99a4cc6121..cb434d2712 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -717,6 +717,16 @@ SWITCH_DECLARE(const char *) switch_channel_get_hold_music(switch_channel_t *cha var = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); } + if (!zstr(var)) { + char *expanded = switch_channel_expand_variables(channel, var); + + if (expanded != var) { + var = switch_core_session_strdup(channel->session, expanded); + free(expanded); + } + } + + return var; } From cd88211d0a8cac10e9c111687066e65d2bc9abd6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 14:33:45 -0500 Subject: [PATCH 0811/1057] FS-4470 try this, the tmp_hanguphook will flag the b leg with CF_REDIRECT in the event that it hangs up which should spare it from the codepath in exchange_media state --- .../applications/mod_dptools/mod_dptools.c | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 7abd30a6bb..4b46e7eec3 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2126,6 +2126,32 @@ static switch_status_t xfer_on_dtmf(switch_core_session_t *session, void *input, return SWITCH_STATUS_SUCCESS; } +static switch_status_t tmp_hanguphook(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_state_t state = switch_channel_get_state(channel); + + if (state == CS_HANGUP || state == CS_ROUTING) { + const char *bond = switch_channel_get_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE); + + if (!zstr(bond)) { + switch_core_session_t *b_session; + + if ((b_session = switch_core_session_locate(bond))) { + switch_channel_t *b_channel = switch_core_session_get_channel(b_session); + if (switch_channel_up(b_channel)) { + switch_channel_set_flag(b_channel, CF_REDIRECT); + } + switch_core_session_rwunlock(b_session); + } + } + + switch_core_event_hook_remove_state_change(session, tmp_hanguphook); + } + + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t hanguphook(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); @@ -2160,14 +2186,13 @@ SWITCH_STANDARD_APP(att_xfer_function) switch_channel_t *channel, *peer_channel = NULL; const char *bond = NULL; switch_core_session_t *b_session = NULL; - + channel = switch_core_session_get_channel(session); - if ((bond = switch_channel_get_partner_uuid(channel))) { - bond = switch_core_session_strdup(session, bond); - } - + bond = switch_channel_get_partner_uuid(channel); switch_channel_set_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, bond); + switch_core_event_hook_add_state_change(session, tmp_hanguphook); + if (switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) != SWITCH_STATUS_SUCCESS || !peer_session) { @@ -2226,6 +2251,9 @@ SWITCH_STANDARD_APP(att_xfer_function) switch_core_session_rwunlock(peer_session); end: + + switch_core_event_hook_remove_state_change(session, tmp_hanguphook); + switch_channel_set_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL); switch_channel_clear_flag(channel, CF_XFER_ZOMBIE); } From 772f60d23527e47e1034a40b36d6f4aa3e6ac16f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 16:47:50 -0500 Subject: [PATCH 0812/1057] 4569 tweaks --- src/mod/endpoints/mod_sofia/sofia.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 628bd81d1f..4c9670f422 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1222,7 +1222,11 @@ static void our_sofia_event_callback(nua_event_t event, refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to); if ((params = strchr(refer_to, ';'))) { - *params++ = '\0'; + if (*refer_to == '<') { + *params++ = '\0'; + } else { + *params++ = '>'; + } if (!(method = switch_find_parameter(params, "method", NULL))) { method = strdup("INVITE"); @@ -1260,7 +1264,11 @@ static void our_sofia_event_callback(nua_event_t event, switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Target-URI", "%s", refer_to); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Extension", ref_to_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Domain", ref_to_host); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Sender", "sofia/%s/%s", profile->name, referred_by); + + if (!zstr(referred_by)) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Sender", "sofia/%s/%s", profile->name, referred_by); + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_number", ref_by_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_name", ref_by_user); switch_event_fire(&event); From 034d3741c1e5494e1ae01f142eb8c35e7123428b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 21:07:10 -0500 Subject: [PATCH 0813/1057] 4569 tweaks --- src/mod/endpoints/mod_sofia/sofia.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4c9670f422..efcda5e615 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1222,10 +1222,10 @@ static void our_sofia_event_callback(nua_event_t event, refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to); if ((params = strchr(refer_to, ';'))) { - if (*refer_to == '<') { - *params++ = '\0'; - } else { + if (strchr(refer_to, '<')) { *params++ = '>'; + } else { + *params++ = '\0'; } if (!(method = switch_find_parameter(params, "method", NULL))) { From f5af7ae2b1ca332ecafc6c636194c04b1b87876b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Jul 2012 21:25:50 -0500 Subject: [PATCH 0814/1057] FS-4471 --resolve --- src/switch_ivr_bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 4af0dbb8ff..3ca4dd2715 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1703,7 +1703,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, c switch_channel_t *rchannel = switch_core_session_get_channel(rsession); const char *brto; - if ((brto = switch_channel_get_variable(rchannel, "orignate_signal_bond")) || + if ((brto = switch_channel_get_variable(rchannel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE)) || (brto = switch_channel_get_partner_uuid(rchannel))) { switch_copy_string(b_uuid, brto, blen); status = SWITCH_STATUS_SUCCESS; From dc1422998a1962c864274f47bd9e3b98278d0157 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 27 Jul 2012 14:31:39 +0200 Subject: [PATCH 0815/1057] FreeTDM: Add FTDM_XINT64_FMT 64bit hex format string and use it in ftmod_misdn. Fixes: src/ftmod/ftmod_misdn/ftmod_misdn.c: In function 'misdn_handle_mph_information_ind': src/ftmod/ftmod_misdn/ftmod_misdn.c:871:3: error: format '%lx' expects argument of type 'long unsigned int', but argument 13 has type 'uint64_t' [-Werror=format] Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c | 2 +- libs/freetdm/src/include/ftdm_declare.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c index 2e56c3f39c..462cb9a6c4 100644 --- a/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c +++ b/libs/freetdm/src/ftmod/ftmod_misdn/ftmod_misdn.c @@ -868,7 +868,7 @@ static int misdn_handle_mph_information_ind(ftdm_channel_t *chan, const struct m } bch_info = &info->bch[0]; - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN port state:\n\tD-Chan proto:\t%hu\n\tD-Chan state:\t%s (%hu)\n\tD-Chan flags:\t%#lx\n\t\t\t%-70s\n", + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "mISDN port state:\n\tD-Chan proto:\t%hu\n\tD-Chan state:\t%s (%hu)\n\tD-Chan flags:\t%#"FTDM_XINT64_FMT"\n\t\t\t%-70s\n", info->dch.ch.protocol, misdn_hw_state_name(info->dch.ch.protocol, info->dch.state), info->dch.state, info->dch.ch.Flags, diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index 3a931fb718..b47d16268a 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -192,6 +192,7 @@ typedef __int8 int8_t; #define FTDM_SIZE_FMT "Id" #define FTDM_INT64_FMT "lld" #define FTDM_UINT64_FMT "llu" +#define FTDM_XINT64_FMT "llx" #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else @@ -203,9 +204,11 @@ typedef __int8 int8_t; #if (defined(__SIZEOF_LONG__) && (__SIZEOF_LONG__ == 8)) || defined(__LP64__) || defined(__LLP64__) #define FTDM_INT64_FMT "ld" #define FTDM_UINT64_FMT "lu" +#define FTDM_XINT64_FMT "lx" #else #define FTDM_INT64_FMT "lld" #define FTDM_UINT64_FMT "llu" +#define FTDM_XINT64_FMT "llx" #endif #define FTDM_INVALID_SOCKET -1 typedef int ftdm_socket_t; From 71b64412b9366f14ee47635df444a8ebb02020e7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Jul 2012 10:44:16 -0500 Subject: [PATCH 0816/1057] FS-4470 --resolve 2 for one fix --- src/switch_ivr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 69f77808c1..8c0f3226c9 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1690,6 +1690,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL); + /* Set CF_TRANSFER flag before hanging up bleg to avoid race condition */ + switch_channel_set_flag(channel, CF_TRANSFER); + /* If HANGUP_AFTER_BRIDGE is set to 'true', SWITCH_SIGNAL_BRIDGE_VARIABLE * will not have a value, so we need to check SWITCH_BRIDGE_VARIABLE */ @@ -1725,8 +1728,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ } switch_channel_set_caller_profile(channel, new_profile); - switch_channel_set_flag(channel, CF_TRANSFER); - + switch_channel_set_state(channel, CS_ROUTING); msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSFER; From aba2b391fbe013519c10e5ff555b86632ab71288 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Jul 2012 13:23:30 -0500 Subject: [PATCH 0817/1057] fix seg --- src/mod/applications/mod_conference/mod_conference.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 779feb393d..28c90062dd 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -7799,9 +7799,7 @@ static conference_obj_t *conference_find(char *name, char *domain) switch_core_hash_delete(globals.conference_hash, conference->name); switch_clear_flag(conference, CFLAG_INHASH); conference = NULL; - } - - if (!zstr(domain) && conference->domain && strcasecmp(domain, conference->domain)) { + } else if (!zstr(domain) && conference->domain && strcasecmp(domain, conference->domain)) { conference = NULL; } } From b6de76cb8c0ad7ef80ca1faf6d8c8928a75be23d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Jul 2012 14:49:08 -0500 Subject: [PATCH 0818/1057] tweak --- src/mod/applications/mod_conference/mod_conference.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 28c90062dd..ed5e51b16d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -671,9 +671,11 @@ static char *conference_rfc4579_render(conference_obj_t *conference, switch_even switch_snprintf(tmp, sizeof(tmp), "%u", conference->count); switch_xml_set_txt_d(x_tag1, tmpp); +#if 0 if (conference->count == 0) { switch_event_add_header(revent, SWITCH_STACK_BOTTOM, "notfound", "true"); } +#endif if (!(x_tag1 = switch_xml_add_child_d(x_tag, "active", off1++))) { abort(); From 365b9feb72a9201e06ed6812e31e570da937a6e7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Jul 2012 15:07:11 -0500 Subject: [PATCH 0819/1057] 457x tweaks --- .../mod_conference/mod_conference.c | 4 ++-- src/mod/endpoints/mod_sofia/sofia.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index ed5e51b16d..d7be5e6ea5 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -8433,7 +8433,7 @@ static void call_setup_event_handler(switch_event_t *event) char *dial_uri = switch_event_get_header(event, "Request-Target-URI"); char *action = switch_event_get_header(event, "Request-Action"); char *ext = switch_event_get_header(event, "Request-Target-Extension"); - + char *full_url = switch_event_get_header(event, "full_url"); if (!ext) ext = dial_str; @@ -8464,7 +8464,7 @@ static void call_setup_event_handler(switch_event_t *event) if (!strncasecmp(ostr, "url+", 4)) { ostr += 4; - } else if (conference->outcall_templ) { + } else if (!switch_true(full_url) && conference->outcall_templ) { if ((expanded = switch_event_expand_headers(var_event, conference->outcall_templ))) { ostr = expanded; } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index efcda5e615..777b23fad9 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1212,7 +1212,7 @@ static void our_sofia_event_callback(nua_event_t event, sofia_handle_sip_i_refer(nua, profile, nh, session, sip, de, tags); } else { const char *req_user = NULL, *req_host = NULL, *action = NULL, *ref_by_user = NULL, *ref_to_user = NULL, *ref_to_host = NULL; - char *refer_to = NULL, *referred_by = NULL, *method = NULL; + char *refer_to = NULL, *referred_by = NULL, *method = NULL, *full_url = NULL; char *params = NULL; switch_event_t *event; @@ -1231,6 +1231,8 @@ static void our_sofia_event_callback(nua_event_t event, if (!(method = switch_find_parameter(params, "method", NULL))) { method = strdup("INVITE"); } + + full_url = switch_find_parameter(params, "full_url", NULL); if (!strcasecmp(method, "INVITE")) { action = "call"; @@ -1264,6 +1266,10 @@ static void our_sofia_event_callback(nua_event_t event, switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Target-URI", "%s", refer_to); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Extension", ref_to_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Request-Target-Domain", ref_to_host); + if (switch_true(full_url)) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "full-url", "true"); + } + if (!zstr(referred_by)) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Request-Sender", "sofia/%s/%s", profile->name, referred_by); @@ -1276,6 +1282,7 @@ static void our_sofia_event_callback(nua_event_t event, nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END()); switch_safe_free(method); + switch_safe_free(full_url); } break; @@ -6941,13 +6948,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t goto done; } - printf("DICK %d\n", __LINE__); - if (!sip->sip_cseq || !(etmp = switch_mprintf("refer;id=%u", sip->sip_cseq->cs_seq))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Memory Error!\n"); goto done; } - printf("DICK %d\n", __LINE__); + from = sip->sip_from; //to = sip->sip_to; @@ -6980,11 +6985,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t rep = (char *) switch_stristr("Replaces=", refer_to->r_url->url_headers); } - printf("WTFX %s\n", rep); - if (!rep) { - printf("WTF [%s]\n", refer_to->r_url->url_headers); - } else { + if (rep) { sip_replaces_t *replaces; nua_handle_t *bnh = NULL; From cfb2335406d7558bbe59ed2f224ba8a2a771e350 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Jul 2012 15:27:01 -0500 Subject: [PATCH 0820/1057] FS-4462 add log message to point out this problem in the future --- src/mod/applications/mod_voicemail/mod_voicemail.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 699bc96311..51677c5b3f 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3808,6 +3808,9 @@ static void actual_message_query_handler(switch_event_t *event) if (globals.message_query_exact_match) { if ((profile = (vm_profile_t *) switch_core_hash_find(globals.profile_hash, domain))) { parse_profile(); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Cound not find a profile for domain: [%s] Returning 0 messages\nWhen message-query-exact-match is enabled you must have a dedicated vm profile per distinct domain name you wish to use.\n", domain); } } else { for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) { From 293429f78d72f2793e7e9283752b0be2bb9ba731 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Jul 2012 18:53:04 -0500 Subject: [PATCH 0821/1057] add api-expansion to switch.conf.xml and fsctl api_expansion command to control allowing apis to be expanded via variable expansion --- src/include/switch_core.h | 3 +++ src/include/switch_types.h | 4 ++- .../applications/mod_commands/mod_commands.c | 9 +++++++ src/switch_channel.c | 9 ++++--- src/switch_core.c | 25 +++++++++++++++++++ src/switch_event.c | 9 ++++--- 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 007f6a85ad..879951cfde 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -323,6 +323,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(_In_ switch SWITCH_DECLARE(void) switch_core_port_allocator_destroy(_Inout_ switch_core_port_allocator_t **alloc); ///\} + +SWITCH_DECLARE(int) switch_core_test_flag(int flag); + ///\defgroup ss Startup/Shutdown ///\ingroup core1 ///\{ diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 20ee478bf5..b4ec368021 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -322,7 +322,8 @@ typedef enum { SCF_THREADED_SYSTEM_EXEC = (1 << 18), SCF_SYNC_CLOCK_REQUESTED = (1 << 19), SCF_CORE_ODBC_REQ = (1 << 20), - SCF_DEBUG_SQL = (1 << 21) + SCF_DEBUG_SQL = (1 << 21), + SCF_API_EXPANSION = (1 << 22) } switch_core_flag_enum_t; typedef uint32_t switch_core_flag_t; @@ -1776,6 +1777,7 @@ typedef enum { SCSC_SYNC_CLOCK_WHEN_IDLE, SCSC_DEBUG_SQL, SCSC_SQL, + SCSC_API_EXPANSION } switch_session_ctl_t; typedef enum { diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 1cde9b30ce..9ed0506efd 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1854,6 +1854,15 @@ SWITCH_STANDARD_API(ctl_function) switch_core_session_ctl(SCSC_VERBOSE_EVENTS, &arg); stream->write_function(stream, "+OK verbose_events is %s \n", arg ? "on" : "off"); + } else if (!strcasecmp(argv[0], "api_expansion")) { + arg = -1; + if (argv[1]) { + arg = switch_true(argv[1]); + } + + switch_core_session_ctl(SCSC_API_EXPANSION, &arg); + + stream->write_function(stream, "+OK api_expansion is %s \n", arg ? "on" : "off"); } else if (!strcasecmp(argv[0], "threaded_system_exec")) { arg = -1; if (argv[1]) { diff --git a/src/switch_channel.c b/src/switch_channel.c index cb434d2712..a8f05f1928 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -34,6 +34,7 @@ #include #include + struct switch_cause_table { const char *name; switch_call_cause_t cause; @@ -3591,7 +3592,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c if ((sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) { if (var_list && !switch_event_check_permission_list(var_list, vname)) { - sub_val = "INVALID"; + sub_val = ""; } if ((expanded_sub_val = switch_channel_expand_variables_check(channel, sub_val, var_list, api_list, recur+1)) == sub_val) { @@ -3645,9 +3646,9 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c vval = expanded; } - if (api_list && !switch_event_check_permission_list(api_list, vname)) { - func_val = "INVALID"; - sub_val = "INVALID"; + if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) { + func_val = NULL; + sub_val = ""; } else { if (switch_api_execute(vname, vval, channel->session, &stream) == SWITCH_STATUS_SUCCESS) { func_val = stream.data; diff --git a/src/switch_core.c b/src/switch_core.c index 534edf6303..e5433077b3 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1405,6 +1405,12 @@ static void switch_core_set_serial(void) } +SWITCH_DECLARE(int) switch_core_test_flag(int flag) +{ + return switch_test_flag((&runtime), flag); +} + + SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err) { switch_uuid_t uuid; @@ -1433,6 +1439,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_set_flag((&runtime.dummy_cng_frame), SFF_CNG); switch_set_flag((&runtime), SCF_AUTO_SCHEMAS); switch_set_flag((&runtime), SCF_CLEAR_SQL); + switch_set_flag((&runtime), SCF_API_EXPANSION); #ifdef WIN32 switch_set_flag((&runtime), SCF_THREADED_SYSTEM_EXEC); #endif @@ -1750,6 +1757,12 @@ static void switch_load_core_config(const char *file) } else { switch_clear_flag((&runtime), SCF_CLEAR_SQL); } + } else if (!strcasecmp(var, "api-expansion")) { + if (switch_true(val)) { + switch_set_flag((&runtime), SCF_API_EXPANSION); + } else { + switch_clear_flag((&runtime), SCF_API_EXPANSION); + } } else if (!strcasecmp(var, "enable-early-hangup") && switch_true(val)) { switch_set_flag((&runtime), SCF_EARLY_HANGUP); } else if (!strcasecmp(var, "colorize-console") && switch_true(val)) { @@ -2099,6 +2112,18 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void * newintval = switch_test_flag((&runtime), SCF_VERBOSE_EVENTS); } break; + case SCSC_API_EXPANSION: + if (intval) { + if (oldintval > -1) { + if (oldintval) { + switch_set_flag((&runtime), SCF_API_EXPANSION); + } else { + switch_clear_flag((&runtime), SCF_API_EXPANSION); + } + } + newintval = switch_test_flag((&runtime), SCF_API_EXPANSION); + } + break; case SCSC_THREADED_SYSTEM_EXEC: if (intval) { if (oldintval > -1) { diff --git a/src/switch_event.c b/src/switch_event.c index 4bfbbb1ff7..5b7891d496 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -35,6 +35,7 @@ #include #include + //#define SWITCH_EVENT_RECYCLE #define DISPATCH_QUEUE_LEN 100 //#define DEBUG_DISPATCH_QUEUES @@ -2109,7 +2110,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, } if (var_list && !switch_event_check_permission_list(var_list, vname)) { - sub_val = "INVALID"; + sub_val = ""; } @@ -2161,9 +2162,9 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, vval = expanded; } - if (api_list && !switch_event_check_permission_list(api_list, vname)) { - func_val = "INVALID"; - sub_val = "INVALID"; + if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) { + func_val = NULL; + sub_val = ""; } else { if (switch_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) { func_val = stream.data; From 3c82033e532081fb42678a2ba297f9bd32b94635 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Mon, 30 Jul 2012 13:56:48 +0200 Subject: [PATCH 0822/1057] FreeSWITCH: Fix warn-unused-result error in rtp_common_read(). strerror_r() returns the error message string (and expects you to use it). Signed-off-by: Stefan Knoblich --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index f0749d8087..867f600f47 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3310,8 +3310,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) { char tmp[128] = ""; - strerror_r(poll_status, tmp, sizeof(tmp)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", + poll_status, strerror_r(poll_status, tmp, sizeof(tmp))); ret = -1; goto end; } From 0f4ecab5e9d3ad765ee266f1af41560df5f434ae Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 30 Jul 2012 16:36:20 -0500 Subject: [PATCH 0823/1057] FS-4481 --resolve seg is fixed but just utf-8 will not work. you need type/subtype format like text/utf-8 --- src/mod/endpoints/mod_sofia/sofia.c | 3 ++- src/mod/endpoints/mod_sofia/sofia_presence.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 777b23fad9..3ded1dccd2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -748,7 +748,8 @@ void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle const char *call_id; int *mstatus; - if (!sip && sip->sip_call_id) { + if (!(sip && sip->sip_call_id)) { + nua_handle_destroy(nh); return; } diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f147d6d471..e53a4fd267 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -357,7 +357,7 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) if (is_blocking) { sanity = 200; - while(!mstatus && --sanity) { + while(!mstatus && --sanity && !msg_nh->nh_destroyed) { switch_yield(100000); } From 3b5b59e693f5c36568055427ea097c4ba40b4913 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 31 Jul 2012 01:58:48 +0200 Subject: [PATCH 0824/1057] Revert "FreeSWITCH: Fix warn-unused-result error in rtp_common_read()." *sigh* of course there are two versions of strerror_r(): char *strerror_r() - GNU int strerror_r() - non-GNU Revert and back the drawing board... This reverts commit 3c82033e532081fb42678a2ba297f9bd32b94635. --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 867f600f47..f0749d8087 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3310,8 +3310,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) { char tmp[128] = ""; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", - poll_status, strerror_r(poll_status, tmp, sizeof(tmp))); + strerror_r(poll_status, tmp, sizeof(tmp)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp); ret = -1; goto end; } From b3e6730de82a407b67380a871c506a57c1773615 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 07:59:58 -0500 Subject: [PATCH 0825/1057] indent --- src/switch_core_sqldb.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 90a88e59b5..851d492ad5 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -156,9 +156,9 @@ static switch_cache_db_handle_t *get_handle(const char *db_str, const char *user if (dbh_ptr->hash == hash && !dbh_ptr->use_count && !switch_test_flag(dbh_ptr, CDF_PRUNE) && switch_mutex_trylock(dbh_ptr->mutex) == SWITCH_STATUS_SUCCESS) { r = dbh_ptr; - break; - } - } + break; + } + } } if (r) { @@ -210,9 +210,9 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t } /* 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; - } + if (r == SWITCH_STATUS_SUCCESS && !(*dbh)->io_mutex) { + (*dbh)->io_mutex = sql_manager.io_mutex; + } */ return r; @@ -1018,16 +1018,16 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, switch_mutex_lock(sql_manager.cond_mutex); switch (sql_manager.event_db->type) { - case SCDB_TYPE_ODBC: - break; - case SCDB_TYPE_CORE_DB: - { - switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA synchronous=OFF;", NULL); - switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA count_changes=OFF;", NULL); - switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA temp_store=MEMORY;", NULL); - switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA journal_mode=OFF;", NULL); - } - break; + case SCDB_TYPE_ODBC: + break; + case SCDB_TYPE_CORE_DB: + { + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA synchronous=OFF;", NULL); + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA count_changes=OFF;", NULL); + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA temp_store=MEMORY;", NULL); + switch_cache_db_execute_sql(sql_manager.event_db, "PRAGMA journal_mode=OFF;", NULL); + } + break; } while (sql_manager.thread_running == 1) { @@ -1494,7 +1494,7 @@ static void core_event_handler(switch_event_t *event) } new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' or uuid='%s'", - switch_event_get_header_nil(event, "channel-call-uuid"), a_uuid, b_uuid); + switch_event_get_header_nil(event, "channel-call-uuid"), a_uuid, b_uuid); new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch," @@ -1721,7 +1721,7 @@ static char create_registrations_sql[] = " reg_user VARCHAR(256),\n" " realm VARCHAR(256),\n" " token VARCHAR(256),\n" -/* If url is modified please check for code in switch_core_sqldb_start for dependencies for MSSQL" */ + /* If url is modified please check for code in switch_core_sqldb_start for dependencies for MSSQL" */ " url TEXT,\n" " expires INTEGER,\n" " network_ip VARCHAR(256),\n" From 1b355edf18a20ec7b5909819bd5d51d9493990ef Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 08:03:07 -0500 Subject: [PATCH 0826/1057] FS-4483 --resolve --- src/switch_core_sqldb.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 851d492ad5..20e0a788dd 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -2156,18 +2156,17 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_queue_create(&sql_manager.sql_queue[0], SWITCH_SQL_QUEUE_LEN, sql_manager.memory_pool); switch_queue_create(&sql_manager.sql_queue[1], SWITCH_SQL_QUEUE_LEN, sql_manager.memory_pool); + + switch_threadattr_create(&thd_attr, sql_manager.memory_pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + + switch_core_sqldb_start_thread(); + switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool); + + while (sql_manager.manage && !sql_manager.thread_running && --sanity) { + switch_yield(10000); + } } - - switch_threadattr_create(&thd_attr, sql_manager.memory_pool); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - - switch_core_sqldb_start_thread(); - switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool); - - while (sql_manager.manage && !sql_manager.thread_running && --sanity) { - switch_yield(10000); - } - return SWITCH_STATUS_SUCCESS; } @@ -2263,7 +2262,7 @@ void switch_core_sqldb_stop(void) switch_core_sqldb_stop_thread(); - if (sql_manager.thread && sql_manager.db_thread_running) { + if (sql_manager.db_thread && sql_manager.db_thread_running) { sql_manager.db_thread_running = -1; switch_thread_join(&st, sql_manager.db_thread); } From e40e8696fc61d9a623d4433ed619aa74c9b73b45 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 14:01:56 -0500 Subject: [PATCH 0827/1057] update 4579 stuff --- src/mod/endpoints/mod_sofia/sofia.c | 50 ++++++++++++++++++----------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 3ded1dccd2..6c7c0382b3 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1216,38 +1216,49 @@ static void our_sofia_event_callback(nua_event_t event, char *refer_to = NULL, *referred_by = NULL, *method = NULL, *full_url = NULL; char *params = NULL; switch_event_t *event; + char *tmp; if (sip->sip_refer_to) { ref_to_user = sip->sip_refer_to->r_url->url_user; ref_to_host = sip->sip_refer_to->r_url->url_host; - refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to); - if ((params = strchr(refer_to, ';'))) { - if (strchr(refer_to, '<')) { - *params++ = '>'; - } else { + if ((refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to))) { + + if ((params = strrchr(refer_to, ';'))) { *params++ = '\0'; } - - if (!(method = switch_find_parameter(params, "method", NULL))) { - method = strdup("INVITE"); - } - full_url = switch_find_parameter(params, "full_url", NULL); - - if (!strcasecmp(method, "INVITE")) { - action = "call"; - } else if (!strcasecmp(method, "BYE")) { - action = "end"; - } else { - action = method; + if ((tmp = sofia_glue_get_url_from_contact(refer_to, 0))) { + refer_to = tmp; } } - refer_to = sofia_glue_get_url_from_contact(refer_to, 0); - + if (!params || !switch_stristr("method=", params)) { + if ((params = strchr(refer_to, ';'))) { + *params++ = '\0'; + } + } + + if (params) { + method = switch_find_parameter(params, "method", NULL); + full_url = switch_find_parameter(params, "full_url", NULL); + } + + } + if (!method) { + method = strdup("INVITE"); + } + + if (!strcasecmp(method, "INVITE")) { + action = "call"; + } else if (!strcasecmp(method, "BYE")) { + action = "end"; + } else { + action = method; + } + if (sip->sip_referred_by) { referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_referred_by), 0); ref_by_user = sip->sip_referred_by->b_url->url_user; @@ -1278,6 +1289,7 @@ static void our_sofia_event_callback(nua_event_t event, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_number", ref_by_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_name", ref_by_user); + DUMP_EVENT(event); switch_event_fire(&event); } From a7b10081c88a893d2ac0d4d3f88a45ea7559c25d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 15:26:03 -0500 Subject: [PATCH 0828/1057] send notifies for refer for 4579 --- .../mod_conference/mod_conference.c | 65 +++++++++++++++++++ src/mod/endpoints/mod_sofia/sofia.c | 64 +++++++++++++++++- src/mod/endpoints/mod_sofia/sofia_presence.c | 43 +++++++++--- 3 files changed, 163 insertions(+), 9 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index d7be5e6ea5..fccdefd46e 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1325,6 +1325,49 @@ static void send_rfc_event(conference_obj_t *conference) } + +static void send_conference_notify(conference_obj_t *conference, const char *status, switch_bool_t final) +{ + switch_event_t *event; + char *name = NULL, *domain = NULL, *dup_domain = NULL; + + if (!switch_test_flag(conference, CFLAG_RFC4579)) { + return; + } + + if (!(name = conference->name)) { + name = "conference"; + } + + if (!(domain = conference->domain)) { + dup_domain = switch_core_get_variable_dup("domain"); + if (!(domain = dup_domain)) { + domain = "cluecon.com"; + } + } + + + if (switch_event_create(&event, SWITCH_EVENT_CONFERENCE_DATA) == SWITCH_STATUS_SUCCESS) { + event->flags |= EF_UNIQ_HEADERS; + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "conference-name", name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "conference-domain", domain); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "conference-event", "refer"); + + if (final) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "final", "true"); + } + + + switch_event_add_body(event, "%s", status); + switch_event_fire(&event); + } + + switch_safe_free(dup_domain); + +} + + /* Gain exclusive access and add the member to the list */ static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member) { @@ -6459,6 +6502,11 @@ static switch_status_t conference_outcall(conference_obj_t *conference, int rdlock = 0; switch_bool_t have_flags = SWITCH_FALSE; const char *outcall_flags; + int track = 0; + + if (var_event && switch_true(switch_event_get_header(var_event, "conference_track_status"))) { + track++; + } *cause = SWITCH_CAUSE_NORMAL_CLEARING; @@ -6500,6 +6548,12 @@ static switch_status_t conference_outcall(conference_obj_t *conference, switch_mutex_lock(conference->mutex); conference->originating++; switch_mutex_unlock(conference->mutex); + + if (track) { + send_conference_notify(conference, "SIP/2.0 100 Trying\r\n", SWITCH_FALSE); + } + + status = switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, var_event, SOF_NO_LIMITS, cancel_cause); switch_mutex_lock(conference->mutex); conference->originating--; @@ -6511,9 +6565,18 @@ static switch_status_t conference_outcall(conference_obj_t *conference, if (caller_channel) { switch_channel_hangup(caller_channel, *cause); } + + if (track) { + send_conference_notify(conference, "SIP/2.0 481 Failure\r\n", SWITCH_TRUE); + } + goto done; } + if (track) { + send_conference_notify(conference, "SIP/2.0 200 OK\r\n", SWITCH_TRUE); + } + rdlock = 1; peer_channel = switch_core_session_get_channel(peer_session); @@ -8462,6 +8525,8 @@ static void call_setup_event_handler(switch_event_t *event) switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_invite_uri", dial_uri); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "conference_track_status", "true"); + if (!strncasecmp(ostr, "url+", 4)) { ostr += 4; } else if (!switch_true(full_url) && conference->outcall_templ) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 6c7c0382b3..9299d9f680 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1289,10 +1289,72 @@ static void our_sofia_event_callback(nua_event_t event, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_number", ref_by_user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "var_origination_caller_id_name", ref_by_user); - DUMP_EVENT(event); switch_event_fire(&event); } + + + if (sip) { + char *sql; + sofia_nat_parse_t np = { { 0 } }; + char *contact_str; + char *proto = "sip", *orig_proto = "sip"; + const char *call_id, *full_from, *full_to, *full_via, *from_user = NULL, *from_host = NULL, *to_user, *to_host, *full_agent; + char to_tag[13] = ""; + char *event_str = "refer"; + + np.fs_path = 1; + contact_str = sofia_glue_gen_contact_str(profile, sip, nh, de, &np); + + call_id = sip->sip_call_id->i_id; + full_from = sip_header_as_string(nh->nh_home, (void *) sip->sip_from); + full_to = sip_header_as_string(nh->nh_home, (void *) sip->sip_to); + full_via = sip_header_as_string(nh->nh_home, (void *) sip->sip_via); + + full_agent = sip_header_as_string(nh->nh_home, (void *) sip->sip_user_agent); + + switch_stun_random_string(to_tag, 12, NULL); + + if (sip->sip_from) { + from_user = sip->sip_from->a_url->url_user; + from_host = sip->sip_from->a_url->url_host; + } else { + from_user = "n/a"; + from_host = "n/a"; + } + + if (sip->sip_to) { + to_user = sip->sip_to->a_url->url_user; + to_host = sip->sip_to->a_url->url_host; + } else { + to_user = "n/a"; + to_host = "n/a"; + } + + sql = switch_mprintf("insert into sip_subscriptions " + "(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from," + "full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip,version,orig_proto, full_to) " + "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q',-1,'%q','%q;tag=%q')", + proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : "", + event_str, contact_str, call_id, full_from, full_via, + (long) switch_epoch_time_now(NULL) + 60, + full_agent, accept, profile->name, mod_sofia_globals.hostname, + np.network_port, np.network_ip, orig_proto, full_to, to_tag); + + switch_assert(sql != NULL); + + + if (1 || mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s REFER SUBSCRIBE %s@%s %s@%s\n%s\n", + profile->name, from_user, from_host, to_user, to_host, sql); + } + + + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + + sip_to_tag(nh->nh_home, sip->sip_to, to_tag); + } + nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END()); switch_safe_free(method); switch_safe_free(full_url); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index e53a4fd267..b7b39d1feb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -900,8 +900,20 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event const char *call_id = switch_event_get_header(event, "call_id"); const char *from_user = switch_event_get_header(event, "conference-name"); const char *from_host = switch_event_get_header(event, "conference-domain"); + const char *event_str = switch_event_get_header(event, "conference-event"); const char *notfound = switch_event_get_header(event, "notfound"); const char *body = switch_event_get_body(event); + const char *type = "application/conference-info+xml"; + int final = switch_true(switch_event_get_header(event, "final"); + + if (!event_str) { + event_str = "conference"; + } + + if (!strcasecmp(event_str, "refer")) { + type = "message/sipfrag"; + } + if (!(from_user && from_host)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event information not given\n"); @@ -910,34 +922,49 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event if (switch_true(notfound)) { sql = switch_mprintf("update sip_subscriptions set expires=%ld where " - "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='conference'", + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'", (long)switch_epoch_time_now(NULL), mod_sofia_globals.hostname, profile->name, - from_user, from_host); + from_user, from_host, event_str); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } + if (switch_true(final)) { + sql = switch_mprintf("delete from sip_subscriptions where " + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'", + mod_sofia_globals.hostname, profile->name, + from_user, from_host, event_str); + + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } + + + + + if (call_id) { sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, " - "'application/conference-info+xml' as ct,'%q' as pt " + "'%q' as ct,'%q' as pt " " from sip_subscriptions where " - "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='conference'" + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'" "and call_id = '%q' ", switch_sql_concat(), + type, switch_str_nil(body), mod_sofia_globals.hostname, profile->name, - from_user, from_host, call_id); + from_user, from_host, event_str, call_id); } else { sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, " - "'application/conference-info+xml' as ct,'%q' as pt " + "'%q' as ct,'%q' as pt " " from sip_subscriptions where " - "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='conference'", + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'", switch_sql_concat(), + type, switch_str_nil(body), mod_sofia_globals.hostname, profile->name, - from_user, from_host); + from_user, from_host, event_str); } sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_send_sql, &cb); From 258afd47045754f8f9633c66f91f61d100abead3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 15:32:04 -0500 Subject: [PATCH 0829/1057] FS-4480 try this --- 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 4b46e7eec3..5ca719e8d2 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1403,7 +1403,7 @@ SWITCH_STANDARD_APP(export_function) } } - switch_channel_export_variable(channel, var, val, SWITCH_EXPORT_VARS_VARIABLE); + switch_channel_export_variable_var_check(channel, var, val, SWITCH_EXPORT_VARS_VARIABLE, SWITCH_FALSE); } } From f6ca367fff0fb9c3670de09a9cc5eeefe72bfe40 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 15:44:57 -0500 Subject: [PATCH 0830/1057] doh --- src/mod/endpoints/mod_sofia/sofia_presence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index b7b39d1feb..f116cd2ee0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -904,7 +904,7 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event const char *notfound = switch_event_get_header(event, "notfound"); const char *body = switch_event_get_body(event); const char *type = "application/conference-info+xml"; - int final = switch_true(switch_event_get_header(event, "final"); + const char *final = switch_event_get_header(event, "final"); if (!event_str) { event_str = "conference"; From beed0336c0ec616a8c749a56430f0a880926b6ec Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 15:53:00 -0500 Subject: [PATCH 0831/1057] FS-4484 I missed the part about gateways, that is a different story. Try this patch --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c2a256de14..c831721ffb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4568,9 +4568,10 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session dest_to = NULL; } } - + if (params) { tech_pvt->invite_contact = switch_core_session_sprintf(nsession, "%s;%s", gateway_ptr->register_contact, params); + tech_pvt->dest = switch_core_session_sprintf(nsession, "%s;%s", tech_pvt->dest, params); } else { tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact); } From e97da8e20a83bdc5c85fc1630dc0980de6290664 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 31 Jul 2012 16:35:56 -0500 Subject: [PATCH 0832/1057] remove debug --- 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 9299d9f680..c7464e20bd 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1344,7 +1344,7 @@ static void our_sofia_event_callback(nua_event_t event, switch_assert(sql != NULL); - if (1 || mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { + if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s REFER SUBSCRIBE %s@%s %s@%s\n%s\n", profile->name, from_user, from_host, to_user, to_host, sql); } From c5d72d9bd0c0cce2eeb7d0e61a175e29810aeff0 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 2 Aug 2012 18:39:02 +0200 Subject: [PATCH 0833/1057] FS-4379 gsmopen: 'gsm remove interface' works now --- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 837d20ed30..05221d1800 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -342,6 +342,7 @@ static switch_status_t interface_exists(char *the_interface) static switch_status_t remove_interface(char *the_interface) { int x = 10; + int fd; #ifdef WIN32 switch_size_t howmany = 8; #else @@ -390,6 +391,8 @@ static switch_status_t remove_interface(char *the_interface) goto end; } + LOKKA(tech_pvt->controldev_lock); + globals.GSMOPEN_INTERFACES[interface_id].running = 0; if (globals.GSMOPEN_INTERFACES[interface_id].gsmopen_signaling_thread) { @@ -441,6 +444,42 @@ static switch_status_t remove_interface(char *the_interface) switch_thread_join(&status, globals.GSMOPEN_INTERFACES[interface_id].gsmopen_api_thread); } + + + fd = tech_pvt->controldevfd; + //DEBUGA_GSMOPEN("SHUTDOWN tech_pvt->controldevfd=%d\n", GSMOPEN_P_LOG, tech_pvt->controldevfd); + if (fd) { + //close(fd); + tech_pvt->controldevfd = -1; + DEBUGA_GSMOPEN("SHUTDOWN tech_pvt->controldevfd=%d\n", GSMOPEN_P_LOG, tech_pvt->controldevfd); + } + + serial_audio_shutdown(tech_pvt); + + int res; + res = tech_pvt->serialPort_serial_control->Close(); + DEBUGA_GSMOPEN("serial_shutdown res=%d (controldevfd is %d)\n", GSMOPEN_P_LOG, res, tech_pvt->controldevfd); + +#ifndef WIN32 + shutdown(tech_pvt->audiogsmopenpipe[0], 2); + close(tech_pvt->audiogsmopenpipe[0]); + shutdown(tech_pvt->audiogsmopenpipe[1], 2); + close(tech_pvt->audiogsmopenpipe[1]); + shutdown(tech_pvt->audiopipe[0], 2); + close(tech_pvt->audiopipe[0]); + shutdown(tech_pvt->audiopipe[1], 2); + close(tech_pvt->audiopipe[1]); + shutdown(tech_pvt->GSMopenHandles.fdesc[0], 2); + close(tech_pvt->GSMopenHandles.fdesc[0]); + shutdown(tech_pvt->GSMopenHandles.fdesc[1], 2); + close(tech_pvt->GSMopenHandles.fdesc[1]); +#endif /* WIN32 */ + + + + + + UNLOCKA(tech_pvt->controldev_lock); switch_mutex_lock(globals.mutex); if (globals.gsm_console == &globals.GSMOPEN_INTERFACES[interface_id]) { DEBUGA_GSMOPEN("interface '%s' no more console\n", GSMOPEN_P_LOG, the_interface); @@ -454,6 +493,7 @@ static switch_status_t remove_interface(char *the_interface) DEBUGA_GSMOPEN("interface '%s' deleted successfully\n", GSMOPEN_P_LOG, the_interface); globals.GSMOPEN_INTERFACES[interface_id].running = 1; + end: //running = 1; return SWITCH_STATUS_SUCCESS; From 716f89f2d18ef7d85e0f1818bfa16ac1deca12e2 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 2 Aug 2012 18:47:18 +0200 Subject: [PATCH 0834/1057] gsmopen: indent --- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 52 ++++++++----------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 05221d1800..af266caf5b 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -444,41 +444,35 @@ static switch_status_t remove_interface(char *the_interface) switch_thread_join(&status, globals.GSMOPEN_INTERFACES[interface_id].gsmopen_api_thread); } + fd = tech_pvt->controldevfd; + //DEBUGA_GSMOPEN("SHUTDOWN tech_pvt->controldevfd=%d\n", GSMOPEN_P_LOG, tech_pvt->controldevfd); + if (fd) { + //close(fd); + tech_pvt->controldevfd = -1; + DEBUGA_GSMOPEN("SHUTDOWN tech_pvt->controldevfd=%d\n", GSMOPEN_P_LOG, tech_pvt->controldevfd); + } + serial_audio_shutdown(tech_pvt); - fd = tech_pvt->controldevfd; - //DEBUGA_GSMOPEN("SHUTDOWN tech_pvt->controldevfd=%d\n", GSMOPEN_P_LOG, tech_pvt->controldevfd); - if (fd) { - //close(fd); - tech_pvt->controldevfd = -1; - DEBUGA_GSMOPEN("SHUTDOWN tech_pvt->controldevfd=%d\n", GSMOPEN_P_LOG, tech_pvt->controldevfd); - } - - serial_audio_shutdown(tech_pvt); - - int res; - res = tech_pvt->serialPort_serial_control->Close(); - DEBUGA_GSMOPEN("serial_shutdown res=%d (controldevfd is %d)\n", GSMOPEN_P_LOG, res, tech_pvt->controldevfd); + int res; + res = tech_pvt->serialPort_serial_control->Close(); + DEBUGA_GSMOPEN("serial_shutdown res=%d (controldevfd is %d)\n", GSMOPEN_P_LOG, res, tech_pvt->controldevfd); #ifndef WIN32 - shutdown(tech_pvt->audiogsmopenpipe[0], 2); - close(tech_pvt->audiogsmopenpipe[0]); - shutdown(tech_pvt->audiogsmopenpipe[1], 2); - close(tech_pvt->audiogsmopenpipe[1]); - shutdown(tech_pvt->audiopipe[0], 2); - close(tech_pvt->audiopipe[0]); - shutdown(tech_pvt->audiopipe[1], 2); - close(tech_pvt->audiopipe[1]); - shutdown(tech_pvt->GSMopenHandles.fdesc[0], 2); - close(tech_pvt->GSMopenHandles.fdesc[0]); - shutdown(tech_pvt->GSMopenHandles.fdesc[1], 2); - close(tech_pvt->GSMopenHandles.fdesc[1]); + shutdown(tech_pvt->audiogsmopenpipe[0], 2); + close(tech_pvt->audiogsmopenpipe[0]); + shutdown(tech_pvt->audiogsmopenpipe[1], 2); + close(tech_pvt->audiogsmopenpipe[1]); + shutdown(tech_pvt->audiopipe[0], 2); + close(tech_pvt->audiopipe[0]); + shutdown(tech_pvt->audiopipe[1], 2); + close(tech_pvt->audiopipe[1]); + shutdown(tech_pvt->GSMopenHandles.fdesc[0], 2); + close(tech_pvt->GSMopenHandles.fdesc[0]); + shutdown(tech_pvt->GSMopenHandles.fdesc[1], 2); + close(tech_pvt->GSMopenHandles.fdesc[1]); #endif /* WIN32 */ - - - - UNLOCKA(tech_pvt->controldev_lock); switch_mutex_lock(globals.mutex); if (globals.gsm_console == &globals.GSMOPEN_INTERFACES[interface_id]) { From ccae5cd6b2ca1a49cbb0b1b2d37c9f5d60d6d1b0 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 2 Aug 2012 19:13:32 +0200 Subject: [PATCH 0835/1057] gsmopen and skypopen: better printout from function gsm (or sk) list --- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 38 +++++++++++++------ src/mod/endpoints/mod_skypopen/mod_skypopen.c | 2 +- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index af266caf5b..62f5cdd20f 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -2292,31 +2292,45 @@ SWITCH_STANDARD_API(gsm_function) if (!strcasecmp(argv[0], "list")) { int i; + unsigned int ib = 0; + unsigned int ib_failed = 0; + unsigned int ob = 0; + unsigned int ob_failed = 0; char next_flag_char = ' '; stream->write_function(stream, "F ID\t Name \tIB (F/T) OB (F/T)\tState\tCallFlw\t\tUUID\n"); stream->write_function(stream, "= ====\t ======== \t======= =======\t======\t============\t======\n"); for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) { - next_flag_char = i == globals.next_interface ? '*' : ' '; if (strlen(globals.GSMOPEN_INTERFACES[i].name)) { + next_flag_char = i == globals.next_interface ? '*' : ' '; + ib += globals.GSMOPEN_INTERFACES[i].ib_calls; + ib_failed += globals.GSMOPEN_INTERFACES[i].ib_failed_calls; + ob += globals.GSMOPEN_INTERFACES[i].ob_calls; + ob_failed += globals.GSMOPEN_INTERFACES[i].ob_failed_calls; + + stream->write_function(stream, - "%c %d\t[%s]\t%3ld/%ld\t%6ld/%ld\t%s\t%s\t%s\n", - next_flag_char, - i, globals.GSMOPEN_INTERFACES[i].name, - globals.GSMOPEN_INTERFACES[i].ib_failed_calls, - globals.GSMOPEN_INTERFACES[i].ib_calls, - globals.GSMOPEN_INTERFACES[i].ob_failed_calls, - globals.GSMOPEN_INTERFACES[i].ob_calls, - interface_status[globals.GSMOPEN_INTERFACES[i].interface_state], - phone_callflow[globals.GSMOPEN_INTERFACES[i].phone_callflow], globals.GSMOPEN_INTERFACES[i].session_uuid_str); + //"%c %d\t[%s]\t%3ld/%ld\t%6ld/%ld\t%s\t%s\t%s\n", + "%c %d\t[%6s]\t%3u/%u\t%6u/%u\t%s\t%s\t%s\n", + next_flag_char, + i, globals.GSMOPEN_INTERFACES[i].name, + globals.GSMOPEN_INTERFACES[i].ib_failed_calls, + globals.GSMOPEN_INTERFACES[i].ib_calls, + globals.GSMOPEN_INTERFACES[i].ob_failed_calls, + globals.GSMOPEN_INTERFACES[i].ob_calls, + interface_status[globals.GSMOPEN_INTERFACES[i].interface_state], + phone_callflow[globals.GSMOPEN_INTERFACES[i].phone_callflow], globals.GSMOPEN_INTERFACES[i].session_uuid_str); } else if (argc > 1 && !strcasecmp(argv[1], "full")) { - stream->write_function(stream, "%c\t%d\n", next_flag_char, i); + stream->write_function(stream, "%c %d\n", next_flag_char, i); + //stream->write_function(stream, "%c\t%d\n", next_flag_char, i); } } - stream->write_function(stream, "\nTotal: %d\n", globals.real_interfaces - 1); + //stream->write_function(stream, "\nTotal: %d\n", globals.real_interfaces - 1); + stream->write_function(stream, "\nTotal Interfaces: %d IB Calls(Failed/Total): %u/%u OB Calls(Failed/Total): %u/%u\n", + globals.real_interfaces > 0 ? globals.real_interfaces - 1 : 0, ib_failed, ib, ob_failed, ob); } else if (!strcasecmp(argv[0], "console")) { int i; diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index ce89211b83..21dea92d4f 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2551,7 +2551,7 @@ SWITCH_STANDARD_API(sk_function) ob_failed += globals.SKYPOPEN_INTERFACES[i].ob_failed_calls; stream->write_function(stream, - "%c %d\t[%s]\t%3u/%u\t%6u/%u\t%s\t%s\t%s\n", + "%c %d\t[%6s]\t%3u/%u\t%6u/%u\t%s\t%s\t%s\n", next_flag_char, i, globals.SKYPOPEN_INTERFACES[i].name, globals.SKYPOPEN_INTERFACES[i].ib_failed_calls, From ac0eec9de4be015836b66171ffe0b10f442ec2f6 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 3 Aug 2012 12:31:41 +0200 Subject: [PATCH 0836/1057] ftmod_isdn: Fix set-but-unused warning. Resolves OPENZAP-189 Fixes: src/ftmod/ftmod_isdn/ftmod_isdn.c: In function 'ftdm_isdn_931_34': src/ftmod/ftmod_isdn/ftmod_isdn.c:902:21: error: variable 'status' set but not used [-Werror=unused-but-set-variable] 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 de53002b79..750bc882c9 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -899,7 +899,6 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic */ Q931ie_Cause *cause = Q931GetIEPtr(gen->Cause, gen->buf); ftdm_sigmsg_t sig; - ftdm_status_t status; memset(&sig, 0, sizeof(sig)); sig.span_id = ftdm_channel_get_span_id(ftdmchan); @@ -908,7 +907,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic sig.channel->caller_data.hangup_cause = (cause) ? cause->Value : FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(span, &sig); + ftdm_span_send_signal(span, &sig); ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, ftdm_channel_get_state_str(ftdmchan), From e35221b981251fea8275355d3cacc6e60f5cc83e Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Fri, 3 Aug 2012 20:26:30 +0800 Subject: [PATCH 0837/1057] Fixed the way T.85/T.85-L0 selection is handled when decoding DCS messages --- libs/spandsp/src/t30.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index e25e77b41a..8a20c3996d 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -1344,14 +1344,12 @@ static int build_dcs(t30_state_t *s) set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; #endif - case T4_COMPRESSION_ITU_T85: - set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE); - clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); + case T4_COMPRESSION_ITU_T85_L0: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; - case T4_COMPRESSION_ITU_T85_L0: + case T4_COMPRESSION_ITU_T85: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE); - set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; case T4_COMPRESSION_ITU_T6: @@ -2360,12 +2358,13 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) s->image_width = widths[i][dcs_frame[5] & (DISBIT2 | DISBIT1)]; /* Check which compression we will use. */ - if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE)) + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE)) { - if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE)) - s->line_encoding = T4_COMPRESSION_ITU_T85_L0; - else - s->line_encoding = T4_COMPRESSION_ITU_T85; + s->line_encoding = T4_COMPRESSION_ITU_T85_L0; + } + else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T85; } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) { From e523076274847c1282b42150eee56d6ccf7fb2b9 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sat, 4 Aug 2012 03:45:09 +0800 Subject: [PATCH 0838/1057] FAX T.6 decompression fixed for images with black in the last pixel of lines. Colour and grey images can down be dithered down to bi-level images for transmission as faxes. More movement towards T.42 support --- libs/spandsp/src/Makefile.am | 13 + libs/spandsp/src/cielab_luts.h | 39 +- libs/spandsp/src/fax.c | 2 + libs/spandsp/src/image_translate.c | 39 +- libs/spandsp/src/make_cielab_luts.c | 92 ++++ libs/spandsp/src/spandsp/image_translate.h | 9 +- libs/spandsp/src/spandsp/private/t42.h | 11 + libs/spandsp/src/spandsp/private/t4_tx.h | 8 + libs/spandsp/src/spandsp/private/t85.h | 4 +- libs/spandsp/src/spandsp/t42.h | 14 +- libs/spandsp/src/spandsp/t4_rx.h | 17 + libs/spandsp/src/spandsp/t85.h | 18 - libs/spandsp/src/t30.c | 98 ++-- libs/spandsp/src/t30_api.c | 4 +- libs/spandsp/src/t30_logging.c | 2 + libs/spandsp/src/t38_gateway.c | 2 + libs/spandsp/src/t38_terminal.c | 2 + libs/spandsp/src/t42.c | 532 +++++++++++++++------ libs/spandsp/src/t42_t43_local.h | 44 ++ libs/spandsp/src/t4_rx.c | 6 +- libs/spandsp/src/t4_t6_decode.c | 11 +- libs/spandsp/src/t4_t6_encode.c | 18 + libs/spandsp/src/t4_tx.c | 139 ++++-- libs/spandsp/src/t85_decode.c | 60 +-- libs/spandsp/tests/image_translate_tests.c | 42 +- libs/spandsp/tests/t42_tests.c | 85 +--- libs/spandsp/tests/t4_t6_tests.c | 31 +- libs/spandsp/tests/t4_tests.c | 8 +- libs/spandsp/tests/t85_tests.c | 12 +- 29 files changed, 916 insertions(+), 446 deletions(-) create mode 100644 libs/spandsp/src/make_cielab_luts.c create mode 100644 libs/spandsp/src/t42_t43_local.h diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index 685e3d9328..95e9932c3c 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -20,6 +20,7 @@ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \ + $(srcdir)/cielab_luts.h \ $(srcdir)/math_fixed_tables.h \ $(srcdir)/v17_v32bis_rx_fixed_rrc.h \ $(srcdir)/v17_v32bis_rx_floating_rrc.h \ @@ -58,6 +59,7 @@ EXTRA_DIST = floating_fudge.h \ libtiff.2008.vcproj \ filter_tools.c \ make_at_dictionary.c \ + make_cielab_luts.c \ make_math_fixed_tables.c \ make_modem_filter.c \ msvc/config.h \ @@ -344,6 +346,7 @@ noinst_HEADERS = cielab_luts.h \ mmx_sse_decs.h \ t30_local.h \ t4_t6_decode_states.h \ + t42_t43_local.h \ v17_v32bis_rx_constellation_maps.h \ v17_v32bis_tx_constellation_maps.h \ v29tx_constellation_maps.h @@ -351,6 +354,9 @@ noinst_HEADERS = cielab_luts.h \ make_at_dictionary$(EXEEXT): $(top_srcdir)/src/make_at_dictionary.c $(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c -DHAVE_CONFIG_H -I$(top_builddir)/src +make_cielab_luts$(EXEEXT): $(top_srcdir)/src/make_cielab_luts.c + $(CC_FOR_BUILD) -o make_cielab_luts$(EXEEXT) $(top_srcdir)/src/make_cielab_luts.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + make_math_fixed_tables$(EXEEXT): $(top_srcdir)/src/make_math_fixed_tables.c $(CC_FOR_BUILD) -o make_math_fixed_tables$(EXEEXT) $(top_srcdir)/src/make_math_fixed_tables.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm @@ -378,6 +384,13 @@ t4_rx.$(OBJEXT): spandsp/version.h t4_rx.lo: spandsp/version.h +t42.$(OBJEXT): cielab_luts.h + +t42.lo: cielab_luts.h + +cielab_luts.h: make_cielab_luts$(EXEEXT) + ./make_cielab_luts$(EXEEXT) >cielab_luts.h + V17_V32BIS_RX_INCL = v17_v32bis_rx_fixed_rrc.h \ v17_v32bis_rx_floating_rrc.h diff --git a/libs/spandsp/src/cielab_luts.h b/libs/spandsp/src/cielab_luts.h index 73e72ac824..0a3c697915 100644 --- a/libs/spandsp/src/cielab_luts.h +++ b/libs/spandsp/src/cielab_luts.h @@ -1,32 +1,4 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * cielab_luts.h - * - * Written by Steve Underwood - * - * Copyright (C) 2011 Steve Underwood - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1, - * as published by the Free Software Foundation. - * - * 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/*! \file */ - -#if defined(T42_USE_LUTS) -static const float sRGB_to_linear[256] = +static const float srgb_to_linear[256] = { 0.000000, 0.000302, @@ -168,7 +140,7 @@ static const float sRGB_to_linear[256] = 0.248036, 0.251995, 0.255990, - 0.260021, + 0.260022, 0.264090, 0.268196, 0.272338, @@ -267,7 +239,7 @@ static const float sRGB_to_linear[256] = 0.831396, 0.839397, 0.847443, - 0.855533, + 0.855534, 0.863669, 0.871850, 0.880075, @@ -285,8 +257,7 @@ static const float sRGB_to_linear[256] = 0.982319, 0.991137 }; - -static const uint8_t linear_to_sRGB[4096] = +static const uint8_t linear_to_srgb[4096] = { 0, 0, @@ -4385,5 +4356,3 @@ static const uint8_t linear_to_sRGB[4096] = 255, 255 }; -#endif -/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c index abe25675ce..19bf4cf5e6 100644 --- a/libs/spandsp/src/fax.c +++ b/libs/spandsp/src/fax.c @@ -74,6 +74,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -118,6 +119,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c index d21b5b9d81..db6a7adc0e 100644 --- a/libs/spandsp/src/image_translate.c +++ b/libs/spandsp/src/image_translate.c @@ -80,9 +80,9 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" -#include "spandsp/private/image_translate.h" static int image_colour16_to_gray8_row(uint8_t mono[], uint16_t colour[], int pixels) { @@ -154,12 +154,14 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[], size_t le int input_width; int input_length; int x; - double c1; - double c2; #if defined(SPANDSP_USE_FIXED_POINT) + int c1; + int c2; int frac_row; int frac_col; #else + double c1; + double c2; double int_part; double frac_row; double frac_col; @@ -200,15 +202,15 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[], size_t le } #if defined(SPANDSP_USE_FIXED_POINT) - frac_row = s->raw_output_row*input_length/output_length; - frac_row = s->raw_output_row*input_length - frac_row*output_length; + frac_row = ((s->raw_output_row*256*input_length)/output_length) & 0xFF; for (i = 0; i < output_width; i++) { - x = i*input_width/output_width; - frac_col = x - x*output_width; - c1 = s->raw_pixel_row[0][x] + (s->raw_pixel_row[0][x + 1] - s->raw_pixel_row[0][x])*frac_col; - c2 = s->raw_pixel_row[1][x] + (s->raw_pixel_row[1][x + 1] - s->raw_pixel_row[1][x])*frac_col; - buf[i] = saturateu8(c1 + (c2 - c1)*frac_row); + x = i*256*input_width/output_width; + frac_col = x & 0xFF; + x >>= 8; + c1 = s->raw_pixel_row[0][x] + (((s->raw_pixel_row[0][x + 1] - s->raw_pixel_row[0][x])*frac_col) >> 8); + c2 = s->raw_pixel_row[1][x] + (((s->raw_pixel_row[1][x + 1] - s->raw_pixel_row[1][x])*frac_col) >> 8); + buf[i] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8)); } #else frac_row = modf((double) s->raw_output_row*input_length/output_length, &int_part); @@ -368,6 +370,7 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta int input_width, int input_length, int output_width, + int output_length, t4_row_read_handler_t row_read_handler, void *row_read_user_data) { @@ -385,9 +388,19 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta s->input_width = input_width; s->input_length = input_length; - s->resize = (output_width > 0); - s->output_width = (s->resize) ? output_width : s->input_width; - s->output_length = (s->resize) ? s->input_length*s->output_width/s->input_width : s->input_length; + if ((s->resize = (output_width > 0))) + { + s->output_width = output_width; + if (output_length > 0) + s->output_length = output_length; + else + s->output_length = (s->input_length*s->output_width)/s->input_width; + } + else + { + s->output_width = s->input_width; + s->output_length = s->input_length; + } switch (s->input_format) { diff --git a/libs/spandsp/src/make_cielab_luts.c b/libs/spandsp/src/make_cielab_luts.c new file mode 100644 index 0000000000..905005674f --- /dev/null +++ b/libs/spandsp/src/make_cielab_luts.c @@ -0,0 +1,92 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * make_cielab_luts.c - Create the look up tables for CIELab colour management + * + * Written by Steve Underwood + * + * Copyright (C) 2011 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(HAVE_TGMATH_H) +#include +#endif +#if defined(HAVE_MATH_H) +#include +#endif + +typedef struct +{ + float L; + float a; + float b; +} cielab_t; + +int main(int argc, char *argv[]) +{ + float r; + uint8_t srgb; + int i; + + printf("static const float srgb_to_linear[256] =\n"); + printf("{\n"); + for (i = 0; i < 256; i++) + { + /* Start with "i" as the sRGB value */ + r = i/256.0f; + + /* sRGB to Linear RGB */ + r = (r > 0.04045f) ? powf((r + 0.055f)/1.055f, 2.4f) : r/12.92f; + + printf((i < 255) ? " %f,\n" : " %f\n", r); + } + printf("};\n"); + + printf("static const uint8_t linear_to_srgb[4096] =\n"); + printf("{\n"); + for (i = 0; i < 4096; i++) + { + /* Start with "i" as the linear RGB value */ + /* Linear RGB to sRGB */ + r = i/4096.0f; + + r = (r > 0.0031308f) ? (1.055f*powf(r, 1.0f/2.4f) - 0.055f) : r*12.92f; + + r = floorf(r*256.0f); + + srgb = (r < 0) ? 0 : (r <= 255) ? r : 255; + + printf((i < 4095) ? " %d,\n" : " %d\n", srgb); + } + printf("};\n"); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/image_translate.h b/libs/spandsp/src/spandsp/image_translate.h index b795c705af..80f29f0471 100644 --- a/libs/spandsp/src/spandsp/image_translate.h +++ b/libs/spandsp/src/spandsp/image_translate.h @@ -75,9 +75,11 @@ SPAN_DECLARE(int) image_translate_get_output_length(image_translate_state_t *s); \param input_format x \param input_width The width of the source image, in pixels. \param input_length The length of the source image, in pixels. - \param output_width The width of the output image, in pixels. The length of the output image - will be derived automatically from this and the source image dimension, to main the - geometry of the original image. + \param output_width The width of the output image, in pixels. If this is set <= 0 the image + will not be resized. + \param output_length The length of the output image, in pixels. If this is set to <= 0 the + output length will be derived automatically from the width, to maintain the geometry + of the original image. \param row_read_handler A callback routine used to pull rows of pixels from the source image into the translation process. \param row_read_user_data An opaque point passed to read_row_handler @@ -87,6 +89,7 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta int input_width, int input_length, int output_width, + int output_length, t4_row_read_handler_t row_read_handler, void *row_read_user_data); diff --git a/libs/spandsp/src/spandsp/private/t42.h b/libs/spandsp/src/spandsp/private/t42.h index 7dedfa7ee1..bfdae884eb 100644 --- a/libs/spandsp/src/spandsp/private/t42.h +++ b/libs/spandsp/src/spandsp/private/t42.h @@ -53,6 +53,9 @@ struct t42_encode_state_s lab_params_t lab_params; + /*! \brief The size of the compressed image, in bytes. */ + int compressed_image_size; + /*! \brief Error and flow logging control */ logging_state_t logging; }; @@ -68,6 +71,8 @@ struct t42_decode_state_s t4_row_write_handler_t comment_handler; /*! An opaque pointer passed to comment_handler() */ void *comment_user_data; + /*! The maximum length of comment to be passed to the comment handler */ + uint32_t max_comment_len; lab_params_t lab_params; @@ -78,6 +83,12 @@ struct t42_decode_state_s /*! Length of data pointed to by comment */ size_t comment_len; + /*! \brief The size of the compressed image, in bytes. */ + int compressed_image_size; + + int buf_size; + uint8_t *compressed_buf; + /*! \brief Error and flow logging control */ logging_state_t logging; }; diff --git a/libs/spandsp/src/spandsp/private/t4_tx.h b/libs/spandsp/src/spandsp/private/t4_tx.h index ffa3c342d8..b7b5d11eff 100644 --- a/libs/spandsp/src/spandsp/private/t4_tx.h +++ b/libs/spandsp/src/spandsp/private/t4_tx.h @@ -54,6 +54,12 @@ typedef struct int image_buffer_size; /*! \brief Row counter for playing out the rows of the image. */ int row; + + /*! \brief Image length of the image in the file. This is used when the + image is resized or dithered flat. */ + int image_length; + /*! \brief Row counter used when the image is resized or dithered flat. */ + int raw_row; } t4_tx_tiff_state_t; /*! @@ -132,6 +138,8 @@ struct t4_tx_state_s t85_encode_state_t t85; } encoder; + image_translate_state_t translator; + /* Supporting information, like resolutions, which the backend may want. */ t4_tx_metadata_t metadata; diff --git a/libs/spandsp/src/spandsp/private/t85.h b/libs/spandsp/src/spandsp/private/t85.h index dac7a3340a..2d180c9baf 100644 --- a/libs/spandsp/src/spandsp/private/t85.h +++ b/libs/spandsp/src/spandsp/private/t85.h @@ -123,11 +123,11 @@ struct t85_decode_state_s t4_row_write_handler_t comment_handler; /*! An opaque pointer passed to comment_handler() */ void *comment_user_data; + /*! The maximum length of comment to be passed to the comment handler */ + uint32_t max_comment_len; uint8_t min_bit_planes; uint8_t max_bit_planes; - /*! The maximum length of comment to be passed to the comment handler */ - uint32_t max_comment_len; /*! The maximum permitted width of the full image, in pixels */ uint32_t max_xd; /*! The maximum permitted height of the full image, in pixels */ diff --git a/libs/spandsp/src/spandsp/t42.h b/libs/spandsp/src/spandsp/t42.h index d6785cba23..e072b07442 100644 --- a/libs/spandsp/src/spandsp/t42.h +++ b/libs/spandsp/src/spandsp/t42.h @@ -58,19 +58,15 @@ SPAN_DECLARE(void) set_lab_gamut(lab_params_t *s, int L_min, int L_max, int a_mi SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, int a_Q, int b_P, int b_Q); -SPAN_DECLARE(void) set_illuminant_from_code(lab_params_t *s, const uint8_t code[4]); +SPAN_DECLARE(int) t42_itulab_to_itulab(logging_state_t *logging, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height); -SPAN_DECLARE(void) set_gamut_from_code(lab_params_t *s, const uint8_t code[12]); +SPAN_DECLARE(int) t42_itulab_to_jpeg(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen); -SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes); +SPAN_DECLARE(int) t42_jpeg_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen); -SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes); +SPAN_DECLARE(int) t42_srgb_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height); -SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes); - -SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes); - -SPAN_DECLARE(int) t42_itulab_to_srgb(lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height, char *emsg, size_t max_emsg_bytes); +SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height); SPAN_DECLARE(void) t42_encode_set_options(t42_encode_state_t *s, uint32_t l0, diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index 8ff1e286e0..0d37248593 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -199,6 +199,23 @@ typedef enum T4_LENGTH_1200_US_LEGAL = 0 } t4_image_length_t; +/*! Return values from the T.85 decoder */ +typedef enum +{ + /*! More image data is needed */ + T4_DECODE_MORE_DATA = 0, + /*! Image completed successfully */ + T4_DECODE_OK = -1, + /*! The decoder has interrupted */ + T4_DECODE_INTERRUPT = -2, + /*! An abort was found in the image data */ + T4_DECODE_ABORTED = -3, + /*! A memory allocation error occurred */ + T4_DECODE_NOMEM = -4, + /*! The image data is invalid. */ + T4_DECODE_INVALID_DATA = -5 +} t4_decoder_status_t; + /*! T.4 FAX compression/decompression descriptor. This defines the working state for a single instance of a T.4 FAX compression or decompression channel. diff --git a/libs/spandsp/src/spandsp/t85.h b/libs/spandsp/src/spandsp/t85.h index 516f6ee0e7..3ad36cdfdd 100644 --- a/libs/spandsp/src/spandsp/t85.h +++ b/libs/spandsp/src/spandsp/t85.h @@ -53,24 +53,6 @@ enum T85_LRLTWO = 0x40 }; -/*! Return values from the T.85 decoder */ -enum -{ - /*! More image data is needed */ - T85_MORE_DATA = 0, - /*! Image completed successfully */ - T85_OK = -1, - /*! The decoder has interrupted */ - T85_INTERRUPT = -2, - /*! An abort was found in the image data */ - T85_ABORTED = -3, - /*! A memory allocation error occurred */ - T85_NOMEM = -4, - /*! The image data is invalid. This includes finding values - in the BIH which lie outside the T.85 domain */ - T85_INVALID_DATA = -5 -}; - /*! State of a working instance of the T.85 encoder */ typedef struct t85_encode_state_s t85_encode_state_t; diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 8a20c3996d..ec2852ef42 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -61,6 +61,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -89,6 +90,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" @@ -1179,9 +1181,11 @@ int t30_build_dis_or_dtc(t30_state_t *s) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); if ((s->supported_compressions & T30_SUPPORT_T85_COMPRESSION)) { - set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE); + /* Bit 79 set with bit 78 clear is invalid, so only check for L0 + support here. */ if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE); } //if ((s->supported_compressions & T30_SUPPORT_T89_COMPRESSION)) // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T89_CAPABLE); @@ -1970,8 +1974,6 @@ static int start_sending_document(t30_state_t *s) if (s->use_own_tz) t4_tx_set_header_tz(&s->t4.tx, &s->tz); - s->x_resolution = t4_tx_get_x_resolution(&s->t4.tx); - s->y_resolution = t4_tx_get_y_resolution(&s->t4.tx); /* The minimum scan time to be used can't be evaluated until we know the Y resolution, and must be evaluated before the minimum scan row bits can be evaluated. */ if ((min_row_bits = set_min_scan_time_code(s)) < 0) @@ -1984,6 +1986,8 @@ static int start_sending_document(t30_state_t *s) if (tx_start_page(s)) return -1; + s->x_resolution = t4_tx_get_x_resolution(&s->t4.tx); + s->y_resolution = t4_tx_get_y_resolution(&s->t4.tx); s->image_width = t4_tx_get_image_width(&s->t4.tx); if (s->error_correcting_mode) { @@ -2069,41 +2073,61 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) /* 256 octets per ECM frame */ s->octets_per_ecm_frame = 256; /* Select the compression to use. */ - if (s->error_correcting_mode - && - (s->supported_compressions & T30_SUPPORT_T85_COMPRESSION) - && - test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) + if (!s->error_correcting_mode) { - if (s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION + /* Without error correction our choices are very limited */ + if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) && - test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE)) + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + } + else + { + s->line_encoding = T4_COMPRESSION_ITU_T4_1D; + } + } + else + { +#if defined(SPANDSP_SUPPORT_T42x) || defined(SPANDSP_SUPPORT_T43) + /* With error correction colour may be possible/required */ + if (0) { s->line_encoding = T4_COMPRESSION_ITU_T85_L0; } else +#endif { - s->line_encoding = T4_COMPRESSION_ITU_T85; + if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION) + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T85_L0; + } + else if ((s->supported_compressions & T30_SUPPORT_T85_COMPRESSION) + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T85; + } + else if ((s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T6; + } + else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + } + else + { + s->line_encoding = T4_COMPRESSION_ITU_T4_1D; + } } } - else if (s->error_correcting_mode - && - (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) - && - test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) - { - s->line_encoding = T4_COMPRESSION_ITU_T6; - } - else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) - && - test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) - { - s->line_encoding = T4_COMPRESSION_ITU_T4_2D; - } - else - { - s->line_encoding = T4_COMPRESSION_ITU_T4_1D; - } span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %s (%d)\n", t4_encoding_to_str(s->line_encoding), s->line_encoding); switch (s->far_dis_dtc_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3)) { @@ -2357,7 +2381,21 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) s->image_width = widths[i][dcs_frame[5] & (DISBIT2 | DISBIT1)]; - /* Check which compression we will use. */ + /* Check which compression the far end has decided to use. */ +#if defined(SPANDSP_SUPPORT_T42x) + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T42; + } + else +#endif +#if defined(SPANDSP_SUPPORT_T43) + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T43_MODE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T43; + } + else +#endif if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE)) { s->line_encoding = T4_COMPRESSION_ITU_T85_L0; diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index 9da3e25bcc..ad7cb0e71c 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -61,6 +61,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -89,6 +90,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" @@ -700,7 +702,7 @@ SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_c | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION #if defined(SPANDSP_SUPPORT_T42) - | T30_SUPPORT_T42_COMPRESSION + //| T30_SUPPORT_T42_COMPRESSION #endif #if defined(SPANDSP_SUPPORT_T43) | T30_SUPPORT_T43_COMPRESSION diff --git a/libs/spandsp/src/t30_logging.c b/libs/spandsp/src/t30_logging.c index 9c53b01037..9328c9b8f3 100644 --- a/libs/spandsp/src/t30_logging.c +++ b/libs/spandsp/src/t30_logging.c @@ -61,6 +61,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -88,6 +89,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 205bc1b5bb..e3c99a634a 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -74,6 +74,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -116,6 +117,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index 675c895a2f..d16e3cd569 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -64,6 +64,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -94,6 +95,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" diff --git a/libs/spandsp/src/t42.c b/libs/spandsp/src/t42.c index 608341fd4c..f7f7e1e062 100644 --- a/libs/spandsp/src/t42.c +++ b/libs/spandsp/src/t42.c @@ -61,7 +61,10 @@ #define T42_USE_LUTS +#include "t42_t43_local.h" +#if defined(T42_USE_LUTS) #include "cielab_luts.h" +#endif typedef struct { @@ -197,7 +200,7 @@ SPAN_DECLARE(void) set_lab_gamut2(lab_params_t *s, int L_P, int L_Q, int a_P, in } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) set_illuminant_from_code(lab_params_t *s, const uint8_t code[4]) +void set_illuminant_from_code(logging_state_t *logging, lab_params_t *s, const uint8_t code[4]) { int i; int colour_temp; @@ -205,42 +208,44 @@ SPAN_DECLARE(void) set_illuminant_from_code(lab_params_t *s, const uint8_t code[ if (code[0] == 'C' && code[1] == 'T') { colour_temp = pack_16(&code[2]); - printf("Illuminant colour temp %dK\n", colour_temp); + span_log(logging, SPAN_LOG_FLOW, "Illuminant colour temp %dK\n", colour_temp); return; } for (i = 0; illuminants[i].name[0]; i++) { if (memcmp(code, illuminants[i].tag, 4) == 0) { - printf("Illuminant %s\n", illuminants[i].name); + span_log(logging, SPAN_LOG_FLOW, "Illuminant %s\n", illuminants[i].name); set_lab_illuminant(s, illuminants[i].xn, illuminants[i].yn, illuminants[i].zn); break; } } if (illuminants[i].name[0] == '\0') - printf("Unrecognised illuminant 0x%x 0x%x 0x%x 0x%x\n", code[0], code[1], code[2], code[3]); + span_log(logging, SPAN_LOG_FLOW, "Unrecognised illuminant 0x%x 0x%x 0x%x 0x%x\n", code[0], code[1], code[2], code[3]); } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) set_gamut_from_code(lab_params_t *s, const uint8_t code[12]) +void set_gamut_from_code(logging_state_t *logging, lab_params_t *s, const uint8_t code[12]) { int i; int val[6]; for (i = 0; i < 6; i++) val[i] = pack_16(&code[2*i]); - printf("Gamut L=[%d,%d], a*=[%d,%d], b*=[%d,%d]\n", - val[0], - val[1], - val[2], - val[3], - val[4], - val[5]); + span_log(logging, + SPAN_LOG_FLOW, + "Gamut L=[%d,%d], a*=[%d,%d], b*=[%d,%d]\n", + val[0], + val[1], + val[2], + val[3], + val[4], + val[5]); set_lab_gamut2(s, val[0], val[1], val[2], val[3], val[4], val[5]); } /*- End of function --------------------------------------------------------*/ -static int isITUfax(lab_params_t *s, jpeg_saved_marker_ptr ptr) +static int is_itu_fax(logging_state_t *logging, lab_params_t *s, jpeg_saved_marker_ptr ptr) { const uint8_t *data; int ok; @@ -252,6 +257,11 @@ static int isITUfax(lab_params_t *s, jpeg_saved_marker_ptr ptr) { if (ptr->marker == (JPEG_APP0 + 1) && ptr->data_length >= 6) { + /* Markers are: + JPEG_RST0 + JPEG_EOI + JPEG_APP0 + JPEG_COM */ data = (const uint8_t *) ptr->data; if (strncmp((const char *) data, "G3FAX", 5) == 0) { @@ -260,29 +270,57 @@ static int isITUfax(lab_params_t *s, jpeg_saved_marker_ptr ptr) case 0: for (i = 0; i < 2; i++) val[i] = pack_16(&data[6 + 2*i]); - printf("Version %d, resolution %d dpi\n", val[0], val[1]); + span_log(logging, SPAN_LOG_FLOW, "Version %d, resolution %d dpi\n", val[0], val[1]); ok = TRUE; break; case 1: - printf("Set gamut\n"); - set_gamut_from_code(s, &data[6]); - ok = TRUE; + span_log(logging, SPAN_LOG_FLOW, "Set gamut\n"); + if (ptr->data_length >= 6 + 12) + { + set_gamut_from_code(logging, s, &data[6]); + ok = TRUE; + } + else + { + span_log(logging, SPAN_LOG_FLOW, "Got bad G3FAX1 length - %d\n", ptr->data_length); + } break; case 2: - printf("Set illuminant\n"); - set_illuminant_from_code(s, &data[6]); - ok = TRUE; + span_log(logging, SPAN_LOG_FLOW, "Set illuminant\n"); + if (ptr->data_length >= 6 + 4) + { + set_illuminant_from_code(logging, s, &data[6]); + ok = TRUE; + } + else + { + span_log(logging, SPAN_LOG_FLOW, "Got bad G3FAX2 length - %d\n", ptr->data_length); + } break; case 3: /* Colour palette table */ - printf("Set colour palette\n"); - val[0] = pack_16(&data[6]); - printf("Colour palette %d\n", val[0]); + span_log(logging, SPAN_LOG_FLOW, "Set colour palette\n"); + if (ptr->data_length >= 6 + 2) + { + val[0] = pack_16(&data[6]); + span_log(logging, SPAN_LOG_FLOW, "Colour palette %d\n", val[0]); + } + else + { + span_log(logging, SPAN_LOG_FLOW, "Got bad G3FAX3 length - %d\n", ptr->data_length); + } + break; + default: + span_log(logging, SPAN_LOG_FLOW, "Got unexpected G3FAX%d length - %d\n", data[5], ptr->data_length); break; } } } - + else + { + span_log(logging, SPAN_LOG_FLOW, "Got marker 0x%x, length %d\n", ptr->marker, ptr->data_length); + span_log_buf(logging, SPAN_LOG_FLOW, "Got marker", (const uint8_t *) ptr->data, ptr->data_length); + } ptr = ptr->next; } @@ -290,7 +328,7 @@ static int isITUfax(lab_params_t *s, jpeg_saved_marker_ptr ptr) } /*- End of function --------------------------------------------------------*/ -static void SetITUFax(j_compress_ptr cinfo) +static void set_itu_fax(j_compress_ptr cinfo) { uint8_t marker[10] = { @@ -358,9 +396,9 @@ SPAN_DECLARE(void) srgb_to_lab(lab_params_t *s, uint8_t lab[], const uint8_t srg for (i = 0; i < pixels; i++) { #if defined(T42_USE_LUTS) - r = sRGB_to_linear[srgb[0]]; - g = sRGB_to_linear[srgb[1]]; - b = sRGB_to_linear[srgb[2]]; + r = srgb_to_linear[srgb[0]]; + g = srgb_to_linear[srgb[1]]; + b = srgb_to_linear[srgb[2]]; #else r = srgb[0]/256.0f; g = srgb[1]/256.0f; @@ -436,11 +474,11 @@ SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t la #if defined(T42_USE_LUTS) val = r*4096.0f; - srgb[0] = linear_to_sRGB[(val < 0) ? 0 : (val < 4095) ? val : 4095]; + srgb[0] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095]; val = g*4096.0f; - srgb[1] = linear_to_sRGB[(val < 0) ? 0 : (val < 4095) ? val : 4095]; + srgb[1] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095]; val = b*4096.0f; - srgb[2] = linear_to_sRGB[(val < 0) ? 0 : (val < 4095) ? val : 4095]; + srgb[2] = linear_to_srgb[(val < 0) ? 0 : (val < 4095) ? val : 4095]; #else /* Linear RGB to sRGB */ r = (r > 0.0031308f) ? (1.055f*powf(r, 1.0f/2.4f) - 0.055f) : r*12.92f; @@ -461,54 +499,77 @@ SPAN_DECLARE(void) lab_to_srgb(lab_params_t *s, uint8_t srgb[], const uint8_t la } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes) +SPAN_DECLARE(int) t42_itulab_to_jpeg(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen) { struct jpeg_decompress_struct decompressor; struct jpeg_compress_struct compressor; - char *outptr; - size_t outsize; FILE *in; FILE *out; int m; JSAMPROW scan_line_in; JSAMPROW scan_line_out; escape_route_t escape; +#if defined(HAVE_OPEN_MEMSTREAM) + char *outptr; + size_t outsize; +#endif escape.error_message[0] = '\0'; - emsg[0] = '\0'; #if defined(HAVE_OPEN_MEMSTREAM) - in = fmemopen(src, srclen, "r"); -#else - in = tmpfile(); - fwrite(src, 1, srclen, in); - rewind(in); -#endif - if (in == NULL) + if ((in = fmemopen(src, srclen, "r")) == NULL) { - if (emsg[0] == '\0') - strcpy(emsg, "Failed to fmemopen()."); + span_log(logging, SPAN_LOG_FLOW, "Failed to fmemopen().\n"); return FALSE; } - -#if defined(HAVE_OPEN_MEMSTREAM) - out = open_memstream(&outptr, &outsize); -#else - out = tmpfile(); -#endif - if (out == NULL) + outsize = 0; + if ((out = open_memstream(&outptr, &outsize)) == NULL) { - if (emsg[0] == '\0') - strcpy(emsg, "Failed to open_memstream()."); + span_log(logging, SPAN_LOG_FLOW, "Failed to open_memstream().\n"); + fclose(in); return FALSE; } + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(in); + fclose(out); + return FALSE; + } +#else + if ((in = tmpfile()) == NULL) + { + span_log(logging, SPAN_LOG_FLOW, "Failed to tmpfile().\n"); + return FALSE; + } + if (fwrite(src, 1, srclen, in) != srclen) + { + fclose(in); + return FALSE; + } + if (fseek(in, 0, SEEK_SET) != 0) + { + fclose(in); + return FALSE; + } + if ((out = tmpfile()) == NULL) + { + span_log(logging, SPAN_LOG_FLOW, "Failed to tmpfile().\n"); + fclose(in); + return FALSE; + } +#endif + scan_line_out = NULL; if (setjmp(escape.escape)) { - strncpy(emsg, escape.error_message, max_emsg_bytes - 1); - emsg[max_emsg_bytes - 1] = '\0'; - if (emsg[0] == '\0') - strcpy(emsg, "Unspecified libjpeg error."); + if (escape.error_message[0]) + span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message); + else + span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n"); + if (scan_line_out) + free(scan_line_out); + fclose(in); + fclose(out); return FALSE; } @@ -532,14 +593,13 @@ SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dst /* Take the header */ jpeg_read_header(&decompressor, TRUE); - /* Now we can force the input colorspace. For ITULab, we will use YCbCr as a "don't touch" marker */ + /* Now we can force the input colour space. For ITULab, we use YCbCr as a "don't touch" marker */ decompressor.out_color_space = JCS_YCbCr; /* Sanity check and parameter check */ - if (!isITUfax(s, decompressor.marker_list)) + if (!is_itu_fax(logging, s, decompressor.marker_list)) { - if (emsg[0] == '\0') - strcpy(emsg, "Is not ITUFAX."); + span_log(logging, SPAN_LOG_FLOW, "Is not an ITU FAX.\n"); return FALSE; } @@ -552,12 +612,13 @@ SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dst jpeg_create_compress(&compressor); jpeg_stdio_dest(&compressor, out); - /* Force the destination color space */ + /* Force the destination colour space */ compressor.in_color_space = JCS_RGB; compressor.input_components = 3; jpeg_set_defaults(&compressor); - //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + /* Limit to baseline-JPEG values */ + //jpeg_set_quality(&compressor, quality, TRUE); /* Copy size, resolution, etc */ jpeg_copy_critical_parameters(&decompressor, &compressor); @@ -592,64 +653,106 @@ SPAN_DECLARE(int) t42_itulab_to_jpeg(lab_params_t *s, tdata_t *dst, tsize_t *dst jpeg_destroy_decompress(&decompressor); jpeg_destroy_compress(&compressor); fclose(in); - fclose(out); +#if defined(HAVE_OPEN_MEMSTREAM) + fclose(out); *dst = outptr; *dstlen = outsize; +#else + *dstlen = ftell(out); + *dst = malloc(*dstlen); + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(out); + return FALSE; + } + if (fread(*dst, 1, *dstlen, out) != *dstlen) + { + free(*dst); + fclose(out); + return FALSE; + } + fclose(out); +#endif return TRUE; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, char *emsg, size_t max_emsg_bytes) +SPAN_DECLARE(int) t42_jpeg_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen) { struct jpeg_decompress_struct decompressor; struct jpeg_compress_struct compressor; - char *outptr; - size_t outsize; FILE *in; FILE *out; int m; JSAMPROW scan_line_in; JSAMPROW scan_line_out; escape_route_t escape; +#if defined(HAVE_OPEN_MEMSTREAM) + char *outptr; + size_t outsize; +#endif escape.error_message[0] = '\0'; - emsg[0] = '\0'; #if defined(HAVE_OPEN_MEMSTREAM) - in = fmemopen(src, srclen, "r"); -#else - in = tmpfile(); - fwrite(src, 1, srclen, in); - rewind(in); -#endif - if (in == NULL) + if ((in = fmemopen(src, srclen, "r")) == NULL) { - if (emsg[0] == '\0') - strcpy(emsg, "Failed to fmemopen()."); + span_log(logging, SPAN_LOG_FLOW, "Failed to fmemopen().\n"); return FALSE; } - -#if defined(HAVE_OPEN_MEMSTREAM) - out = open_memstream(&outptr, &outsize); -#else - out = tmpfile(); -#endif - if (out == NULL) + outsize = 0; + if ((out = open_memstream(&outptr, &outsize)) == NULL) { - if (emsg[0] == '\0') - strcpy(emsg, "Failed to open_memstream()."); + span_log(logging, SPAN_LOG_FLOW, "Failed to open_memstream().\n"); + fclose(in); return FALSE; } + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(in); + fclose(out); + return FALSE; + } +#else + if ((in = tmpfile()) == NULL) + { + span_log(logging, SPAN_LOG_FLOW, "Failed to tmpfile().\n"); + return FALSE; + } + if (fwrite(src, 1, srclen, in) != srclen) + { + fclose(in); + return FALSE; + } + if (fseek(in, 0, SEEK_SET) != 0) + { + fclose(in); + return FALSE; + } + if ((out = tmpfile()) == NULL) + { + span_log(logging, SPAN_LOG_FLOW, "Failed to tmpfile().\n"); + fclose(in); + return FALSE; + } +#endif + scan_line_out = NULL; if (setjmp(escape.escape)) { - strncpy(emsg, escape.error_message, max_emsg_bytes - 1); - emsg[max_emsg_bytes - 1] = '\0'; + if (escape.error_message[0]) + span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message); + else + span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n"); + if (scan_line_out) + free(scan_line_out); + fclose(in); + fclose(out); return FALSE; } - + /* Create input decompressor. */ decompressor.err = jpeg_std_error(&error_handler); decompressor.client_data = (void *) &escape; error_handler.error_exit = jpg_error_exit; @@ -669,7 +772,7 @@ SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dst /* Take the header */ jpeg_read_header(&decompressor, TRUE); - /* Now we can force the input colorspace. For ITULab, we will use YCbCr as a "don't touch" marker */ + /* Now we can force the input colour space. For ITULab, we use YCbCr as a "don't touch" marker */ decompressor.out_color_space = JCS_RGB; compressor.err = jpeg_std_error(&error_handler); @@ -680,12 +783,13 @@ SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dst jpeg_create_compress(&compressor); jpeg_stdio_dest(&compressor, out); - /* Force the destination color space */ + /* Force the destination colour space */ compressor.in_color_space = JCS_YCbCr; compressor.input_components = 3; jpeg_set_defaults(&compressor); - //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + /* Limit to baseline-JPEG values */ + //jpeg_set_quality(&compressor, quality, TRUE); jpeg_copy_critical_parameters(&decompressor, &compressor); @@ -697,7 +801,7 @@ SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dst jpeg_start_decompress(&decompressor); jpeg_start_compress(&compressor, TRUE); - SetITUFax(&compressor); + set_itu_fax(&compressor); if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL) return FALSE; @@ -722,45 +826,77 @@ SPAN_DECLARE(int) t42_jpeg_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dst jpeg_destroy_decompress(&decompressor); jpeg_destroy_compress(&compressor); fclose(in); - fclose(out); +#if defined(HAVE_OPEN_MEMSTREAM) + fclose(out); *dst = outptr; *dstlen = outsize; +#else + *dstlen = ftell(out); + *dst = malloc(*dstlen); + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(out); + return FALSE; + } + if (fread(*dst, 1, *dstlen, out) != *dstlen) + { + free(*dst); + fclose(out); + return FALSE; + } + fclose(out); +#endif return TRUE; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes) +SPAN_DECLARE(int) t42_srgb_to_itulab(logging_state_t *logging, lab_params_t *s, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height) { struct jpeg_compress_struct compressor; FILE *out; - char *outptr; - size_t outsize; JSAMPROW scan_line_out; JSAMPROW scan_line_in; tsize_t pos; escape_route_t escape; +#if defined(HAVE_OPEN_MEMSTREAM) + char *outptr; + size_t outsize; +#endif escape.error_message[0] = '\0'; - emsg[0] = '\0'; #if defined(HAVE_OPEN_MEMSTREAM) - out = open_memstream(&outptr, &outsize); -#else - out = tmpfile(); -#endif - if (out == NULL) + outsize = 0; + if ((out = open_memstream(&outptr, &outsize)) == NULL) { - if (emsg[0] == '\0') - strcpy(emsg, "Failed to open_memstream()."); + span_log(logging, SPAN_LOG_FLOW, "Failed to open_memstream().\n"); return FALSE; } + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(out); + return FALSE; + } +#else + if ((out = tmpfile()) == NULL) + { + span_log(logging, SPAN_LOG_FLOW, "Failed to tmpfile().\n"); + return FALSE; + } +#endif + scan_line_out = NULL; if (setjmp(escape.escape)) { - strncpy(emsg, escape.error_message, max_emsg_bytes - 1); - emsg[max_emsg_bytes - 1] = '\0'; + if (escape.error_message[0]) + span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message); + else + span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n"); + if (scan_line_out) + free(scan_line_out); + fclose(out); return FALSE; } @@ -772,12 +908,13 @@ SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dst jpeg_create_compress(&compressor); jpeg_stdio_dest(&compressor, out); - /* Force the destination color space */ + /* Force the destination colour space */ compressor.in_color_space = JCS_YCbCr; compressor.input_components = 3; jpeg_set_defaults(&compressor); - //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + /* Limit to baseline-JPEG values */ + //jpeg_set_quality(&compressor, quality, TRUE); /* Size, resolution, etc */ compressor.image_width = width; @@ -785,7 +922,7 @@ SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dst jpeg_start_compress(&compressor, TRUE); - SetITUFax(&compressor); + set_itu_fax(&compressor); if ((scan_line_out = (JSAMPROW) malloc(compressor.image_width*compressor.num_components)) == NULL) return FALSE; @@ -800,44 +937,73 @@ SPAN_DECLARE(int) t42_srgb_to_itulab(lab_params_t *s, tdata_t *dst, tsize_t *dst free(scan_line_out); jpeg_finish_compress(&compressor); jpeg_destroy_compress(&compressor); - fclose(out); +#if defined(HAVE_OPEN_MEMSTREAM) + fclose(out); *dst = outptr; *dstlen = outsize; +#else + *dstlen = ftell(out); + *dst = malloc(*dstlen); + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(out); + return FALSE; + } + if (fread(*dst, 1, *dstlen, out) != *dstlen) + { + free(*dst); + fclose(out); + return FALSE; + } + fclose(out); +#endif return TRUE; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height, char *emsg, size_t max_emsg_bytes) +SPAN_DECLARE(int) t42_itulab_to_itulab(logging_state_t *logging, tdata_t *dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t width, uint32_t height) { struct jpeg_compress_struct compressor; FILE *out; - char *outptr; - size_t outsize; JSAMPROW scan_line_in; tsize_t pos; escape_route_t escape; +#if defined(HAVE_OPEN_MEMSTREAM) + char *outptr; + size_t outsize; +#endif escape.error_message[0] = '\0'; - emsg[0] = '\0'; #if defined(HAVE_OPEN_MEMSTREAM) - out = open_memstream(&outptr, &outsize); -#else - out = tmpfile(); -#endif - if (out == NULL) + outsize = 0; + if ((out = open_memstream(&outptr, &outsize)) == NULL) { - if (emsg[0] == '\0') - strcpy(emsg, "Failed to open_memstream()."); + span_log(logging, SPAN_LOG_FLOW, "Failed to open_memstream().\n"); return FALSE; } + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(out); + return FALSE; + } +#else + if ((out = tmpfile()) == NULL) + { + span_log(logging, SPAN_LOG_FLOW, "Failed to tmpfile().\n"); + return FALSE; + } +#endif if (setjmp(escape.escape)) { - strncpy(emsg, escape.error_message, max_emsg_bytes - 1); - emsg[max_emsg_bytes - 1] = '\0'; + if (escape.error_message[0]) + span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message); + else + span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n"); + fclose(out); return FALSE; } @@ -849,12 +1015,13 @@ SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t sr jpeg_create_compress(&compressor); jpeg_stdio_dest(&compressor, out); - /* Force the destination color space */ + /* Force the destination colour space */ compressor.in_color_space = JCS_YCbCr; compressor.input_components = 3; jpeg_set_defaults(&compressor); - //jpeg_set_quality(&compressor, quality, TRUE /* limit to baseline-JPEG values */); + /* Limit to baseline-JPEG values */ + //jpeg_set_quality(&compressor, quality, TRUE); /* Size, resolution, etc */ compressor.image_width = width; @@ -862,7 +1029,7 @@ SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t sr jpeg_start_compress(&compressor, TRUE); - SetITUFax(&compressor); + set_itu_fax(&compressor); for (pos = 0; pos < srclen; pos += compressor.image_width*compressor.num_components) { @@ -872,16 +1039,33 @@ SPAN_DECLARE(int) t42_itulab_to_itulab(tdata_t *dst, tsize_t *dstlen, tdata_t sr jpeg_finish_compress(&compressor); jpeg_destroy_compress(&compressor); - fclose(out); +#if defined(HAVE_OPEN_MEMSTREAM) + fclose(out); *dst = outptr; *dstlen = outsize; +#else + *dstlen = ftell(out); + *dst = malloc(*dstlen); + if (fseek(out, 0, SEEK_SET) != 0) + { + fclose(out); + return FALSE; + } + if (fread(*dst, 1, *dstlen, out) != *dstlen) + { + free(*dst); + fclose(out); + return FALSE; + } + fclose(out); +#endif return TRUE; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t42_itulab_to_srgb(lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height, char *emsg, size_t max_emsg_bytes) +SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s, tdata_t dst, tsize_t *dstlen, tdata_t src, tsize_t srclen, uint32_t *width, uint32_t *height) { struct jpeg_decompress_struct decompressor; JSAMPROW scan_line_out; @@ -892,28 +1076,41 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(lab_params_t *s, tdata_t dst, tsize_t *dstl escape_route_t escape; escape.error_message[0] = '\0'; - emsg[0] = '\0'; #if defined(HAVE_OPEN_MEMSTREAM) - in = fmemopen(src, srclen, "r"); -#else - in = tmpfile(); - fwrite(src, 1, srclen, in); - rewind(in); -#endif - if (in == NULL) + if ((in = fmemopen(src, srclen, "r")) == NULL) { - if (emsg[0] == '\0') - strcpy(emsg, "Failed to fmemopen()."); + span_log(logging, SPAN_LOG_FLOW, "Failed to fmemopen().\n"); return FALSE; } +#else + if ((in = tmpfile()) == NULL) + { + span_log(logging, SPAN_LOG_FLOW, "Failed to tmpfile().\n"); + return FALSE; + } + if (fwrite(src, 1, srclen, in) != srclen) + { + fclose(in); + return FALSE; + } + if (fseek(in, 0, SEEK_SET) != 0) + { + fclose(in); + return FALSE; + } +#endif + scan_line_out = NULL; if (setjmp(escape.escape)) { - strncpy(emsg, escape.error_message, max_emsg_bytes - 1); - emsg[max_emsg_bytes - 1] = '\0'; - if (emsg[0] == '\0') - strcpy(emsg, "Unspecified libjpeg error."); + if (escape.error_message[0]) + span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message); + else + span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n"); + if (scan_line_out) + free(scan_line_out); + fclose(in); return FALSE; } /* Create input decompressor. */ @@ -932,21 +1129,16 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(lab_params_t *s, tdata_t dst, tsize_t *dstl /* Rewind the file */ if (fseek(in, 0, SEEK_SET) != 0) return FALSE; -printf("XXXX 10\n"); /* Take the header */ jpeg_read_header(&decompressor, FALSE); -printf("XXXX 11\n"); - /* Now we can force the input colorspace. For ITULab, we will use YCbCr as a "don't touch" marker */ + /* Now we can force the input colour space. For ITULab, we use YCbCr as a "don't touch" marker */ decompressor.out_color_space = JCS_YCbCr; -printf("XXXX 12\n"); /* Sanity check and parameter check */ - if (!isITUfax(s, decompressor.marker_list)) + if (!is_itu_fax(logging, s, decompressor.marker_list)) { - if (emsg[0] == '\0') - strcpy(emsg, "Is not ITUFAX."); - //return FALSE; + span_log(logging, SPAN_LOG_FLOW, "Is not an ITU FAX.\n"); + return FALSE; } -printf("XXXX 13\n"); /* Copy size, resolution, etc */ *width = decompressor.image_width; *height = decompressor.image_height; @@ -1030,7 +1222,7 @@ SPAN_DECLARE(uint32_t) t42_encode_get_image_length(t42_encode_state_t *s) SPAN_DECLARE(int) t42_encode_get_compressed_image_size(t42_encode_state_t *s) { - return 0; + return s->compressed_image_size; } /*- End of function --------------------------------------------------------*/ @@ -1044,6 +1236,9 @@ SPAN_DECLARE(int) t42_encode_set_row_read_handler(t42_encode_state_t *s, SPAN_DECLARE(int) t42_encode_restart(t42_encode_state_t *s, uint32_t image_width, uint32_t image_length) { + //s->image_width = image_width; + //s->image_length = image_length; + s->compressed_image_size = 0; return 0; } /*- End of function --------------------------------------------------------*/ @@ -1065,6 +1260,7 @@ SPAN_DECLARE(t42_encode_state_t *) t42_encode_init(t42_encode_state_t *s, s->row_read_handler = handler; s->row_read_user_data = user_data; + t42_encode_restart(s, image_width, image_length); return s; } @@ -1078,7 +1274,11 @@ SPAN_DECLARE(int) t42_encode_release(t42_encode_state_t *s) SPAN_DECLARE(int) t42_encode_free(t42_encode_state_t *s) { - return 0; + int ret; + + ret = t42_encode_release(s); + free(s); + return ret; } /*- End of function --------------------------------------------------------*/ @@ -1097,6 +1297,17 @@ SPAN_DECLARE(int) t42_decode_put_chunk(t42_decode_state_t *s, const uint8_t data[], size_t len) { + uint8_t *buf; + + if (s->compressed_image_size + len > s->buf_size) + { + if ((buf = (uint8_t *) realloc(s->compressed_buf, s->compressed_image_size + 1000)) == NULL) + return -1; + s->buf_size = s->compressed_image_size + 1000; + s->compressed_buf = buf; + } + memcpy(&s->compressed_buf[s->compressed_image_size], data, len); + s->compressed_image_size += len; return 0; } /*- End of function --------------------------------------------------------*/ @@ -1105,6 +1316,8 @@ SPAN_DECLARE(int) t42_decode_set_row_write_handler(t42_decode_state_t *s, t4_row_write_handler_t handler, void *user_data) { + s->row_write_handler = handler; + s->row_write_user_data = user_data; return 0; } /*- End of function --------------------------------------------------------*/ @@ -1114,6 +1327,9 @@ SPAN_DECLARE(int) t42_decode_set_comment_handler(t42_decode_state_t *s, t4_row_write_handler_t handler, void *user_data) { + s->max_comment_len = max_comment_len; + s->comment_handler = handler; + s->comment_user_data = user_data; return 0; } /*- End of function --------------------------------------------------------*/ @@ -1140,7 +1356,7 @@ SPAN_DECLARE(uint32_t) t42_decode_get_image_length(t42_decode_state_t *s) SPAN_DECLARE(int) t42_decode_get_compressed_image_size(t42_decode_state_t *s) { - return 0; + return s->compressed_image_size; } /*- End of function --------------------------------------------------------*/ @@ -1152,6 +1368,7 @@ SPAN_DECLARE(int) t42_decode_new_plane(t42_decode_state_t *s) SPAN_DECLARE(int) t42_decode_restart(t42_decode_state_t *s) { + s->compressed_image_size = 0; return 0; } /*- End of function --------------------------------------------------------*/ @@ -1172,6 +1389,11 @@ SPAN_DECLARE(t42_decode_state_t *) t42_decode_init(t42_decode_state_t *s, s->row_write_handler = handler; s->row_write_user_data = user_data; + s->buf_size = 0; + s->compressed_buf = NULL; + + t42_decode_restart(s); + return s; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/t42_t43_local.h b/libs/spandsp/src/t42_t43_local.h new file mode 100644 index 0000000000..6eec67c6b9 --- /dev/null +++ b/libs/spandsp/src/t42_t43_local.h @@ -0,0 +1,44 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * t42_t43_local.h - definitions for T.42 and T.43 shared processing + * + * Written by Steve Underwood + * + * Copyright (C) 2011 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_T42_T43_LOCAL_H_) +#define _T42_T43_LOCAL_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +void set_illuminant_from_code(logging_state_t *logging, lab_params_t *s, const uint8_t code[4]); +void set_gamut_from_code(logging_state_t *logging, lab_params_t *s, const uint8_t code[12]); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 74dd152b7c..4e096e6371 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -54,6 +54,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -77,6 +78,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" @@ -374,7 +376,7 @@ SPAN_DECLARE(int) t4_rx_put_byte(t4_rx_state_t *s, uint8_t byte) case T4_COMPRESSION_ITU_T85_L0: return t85_decode_put_byte(&s->decoder.t85, byte); } - return TRUE; + return T4_DECODE_OK; } /*- End of function --------------------------------------------------------*/ @@ -399,7 +401,7 @@ SPAN_DECLARE(int) t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len case T4_COMPRESSION_ITU_T85_L0: return t85_decode_put_chunk(&s->decoder.t85, buf, len); } - return TRUE; + return T4_DECODE_OK; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/t4_t6_decode.c b/libs/spandsp/src/t4_t6_decode.c index ceb2af28f6..b3c96222b8 100644 --- a/libs/spandsp/src/t4_t6_decode.c +++ b/libs/spandsp/src/t4_t6_decode.c @@ -85,6 +85,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -107,6 +108,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" @@ -764,9 +766,9 @@ SPAN_DECLARE(int) t4_t6_decode_put_chunk(t4_t6_decode_state_t *s, const uint8_t s->compressed_image_size += 8; byte = buf[i]; if (put_bits(s, byte & 0xFF, 8)) - return TRUE; + return T4_DECODE_OK; } - return FALSE; + return T4_DECODE_MORE_DATA; } /*- End of function --------------------------------------------------------*/ @@ -875,10 +877,7 @@ SPAN_DECLARE(int) t4_t6_decode_restart(t4_t6_decode_state_t *s, int image_width) if (s->ref_runs) { memset(s->ref_runs, 0, run_space); - s->ref_runs[0] = - s->ref_runs[1] = - s->ref_runs[2] = - s->ref_runs[3] = s->image_width; + s->ref_runs[0] = s->image_width; } if (s->row_buf) memset(s->row_buf, 0, s->bytes_per_row); diff --git a/libs/spandsp/src/t4_t6_encode.c b/libs/spandsp/src/t4_t6_encode.c index 51103e522d..59dbd251e9 100644 --- a/libs/spandsp/src/t4_t6_encode.c +++ b/libs/spandsp/src/t4_t6_encode.c @@ -82,6 +82,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -104,6 +105,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" @@ -544,6 +546,22 @@ static int row_to_run_lengths(uint32_t list[], const uint8_t row[], int width) list[entry++] = pos; } } +#if defined(T4_STATE_DEBUGGING) + /* Dump the runs of black and white for analysis */ + { + int prev; + int x; + + printf("Runs (%d)", list[entry - 1]); + prev = 0; + for (x = 0; x < entry; x++) + { + printf(" %" PRIu32, list[x] - prev); + prev = list[x]; + } + printf("\n"); + } +#endif return entry; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 3961bfa94d..d1060f8a82 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -54,6 +54,7 @@ #include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #if defined(SPANDSP_SUPPORT_T42) @@ -76,6 +77,7 @@ #endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" +#include "spandsp/private/image_translate.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" @@ -180,21 +182,39 @@ static int get_tiff_directory_info(t4_tx_state_t *s) float y_resolution; int i; t4_tx_tiff_state_t *t; + uint16_t bits_per_sample; + uint16_t samples_per_pixel; t = &s->tiff; parm16 = 0; TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16); - if (parm16 != 1) - return -1; + bits_per_sample = parm16; parm16 = 0; TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16); - if (parm16 != 1) + samples_per_pixel = parm16; + if (samples_per_pixel == 1 && bits_per_sample == 1) + t->image_type = T4_IMAGE_TYPE_BILEVEL; + else if (samples_per_pixel == 1 && bits_per_sample == 8) + t->image_type = T4_IMAGE_TYPE_GRAY_8BIT; + else if (samples_per_pixel == 1 && bits_per_sample > 8) + t->image_type = T4_IMAGE_TYPE_GRAY_12BIT; + else if (samples_per_pixel == 3 && bits_per_sample == 8) + t->image_type = T4_IMAGE_TYPE_COLOUR_8BIT; + else if (samples_per_pixel == 3 && bits_per_sample > 8) + t->image_type = T4_IMAGE_TYPE_COLOUR_12BIT; + else return -1; +#if 0 + /* Limit ourselves to plain black and white pages */ + if (t->image_type != T4_IMAGE_TYPE_BILEVEL) + return -1; +#endif parm32 = 0; TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32); s->image_width = parm32; parm32 = 0; TIFFGetField(t->tiff_file, TIFFTAG_IMAGELENGTH, &parm32); + s->tiff.image_length = s->image_length = parm32; x_resolution = 0.0f; TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution); @@ -206,8 +226,6 @@ static int get_tiff_directory_info(t4_tx_state_t *s) TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &t->photo_metric); /* TIFFGetField(t->tiff_file, TIFFTAG_COMPRESSION, &t->????); */ - if (t->photo_metric != PHOTOMETRIC_MINISWHITE) - span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", s->tiff.file); t->fill_order = FILLORDER_LSB2MSB; /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the @@ -388,61 +406,102 @@ static int open_tiff_input_file(t4_tx_state_t *s, const char *file) static int tiff_row_read_handler(void *user_data, uint8_t buf[], size_t len) { t4_tx_state_t *s; - int i; s = (t4_tx_state_t *) user_data; if (s->tiff.row >= s->image_length) return 0; -#if 0 - if (TIFFReadScanline(s->tiff.tiff_file, buf, s->tiff.row, 0) < 0) - span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error reading TIFF row.\n", s->tiff.file); -#else memcpy(buf, &s->tiff.image_buffer[s->tiff.row*len], len); -#endif - if (s->tiff.photo_metric != PHOTOMETRIC_MINISWHITE) - { - for (i = 0; i < len; i++) - buf[i] = ~buf[i]; - } - if (s->tiff.fill_order != FILLORDER_LSB2MSB) - bit_reverse(buf, buf, len); s->tiff.row++; return len; } /*- End of function --------------------------------------------------------*/ +static int row_read(void *user_data, uint8_t buf[], size_t len) +{ + t4_tx_state_t *s; + + s = (t4_tx_state_t *) user_data; + + if (s->tiff.raw_row >= s->tiff.image_length) + return 0; + if (TIFFReadScanline(s->tiff.tiff_file, buf, s->tiff.raw_row, 0) < 0) + return 0; + s->tiff.raw_row++; + return len; +} +/*- End of function --------------------------------------------------------*/ + static int read_tiff_image(t4_tx_state_t *s) { int total_len; int len; - int bytes_per_row; int i; uint8_t *t; + image_translate_state_t *translator; + int mode; - s->image_width = 0; - TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGEWIDTH, &s->image_width); - s->image_length = 0; - TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGELENGTH, &s->image_length); - bytes_per_row = TIFFScanlineSize(s->tiff.tiff_file); - s->tiff.image_size = s->image_length*bytes_per_row; - if (s->tiff.image_size >= s->tiff.image_buffer_size) + if (s->tiff.image_type != T4_IMAGE_TYPE_BILEVEL) { - if ((t = realloc(s->tiff.image_buffer, s->tiff.image_size)) == NULL) + /* We need to dither this image down to pure black and white, possibly resizing it + along the way. */ + if (s->tiff.image_type == T4_IMAGE_TYPE_GRAY_8BIT) + mode = IMAGE_TRANSLATE_FROM_GRAY_8; + else if (s->tiff.image_type == T4_IMAGE_TYPE_GRAY_12BIT) + mode = IMAGE_TRANSLATE_FROM_GRAY_16; + else if (s->tiff.image_type == T4_IMAGE_TYPE_COLOUR_8BIT) + mode = IMAGE_TRANSLATE_FROM_COLOUR_8; + else if (s->tiff.image_type == T4_IMAGE_TYPE_COLOUR_12BIT) + mode = IMAGE_TRANSLATE_FROM_COLOUR_16; + else return -1; - s->tiff.image_buffer_size += s->tiff.image_size; - s->tiff.image_buffer = t; - } - -#if 1 - for (i = 0, total_len = 0; total_len < s->tiff.image_size; i++, total_len += len) - { - if ((len = TIFFReadEncodedStrip(s->tiff.tiff_file, i, &s->tiff.image_buffer[total_len], s->tiff.image_size - total_len)) < 0) + if ((translator = image_translate_init(NULL, mode, s->image_width, s->image_length, 1728, -1, row_read, s)) == NULL) + return -1; + s->image_width = image_translate_get_output_width(translator); + s->image_length = image_translate_get_output_length(translator); + s->metadata.x_resolution = T4_X_RESOLUTION_R8; + s->metadata.y_resolution = T4_Y_RESOLUTION_FINE; + s->tiff.image_size = (s->image_width*s->image_length + 7)/8; + if (s->tiff.image_size >= s->tiff.image_buffer_size) { - span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error.\n", s->tiff.file); - return -1; + if ((t = realloc(s->tiff.image_buffer, s->tiff.image_size)) == NULL) + return -1; + s->tiff.image_buffer_size = s->tiff.image_size; + s->tiff.image_buffer = t; } + s->tiff.raw_row = 0; + total_len = 0; + for (i = 0; i < s->image_length; i++) + total_len += image_translate_row(translator, &s->tiff.image_buffer[total_len], s->image_width/8); + image_translate_free(translator); + } + else + { + s->tiff.image_size = s->image_length*TIFFScanlineSize(s->tiff.tiff_file); + if (s->tiff.image_size >= s->tiff.image_buffer_size) + { + if ((t = realloc(s->tiff.image_buffer, s->tiff.image_size)) == NULL) + return -1; + s->tiff.image_buffer_size = s->tiff.image_size; + s->tiff.image_buffer = t; + } + + for (i = 0, total_len = 0; total_len < s->tiff.image_size; i++, total_len += len) + { + if ((len = TIFFReadEncodedStrip(s->tiff.tiff_file, i, &s->tiff.image_buffer[total_len], s->tiff.image_size - total_len)) < 0) + { + span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error.\n", s->tiff.file); + return -1; + } + } + if (s->tiff.photo_metric != PHOTOMETRIC_MINISWHITE) + { + span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", s->tiff.file); + for (i = 0; i < s->tiff.image_size; i++) + s->tiff.image_buffer[i] = ~s->tiff.image_buffer[i]; + } + if (s->tiff.fill_order != FILLORDER_LSB2MSB) + bit_reverse(s->tiff.image_buffer, s->tiff.image_buffer, s->tiff.image_size); } -#endif s->tiff.row = 0; return s->image_length; } @@ -901,8 +960,6 @@ SPAN_DECLARE(int) t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len) SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) { - uint32_t image_length; - span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d - compression %s\n", s->current_page, t4_encoding_to_str(s->line_encoding)); if (s->current_page > s->stop_page) return -1; @@ -911,7 +968,7 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page)) return -1; get_tiff_directory_info(s); - if ((image_length = read_tiff_image(s)) < 0) + if (read_tiff_image(s) < 0) return -1; } else diff --git a/libs/spandsp/src/t85_decode.c b/libs/spandsp/src/t85_decode.c index ff348a5fda..2cdee513f7 100644 --- a/libs/spandsp/src/t85_decode.c +++ b/libs/spandsp/src/t85_decode.c @@ -286,13 +286,13 @@ static int check_bih(t85_decode_state_t *s) #endif { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Fixed bytes do not contain expected values.\n"); - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } /* P - Number of bit planes */ if (s->buffer[2] < s->min_bit_planes || s->buffer[2] > s->max_bit_planes) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. %d bit planes. Should be %d to %d.\n", s->buffer[2], s->min_bit_planes, s->max_bit_planes); - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } s->bit_planes = s->buffer[2]; s->current_bit_plane = 0; @@ -302,38 +302,38 @@ static int check_bih(t85_decode_state_t *s) if (s->xd == 0 || (s->max_xd && s->xd > s->max_xd)) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Width is %" PRIu32 "\n", s->xd); - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } /* YD - Vertical image size at layer D */ s->yd = pack_32(&s->buffer[8]); if (s->yd == 0 || (s->max_yd && s->yd > s->max_yd)) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Length is %" PRIu32 "\n", s->yd); - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } /* L0 - Rows per stripe, at the lowest resolution */ s->l0 = pack_32(&s->buffer[12]); if (s->l0 == 0) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. L0 is %" PRIu32 "\n", s->l0); - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } /* MX - Maximum horizontal offset allowed for AT pixel */ s->mx = s->buffer[16]; if (s->mx > 127) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. MX is %d\n", s->mx); - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } /* Options byte */ s->options = s->buffer[19]; if ((s->options & 0x97)) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Options are 0x%X\n", s->options); - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } span_log(&s->logging, SPAN_LOG_FLOW, "BIH is OK. Image is %" PRIu32 "x%" PRIu32 " pixels\n", s->xd, s->yd); - return T85_OK; + return T4_DECODE_OK; } /*- End of function --------------------------------------------------------*/ @@ -368,7 +368,7 @@ SPAN_DECLARE(int) t85_decode_put_byte(t85_decode_state_t *s, int byte) if (byte < 0) { t85_decode_rx_status(s, byte); - return (s->y >= s->yd) ? T85_OK : T85_MORE_DATA; + return (s->y >= s->yd) ? T4_DECODE_OK : T4_DECODE_MORE_DATA; } data[0] = byte; return t85_decode_put_chunk(s, data, 1); @@ -399,8 +399,8 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, s->bie_len += i; cnt = i; if (s->bie_len < 20) - return T85_MORE_DATA; - if ((ret = check_bih(s)) != T85_OK) + return T4_DECODE_MORE_DATA; + if ((ret = check_bih(s)) != T4_DECODE_OK) return ret; /* Set up the two/three row buffer */ bytes_per_row = (s->xd + 7) >> 3; @@ -409,7 +409,7 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, { /* We need to expand the 3 row buffer */ if ((buf = (uint8_t *) realloc(s->row_buf, min_len)) == NULL) - return T85_NOMEM; + return T4_DECODE_NOMEM; s->row_buf = buf; s->row_buf_len = min_len; } @@ -500,11 +500,11 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, s->buf_len = 0; if (s->interrupt) - return T85_INTERRUPT; + return T4_DECODE_INTERRUPT; break; case T82_ABORT: s->buf_len = 0; - return T85_ABORTED; + return T4_DECODE_ABORTED; case T82_COMMENT: s->buf_needed = 6; if (s->buf_len < 6) @@ -531,7 +531,7 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, s->buf_len = 0; if (s->at_moves >= T85_ATMOVES_MAX) - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; s->at_row[s->at_moves] = pack_32(&s->buffer[2]); s->at_tx[s->at_moves] = s->buffer[6]; if (s->at_tx[s->at_moves] > s->mx @@ -540,7 +540,7 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, || s->buffer[7] != 0) { - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } s->at_moves++; break; @@ -552,12 +552,12 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, s->buf_len = 0; if (!(s->options & T85_VLENGTH)) - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; s->options &= ~T85_VLENGTH; y = pack_32(&s->buffer[2]); /* An update to the image length is not allowed to stretch it. */ if (y > s->yd) - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; s->yd = y; break; case T82_SDNORM: @@ -567,12 +567,12 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, /* A plain SDNORM or SDRST with no peek ahead required */ s->buf_len = 0; if (finish_sde(s)) - return T85_INTERRUPT; + return T4_DECODE_INTERRUPT; /* Check whether this was the last SDE */ if (s->y >= s->yd) { s->compressed_image_size -= (len - cnt); - return T85_OK; + return T4_DECODE_OK; } break; } @@ -594,12 +594,12 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, cnt--; /* Process the T82_SDNORM or T82_SDRST */ if (finish_sde(s)) - return T85_INTERRUPT; + return T4_DECODE_INTERRUPT; /* Check whether this was the last SDE */ if (s->y >= s->yd) { s->compressed_image_size -= (len - cnt); - return T85_OK; + return T4_DECODE_OK; } break; } @@ -613,12 +613,12 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, /* Process the T82_SDNORM or T82_SDRST */ if (finish_sde(s)) - return T85_INTERRUPT; + return T4_DECODE_INTERRUPT; /* Check whether this was the last SDE */ if (s->y >= s->yd) { s->compressed_image_size -= (len - cnt); - return T85_OK; + return T4_DECODE_OK; } /* Recycle the two peek-ahead marker sequence bytes to be processed later. */ @@ -639,12 +639,12 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, y = pack_32(&s->buffer[4]); /* An update to the image length is not allowed to stretch it. */ if (y > s->yd) - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; /* Things look OK, so accept this new length, and proceed. */ s->yd = y; /* Now process the T82_SDNORM or T82_SDRST */ if (finish_sde(s)) - return T85_INTERRUPT; + return T4_DECODE_INTERRUPT; /* We might be at the end of the image now, but even if we are there should still be a final training T82_SDNORM or T82_SDRST that we should pick up. When we do, we won't wait for further @@ -653,7 +653,7 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, break; default: s->buf_len = 0; - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } } else if (cnt < len && data[cnt] == T82_ESC) @@ -665,15 +665,15 @@ SPAN_DECLARE(int) t85_decode_put_chunk(t85_decode_state_t *s, /* We have found PSCD bytes */ cnt += decode_pscd(s, data + cnt, len - cnt); if (s->interrupt) - return T85_INTERRUPT; + return T4_DECODE_INTERRUPT; /* We should only have stopped processing PSCD if we ran out of data, or hit a T82_ESC */ if (cnt < len && data[cnt] != T82_ESC) - return T85_INVALID_DATA; + return T4_DECODE_INVALID_DATA; } } - return T85_MORE_DATA; + return T4_DECODE_MORE_DATA; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/image_translate_tests.c b/libs/spandsp/tests/image_translate_tests.c index be0f5ea18c..8c3f55f077 100644 --- a/libs/spandsp/tests/image_translate_tests.c +++ b/libs/spandsp/tests/image_translate_tests.c @@ -213,7 +213,7 @@ static void dither_tests_gray16(void) image[i*im.width + j] = j*1200; } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_GRAY_16, im.width, im.length, -1, row_read, &im); + s = image_translate_init(s, IMAGE_TRANSLATE_FROM_GRAY_16, im.width, im.length, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -239,7 +239,7 @@ static void dither_tests_gray8(void) for (j = 0; j < im.width; j++) image[i*im.width + j] = j*1200/256; } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_GRAY_8, im.width, im.length, -1, row_read, &im); + s = image_translate_init(s, IMAGE_TRANSLATE_FROM_GRAY_8, im.width, im.length, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -269,7 +269,7 @@ static void dither_tests_colour16(void) image[i*3*im.width + 3*j + 2] = j*1200; } } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_16, im.width, im.length, -1, row_read, &im); + s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_16, im.width, im.length, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -300,7 +300,7 @@ static void dither_tests_colour8(void) } } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_8, im.width, im.length, -1, row_read, &im); + s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_8, im.width, im.length, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -331,13 +331,13 @@ static void grow_tests_colour8(void) } } - s1 = image_translate_init(s1, IMAGE_TRANSLATE_FROM_COLOUR_8, im.width, im.length, 200, row_read, &im); + s1 = image_translate_init(s1, IMAGE_TRANSLATE_FROM_COLOUR_8, im.width, im.length, 200, -1, row_read, &im); get_flattened_image(s1, FALSE); } /*- End of function --------------------------------------------------------*/ -static void lenna_tests(int output_width, const char *file) +static void lenna_tests(int output_width, int output_length_scaling, const char *file) { TIFF *in_file; TIFF *out_file; @@ -355,6 +355,9 @@ static void lenna_tests(int output_width, const char *file) image_translate_state_t bw; image_translate_state_t *s = &bw; image_descriptor_t im; + float x_resolution; + float y_resolution; + uint16_t res_unit; printf("Dithering Lenna from colour to bi-level test\n"); if ((in_file = TIFFOpen(INPUT_TIFF_FILE_NAME, "r")) == NULL) @@ -367,11 +370,17 @@ static void lenna_tests(int output_width, const char *file) TIFFGetField(in_file, TIFFTAG_IMAGELENGTH, &image_length); if (image_length <= 0) return; + x_resolution = 200.0; + TIFFGetField(in_file, TIFFTAG_XRESOLUTION, &x_resolution); + y_resolution = 200.0; + TIFFGetField(in_file, TIFFTAG_YRESOLUTION, &y_resolution); + res_unit = RESUNIT_INCH; + TIFFSetField(in_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); bits_per_sample = 0; TIFFGetField(in_file, TIFFTAG_BITSPERSAMPLE, &bits_per_sample); samples_per_pixel = 0; TIFFGetField(in_file, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel); - printf("Original image is %d x %d, %d bits per sample, %d samples per pixel\n", image_width, image_length, bits_per_sample, samples_per_pixel); + printf("Original image is %d x %d, %f x %f resolution, %d bits per sample, %d samples per pixel\n", image_width, image_length, x_resolution, y_resolution, bits_per_sample, samples_per_pixel); if ((image = malloc(image_width*image_length*samples_per_pixel)) == NULL) return; for (total = 0, i = 0; i < 1000; i++) @@ -389,13 +398,18 @@ static void lenna_tests(int output_width, const char *file) printf("Image size %d %d\n", total, image_width*image_length*samples_per_pixel); TIFFClose(in_file); + if (output_length_scaling > 0) + output_length = (double) image_length*output_length_scaling*output_width/image_width; + else + output_length = -1; + im.image = image; im.width = image_width; im.length = image_length; im.current_row = 0; im.bytes_per_pixel = samples_per_pixel; - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_8, image_width, image_length, output_width, row_read, &im); + s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_8, image_width, image_length, output_width, output_length, row_read, &im); output_width = image_translate_get_output_width(s); output_length = image_translate_get_output_length(s); @@ -403,6 +417,11 @@ static void lenna_tests(int output_width, const char *file) return; TIFFSetField(out_file, TIFFTAG_IMAGEWIDTH, output_width); TIFFSetField(out_file, TIFFTAG_IMAGELENGTH, output_length); + TIFFSetField(out_file, TIFFTAG_XRESOLUTION, x_resolution); + if (output_length_scaling > 0) + y_resolution *= output_length_scaling; + TIFFSetField(out_file, TIFFTAG_YRESOLUTION, y_resolution); + TIFFSetField(out_file, TIFFTAG_RESOLUTIONUNIT, res_unit); TIFFSetField(out_file, TIFFTAG_BITSPERSAMPLE, 1); TIFFSetField(out_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(out_file, TIFFTAG_SAMPLESPERPIXEL, 1); @@ -441,9 +460,10 @@ int main(int argc, char **argv) grow_tests_colour8(); #endif #if 1 - lenna_tests(0, "lenna-bw.tif"); - lenna_tests(1728, "lenna-bw-1728.tif"); - lenna_tests(200, "lenna-bw-200.tif"); + lenna_tests(0, 0, "lenna-bw.tif"); + lenna_tests(200, 0, "lenna-bw-200.tif"); + lenna_tests(1728, 0, "lenna-bw-1728.tif"); + lenna_tests(1728, 2, "lenna-bw-1728-superfine.tif"); #endif printf("Tests passed.\n"); return 0; diff --git a/libs/spandsp/tests/t42_tests.c b/libs/spandsp/tests/t42_tests.c index 1ccefed9f0..c0d494c8ce 100644 --- a/libs/spandsp/tests/t42_tests.c +++ b/libs/spandsp/tests/t42_tests.c @@ -45,7 +45,8 @@ #include "spandsp.h" -#define IN_FILE_NAME "../test-data/itu/t24/F21_200.TIF" +//#define IN_FILE_NAME "../test-data/itu/t24/F21_200.TIF" +#define IN_FILE_NAME "../test-data/itu/t24/F21B400.TIF" #define OUT_FILE_NAME "t42_tests_receive.tif" uint8_t data5[50000000]; @@ -59,55 +60,6 @@ lab_params_t lab_param; int write_row = 0; -typedef struct -{ - float L; - float a; - float b; -} cielab_t; - -#if 0 -static void generate_luts(void) -{ - float r; - uint8_t srgb; - int i; - - printf("static const float srgb_to_linear[256] =\n"); - printf("{\n"); - for (i = 0; i < 256; i++) - { - /* Start with "i" as the sRGB value */ - r = i/256.0f; - - /* sRGB to Linear RGB */ - r = (r > 0.04045f) ? powf((r + 0.055f)/1.055f, 2.4f) : r/12.92f; - - printf((i < 255) ? " %f,\n" : " %f\n", r); - } - printf("};\n"); - - printf("static const uint8_t linear_to_srgb[4096] =\n"); - printf("{\n"); - for (i = 0; i < 4096; i++) - { - /* Start with "i" as the linear RGB value */ - /* Linear RGB to sRGB */ - r = i/4096.0f; - - r = (r > 0.0031308f) ? (1.055f*powf(r, 1.0f/2.4f) - 0.055f) : r*12.92f; - - r = floorf(r*256.0f); - - srgb = (r < 0) ? 0 : (r <= 255) ? r : 255; - - printf((i < 4095) ? " %d,\n" : " %d\n", srgb); - } - printf("};\n"); -} -/*- End of function --------------------------------------------------------*/ -#endif - static __inline__ uint16_t pack_16(uint8_t *s) { uint16_t value; @@ -159,7 +111,6 @@ static int t85_comment_handler(void *user_data, const uint8_t buf[], size_t len) int main(int argc, char *argv[]) { - char kk[256]; TIFF *tif; uint32_t w; uint32_t h; @@ -194,18 +145,17 @@ int main(int argc, char *argv[]) uint16_t *yyya; uint16_t *yyyb; uint16_t *yyyz; + logging_state_t *logging; printf("Demo of ITU/Lab library.\n"); + logging = span_log_init(NULL, SPAN_LOG_FLOW, "T.42"); + TIFF_FX_init(); set_lab_illuminant(&lab_param, 0.9638f, 1.0f, 0.8245f); set_lab_gamut(&lab_param, 0, 100, -85, 85, -75, 125, FALSE); -#if 0 - generate_luts(); -#endif - source_file = (argc > 1) ? argv[1] : IN_FILE_NAME; /* sRGB to ITU */ if ((tif = TIFFOpen(source_file, "r")) == NULL) @@ -307,6 +257,7 @@ int main(int argc, char *argv[]) printf("Unexpected compression %d\n", compression); break; } + if (process_raw) { nstrips = TIFFNumberOfStrips(tif); @@ -337,7 +288,7 @@ int main(int argc, char *argv[]) t85_decode_init(&t85_dec, t85_row_write_handler, NULL); t85_decode_set_comment_handler(&t85_dec, 1000, t85_comment_handler, NULL); result = t85_decode_put_chunk(&t85_dec, data, total_len); - if (result == T85_MORE_DATA) + if (result == T4_DECODE_MORE_DATA) result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); len = t85_decode_get_compressed_image_size(&t85_dec); printf("Compressed image is %d bytes, %d rows\n", len/8, write_row); @@ -396,7 +347,7 @@ int main(int argc, char *argv[]) len = t85_decode_get_compressed_image_size(&t85_dec); printf("Compressed image is %d bytes, %d rows\n", len/8, write_row); } - if (result == T85_MORE_DATA) + if (result == T4_DECODE_MORE_DATA) { printf("More\n"); result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); @@ -435,7 +386,7 @@ int main(int argc, char *argv[]) TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); TIFFSetField(tif, TIFFTAG_SOFTWARE, "spandsp"); TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "Test"); - TIFFSetField(tif, TIFFTAG_DATETIME, "2011/02/03 12:30:45"); + TIFFSetField(tif, TIFFTAG_DATETIME, "2012/07/03 12:30:45"); TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org"); TIFFSetField(tif, TIFFTAG_MODEL, "spandsp"); TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org"); @@ -477,9 +428,9 @@ int main(int argc, char *argv[]) { printf("YYY ITULAB\n"); - if (!t42_itulab_to_itulab((tdata_t) &outptr, &outsize, data, off, w, h, kk, 256)) + if (!t42_itulab_to_itulab(logging, (tdata_t) &outptr, &outsize, data, off, w, h)) { - printf("Failed to convert to ITULAB - %s\n", kk); + printf("Failed to convert to ITULAB\n"); return 1; } free(data); @@ -500,9 +451,9 @@ int main(int argc, char *argv[]) set_lab_illuminant(&lab_param, 0.9638f, 1.0f, 0.8245f); set_lab_gamut(&lab_param, 0, 100, -85, 85, -75, 125, FALSE); - if (!t42_srgb_to_itulab(&lab_param, (tdata_t) &outptr, &outsize, data, off, w, h, kk, 256)) + if (!t42_srgb_to_itulab(logging, &lab_param, (tdata_t) &outptr, &outsize, data, off, w, h)) { - printf("Failed to convert to ITULAB - %s\n", kk); + printf("Failed to convert to ITULAB\n"); return 1; } end = rdtscll(); @@ -539,7 +490,7 @@ int main(int argc, char *argv[]) TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); TIFFSetField(tif, TIFFTAG_SOFTWARE, "spandsp"); TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "Test"); - TIFFSetField(tif, TIFFTAG_DATETIME, "2011/02/03 12:30:45"); + TIFFSetField(tif, TIFFTAG_DATETIME, "2012/07/03 12:30:45"); TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org"); TIFFSetField(tif, TIFFTAG_MODEL, "spandsp"); TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org"); @@ -564,22 +515,22 @@ int main(int argc, char *argv[]) start = rdtscll(); data2 = NULL; totdata = 0; - t42_itulab_to_JPEG(&lab_param, (void **) &data2, &totdata, data, off, kk, 256); + t42_itulab_to_jpeg(logging, &lab_param, (void **) &data2, &totdata, data, off); end = rdtscll(); printf("Duration %" PRIu64 "\n", end - start); printf("Compressed length %d (%p)\n", totdata, data2); if (TIFFWriteRawStrip(tif, 0, data2, totdata) < 0) { - printf("Failed to convert from ITULAB - %s\n", kk); + printf("Failed to convert from ITULAB\n"); return 1; } free(data); #else data2 = malloc(totdata); start = rdtscll(); - if (!t42_itulab_to_srgb(&lab_param, data2, &off, data, off, &w, &h, kk, 256)) + if (!t42_itulab_to_srgb(logging, &lab_param, data2, &off, data, off, &w, &h)) { - printf("Failed to convert from ITULAB - %s\n", kk); + printf("Failed to convert from ITULAB\n"); return 1; } end = rdtscll(); diff --git a/libs/spandsp/tests/t4_t6_tests.c b/libs/spandsp/tests/t4_t6_tests.c index 38c4750f21..52eef26c19 100644 --- a/libs/spandsp/tests/t4_t6_tests.c +++ b/libs/spandsp/tests/t4_t6_tests.c @@ -293,27 +293,32 @@ int main(int argc, char *argv[]) properly. */ min_row_bits = 50; block_size = 0; - while ((opt = getopt(argc, argv, "126b:m:")) != -1) + while ((opt = getopt(argc, argv, "b:c:m:")) != -1) { switch (opt) { - case '1': - compression = T4_COMPRESSION_ITU_T4_1D; - compression_step = -1; - break; - case '2': - compression = T4_COMPRESSION_ITU_T4_2D; - compression_step = -1; - break; - case '6': - compression = T4_COMPRESSION_ITU_T6; - compression_step = -1; - break; case 'b': block_size = atoi(optarg); if (block_size > 1024) block_size = 1024; break; + case 'c': + if (strcmp(optarg, "T41D") == 0) + { + compression = T4_COMPRESSION_ITU_T4_1D; + compression_step = -1; + } + else if (strcmp(optarg, "T42D") == 0) + { + compression = T4_COMPRESSION_ITU_T4_2D; + compression_step = -1; + } + else if (strcmp(optarg, "T6") == 0) + { + compression = T4_COMPRESSION_ITU_T6; + compression_step = -1; + } + break; case 'm': min_row_bits = atoi(optarg); break; diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index 5bbf0555ac..b47530068d 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -542,7 +542,7 @@ int main(int argc, char *argv[]) #if 1 printf("Testing image_function->compress->decompress->image_function\n"); /* Send end gets image from a function */ - if (t4_tx_init(&send_state, FALSE, -1, -1) == NULL) + if (t4_tx_init(&send_state, NULL, -1, -1) == NULL) { printf("Failed to init T.4 tx\n"); exit(2); @@ -680,9 +680,6 @@ int main(int argc, char *argv[]) exit(2); } span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); - t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state)); - t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state)); - t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state)); /* Now send and receive all the pages in the source TIFF file */ sends = 0; @@ -725,6 +722,9 @@ int main(int argc, char *argv[]) if (t4_tx_start_page(&send_state)) break; + t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state)); + t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state)); + t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state)); } t4_rx_start_page(&receive_state); detect_page_end(-1000000, compression); diff --git a/libs/spandsp/tests/t85_tests.c b/libs/spandsp/tests/t85_tests.c index 832ee816fc..3e60507c1a 100644 --- a/libs/spandsp/tests/t85_tests.c +++ b/libs/spandsp/tests/t85_tests.c @@ -262,11 +262,11 @@ static int test_cycle(const char *test_id, t85_decode_set_comment_handler(&t85_dec, 1000, comment_handler, NULL); write_row = 0; result = t85_decode_put_chunk(&t85_dec, testbuf, testbuf_len); - if (result == T85_MORE_DATA) + if (result == T4_DECODE_MORE_DATA) result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); cnt_a = t85_encode_get_compressed_image_size(&t85_enc); cnt_b = t85_decode_get_compressed_image_size(&t85_dec); - if (cnt_a != cnt_b || cnt_a != testbuf_len*8 || result != T85_OK) + if (cnt_a != cnt_b || cnt_a != testbuf_len*8 || result != T4_DECODE_OK) { printf("Decode result %d\n", result); printf("%ld/%ld bits of %ld bits of BIE read. %lu lines decoded.\n", @@ -297,19 +297,19 @@ static int test_cycle(const char *test_id, if (comment && comment[0] != 'X') t85_decode_set_comment_handler(&t85_dec, 1000, comment_handler, NULL); write_row = 0; - result = T85_MORE_DATA; + result = T4_DECODE_MORE_DATA; for (l = 0; l < testbuf_len; l++) { result = t85_decode_put_chunk(&t85_dec, &testbuf[l], 1); - if (result != T85_MORE_DATA) + if (result != T4_DECODE_MORE_DATA) { l++; break; } } - if (result == T85_MORE_DATA) + if (result == T4_DECODE_MORE_DATA) result = t85_decode_put_byte(&t85_dec, SIG_STATUS_END_OF_DATA); - if (l != testbuf_len || result != T85_OK) + if (l != testbuf_len || result != T4_DECODE_OK) { printf("Decode result %d\n", result); printf("%ld bytes of %ld bytes of BIE read. %lu lines decoded.\n", From d1c3f910a6c8ae90efed07d4564cae1505050b0a Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 3 Aug 2012 16:46:48 -0500 Subject: [PATCH 0839/1057] windows -fix build for recent spandsp changes --- libs/spandsp/src/libspandsp.2008.vcproj | 16 ++++++++++++++-- libs/spandsp/src/libspandsp.2010.vcxproj | 3 +++ libs/spandsp/src/libspandsp.2010.vcxproj.filters | 9 +++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/libs/spandsp/src/libspandsp.2008.vcproj b/libs/spandsp/src/libspandsp.2008.vcproj index 9793cc6f61..cf68451ede 100644 --- a/libs/spandsp/src/libspandsp.2008.vcproj +++ b/libs/spandsp/src/libspandsp.2008.vcproj @@ -470,6 +470,10 @@ RelativePath="ima_adpcm.c" > + + @@ -694,6 +698,14 @@ + + + + @@ -1259,11 +1271,11 @@ > diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj b/libs/spandsp/src/libspandsp.2010.vcxproj index 2c933c77a5..253863f975 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj +++ b/libs/spandsp/src/libspandsp.2010.vcxproj @@ -186,6 +186,7 @@ + @@ -276,6 +277,7 @@ + @@ -287,6 +289,7 @@ + diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj.filters b/libs/spandsp/src/libspandsp.2010.vcxproj.filters index d79f7d1201..0c445ef07c 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj.filters +++ b/libs/spandsp/src/libspandsp.2010.vcxproj.filters @@ -274,6 +274,9 @@ Source Files + + Source Files + @@ -707,6 +710,12 @@ Header Files + + Header Files + + + Header Files + From d648a05ed114a0afe223ead9fd79262985eac0d6 Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 4 Aug 2012 19:19:04 -0400 Subject: [PATCH 0840/1057] Adding a new configurable radius module that will support both authentication based on a dialplan app, as well as digest based radius authentication by hooking into the directory. It is also fully configurable on which fields to send by the config file. --- src/mod/xml_int/mod_xml_radius/.gitignore | 1 + .../mod_xml_radius/00_dialpla_auth.xml | 22 + src/mod/xml_int/mod_xml_radius/Makefile | 26 + .../mod_xml_radius/dictionaries/dictionary | 244 ++++++ .../dictionaries/dictionary.cisco | 161 ++++ .../dictionaries/dictionary.rfc5090 | 27 + .../xml_int/mod_xml_radius/mod_xml_radius.c | 824 ++++++++++++++++++ .../mod_xml_radius/xml_radius.conf.xml | 103 +++ 8 files changed, 1408 insertions(+) create mode 100644 src/mod/xml_int/mod_xml_radius/.gitignore create mode 100644 src/mod/xml_int/mod_xml_radius/00_dialpla_auth.xml create mode 100644 src/mod/xml_int/mod_xml_radius/Makefile create mode 100644 src/mod/xml_int/mod_xml_radius/dictionaries/dictionary create mode 100644 src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.cisco create mode 100644 src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.rfc5090 create mode 100644 src/mod/xml_int/mod_xml_radius/mod_xml_radius.c create mode 100644 src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml diff --git a/src/mod/xml_int/mod_xml_radius/.gitignore b/src/mod/xml_int/mod_xml_radius/.gitignore new file mode 100644 index 0000000000..bb7ad3d288 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/.gitignore @@ -0,0 +1 @@ +freeradius-client* \ No newline at end of file diff --git a/src/mod/xml_int/mod_xml_radius/00_dialpla_auth.xml b/src/mod/xml_int/mod_xml_radius/00_dialpla_auth.xml new file mode 100644 index 0000000000..d4c74539a1 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/00_dialpla_auth.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/xml_int/mod_xml_radius/Makefile b/src/mod/xml_int/mod_xml_radius/Makefile new file mode 100644 index 0000000000..63542dff47 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/Makefile @@ -0,0 +1,26 @@ +RADCLIENT_VERSION=1.1.6 +RADCLIENT=freeradius-client-$(RADCLIENT_VERSION) +RADCLIENT_DIR=$(switch_srcdir)/libs/$(RADCLIENT) +RADCLIENT_BUILDDIR=$(switch_builddir)/libs/$(RADCLIENT) +RADCLIENT_LIBDIR=$(RADCLIENT_BUILDDIR)/lib +RADCLIENT_LA=${RADCLIENT_LIBDIR}/libfreeradius-client.la + +LOCAL_CFLAGS=-I$(RADCLIENT_DIR)/include +LOCAL_LIBADD=$(RADCLIENT_LA) + +BASE=../../../.. +include $(BASE)/build/modmake.rules + +$(RADCLIENT_DIR): + $(GETLIB) $(RADCLIENT).tar.gz + +$(RADCLIENT_BUILDDIR)/Makefile: $(RADCLIENT_DIR) + mkdir -p $(RADCLIENT_BUILDDIR) + cd $(RADCLIENT_BUILDDIR) && $(DEFAULT_VARS) $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR) + $(TOUCH_TARGET) + +$(RADCLIENT_LA): $(RADCLIENT_BUILDDIR)/Makefile + cd $(RADCLIENT_BUILDDIR) && CFLAGS="$(CFLAGS)" $(MAKE) + $(TOUCH_TARGET) + + diff --git a/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary b/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary new file mode 100644 index 0000000000..431d92c544 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary @@ -0,0 +1,244 @@ +# +# Updated 97/06/13 to livingston-radius-2.01 miquels@cistron.nl +# +# This file contains dictionary translations for parsing +# requests and generating responses. All transactions are +# composed of Attribute/Value Pairs. The value of each attribute +# is specified as one of 4 data types. Valid data types are: +# +# string - 0-253 octets +# ipaddr - 4 octets in network byte order +# integer - 32 bit value in big endian order (high byte first) +# date - 32 bit value in big endian order - seconds since +# 00:00:00 GMT, Jan. 1, 1970 +# +# Enumerated values are stored in the user file with dictionary +# VALUE translations for easy administration. +# +# Example: +# +# ATTRIBUTE VALUE +# --------------- ----- +# Framed-Protocol = PPP +# 7 = 1 (integer encoding) +# + +# +# Following are the proper new names. Use these. +# +$INCLUDE /usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.cisco +$INCLUDE /usr/local/src/freeswitch/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.rfc5090 + +ATTRIBUTE User-Name 1 string +ATTRIBUTE Password 2 string +ATTRIBUTE CHAP-Password 3 string +ATTRIBUTE NAS-IP-Address 4 ipaddr +ATTRIBUTE NAS-Port-Id 5 integer +ATTRIBUTE Service-Type 6 integer +ATTRIBUTE Framed-Protocol 7 integer +ATTRIBUTE Framed-IP-Address 8 ipaddr +ATTRIBUTE Framed-IP-Netmask 9 ipaddr +ATTRIBUTE Framed-Routing 10 integer +ATTRIBUTE Filter-Id 11 string +ATTRIBUTE Framed-MTU 12 integer +ATTRIBUTE Framed-Compression 13 integer +ATTRIBUTE Login-IP-Host 14 ipaddr +ATTRIBUTE Login-Service 15 integer +ATTRIBUTE Login-TCP-Port 16 integer +ATTRIBUTE Reply-Message 18 string +ATTRIBUTE Callback-Number 19 string +ATTRIBUTE Callback-Id 20 string +ATTRIBUTE Framed-Route 22 string +ATTRIBUTE Framed-IPX-Network 23 ipaddr +ATTRIBUTE State 24 string +ATTRIBUTE Class 25 string +ATTRIBUTE Vendor-Specific 26 string +ATTRIBUTE Session-Timeout 27 integer +ATTRIBUTE Idle-Timeout 28 integer +ATTRIBUTE Termination-Action 29 integer +ATTRIBUTE Called-Station-Id 30 string +ATTRIBUTE Calling-Station-Id 31 string +ATTRIBUTE NAS-Identifier 32 string +ATTRIBUTE Proxy-State 33 string +ATTRIBUTE Login-LAT-Service 34 string +ATTRIBUTE Login-LAT-Node 35 string +ATTRIBUTE Login-LAT-Group 36 string +ATTRIBUTE Framed-AppleTalk-Link 37 integer +ATTRIBUTE Framed-AppleTalk-Network 38 integer +ATTRIBUTE Framed-AppleTalk-Zone 39 string +ATTRIBUTE Acct-Status-Type 40 integer +ATTRIBUTE Acct-Delay-Time 41 integer +ATTRIBUTE Acct-Input-Octets 42 integer +ATTRIBUTE Acct-Output-Octets 43 integer +ATTRIBUTE Acct-Session-Id 44 string +ATTRIBUTE Acct-Authentic 45 integer +ATTRIBUTE Acct-Session-Time 46 integer +ATTRIBUTE Acct-Input-Packets 47 integer +ATTRIBUTE Acct-Output-Packets 48 integer +ATTRIBUTE Acct-Terminate-Cause 49 integer +ATTRIBUTE Acct-Multi-Session-Id 50 string +ATTRIBUTE Acct-Link-Count 51 integer +ATTRIBUTE Event-Timestamp 55 integer +ATTRIBUTE CHAP-Challenge 60 string +ATTRIBUTE NAS-Port-Type 61 integer +ATTRIBUTE Port-Limit 62 integer +ATTRIBUTE Login-LAT-Port 63 integer +ATTRIBUTE Connect-Info 77 string + +# +# RFC3162 IPv6 attributes +# +ATTRIBUTE NAS-IPv6-Address 95 string +ATTRIBUTE Framed-Interface-Id 96 string +ATTRIBUTE Framed-IPv6-Prefix 97 string +ATTRIBUTE Login-IPv6-Host 98 string +ATTRIBUTE Framed-IPv6-Route 99 string +ATTRIBUTE Framed-IPv6-Pool 100 string + +# +# Experimental Non Protocol Attributes used by Cistron-Radiusd +# +ATTRIBUTE Huntgroup-Name 221 string +ATTRIBUTE User-Category 1029 string +ATTRIBUTE Group-Name 1030 string +ATTRIBUTE Simultaneous-Use 1034 integer +ATTRIBUTE Strip-User-Name 1035 integer +ATTRIBUTE Fall-Through 1036 integer +ATTRIBUTE Add-Port-To-IP-Address 1037 integer +ATTRIBUTE Exec-Program 1038 string +ATTRIBUTE Exec-Program-Wait 1039 string +ATTRIBUTE Hint 1040 string + +# +# Non-Protocol Attributes +# These attributes are used internally by the server +# +ATTRIBUTE Expiration 21 date +ATTRIBUTE Auth-Type 1000 integer +ATTRIBUTE Menu 1001 string +ATTRIBUTE Termination-Menu 1002 string +ATTRIBUTE Prefix 1003 string +ATTRIBUTE Suffix 1004 string +ATTRIBUTE Group 1005 string +ATTRIBUTE Crypt-Password 1006 string +ATTRIBUTE Connect-Rate 1007 integer + +# +# Integer Translations +# + +# User Types + +VALUE Service-Type Login-User 1 +VALUE Service-Type Framed-User 2 +VALUE Service-Type Callback-Login-User 3 +VALUE Service-Type Callback-Framed-User 4 +VALUE Service-Type Outbound-User 5 +VALUE Service-Type Administrative-User 6 +VALUE Service-Type NAS-Prompt-User 7 + +# Framed Protocols + +VALUE Framed-Protocol PPP 1 +VALUE Framed-Protocol SLIP 2 + +# Framed Routing Values + +VALUE Framed-Routing None 0 +VALUE Framed-Routing Broadcast 1 +VALUE Framed-Routing Listen 2 +VALUE Framed-Routing Broadcast-Listen 3 + +# Framed Compression Types + +VALUE Framed-Compression None 0 +VALUE Framed-Compression Van-Jacobson-TCP-IP 1 + +# Login Services + +VALUE Login-Service Telnet 0 +VALUE Login-Service Rlogin 1 +VALUE Login-Service TCP-Clear 2 +VALUE Login-Service PortMaster 3 + +# Status Types + +VALUE Acct-Status-Type Start 1 +VALUE Acct-Status-Type Stop 2 +VALUE Acct-Status-Type Alive 3 +VALUE Acct-Status-Type Accounting-On 7 +VALUE Acct-Status-Type Accounting-Off 8 + +# Authentication Types + +VALUE Acct-Authentic RADIUS 1 +VALUE Acct-Authentic Local 2 +VALUE Acct-Authentic PowerLink128 100 + +# Termination Options + +VALUE Termination-Action Default 0 +VALUE Termination-Action RADIUS-Request 1 + +# NAS Port Types, available in 3.3.1 and later + +VALUE NAS-Port-Type Async 0 +VALUE NAS-Port-Type Sync 1 +VALUE NAS-Port-Type ISDN 2 +VALUE NAS-Port-Type ISDN-V120 3 +VALUE NAS-Port-Type ISDN-V110 4 + +# Acct Terminate Causes, available in 3.3.2 and later + +VALUE Acct-Terminate-Cause User-Request 1 +VALUE Acct-Terminate-Cause Lost-Carrier 2 +VALUE Acct-Terminate-Cause Lost-Service 3 +VALUE Acct-Terminate-Cause Idle-Timeout 4 +VALUE Acct-Terminate-Cause Session-Timeout 5 +VALUE Acct-Terminate-Cause Admin-Reset 6 +VALUE Acct-Terminate-Cause Admin-Reboot 7 +VALUE Acct-Terminate-Cause Port-Error 8 +VALUE Acct-Terminate-Cause NAS-Error 9 +VALUE Acct-Terminate-Cause NAS-Request 10 +VALUE Acct-Terminate-Cause NAS-Reboot 11 +VALUE Acct-Terminate-Cause Port-Unneeded 12 +VALUE Acct-Terminate-Cause Port-Preempted 13 +VALUE Acct-Terminate-Cause Port-Suspended 14 +VALUE Acct-Terminate-Cause Service-Unavailable 15 +VALUE Acct-Terminate-Cause Callback 16 +VALUE Acct-Terminate-Cause User-Error 17 +VALUE Acct-Terminate-Cause Host-Request 18 + +# +# Non-Protocol Integer Translations +# + +VALUE Auth-Type Local 0 +VALUE Auth-Type System 1 +VALUE Auth-Type SecurID 2 +VALUE Auth-Type Crypt-Local 3 +VALUE Auth-Type Reject 4 + +# +# Cistron extensions +# +VALUE Auth-Type Pam 253 +VALUE Auth-Type Accept 254 + +# +# Experimental Non-Protocol Integer Translations for Cistron-Radiusd +# +VALUE Fall-Through No 0 +VALUE Fall-Through Yes 1 +VALUE Add-Port-To-IP-Address No 0 +VALUE Add-Port-To-IP-Address Yes 1 + +# +# Configuration Values +# uncomment these two lines to turn account expiration on +# + +#VALUE Server-Config Password-Expiration 30 +#VALUE Server-Config Password-Warning 5 + + diff --git a/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.cisco b/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.cisco new file mode 100644 index 0000000000..b61c9d27cc --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.cisco @@ -0,0 +1,161 @@ +# -*- text -*- +# +# dictionary.cisco +# +# Accounting VSAs originally by +# "Marcelo M. Sosa Lugones" +# +# Version: $Id$ +# +# For documentation on Cisco RADIUS attributes, see: +# +# http://www.cisco.com/univercd/cc/td/doc/product/access/acs_serv/vapp_dev/vsaig3.htm +# +# For general documentation on Cisco RADIUS configuration, see: +# +# http://www.cisco.com/en/US/partner/tech/tk583/tk547/tsd_technology_support_sub-protocol_home.html +# + +VENDOR Cisco 9 + +# +# Standard attribute +# +#BEGIN-VENDOR Cisco + +ATTRIBUTE Cisco-AVPair 1 string vendor=Cisco +ATTRIBUTE Cisco-NAS-Port 2 string vendor=Cisco + +# +# T.37 Store-and-Forward attributes. +# +ATTRIBUTE Cisco-Fax-Account-Id-Origin 3 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Msg-Id 4 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Pages 5 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Coverpage-Flag 6 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Modem-Time 7 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Connect-Speed 8 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Recipient-Count 9 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Process-Abort-Flag 10 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Dsn-Address 11 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Dsn-Flag 12 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Mdn-Address 13 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Mdn-Flag 14 string vendor=Cisco +ATTRIBUTE Cisco-Fax-Auth-Status 15 string vendor=Cisco +ATTRIBUTE Cisco-Email-Server-Address 16 string vendor=Cisco +ATTRIBUTE Cisco-Email-Server-Ack-Flag 17 string vendor=Cisco +ATTRIBUTE Cisco-Gateway-Id 18 string vendor=Cisco +ATTRIBUTE Cisco-Call-Type 19 string vendor=Cisco +ATTRIBUTE Cisco-Port-Used 20 string vendor=Cisco +ATTRIBUTE Cisco-Abort-Cause 21 string vendor=Cisco + +# +# Voice over IP attributes. +# +ATTRIBUTE h323-remote-address 23 string vendor=Cisco +ATTRIBUTE h323-conf-id 24 string vendor=Cisco +ATTRIBUTE h323-setup-time 25 string vendor=Cisco +ATTRIBUTE h323-call-origin 26 string vendor=Cisco +ATTRIBUTE h323-call-type 27 string vendor=Cisco +ATTRIBUTE h323-connect-time 28 string vendor=Cisco +ATTRIBUTE h323-disconnect-time 29 string vendor=Cisco +ATTRIBUTE h323-disconnect-cause 30 string vendor=Cisco +ATTRIBUTE h323-voice-quality 31 string vendor=Cisco +ATTRIBUTE h323-gw-id 33 string vendor=Cisco +ATTRIBUTE h323-incoming-conf-id 35 string vendor=Cisco + +ATTRIBUTE Cisco-Policy-Up 37 string vendor=Cisco +ATTRIBUTE Cisco-Policy-Down 38 string vendor=Cisco + +ATTRIBUTE sip-conf-id 100 string vendor=Cisco +ATTRIBUTE h323-credit-amount 101 string vendor=Cisco +ATTRIBUTE h323-credit-time 102 string vendor=Cisco +ATTRIBUTE h323-return-code 103 string vendor=Cisco +ATTRIBUTE h323-prompt-id 104 string vendor=Cisco +ATTRIBUTE h323-time-and-day 105 string vendor=Cisco +ATTRIBUTE h323-redirect-number 106 string vendor=Cisco +ATTRIBUTE h323-preferred-lang 107 string vendor=Cisco +ATTRIBUTE h323-redirect-ip-address 108 string vendor=Cisco +ATTRIBUTE h323-billing-model 109 string vendor=Cisco +ATTRIBUTE h323-currency 110 string vendor=Cisco +ATTRIBUTE subscriber 111 string vendor=Cisco +ATTRIBUTE gw-rxd-cdn 112 string vendor=Cisco +ATTRIBUTE gw-final-xlated-cdn 113 string vendor=Cisco +ATTRIBUTE remote-media-address 114 string vendor=Cisco +ATTRIBUTE release-source 115 string vendor=Cisco +ATTRIBUTE gw-rxd-cgn 116 string vendor=Cisco +ATTRIBUTE gw-final-xlated-cgn 117 string vendor=Cisco + +# SIP Attributes +ATTRIBUTE call-id 141 string vendor=Cisco +ATTRIBUTE session-protocol 142 string vendor=Cisco +ATTRIBUTE method 143 string vendor=Cisco +ATTRIBUTE prev-hop-via 144 string vendor=Cisco +ATTRIBUTE prev-hop-ip 145 string vendor=Cisco +ATTRIBUTE incoming-req-uri 146 string vendor=Cisco +ATTRIBUTE outgoing-req-uri 147 string vendor=Cisco +ATTRIBUTE next-hop-ip 148 string vendor=Cisco +ATTRIBUTE next-hop-dn 149 string vendor=Cisco +ATTRIBUTE sip-hdr 150 string vendor=Cisco + +# +# Extra attributes sent by the Cisco, if you configure +# "radius-server vsa accounting" (requires IOS11.2+). +# +ATTRIBUTE Cisco-Multilink-ID 187 integer vendor=Cisco +ATTRIBUTE Cisco-Num-In-Multilink 188 integer vendor=Cisco +ATTRIBUTE Cisco-Pre-Input-Octets 190 integer vendor=Cisco +ATTRIBUTE Cisco-Pre-Output-Octets 191 integer vendor=Cisco +ATTRIBUTE Cisco-Pre-Input-Packets 192 integer vendor=Cisco +ATTRIBUTE Cisco-Pre-Output-Packets 193 integer vendor=Cisco +ATTRIBUTE Cisco-Maximum-Time 194 integer vendor=Cisco +ATTRIBUTE Cisco-Disconnect-Cause 195 integer vendor=Cisco +ATTRIBUTE Cisco-Data-Rate 197 integer vendor=Cisco +ATTRIBUTE Cisco-PreSession-Time 198 integer vendor=Cisco +ATTRIBUTE Cisco-PW-Lifetime 208 integer vendor=Cisco +ATTRIBUTE Cisco-IP-Direct 209 integer vendor=Cisco +ATTRIBUTE Cisco-PPP-VJ-Slot-Comp 210 integer vendor=Cisco +ATTRIBUTE Cisco-PPP-Async-Map 212 integer vendor=Cisco +ATTRIBUTE Cisco-IP-Pool-Definition 217 string vendor=Cisco +ATTRIBUTE Cisco-Assign-IP-Pool 218 integer vendor=Cisco +ATTRIBUTE Cisco-Route-IP 228 integer vendor=Cisco +ATTRIBUTE Cisco-Link-Compression 233 integer vendor=Cisco +ATTRIBUTE Cisco-Target-Util 234 integer vendor=Cisco +ATTRIBUTE Cisco-Maximum-Channels 235 integer vendor=Cisco +ATTRIBUTE Cisco-Data-Filter 242 integer vendor=Cisco +ATTRIBUTE Cisco-Call-Filter 243 integer vendor=Cisco +ATTRIBUTE Cisco-Idle-Limit 244 integer vendor=Cisco +ATTRIBUTE Cisco-Subscriber-Password 249 string vendor=Cisco +ATTRIBUTE Cisco-Account-Info 250 string vendor=Cisco +ATTRIBUTE Cisco-Service-Info 251 string vendor=Cisco +ATTRIBUTE Cisco-Command-Code 252 string vendor=Cisco +ATTRIBUTE Cisco-Control-Info 253 string vendor=Cisco +ATTRIBUTE Cisco-Xmit-Rate 255 integer vendor=Cisco + +VALUE Cisco-Disconnect-Cause Unknown 2 +VALUE Cisco-Disconnect-Cause CLID-Authentication-Failure 4 +VALUE Cisco-Disconnect-Cause No-Carrier 10 +VALUE Cisco-Disconnect-Cause Lost-Carrier 11 +VALUE Cisco-Disconnect-Cause No-Detected-Result-Codes 12 +VALUE Cisco-Disconnect-Cause User-Ends-Session 20 +VALUE Cisco-Disconnect-Cause Idle-Timeout 21 +VALUE Cisco-Disconnect-Cause Exit-Telnet-Session 22 +VALUE Cisco-Disconnect-Cause No-Remote-IP-Addr 23 +VALUE Cisco-Disconnect-Cause Exit-Raw-TCP 24 +VALUE Cisco-Disconnect-Cause Password-Fail 25 +VALUE Cisco-Disconnect-Cause Raw-TCP-Disabled 26 +VALUE Cisco-Disconnect-Cause Control-C-Detected 27 +VALUE Cisco-Disconnect-Cause EXEC-Program-Destroyed 28 +VALUE Cisco-Disconnect-Cause Timeout-PPP-LCP 40 +VALUE Cisco-Disconnect-Cause Failed-PPP-LCP-Negotiation 41 +VALUE Cisco-Disconnect-Cause Failed-PPP-PAP-Auth-Fail 42 +VALUE Cisco-Disconnect-Cause Failed-PPP-CHAP-Auth 43 +VALUE Cisco-Disconnect-Cause Failed-PPP-Remote-Auth 44 +VALUE Cisco-Disconnect-Cause PPP-Remote-Terminate 45 +VALUE Cisco-Disconnect-Cause PPP-Closed-Event 46 +VALUE Cisco-Disconnect-Cause Session-Timeout 100 +VALUE Cisco-Disconnect-Cause Session-Failed-Security 101 +VALUE Cisco-Disconnect-Cause Session-End-Callback 102 +VALUE Cisco-Disconnect-Cause Invalid-Protocol 120 + +#END-VENDOR Cisco diff --git a/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.rfc5090 b/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.rfc5090 new file mode 100644 index 0000000000..4feda43628 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/dictionaries/dictionary.rfc5090 @@ -0,0 +1,27 @@ +# -*- text -*- +# +# Attributes and values defined in RFC 5090. +# http://www.ietf.org/rfc/rfc5090.txt +# +# $Id$ +# +ATTRIBUTE Digest-Response 103 string +ATTRIBUTE Digest-Realm 104 string +ATTRIBUTE Digest-Nonce 105 string +ATTRIBUTE Digest-Response-Auth 106 string +ATTRIBUTE Digest-Nextnonce 107 string +ATTRIBUTE Digest-Method 108 string +ATTRIBUTE Digest-URI 109 string +ATTRIBUTE Digest-Qop 110 string +ATTRIBUTE Digest-Algorithm 111 string +ATTRIBUTE Digest-Entity-Body-Hash 112 string +ATTRIBUTE Digest-CNonce 113 string +ATTRIBUTE Digest-Nonce-Count 114 string +ATTRIBUTE Digest-Username 115 string +ATTRIBUTE Digest-Opaque 116 string +ATTRIBUTE Digest-Auth-Param 117 string +ATTRIBUTE Digest-AKA-Auts 118 string +ATTRIBUTE Digest-Domain 119 string +ATTRIBUTE Digest-Stale 120 string +ATTRIBUTE Digest-HA1 121 string +ATTRIBUTE SIP-AOR 122 string diff --git a/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c new file mode 100644 index 0000000000..28fd56eca6 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c @@ -0,0 +1,824 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2012, 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): + * + * William King + * + * mod_xml_radius.c -- Radius authentication and authorization + * + */ +#include +#include + +static struct { + switch_memory_pool_t *pool; + switch_xml_t auth_invite_configs; + switch_xml_t auth_app_configs; + switch_xml_t acct_start_configs; + switch_xml_t acct_end_configs; + /* xml read write lock */ +} globals = {0}; + +SWITCH_MODULE_LOAD_FUNCTION(mod_xml_radius_load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_radius_shutdown); +SWITCH_MODULE_DEFINITION(mod_xml_radius, mod_xml_radius_load, mod_xml_radius_shutdown, NULL); + +static int GLOBAL_DEBUG = 0; + +switch_status_t mod_xml_radius_new_handle(rc_handle **new_handle, switch_xml_t xml) { + switch_xml_t server, param; + + *new_handle = rc_new(); + + if ( *new_handle == NULL ) { + goto err; + } + + *new_handle = rc_config_init(*new_handle); + + if ( *new_handle == NULL ) { + goto err; + } + + if (rc_add_config(*new_handle, "auth_order", "radius", "mod_radius_cdr.c", 0) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding auth_order\n"); + goto err; + } + + if ((server = switch_xml_child(xml, "connection")) == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section in config file.\n"); + goto err; + } + + for (param = switch_xml_child(server, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Attempting to add param '%s' with value '%s' \n", var, val); + } + + if (strncmp(var, "dictionary", 10) == 0) { + rc_read_dictionary(*new_handle, val); + } else if (rc_add_config(*new_handle, var, val, "mod_xml_radius", 0) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding param '%s' with value '%s' \n", var, val); + goto err; + } + } + + return SWITCH_STATUS_SUCCESS; + + err: + if ( *new_handle ) { + rc_destroy( *new_handle ); + *new_handle = NULL; + } + return SWITCH_STATUS_GENERR; +} + +switch_status_t do_config() +{ + char *conf = "xml_radius.conf"; + switch_xml_t xml, cfg, tmp, server; + int serv, timeout, deadtime, retries, dict, seq; + /* TODO: + 1. read new auth_invite_configs + 2. Create replacement xml and vas objects + 3. Get the write lock. + 4. Replace xml and vas objects + 5. unlock and return. + */ + + if (!(xml = switch_xml_open_cfg(conf, &cfg, NULL))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", conf); + goto err; + } + + serv = timeout = deadtime = retries = dict = seq = 0; + if ((tmp = switch_xml_dup(switch_xml_child(cfg, "auth_invite"))) != NULL ) { + if ( (server = switch_xml_child(xml, "connection")) != NULL) { + for (param = switch_xml_child(server, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + if ( strncmp(var, "authserver", 10) == 0 ) { + serv = 1; + } else if ( strncmp(var, "radius_timeout", 14) == 0 ) { + timeout = 1; + } else if ( strncmp(var, "radius_deadtime", 15) == 0 ) { + deadtime = 1; + } else if ( strncmp(var, "radius_retries", 14) == 0 ) { + retries = 1; + } else if ( strncmp(var, "dictionary", 10) == 0 ) { + dict = 1; + } else if ( strncmp(var, "seqfile", 7) == 0 ) { + seq = 1; + } + } + + if ( serv && timeout && deadtime && retries && dict && seq ) { + globals.auth_invite_configs = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing a require section for radius connections\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for auth_invite\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_invite' section in config file.\n"); + } + + if ((globals.auth_app_configs = switch_xml_dup(switch_xml_child(cfg, "auth_app"))) == NULL ) { + if ( (server = switch_xml_child(xml, "connection")) != NULL) { + for (param = switch_xml_child(server, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + if ( strncmp(var, "authserver", 10) == 0 ) { + serv = 1; + } else if ( strncmp(var, "radius_timeout", 14) == 0 ) { + timeout = 1; + } else if ( strncmp(var, "radius_deadtime", 15) == 0 ) { + deadtime = 1; + } else if ( strncmp(var, "radius_retries", 14) == 0 ) { + retries = 1; + } else if ( strncmp(var, "dictionary", 10) == 0 ) { + dict = 1; + } else if ( strncmp(var, "seqfile", 7) == 0 ) { + seq = 1; + } + } + + if ( serv && timeout && deadtime && retries && dict && seq ) { + globals.auth_invite_configs = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing a require section for radius connections\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for auth_app\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'auth_app' section in config file.\n"); + } + + if ((globals.acct_start_configs = switch_xml_dup(switch_xml_child(cfg, "acct_start"))) == NULL ) { + if ( (server = switch_xml_child(xml, "connection")) != NULL) { + for (param = switch_xml_child(server, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + if ( strncmp(var, "acctserver", 10) == 0 ) { + serv = 1; + } else if ( strncmp(var, "radius_timeout", 14) == 0 ) { + timeout = 1; + } else if ( strncmp(var, "radius_deadtime", 15) == 0 ) { + deadtime = 1; + } else if ( strncmp(var, "radius_retries", 14) == 0 ) { + retries = 1; + } else if ( strncmp(var, "dictionary", 10) == 0 ) { + dict = 1; + } else if ( strncmp(var, "seqfile", 7) == 0 ) { + seq = 1; + } + } + + if ( serv && timeout && deadtime && retries && dict && seq ) { + globals.auth_invite_configs = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing a require section for radius connections\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for acct_start\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'acct_start' section in config file.\n"); + } + + if ((globals.acct_end_configs = switch_xml_dup(switch_xml_child(cfg, "acct_end"))) == NULL ) { + if ( (server = switch_xml_child(xml, "connection")) != NULL) { + for (param = switch_xml_child(server, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + if ( strncmp(var, "acctserver", 10) == 0 ) { + serv = 1; + } else if ( strncmp(var, "radius_timeout", 14) == 0 ) { + timeout = 1; + } else if ( strncmp(var, "radius_deadtime", 15) == 0 ) { + deadtime = 1; + } else if ( strncmp(var, "radius_retries", 14) == 0 ) { + retries = 1; + } else if ( strncmp(var, "dictionary", 10) == 0 ) { + dict = 1; + } else if ( strncmp(var, "seqfile", 7) == 0 ) { + seq = 1; + } + } + + if ( serv && timeout && deadtime && retries && dict && seq ) { + globals.auth_invite_configs = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing a require section for radius connections\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'connection' section for acct_end\n"); + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Could not find 'acct_end' section in config file.\n"); + } + + if ( xml ) { + switch_xml_free(xml); + } + + return SWITCH_STATUS_SUCCESS; + + err: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Configuration error\n"); + if ( xml ) { + switch_xml_free(xml); + } + + return SWITCH_STATUS_GENERR; +} + +switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch_event_t *params, rc_handle *handle, VALUE_PAIR **send, switch_xml_t fields) +{ + switch_xml_t param; + + if ( (param = switch_xml_child(fields, "param")) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to locate a param under the fields section\n"); + goto err; + } + + for (; param; param = param->next) { + DICT_ATTR *attribute = NULL; + DICT_VENDOR *vendor = NULL; + int attr_num = 0, vend_num = 0; + void *av_value = NULL; + + char *var = (char *) switch_xml_attr(param, "name"); + char *vend = (char *) switch_xml_attr(param, "vendor"); + char *variable = (char *) switch_xml_attr(param, "variable"); + char *format = (char *) switch_xml_attr(param, "format"); + + attribute = rc_dict_findattr(handle, var); + + if ( attribute == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Could not locate attribute '%s' in the configured dictionary\n", var); + goto err; + } + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: dict attr '%s' value '%d' type '%d'\n", + attribute->name, attribute->value, attribute->type); + } + + attr_num = attribute->value; + + if ( vend ) { + vendor = rc_dict_findvend(handle, vend); + + if ( vendor == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Could not locate vendor '%s' in the configured dictionary %p\n", + vend, vend); + goto err; + } + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: dict vend name '%s' vendorpec '%d'\n", + vendor->vendorname, vendor->vendorpec); + } + + vend_num = vendor->vendorpec; + } + + if ( var ) { + if ( session ) { + switch_channel_t *channel = switch_core_session_get_channel(session); + + /* Accounting only */ + if ( strncmp( var, "h323-setup-time", 15) == 0 ) { + switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel); + switch_time_t time = profile->times->created; + switch_time_exp_t tm; + + switch_time_exp_lt(&tm, time); + av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d", + 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(handle, send, attr_num, av_value, -1, vend_num) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto err; + } + } else if ( strncmp( var, "h323-connect-time", 17) == 0 ) { + switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel); + switch_time_t time = profile->times->answered; + switch_time_exp_t tm; + + switch_time_exp_lt(&tm, time); + + av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d", + 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(handle, send, attr_num, av_value, -1, vend_num) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto err; + } + } else if ( strncmp( var, "h323-disconnect-time", 20) == 0 ) { + switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel); + switch_time_t time = profile->times->hungup; + switch_time_exp_t tm; + + switch_time_exp_lt(&tm, time); + + av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d", + 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(handle, send, attr_num, av_value, -1, vend_num) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto err; + } + } else if ( strncmp( var, "h323-disconnect-cause", 21) == 0 ) { + switch_call_cause_t cause = switch_channel_get_cause(channel); + av_value = switch_mprintf("h323-disconnect-cause=%x", cause); + if (rc_avpair_add(handle, send, 30, av_value, -1, 9) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add disconnect cause \n"); + goto err; + } + + } else { + if ( attribute->type == 0 ) { + av_value = switch_mprintf(format, switch_channel_get_variable(channel, variable)); + if (rc_avpair_add(handle, send, attr_num, av_value, -1, vend_num) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option with val '%s' to handle\n", (char *) av_value); + goto err; + } + } else if ( attribute->type == 1 ) { + int number = atoi(switch_channel_get_variable(channel, variable)); + + if (rc_avpair_add(handle, send, attr_num, &number, -1, vend_num) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option with value '%d' to handle\n", number); + goto err; + } + } + } + } else if ( params ) { + /* Auth only */ + char *tmp = switch_event_get_header(params, variable); + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: param var '%s' val: %s\n", variable, tmp); + } + + if ( tmp == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Unable to locate '%s' on the event\n", variable); + goto err; + } + + av_value = switch_mprintf(format, tmp); + if (rc_avpair_add(handle, send, attr_num, av_value, -1, vend_num) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto err; + } + } else { + goto err; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: all params must have a name attribute\n"); + goto err; + } + if ( av_value != NULL ) { + free(av_value); + } + } + + return SWITCH_STATUS_SUCCESS; + err: + return SWITCH_STATUS_GENERR; + +} + +/* static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) */ +SWITCH_STANDARD_API(mod_xml_radius_connect_test) +{ + int result = 0; + VALUE_PAIR *send = NULL, *recv = NULL; + char msg[512 * 10 + 1] = {0}; + uint32_t service = PW_AUTHENTICATE_ONLY; + rc_handle *new_handle = NULL; + switch_xml_t fields; + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting connection test\n"); + } + + mod_xml_radius_new_handle(&new_handle, globals.auth_invite_configs); + + if ((fields = switch_xml_child(globals.auth_invite_configs, "fields")) == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n"); + goto err; + } + + if ( mod_xml_radius_add_params(NULL, NULL, new_handle, &send, fields) !=SWITCH_STATUS_SUCCESS ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n"); + goto err; + } + + if (rc_avpair_add(new_handle, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + return SWITCH_STATUS_SUCCESS; + } + + result = rc_auth(new_handle, 0, send, &recv, msg); + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: result(RC=%d) %s \n", result, msg); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: finished connection test\n"); + } + + err: + if ( recv ) { + rc_avpair_free(recv); + recv = NULL; + } + rc_destroy(new_handle); + + return SWITCH_STATUS_SUCCESS; +} + +switch_xml_t mod_xml_radius_auth_invite(switch_event_t *params) { + int result = 0, param_idx = 0; + VALUE_PAIR *send = NULL, *recv = NULL, *service_vp = NULL; + char msg[512 * 10 + 1] = {0}; + uint32_t service = PW_AUTHENTICATE_ONLY; + rc_handle *new_handle = NULL; + switch_xml_t fields, xml, dir, dom, usr, vars, var; + char name[512], value[512], *strtmp; + + if (GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting invite authentication\n"); + } + + mod_xml_radius_new_handle(&new_handle, globals.auth_invite_configs); + + if ( new_handle == NULL ) { + goto err; + } + + if ((fields = switch_xml_child(globals.auth_invite_configs, "fields")) == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n"); + goto err; + } + + if ( mod_xml_radius_add_params(NULL, params, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n"); + goto err; + } + + if (rc_avpair_add(new_handle, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto err; + } + + result = rc_auth(new_handle, 0, send, &recv, msg); + + if ( GLOBAL_DEBUG ){ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: result(RC=%d) %s \n", result, msg); + } + + if ( result != 0 ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Failed to authenticate\n"); + goto err; + } + + xml = switch_xml_new("document"); + switch_xml_set_attr_d(xml, "type", "freeswitch/xml"); + dir = switch_xml_add_child_d(xml, "section", 0); + switch_xml_set_attr_d(dir, "name", "directory"); + dom = switch_xml_add_child_d(dir, "domain", 0); + switch_xml_set_attr_d(dom, "name", switch_event_get_header(params, "domain")); + usr = switch_xml_add_child_d(dom, "user", 0); + vars = switch_xml_add_child_d(usr, "variables", 0); + + switch_xml_set_attr_d(usr, "id", switch_event_get_header(params, "user")); + + service_vp = recv; + while (service_vp != NULL) { + rc_avpair_tostr(new_handle, service_vp, name, 512, value, 512); + if ( GLOBAL_DEBUG ) + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\tattribute (%s)[%s] found in radius packet\n", name, value); + var = switch_xml_add_child_d(vars, "variable", param_idx++); + strtmp = strdup(name); + switch_xml_set_attr_d(var, "name", strtmp); + free(strtmp); + strtmp = strdup(value); + switch_xml_set_attr_d(var, "value", strtmp); + free(strtmp); + service_vp = service_vp->next; + } + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML: %s \n", switch_xml_toxml(xml, 1)); + } + + rc_avpair_free(recv); + rc_destroy(new_handle); + return xml; + err: + if ( recv ) { + rc_avpair_free(recv); + recv = NULL; + } + if ( new_handle ) { + rc_destroy(new_handle); + new_handle = NULL; + } + + return NULL; +} + +static switch_xml_t mod_xml_radius_directory_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, + switch_event_t *params, void *user_data) +{ + char *event_buf = NULL; + switch_xml_t xml = NULL; + char *auth_method = switch_event_get_header(params,"sip_auth_method"); + + + if ( GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting authentication\n"); + switch_event_serialize(params, &event_buf, SWITCH_TRUE); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event: %s \n", event_buf); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Section: %s \nTag: %s\nKey_name: %s\nKey_value: %s\n", + section, tag_name, key_name, key_value); + } + + if ( auth_method == NULL) { + return NULL; + } + + if ( strncmp( "INVITE", auth_method, 6) == 0) { + xml = mod_xml_radius_auth_invite(params); + } else { + xml = NULL; + } + + return xml; +} + +switch_status_t mod_xml_radius_accounting_start(switch_core_session_t *session){ + VALUE_PAIR *send = NULL; + uint32_t service = PW_STATUS_START; + rc_handle *new_handle = NULL; + switch_xml_t fields; + + if (GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting accounting start\n"); + } + + mod_xml_radius_new_handle(&new_handle, globals.acct_start_configs); + + if ((fields = switch_xml_child(globals.acct_start_configs, "fields")) == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n"); + goto end; + } + + if ( mod_xml_radius_add_params(session, NULL, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n"); + goto end; + } + + if (rc_avpair_add(new_handle, &send, PW_ACCT_STATUS_TYPE, &service, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto end; + } + + if (rc_acct(new_handle, 0, send) == OK_RC) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "mod_xml_radius: Accounting Start success\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Accounting Start failed\n"); + } + + end: + rc_destroy(new_handle); + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t mod_xml_radius_accounting_end(switch_core_session_t *session){ + VALUE_PAIR *send = NULL; + uint32_t service = PW_STATUS_STOP; + rc_handle *new_handle = NULL; + switch_xml_t fields; + + if (GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting accounting stop\n"); + switch_core_session_execute_application(session, "info", NULL); + } + + mod_xml_radius_new_handle(&new_handle, globals.acct_end_configs); + + if ((fields = switch_xml_child(globals.acct_end_configs, "fields")) == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n"); + goto end; + } + + if ( mod_xml_radius_add_params(session, NULL, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n"); + goto end; + } + + if (rc_avpair_add(new_handle, &send, PW_ACCT_STATUS_TYPE, &service, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto end; + } + + if (rc_acct(new_handle, 0, send) == OK_RC) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "mod_xml_radius: Accounting Stop success\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Accounting Stop failed\n"); + } + + end: + rc_destroy(new_handle); + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_STANDARD_APP(radius_auth_handle) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + + int result = 0; + VALUE_PAIR *send = NULL, *recv = NULL, *service_vp = NULL; + char msg[512 * 10 + 1] = {0}; + uint32_t service = PW_AUTHENTICATE_ONLY; + rc_handle *new_handle = NULL; + switch_xml_t fields; + char name[512], value[512]; + + if (GLOBAL_DEBUG ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: starting app authentication\n"); + } + + mod_xml_radius_new_handle(&new_handle, globals.auth_app_configs); + + if ( new_handle == NULL ) { + goto err; + } + + if ((fields = switch_xml_child(globals.auth_app_configs, "fields")) == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find 'fields' section in config file.\n"); + goto err; + } + + if ( mod_xml_radius_add_params(session, NULL, new_handle, &send, fields) != SWITCH_STATUS_SUCCESS ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to add params to rc_handle\n"); + goto err; + } + + if (rc_avpair_add(new_handle, &send, PW_SERVICE_TYPE, &service, -1, 0) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: failed to add option to handle\n"); + goto err; + } + + result = rc_auth(new_handle, 0, send, &recv, msg); + + if ( GLOBAL_DEBUG ){ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: result(RC=%d) %s \n", result, msg); + } + + switch_channel_set_variable(channel, "radius_auth_result", switch_mprintf("%d",result)); + + if ( result != 0 ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Failed to authenticate\n"); + goto err; + } + + + service_vp = recv; + while (service_vp != NULL) { + rc_avpair_tostr(new_handle, service_vp, name, 512, value, 512); + if ( GLOBAL_DEBUG ) + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\tattribute (%s)[%s] found in radius packet\n", name, value); + + switch_channel_set_variable(channel, name, value); + service_vp = service_vp->next; + } + + rc_avpair_free(recv); + rc_destroy(new_handle); + return; + err: + if ( recv ) { + rc_avpair_free(recv); + recv = NULL; + } + if ( new_handle ) { + rc_destroy(new_handle); + new_handle = NULL; + } + + return; +} + +static const switch_state_handler_table_t state_handlers = { + /*.on_init */ NULL, + /*.on_routing */ mod_xml_radius_accounting_start, + /*.on_execute */ NULL, + /*.on_hangup */ NULL, + /*.on_exchange_media */ NULL, + /*.on_soft_execute */ NULL, + /*.on_consume_media */ NULL, + /*.on_hibernate */ NULL, + /*.on_reset */ NULL, + /*.on_park */ NULL, + /*.on_reporting */ mod_xml_radius_accounting_end +}; + + +/* switch_status_t name (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */ +SWITCH_MODULE_LOAD_FUNCTION(mod_xml_radius_load) +{ + switch_api_interface_t *mod_xml_radius_api_interface; + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_application_interface_t *app_interface; + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + memset(&globals, 0, sizeof(globals)); + globals.pool = pool; + + if ( GLOBAL_DEBUG != 0 ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: loading\n"); + } + + if ( (status = do_config()) != SWITCH_STATUS_SUCCESS ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_xml_radius: Failed to load configs\n"); + return SWITCH_STATUS_TERM; + } + + if ( globals.auth_invite_configs ) { + status = switch_xml_bind_search_function(mod_xml_radius_directory_search, switch_xml_parse_section_string("directory"), NULL); + } + + SWITCH_ADD_API(mod_xml_radius_api_interface, "xml_radius_connect_test", "mod_xml_radius connection test", mod_xml_radius_connect_test, NULL); + + switch_core_add_state_handler(&state_handlers); + + SWITCH_ADD_APP(app_interface, "radius_auth", NULL, NULL, radius_auth_handle, "radius_auth", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_radius_shutdown) +{ + switch_core_remove_state_handler(&state_handlers); + switch_xml_unbind_search_function_ptr(mod_xml_radius_directory_search); + + if ( globals.auth_invite_configs ) { + switch_xml_free(globals.auth_invite_configs); + } + 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/xml_int/mod_xml_radius/xml_radius.conf.xml b/src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml new file mode 100644 index 0000000000..3340cf17b4 --- /dev/null +++ b/src/mod/xml_int/mod_xml_radius/xml_radius.conf.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d1b98ab388eed7840ac9e80eb8b212b33b232114 Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 4 Aug 2012 19:54:48 -0400 Subject: [PATCH 0841/1057] Good find DelphiWorld. --- .../mod_xml_radius/{00_dialpla_auth.xml => 00_dialplan_auth.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/mod/xml_int/mod_xml_radius/{00_dialpla_auth.xml => 00_dialplan_auth.xml} (100%) diff --git a/src/mod/xml_int/mod_xml_radius/00_dialpla_auth.xml b/src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml similarity index 100% rename from src/mod/xml_int/mod_xml_radius/00_dialpla_auth.xml rename to src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml From f088d971f3459db2cc8e43fda66d029fcc4a5ec5 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 5 Aug 2012 18:38:47 +0800 Subject: [PATCH 0842/1057] Sorted out fixed point builds of the V.22bis modem --- libs/spandsp/tests/v17_tests.sh | 16 ++++++++++++++++ libs/spandsp/tests/v27ter_tests.sh | 16 ++++++++++++++++ libs/spandsp/tests/v29_tests.sh | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100755 libs/spandsp/tests/v17_tests.sh create mode 100755 libs/spandsp/tests/v27ter_tests.sh create mode 100755 libs/spandsp/tests/v29_tests.sh diff --git a/libs/spandsp/tests/v17_tests.sh b/libs/spandsp/tests/v17_tests.sh new file mode 100755 index 0000000000..5657afd348 --- /dev/null +++ b/libs/spandsp/tests/v17_tests.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +STDOUT_DEST=xyzzy +STDERR_DEST=xyzzy2 + +for OPTS in "-b 14400 -s -42 -n -66" "-b 12000 -s -42 -n -61" "-b 9600 -s -42 -n -59" "-b 7200 -s -42 -n -56" +do + ./v17_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo v17_tests ${OPTS} failed! + exit $RETVAL + fi +done +echo v17_tests completed OK diff --git a/libs/spandsp/tests/v27ter_tests.sh b/libs/spandsp/tests/v27ter_tests.sh new file mode 100755 index 0000000000..9e5d99d9b3 --- /dev/null +++ b/libs/spandsp/tests/v27ter_tests.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +STDOUT_DEST=xyzzy +STDERR_DEST=xyzzy2 + +for OPTS in "-g -b 4800 -s -42 -n -57" "-g -b 2400 -s -42 -n -51" +do + ./v27ter_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo v27ter_tests ${OPTS} failed! + exit $RETVAL + fi +done +echo v27ter_tests completed OK diff --git a/libs/spandsp/tests/v29_tests.sh b/libs/spandsp/tests/v29_tests.sh new file mode 100755 index 0000000000..5c98d00619 --- /dev/null +++ b/libs/spandsp/tests/v29_tests.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +STDOUT_DEST=xyzzy +STDERR_DEST=xyzzy2 + +for OPTS in "-g -b 9600 -s -42 -n -62" "-g -b 7200 -s -42 -n -59" "-g -b 4800 -s -42 -n -54" +do + ./v29_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo v29_tests ${OPTS} failed! + exit $RETVAL + fi +done +echo v29_tests completed OK From 72566f6a3f4095c128f27c924bdfe0640cee5fb9 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 5 Aug 2012 18:39:41 +0800 Subject: [PATCH 0843/1057] Fixed V.22bis fixed point builds --- libs/spandsp/autogen.sh | 19 ++-------- libs/spandsp/src/spandsp/async.h | 3 -- libs/spandsp/src/spandsp/private/v22bis.h | 4 +-- libs/spandsp/src/spandsp/tone_generate.h | 3 -- libs/spandsp/src/spandsp/v22bis.h | 2 +- libs/spandsp/src/v22bis_rx.c | 42 +++++++++++------------ 6 files changed, 27 insertions(+), 46 deletions(-) diff --git a/libs/spandsp/autogen.sh b/libs/spandsp/autogen.sh index 2d9a0670da..c3cc88b04a 100755 --- a/libs/spandsp/autogen.sh +++ b/libs/spandsp/autogen.sh @@ -106,32 +106,19 @@ version_compare() # Check for required version and die if unhappy +mkdir config + if [ "x$UNAME" = "xFreeBSD" ]; then version_compare libtoolize 1 5 16 || exit 1 version_compare automake19 1 9 5 || exit 1 version_compare autoconf259 2 59 || exit 1 -ACLOCAL=aclocal19 -AUTOHEADER=autoheader259 -AUTOMAKE=automake19 -AUTOCONF=autoconf259 else version_compare libtoolize 1 5 16 || exit 1 version_compare automake 1 9 5 || exit 1 version_compare autoconf 2 59 || exit 1 -ACLOCAL=aclocal -AUTOHEADER=autoheader -AUTOMAKE=automake -AUTOCONF=autoconf fi -libtoolize --copy --force --ltdl -#NetBSD seems to need this file writable -chmod u+w libltdl/configure - -$ACLOCAL -$AUTOHEADER --force -$AUTOMAKE --copy --add-missing -$AUTOCONF --force +autoreconf -fi #chmod ug+x debian/rules diff --git a/libs/spandsp/src/spandsp/async.h b/libs/spandsp/src/spandsp/async.h index 4324264042..8d643dd720 100644 --- a/libs/spandsp/src/spandsp/async.h +++ b/libs/spandsp/src/spandsp/async.h @@ -107,9 +107,6 @@ typedef void (*put_bit_func_t)(void *user_data, int bit); /*! Bit get function for data pumps */ typedef int (*get_bit_func_t)(void *user_data); -#define modem_rx_status_func_t modem_status_func_t -#define modem_tx_status_func_t modem_status_func_t - /*! Status change callback function for data pumps */ typedef void (*modem_status_func_t)(void *user_data, int status); diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h index 9ac200d44e..b601b0c02d 100644 --- a/libs/spandsp/src/spandsp/private/v22bis.h +++ b/libs/spandsp/src/spandsp/private/v22bis.h @@ -65,7 +65,7 @@ enum V22BIS_TX_TRAINING_STAGE_PARKED }; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) extern const complexi16_t v22bis_constellation[16]; #else extern const complexf_t v22bis_constellation[16]; @@ -137,7 +137,7 @@ struct v22bis_state_s int constellation_state; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) /*! \brief The scaling factor accessed by the AGC algorithm. */ int16_t agc_scaling; /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */ diff --git a/libs/spandsp/src/spandsp/tone_generate.h b/libs/spandsp/src/spandsp/tone_generate.h index 545335af51..d6ed8f2bc3 100644 --- a/libs/spandsp/src/spandsp/tone_generate.h +++ b/libs/spandsp/src/spandsp/tone_generate.h @@ -86,9 +86,6 @@ SPAN_DECLARE(tone_gen_descriptor_t *) tone_gen_descriptor_init(tone_gen_descript int d4, int repeat); -/* For backwards compatibility */ -#define make_tone_gen_descriptor tone_gen_descriptor_init - SPAN_DECLARE(void) tone_gen_descriptor_free(tone_gen_descriptor_t *s); SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples); diff --git a/libs/spandsp/src/spandsp/v22bis.h b/libs/spandsp/src/spandsp/v22bis.h index 6ecd91773e..440118c7cb 100644 --- a/libs/spandsp/src/spandsp/v22bis.h +++ b/libs/spandsp/src/spandsp/v22bis.h @@ -86,7 +86,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx_fillin(v22bis_state_t *s, int len); \brief Get a snapshot of the current equalizer coefficients. \param coeffs The vector of complex coefficients. \return The number of coefficients in the vector. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexi16_t **coeffs); #else SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs); diff --git a/libs/spandsp/src/v22bis_rx.c b/libs/spandsp/src/v22bis_rx.c index 85303220f5..41e3076042 100644 --- a/libs/spandsp/src/v22bis_rx.c +++ b/libs/spandsp/src/v22bis_rx.c @@ -72,7 +72,7 @@ #include "spandsp/private/logging.h" #include "spandsp/private/v22bis.h" -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) #define FP_SHIFT_FACTOR 10 #define FP_SCALE FP_Q_6_10 #include "v22bis_rx_1200_fixed_rrc.h" @@ -187,7 +187,7 @@ SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coef void v22bis_equalizer_coefficient_reset(v22bis_state_t *s) { /* Start with an equalizer based on everything being perfect */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static const complexi16_t x = {FP_Q_6_10(3.0f), FP_Q_6_10(0.0f)}; cvec_zeroi16(s->rx.eq_coeff, V22BIS_EQUALIZER_LEN); @@ -206,7 +206,7 @@ void v22bis_equalizer_coefficient_reset(v22bis_state_t *s) static void equalizer_reset(v22bis_state_t *s) { v22bis_equalizer_coefficient_reset(s); -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) cvec_zeroi16(s->rx.eq_buf, V22BIS_EQUALIZER_LEN); #else cvec_zerof(s->rx.eq_buf, V22BIS_EQUALIZER_LEN); @@ -237,7 +237,7 @@ static __inline__ complexf_t equalizer_get(v22bis_state_t *s) #endif /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static void tune_equalizer(v22bis_state_t *s, const complexi16_t *z, const complexi16_t *target) { complexi16_t err; @@ -262,13 +262,13 @@ static void tune_equalizer(v22bis_state_t *s, const complexf_t *z, const complex #endif /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static __inline__ void track_carrier(v22bis_state_t *s, const complexi16_t *z, const complexi16_t *target) #else static __inline__ void track_carrier(v22bis_state_t *s, const complexf_t *z, const complexf_t *target) #endif { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) int32_t error; #else float error; @@ -277,7 +277,7 @@ static __inline__ void track_carrier(v22bis_state_t *s, const complexf_t *z, con /* For small errors the imaginary part of the difference between the actual and the target positions is proportional to the phase error, for any particular target. However, the different amplitudes of the various target positions scale things. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) error = ((int32_t) z->im*target->re - (int32_t) z->re*target->im) >> FP_SHIFT_FACTOR; s->rx.carrier_phase_rate += (s->rx.carrier_track_i*error); s->rx.carrier_phase += (s->rx.carrier_track_p*error); @@ -376,7 +376,7 @@ static int decode_baudx(v22bis_state_t *s, int nearest) static __inline__ void symbol_sync(v22bis_state_t *s) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) int32_t p; int32_t q; complexi16_t a; @@ -447,13 +447,13 @@ static __inline__ void symbol_sync(v22bis_state_t *s) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) static __inline__ void process_half_baud(v22bis_state_t *s, const complexi16_t *sample) #else static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sample) #endif { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t z; complexi16_t zz; const complexi16_t *target; @@ -490,7 +490,7 @@ static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sa /* Find the constellation point */ if (s->rx.sixteen_way_decisions) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) re = (z.re + FP_Q_6_10(3.0f)) >> FP_SHIFT_FACTOR; im = (z.im + FP_Q_6_10(3.0f)) >> FP_SHIFT_FACTOR; #else @@ -688,7 +688,7 @@ static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sa s->tx.training = V22BIS_TX_TRAINING_STAGE_TIMED_S11; /* Normal reception starts immediately */ s->rx.training = V22BIS_RX_TRAINING_STAGE_NORMAL_OPERATION; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) s->rx.carrier_track_i = 8; #else s->rx.carrier_track_i = 8000.0f; @@ -716,7 +716,7 @@ static __inline__ void process_half_baud(v22bis_state_t *s, const complexf_t *sa s->rx.sixteen_way_decisions = TRUE; s->rx.training = V22BIS_RX_TRAINING_STAGE_WAIT_FOR_SCRAMBLED_ONES_AT_2400; s->rx.pattern_repeats = 0; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) s->rx.carrier_track_i = 8; #else s->rx.carrier_track_i = 8000.0f; @@ -782,7 +782,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l { int i; int step; -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t z; complexi16_t zz; complexi16_t sample; @@ -856,7 +856,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l if (s->rx.training == V22BIS_RX_TRAINING_STAGE_SYMBOL_ACQUISITION) { /* Only AGC during the initial symbol acquisition, and then lock the gain. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) s->rx.agc_scaling = saturate16(((int32_t) (1024.0f*1024.0f*0.18f*3.60f))/fixed_sqrt32(power)); #else s->rx.agc_scaling = 0.18f*3.60f/sqrtf(power); @@ -872,7 +872,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l s->rx.eq_put_step += PULSESHAPER_COEFF_SETS*40/(3*2); if (s->calling_party) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; #else @@ -882,7 +882,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l } else { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step) >> 15; #else @@ -893,7 +893,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l /* Shift to baseband - since this is done in a full complex form, the result is clean, and requires no further filtering apart from the equalizer. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) sample.re = (ii*s->rx.agc_scaling) >> FP_SHIFT_FACTOR; sample.im = (qq*s->rx.agc_scaling) >> FP_SHIFT_FACTOR; z = dds_lookup_complexi16(s->rx.carrier_phase); @@ -929,7 +929,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx_fillin(v22bis_state_t *s, int len) return 0; for (i = 0; i < len; i++) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) dds_advance(&s->rx.carrier_phase, s->rx.carrier_phase_rate); #else dds_advancef(&s->rx.carrier_phase, s->rx.carrier_phase_rate); @@ -942,7 +942,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx_fillin(v22bis_state_t *s, int len) int v22bis_rx_restart(v22bis_state_t *s) { -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) vec_zeroi16(s->rx.rrc_filter, sizeof(s->rx.rrc_filter)/sizeof(s->rx.rrc_filter[0])); s->rx.training_error = 0; #else @@ -978,7 +978,7 @@ int v22bis_rx_restart(v22bis_state_t *s) s->rx.baud_phase = 0; s->rx.total_baud_timing_correction = 0; /* We want the carrier to pull in faster on the answerer side, as it has very little time to adapt. */ -#if defined(SPANDSP_USE_FIXED_POINTx) +#if defined(SPANDSP_USE_FIXED_POINT) s->rx.carrier_track_i = (s->calling_party) ? 8 : 40; s->rx.carrier_track_p = 8000; #else From 04e93f4c0b4be6bd4e1f7613eb4480ee3a952c6a Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 5 Aug 2012 22:20:39 +0800 Subject: [PATCH 0844/1057] Fix fixed point builds of spandsp, and improve logging of modem performance during tests --- libs/spandsp/src/spandsp/v17rx.h | 6 ++ libs/spandsp/src/spandsp/v22bis.h | 6 ++ libs/spandsp/src/spandsp/v27ter_rx.h | 6 ++ libs/spandsp/src/spandsp/v29rx.h | 6 ++ libs/spandsp/src/v17rx.c | 3 +- libs/spandsp/tests/modem_monitor.cpp | 32 ++++--- libs/spandsp/tests/modem_monitor.h | 2 +- libs/spandsp/tests/v17_tests.c | 73 +++++++-------- libs/spandsp/tests/v22bis_tests.c | 66 +++++++------ libs/spandsp/tests/v27ter_tests.c | 133 ++++++++++++--------------- libs/spandsp/tests/v29_tests.c | 71 +++++++------- 11 files changed, 197 insertions(+), 207 deletions(-) diff --git a/libs/spandsp/src/spandsp/v17rx.h b/libs/spandsp/src/spandsp/v17rx.h index 892217889a..935d542853 100644 --- a/libs/spandsp/src/spandsp/v17rx.h +++ b/libs/spandsp/src/spandsp/v17rx.h @@ -209,6 +209,12 @@ working only on the most optimal lines, and being widely usable across most phon TCM absolutely transformed the phone line modem business. */ +#if defined(SPANDSP_USE_FIXED_POINT) +#define V17_CONSTELLATION_SCALING_FACTOR 1024.0 +#else +#define V17_CONSTELLATION_SCALING_FACTOR 1.0 +#endif + /*! V.17 modem receive side descriptor. This defines the working state for a single instance of a V.17 modem receiver. diff --git a/libs/spandsp/src/spandsp/v22bis.h b/libs/spandsp/src/spandsp/v22bis.h index 440118c7cb..6361c05841 100644 --- a/libs/spandsp/src/spandsp/v22bis.h +++ b/libs/spandsp/src/spandsp/v22bis.h @@ -48,6 +48,12 @@ or 1200bps if one or both ends to not acknowledge that 2400bps is OK. #if !defined(_SPANDSP_V22BIS_H_) #define _SPANDSP_V22BIS_H_ +#if defined(SPANDSP_USE_FIXED_POINT) +#define V22BIS_CONSTELLATION_SCALING_FACTOR 1024.0 +#else +#define V22BIS_CONSTELLATION_SCALING_FACTOR 1.0 +#endif + enum { V22BIS_GUARD_TONE_NONE, diff --git a/libs/spandsp/src/spandsp/v27ter_rx.h b/libs/spandsp/src/spandsp/v27ter_rx.h index 6b464b3d42..a6055844d6 100644 --- a/libs/spandsp/src/spandsp/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/v27ter_rx.h @@ -44,6 +44,12 @@ at the start of transmission, which makes the design of a V.27ter receiver relat straightforward. */ +#if defined(SPANDSP_USE_FIXED_POINT) +#define V27TER_CONSTELLATION_SCALING_FACTOR 1024.0 +#else +#define V27TER_CONSTELLATION_SCALING_FACTOR 1.0 +#endif + /*! V.27ter modem receive side descriptor. This defines the working state for a single instance of a V.27ter modem receiver. diff --git a/libs/spandsp/src/spandsp/v29rx.h b/libs/spandsp/src/spandsp/v29rx.h index bdcd23f944..bb52e624dc 100644 --- a/libs/spandsp/src/spandsp/v29rx.h +++ b/libs/spandsp/src/spandsp/v29rx.h @@ -118,6 +118,12 @@ scrambler register) cannot be trusted for the test. The receive modem, therefore, only tests that bits starting at bit 24 are really ones. */ +#if defined(SPANDSP_USE_FIXED_POINT) +#define V29_CONSTELLATION_SCALING_FACTOR 4096.0 +#else +#define V29_CONSTELLATION_SCALING_FACTOR 1.0 +#endif + #if defined(SPANDSP_USE_FIXED_POINT) typedef void (*qam_report_handler_t)(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol); #else diff --git a/libs/spandsp/src/v17rx.c b/libs/spandsp/src/v17rx.c index 27c568c46a..9d692a1548 100644 --- a/libs/spandsp/src/v17rx.c +++ b/libs/spandsp/src/v17rx.c @@ -202,10 +202,11 @@ SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs) { #if defined(SPANDSP_USE_FIXED_POINT) *coeffs = NULL; + return 0; #else *coeffs = s->eq_coeff; -#endif return V17_EQUALIZER_LEN; +#endif } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/modem_monitor.cpp b/libs/spandsp/tests/modem_monitor.cpp index a5ba73289f..db8a31a22d 100644 --- a/libs/spandsp/tests/modem_monitor.cpp +++ b/libs/spandsp/tests/modem_monitor.cpp @@ -52,10 +52,10 @@ #define SYMBOL_TRACKER_POINTS 12000 #define CARRIER_TRACKER_POINTS 12000 -#define FP_FACTOR 4096 - struct qam_monitor_s { + float constel_scaling; + Fl_Double_Window *w; Fl_Group *c_const; Fl_Group *c_right; @@ -189,14 +189,14 @@ int qam_monitor_update_equalizer(qam_monitor_t *s, const complexf_t *coeffs, int for (i = 0; i < len; i++) { s->eq_re_plot[2*i] = (i - len/2)/2.0; - s->eq_re_plot[2*i + 1] = coeffs[i].re; + s->eq_re_plot[2*i + 1] = coeffs[i].re*s->constel_scaling; if (min > coeffs[i].re) min = coeffs[i].re; if (max < coeffs[i].re) max = coeffs[i].re; s->eq_im_plot[2*i] = (i - len/2)/2.0; - s->eq_im_plot[2*i + 1] = coeffs[i].im; + s->eq_im_plot[2*i + 1] = coeffs[i].im*s->constel_scaling; if (min > coeffs[i].im) min = coeffs[i].im; if (max < coeffs[i].im) @@ -235,22 +235,22 @@ int qam_monitor_update_int_equalizer(qam_monitor_t *s, const complexi16_t *coeff max = coeffs[i].im; for (i = 0; i < len; i++) { - s->eq_re_plot[2*i] = (i - len/2)/2.0f; - s->eq_re_plot[2*i + 1] = coeffs[i].re/(float) FP_FACTOR; if (min > coeffs[i].re) min = coeffs[i].re; if (max < coeffs[i].re) max = coeffs[i].re; + s->eq_re_plot[2*i] = (i - len/2)/2.0f; + s->eq_re_plot[2*i + 1] = coeffs[i].re*s->constel_scaling; - s->eq_im_plot[2*i] = (i - len/2)/2.0f; - s->eq_im_plot[2*i + 1] = coeffs[i].im/(float) FP_FACTOR; if (min > coeffs[i].im) min = coeffs[i].im; if (max < coeffs[i].im) max = coeffs[i].im; + s->eq_im_plot[2*i] = (i - len/2)/2.0f; + s->eq_im_plot[2*i + 1] = coeffs[i].im*s->constel_scaling; } - min /= (float) FP_FACTOR; - max /= (float) FP_FACTOR; + min *= s->constel_scaling; + max *= s->constel_scaling; s->eq_x->minimum(-len/4.0); s->eq_x->maximum(len/4.0); @@ -286,21 +286,21 @@ int qam_monitor_update_symbol_tracking(qam_monitor_t *s, float total_correction) max = s->symbol_tracker[0]; for (i = s->symbol_track_ptr, j = 0; i < s->symbol_track_points; i++, j++) { - s->symbol_track_plot[2*j] = j; - s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i]; if (min > s->symbol_tracker[i]) min = s->symbol_tracker[i]; if (max < s->symbol_tracker[i]) max = s->symbol_tracker[i]; + s->symbol_track_plot[2*j] = j; + s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i]; } for (i = 0; i < s->symbol_track_ptr; i++, j++) { - s->symbol_track_plot[2*j] = j; - s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i]; if (min > s->symbol_tracker[i]) min = s->symbol_tracker[i]; if (max < s->symbol_tracker[i]) max = s->symbol_tracker[i]; + s->symbol_track_plot[2*j] = j; + s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i]; } s->symbol_track_y->maximum((fabs(max - min) < 0.05) ? max + 0.05 : max); s->symbol_track_y->minimum(min); @@ -379,7 +379,7 @@ int qam_monitor_update_carrier_tracking(qam_monitor_t *s, float carrier_freq) } /*- End of function --------------------------------------------------------*/ -qam_monitor_t *qam_monitor_init(float constel_width, const char *tag) +qam_monitor_t *qam_monitor_init(float constel_width, float constel_scaling, const char *tag) { char buf[132 + 1]; float x; @@ -391,6 +391,8 @@ qam_monitor_t *qam_monitor_init(float constel_width, const char *tag) s->w = new Fl_Double_Window(905, 400, (tag) ? tag : "QAM monitor"); + s->constel_scaling = 1.0/constel_scaling; + s->c_const = new Fl_Group(0, 0, 380, 400); s->c_const->box(FL_DOWN_BOX); s->c_const->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); diff --git a/libs/spandsp/tests/modem_monitor.h b/libs/spandsp/tests/modem_monitor.h index b1b79fda06..3a3f896b8a 100644 --- a/libs/spandsp/tests/modem_monitor.h +++ b/libs/spandsp/tests/modem_monitor.h @@ -50,7 +50,7 @@ extern "C" { #endif -qam_monitor_t *qam_monitor_init(float constel_width, const char *tag); +qam_monitor_t *qam_monitor_init(float constel_width, float constel_scaling, const char *tag); int qam_monitor_clear_constel(qam_monitor_t *s); int qam_monitor_update_constel(qam_monitor_t *s, const complexf_t *pt); int qam_monitor_update_equalizer(qam_monitor_t *s, const complexf_t *coeffs, int len); diff --git a/libs/spandsp/tests/v17_tests.c b/libs/spandsp/tests/v17_tests.c index a974049a29..39b5a4a319 100644 --- a/libs/spandsp/tests/v17_tests.c +++ b/libs/spandsp/tests/v17_tests.c @@ -133,14 +133,17 @@ static void v17_rx_status(void *user_data, int status) switch (status) { case SIG_STATUS_TRAINING_SUCCEEDED: - len = v17_rx_equalizer_state(s, &coeffs); - printf("Equalizer:\n"); - for (i = 0; i < len; i++) + printf("Training succeeded\n"); + if ((len = v17_rx_equalizer_state(s, &coeffs))) + { + printf("Equalizer:\n"); + for (i = 0; i < len; i++) #if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V17_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V17_CONSTELLATION_SCALING_FACTOR); #else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); #endif + } break; } } @@ -183,10 +186,11 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex int len; #if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; - complexf_t constel_point; #else complexf_t *coeffs; #endif + complexf_t constel_point; + complexf_t target_point; float fpower; v17_rx_state_t *rx; static float smooth_power = 0.0f; @@ -195,67 +199,56 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex rx = (v17_rx_state_t *) user_data; if (constel) { - fpower = (constel->re - target->re)*(constel->re - target->re) - + (constel->im - target->im)*(constel->im - target->im); -#if defined(SPANDSP_USE_FIXED_POINT) - fpower /= 4096.0*4096.0; -#endif + constel_point.re = constel->re/V17_CONSTELLATION_SCALING_FACTOR; + constel_point.im = constel->im/V17_CONSTELLATION_SCALING_FACTOR; + target_point.re = target->re/V17_CONSTELLATION_SCALING_FACTOR, + target_point.im = target->im/V17_CONSTELLATION_SCALING_FACTOR, + fpower = (constel_point.re - target_point.re)*(constel_point.re - target_point.re) + + (constel_point.im - target_point.im)*(constel_point.im - target_point.im); smooth_power = 0.95f*smooth_power + 0.05f*fpower; #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINT) - constel_point.re = constel->re/4096.0; - constel_point.im = constel->im/4096.0; qam_monitor_update_constel(qam_monitor, &constel_point); -#else - qam_monitor_update_constel(qam_monitor, constel); -#endif qam_monitor_update_carrier_tracking(qam_monitor, v17_rx_carrier_frequency(rx)); qam_monitor_update_symbol_tracking(qam_monitor, v17_rx_symbol_timing_correction(rx)); } #endif printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", symbol_no, -#if defined(SPANDSP_USE_FIXED_POINT) - constel->re/4096.0, - constel->im/4096.0, - target->re/4096.0, - target->im/4096.0, -#else - constel->re, - constel->im, - target->re, - target->im, -#endif + constel_point.re, + constel_point.im, + target_point.re, + target_point.im, symbol, fpower, smooth_power, v17_rx_carrier_frequency(rx), v17_rx_signal_power(rx), v17_rx_symbol_timing_correction(rx)); - //printf("Carrier %d %f %f\n", symbol_no, v17_rx_carrier_frequency(rx), v17_rx_symbol_timing_correction(rx)); symbol_no++; if (--update_interval <= 0) { - len = v17_rx_equalizer_state(rx, &coeffs); - printf("Equalizer A:\n"); - for (i = 0; i < len; i++) + if ((len = v17_rx_equalizer_state(rx, &coeffs))) + { + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) #if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V17_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V17_CONSTELLATION_SCALING_FACTOR); #else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); #endif #if defined(ENABLE_GUI) - if (use_gui) - { + if (use_gui) + { #if defined(SPANDSP_USE_FIXED_POINT) - qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); + qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else - qam_monitor_update_equalizer(qam_monitor, coeffs, len); + qam_monitor_update_equalizer(qam_monitor, coeffs, len); +#endif + } #endif } -#endif update_interval = 100; } } @@ -481,7 +474,7 @@ int main(int argc, char *argv[]) #if defined(ENABLE_GUI) if (use_gui) { - qam_monitor = qam_monitor_init(10.0f, NULL); + qam_monitor = qam_monitor_init(10.0f, V17_CONSTELLATION_SCALING_FACTOR, NULL); if (!decode_test_file) { start_line_model_monitor(129); diff --git a/libs/spandsp/tests/v22bis_tests.c b/libs/spandsp/tests/v22bis_tests.c index 23515f4038..f9604554d0 100644 --- a/libs/spandsp/tests/v22bis_tests.c +++ b/libs/spandsp/tests/v22bis_tests.c @@ -129,14 +129,16 @@ static void v22bis_rx_status(void *user_data, int status) case SIG_STATUS_TRAINING_SUCCEEDED: bit_rate = v22bis_get_current_bit_rate(s->v22bis); printf("Negotiated bit rate: %d\n", bit_rate); - len = v22bis_rx_equalizer_state(s->v22bis, &coeffs); - printf("Equalizer:\n"); - for (i = 0; i < len; i++) + if ((len = v22bis_rx_equalizer_state(s->v22bis, &coeffs))) + { + printf("Equalizer:\n"); + for (i = 0; i < len; i++) #if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V22BIS_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V22BIS_CONSTELLATION_SCALING_FACTOR); #else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); #endif + } break; } } @@ -181,26 +183,25 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex int len; #if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; - complexf_t constel_point; #else complexf_t *coeffs; #endif + complexf_t constel_point; + complexf_t target_point; float fpower; endpoint_t *s; s = (endpoint_t *) user_data; if (constel) { + constel_point.re = constel->re/V22BIS_CONSTELLATION_SCALING_FACTOR; + constel_point.im = constel->im/V22BIS_CONSTELLATION_SCALING_FACTOR; + target_point.re = target->re/V22BIS_CONSTELLATION_SCALING_FACTOR; + target_point.im = target->im/V22BIS_CONSTELLATION_SCALING_FACTOR; #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINT) - constel_point.re = constel->re/1024.0; - constel_point.im = constel->im/1024.0; qam_monitor_update_constel(s->qam_monitor, &constel_point); -#else - qam_monitor_update_constel(s->qam_monitor, constel); -#endif qam_monitor_update_carrier_tracking(s->qam_monitor, v22bis_rx_carrier_frequency(s->v22bis)); qam_monitor_update_symbol_tracking(s->qam_monitor, v22bis_rx_symbol_timing_correction(s->v22bis)); } @@ -211,17 +212,10 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %8.4f\n", s->symbol_no, -#if defined(SPANDSP_USE_FIXED_POINT) - constel->re/1024.0, - constel->im/1024.0, - target->re/1024.0, - target->im/1024.0, -#else - constel->re, - constel->im, - target->re, - target->im, -#endif + constel_point.re, + constel_point.im, + target_point.re, + target_point.im, symbol, fpower, s->smooth_power, @@ -231,24 +225,26 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex else { printf("Gardner step %d\n", symbol); - len = v22bis_rx_equalizer_state(s->v22bis, &coeffs); - printf("Equalizer A:\n"); - for (i = 0; i < len; i++) + if ((len = v22bis_rx_equalizer_state(s->v22bis, &coeffs))) + { + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) #if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V22BIS_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V22BIS_CONSTELLATION_SCALING_FACTOR); #else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); #endif #if defined(ENABLE_GUI) - if (use_gui) - { + if (use_gui) + { #if defined(SPANDSP_USE_FIXED_POINT) - qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len); + qam_monitor_update_int_equalizer(s->qam_monitor, coeffs, len); #else - qam_monitor_update_equalizer(s->qam_monitor, coeffs, len); + qam_monitor_update_equalizer(s->qam_monitor, coeffs, len); +#endif + } #endif } -#endif } } /*- End of function --------------------------------------------------------*/ @@ -381,8 +377,8 @@ int main(int argc, char *argv[]) #if defined(ENABLE_GUI) if (use_gui) { - endpoint[0].qam_monitor = qam_monitor_init(6.0f, "Calling modem"); - endpoint[1].qam_monitor = qam_monitor_init(6.0f, "Answering modem"); + endpoint[0].qam_monitor = qam_monitor_init(6.0f, V22BIS_CONSTELLATION_SCALING_FACTOR, "Calling modem"); + endpoint[1].qam_monitor = qam_monitor_init(6.0f, V22BIS_CONSTELLATION_SCALING_FACTOR, "Answering modem"); } #endif if ((model = both_ways_line_model_init(line_model_no, diff --git a/libs/spandsp/tests/v27ter_tests.c b/libs/spandsp/tests/v27ter_tests.c index 0d63023cc0..db5a13d29f 100644 --- a/libs/spandsp/tests/v27ter_tests.c +++ b/libs/spandsp/tests/v27ter_tests.c @@ -129,14 +129,16 @@ static void v27ter_rx_status(void *user_data, int status) switch (status) { case SIG_STATUS_TRAINING_SUCCEEDED: - len = v27ter_rx_equalizer_state(s, &coeffs); - printf("Equalizer:\n"); - for (i = 0; i < len; i++) + if ((len = v27ter_rx_equalizer_state(s, &coeffs))) + { + printf("Equalizer:\n"); + for (i = 0; i < len; i++) #if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V27TER_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V27TER_CONSTELLATION_SCALING_FACTOR); #else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); #endif + } break; } } @@ -179,115 +181,94 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex int len; #if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; - complexf_t constel_point; #else complexf_t *coeffs; #endif + complexf_t constel_point; + complexf_t target_point; float fpower; float error; v27ter_rx_state_t *rx; static float smooth_power = 0.0f; -#if defined(ENABLE_GUI) - static int reports = 0; -#endif + static int update_interval = 100; rx = (v27ter_rx_state_t *) user_data; if (constel) { - fpower = (constel->re - target->re)*(constel->re - target->re) - + (constel->im - target->im)*(constel->im - target->im); -#if defined(SPANDSP_USE_FIXED_POINT) - fpower /= 1024.0*1024.0; -#endif + constel_point.re = constel->re/V27TER_CONSTELLATION_SCALING_FACTOR; + constel_point.im = constel->im/V27TER_CONSTELLATION_SCALING_FACTOR; + target_point.re = target->re/V27TER_CONSTELLATION_SCALING_FACTOR; + target_point.im = target->im/V27TER_CONSTELLATION_SCALING_FACTOR; + fpower = (constel_point.re - target_point.re)*(constel_point.re - target_point.re) + + (constel_point.im - target_point.im)*(constel_point.im - target_point.im); smooth_power = 0.95f*smooth_power + 0.05f*fpower; #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINT) - constel_point.re = constel->re/1024.0; - constel_point.im = constel->im/1024.0; qam_monitor_update_constel(qam_monitor, &constel_point); -#else - qam_monitor_update_constel(qam_monitor, constel); -#endif qam_monitor_update_carrier_tracking(qam_monitor, v27ter_rx_carrier_frequency(rx)); qam_monitor_update_symbol_tracking(qam_monitor, v27ter_rx_symbol_timing_correction(rx)); } #endif error = constel->im*target->re - constel->re*target->im; -#if defined(SPANDSP_USE_FIXED_POINT) - printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re/1024.0, constel->im/1024.0, target->re/1024.0, target->im/1024.0); -#else - printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel->re, constel->im, target->re, target->im); -#endif + printf("Tracking error %f %f %f %f %f %f\n", error, v27ter_rx_carrier_frequency(rx), constel_point.re, constel_point.im, target_point.re, target_point.im); printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", symbol_no, -#if defined(SPANDSP_USE_FIXED_POINT) - constel->re/1024.0, - constel->im/1024.0, - target->re/1024.0, - target->im/1024.0, -#else - constel->re, - constel->im, - target->re, - target->im, -#endif + constel_point.re, + constel_point.im, + target_point.re, + target_point.im, symbol, fpower, smooth_power, v27ter_rx_carrier_frequency(rx), v27ter_rx_signal_power(rx), v27ter_rx_symbol_timing_correction(rx)); - len = v27ter_rx_equalizer_state(rx, &coeffs); - printf("Equalizer B:\n"); - for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); -#else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); -#endif -#if defined(WITH_SPANDSP_INTERNALS) - printf("Gardtest %d %f %d\n", symbol_no, v27ter_rx_symbol_timing_correction(rx), rx->gardner_integrate); -#endif - printf("Carcar %d %f\n", symbol_no, v27ter_rx_carrier_frequency(rx)); -#if defined(ENABLE_GUI) - if (use_gui) + symbol_no++; + if (--update_interval <= 0) { - if (++reports >= 1000) + if ((len = v27ter_rx_equalizer_state(rx, &coeffs))) + { + printf("Equalizer B:\n"); + for (i = 0; i < len; i++) + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V27TER_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V27TER_CONSTELLATION_SCALING_FACTOR); +#if defined(ENABLE_GUI) + if (use_gui) + { +#if defined(SPANDSP_USE_FIXED_POINT) + qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); +#else + qam_monitor_update_equalizer(qam_monitor, coeffs, len); +#endif + } + } + update_interval = 100; + } +#endif + } + else + { + printf("Gardner step %d\n", symbol); + if ((len = v27ter_rx_equalizer_state(rx, &coeffs))) + { + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) +#if defined(SPANDSP_USE_FIXED_POINT) + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V27TER_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V27TER_CONSTELLATION_SCALING_FACTOR); +#else + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#endif +#if defined(ENABLE_GUI) + if (use_gui) { #if defined(SPANDSP_USE_FIXED_POINT) qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else qam_monitor_update_equalizer(qam_monitor, coeffs, len); #endif - reports = 0; } - } -#endif - symbol_no++; - } - else - { - printf("Gardner step %d\n", symbol); - len = v27ter_rx_equalizer_state(rx, &coeffs); - printf("Equalizer A:\n"); - for (i = 0; i < len; i++) -#if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/1024.0f, coeffs[i].im/1024.0f); -#else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); -#endif -#if defined(ENABLE_GUI) - if (use_gui) - { -#if defined(SPANDSP_USE_FIXED_POINT) - qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); -#else - qam_monitor_update_equalizer(qam_monitor, coeffs, len); #endif } -#endif } } /*- End of function --------------------------------------------------------*/ @@ -497,7 +478,7 @@ int main(int argc, char *argv[]) #if defined(ENABLE_GUI) if (use_gui) { - qam_monitor = qam_monitor_init(2.0f, NULL); + qam_monitor = qam_monitor_init(2.0f, V27TER_CONSTELLATION_SCALING_FACTOR, NULL); if (!decode_test_file) { start_line_model_monitor(129); diff --git a/libs/spandsp/tests/v29_tests.c b/libs/spandsp/tests/v29_tests.c index 1252a4fc4b..c7335b08ec 100644 --- a/libs/spandsp/tests/v29_tests.c +++ b/libs/spandsp/tests/v29_tests.c @@ -129,14 +129,16 @@ static void v29_rx_status(void *user_data, int status) { case SIG_STATUS_TRAINING_SUCCEEDED: printf("Training succeeded\n"); - len = v29_rx_equalizer_state(s, &coeffs); - printf("Equalizer:\n"); - for (i = 0; i < len; i++) + if ((len = v29_rx_equalizer_state(s, &coeffs))) + { + printf("Equalizer:\n"); + for (i = 0; i < len; i++) #if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V29_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V29_CONSTELLATION_SCALING_FACTOR); #else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); #endif + } break; } } @@ -179,10 +181,11 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex int len; #if defined(SPANDSP_USE_FIXED_POINT) complexi16_t *coeffs; - complexf_t constel_point; #else complexf_t *coeffs; #endif + complexf_t constel_point; + complexf_t target_point; float fpower; v29_rx_state_t *rx; static float smooth_power = 0.0f; @@ -191,22 +194,17 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex rx = (v29_rx_state_t *) user_data; if (constel) { - fpower = (constel->re - target->re)*(constel->re - target->re) - + (constel->im - target->im)*(constel->im - target->im); -#if defined(SPANDSP_USE_FIXED_POINT) - fpower /= 4096.0*4096.0; -#endif + constel_point.re = constel->re/V29_CONSTELLATION_SCALING_FACTOR; + constel_point.im = constel->im/V29_CONSTELLATION_SCALING_FACTOR; + target_point.re = target->re/V29_CONSTELLATION_SCALING_FACTOR, + target_point.im = target->im/V29_CONSTELLATION_SCALING_FACTOR, + fpower = (constel_point.re - target_point.re)*(constel_point.re - target_point.re) + + (constel_point.im - target_point.im)*(constel_point.im - target_point.im); smooth_power = 0.95f*smooth_power + 0.05f*fpower; #if defined(ENABLE_GUI) if (use_gui) { -#if defined(SPANDSP_USE_FIXED_POINT) - constel_point.re = constel->re/4096.0; - constel_point.im = constel->im/4096.0; qam_monitor_update_constel(qam_monitor, &constel_point); -#else - qam_monitor_update_constel(qam_monitor, constel); -#endif qam_monitor_update_carrier_tracking(qam_monitor, v29_rx_carrier_frequency(rx)); //qam_monitor_update_carrier_tracking(qam_monitor, (fpower) ? fpower : 0.001f); qam_monitor_update_symbol_tracking(qam_monitor, v29_rx_symbol_timing_correction(rx)); @@ -214,17 +212,10 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex #endif printf("%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f\n", symbol_no, -#if defined(SPANDSP_USE_FIXED_POINT) - constel->re/4096.0, - constel->im/4096.0, - target->re/4096.0, - target->im/4096.0, -#else - constel->re, - constel->im, - target->re, - target->im, -#endif + constel_point.re, + constel_point.im, + target_point.re, + target_point.im, symbol, fpower, smooth_power, @@ -234,24 +225,26 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex symbol_no++; if (--update_interval <= 0) { - len = v29_rx_equalizer_state(rx, &coeffs); - printf("Equalizer A:\n"); - for (i = 0; i < len; i++) + if ((len = v29_rx_equalizer_state(rx, &coeffs))) + { + printf("Equalizer A:\n"); + for (i = 0; i < len; i++) #if defined(SPANDSP_USE_FIXED_POINT) - printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/4096.0f, coeffs[i].im/4096.0f); + printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V29_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V29_CONSTELLATION_SCALING_FACTOR); #else - printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); #endif #if defined(ENABLE_GUI) - if (use_gui) - { + if (use_gui) + { #if defined(SPANDSP_USE_FIXED_POINT) - qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); + qam_monitor_update_int_equalizer(qam_monitor, coeffs, len); #else - qam_monitor_update_equalizer(qam_monitor, coeffs, len); + qam_monitor_update_equalizer(qam_monitor, coeffs, len); +#endif + } #endif } -#endif update_interval = 100; } } @@ -470,7 +463,7 @@ int main(int argc, char *argv[]) #if defined(ENABLE_GUI) if (use_gui) { - qam_monitor = qam_monitor_init(6.0f, NULL); + qam_monitor = qam_monitor_init(6.0f, V29_CONSTELLATION_SCALING_FACTOR, NULL); if (!decode_test_file) { start_line_model_monitor(129); From 8eb36ec92de8b172dba6b1d075b4fca4544fa40d Mon Sep 17 00:00:00 2001 From: William King Date: Sun, 5 Aug 2012 12:01:33 -0400 Subject: [PATCH 0845/1057] DelphiWorld found another typo. Also remove the condition for auth since all dialplan lookups should be authed to prevent fraud. --- src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml b/src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml index d4c74539a1..4085a68de0 100644 --- a/src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml +++ b/src/mod/xml_int/mod_xml_radius/00_dialplan_auth.xml @@ -1,19 +1,19 @@ - + - - + + - - + + From 996c5378a1d0a97d057d27a041f9aa2ac4785000 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 5 Aug 2012 16:45:14 -0500 Subject: [PATCH 0846/1057] 4579 tweaks --- src/mod/endpoints/mod_sofia/sofia.c | 13 +++++++---- src/mod/endpoints/mod_sofia/sofia_presence.c | 23 ++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c7464e20bd..a3add9c434 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1263,10 +1263,15 @@ static void our_sofia_event_callback(nua_event_t event, referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_referred_by), 0); ref_by_user = sip->sip_referred_by->b_url->url_user; } + else if(sip->sip_to && sip->sip_to->a_url) + { + referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_to), 0); + ref_by_user = sip->sip_to->a_url->url_user; + } - if (sip->sip_request && sip->sip_request->rq_url) { - req_user = sip->sip_request->rq_url->url_user; - req_host = sip->sip_request->rq_url->url_host; + if (sip->sip_to && sip->sip_to->a_url) { + req_user = sip->sip_to->a_url->url_user; + req_host = sip->sip_to->a_url->url_host; } if (switch_event_create(&event, SWITCH_EVENT_CALL_SETUP_REQ) == SWITCH_STATUS_SUCCESS) { @@ -1355,7 +1360,7 @@ static void our_sofia_event_callback(nua_event_t event, sip_to_tag(nh->nh_home, sip->sip_to, to_tag); } - nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END()); + nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_TO(sip->sip_to), NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END()); switch_safe_free(method); switch_safe_free(full_url); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f116cd2ee0..23db7d0094 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -930,20 +930,6 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } - - if (switch_true(final)) { - sql = switch_mprintf("delete from sip_subscriptions where " - "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'", - mod_sofia_globals.hostname, profile->name, - from_user, from_host, event_str); - - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - } - - - - - if (call_id) { sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, " "'%q' as ct,'%q' as pt " @@ -968,6 +954,15 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event } sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_send_sql, &cb); + + if (switch_true(final)) { + sql = switch_mprintf("delete from sip_subscriptions where " + "hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'", + mod_sofia_globals.hostname, profile->name, + from_user, from_host, event_str); + + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } switch_safe_free(sql); } From d8b9ccef0dba86cbd6dfa894893e17b03acc28ea Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Sun, 5 Aug 2012 16:08:01 -0700 Subject: [PATCH 0847/1057] Update ChangeLog through Jan 2012 --- docs/ChangeLog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index 65588c761a..3b02aca654 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,17 +1,29 @@ freeswitch (1.2.0) config: add screen_confirm macro to lang/en/ivr/sounds.xml (r:9ea3ce66) config: support for --with-logfilesdir, --with-dbdir, --with-htdocsdir, --with-soundsdir, --with-grammardir, --with-scriptdir and --with-recordin + config: Redo config files, example - mv conf/* -> conf/vanilla/* (r:ee71daa1) gsdir (r:7ae3f5b7/FS-302) core: Add RECORD_STEREO_SWAP to reverse the record channels (r:d5042f2c/FS-3069) core: api_on_startup (r:e164b76c) + core: allow dmachine and input callback to co-exist (r:e185ff00) + core: add support for configurable timeout and passing of args to play_and_detect_speech (r:410e523c) + core: partial with renaming (r:24288832/FS-2216) mod_conference: Add auto-record filename to conference_recording channel variable and ability to pull filename from API (r:b9295fd5/FS-1573) mod_conference: Convenience feature in mod_conference: apply sub cmds to non_moderator members (r:04295ac9/FS-3249) mod_conference: New conference commands: get and set (r:ab5f3f28/FS-3254) mod_commands: allow system API command to capture output from the executed command (r:d7a37e97) + mod_fax: moved to deprecated list + mod_httapi: mod_httapi.c -- HT-TAPI Hypertext Telephony API (Twillio FreeSWITCH style) (r:bc8cbee1) + mod_isac: add mod_iSAC (extracted from webRTC) 16hz @30ms,60ms 32khz @30ms (r:a0473cda) mod_posix_timer: New timer module mod_posix_timer (r:9d7e9e67/FS-3731) mod_sofia: Add presence-privacy parameter to exclude extension numbers from the distributed presence string (r:c6633fa3/FS-849) + mod_sofia: Reverse data in dialog-info so the proto is in the params not in the user because polycom uses the target uri for what to dial and stips the params (r:cdb4b29a) + mod_sofia: add registration-thread-frequency param (r:5b7e2013) + mod_sofia: add support for yealink display update (r:39c4e7a3) + mod_sofia: added a new param to the gateway config called options_user_agent to set something specific (r:f25c5aaf/FS-3842) mod_spandsp: Add T31 modem support to mod_spandsp - similar to iaxmodem only wired into FS. Also merge configs into single spandsp.conf.xml --see in tree example-- (r:d91f67d0) mod_valet_parking: add orbit feature to valet_parking similar to mod_fifo (r:09725e2b) + mod_voicemail: vm_read should mark messages as read, but not saved (r:693f2986) freeswitch (1.0.7) From 2a500116de5ab35a99c1319557ee093bdf863cec Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Sun, 5 Aug 2012 16:32:12 -0700 Subject: [PATCH 0848/1057] Update ChangeLog through Feb 2012 --- docs/ChangeLog | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/ChangeLog b/docs/ChangeLog index 3b02aca654..b2c6507fcf 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,13 +1,17 @@ freeswitch (1.2.0) + build: Automated builds for CI testing/Jenkins (r:2aff535a) config: add screen_confirm macro to lang/en/ivr/sounds.xml (r:9ea3ce66) config: support for --with-logfilesdir, --with-dbdir, --with-htdocsdir, --with-soundsdir, --with-grammardir, --with-scriptdir and --with-recordin config: Redo config files, example - mv conf/* -> conf/vanilla/* (r:ee71daa1) + config: clean up switch.conf and add all the missing options needs more docs (r:65fc2f8a) gsdir (r:7ae3f5b7/FS-302) core: Add RECORD_STEREO_SWAP to reverse the record channels (r:d5042f2c/FS-3069) core: api_on_startup (r:e164b76c) core: allow dmachine and input callback to co-exist (r:e185ff00) core: add support for configurable timeout and passing of args to play_and_detect_speech (r:410e523c) core: partial with renaming (r:24288832/FS-2216) + core: only flush on break when its a blocking situation (r:3a076786) + mod_commands: Add "file_exists" API (r:7eba3f2b/FS-3927) mod_conference: Add auto-record filename to conference_recording channel variable and ability to pull filename from API (r:b9295fd5/FS-1573) mod_conference: Convenience feature in mod_conference: apply sub cmds to non_moderator members (r:04295ac9/FS-3249) mod_conference: New conference commands: get and set (r:ab5f3f28/FS-3254) @@ -21,10 +25,16 @@ freeswitch (1.2.0) mod_sofia: add registration-thread-frequency param (r:5b7e2013) mod_sofia: add support for yealink display update (r:39c4e7a3) mod_sofia: added a new param to the gateway config called options_user_agent to set something specific (r:f25c5aaf/FS-3842) + mod_sofia: produce sip_full_via var (r:23dcdbd8) + mod_sofia: add presence-disable-early sofia option to send non-specifc presence messages w/o special case for early (r:9b023152) + mod_sofia: add sdp_secure_savp_only channel variable for silly asterisk srtp that only has the SAVP or cries (r:50727f56) + mod_sofia: allow publish with no contact (r:b843911c) mod_spandsp: Add T31 modem support to mod_spandsp - similar to iaxmodem only wired into FS. Also merge configs into single spandsp.conf.xml --see in tree example-- (r:d91f67d0) mod_valet_parking: add orbit feature to valet_parking similar to mod_fifo (r:09725e2b) + mod_vlc: Adding mod_vlc initial working version (r:77f3bd24) mod_voicemail: vm_read should mark messages as read, but not saved (r:693f2986) - + mod_voicemail: Change vm_announce_cid to be true/false and utilize vm_play_phone_number_macro (r:18289fa0) + mod_voicemail: fire event with result of vm auth attempt (r:0a6dde7b) freeswitch (1.0.7) build: Add mod_silk to windows build From b560ff6d8326deb412bfe924fe4d57e5caa6bbb6 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Sun, 5 Aug 2012 17:24:02 -0700 Subject: [PATCH 0849/1057] Update ChangeLog through April 2012 --- docs/ChangeLog | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/ChangeLog b/docs/ChangeLog index b2c6507fcf..99abeabf9a 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,9 +1,12 @@ freeswitch (1.2.0) build: Automated builds for CI testing/Jenkins (r:2aff535a) + build: add debian source package building script (r:c164aae9) config: add screen_confirm macro to lang/en/ivr/sounds.xml (r:9ea3ce66) config: support for --with-logfilesdir, --with-dbdir, --with-htdocsdir, --with-soundsdir, --with-grammardir, --with-scriptdir and --with-recordin config: Redo config files, example - mv conf/* -> conf/vanilla/* (r:ee71daa1) config: clean up switch.conf and add all the missing options needs more docs (r:65fc2f8a) + config: add cdr_csv template for OpenCDRRate (r:ca60afaa) + config: add conference_flags to config; mention 'audio-always' option - FreeSWITCH Jira gsdir (r:7ae3f5b7/FS-302) core: Add RECORD_STEREO_SWAP to reverse the record channels (r:d5042f2c/FS-3069) core: api_on_startup (r:e164b76c) @@ -11,7 +14,14 @@ freeswitch (1.2.0) core: add support for configurable timeout and passing of args to play_and_detect_speech (r:410e523c) core: partial with renaming (r:24288832/FS-2216) core: only flush on break when its a blocking situation (r:3a076786) - mod_commands: Add "file_exists" API (r:7eba3f2b/FS-3927) + core: In tone_detect all specs work, not just the first one detected (r:d5ad8670/FS-4023) + core: add origination_nested_vars=true to allow vars within vars in originate strings e.g. [originate {origination_nested_vars=true,TEST=,var=,recur=W00t}user/1004 3000] will end up as w00t (r:385a92ce) + core: add core-db-pre-trans-execute and core-db-post-trans-execute to switch.conf.xml to wrap sql stmts around the core transactions (r:21b1ffbf) + libesl: shutdown socket before closing to avoid blocking (r:c41a16d4) + libzrtp: FreeSWITCH is now the official home of ZRTP code + fs_cli: set session loglevel as well in fs_cli when doing 'console loglevel info' also now implies '/log info' locally (r:b80a3a34) + mod_commands: Add "file_exists" API (r:7eba3f2b/FS-3927) + mod_commands: add fsctl debug sql (r:d655ceec) mod_conference: Add auto-record filename to conference_recording channel variable and ability to pull filename from API (r:b9295fd5/FS-1573) mod_conference: Convenience feature in mod_conference: apply sub cmds to non_moderator members (r:04295ac9/FS-3249) mod_conference: New conference commands: get and set (r:ab5f3f28/FS-3254) @@ -29,6 +39,11 @@ freeswitch (1.2.0) mod_sofia: add presence-disable-early sofia option to send non-specifc presence messages w/o special case for early (r:9b023152) mod_sofia: add sdp_secure_savp_only channel variable for silly asterisk srtp that only has the SAVP or cries (r:50727f56) mod_sofia: allow publish with no contact (r:b843911c) + mod_sofia: add some defensive code to allow support for yealink in SCA mode even when its broken (r:17cb6a22) + mod_sofia: add user_via to ack in case with track calls (r:f558247d) + mod_sofia: one msg thread per cpu by default (r:6f6765b8) + mod_sofia: mirror back record-route header in options (r:ef9dfe42) + mod_sofia: add sip_require_timer=true variable to enable require timer on session refresh that breaks finicky endpoints (r:b553d62f) mod_spandsp: Add T31 modem support to mod_spandsp - similar to iaxmodem only wired into FS. Also merge configs into single spandsp.conf.xml --see in tree example-- (r:d91f67d0) mod_valet_parking: add orbit feature to valet_parking similar to mod_fifo (r:09725e2b) mod_vlc: Adding mod_vlc initial working version (r:77f3bd24) From 577d67e8e4bab17673afa6f66809a3eefd41883c Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Sun, 5 Aug 2012 17:44:53 -0700 Subject: [PATCH 0850/1057] Update ChangeLog through May 2012 --- docs/ChangeLog | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/ChangeLog b/docs/ChangeLog index 99abeabf9a..9b618d7b9b 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,6 +1,7 @@ freeswitch (1.2.0) build: Automated builds for CI testing/Jenkins (r:2aff535a) build: add debian source package building script (r:c164aae9) + build: add convenience script to set version in configure.in (r:efc6f16c) config: add screen_confirm macro to lang/en/ivr/sounds.xml (r:9ea3ce66) config: support for --with-logfilesdir, --with-dbdir, --with-htdocsdir, --with-soundsdir, --with-grammardir, --with-scriptdir and --with-recordin config: Redo config files, example - mv conf/* -> conf/vanilla/* (r:ee71daa1) @@ -17,6 +18,7 @@ freeswitch (1.2.0) core: In tone_detect all specs work, not just the first one detected (r:d5ad8670/FS-4023) core: add origination_nested_vars=true to allow vars within vars in originate strings e.g. [originate {origination_nested_vars=true,TEST=,var=,recur=W00t}user/1004 3000] will end up as w00t (r:385a92ce) core: add core-db-pre-trans-execute and core-db-post-trans-execute to switch.conf.xml to wrap sql stmts around the core transactions (r:21b1ffbf) + core: abstract out originate_signal_bond to a function to avoid confustion and regressions (r:8bb55ed4) libesl: shutdown socket before closing to avoid blocking (r:c41a16d4) libzrtp: FreeSWITCH is now the official home of ZRTP code fs_cli: set session loglevel as well in fs_cli when doing 'console loglevel info' also now implies '/log info' locally (r:b80a3a34) @@ -25,11 +27,16 @@ freeswitch (1.2.0) mod_conference: Add auto-record filename to conference_recording channel variable and ability to pull filename from API (r:b9295fd5/FS-1573) mod_conference: Convenience feature in mod_conference: apply sub cmds to non_moderator members (r:04295ac9/FS-3249) mod_conference: New conference commands: get and set (r:ab5f3f28/FS-3254) + mod_conference: Mirrored video when alone in conference (r:086cbf1b/FS-4176) + mod_conference: add outcall_flags (r:090345de) mod_commands: allow system API command to capture output from the executed command (r:d7a37e97) - mod_fax: moved to deprecated list + mod_dptools: add video_refresh dp and uuid_video_refresh fsapi (r:99bac0d0) + mod_fax: Deprecated and now removed from tree mod_httapi: mod_httapi.c -- HT-TAPI Hypertext Telephony API (Twillio FreeSWITCH style) (r:bc8cbee1) mod_isac: add mod_iSAC (extracted from webRTC) 16hz @30ms,60ms 32khz @30ms (r:a0473cda) + mod_loopback: allow mod loopback bowout to reach out across stacked loopback bridges and remove all of them (r:ad7149bf) mod_posix_timer: New timer module mod_posix_timer (r:9d7e9e67/FS-3731) + mod_say_fa: Initial commit of Farsi say module (r:18ee7ce3) mod_sofia: Add presence-privacy parameter to exclude extension numbers from the distributed presence string (r:c6633fa3/FS-849) mod_sofia: Reverse data in dialog-info so the proto is in the params not in the user because polycom uses the target uri for what to dial and stips the params (r:cdb4b29a) mod_sofia: add registration-thread-frequency param (r:5b7e2013) @@ -44,12 +51,21 @@ freeswitch (1.2.0) mod_sofia: one msg thread per cpu by default (r:6f6765b8) mod_sofia: mirror back record-route header in options (r:ef9dfe42) mod_sofia: add sip_require_timer=true variable to enable require timer on session refresh that breaks finicky endpoints (r:b553d62f) + mod_sofia: Channel var now takes precedence over the profile setting (r:ca39f15a) + mod_sofia: re-implement sla barge using eavesdrop backend (r:a511ff30) + mod_sofia: add inbound-reg-in-new-thread sofia param to launch a new thread to process each new inbound register when using heavier backends (r:0a5a057c) + mod_sofia: add mwi-use-reg-callid (r:792b004f) + mod_sofia: block any inbound messages when queue is full; add debounce for mwi and pres on register; fix missing detach attr on new mode to process reg in new thread (r:fb790bc3) + mod_sofia: add metadata col to internal registrations table (r:192030c5) mod_spandsp: Add T31 modem support to mod_spandsp - similar to iaxmodem only wired into FS. Also merge configs into single spandsp.conf.xml --see in tree example-- (r:d91f67d0) mod_valet_parking: add orbit feature to valet_parking similar to mod_fifo (r:09725e2b) mod_vlc: Adding mod_vlc initial working version (r:77f3bd24) mod_voicemail: vm_read should mark messages as read, but not saved (r:693f2986) mod_voicemail: Change vm_announce_cid to be true/false and utilize vm_play_phone_number_macro (r:18289fa0) mod_voicemail: fire event with result of vm auth attempt (r:0a6dde7b) + mod_voicemail: Improved feedback to user when chaning vm passwords. (r:7b54701d) + mod_xml_scgi: add mod_xml_scgi (like xml_curl minus the web server direct to an application backend that supports the SCGI protocol) (r:d7cf0bbe) + freeswitch (1.0.7) build: Add mod_silk to windows build From 7ce3111114dde020fefcb988abf42b0d469c2714 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Sun, 5 Aug 2012 18:00:34 -0700 Subject: [PATCH 0851/1057] Update ChangeLog through June 2012 --- docs/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index 9b618d7b9b..471ad89653 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -19,6 +19,8 @@ freeswitch (1.2.0) core: add origination_nested_vars=true to allow vars within vars in originate strings e.g. [originate {origination_nested_vars=true,TEST=,var=,recur=W00t}user/1004 3000] will end up as w00t (r:385a92ce) core: add core-db-pre-trans-execute and core-db-post-trans-execute to switch.conf.xml to wrap sql stmts around the core transactions (r:21b1ffbf) core: abstract out originate_signal_bond to a function to avoid confustion and regressions (r:8bb55ed4) + core: update stun to more modern spec (r:c3094046) + core: add initial-event-threads to switch.conf.xml (r:7ec8fb43) libesl: shutdown socket before closing to avoid blocking (r:c41a16d4) libzrtp: FreeSWITCH is now the official home of ZRTP code fs_cli: set session loglevel as well in fs_cli when doing 'console loglevel info' also now implies '/log info' locally (r:b80a3a34) @@ -31,6 +33,7 @@ freeswitch (1.2.0) mod_conference: add outcall_flags (r:090345de) mod_commands: allow system API command to capture output from the executed command (r:d7a37e97) mod_dptools: add video_refresh dp and uuid_video_refresh fsapi (r:99bac0d0) + mod_dptools: allow silence for moh type on campon (r:13068f17) mod_fax: Deprecated and now removed from tree mod_httapi: mod_httapi.c -- HT-TAPI Hypertext Telephony API (Twillio FreeSWITCH style) (r:bc8cbee1) mod_isac: add mod_iSAC (extracted from webRTC) 16hz @30ms,60ms 32khz @30ms (r:a0473cda) @@ -57,6 +60,9 @@ freeswitch (1.2.0) mod_sofia: add mwi-use-reg-callid (r:792b004f) mod_sofia: block any inbound messages when queue is full; add debounce for mwi and pres on register; fix missing detach attr on new mode to process reg in new thread (r:fb790bc3) mod_sofia: add metadata col to internal registrations table (r:192030c5) + mod_sofia: allow ep_codec_string to draw from absolute_codec_string before the profile prefs (r:f685e4c5) + mod_sofia: put presence data in state events (r:75aab0ee) + mod_sofia: add sip_recovery_break_rfc variable to set globally or per channel to not reverse the from and 2 on uas re-invites (r:5f09b403) mod_spandsp: Add T31 modem support to mod_spandsp - similar to iaxmodem only wired into FS. Also merge configs into single spandsp.conf.xml --see in tree example-- (r:d91f67d0) mod_valet_parking: add orbit feature to valet_parking similar to mod_fifo (r:09725e2b) mod_vlc: Adding mod_vlc initial working version (r:77f3bd24) From e224b24fed4cf362d8911fb6f39a9b00ec71edb2 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Sun, 5 Aug 2012 21:54:57 -0700 Subject: [PATCH 0852/1057] Update ChangeLog through July 2012. (Hello from Chicago\!) --- docs/ChangeLog | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/ChangeLog b/docs/ChangeLog index 471ad89653..e0de248e87 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -21,19 +21,33 @@ freeswitch (1.2.0) core: abstract out originate_signal_bond to a function to avoid confustion and regressions (r:8bb55ed4) core: update stun to more modern spec (r:c3094046) core: add initial-event-threads to switch.conf.xml (r:7ec8fb43) + core: add enable-use-system-time param to switch.conf.xml (r:b1ae9746) + core: add execute_on_post_originate and api_on_post_originate to run on chosen newly originated channels vs execute_on_originate which runs on all candidates (r:bf20f524) + core: have sql thread manually subscribe to each event it cares about instead of every event and filtering it (r:6ea4c42c) + core: Add FreeSWITCH-Version string and Uptime-msec (uptime in *milliseconds*) to heartbeat events (r:a8efae99) + core: add core_uuid global variable to expose the runtime uuid (r:1d5b5f21) + core: add core-uuid attr to xml cdr tag (r:1dd4bd49) libesl: shutdown socket before closing to avoid blocking (r:c41a16d4) + libesl: add wait handler to forking code in ivrd (r:6c406aa0) libzrtp: FreeSWITCH is now the official home of ZRTP code fs_cli: set session loglevel as well in fs_cli when doing 'console loglevel info' also now implies '/log info' locally (r:b80a3a34) mod_commands: Add "file_exists" API (r:7eba3f2b/FS-3927) mod_commands: add fsctl debug sql (r:d655ceec) + mod_commands: show current process stack size from status command where supported (r:d32a72bc) + mod_commands: add fsctl sql start/stop for standby controls (r:46fee25d) + mod_commands: add api-expansion to switch.conf.xml and fsctl api_expansion command to control allowing apis to be expanded via variable expansion (r:293429f7) mod_conference: Add auto-record filename to conference_recording channel variable and ability to pull filename from API (r:b9295fd5/FS-1573) mod_conference: Convenience feature in mod_conference: apply sub cmds to non_moderator members (r:04295ac9/FS-3249) mod_conference: New conference commands: get and set (r:ab5f3f28/FS-3254) mod_conference: Mirrored video when alone in conference (r:086cbf1b/FS-4176) mod_conference: add outcall_flags (r:090345de) + mod_conference: add flags to conference xml_list and show also on conference list (r:8d6b64e0) mod_commands: allow system API command to capture output from the executed command (r:d7a37e97) + mod_dingaling: enable srtp for dingaling (r:68d9a83e) mod_dptools: add video_refresh dp and uuid_video_refresh fsapi (r:99bac0d0) - mod_dptools: allow silence for moh type on campon (r:13068f17) + mod_dptools: allow silence for moh type on campon (r:13068f17) + mod_erlang_event: accept binary in api and bgapi (r:f55f15c8) + mod_event_socket: add uuid to event socket apps (r:3708c962) mod_fax: Deprecated and now removed from tree mod_httapi: mod_httapi.c -- HT-TAPI Hypertext Telephony API (Twillio FreeSWITCH style) (r:bc8cbee1) mod_isac: add mod_iSAC (extracted from webRTC) 16hz @30ms,60ms 32khz @30ms (r:a0473cda) @@ -63,7 +77,9 @@ freeswitch (1.2.0) mod_sofia: allow ep_codec_string to draw from absolute_codec_string before the profile prefs (r:f685e4c5) mod_sofia: put presence data in state events (r:75aab0ee) mod_sofia: add sip_recovery_break_rfc variable to set globally or per channel to not reverse the from and 2 on uas re-invites (r:5f09b403) + mod_sofia: add tags to allow crypto in avp (r:9fe08675) mod_spandsp: Add T31 modem support to mod_spandsp - similar to iaxmodem only wired into FS. Also merge configs into single spandsp.conf.xml --see in tree example-- (r:d91f67d0) + mod_spandsp: add v18_mode var (r:e941a61f) mod_valet_parking: add orbit feature to valet_parking similar to mod_fifo (r:09725e2b) mod_vlc: Adding mod_vlc initial working version (r:77f3bd24) mod_voicemail: vm_read should mark messages as read, but not saved (r:693f2986) From b843e8fd8b24670619045b5b65d8fb162e169d9b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 10:49:48 -0500 Subject: [PATCH 0853/1057] FS-4495 --resolve --- src/mod/endpoints/mod_sofia/sofia.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index a3add9c434..99f42169f1 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -900,6 +900,10 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro if ((tmp = switch_channel_get_variable(channel, "callee_id_number")) && !zstr(tmp)) { number = (char *) tmp; } + + if (zstr(number)) { + number = "unknown"; + } } if (zstr(name)) { @@ -912,7 +916,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro name = (char *) number; } - if (zstr(name) && zstr(number)) { + if (zstr(name) || zstr(number)) { goto end; } From 40ed0b31c1a6aa64ed2e5b22e2110ffa571d072f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 11:20:27 -0500 Subject: [PATCH 0854/1057] FS-4499 --resolve this is a different fix but this will implicitly fix it --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 1 + 1 file changed, 1 insertion(+) 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 c377080e63..371ce62b3a 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 @@ -2140,6 +2140,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even } if (*event) { + switch_event_prep_for_delivery(*event); switch_event_fire(event); } switch_snprintf(reply, reply_len, "+OK %s", uuid_str); From c3de9637af8ae57c1e671692aec55a7ae7e7fdb9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 16:12:03 -0500 Subject: [PATCH 0855/1057] FS-4079 please test --- src/mod/endpoints/mod_sofia/mod_sofia.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c831721ffb..5bf9eb7b24 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -374,6 +374,11 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA DESTROY\n", switch_channel_get_name(channel)); if (tech_pvt) { + + if (tech_pvt->respond_phrase) { + switch_yield(100000); + } + if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } @@ -540,7 +545,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) if (tech_pvt->respond_phrase) { - phrase = su_strdup(nua_handle_home(tech_pvt->nh), tech_pvt->respond_phrase); + //phrase = su_strdup(nua_handle_home(tech_pvt->nh), tech_pvt->respond_phrase); + phrase = tech_pvt->respond_phrase; } else { phrase = sip_status_phrase(sip_cause); } From 0b852eb3d1e7ac4c407773d1ae16d9e3aebe6f11 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 18:30:08 -0500 Subject: [PATCH 0856/1057] FS-4493 does this work --- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 367d97b3bc..7c8f920712 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1061,6 +1061,11 @@ static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t tty } + if (tech_pvt->transports[ttype].crypto_recv_type) { + tech_pvt->transports[ttype].crypto_type = tech_pvt->transports[ttype].crypto_recv_type; + } + + //if (tech_pvt->transports[ttype].crypto_type) { switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->transports[ttype].crypto_type, From 06ed24b2d48b65b09eba39f43600b1ae03c6a0b5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 19:38:56 -0500 Subject: [PATCH 0857/1057] FS-4501 try this --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5bf9eb7b24..52e7333607 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2398,13 +2398,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } nua_refer(tech_pvt->nh, SIPTAG_REFER_TO_STR(ref_to), SIPTAG_REFERRED_BY_STR(tech_pvt->contact_url), TAG_END()); switch_mutex_unlock(tech_pvt->sofia_mutex); - sofia_wait_for_reply(tech_pvt, 9999, 300); + sofia_wait_for_reply(tech_pvt, 9999, 10); switch_mutex_lock(tech_pvt->sofia_mutex); if ((var = switch_channel_get_variable(tech_pvt->channel, "sip_refer_reply"))) { msg->string_reply = switch_core_session_strdup(session, var); } else { msg->string_reply = "no reply"; } + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BLIND_TRANSFER); } break; From 2ed9281d1966de2f71aae4fc15aace2948b740b3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 22:30:34 -0500 Subject: [PATCH 0858/1057] FS-4487 --resolve --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 8c0f3226c9..80e3adbbea 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -553,7 +553,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_clear_flag(channel, CF_STOP_BROADCAST); - if (switch_channel_test_flag(channel, CF_BROADCAST)) { + if (switch_channel_test_flag(channel, CF_BRIDGED) && switch_channel_test_flag(channel, CF_BROADCAST)) { inner++; hold_bleg = NULL; } else { From 8e14fd2039d837baa4c90ff42c2fb895429ece1e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 22:34:31 -0500 Subject: [PATCH 0859/1057] FS-4348 --resolve --- .../applications/mod_commands/mod_commands.c | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 9ed0506efd..65801f85d3 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3935,10 +3935,50 @@ struct holder { uint32_t count; int print_title; switch_xml_t xml; + cJSON *json; int rows; int justcount; }; +static int show_as_json_callback(void *pArg, int argc, char **argv, char **columnNames) +{ + struct holder *holder = (struct holder *) pArg; + cJSON *row; + int x; + + if (holder->count == 0) { + if (!(holder->json = cJSON_CreateArray())) { + return -1; + } + } + + if (holder->justcount) { + holder->count++; + return 0; + } + + if (!(row = cJSON_CreateObject())) { + return -1; + } + + cJSON_AddItemToArray(holder->json, row); + + for (x = 0; x < argc; x++) { + char *name = columnNames[x]; + char *val = switch_str_nil(argv[x]); + + if (!name) { + name = "undefined"; + } + + cJSON_AddItemToObject(row, name, cJSON_CreateString(val)); + } + + holder->count++; + + return 0; +} + static int show_as_xml_callback(void *pArg, int argc, char **argv, char **columnNames) { struct holder *holder = (struct holder *) pArg; @@ -4309,6 +4349,45 @@ SWITCH_STANDARD_API(show_function) } else { holder.stream->write_function(holder.stream, "\n"); } + } else if (!strcasecmp(as, "json")) { + + switch_cache_db_execute_sql_callback(db, sql, show_as_json_callback, &holder, &errmsg); + + if (errmsg) { + stream->write_function(stream, "-ERR SQL Error [%s]\n", errmsg); + free(errmsg); + errmsg = NULL; + } + + if (holder.json) { + cJSON *result; + + if (!(result = cJSON_CreateObject())) { + cJSON_Delete(holder.json); + holder.json = NULL; + holder.stream->write_function(holder.stream, "-ERR Error creating json object!\n"); + } else { + char *json_text; + + cJSON_AddItemToObject(result, "row_count", cJSON_CreateNumber(holder.count)); + cJSON_AddItemToObject(result, "rows", holder.json); + + json_text = cJSON_PrintUnformatted(result); + + if (!json_text) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); + holder.stream->write_function(holder.stream, "-ERR Memory Error!\n"); + } else { + holder.stream->write_function(holder.stream, json_text); + } + cJSON_Delete(result); + switch_safe_free(json_text); + } + + } else { + holder.stream->write_function(holder.stream, "{\"row_count\": 0}\n"); + } + } else { holder.stream->write_function(holder.stream, "-ERR Cannot find format %s\n", as); } @@ -4771,6 +4850,8 @@ SWITCH_STANDARD_API(uuid_dump_function) switch_core_session_rwunlock(psession); goto done; } + } else if (!strcasecmp(format, "json")) { + switch_event_serialize_json(event, &buf); } else { switch_event_serialize(event, &buf, strcasecmp(format, "plain")); } From d23b74e66a779a3135e2eb59e28a48f1f4aa1ce2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 6 Aug 2012 23:50:39 -0500 Subject: [PATCH 0860/1057] FS-4352 --resolve alternate implementation as multiset to avoid regressions on set --- .../applications/mod_dptools/mod_dptools.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 5ca719e8d2..92eba0f568 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1326,6 +1326,33 @@ static void base_set (switch_core_session_t *session, const char *data, switch_s } } +SWITCH_STANDARD_APP(multiset_function) +{ + char delim = ' '; + char *arg = (char *) data; + + if (!zstr(arg) && *arg == '^' && *(arg+1) == '^') { + arg += 2; + delim = *arg++; + } + + if (arg) { + char *array[256] = {0}; + int i, argc; + + arg = switch_core_session_strdup(session, arg); + argc = switch_split(arg, delim, array); + + for(i = 0; i < argc; i++) { + base_set(session, array[i], SWITCH_STACK_BOTTOM); + } + + + } else { + base_set(session, data, SWITCH_STACK_BOTTOM); + } +} + SWITCH_STANDARD_APP(set_function) { base_set(session, data, SWITCH_STACK_BOTTOM); @@ -4672,6 +4699,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "=", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); + SWITCH_ADD_APP(app_interface, "multiset", "Set many channel variables", SET_LONG_DESC, multiset_function, "[^^]= =", + SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); + SWITCH_ADD_APP(app_interface, "push", "Set a channel variable", SET_LONG_DESC, push_function, "=", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); From 63b6fa5f24566af5698fdf0d706afd7603be31ca Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Aug 2012 07:30:22 -0500 Subject: [PATCH 0861/1057] FS-4487 revert 2ed9281d1966de2f71aae4fc15aace2948b740b3 --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 80e3adbbea..8c0f3226c9 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -553,7 +553,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_clear_flag(channel, CF_STOP_BROADCAST); - if (switch_channel_test_flag(channel, CF_BRIDGED) && switch_channel_test_flag(channel, CF_BROADCAST)) { + if (switch_channel_test_flag(channel, CF_BROADCAST)) { inner++; hold_bleg = NULL; } else { From c0626e6801926ada52a215207d7638169d074e82 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Aug 2012 07:35:41 -0500 Subject: [PATCH 0862/1057] FS-4487 --resolve --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 8c0f3226c9..3296161c9d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -553,7 +553,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_clear_flag(channel, CF_STOP_BROADCAST); - if (switch_channel_test_flag(channel, CF_BROADCAST)) { + if (!switch_channel_test_flag(channel, CF_BRIDGED) || switch_channel_test_flag(channel, CF_BROADCAST)) { inner++; hold_bleg = NULL; } else { From 48857cc7a798ede077057fb04510832a038bc964 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Aug 2012 09:03:02 -0500 Subject: [PATCH 0863/1057] typo --- src/mod/applications/mod_httapi/mod_httapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 9d5b8003a5..6011f16458 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -553,7 +553,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw do { if (speak) { - status = switch_ivr_speak_text(client->session, tts_engine, tts_voice, (char *)body, args); + status = switch_ivr_speak_text(client->session, tts_engine, tts_voice, (char *)file, args); } else if (say) { status = switch_ivr_say(client->session, body, say_lang, say_type, say_method, say_gender, args); } else if (play) { From 3ae2bdf4aaf5b5f4132fde763ef5dc6a610128d8 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Tue, 7 Aug 2012 22:34:32 +0800 Subject: [PATCH 0864/1057] Improvements to dithering down colour and gray scale images to bi-level images, for images with different illuminants. --- libs/spandsp/src/fax.c | 4 - libs/spandsp/src/image_translate.c | 94 ++++++++++--------- libs/spandsp/src/spandsp/image_translate.h | 11 +-- .../src/spandsp/private/image_translate.h | 1 + libs/spandsp/src/spandsp/private/t4_tx.h | 7 ++ libs/spandsp/src/spandsp/t30.h | 6 +- libs/spandsp/src/spandsp/t30_fcf.h | 1 + libs/spandsp/src/t30.c | 10 +- libs/spandsp/src/t30_api.c | 4 - libs/spandsp/src/t30_logging.c | 6 +- libs/spandsp/src/t38_gateway.c | 4 - libs/spandsp/src/t38_terminal.c | 4 - libs/spandsp/src/t4_rx.c | 4 - libs/spandsp/src/t4_t6_decode.c | 4 - libs/spandsp/src/t4_t6_encode.c | 4 - libs/spandsp/src/t4_tx.c | 80 +++++++++------- libs/spandsp/tests/image_translate_tests.c | 12 +-- libs/spandsp/tests/t42_tests.c | 4 +- 18 files changed, 126 insertions(+), 134 deletions(-) diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c index 19bf4cf5e6..1edba28eea 100644 --- a/libs/spandsp/src/fax.c +++ b/libs/spandsp/src/fax.c @@ -77,9 +77,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -111,9 +109,7 @@ #include "spandsp/private/timezone.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c index db6a7adc0e..785997def5 100644 --- a/libs/spandsp/src/image_translate.c +++ b/libs/spandsp/src/image_translate.c @@ -59,9 +59,7 @@ #include "spandsp/t4_tx.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -72,9 +70,7 @@ #include "spandsp/private/logging.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif @@ -132,13 +128,13 @@ static int get_and_scrunch_row(image_translate_state_t *s, uint8_t buf[], size_t /* Scrunch colour down to gray, and scrunch 16 bit pixels down to 8 bit pixels */ switch (s->input_format) { - case IMAGE_TRANSLATE_FROM_GRAY_16: + case T4_IMAGE_TYPE_GRAY_12BIT: image_gray16_to_gray8_row(buf, (uint16_t *) buf, s->input_width); break; - case IMAGE_TRANSLATE_FROM_COLOUR_16: + case T4_IMAGE_TYPE_COLOUR_12BIT: image_colour16_to_gray8_row(buf, (uint16_t *) buf, s->input_width); break; - case IMAGE_TRANSLATE_FROM_COLOUR_8: + case T4_IMAGE_TYPE_COLOUR_8BIT: image_colour8_to_gray8_row(buf, buf, s->input_width); break; } @@ -235,47 +231,17 @@ static __inline__ uint8_t find_closest_palette_color(int in) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], size_t len) +static int floyd_steinberg_dither_row(image_translate_state_t *s, uint8_t buf[], int y) { int x; - int y; int i; int j; int limit; int old_pixel; int new_pixel; int quant_error; - uint8_t *p; uint8_t xx; - if (s->output_row < 0) - return 0; - y = s->output_row++; - /* This algorithm works over two rows, and outputs the earlier of the two. To - make this work: - - At row 0 we grab and scrunch two rows. - - From row 1 up to the last row we grab one new additional row each time. - - At the last row we dither and output, without getting an extra row in. */ - for (i = (y == 0) ? 0 : 1; i < 2; i++) - { - p = s->pixel_row[0]; - s->pixel_row[0] = s->pixel_row[1]; - s->pixel_row[1] = p; - - /* If this is the end of the image just ignore that there is now rubbish in pixel_row[1]. - Mark that the end has occurred. This row will be properly output, and the next one - will fail, with the end of image condition (i.e. returning zero length) */ - if (s->resize) - { - if (image_resize_row(s, s->pixel_row[1], s->output_width*s->bytes_per_pixel) != s->output_width*s->bytes_per_pixel) - s->output_row = -1; - } - else - { - if (get_and_scrunch_row(s, s->pixel_row[1], s->output_width*s->bytes_per_pixel) != s->output_width*s->bytes_per_pixel) - s->output_row = -1; - } - } /* Apply Floyd-Steinberg dithering to the 8 bit pixels, using a bustrophodontic scan, to reduce the grayscale image to pure black and white */ /* The first and last pixels in each row need special treatment, so we do not @@ -353,6 +319,46 @@ SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], size_t len) +{ + int y; + int i; + uint8_t *p; + + if (s->output_row < 0) + return 0; + y = s->output_row++; + /* This algorithm works over two rows, and outputs the earlier of the two. To + make this work: + - At row 0 we grab and scrunch two rows. + - From row 1 up to the last row we grab one new additional row each time. + - At the last row we dither and output, without getting an extra row in. */ + for (i = (y == 0) ? 0 : 1; i < 2; i++) + { + p = s->pixel_row[0]; + s->pixel_row[0] = s->pixel_row[1]; + s->pixel_row[1] = p; + + /* If this is the end of the image just ignore that there is now rubbish in pixel_row[1]. + Mark that the end has occurred. This row will be properly output, and the next one + will fail, with the end of image condition (i.e. returning zero length) */ + if (s->resize) + { + if (image_resize_row(s, s->pixel_row[1], s->output_width*s->bytes_per_pixel) != s->output_width*s->bytes_per_pixel) + s->output_row = -1; + } + else + { + if (get_and_scrunch_row(s, s->pixel_row[1], s->output_width*s->bytes_per_pixel) != s->output_width*s->bytes_per_pixel) + s->output_row = -1; + } + } + if (s->output_format == T4_IMAGE_TYPE_BILEVEL) + i = floyd_steinberg_dither_row(s, buf, y); + return i; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(int) image_translate_get_output_width(image_translate_state_t *s) { return s->output_width; @@ -369,6 +375,7 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta int input_format, int input_width, int input_length, + int output_format, int output_width, int output_length, t4_row_read_handler_t row_read_handler, @@ -384,10 +391,11 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta memset(s, 0, sizeof(*s)); s->input_format = input_format; - s->input_width = input_width; s->input_length = input_length; + s->output_format = output_format; + if ((s->resize = (output_width > 0))) { s->output_width = output_width; @@ -404,16 +412,16 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta switch (s->input_format) { - case IMAGE_TRANSLATE_FROM_GRAY_8: + case T4_IMAGE_TYPE_GRAY_8BIT: s->bytes_per_pixel = 1; break; - case IMAGE_TRANSLATE_FROM_GRAY_16: + case T4_IMAGE_TYPE_GRAY_12BIT: s->bytes_per_pixel = 2; break; - case IMAGE_TRANSLATE_FROM_COLOUR_8: + case T4_IMAGE_TYPE_COLOUR_8BIT: s->bytes_per_pixel = 3; break; - case IMAGE_TRANSLATE_FROM_COLOUR_16: + case T4_IMAGE_TYPE_COLOUR_12BIT: s->bytes_per_pixel = 6; break; default: diff --git a/libs/spandsp/src/spandsp/image_translate.h b/libs/spandsp/src/spandsp/image_translate.h index 80f29f0471..31f13d2845 100644 --- a/libs/spandsp/src/spandsp/image_translate.h +++ b/libs/spandsp/src/spandsp/image_translate.h @@ -40,15 +40,6 @@ typedef struct image_translate_state_s image_translate_state_t; -enum -{ - IMAGE_TRANSLATE_FROM_MONO = 1, - IMAGE_TRANSLATE_FROM_GRAY_8 = 2, - IMAGE_TRANSLATE_FROM_GRAY_16 = 3, - IMAGE_TRANSLATE_FROM_COLOUR_8 = 4, - IMAGE_TRANSLATE_FROM_COLOUR_16 = 5 -}; - #if defined(__cplusplus) extern "C" { @@ -75,6 +66,7 @@ SPAN_DECLARE(int) image_translate_get_output_length(image_translate_state_t *s); \param input_format x \param input_width The width of the source image, in pixels. \param input_length The length of the source image, in pixels. + \param output_format x \param output_width The width of the output image, in pixels. If this is set <= 0 the image will not be resized. \param output_length The length of the output image, in pixels. If this is set to <= 0 the @@ -88,6 +80,7 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta int input_format, int input_width, int input_length, + int output_format, int output_width, int output_length, t4_row_read_handler_t row_read_handler, diff --git a/libs/spandsp/src/spandsp/private/image_translate.h b/libs/spandsp/src/spandsp/private/image_translate.h index a4f7daa81f..e473a0f644 100644 --- a/libs/spandsp/src/spandsp/private/image_translate.h +++ b/libs/spandsp/src/spandsp/private/image_translate.h @@ -33,6 +33,7 @@ struct image_translate_state_s int input_format; int input_width; int input_length; + int output_format; int output_width; int output_length; int resize; diff --git a/libs/spandsp/src/spandsp/private/t4_tx.h b/libs/spandsp/src/spandsp/private/t4_tx.h index b7b5d11eff..9f4bf463be 100644 --- a/libs/spandsp/src/spandsp/private/t4_tx.h +++ b/libs/spandsp/src/spandsp/private/t4_tx.h @@ -90,6 +90,10 @@ struct t4_tx_state_s /*! \brief The type of compression used between the FAX machines. */ int line_encoding; + int line_encoding_bilevel; + int line_encoding_gray; + int line_encoding_colour; + /*! \brief The width of the current page, in pixels. */ uint32_t image_width; /*! \brief The length of the current page, in pixels. */ @@ -140,6 +144,9 @@ struct t4_tx_state_s image_translate_state_t translator; + int apply_lab; + lab_params_t lab_params; + /* Supporting information, like resolutions, which the backend may want. */ t4_tx_metadata_t metadata; diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 8c0edffd83..88dd94be90 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -373,7 +373,11 @@ enum /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ T30_SUPPORT_SYCC_T81_COMPRESSION = 0x200, /*! T.88 monochrome JBIG2 compression */ - T30_SUPPORT_T88_COMPRESSION = 0x400 + T30_SUPPORT_T88_COMPRESSION = 0x400, + /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ + T30_SUPPORT_GRAY_TO_BILEVEL = 0x40000000, + /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ + T30_SUPPORT_COLOUR_TO_BILEVEL = 0x80000000 }; enum diff --git a/libs/spandsp/src/spandsp/t30_fcf.h b/libs/spandsp/src/spandsp/t30_fcf.h index 7414497247..763627e435 100644 --- a/libs/spandsp/src/spandsp/t30_fcf.h +++ b/libs/spandsp/src/spandsp/t30_fcf.h @@ -114,6 +114,7 @@ enum /*! Information frame types used for error correction mode, in T.4 */ T4_FCD = 0x06, /*! [0110 0000] Facsimile coded data */ + T4_CCD = 0x46, /*! [0110 0010] Character coded data */ T4_RCP = 0x86 /*! [0110 0001] Return to control for partial page */ }; diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index ec2852ef42..cf073b9049 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -64,9 +64,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -82,9 +80,7 @@ #include "spandsp/private/timezone.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif @@ -2072,7 +2068,7 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) s->error_correcting_mode = (s->ecm_allowed && (s->far_dis_dtc_frame[6] & DISBIT3) != 0); /* 256 octets per ECM frame */ s->octets_per_ecm_frame = 256; - /* Select the compression to use. */ + /* Now we know if we are going to use ECM, select the compression to use. */ if (!s->error_correcting_mode) { /* Without error correction our choices are very limited */ @@ -2091,7 +2087,7 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) { #if defined(SPANDSP_SUPPORT_T42x) || defined(SPANDSP_SUPPORT_T43) /* With error correction colour may be possible/required */ - if (0) + if ((0 & (T30_SUPPORT_T43_COMPRESSION | T30_SUPPORT_T45_COMPRESSION | T30_SUPPORT_T81_COMPRESSION | T30_SUPPORT_SYCC_T81_COMPRESSION))) { s->line_encoding = T4_COMPRESSION_ITU_T85_L0; } @@ -2382,7 +2378,7 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) s->image_width = widths[i][dcs_frame[5] & (DISBIT2 | DISBIT1)]; /* Check which compression the far end has decided to use. */ -#if defined(SPANDSP_SUPPORT_T42x) +#if defined(SPANDSP_SUPPORT_T42) if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_FULL_COLOUR_MODE)) { s->line_encoding = T4_COMPRESSION_ITU_T42; diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index ad7cb0e71c..86972c0fee 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -64,9 +64,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -82,9 +80,7 @@ #include "spandsp/private/timezone.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif diff --git a/libs/spandsp/src/t30_logging.c b/libs/spandsp/src/t30_logging.c index 9328c9b8f3..8347a2615d 100644 --- a/libs/spandsp/src/t30_logging.c +++ b/libs/spandsp/src/t30_logging.c @@ -64,9 +64,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -81,9 +79,7 @@ #include "spandsp/private/timezone.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif @@ -410,6 +406,8 @@ SPAN_DECLARE(const char *) t30_frametype(uint8_t x) return "NULL"; case T4_FCD: return "FCD"; + case T4_CCD: + return "CCD"; case T4_RCP: return "RCP"; } diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index e3c99a634a..11b653face 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -77,9 +77,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -109,9 +107,7 @@ #include "spandsp/private/timezone.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index d16e3cd569..d947d13906 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -67,9 +67,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -87,9 +85,7 @@ #include "spandsp/private/timezone.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 4e096e6371..7de952b890 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -57,9 +57,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -70,9 +68,7 @@ #include "spandsp/private/logging.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif diff --git a/libs/spandsp/src/t4_t6_decode.c b/libs/spandsp/src/t4_t6_decode.c index b3c96222b8..ac528a6a89 100644 --- a/libs/spandsp/src/t4_t6_decode.c +++ b/libs/spandsp/src/t4_t6_decode.c @@ -88,9 +88,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -100,9 +98,7 @@ #include "spandsp/private/logging.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif diff --git a/libs/spandsp/src/t4_t6_encode.c b/libs/spandsp/src/t4_t6_encode.c index 59dbd251e9..c8c0c2f5bb 100644 --- a/libs/spandsp/src/t4_t6_encode.c +++ b/libs/spandsp/src/t4_t6_encode.c @@ -85,9 +85,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -97,9 +95,7 @@ #include "spandsp/private/logging.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index d1060f8a82..17c832ecf5 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -57,9 +57,7 @@ #include "spandsp/image_translate.h" #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" #endif @@ -69,9 +67,7 @@ #include "spandsp/private/logging.h" #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" -#if defined(SPANDSP_SUPPORT_T42) #include "spandsp/private/t42.h" -#endif #if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" #endif @@ -104,6 +100,8 @@ static const TIFFFieldInfo tiff_fx_tiff_field_info[] = {TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, FIELD_CUSTOM, FALSE, FALSE, (char *) "ImageLayer"}, }; +static void t4_tx_set_image_length(t4_tx_state_t *s, int image_length); + static TIFFExtendProc _ParentExtender = NULL; static void TIFFFXDefaultDirectory(TIFF *tif) @@ -251,31 +249,14 @@ static int get_tiff_directory_info(t4_tx_state_t *s) } } t4_tx_set_image_width(s, s->image_width); + t4_tx_set_image_length(s, s->image_length); switch (s->line_encoding) { case T4_COMPRESSION_ITU_T4_1D: case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: - t4_t6_encode_set_image_width(&s->encoder.t4_t6, s->image_width); t4_t6_encode_set_max_2d_rows_per_1d_row(&s->encoder.t4_t6, -s->metadata.y_resolution); break; -#if defined(SPANDSP_SUPPORT_T42) - case T4_COMPRESSION_ITU_T42: - t42_encode_set_image_width(&s->encoder.t42, s->image_width); - t42_encode_set_image_length(&s->encoder.t42, s->image_length); - break; -#endif -#if defined(SPANDSP_SUPPORT_T43) - case T4_COMPRESSION_ITU_T43: - t43_encode_set_image_width(&s->encoder.t43, s->image_width); - t43_encode_set_image_length(&s->encoder.t43, s->image_length); - break; -#endif - case T4_COMPRESSION_ITU_T85: - case T4_COMPRESSION_ITU_T85_L0: - t85_encode_set_image_width(&s->encoder.t85, s->image_width); - t85_encode_set_image_length(&s->encoder.t85, s->image_length); - break; } #if defined(SPANDSP_SUPPORT_TIFF_FX) if (TIFFGetField(t->tiff_file, TIFFTAG_PROFILETYPE, &parm32)) @@ -426,6 +407,8 @@ static int row_read(void *user_data, uint8_t buf[], size_t len) return 0; if (TIFFReadScanline(s->tiff.tiff_file, buf, s->tiff.raw_row, 0) < 0) return 0; + if (s->apply_lab) + lab_to_srgb(&s->lab_params, buf, buf, len/3); s->tiff.raw_row++; return len; } @@ -438,23 +421,12 @@ static int read_tiff_image(t4_tx_state_t *s) int i; uint8_t *t; image_translate_state_t *translator; - int mode; if (s->tiff.image_type != T4_IMAGE_TYPE_BILEVEL) { /* We need to dither this image down to pure black and white, possibly resizing it along the way. */ - if (s->tiff.image_type == T4_IMAGE_TYPE_GRAY_8BIT) - mode = IMAGE_TRANSLATE_FROM_GRAY_8; - else if (s->tiff.image_type == T4_IMAGE_TYPE_GRAY_12BIT) - mode = IMAGE_TRANSLATE_FROM_GRAY_16; - else if (s->tiff.image_type == T4_IMAGE_TYPE_COLOUR_8BIT) - mode = IMAGE_TRANSLATE_FROM_COLOUR_8; - else if (s->tiff.image_type == T4_IMAGE_TYPE_COLOUR_12BIT) - mode = IMAGE_TRANSLATE_FROM_COLOUR_16; - else - return -1; - if ((translator = image_translate_init(NULL, mode, s->image_width, s->image_length, 1728, -1, row_read, s)) == NULL) + if ((translator = image_translate_init(NULL, s->tiff.image_type, s->image_width, s->image_length, T4_IMAGE_TYPE_BILEVEL, 1728, -1, row_read, s)) == NULL) return -1; s->image_width = image_translate_get_output_width(translator); s->image_length = image_translate_get_output_length(translator); @@ -469,6 +441,23 @@ static int read_tiff_image(t4_tx_state_t *s) s->tiff.image_buffer = t; } s->tiff.raw_row = 0; + switch (s->tiff.photo_metric) + { + case PHOTOMETRIC_CIELAB: + /* The default luminant is D50 */ + set_lab_illuminant(&s->lab_params, 0.96422f, 1.0f, 0.82521f); + set_lab_gamut(&s->lab_params, 0, 100, -128, 127, -128, 127, TRUE); + s->apply_lab = TRUE; + break; + case PHOTOMETRIC_ITULAB: + set_lab_illuminant(&s->lab_params, 0.9638f, 1.0f, 0.8245f); + set_lab_gamut(&s->lab_params, 0, 100, -85, 85, -75, 125, FALSE); + s->apply_lab = TRUE; + break; + default: + s->apply_lab = FALSE; + break; + } total_len = 0; for (i = 0; i < s->image_length; i++) total_len += image_translate_row(translator, &s->tiff.image_buffer[total_len], s->image_width/8); @@ -782,6 +771,29 @@ SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width) } /*- End of function --------------------------------------------------------*/ +static void t4_tx_set_image_length(t4_tx_state_t *s, int image_length) +{ + s->image_length = image_length; + switch (s->line_encoding) + { +#if defined(SPANDSP_SUPPORT_T42) + case T4_COMPRESSION_ITU_T42: + t42_encode_set_image_length(&s->encoder.t42, image_length); + break; +#endif +#if defined(SPANDSP_SUPPORT_T43) + case T4_COMPRESSION_ITU_T43: + t43_encode_set_image_length(&s->encoder.t43, image_length); + break; +#endif + case T4_COMPRESSION_ITU_T85: + case T4_COMPRESSION_ITU_T85_L0: + t85_encode_set_image_length(&s->encoder.t85, image_length); + break; + } +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(void) t4_tx_set_max_2d_rows_per_1d_row(t4_tx_state_t *s, int max) { switch (s->line_encoding) diff --git a/libs/spandsp/tests/image_translate_tests.c b/libs/spandsp/tests/image_translate_tests.c index 8c3f55f077..b57fe3965b 100644 --- a/libs/spandsp/tests/image_translate_tests.c +++ b/libs/spandsp/tests/image_translate_tests.c @@ -213,7 +213,7 @@ static void dither_tests_gray16(void) image[i*im.width + j] = j*1200; } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_GRAY_16, im.width, im.length, -1, -1, row_read, &im); + s = image_translate_init(s, T4_IMAGE_TYPE_GRAY_12BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -239,7 +239,7 @@ static void dither_tests_gray8(void) for (j = 0; j < im.width; j++) image[i*im.width + j] = j*1200/256; } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_GRAY_8, im.width, im.length, -1, -1, row_read, &im); + s = image_translate_init(s, T4_IMAGE_TYPE_GRAY_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -269,7 +269,7 @@ static void dither_tests_colour16(void) image[i*3*im.width + 3*j + 2] = j*1200; } } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_16, im.width, im.length, -1, -1, row_read, &im); + s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_12BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -300,7 +300,7 @@ static void dither_tests_colour8(void) } } - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_8, im.width, im.length, -1, -1, row_read, &im); + s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); get_flattened_image(s, TRUE); } /*- End of function --------------------------------------------------------*/ @@ -331,7 +331,7 @@ static void grow_tests_colour8(void) } } - s1 = image_translate_init(s1, IMAGE_TRANSLATE_FROM_COLOUR_8, im.width, im.length, 200, -1, row_read, &im); + s1 = image_translate_init(s1, T4_IMAGE_TYPE_COLOUR_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, 200, -1, row_read, &im); get_flattened_image(s1, FALSE); } @@ -409,7 +409,7 @@ static void lenna_tests(int output_width, int output_length_scaling, const char im.current_row = 0; im.bytes_per_pixel = samples_per_pixel; - s = image_translate_init(s, IMAGE_TRANSLATE_FROM_COLOUR_8, image_width, image_length, output_width, output_length, row_read, &im); + s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_8BIT, image_width, image_length, T4_IMAGE_TYPE_BILEVEL, output_width, output_length, row_read, &im); output_width = image_translate_get_output_width(s); output_length = image_translate_get_output_length(s); diff --git a/libs/spandsp/tests/t42_tests.c b/libs/spandsp/tests/t42_tests.c index c0d494c8ce..b00dac0707 100644 --- a/libs/spandsp/tests/t42_tests.c +++ b/libs/spandsp/tests/t42_tests.c @@ -476,8 +476,8 @@ int main(int argc, char *argv[]) } TIFFSetField(tif, TIFFTAG_SUBFILETYPE, FILETYPE_PAGE); TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, w); - // libtiff requires IMAGELENGTH to be set before SAMPLESPERPIXEL, - // or StripOffsets and StripByteCounts will have SAMPLESPERPIXEL values + /* libtiff requires IMAGELENGTH to be set before SAMPLESPERPIXEL, + or StripOffsets and StripByteCounts will have SAMPLESPERPIXEL values */ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, h); TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_JPEG); TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); From a117fd8fa3ab1f902afdbcf93bc21a45531bc548 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Tue, 7 Aug 2012 23:06:17 +0800 Subject: [PATCH 0865/1057] Avoid quirky complaints about using the top bit of an integer as an enum --- libs/spandsp/src/spandsp/t30.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 88dd94be90..ee842afea8 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -375,9 +375,9 @@ enum /*! T.88 monochrome JBIG2 compression */ T30_SUPPORT_T88_COMPRESSION = 0x400, /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_GRAY_TO_BILEVEL = 0x40000000, + T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_COLOUR_TO_BILEVEL = 0x80000000 + T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000 }; enum From c6cf92d7661616f331cf113b5b447049acfde1cd Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 7 Aug 2012 15:57:40 +0200 Subject: [PATCH 0866/1057] ftmod_isdn: Use ftdm_time_t for dialtone timeout. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h index 57e1d5386d..e12520f691 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h @@ -78,7 +78,7 @@ typedef struct ftdm_isdn_data ftdm_isdn_data_t; /* b-channel private data */ struct ftdm_isdn_bchan_data { - int32_t digit_timeout; + ftdm_time_t digit_timeout; int offset; /* offset in teletone buffer */ }; From 964d14c0126237fe6fd08ad786b1cfb8e3e39927 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 7 Aug 2012 17:20:18 +0200 Subject: [PATCH 0867/1057] ftmod_isdn: Fix channel state handling in NT mode w/ early disconnect. In this particular case: NO_ROUTE_DESTINATION caused by missing context. Signed-off-by: Stefan Knoblich --- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 750bc882c9..11139f7fb4 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -599,7 +599,9 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * return; } - if (ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_DOWN && + ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_HANGUP_COMPLETE) + { ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d not in DOWN state, cleaning up\n", ftdm_channel_get_span_id(ftdmchan), ftdm_channel_get_id(ftdmchan)); @@ -1320,6 +1322,9 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) sig.chan_id = ftdm_channel_get_id(ftdmchan); sig.channel = ftdmchan; + /* Acknowledge channel state change */ + ftdm_channel_complete_state(ftdmchan); + switch (ftdm_channel_get_state(ftdmchan)) { case FTDM_CHANNEL_STATE_DOWN: { @@ -1336,7 +1341,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS; if ((status = ftdm_span_send_signal(ftdm_channel_get_span(ftdmchan), &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { gen->MesType = Q931mes_CALL_PROCEEDING; @@ -1379,7 +1384,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_START; if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } } @@ -1389,7 +1394,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_RESTART; status = ftdm_span_send_signal(span, &sig); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } break; case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: @@ -1397,12 +1402,12 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); return; } } @@ -1416,12 +1421,12 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_UP; if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); return; } } @@ -1564,7 +1569,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) Q931Rx43(&isdn_data->q931, gen, gen->Size); } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } break; case FTDM_CHANNEL_STATE_HANGUP: @@ -1572,7 +1577,8 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); Q931ie_Cause cause; - ftdm_log(FTDM_LOG_DEBUG, "Hangup: Direction %s\n", ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); + ftdm_log(FTDM_LOG_DEBUG, "Hangup: Call direction %s\n", + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); cause.IEId = Q931ie_CAUSE; cause.Size = sizeof(Q931ie_Cause); @@ -1589,7 +1595,13 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) * inbound call [was: number unknown (= not found in routing state)] * (in Q.931 spec terms: Reject request) */ - gen->MesType = Q931mes_RELEASE_COMPLETE; + if (!FTDM_SPAN_IS_NT(span)) { + gen->MesType = Q931mes_RELEASE_COMPLETE; /* TE mode: Reject call */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } else { + gen->MesType = Q931mes_DISCONNECT; /* NT mode: Disconnect and wait */ + //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + } //cause.Value = (unsigned char) FTDM_CAUSE_UNALLOCATED; cause.Value = (unsigned char) caller_data->hangup_cause; @@ -1598,8 +1610,8 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) Q931Rx43(&isdn_data->q931, gen, gen->Size); /* we're done, release channel */ - //ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ////ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } else if (ftdm_channel_get_last_state(ftdmchan) <= FTDM_CHANNEL_STATE_PROGRESS) { /* @@ -1613,7 +1625,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) Q931Rx43(&isdn_data->q931, gen, gen->Size); /* this will be triggered by the RELEASE_COMPLETE reply */ - /* ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); */ + /* ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); */ } else { /* @@ -1630,7 +1642,8 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_TERMINATING: { - ftdm_log(FTDM_LOG_DEBUG, "Terminating: Direction %s\n", ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); + ftdm_log(FTDM_LOG_DEBUG, "Terminating: Call direction %s\n", + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); sig.event_id = FTDM_SIGEVENT_STOP; status = ftdm_span_send_signal(span, &sig); @@ -1655,11 +1668,8 @@ static __inline__ void check_state(ftdm_span_t *span) if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { ftdm_channel_lock(chan); - ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); state_advance(chan); - ftdm_channel_complete_state(chan); - ftdm_channel_unlock(chan); } } From 3818cae3e6d40f3a738e0ae16f8b8b158f064988 Mon Sep 17 00:00:00 2001 From: SwK Date: Tue, 7 Aug 2012 14:46:23 -0400 Subject: [PATCH 0868/1057] Work around for compiler issues on centos --- libs/spandsp/src/spandsp/t30.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index ee842afea8..1e66a95a27 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -373,12 +373,12 @@ enum /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ T30_SUPPORT_SYCC_T81_COMPRESSION = 0x200, /*! T.88 monochrome JBIG2 compression */ - T30_SUPPORT_T88_COMPRESSION = 0x400, - /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, - /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ - T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000 + T30_SUPPORT_T88_COMPRESSION = 0x400 }; + /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ +#define T30_SUPPORT_GRAY_TO_BILEVEL 0x10000000 + /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ +#define T30_SUPPORT_COLOUR_TO_BILEVEL 0x20000000 enum { From d806014009624e76bc252b2e09da19b62559655f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Aug 2012 17:23:01 -0500 Subject: [PATCH 0869/1057] FS-4079 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 99f42169f1..08f0686625 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -972,7 +972,13 @@ static void our_sofia_event_callback(nua_event_t event, if (sofia_private && sofia_private->is_call && sofia_private->de) { sofia_dispatch_event_t *qde = sofia_private->de; sofia_private->de = NULL; - sofia_process_dispatch_event(&qde); + + if (event == nua_i_cancel) { + nua_destroy_event(qde->event); + su_free(nh->nh_home, qde); + } else { + sofia_process_dispatch_event(&qde); + } } profile->last_sip_event = switch_time_now(); From 9ac586adc826030422b2dd0910873aca3de268ac Mon Sep 17 00:00:00 2001 From: William King Date: Tue, 7 Aug 2012 21:57:58 -0500 Subject: [PATCH 0870/1057] Add param variable where needed. --- src/mod/xml_int/mod_xml_radius/mod_xml_radius.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c index 28fd56eca6..c561eb7051 100644 --- a/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c +++ b/src/mod/xml_int/mod_xml_radius/mod_xml_radius.c @@ -100,7 +100,7 @@ switch_status_t mod_xml_radius_new_handle(rc_handle **new_handle, switch_xml_t x switch_status_t do_config() { char *conf = "xml_radius.conf"; - switch_xml_t xml, cfg, tmp, server; + switch_xml_t xml, cfg, tmp, server, param; int serv, timeout, deadtime, retries, dict, seq; /* TODO: 1. read new auth_invite_configs From 65ffaa8ca90e5befa4cbac64d723d53a98a4fc8f Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 8 Aug 2012 19:46:31 +0800 Subject: [PATCH 0871/1057] Someone's been doing something odd to t30.h :-\ --- libs/spandsp/src/spandsp/t30.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 1e66a95a27..ee842afea8 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -373,12 +373,12 @@ enum /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ T30_SUPPORT_SYCC_T81_COMPRESSION = 0x200, /*! T.88 monochrome JBIG2 compression */ - T30_SUPPORT_T88_COMPRESSION = 0x400 -}; + T30_SUPPORT_T88_COMPRESSION = 0x400, /*! Dither a gray scale image down a simple bilevel image, with rescaling to fit a FAX page */ -#define T30_SUPPORT_GRAY_TO_BILEVEL 0x10000000 + T30_SUPPORT_GRAY_TO_BILEVEL = 0x10000000, /*! Dither a colour image down a simple bilevel image, with rescaling to fit a FAX page */ -#define T30_SUPPORT_COLOUR_TO_BILEVEL 0x20000000 + T30_SUPPORT_COLOUR_TO_BILEVEL = 0x20000000 +}; enum { From 14a6e0cfc284348bc0a3a2312d82a43b2a256456 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Wed, 8 Aug 2012 14:08:31 +0200 Subject: [PATCH 0872/1057] CGI specifies that REQUEST_URI is relative to the root (and does not include scheme name, hostname, port) --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 1ac74ebbdf..a0898fb1cd 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -40,6 +40,7 @@ SWITCH_MODULE_DEFINITION(mod_xml_scgi, mod_xml_scgi_load, mod_xml_scgi_shutdown, struct xml_binding { char *host; switch_port_t port; + char *uri; char *url; int timeout; @@ -144,7 +145,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_stream_handle_t stream = { 0 }; char *txt = NULL; - strncpy(hostname, switch_core_get_switchname(), sizeof(hostname)); + strncpy(hostname, switch_core_get_switchname(), sizeof(hostname)); if (!binding) { return NULL; @@ -157,7 +158,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_assert(data); scgi_add_param(&handle, "REQUEST_METHOD", "POST"); - scgi_add_param(&handle, "REQUEST_URI", binding->url); + scgi_add_param(&handle, "REQUEST_URI", binding->uri); scgi_add_body(&handle, data); if (scgi_connect(&handle, binding->host, binding->port, binding->timeout * 1000) == SCGI_SUCCESS) { @@ -318,6 +319,7 @@ static switch_status_t do_config(void) binding->host = switch_core_strdup(globals.pool, host); binding->port = atoi(port); binding->vars_map = vars_map; + binding->uri = switch_mprintf("/%s", bname); binding->url = switch_mprintf("scgi://%s:%s/%s", host, port, bname); if (server) { From f3c1f5aa686231959e9b139d9982c89506a364a9 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Wed, 8 Aug 2012 14:14:54 +0200 Subject: [PATCH 0873/1057] missed this one --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index a0898fb1cd..3e39e65407 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -409,7 +409,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_scgi_shutdown) int x = 3; scgi_add_param(&handle, "REQUEST_METHOD", "POST"); - scgi_add_param(&handle, "REQUEST_URI", bp->url); + scgi_add_param(&handle, "REQUEST_URI", bp->uri); scgi_add_body(&handle, "SHUTDOWN"); while(x--) { From bb96d091fc33e5d43b6a87810fa09a3185ce7619 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 8 Aug 2012 21:16:38 +0800 Subject: [PATCH 0874/1057] Tweaks --- libs/spandsp/src/spandsp/private/t4_rx.h | 2 -- libs/spandsp/src/spandsp/private/t4_tx.h | 2 -- libs/spandsp/src/t4_rx.c | 18 ------------------ libs/spandsp/src/t4_tx.c | 18 ------------------ 4 files changed, 40 deletions(-) diff --git a/libs/spandsp/src/spandsp/private/t4_rx.h b/libs/spandsp/src/spandsp/private/t4_rx.h index 4dc2b21e21..44eb2d2664 100644 --- a/libs/spandsp/src/spandsp/private/t4_rx.h +++ b/libs/spandsp/src/spandsp/private/t4_rx.h @@ -109,9 +109,7 @@ struct t4_rx_state_s union { t4_t6_decode_state_t t4_t6; -#if defined(SPANDSP_SUPPORT_T42) t42_decode_state_t t42; -#endif #if defined(SPANDSP_SUPPORT_T43) t43_decode_state_t t43; #endif diff --git a/libs/spandsp/src/spandsp/private/t4_tx.h b/libs/spandsp/src/spandsp/private/t4_tx.h index 9f4bf463be..360315a9d2 100644 --- a/libs/spandsp/src/spandsp/private/t4_tx.h +++ b/libs/spandsp/src/spandsp/private/t4_tx.h @@ -133,9 +133,7 @@ struct t4_tx_state_s union { t4_t6_encode_state_t t4_t6; -#if defined(SPANDSP_SUPPORT_T42) t42_encode_state_t t42; -#endif #if defined(SPANDSP_SUPPORT_T43) t43_encode_state_t t43; #endif diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 7de952b890..c152d31871 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -253,11 +253,9 @@ static int set_tiff_directory_info(t4_rx_state_t *s) case T4_COMPRESSION_ITU_T6: TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t4_t6_decode_get_image_length(&s->decoder.t4_t6)); break; -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t42_decode_get_image_length(&s->decoder.t42)); break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, t43_decode_get_image_length(&s->decoder.t43)); @@ -360,10 +358,8 @@ SPAN_DECLARE(int) t4_rx_put_byte(t4_rx_state_t *s, uint8_t byte) case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_decode_put_byte(&s->decoder.t4_t6, byte); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_decode_put_byte(&s->decoder.t42, byte); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_decode_put_byte(&s->decoder.t43, byte); @@ -385,10 +381,8 @@ SPAN_DECLARE(int) t4_rx_put_chunk(t4_rx_state_t *s, const uint8_t buf[], int len case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_decode_put_chunk(&s->decoder.t4_t6, buf, len); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_decode_put_chunk(&s->decoder.t42, buf, len); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_decode_put_chunk(&s->decoder.t43, buf, len); @@ -462,7 +456,6 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding) } s->line_encoding = encoding; return t4_t6_decode_set_encoding(&s->decoder.t4_t6, encoding); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: switch (s->line_encoding) { @@ -478,7 +471,6 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int encoding) } s->line_encoding = encoding; return 0; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: switch (s->line_encoding) @@ -534,10 +526,8 @@ SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_han case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_decode_set_row_write_handler(&s->decoder.t4_t6, handler, user_data); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_decode_set_row_write_handler(&s->decoder.t42, handler, user_data); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_decode_set_row_write_handler(&s->decoder.t43, handler, user_data); @@ -569,13 +559,11 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->bad_rows = s->decoder.t4_t6.bad_rows; t->longest_bad_row_run = s->decoder.t4_t6.longest_bad_row_run; break; -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: t->width = t42_decode_get_image_width(&s->decoder.t42); t->length = t42_decode_get_image_length(&s->decoder.t42); t->line_image_size = t42_decode_get_compressed_image_size(&s->decoder.t42)/8; break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: t->width = t43_decode_get_image_width(&s->decoder.t43); @@ -604,11 +592,9 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) case T4_COMPRESSION_ITU_T6: t4_t6_decode_restart(&s->decoder.t4_t6, s->image_width); break; -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: t42_decode_restart(&s->decoder.t42); break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: t43_decode_restart(&s->decoder.t43); @@ -663,12 +649,10 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) t4_t6_decode_put_byte(&s->decoder.t4_t6, SIG_STATUS_END_OF_DATA); length = t4_t6_decode_get_image_length(&s->decoder.t4_t6); break; -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: t42_decode_put_byte(&s->decoder.t42, SIG_STATUS_END_OF_DATA); length = t42_decode_get_image_length(&s->decoder.t42); break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: t43_decode_put_byte(&s->decoder.t43, SIG_STATUS_END_OF_DATA); @@ -759,10 +743,8 @@ SPAN_DECLARE(int) t4_rx_release(t4_rx_state_t *s) case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_decode_release(&s->decoder.t4_t6); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_decode_release(&s->decoder.t42); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_decode_release(&s->decoder.t43); diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 17c832ecf5..49f059e89c 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -524,10 +524,8 @@ static int set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_encode_set_row_read_handler(&s->encoder.t4_t6, handler, user_data); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_encode_set_row_read_handler(&s->encoder.t42, handler, user_data); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_encode_set_row_read_handler(&s->encoder.t43, handler, user_data); @@ -686,7 +684,6 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) } s->line_encoding = encoding; return t4_t6_encode_set_encoding(&s->encoder.t4_t6, encoding); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: switch (s->line_encoding) { @@ -698,7 +695,6 @@ SPAN_DECLARE(int) t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding) } s->line_encoding = encoding; return 0; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: switch (s->line_encoding) @@ -753,11 +749,9 @@ SPAN_DECLARE(void) t4_tx_set_image_width(t4_tx_state_t *s, int image_width) case T4_COMPRESSION_ITU_T6: t4_t6_encode_set_image_width(&s->encoder.t4_t6, image_width); break; -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: t42_encode_set_image_width(&s->encoder.t42, image_width); break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: t43_encode_set_image_width(&s->encoder.t43, image_width); @@ -776,11 +770,9 @@ static void t4_tx_set_image_length(t4_tx_state_t *s, int image_length) s->image_length = image_length; switch (s->line_encoding) { -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: t42_encode_set_image_length(&s->encoder.t42, image_length); break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: t43_encode_set_image_length(&s->encoder.t43, image_length); @@ -886,13 +878,11 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t t->length = t4_t6_encode_get_image_length(&s->encoder.t4_t6); t->line_image_size = t4_t6_encode_get_compressed_image_size(&s->encoder.t4_t6)/8; break; -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: t->width = t42_encode_get_image_width(&s->encoder.t42); t->length = t42_encode_get_image_length(&s->encoder.t42); t->line_image_size = t42_encode_get_compressed_image_size(&s->encoder.t42)/8; break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: t->width = t43_encode_get_image_width(&s->encoder.t43); @@ -930,10 +920,8 @@ SPAN_DECLARE(int) t4_tx_get_byte(t4_tx_state_t *s) case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_encode_get_byte(&s->encoder.t4_t6); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_encode_get_byte(&s->encoder.t42); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_encode_get_byte(&s->encoder.t43); @@ -954,10 +942,8 @@ SPAN_DECLARE(int) t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len) case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_encode_get_chunk(&s->encoder.t4_t6, buf, max_len); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_encode_get_chunk(&s->encoder.t42, buf, max_len); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_encode_get_chunk(&s->encoder.t43, buf, max_len); @@ -995,11 +981,9 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) case T4_COMPRESSION_ITU_T6: t4_t6_encode_restart(&s->encoder.t4_t6, s->image_width); break; -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: t42_encode_restart(&s->encoder.t42, s->image_width, s->image_length); break; -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: t43_encode_restart(&s->encoder.t43, s->image_width, s->image_length); @@ -1106,10 +1090,8 @@ SPAN_DECLARE(int) t4_tx_release(t4_tx_state_t *s) case T4_COMPRESSION_ITU_T4_2D: case T4_COMPRESSION_ITU_T6: return t4_t6_encode_release(&s->encoder.t4_t6); -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_ITU_T42: return t42_encode_release(&s->encoder.t42); -#endif #if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_ITU_T43: return t43_encode_release(&s->encoder.t43); From 42c5ab08d3369f16983599174507adb356fae6ce Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 8 Aug 2012 21:26:06 +0800 Subject: [PATCH 0875/1057] Image translate moves forward a little, towards colour support --- libs/spandsp/src/image_translate.c | 264 +++++++++++++--- libs/spandsp/src/spandsp/image_translate.h | 5 +- .../src/spandsp/private/image_translate.h | 5 +- libs/spandsp/tests/image_translate_tests.c | 288 +++++++++++++++--- 4 files changed, 489 insertions(+), 73 deletions(-) diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c index 785997def5..54037990fc 100644 --- a/libs/spandsp/src/image_translate.c +++ b/libs/spandsp/src/image_translate.c @@ -2,8 +2,9 @@ * SpanDSP - a series of DSP components for telephony * * image_translate.c - Image translation routines for reworking colour - * and gray scale images to be bi-level images of an - * appropriate size to be FAX compatible. + * and gray scale images to be colour, gray scale or + * bi-level images of an appropriate size to be FAX + * compatible. * * Written by Steve Underwood * @@ -80,69 +81,237 @@ #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" -static int image_colour16_to_gray8_row(uint8_t mono[], uint16_t colour[], int pixels) +static int image_colour16_to_colour8_row(uint8_t colour8[], uint16_t colour16[], int pixels) +{ + int i; + + for (i = 0; i < 3*pixels; i++) + colour8[i] = colour16[i] >> 8; + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_colour16_to_gray16_row(uint16_t gray16[], uint16_t colour16[], int pixels) { int i; uint32_t gray; for (i = 0; i < pixels; i++) { - gray = colour[3*i]*19595 + colour[3*i + 1]*38469 + colour[3*i + 2]*7472; - mono[i] = saturateu8(gray >> 24); + gray = colour16[3*i]*19595 + colour16[3*i + 1]*38469 + colour16[3*i + 2]*7472; + gray16[i] = saturateu16(gray >> 16); } return pixels; } /*- End of function --------------------------------------------------------*/ -static int image_colour8_to_gray8_row(uint8_t mono[], uint8_t colour[], int pixels) +static int image_colour16_to_gray8_row(uint8_t gray8[], uint16_t colour16[], int pixels) { int i; uint32_t gray; for (i = 0; i < pixels; i++) { - gray = colour[3*i]*19595 + colour[3*i + 1]*38469 + colour[3*i + 2]*7472; - mono[i] = saturateu8(gray >> 16); + gray = colour16[3*i]*19595 + colour16[3*i + 1]*38469 + colour16[3*i + 2]*7472; + gray8[i] = saturateu8(gray >> 24); } return pixels; } /*- End of function --------------------------------------------------------*/ -static int image_gray16_to_gray8_row(uint8_t mono[], uint16_t gray[], int pixels) +static int image_colour8_to_gray16_row(uint16_t gray16[], uint8_t colour8[], int pixels) { int i; + uint32_t gray; for (i = 0; i < pixels; i++) - mono[i] = gray[i] >> 8; + { + gray = colour8[3*i]*19595 + colour8[3*i + 1]*38469 + colour8[3*i + 2]*7472; + gray16[i] = saturateu16(gray >> 8); + } return pixels; } /*- End of function --------------------------------------------------------*/ -static int get_and_scrunch_row(image_translate_state_t *s, uint8_t buf[], size_t len) +static int image_colour8_to_gray8_row(uint8_t gray8[], uint8_t colour8[], int pixels) { - int row_len; + int i; + uint32_t gray; - row_len = (*s->row_read_handler)(s->row_read_user_data, buf, s->input_width*s->bytes_per_pixel); - if (row_len != s->input_width*s->bytes_per_pixel) + for (i = 0; i < pixels; i++) + { + gray = colour8[3*i]*19595 + colour8[3*i + 1]*38469 + colour8[3*i + 2]*7472; + gray8[i] = saturateu8(gray >> 16); + } + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_colour8_to_colour16_row(uint16_t colour16[], uint8_t colour8[], int pixels) +{ + int i; + + for (i = 3*pixels - 1; i >= 0; i--) + colour16[i] = colour8[i] << 8; + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_gray16_to_colour16_row(uint16_t colour16[], uint16_t gray16[], int pixels) +{ + int i; + + for (i = pixels - 1; i >= 0; i--) + { + /* TODO: need to balance the colours */ + colour16[3*i] = gray16[i]; + colour16[3*i + 1] = gray16[i]; + colour16[3*i + 2] = gray16[i]; + } + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_gray16_to_colour8_row(uint8_t colour8[], uint16_t gray16[], int pixels) +{ + int i; + + for (i = pixels - 1; i >= 0; i--) + { + /* TODO: need to balance the colours */ + colour8[3*i] = gray16[i] >> 8; + colour8[3*i + 1] = gray16[i] >> 8; + colour8[3*i + 2] = gray16[i] >> 8; + } + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_gray16_to_gray8_row(uint8_t gray8[], uint16_t gray16[], int pixels) +{ + int i; + + for (i = 0; i < pixels; i++) + gray8[i] = gray16[i] >> 8; + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_gray8_to_colour16_row(uint16_t colour16[], uint8_t gray8[], int pixels) +{ + int i; + + for (i = pixels - 1; i >= 0; i--) + { + /* TODO: need to balance the colours */ + colour16[3*i] = gray8[i] << 8; + colour16[3*i + 1] = gray8[i] << 8; + colour16[3*i + 2] = gray8[i] << 8; + } + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_gray8_to_colour8_row(uint8_t colour8[], uint8_t gray8[], int pixels) +{ + int i; + + for (i = pixels - 1; i >= 0; i--) + { + /* TODO: need to balance the colours */ + colour8[3*i] = gray8[i]; + colour8[3*i + 1] = gray8[i]; + colour8[3*i + 2] = gray8[i]; + } + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int image_gray8_to_gray16_row(uint16_t gray16[], uint8_t gray8[], int pixels) +{ + int i; + + for (i = pixels - 1; i >= 0; i--) + gray16[i] = gray8[i] << 8; + return pixels; +} +/*- End of function --------------------------------------------------------*/ + +static int get_and_scrunch_row(image_translate_state_t *s, uint8_t buf[]) +{ + int input_row_len; + + input_row_len = (*s->row_read_handler)(s->row_read_user_data, buf, s->input_width*s->input_bytes_per_pixel); + if (input_row_len != s->input_width*s->input_bytes_per_pixel) return 0; - /* Scrunch colour down to gray, and scrunch 16 bit pixels down to 8 bit pixels */ + /* Scrunch colour down to gray, vice versa. Scrunch 16 bit pixels down to 8 bit pixels, or vice versa. */ switch (s->input_format) { case T4_IMAGE_TYPE_GRAY_12BIT: - image_gray16_to_gray8_row(buf, (uint16_t *) buf, s->input_width); + switch (s->output_format) + { + case T4_IMAGE_TYPE_BILEVEL: + case T4_IMAGE_TYPE_GRAY_8BIT: + image_gray16_to_gray8_row(buf, (uint16_t *) buf, s->input_width); + break; + case T4_IMAGE_TYPE_COLOUR_12BIT: + image_gray16_to_colour16_row((uint16_t *) buf, (uint16_t *) buf, s->input_width); + break; + case T4_IMAGE_TYPE_COLOUR_8BIT: + image_gray16_to_colour8_row(buf, (uint16_t *) buf, s->input_width); + break; + } + break; + case T4_IMAGE_TYPE_GRAY_8BIT: + switch (s->output_format) + { + case T4_IMAGE_TYPE_GRAY_12BIT: + image_gray8_to_gray16_row((uint16_t *) buf, buf, s->input_width); + break; + case T4_IMAGE_TYPE_COLOUR_12BIT: + image_gray8_to_colour16_row((uint16_t *) buf, buf, s->input_width); + break; + case T4_IMAGE_TYPE_COLOUR_8BIT: + image_gray8_to_colour8_row(buf, buf, s->input_width); + break; + } break; case T4_IMAGE_TYPE_COLOUR_12BIT: - image_colour16_to_gray8_row(buf, (uint16_t *) buf, s->input_width); + switch (s->output_format) + { + case T4_IMAGE_TYPE_GRAY_12BIT: + image_colour16_to_gray16_row((uint16_t *) buf, (uint16_t *) buf, s->input_width); + break; + case T4_IMAGE_TYPE_BILEVEL: + case T4_IMAGE_TYPE_GRAY_8BIT: + image_colour16_to_gray8_row(buf, (uint16_t *) buf, s->input_width); + break; + case T4_IMAGE_TYPE_COLOUR_8BIT: + image_colour16_to_colour8_row(buf, (uint16_t *) buf, s->input_width); + break; + } break; case T4_IMAGE_TYPE_COLOUR_8BIT: - image_colour8_to_gray8_row(buf, buf, s->input_width); + switch (s->output_format) + { + case T4_IMAGE_TYPE_GRAY_12BIT: + image_colour8_to_gray16_row((uint16_t *) buf, buf, s->input_width); + break; + case T4_IMAGE_TYPE_BILEVEL: + case T4_IMAGE_TYPE_GRAY_8BIT: + image_colour8_to_gray8_row(buf, buf, s->input_width); + break; + case T4_IMAGE_TYPE_COLOUR_12BIT: + image_colour8_to_colour16_row((uint16_t *) buf, buf, s->input_width); + break; + } break; } - return row_len; + return s->output_width; } /*- End of function --------------------------------------------------------*/ -static int image_resize_row(image_translate_state_t *s, uint8_t buf[], size_t len) +static int image_resize_row(image_translate_state_t *s, uint8_t buf[]) { int i; int output_width; @@ -184,8 +353,8 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[], size_t le s->raw_output_row = -1; break; } - row_len = get_and_scrunch_row(s, s->raw_pixel_row[0], s->input_width*s->bytes_per_pixel); - if (row_len != s->input_width*s->bytes_per_pixel) + row_len = get_and_scrunch_row(s, s->raw_pixel_row[0]); + if (row_len != s->output_width) { s->raw_output_row = -1; return 0; @@ -221,7 +390,7 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[], size_t le #endif if (++s->raw_output_row >= s->output_length) s->raw_output_row = -1; - return len; + return s->output_width; } /*- End of function --------------------------------------------------------*/ @@ -335,6 +504,7 @@ SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], - At the last row we dither and output, without getting an extra row in. */ for (i = (y == 0) ? 0 : 1; i < 2; i++) { + /* Swap the row buffers */ p = s->pixel_row[0]; s->pixel_row[0] = s->pixel_row[1]; s->pixel_row[1] = p; @@ -344,17 +514,24 @@ SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], will fail, with the end of image condition (i.e. returning zero length) */ if (s->resize) { - if (image_resize_row(s, s->pixel_row[1], s->output_width*s->bytes_per_pixel) != s->output_width*s->bytes_per_pixel) + if (image_resize_row(s, s->pixel_row[1]) != s->output_width) s->output_row = -1; } else { - if (get_and_scrunch_row(s, s->pixel_row[1], s->output_width*s->bytes_per_pixel) != s->output_width*s->bytes_per_pixel) + if (get_and_scrunch_row(s, s->pixel_row[1]) != s->output_width) s->output_row = -1; } } if (s->output_format == T4_IMAGE_TYPE_BILEVEL) + { i = floyd_steinberg_dither_row(s, buf, y); + } + else + { + i = s->output_width*s->output_bytes_per_pixel; + memcpy(buf, s->pixel_row[1], i); + } return i; } /*- End of function --------------------------------------------------------*/ @@ -413,19 +590,38 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta switch (s->input_format) { case T4_IMAGE_TYPE_GRAY_8BIT: - s->bytes_per_pixel = 1; + s->input_bytes_per_pixel = 1; break; case T4_IMAGE_TYPE_GRAY_12BIT: - s->bytes_per_pixel = 2; + s->input_bytes_per_pixel = 2; break; case T4_IMAGE_TYPE_COLOUR_8BIT: - s->bytes_per_pixel = 3; + s->input_bytes_per_pixel = 3; break; case T4_IMAGE_TYPE_COLOUR_12BIT: - s->bytes_per_pixel = 6; + s->input_bytes_per_pixel = 6; break; default: - s->bytes_per_pixel = 1; + s->input_bytes_per_pixel = 1; + break; + } + + switch (s->output_format) + { + case T4_IMAGE_TYPE_GRAY_8BIT: + s->output_bytes_per_pixel = 1; + break; + case T4_IMAGE_TYPE_GRAY_12BIT: + s->output_bytes_per_pixel = 2; + break; + case T4_IMAGE_TYPE_COLOUR_8BIT: + s->output_bytes_per_pixel = 3; + break; + case T4_IMAGE_TYPE_COLOUR_12BIT: + s->output_bytes_per_pixel = 6; + break; + default: + s->output_bytes_per_pixel = 1; break; } @@ -434,9 +630,9 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta { for (i = 0; i < 2; i++) { - if ((s->raw_pixel_row[i] = (uint8_t *) malloc(s->input_width*s->bytes_per_pixel)) == NULL) + if ((s->raw_pixel_row[i] = (uint8_t *) malloc(s->input_width*s->input_bytes_per_pixel)) == NULL) return NULL; - memset(s->raw_pixel_row[i], 0, s->input_width*s->bytes_per_pixel); + memset(s->raw_pixel_row[i], 0, s->input_width*s->input_bytes_per_pixel); if ((s->pixel_row[i] = (uint8_t *) malloc(s->output_width*sizeof(uint8_t))) == NULL) return NULL; memset(s->pixel_row[i], 0, s->output_width*sizeof(uint8_t)); @@ -446,9 +642,9 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta { for (i = 0; i < 2; i++) { - if ((s->pixel_row[i] = (uint8_t *) malloc(s->output_width*s->bytes_per_pixel)) == NULL) + if ((s->pixel_row[i] = (uint8_t *) malloc(s->output_width*s->input_bytes_per_pixel)) == NULL) return NULL; - memset(s->pixel_row[i], 0, s->output_width*s->bytes_per_pixel); + memset(s->pixel_row[i], 0, s->output_width*s->input_bytes_per_pixel); } } diff --git a/libs/spandsp/src/spandsp/image_translate.h b/libs/spandsp/src/spandsp/image_translate.h index 31f13d2845..7f91c2db0a 100644 --- a/libs/spandsp/src/spandsp/image_translate.h +++ b/libs/spandsp/src/spandsp/image_translate.h @@ -2,8 +2,9 @@ * SpanDSP - a series of DSP components for telephony * * image_translate.h - Image translation routines for reworking colour - * and gray scale images to be bi-level images of an - * appropriate size to be FAX compatible. + * and gray scale images to be colour, gray scale or + * bi-level images of an appropriate size to be FAX + * compatible. * * Written by Steve Underwood * diff --git a/libs/spandsp/src/spandsp/private/image_translate.h b/libs/spandsp/src/spandsp/private/image_translate.h index e473a0f644..02a13506df 100644 --- a/libs/spandsp/src/spandsp/private/image_translate.h +++ b/libs/spandsp/src/spandsp/private/image_translate.h @@ -1,7 +1,7 @@ /* * SpanDSP - a series of DSP components for telephony * - * private/image_translate.c - Image translation routines for reworking colour + * private/image_translate.h - Image translation routines for reworking colour * and gray scale images to be bi-level images of an * appropriate size to be FAX compatible. * @@ -33,11 +33,12 @@ struct image_translate_state_s int input_format; int input_width; int input_length; + int input_bytes_per_pixel; int output_format; int output_width; int output_length; + int output_bytes_per_pixel; int resize; - int bytes_per_pixel; int raw_input_row; int raw_output_row; int output_row; diff --git a/libs/spandsp/tests/image_translate_tests.c b/libs/spandsp/tests/image_translate_tests.c index b57fe3965b..b1930c12a3 100644 --- a/libs/spandsp/tests/image_translate_tests.c +++ b/libs/spandsp/tests/image_translate_tests.c @@ -159,7 +159,7 @@ static int row_read(void *user_data, uint8_t buf[], size_t len) } /*- End of function --------------------------------------------------------*/ -static void get_flattened_image(image_translate_state_t *s, int compare) +static void get_bilevel_image(image_translate_state_t *s, int compare) { int i; int len; @@ -191,12 +191,147 @@ static void get_flattened_image(image_translate_state_t *s, int compare) } /*- End of function --------------------------------------------------------*/ +static void get_gray8_image(image_translate_state_t *s, int compare) +{ + int i; + int j; + int len; + uint8_t row_buf[5000]; + + for (i = 0; i < s->output_length; i++) + { + if ((len = image_translate_row(s, row_buf, s->output_width)) != s->output_width) + { + printf("Image finished early - %d %d\n", len, s->output_width); + exit(2); + } + if (compare) + { + for (j = 0; j < 50; j++) + { + if (row_buf[j] != j*1200/256) + { + printf("Image mismatch - %d - %d\n", j, row_buf[3*j]); + exit(2); + } + } + } + } + if ((len = image_translate_row(s, row_buf, s->output_width)) != 0) + { + printf("Image finished late - %d %d\n", len, s->output_width); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void get_gray16_image(image_translate_state_t *s, int compare) +{ + int i; + int j; + int len; + uint16_t row_buf[5000]; + + for (i = 0; i < s->output_length; i++) + { + if ((len = image_translate_row(s, (uint8_t *) row_buf, 2*s->output_width)) != 2*s->output_width) + { + printf("Image finished early - %d %d\n", len, 2*s->output_width); + exit(2); + } + if (compare) + { + for (j = 0; j < 50; j++) + { + if (row_buf[j] != j*1200) + { + printf("Image mismatch - %d - %d\n", j, row_buf[j]); + exit(2); + } + } + } + } + if ((len = image_translate_row(s, (uint8_t *) row_buf, 2*s->output_width)) != 0) + { + printf("Image finished late - %d %d\n", len, 2*s->output_width); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void get_colour8_image(image_translate_state_t *s, int compare) +{ + int i; + int j; + int len; + uint8_t row_buf[5000]; + + for (i = 0; i < s->output_length; i++) + { + if ((len = image_translate_row(s, row_buf, 3*s->output_width)) != 3*s->output_width) + { + printf("Image finished early - %d %d\n", len, 3*s->output_width); + exit(2); + } + if (compare) + { + for (j = 0; j < 50; j++) + { + if (row_buf[3*j + 0] != j*1200/256 || row_buf[3*j + 1] != j*1200/256 || row_buf[3*j + 2] != j*1200/256) + { + printf("Image mismatch - %d - %d %d %d\n", j, row_buf[3*j + 0], row_buf[3*j + 1], row_buf[3*j + 2]); + exit(2); + } + } + } + } + if ((len = image_translate_row(s, row_buf, 2*s->output_width)) != 0) + { + printf("Image finished late - %d %d\n", len, 3*s->output_width); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + +static void get_colour16_image(image_translate_state_t *s, int compare) +{ + int i; + int j; + int len; + uint16_t row_buf[5000]; + + for (i = 0; i < s->output_length; i++) + { + if ((len = image_translate_row(s, (uint8_t *) row_buf, 6*s->output_width)) != 6*s->output_width) + { + printf("Image finished early - %d %d\n", len, 6*s->output_width); + exit(2); + } + if (compare) + { + for (j = 0; j < 50; j++) + { + if (row_buf[3*j + 0] != j*1200 || row_buf[3*j + 1] != j*1200 || row_buf[3*j + 2] != j*1200) + { + printf("Image mismatch - %d - %d %d %d\n", j, row_buf[3*j + 0], row_buf[3*j + 1], row_buf[3*j + 2]); + exit(2); + } + } + } + } + if ((len = image_translate_row(s, (uint8_t *) row_buf, 6*s->output_width)) != 0) + { + printf("Image finished late - %d %d\n", len, 6*s->output_width); + exit(2); + } +} +/*- End of function --------------------------------------------------------*/ + static void dither_tests_gray16(void) { int i; int j; - image_translate_state_t bw; - image_translate_state_t *s = &bw; + image_translate_state_t *s; uint16_t image[50*50]; image_descriptor_t im; @@ -213,8 +348,9 @@ static void dither_tests_gray16(void) image[i*im.width + j] = j*1200; } - s = image_translate_init(s, T4_IMAGE_TYPE_GRAY_12BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); - get_flattened_image(s, TRUE); + s = image_translate_init(NULL, T4_IMAGE_TYPE_GRAY_12BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); + get_bilevel_image(s, TRUE); + image_translate_free(s); } /*- End of function --------------------------------------------------------*/ @@ -222,8 +358,7 @@ static void dither_tests_gray8(void) { int i; int j; - image_translate_state_t bw; - image_translate_state_t *s = &bw; + image_translate_state_t *s; uint8_t image[50*50]; image_descriptor_t im; @@ -239,8 +374,10 @@ static void dither_tests_gray8(void) for (j = 0; j < im.width; j++) image[i*im.width + j] = j*1200/256; } - s = image_translate_init(s, T4_IMAGE_TYPE_GRAY_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); - get_flattened_image(s, TRUE); + + s = image_translate_init(NULL, T4_IMAGE_TYPE_GRAY_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); + get_bilevel_image(s, TRUE); + image_translate_free(s); } /*- End of function --------------------------------------------------------*/ @@ -248,8 +385,7 @@ static void dither_tests_colour16(void) { int i; int j; - image_translate_state_t bw; - image_translate_state_t *s = &bw; + image_translate_state_t *s; uint16_t image[50*50*3]; image_descriptor_t im; @@ -264,13 +400,96 @@ static void dither_tests_colour16(void) { for (j = 0; j < im.width; j++) { - image[i*3*im.width + 3*j + 0] = j*1200; - image[i*3*im.width + 3*j + 1] = j*1200; - image[i*3*im.width + 3*j + 2] = j*1200; + image[i*3*im.width + 3*j + 0] = j*1200 + i; + image[i*3*im.width + 3*j + 1] = j*1200 + i; + image[i*3*im.width + 3*j + 2] = j*1200 + i; } } - s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_12BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); - get_flattened_image(s, TRUE); + + s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_12BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); + get_bilevel_image(s, TRUE); + + printf("Scrunching from a 3x16 bit per sample colour to 8 bit per sample gray scale\n"); + im.image = (const uint8_t *) image; + im.width = 50; + im.length = 50; + im.bytes_per_pixel = 6; + im.current_row = 0; + + for (i = 0; i < im.length; i++) + { + for (j = 0; j < im.width; j++) + { + image[i*3*im.width + 3*j + 0] = j*1200 + i; + image[i*3*im.width + 3*j + 1] = j*1200 + i; + image[i*3*im.width + 3*j + 2] = j*1200 + i; + } + } + + s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_12BIT, im.width, im.length, T4_IMAGE_TYPE_GRAY_8BIT, -1, -1, row_read, &im); + get_gray8_image(s, TRUE); + + printf("Scrunching from a 3x16 bit per sample colour to 16 bit per sample gray scale\n"); + im.image = (const uint8_t *) image; + im.width = 50; + im.length = 50; + im.bytes_per_pixel = 6; + im.current_row = 0; + + for (i = 0; i < im.length; i++) + { + for (j = 0; j < im.width; j++) + { + image[i*3*im.width + 3*j + 0] = j*1200 + i; + image[i*3*im.width + 3*j + 1] = j*1200 + i; + image[i*3*im.width + 3*j + 2] = j*1200 + i; + } + } + + s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_12BIT, im.width, im.length, T4_IMAGE_TYPE_GRAY_12BIT, -1, -1, row_read, &im); + get_gray16_image(s, TRUE); + + printf("Scrunching from a 3x16 bit per sample colour to 3x8 bit per sample colour\n"); + im.image = (const uint8_t *) image; + im.width = 50; + im.length = 50; + im.bytes_per_pixel = 6; + im.current_row = 0; + + for (i = 0; i < im.length; i++) + { + for (j = 0; j < im.width; j++) + { + image[i*3*im.width + 3*j + 0] = j*1200 + i; + image[i*3*im.width + 3*j + 1] = j*1200 + i; + image[i*3*im.width + 3*j + 2] = j*1200 + i; + } + } + + s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_12BIT, im.width, im.length, T4_IMAGE_TYPE_COLOUR_8BIT, -1, -1, row_read, &im); + get_colour8_image(s, TRUE); + + printf("Scrunching from a 3x16 bit per sample colour to 3x16 bit per sample colour\n"); + im.image = (const uint8_t *) image; + im.width = 50; + im.length = 50; + im.bytes_per_pixel = 6; + im.current_row = 0; + + for (i = 0; i < im.length; i++) + { + for (j = 0; j < im.width; j++) + { + image[i*3*im.width + 3*j + 0] = j*1200 + i; + image[i*3*im.width + 3*j + 1] = j*1200 + i; + image[i*3*im.width + 3*j + 2] = j*1200 + i; + } + } + + s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_12BIT, im.width, im.length, T4_IMAGE_TYPE_COLOUR_12BIT, -1, -1, row_read, &im); + get_colour16_image(s, TRUE); + + image_translate_free(s); } /*- End of function --------------------------------------------------------*/ @@ -278,8 +497,7 @@ static void dither_tests_colour8(void) { int i; int j; - image_translate_state_t bw; - image_translate_state_t *s = &bw; + image_translate_state_t *s; uint8_t image[50*50*3]; image_descriptor_t im; @@ -294,14 +512,15 @@ static void dither_tests_colour8(void) { for (j = 0; j < im.width; j++) { - image[i*3*im.width + 3*j + 0] = j*1200/256; - image[i*3*im.width + 3*j + 1] = j*1200/256; - image[i*3*im.width + 3*j + 2] = j*1200/256; + image[i*3*im.width + 3*j + 0] = j*1200/256 + i; + image[i*3*im.width + 3*j + 1] = j*1200/256 + i; + image[i*3*im.width + 3*j + 2] = j*1200/256 + i; } } - s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); - get_flattened_image(s, TRUE); + s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, -1, -1, row_read, &im); + get_bilevel_image(s, TRUE); + image_translate_free(s); } /*- End of function --------------------------------------------------------*/ @@ -309,8 +528,7 @@ static void grow_tests_colour8(void) { int i; int j; - image_translate_state_t resize; - image_translate_state_t *s1 = &resize; + image_translate_state_t *s; uint8_t image[50*50*3]; image_descriptor_t im; @@ -325,15 +543,15 @@ static void grow_tests_colour8(void) { for (j = 0; j < im.width; j++) { - image[i*3*im.width + 3*j + 0] = j*1200/256; - image[i*3*im.width + 3*j + 1] = j*1200/256; - image[i*3*im.width + 3*j + 2] = j*1200/256; + image[i*3*im.width + 3*j + 0] = j*1200/256 + i; + image[i*3*im.width + 3*j + 1] = j*1200/256 + i; + image[i*3*im.width + 3*j + 2] = j*1200/256 + i; } } - s1 = image_translate_init(s1, T4_IMAGE_TYPE_COLOUR_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, 200, -1, row_read, &im); - - get_flattened_image(s1, FALSE); + s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_8BIT, im.width, im.length, T4_IMAGE_TYPE_BILEVEL, 200, -1, row_read, &im); + get_bilevel_image(s, FALSE); + image_translate_free(s); } /*- End of function --------------------------------------------------------*/ @@ -352,8 +570,7 @@ static void lenna_tests(int output_width, int output_length_scaling, const char int16_t samples_per_pixel; int i; int n; - image_translate_state_t bw; - image_translate_state_t *s = &bw; + image_translate_state_t *s; image_descriptor_t im; float x_resolution; float y_resolution; @@ -375,7 +592,7 @@ static void lenna_tests(int output_width, int output_length_scaling, const char y_resolution = 200.0; TIFFGetField(in_file, TIFFTAG_YRESOLUTION, &y_resolution); res_unit = RESUNIT_INCH; - TIFFSetField(in_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); + TIFFGetField(in_file, TIFFTAG_RESOLUTIONUNIT, &res_unit); bits_per_sample = 0; TIFFGetField(in_file, TIFFTAG_BITSPERSAMPLE, &bits_per_sample); samples_per_pixel = 0; @@ -409,7 +626,7 @@ static void lenna_tests(int output_width, int output_length_scaling, const char im.current_row = 0; im.bytes_per_pixel = samples_per_pixel; - s = image_translate_init(s, T4_IMAGE_TYPE_COLOUR_8BIT, image_width, image_length, T4_IMAGE_TYPE_BILEVEL, output_width, output_length, row_read, &im); + s = image_translate_init(NULL, T4_IMAGE_TYPE_COLOUR_8BIT, image_width, image_length, T4_IMAGE_TYPE_BILEVEL, output_width, output_length, row_read, &im); output_width = image_translate_get_output_width(s); output_length = image_translate_get_output_length(s); @@ -445,6 +662,7 @@ static void lenna_tests(int output_width, int output_length_scaling, const char TIFFWriteEncodedStrip(out_file, 0, image2, output_width*output_length/8); TIFFWriteDirectory(out_file); TIFFClose(out_file); + image_translate_free(s); } /*- End of function --------------------------------------------------------*/ From 9a26b3a8a78d2e948d1e293c3775485982489d93 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 8 Aug 2012 21:31:45 +0800 Subject: [PATCH 0876/1057] Fixed harmless typos in comments --- libs/spandsp/src/spandsp/ima_adpcm.h | 2 +- libs/spandsp/src/spandsp/private/ima_adpcm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/spandsp/src/spandsp/ima_adpcm.h b/libs/spandsp/src/spandsp/ima_adpcm.h index 27be7ec736..292bdd5d83 100644 --- a/libs/spandsp/src/spandsp/ima_adpcm.h +++ b/libs/spandsp/src/spandsp/ima_adpcm.h @@ -2,7 +2,7 @@ * SpanDSP - a series of DSP components for telephony * * ima_adpcm.c - Conversion routines between linear 16 bit PCM data and - * IMA/DVI/Intel ADPCM format. + * IMA/DVI/Intel ADPCM format. * * Written by Steve Underwood * diff --git a/libs/spandsp/src/spandsp/private/ima_adpcm.h b/libs/spandsp/src/spandsp/private/ima_adpcm.h index 1685906c28..21ead941af 100644 --- a/libs/spandsp/src/spandsp/private/ima_adpcm.h +++ b/libs/spandsp/src/spandsp/private/ima_adpcm.h @@ -2,7 +2,7 @@ * SpanDSP - a series of DSP components for telephony * * private/ima_adpcm.c - Conversion routines between linear 16 bit PCM data - * and IMA/DVI/Intel ADPCM format. + * and IMA/DVI/Intel ADPCM format. * * Written by Steve Underwood * From 47f614d40ad9b79971645fc622cd6a48bb0a4a0c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 8 Aug 2012 09:59:36 -0500 Subject: [PATCH 0877/1057] FS-4507 --resolve --- src/mod/endpoints/mod_sofia/sofia_presence.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 23db7d0094..0433f84ba1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2365,6 +2365,10 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r prpid = "onthephone"; } + if (zstr(open)) { + open = "open"; + } + ret = switch_mprintf("\n" "\n" "\n" @@ -2945,7 +2949,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * open = "closed"; } - if (open_closed) { + if (!zstr(open_closed)) { open = open_closed; } @@ -2977,7 +2981,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * open = "closed"; } - if (open_closed) { + if (!zstr(open_closed)) { open = open_closed; } From 210acdd165ba39963bfc1b4c989621b31e787299 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 8 Aug 2012 10:08:29 -0500 Subject: [PATCH 0878/1057] FS-4505 --resolve --- src/mod/endpoints/mod_rtmp/mod_rtmp.c | 8 +++++++- src/mod/endpoints/mod_rtmp/mod_rtmp.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 6b5bc862c9..0dd91cbecb 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -1048,6 +1048,10 @@ void rtmp_add_registration(rtmp_session_t *rsession, const char *auth, const cha dup = strdup(auth); switch_split_user_domain(dup, &user, &domain); + + + reg->user = switch_core_strdup(rsession->pool, user); + reg->domain = switch_core_strdup(rsession->pool, domain); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "User", user); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Domain", domain); @@ -1072,9 +1076,11 @@ static void rtmp_clear_reg_auth(rtmp_session_t *rsession, const char *auth, cons /* Replace hash entry by its next ptr */ switch_core_hash_insert(rsession->profile->reg_hash, auth, reg->next); } - + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, RTMP_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) { rtmp_event_fill(rsession, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "User", reg->user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Domain", reg->domain); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Nickname", switch_str_nil(reg->nickname)); switch_event_fire(&event); } diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.h b/src/mod/endpoints/mod_rtmp/mod_rtmp.h index 6109c8544e..24ef575449 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.h +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.h @@ -529,6 +529,8 @@ typedef struct rtmp_reg rtmp_reg_t; struct rtmp_reg { const char *uuid; /* < The rtmp session id */ const char *nickname; /* < This instance's nickname, optional */ + const char *user; + const char *domain; rtmp_reg_t *next; /* < Next entry */ }; From ef5c1256f3a64502880bb232ea17a673e3e4eb10 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 8 Aug 2012 14:46:38 -0500 Subject: [PATCH 0879/1057] add rtp endpoint contributed by sangoma --- src/mod/endpoints/mod_sofia/Makefile.am | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 + src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/rtp.c | 649 ++++++++++++++++++++++++ 4 files changed, 653 insertions(+), 1 deletion(-) create mode 100644 src/mod/endpoints/mod_sofia/rtp.c diff --git a/src/mod/endpoints/mod_sofia/Makefile.am b/src/mod/endpoints/mod_sofia/Makefile.am index fb0ab25e0b..efd6b2c385 100644 --- a/src/mod/endpoints/mod_sofia/Makefile.am +++ b/src/mod/endpoints/mod_sofia/Makefile.am @@ -9,7 +9,7 @@ SOFIAUA_BUILDDIR=$(SOFIA_BUILDDIR)/libsofia-sip-ua SOFIALA=$(SOFIAUA_BUILDDIR)/libsofia-sip-ua.la mod_LTLIBRARIES = mod_sofia.la -mod_sofia_la_SOURCES = mod_sofia.c sofia.c sofia_glue.c sofia_presence.c sofia_reg.c sip-dig.c mod_sofia.h +mod_sofia_la_SOURCES = mod_sofia.c sofia.c sofia_glue.c sofia_presence.c sofia_reg.c sip-dig.c rtp.c mod_sofia.h mod_sofia_la_CFLAGS = $(AM_CFLAGS) -I. $(SOFIA_CMD_LINE_CFLAGS) mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/bnf -I$(SOFIAUA_BUILDDIR)/bnf mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/http -I$(SOFIAUA_BUILDDIR)/http diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 52e7333607..650b898399 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5705,6 +5705,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) SWITCH_ADD_API(api_interface, "sofia_dig", "SIP DIG", sip_dig_function, ""); SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send); + crtp_init(*module_interface); + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5ef35315e7..6d01de8a38 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1190,6 +1190,7 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool); void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now); void sofia_msg_thread_start(int idx); +void crtp_init(switch_loadable_module_interface_t *module_interface); /* For Emacs: diff --git a/src/mod/endpoints/mod_sofia/rtp.c b/src/mod/endpoints/mod_sofia/rtp.c new file mode 100644 index 0000000000..bf3e36ca19 --- /dev/null +++ b/src/mod/endpoints/mod_sofia/rtp.c @@ -0,0 +1,649 @@ +/* + * 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): + * + * Mathieu Rene + * + * rtp.c -- RTP Controllable Channel Module + * + */ + +#include +#include "mod_sofia.h" + +#define kLOCALADDR "local_addr" +#define kLOCALPORT "local_port" +#define kREMOTEADDR "remote_addr" +#define kREMOTEPORT "remote_port" +#define kCODEC "codec" +#define kPTIME "ptime" +#define kPT "pt" +#define kRFC2833PT "rfc2833_pt" +#define kMODE "mode" +#define kRATE "rate" + +static struct { + switch_memory_pool_t *pool; + switch_endpoint_interface_t *endpoint_interface; +} crtp; + +typedef struct { + switch_core_session_t *session; + switch_channel_t *channel; + switch_codec_t read_codec, write_codec; + switch_frame_t read_frame; + + + + switch_rtp_bug_flag_t rtp_bugs; + switch_rtp_t *rtp_session; + + uint32_t timestamp_send; + + const char *local_address; + const char *remote_address; + const char *codec; + int ptime; + + const switch_codec_implementation_t *negotiated_codecs[SWITCH_MAX_CODECS]; + int num_negotiated_codecs; + + char *origin; + + switch_port_t local_port; + switch_port_t remote_port; + switch_payload_t agreed_pt; /*XXX*/ + sofia_dtmf_t dtmf_type; + enum { + RTP_SENDONLY, + RTP_RECVONLY, + RTP_SENDRECV + } mode; +} crtp_private_t; + +static switch_status_t channel_on_init(switch_core_session_t *session); +static switch_status_t channel_on_destroy(switch_core_session_t *session); +static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, + switch_memory_pool_t **pool, + switch_originate_flag_t flags, switch_call_cause_t *cancel_cause); +static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); +static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); +static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg); +static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf); +static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event); + +switch_state_handler_table_t crtp_state_handlers = { + .on_init = channel_on_init, + .on_destroy = channel_on_destroy +}; + +switch_io_routines_t crtp_io_routines = { + .outgoing_channel = channel_outgoing_channel, + .read_frame = channel_read_frame, + .write_frame = channel_write_frame, + .receive_message = channel_receive_message, + .receive_event = channel_receive_event, + .send_dtmf = channel_send_dtmf +}; + + +void crtp_init(switch_loadable_module_interface_t *module_interface) +{ + switch_endpoint_interface_t *endpoint_interface; + //switch_api_interface_t *api_interface; + + crtp.pool = module_interface->pool; + endpoint_interface = switch_loadable_module_create_interface(module_interface, SWITCH_ENDPOINT_INTERFACE); + endpoint_interface->interface_name = "rtp"; + endpoint_interface->io_routines = &crtp_io_routines; + endpoint_interface->state_handler = &crtp_state_handlers; + crtp.endpoint_interface = endpoint_interface; + + //SWITCH_ADD_API(api_interface, "rtp_test", "test", test_function, ""); +} + +static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, + switch_memory_pool_t **pool, + switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) +{ + switch_channel_t *channel; + char name[128]; + crtp_private_t *tech_pvt = NULL; + switch_caller_profile_t *caller_profile; + + const char *err; + + + const char *local_addr = switch_event_get_header_nil(var_event, kLOCALADDR), + *szlocal_port = switch_event_get_header_nil(var_event, kLOCALPORT), + *remote_addr = switch_event_get_header_nil(var_event, kREMOTEADDR), + *szremote_port = switch_event_get_header_nil(var_event, kREMOTEPORT), + *codec = switch_event_get_header_nil(var_event, kCODEC), + *szptime = switch_event_get_header_nil(var_event, kPTIME), + //*mode = switch_event_get_header_nil(var_event, kMODE), + //*szrfc2833_pt = switch_event_get_header_nil(var_event, kRFC2833PT), + *szrate = switch_event_get_header_nil(var_event, kRATE), + *szpt = switch_event_get_header_nil(var_event, kPT); + + + switch_port_t local_port = !zstr(szlocal_port) ? atoi(szlocal_port) : 0, + remote_port = !zstr(szremote_port) ? atoi(szremote_port) : 0; + + int ptime = !zstr(szptime) ? atoi(szptime) : 0, + //rfc2833_pt = !zstr(szrfc2833_pt) ? atoi(szrfc2833_pt) : 0, + rate = !zstr(szrate) ? atoi(szrate) : 8000, + pt = !zstr(szpt) ? atoi(szpt) : 0; + + if ( + ((zstr(remote_addr) || remote_port == 0) && (zstr(local_addr) || local_port == 0)) || + zstr(codec) || + zstr(szpt)) { + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required arguments\n"); + goto fail; + } + + + if (!(*new_session = switch_core_session_request(crtp.endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, 0, pool))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't request session.\n"); + goto fail; + } + + channel = switch_core_session_get_channel(*new_session); + + tech_pvt = switch_core_session_alloc(*new_session, sizeof *tech_pvt); + tech_pvt->session = *new_session; + tech_pvt->channel = channel; + tech_pvt->local_address = switch_core_session_strdup(*new_session, local_addr); + tech_pvt->local_port = local_port; + tech_pvt->remote_address = switch_core_session_strdup(*new_session, remote_addr); + tech_pvt->remote_port = remote_port; + tech_pvt->ptime = ptime; + tech_pvt->agreed_pt = pt; + tech_pvt->dtmf_type = DTMF_2833; /* XXX */ + + if (zstr(local_addr) || local_port == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "The local address and port must be set\n"); + goto fail; + } else if (zstr(remote_addr) || remote_port == 0) { + tech_pvt->mode = RTP_RECVONLY; + } else { + tech_pvt->mode = RTP_SENDRECV; + } + + switch_core_session_set_private(*new_session, tech_pvt); + + caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); + switch_channel_set_caller_profile(channel, caller_profile); + + + snprintf(name, sizeof(name), "rtp/%s", outbound_profile->destination_number); + switch_channel_set_name(channel, name); + + switch_channel_set_state(channel, CS_INIT); + + if (switch_core_codec_init(&tech_pvt->read_codec, + codec, + NULL, + rate, + ptime, + 1, + /*SWITCH_CODEC_FLAG_ENCODE |*/ SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); + goto fail; + } else { + if (switch_core_codec_init(&tech_pvt->write_codec, + codec, + NULL, + rate, + ptime, + 1, + SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); + goto fail; + } + } + + if (switch_core_session_set_read_codec(*new_session, &tech_pvt->read_codec) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set read codec?\n"); + goto fail; + } + + if (switch_core_session_set_write_codec(*new_session, &tech_pvt->write_codec) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set write codec?\n"); + goto fail; + } + + if (!(tech_pvt->rtp_session = switch_rtp_new(local_addr, local_port, remote_addr, remote_port, tech_pvt->agreed_pt, + tech_pvt->read_codec.implementation->samples_per_packet, ptime * 1000, + flags, "soft", &err, switch_core_session_get_pool(*new_session)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't setup RTP session: [%s]\n", err); + goto fail; + } + + if (switch_core_session_thread_launch(*new_session) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start session thread.\n"); + goto fail; + } + + switch_channel_mark_answered(channel); + + return SWITCH_CAUSE_SUCCESS; + +fail: + if (tech_pvt) { + if (tech_pvt->read_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->read_codec); + } + + if (tech_pvt->write_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->write_codec); + } + } + + if (*new_session) { + switch_core_session_destroy(new_session); + } + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; +} + +static switch_status_t channel_on_init(switch_core_session_t *session) +{ + + switch_channel_t *channel = switch_core_session_get_channel(session); + + switch_channel_set_state(channel, CS_CONSUME_MEDIA); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t channel_on_destroy(switch_core_session_t *session) +{ + crtp_private_t *tech_pvt = switch_core_session_get_private(session); + + if ((tech_pvt = switch_core_session_get_private(session))) { + + if (tech_pvt->read_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->read_codec); + } + + if (tech_pvt->write_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->write_codec); + } + } + + return SWITCH_STATUS_SUCCESS; +} + + +static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) +{ + crtp_private_t *tech_pvt; + switch_channel_t *channel; + switch_status_t status; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + if (!tech_pvt->rtp_session || tech_pvt->mode == RTP_SENDONLY) { + switch_yield(20000); /* replace by local timer XXX */ + goto cng; + } + + if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) { + switch_dtmf_t dtmf = { 0 }; + switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf); + switch_channel_queue_dtmf(channel, &dtmf); + } + + tech_pvt->read_frame.flags = SFF_NONE; + tech_pvt->read_frame.codec = &tech_pvt->read_codec; + status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags); + + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { + goto cng; + } + + *frame = &tech_pvt->read_frame; + return SWITCH_STATUS_SUCCESS; + +cng: + *frame = &tech_pvt->read_frame; + tech_pvt->read_frame.codec = &tech_pvt->read_codec; + tech_pvt->read_frame.flags |= SFF_CNG; + tech_pvt->read_frame.datalen = 0; + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) +{ + crtp_private_t *tech_pvt; + switch_channel_t *channel; + //int frames = 0, bytes = 0, samples = 0; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + +#if 0 + if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) { + if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) { + bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet; + frames = ((int) frame->datalen / bytes); + } else + frames = 1; + + samples = frames * tech_pvt->read_codec.implementation->samples_per_packet; + } + + tech_pvt->timestamp_send += samples; +#endif + if (tech_pvt->mode == RTP_RECVONLY) { + return SWITCH_STATUS_SUCCESS; + } + + switch_rtp_write_frame(tech_pvt->rtp_session, frame); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) +{ + crtp_private_t *tech_pvt = NULL; + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + switch(tech_pvt->dtmf_type) { + case DTMF_2833: + { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Enqueuing RFC2833 DTMF %c of length %d\n", dtmf->digit, dtmf->duration); + return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf); + } + case DTMF_NONE: + default: + { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding DTMF %c of length %d, DTMF type is NONE\n", dtmf->digit, dtmf->duration); + } + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_bool_t compare_var(switch_event_t *event, switch_channel_t *channel, const char *varname) +{ + const char *chan_val = switch_channel_get_variable_dup(channel, varname, SWITCH_FALSE, -1); + const char *event_val = switch_event_get_header(event, varname); + + if (zstr(chan_val) || zstr(event_val)) { + return 1; + } + + return strcasecmp(chan_val, event_val); +} + +static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event) +{ + const char *command = switch_event_get_header(event, "command"); + switch_channel_t *channel = switch_core_session_get_channel(session); + crtp_private_t *tech_pvt = switch_core_session_get_private(session); + char *codec = switch_event_get_header_nil(event, kCODEC); + char *szptime = switch_event_get_header_nil(event, kPTIME); + char *szrate = switch_event_get_header_nil(event, kRATE); + char *szpt = switch_event_get_header_nil(event, kPT); + + int ptime = !zstr(szptime) ? atoi(szptime) : 0, + rate = !zstr(szrate) ? atoi(szrate) : 8000, + pt = !zstr(szpt) ? atoi(szpt) : 0; + + + if (!zstr(command) && !strcasecmp(command, "media_modify")) { + /* Compare parameters */ + if (compare_var(event, channel, kREMOTEADDR) || + compare_var(event, channel, kREMOTEPORT)) { + char *remote_addr = switch_event_get_header(event, kREMOTEADDR); + char *szremote_port = switch_event_get_header(event, kREMOTEPORT); + switch_port_t remote_port = !zstr(szremote_port) ? atoi(szremote_port) : 0; + const char *err; + + + switch_channel_set_variable(channel, kREMOTEADDR, remote_addr); + switch_channel_set_variable(channel, kREMOTEPORT, szremote_port); + + if (switch_rtp_set_remote_address(tech_pvt->rtp_session, remote_addr, remote_port, 0, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error setting RTP remote address: %s\n", err); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set RTP remote: %s:%d\n", remote_addr, (int)remote_port); + tech_pvt->mode = RTP_SENDRECV; + } + } + + if (compare_var(event, channel, kCODEC) || + compare_var(event, channel, kPTIME) || + compare_var(event, channel, kPT) || + compare_var(event, channel, kRATE)) { + /* Reset codec */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Switching codec updating \n"); + + if (switch_core_codec_init(&tech_pvt->read_codec, + codec, + NULL, + rate, + ptime, + 1, + /*SWITCH_CODEC_FLAG_ENCODE |*/ SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); + goto fail; + } else { + if (switch_core_codec_init(&tech_pvt->write_codec, + codec, + NULL, + rate, + ptime, + 1, + SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/, + NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); + goto fail; + } + } + + if (switch_core_session_set_read_codec(session, &tech_pvt->read_codec) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set read codec?\n"); + goto fail; + } + + if (switch_core_session_set_write_codec(session, &tech_pvt->write_codec) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set write codec?\n"); + goto fail; + } + + switch_rtp_set_default_payload(tech_pvt->rtp_session, pt); + switch_rtp_set_recv_pt(tech_pvt->rtp_session, pt); + } + + if (compare_var(event, channel, kRFC2833PT)) { + const char *szpt = switch_channel_get_variable(channel, kRFC2833PT); + int pt = !zstr(szpt) ? atoi(szpt) : 0; + + switch_channel_set_variable(channel, kRFC2833PT, szpt); + switch_rtp_set_telephony_event(tech_pvt->rtp_session, pt); + } + + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received unknown command [%s] in event.\n", !command ? "null" : command); + } + + return SWITCH_STATUS_SUCCESS; +fail: + if (tech_pvt) { + if (tech_pvt->read_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->read_codec); + } + + if (tech_pvt->write_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->write_codec); + } + } + + if (session) { + switch_core_session_destroy(&session); + } + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + +} + +static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) +{ + crtp_private_t *tech_pvt = NULL; + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + switch (msg->message_id) { + case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: + { + if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { + int32_t flags = 0; + if (!strcasecmp(msg->string_array_arg[0], "read")) { + flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ; + } else if (!strcasecmp(msg->string_array_arg[0], "write")) { + flags |= SWITCH_RTP_FLAG_DEBUG_RTP_WRITE; + } else if (!strcasecmp(msg->string_array_arg[0], "both")) { + flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ | SWITCH_RTP_FLAG_DEBUG_RTP_WRITE; + } + + if (flags) { + if (switch_true(msg->string_array_arg[1])) { + switch_rtp_set_flag(tech_pvt->rtp_session, flags); + } else { + switch_rtp_clear_flag(tech_pvt->rtp_session, flags); + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Options\n"); + } + } + break; + } + case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC: + if (switch_rtp_ready(tech_pvt->rtp_session)) { + rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE); + } + break; + case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER: + { + if (switch_rtp_ready(tech_pvt->rtp_session)) { + int len = 0, maxlen = 0, qlen = 0, maxqlen = 50, max_drift = 0; + + if (msg->string_arg) { + char *p, *q; + const char *s; + + if (!strcasecmp(msg->string_arg, "pause")) { + switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE); + goto end; + } else if (!strcasecmp(msg->string_arg, "resume")) { + switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_FALSE); + goto end; + } else if (!strncasecmp(msg->string_arg, "debug:", 6)) { + s = msg->string_arg + 6; + if (s && !strcmp(s, "off")) { + s = NULL; + } + switch_rtp_debug_jitter_buffer(tech_pvt->rtp_session, s); + goto end; + } + + + if ((len = atoi(msg->string_arg))) { + qlen = len / (tech_pvt->read_codec.implementation->microseconds_per_packet / 1000); + if (qlen < 1) { + qlen = 3; + } + } + + if (qlen) { + if ((p = strchr(msg->string_arg, ':'))) { + p++; + maxlen = atol(p); + if ((q = strchr(p, ':'))) { + q++; + max_drift = abs(atol(q)); + } + } + } + + + if (maxlen) { + maxqlen = maxlen / (tech_pvt->read_codec.implementation->microseconds_per_packet / 1000); + } + } + + if (qlen) { + if (maxqlen < qlen) { + maxqlen = qlen * 5; + } + if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen, + tech_pvt->read_codec.implementation->samples_per_packet, + tech_pvt->read_codec.implementation->samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), + SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames) (%d max drift)\n", + len, qlen, maxqlen, max_drift); + switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER); + if (!switch_false(switch_channel_get_variable(tech_pvt->channel, "sip_jitter_buffer_plc"))) { + switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER_PLC); + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), + SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen); + } + + } else { + switch_rtp_deactivate_jitter_buffer(tech_pvt->rtp_session); + } + } + } + break; + + default: + break; + } +end: + return SWITCH_STATUS_SUCCESS; +} + From 6fa2fd36787b0908bb8bf2f9299aa5280629cccc Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 8 Aug 2012 17:05:01 -0500 Subject: [PATCH 0880/1057] add ws --- libs/libwebsockets/.gitignore | 16 + libs/libwebsockets/COPYING | 503 +++ libs/libwebsockets/INSTALL | 365 ++ libs/libwebsockets/Makefile.am | 2 + libs/libwebsockets/Makefile.in | 738 ++++ libs/libwebsockets/README-test-server | 292 ++ libs/libwebsockets/configure.ac | 130 + libs/libwebsockets/lib/Makefile.am | 44 + libs/libwebsockets/lib/Makefile.in | 665 ++++ libs/libwebsockets/lib/base64-decode.c | 188 + libs/libwebsockets/lib/client-handshake.c | 408 +++ .../lib/extension-deflate-stream.c | 150 + .../lib/extension-deflate-stream.h | 18 + .../lib/extension-x-google-mux.c | 1223 +++++++ .../lib/extension-x-google-mux.h | 96 + libs/libwebsockets/lib/extension.c | 22 + libs/libwebsockets/lib/handshake.c | 722 ++++ libs/libwebsockets/lib/libwebsockets.c | 3183 +++++++++++++++++ libs/libwebsockets/lib/libwebsockets.h | 731 ++++ libs/libwebsockets/lib/md5.c | 217 ++ libs/libwebsockets/lib/parsers.c | 1967 ++++++++++ .../libwebsockets/lib/private-libwebsockets.h | 445 +++ libs/libwebsockets/lib/sha-1.c | 326 ++ libs/libwebsockets/libwebsockets-api-doc.html | 933 +++++ libs/libwebsockets/libwebsockets.spec | 63 + libs/libwebsockets/scripts/kernel-doc | 2238 ++++++++++++ libs/libwebsockets/test-server/Makefile.am | 61 + libs/libwebsockets/test-server/Makefile.in | 722 ++++ libs/libwebsockets/test-server/favicon.ico | Bin 0 -> 1406 bytes libs/libwebsockets/test-server/test-client.c | 341 ++ libs/libwebsockets/test-server/test-fraggle.c | 333 ++ libs/libwebsockets/test-server/test-ping.c | 512 +++ .../test-server/test-server-extpoll.c | 553 +++ libs/libwebsockets/test-server/test-server.c | 551 +++ libs/libwebsockets/test-server/test.html | 361 ++ .../win32port/client/client.vcxproj | 259 ++ .../win32port/client/client.vcxproj.filters | 39 + .../libwebsocketswin32.vcxproj | 274 ++ .../libwebsocketswin32.vcxproj.filters | 72 + .../win32port/server/server.vcxproj | 276 ++ .../win32port/server/server.vcxproj.filters | 51 + .../win32port/win32helpers/getopt.c | 153 + .../win32port/win32helpers/getopt.h | 33 + .../win32port/win32helpers/getopt_long.c | 237 ++ .../win32port/win32helpers/gettimeofday.c | 48 + .../win32port/win32helpers/gettimeofday.h | 28 + .../win32port/win32helpers/netdb.h | 1 + .../win32port/win32helpers/strings.h | 0 .../win32port/win32helpers/sys/time.h | 1 + .../win32port/win32helpers/unistd.h | 0 .../win32port/win32helpers/websock-w32.c | 104 + .../win32port/win32helpers/websock-w32.h | 64 + libs/libwebsockets/win32port/win32port.sln | 100 + .../libwebsockets/win32port/zlib/ZLib.vcxproj | 374 ++ .../win32port/zlib/ZLib.vcxproj.filters | 95 + libs/libwebsockets/win32port/zlib/adler32.c | 169 + libs/libwebsockets/win32port/zlib/compress.c | 80 + libs/libwebsockets/win32port/zlib/crc32.c | 442 +++ libs/libwebsockets/win32port/zlib/crc32.h | 441 +++ libs/libwebsockets/win32port/zlib/deflate.c | 1834 ++++++++++ libs/libwebsockets/win32port/zlib/deflate.h | 342 ++ libs/libwebsockets/win32port/zlib/gzclose.c | 25 + libs/libwebsockets/win32port/zlib/gzguts.h | 132 + libs/libwebsockets/win32port/zlib/gzio.c | 1005 ++++++ libs/libwebsockets/win32port/zlib/gzlib.c | 537 +++ libs/libwebsockets/win32port/zlib/gzread.c | 653 ++++ libs/libwebsockets/win32port/zlib/gzwrite.c | 531 +++ libs/libwebsockets/win32port/zlib/infback.c | 632 ++++ libs/libwebsockets/win32port/zlib/inffast.c | 340 ++ libs/libwebsockets/win32port/zlib/inffast.h | 11 + libs/libwebsockets/win32port/zlib/inffixed.h | 94 + libs/libwebsockets/win32port/zlib/inflate.c | 1480 ++++++++ libs/libwebsockets/win32port/zlib/inflate.h | 122 + libs/libwebsockets/win32port/zlib/inftrees.c | 330 ++ libs/libwebsockets/win32port/zlib/inftrees.h | 62 + libs/libwebsockets/win32port/zlib/trees.c | 1244 +++++++ libs/libwebsockets/win32port/zlib/trees.h | 128 + libs/libwebsockets/win32port/zlib/uncompr.c | 59 + libs/libwebsockets/win32port/zlib/zconf.h | 428 +++ libs/libwebsockets/win32port/zlib/zlib.h | 1613 +++++++++ libs/libwebsockets/win32port/zlib/zutil.c | 318 ++ libs/libwebsockets/win32port/zlib/zutil.h | 274 ++ 82 files changed, 34654 insertions(+) create mode 100644 libs/libwebsockets/.gitignore create mode 100644 libs/libwebsockets/COPYING create mode 100644 libs/libwebsockets/INSTALL create mode 100644 libs/libwebsockets/Makefile.am create mode 100644 libs/libwebsockets/Makefile.in create mode 100644 libs/libwebsockets/README-test-server create mode 100644 libs/libwebsockets/configure.ac create mode 100644 libs/libwebsockets/lib/Makefile.am create mode 100644 libs/libwebsockets/lib/Makefile.in create mode 100644 libs/libwebsockets/lib/base64-decode.c create mode 100644 libs/libwebsockets/lib/client-handshake.c create mode 100644 libs/libwebsockets/lib/extension-deflate-stream.c create mode 100644 libs/libwebsockets/lib/extension-deflate-stream.h create mode 100644 libs/libwebsockets/lib/extension-x-google-mux.c create mode 100644 libs/libwebsockets/lib/extension-x-google-mux.h create mode 100644 libs/libwebsockets/lib/extension.c create mode 100644 libs/libwebsockets/lib/handshake.c create mode 100644 libs/libwebsockets/lib/libwebsockets.c create mode 100644 libs/libwebsockets/lib/libwebsockets.h create mode 100644 libs/libwebsockets/lib/md5.c create mode 100644 libs/libwebsockets/lib/parsers.c create mode 100644 libs/libwebsockets/lib/private-libwebsockets.h create mode 100644 libs/libwebsockets/lib/sha-1.c create mode 100644 libs/libwebsockets/libwebsockets-api-doc.html create mode 100644 libs/libwebsockets/libwebsockets.spec create mode 100755 libs/libwebsockets/scripts/kernel-doc create mode 100644 libs/libwebsockets/test-server/Makefile.am create mode 100644 libs/libwebsockets/test-server/Makefile.in create mode 100644 libs/libwebsockets/test-server/favicon.ico create mode 100644 libs/libwebsockets/test-server/test-client.c create mode 100644 libs/libwebsockets/test-server/test-fraggle.c create mode 100644 libs/libwebsockets/test-server/test-ping.c create mode 100644 libs/libwebsockets/test-server/test-server-extpoll.c create mode 100644 libs/libwebsockets/test-server/test-server.c create mode 100644 libs/libwebsockets/test-server/test.html create mode 100644 libs/libwebsockets/win32port/client/client.vcxproj create mode 100644 libs/libwebsockets/win32port/client/client.vcxproj.filters create mode 100644 libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj create mode 100644 libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj.filters create mode 100644 libs/libwebsockets/win32port/server/server.vcxproj create mode 100644 libs/libwebsockets/win32port/server/server.vcxproj.filters create mode 100644 libs/libwebsockets/win32port/win32helpers/getopt.c create mode 100644 libs/libwebsockets/win32port/win32helpers/getopt.h create mode 100644 libs/libwebsockets/win32port/win32helpers/getopt_long.c create mode 100644 libs/libwebsockets/win32port/win32helpers/gettimeofday.c create mode 100644 libs/libwebsockets/win32port/win32helpers/gettimeofday.h create mode 100644 libs/libwebsockets/win32port/win32helpers/netdb.h create mode 100644 libs/libwebsockets/win32port/win32helpers/strings.h create mode 100644 libs/libwebsockets/win32port/win32helpers/sys/time.h create mode 100644 libs/libwebsockets/win32port/win32helpers/unistd.h create mode 100644 libs/libwebsockets/win32port/win32helpers/websock-w32.c create mode 100644 libs/libwebsockets/win32port/win32helpers/websock-w32.h create mode 100644 libs/libwebsockets/win32port/win32port.sln create mode 100644 libs/libwebsockets/win32port/zlib/ZLib.vcxproj create mode 100644 libs/libwebsockets/win32port/zlib/ZLib.vcxproj.filters create mode 100644 libs/libwebsockets/win32port/zlib/adler32.c create mode 100644 libs/libwebsockets/win32port/zlib/compress.c create mode 100644 libs/libwebsockets/win32port/zlib/crc32.c create mode 100644 libs/libwebsockets/win32port/zlib/crc32.h create mode 100644 libs/libwebsockets/win32port/zlib/deflate.c create mode 100644 libs/libwebsockets/win32port/zlib/deflate.h create mode 100755 libs/libwebsockets/win32port/zlib/gzclose.c create mode 100755 libs/libwebsockets/win32port/zlib/gzguts.h create mode 100644 libs/libwebsockets/win32port/zlib/gzio.c create mode 100755 libs/libwebsockets/win32port/zlib/gzlib.c create mode 100755 libs/libwebsockets/win32port/zlib/gzread.c create mode 100755 libs/libwebsockets/win32port/zlib/gzwrite.c create mode 100644 libs/libwebsockets/win32port/zlib/infback.c create mode 100644 libs/libwebsockets/win32port/zlib/inffast.c create mode 100644 libs/libwebsockets/win32port/zlib/inffast.h create mode 100644 libs/libwebsockets/win32port/zlib/inffixed.h create mode 100644 libs/libwebsockets/win32port/zlib/inflate.c create mode 100644 libs/libwebsockets/win32port/zlib/inflate.h create mode 100644 libs/libwebsockets/win32port/zlib/inftrees.c create mode 100644 libs/libwebsockets/win32port/zlib/inftrees.h create mode 100644 libs/libwebsockets/win32port/zlib/trees.c create mode 100644 libs/libwebsockets/win32port/zlib/trees.h create mode 100644 libs/libwebsockets/win32port/zlib/uncompr.c create mode 100644 libs/libwebsockets/win32port/zlib/zconf.h create mode 100644 libs/libwebsockets/win32port/zlib/zlib.h create mode 100644 libs/libwebsockets/win32port/zlib/zutil.c create mode 100644 libs/libwebsockets/win32port/zlib/zutil.h diff --git a/libs/libwebsockets/.gitignore b/libs/libwebsockets/.gitignore new file mode 100644 index 0000000000..5431dbcc9e --- /dev/null +++ b/libs/libwebsockets/.gitignore @@ -0,0 +1,16 @@ +output/ +win32port/ipch/ +win32port/Debug*/ +win32port/Release*/ +win32port/server/Debug*/ +win32port/server/Release*/ +win32port/client/Debug*/ +win32port/client/Release*/ +win32port/libwebsocketswin32/Debug*/ +win32port/libwebsocketswin32/Release*/ +win32port/zlib/Debug*/ +win32port/zlib/Release*/ +*.vcxproj.user +*.opensdf +*.sdf +*.suo diff --git a/libs/libwebsockets/COPYING b/libs/libwebsockets/COPYING new file mode 100644 index 0000000000..a134777643 --- /dev/null +++ b/libs/libwebsockets/COPYING @@ -0,0 +1,503 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 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. + +[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. + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/libwebsockets/INSTALL b/libs/libwebsockets/INSTALL new file mode 100644 index 0000000000..7d1c323bea --- /dev/null +++ b/libs/libwebsockets/INSTALL @@ -0,0 +1,365 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008, 2009 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/libs/libwebsockets/Makefile.am b/libs/libwebsockets/Makefile.am new file mode 100644 index 0000000000..dec9704f49 --- /dev/null +++ b/libs/libwebsockets/Makefile.am @@ -0,0 +1,2 @@ + +SUBDIRS=lib test-server diff --git a/libs/libwebsockets/Makefile.in b/libs/libwebsockets/Makefile.in new file mode 100644 index 0000000000..f795692828 --- /dev/null +++ b/libs/libwebsockets/Makefile.in @@ -0,0 +1,738 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure COPYING INSTALL config.guess \ + config.sub depcomp install-sh ltmain.sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +clientcertdir = @clientcertdir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = lib test-server +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libs/libwebsockets/README-test-server b/libs/libwebsockets/README-test-server new file mode 100644 index 0000000000..e2e0116015 --- /dev/null +++ b/libs/libwebsockets/README-test-server @@ -0,0 +1,292 @@ +Using test-server as a quickstart +--------------------------------- + +You need to regenerate the autotools and libtoolize stuff for your system + +$ autoreconf +$ libtoolize + +Then for a Fedora x86_86 box, the following config line was +needed: + + ./configure --prefix=/usr --libdir=/usr/lib64 --enable-openssl + +For Apple systems, Christopher Baker reported that this is needed +(and I was told separately enabling openssl makes trouble somehow) + +./configure CC="gcc -arch i386 -arch x86_64" CXX="g++ -arch i386 -arch +x86_64" CPP="gcc -E" CXXCPP="g++ -E" --enable-nofork + +For mingw build, I did the following to get working build, ping test is +disabled when building this way + +1) install mingw64_w32 compiler packages from Fedora +2) additionally install mingw64-zlib package +3) ./configure --prefix=/usr --enable-mingw --host=x86_64-w64-mingw32 +4) make + +otherwise if /usr/local/... and /usr/local/lib are OK then... + +$ ./configure +$ make clean +$ make +$ sudo make install +$ libwebsockets-test-server + +should be enough to get a test server listening on port 7861. + +There are a couple of other possible configure options + +--enable-nofork disables the fork into the background API + and removes all references to fork() and + pr_ctl() from the sources. Use it if your + platform doesn't support forking. + +--enable-libcrypto by default libwebsockets uses its own + built-in md5 and sha-1 implementation for + simplicity. However the libcrypto ones + may be faster, and in a distro context it + may be highly desirable to use a common + library implementation for ease of security + upgrades. Give this configure option + to disable the built-in ones and force use + of the libcrypto (part of openssl) ones. + +--with-client-cert-dir=dir tells the client ssl support where to + look for trust certificates to validate + the remote certificate against. + +--enable-noping Don't try to build the ping test app + It needs some unixy environment that + may choke in other build contexts, this + lets you cleanly stop it being built + +--enable-x-google-mux Enable experimental x-google-mux support + in the build (see notes later in document) + +Testing server with a browser +----------------------------- + +If you point your browser (eg, Chrome) to + + http://127.0.0.1:7681 + +It will fetch a script in the form of test.html, and then run the +script in there on the browser to open a websocket connection. +Incrementing numbers should appear in the browser display. + +Using SSL on the server side +---------------------------- + +To test it using SSL/WSS, just run the test server with + +$ libwebsockets-test-server --ssl + +and use the URL + + https://127.0.0.1:7681 + +The connection will be entirely encrypted using some generated +certificates that your browser will not accept, since they are +not signed by any real Certificate Authority. Just accept the +certificates in the browser and the connection will proceed +in first https and then websocket wss, acting exactly the +same. + +test-server.c is all that is needed to use libwebsockets for +serving both the script html over http and websockets. + + +Forkless operation +------------------ + +If your target device does not offer fork(), you can use +libwebsockets from your own main loop instead. Use the +configure option --nofork and simply call libwebsocket_service() +from your own main loop as shown in the test app sources. + + +Testing websocket client support +-------------------------------- + +If you run the test server as described above, you can also +connect to it using the test client as well as a browser. + +$ libwebsockets-test-client localhost + +will by default connect to the test server on localhost:7681 +and print the dumb increment number from the server at the +same time as drawing random circles in the mirror protocol; +if you connect to the test server using a browser at the +same time you will be able to see the circles being drawn. + + +Testing SSL on the client side +------------------------------ + +To test SSL/WSS client action, just run the client test with + +$ libwebsockets-test-client localhost --ssl + +By default the client test applet is set to accept selfsigned +certificates used by the test server, this is indicated by the +use_ssl var being set to 2. Set it to 1 to reject any server +certificate that it doesn't have a trusted CA cert for. + + +Using the websocket ping utility +-------------------------------- + +libwebsockets-test-ping connects as a client to a remote +websocket server using 04 protocol and pings it like the +normal unix ping utility. + +$ libwebsockets-test-ping localhost +handshake OK for protocol lws-mirror-protocol +Websocket PING localhost.localdomain (127.0.0.1) 64 bytes of data. +64 bytes from localhost: req=1 time=0.1ms +64 bytes from localhost: req=2 time=0.1ms +64 bytes from localhost: req=3 time=0.1ms +64 bytes from localhost: req=4 time=0.2ms +64 bytes from localhost: req=5 time=0.1ms +64 bytes from localhost: req=6 time=0.2ms +64 bytes from localhost: req=7 time=0.2ms +64 bytes from localhost: req=8 time=0.1ms +^C +--- localhost.localdomain websocket ping statistics --- +8 packets transmitted, 8 received, 0% packet loss, time 7458ms +rtt min/avg/max = 0.110/0.185/0.218 ms +$ + +By default it sends 64 byte payload packets using the 04 +PING packet opcode type. You can change the payload size +using the -s= flag, up to a maximum of 125 mandated by the +04 standard. + +Using the lws-mirror protocol that is provided by the test +server, libwebsockets-test-ping can also use larger payload +sizes up to 4096 is BINARY packets; lws-mirror will copy +them back to the client and they appear as a PONG. Use the +-m flag to select this operation. + +The default interval between pings is 1s, you can use the -i= +flag to set this, including fractions like -i=0.01 for 10ms +interval. + +Before you can even use the PING opcode that is part of the +standard, you must complete a handshake with a specified +protocol. By default lws-mirror-protocol is used which is +supported by the test server. But if you are using it on +another server, you can specify the protcol to handshake with +by --protocol=protocolname + + +Fraggle test app +---------------- + +By default it runs in server mode + +$ libwebsockets-test-fraggle +libwebsockets test fraggle +(C) Copyright 2010-2011 Andy Green licensed under LGPL2.1 + Compiled with SSL support, not using it + Listening on port 7681 +server sees client connect +accepted v06 connection +Spamming 360 random fragments +Spamming session over, len = 371913. sum = 0x2D3C0AE +Spamming 895 random fragments +Spamming session over, len = 875970. sum = 0x6A74DA1 +... + +You need to run a second session in client mode, you have to +give the -c switch and the server address at least: + +$ libwebsockets-test-fraggle -c localhost +libwebsockets test fraggle +(C) Copyright 2010-2011 Andy Green licensed under LGPL2.1 + Client mode +Connecting to localhost:7681 +denied deflate-stream extension +handshake OK for protocol fraggle-protocol +client connects to server +EOM received 371913 correctly from 360 fragments +EOM received 875970 correctly from 895 fragments +EOM received 247140 correctly from 258 fragments +EOM received 695451 correctly from 692 fragments +... + +The fraggle test sends a random number up to 1024 fragmented websocket frames +each of a random size between 1 and 2001 bytes in a single message, then sends +a checksum and starts sending a new randomly sized and fragmented message. + +The fraggle test client receives the same message fragments and computes the +same checksum using websocket framing to see when the message has ended. It +then accepts the server checksum message and compares that to its checksum. + + +proxy support +------------- + +The http_proxy environment variable is respected by the client +connection code for both ws:// and wss://. It doesn't support +authentication yet. + +You use it like this + +export http_proxy=myproxy.com:3128 +libwebsockets-test-client someserver.com + + +Websocket version supported +--------------------------- + +The websocket client code is 04 and 05 version, the server +supports 00/76 in text mode and 04 and 05 dynamically +per-connection depending on the version of the +client / browser. + + +External Polling Loop support +----------------------------- + +libwebsockets maintains an internal poll() array for all of its +sockets, but you can instead integrate the sockets into an +external polling array. That's needed if libwebsockets will +cooperate with an existing poll array maintained by another +server. + +Four callbacks LWS_CALLBACK_ADD_POLL_FD, LWS_CALLBACK_DEL_POLL_FD, +LWS_CALLBACK_SET_MODE_POLL_FD and LWS_CALLBACK_CLEAR_MODE_POLL_FD +appear in the callback for protocol 0 and allow interface code to +manage socket descriptors in other poll loops. + + +x-google-mux support +-------------------- + +Experimental and super-preliminary x-google-mux support is available if +enabled in ./configure with --enable-x-google-mux. Note that when changing +configurations, you will need to do a make distclean before, then the new +configure and then make ; make install. Don't forget the necessary other +flags for your platform as described at the top of the readme. + +It has the following notes: + + 1) To enable it, reconfigure with --enable-x-google-mux + + 2) It deviates from the google standard by sending full + headers in the addchannel subcommand rather than just + changed ones from original connect + + 3) Quota is not implemented yet + +However despite those caveats, in fact it can run the +test client reliably over one socket (both dumb-increment +and lws-mirror-protocol), you can open a browser on the +same test server too and see the circles, etc. + +It also works compatibly with deflate-stream automatically. + +2012-04-12 Andy Green + diff --git a/libs/libwebsockets/configure.ac b/libs/libwebsockets/configure.ac new file mode 100644 index 0000000000..3980b2d0aa --- /dev/null +++ b/libs/libwebsockets/configure.ac @@ -0,0 +1,130 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.66]) +AC_INIT(libwebsockets, 0.3, andy@warmcat.com) +AC_CONFIG_SRCDIR([test-server/test-server.c]) +AC_CONFIG_HEADERS([config.h]) + +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +LT_INIT(shared) + +#AX_PTHREAD + +# Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_CONFIG_MACRO_DIR([m4]) + + +# +# +# +AC_ARG_ENABLE(openssl, + [ --enable-openssl Enables https support and needs openssl libs], + [ openssl=yes + ]) + +if test "x$openssl" = "xyes" ; then +AC_CHECK_LIB([ssl], [SSL_library_init]) +CFLAGS="$CFLAGS -DLWS_OPENSSL_SUPPORT" +fi + +# +# +# +AC_ARG_ENABLE(nofork, + [ --enable-nofork Disables fork-related options], + [ nofork=yes + ]) + +if test "x$nofork" = "xyes" ; then +CFLAGS="$CFLAGS -DLWS_NO_FORK" +else +AC_FUNC_FORK +fi + +# +# +# +AC_ARG_ENABLE(libcrypto, + [ --enable-libcrypto Use libcrypto MD5 and SHA1 implementations], + [ libcrypto=yes + ]) + +if test "x$libcrypto" = "xyes" ; then +CFLAGS="$CFLAGS -DLWS_LIBCRYPTO" +LDFLAGS="$LDFLAGS -lcrypto" +fi +AM_CONDITIONAL(LIBCRYPTO, test x$libcrypto = xyes) + + +# +# +# +AC_ARG_ENABLE(x-google-mux, + [ --enable-x-google-mux Build experimental x-google-mux], + [ x_google_mux=yes + ]) +if test "x$x_google_mux" = "xyes" ; then +CFLAGS="$CFLAGS -DLWS_EXT_GOOGLE_MUX" +fi +AM_CONDITIONAL(EXT_GOOGLE_MUX, test x$x_google_mux = xyes) + +# +# +# +AC_ARG_ENABLE(mingw, + [ --enable-mingw Using mingw compilers, disables ping test build], + [ mingw=yes + noping=yes + ]) + +if test "x$mingw" = "xyes" ; then +CFLAGS="$CFLAGS -DLWS_MINGW_SUPPORT" +fi +AM_CONDITIONAL(MINGW, test x$mingw = xyes) + +# +# +# +AC_ARG_WITH([client-cert-dir], +[AS_HELP_STRING([--with-client-cert-dir],[directory containing client certs, defaults to /etc/pki/tls/certs/])], +[clientcertdir=$withval], +[clientcertdir=/etc/pki/tls/certs/] +) +AC_SUBST([clientcertdir]) + +AC_SUBST([CFLAGS]) + + +# +# +# +AC_ARG_ENABLE(noping, + [ --enable-noping Do not build ping test app, which has some unixy stuff in sources], + [ noping=yes + ]) + +AM_CONDITIONAL(NOPING, test x$noping = xyes) + + + +# Checks for header files. +AC_CHECK_HEADERS([zlib.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h sys/prctl.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_SIZE_T + +# Checks for library functions. + +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS([bzero memset socket strerror]) + +AC_CONFIG_FILES([Makefile + lib/Makefile + test-server/Makefile]) + +AC_OUTPUT diff --git a/libs/libwebsockets/lib/Makefile.am b/libs/libwebsockets/lib/Makefile.am new file mode 100644 index 0000000000..119366f099 --- /dev/null +++ b/libs/libwebsockets/lib/Makefile.am @@ -0,0 +1,44 @@ +lib_LTLIBRARIES=libwebsockets.la +include_HEADERS=libwebsockets.h +dist_libwebsockets_la_SOURCES=libwebsockets.c \ + handshake.c \ + parsers.c \ + libwebsockets.h \ + base64-decode.c \ + client-handshake.c \ + extension.c \ + extension-deflate-stream.c \ + private-libwebsockets.h + +if EXT_GOOGLE_MUX +dist_libwebsockets_la_SOURCES += extension-x-google-mux.c +endif + +if LIBCRYPTO +else +dist_libwebsockets_la_SOURCES += md5.c sha-1.c +endif + +libwebsockets_la_CFLAGS:=-Wall -std=gnu99 -pedantic +libwebsockets_la_LDFLAGS:= + +if MINGW +libwebsockets_la_CFLAGS+= -w -I../win32port/win32helpers -I ../win32port/zlib/ +libwebsockets_la_LDFLAGS+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc +else +libwebsockets_la_CFLAGS+= -rdynamic -fPIC -Werror +libwebsockets_la_LDFLAGS+= -version-info 0:3 +endif + +libwebsockets_la_CFLAGS+= -c \ + -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +libwebsockets_la_LDFLAGS+= -lz + +all-local: + ../scripts/kernel-doc -html \ + libwebsockets.c \ + parsers.c \ + client-handshake.c \ + libwebsockets.h \ + > ../libwebsockets-api-doc.html + diff --git a/libs/libwebsockets/lib/Makefile.in b/libs/libwebsockets/lib/Makefile.in new file mode 100644 index 0000000000..caa44f3e02 --- /dev/null +++ b/libs/libwebsockets/lib/Makefile.in @@ -0,0 +1,665 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@EXT_GOOGLE_MUX_TRUE@am__append_1 = extension-x-google-mux.c +@LIBCRYPTO_FALSE@am__append_2 = md5.c sha-1.c +@MINGW_TRUE@am__append_3 = -w -I../win32port/win32helpers -I ../win32port/zlib/ +@MINGW_TRUE@am__append_4 = -lm -luser32 -ladvapi32 -lkernel32 -lgcc +@MINGW_FALSE@am__append_5 = -rdynamic -fPIC -Werror +@MINGW_FALSE@am__append_6 = -version-info 0:3 +subdir = lib +DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libwebsockets_la_LIBADD = +am__dist_libwebsockets_la_SOURCES_DIST = libwebsockets.c handshake.c \ + parsers.c libwebsockets.h base64-decode.c client-handshake.c \ + extension.c extension-deflate-stream.c private-libwebsockets.h \ + extension-x-google-mux.c md5.c sha-1.c +@EXT_GOOGLE_MUX_TRUE@am__objects_1 = libwebsockets_la-extension-x-google-mux.lo +@LIBCRYPTO_FALSE@am__objects_2 = libwebsockets_la-md5.lo \ +@LIBCRYPTO_FALSE@ libwebsockets_la-sha-1.lo +dist_libwebsockets_la_OBJECTS = libwebsockets_la-libwebsockets.lo \ + libwebsockets_la-handshake.lo libwebsockets_la-parsers.lo \ + libwebsockets_la-base64-decode.lo \ + libwebsockets_la-client-handshake.lo \ + libwebsockets_la-extension.lo \ + libwebsockets_la-extension-deflate-stream.lo $(am__objects_1) \ + $(am__objects_2) +libwebsockets_la_OBJECTS = $(dist_libwebsockets_la_OBJECTS) +libwebsockets_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libwebsockets_la_CFLAGS) \ + $(CFLAGS) $(libwebsockets_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(dist_libwebsockets_la_SOURCES) +DIST_SOURCES = $(am__dist_libwebsockets_la_SOURCES_DIST) +HEADERS = $(include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +clientcertdir = @clientcertdir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +lib_LTLIBRARIES = libwebsockets.la +include_HEADERS = libwebsockets.h +dist_libwebsockets_la_SOURCES = libwebsockets.c handshake.c parsers.c \ + libwebsockets.h base64-decode.c client-handshake.c extension.c \ + extension-deflate-stream.c private-libwebsockets.h \ + $(am__append_1) $(am__append_2) +libwebsockets_la_CFLAGS := -Wall -std=gnu99 -pedantic $(am__append_3) \ + $(am__append_5) -c -DINSTALL_DATADIR=\"@datadir@\" \ + -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +libwebsockets_la_LDFLAGS := $(am__append_4) $(am__append_6) -lz +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libwebsockets.la: $(libwebsockets_la_OBJECTS) $(libwebsockets_la_DEPENDENCIES) $(EXTRA_libwebsockets_la_DEPENDENCIES) + $(libwebsockets_la_LINK) -rpath $(libdir) $(libwebsockets_la_OBJECTS) $(libwebsockets_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-base64-decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-client-handshake.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-extension-deflate-stream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-extension-x-google-mux.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-extension.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-handshake.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-libwebsockets.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-md5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-parsers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-sha-1.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libwebsockets_la-libwebsockets.lo: libwebsockets.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-libwebsockets.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-libwebsockets.Tpo -c -o libwebsockets_la-libwebsockets.lo `test -f 'libwebsockets.c' || echo '$(srcdir)/'`libwebsockets.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-libwebsockets.Tpo $(DEPDIR)/libwebsockets_la-libwebsockets.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libwebsockets.c' object='libwebsockets_la-libwebsockets.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-libwebsockets.lo `test -f 'libwebsockets.c' || echo '$(srcdir)/'`libwebsockets.c + +libwebsockets_la-handshake.lo: handshake.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-handshake.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-handshake.Tpo -c -o libwebsockets_la-handshake.lo `test -f 'handshake.c' || echo '$(srcdir)/'`handshake.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-handshake.Tpo $(DEPDIR)/libwebsockets_la-handshake.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='handshake.c' object='libwebsockets_la-handshake.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-handshake.lo `test -f 'handshake.c' || echo '$(srcdir)/'`handshake.c + +libwebsockets_la-parsers.lo: parsers.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-parsers.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-parsers.Tpo -c -o libwebsockets_la-parsers.lo `test -f 'parsers.c' || echo '$(srcdir)/'`parsers.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-parsers.Tpo $(DEPDIR)/libwebsockets_la-parsers.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parsers.c' object='libwebsockets_la-parsers.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-parsers.lo `test -f 'parsers.c' || echo '$(srcdir)/'`parsers.c + +libwebsockets_la-base64-decode.lo: base64-decode.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-base64-decode.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-base64-decode.Tpo -c -o libwebsockets_la-base64-decode.lo `test -f 'base64-decode.c' || echo '$(srcdir)/'`base64-decode.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-base64-decode.Tpo $(DEPDIR)/libwebsockets_la-base64-decode.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='base64-decode.c' object='libwebsockets_la-base64-decode.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-base64-decode.lo `test -f 'base64-decode.c' || echo '$(srcdir)/'`base64-decode.c + +libwebsockets_la-client-handshake.lo: client-handshake.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-client-handshake.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-client-handshake.Tpo -c -o libwebsockets_la-client-handshake.lo `test -f 'client-handshake.c' || echo '$(srcdir)/'`client-handshake.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-client-handshake.Tpo $(DEPDIR)/libwebsockets_la-client-handshake.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client-handshake.c' object='libwebsockets_la-client-handshake.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-client-handshake.lo `test -f 'client-handshake.c' || echo '$(srcdir)/'`client-handshake.c + +libwebsockets_la-extension.lo: extension.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-extension.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-extension.Tpo -c -o libwebsockets_la-extension.lo `test -f 'extension.c' || echo '$(srcdir)/'`extension.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-extension.Tpo $(DEPDIR)/libwebsockets_la-extension.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extension.c' object='libwebsockets_la-extension.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-extension.lo `test -f 'extension.c' || echo '$(srcdir)/'`extension.c + +libwebsockets_la-extension-deflate-stream.lo: extension-deflate-stream.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-extension-deflate-stream.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-extension-deflate-stream.Tpo -c -o libwebsockets_la-extension-deflate-stream.lo `test -f 'extension-deflate-stream.c' || echo '$(srcdir)/'`extension-deflate-stream.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-extension-deflate-stream.Tpo $(DEPDIR)/libwebsockets_la-extension-deflate-stream.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extension-deflate-stream.c' object='libwebsockets_la-extension-deflate-stream.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-extension-deflate-stream.lo `test -f 'extension-deflate-stream.c' || echo '$(srcdir)/'`extension-deflate-stream.c + +libwebsockets_la-extension-x-google-mux.lo: extension-x-google-mux.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-extension-x-google-mux.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-extension-x-google-mux.Tpo -c -o libwebsockets_la-extension-x-google-mux.lo `test -f 'extension-x-google-mux.c' || echo '$(srcdir)/'`extension-x-google-mux.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-extension-x-google-mux.Tpo $(DEPDIR)/libwebsockets_la-extension-x-google-mux.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extension-x-google-mux.c' object='libwebsockets_la-extension-x-google-mux.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-extension-x-google-mux.lo `test -f 'extension-x-google-mux.c' || echo '$(srcdir)/'`extension-x-google-mux.c + +libwebsockets_la-md5.lo: md5.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-md5.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-md5.Tpo -c -o libwebsockets_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-md5.Tpo $(DEPDIR)/libwebsockets_la-md5.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='md5.c' object='libwebsockets_la-md5.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c + +libwebsockets_la-sha-1.lo: sha-1.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-sha-1.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-sha-1.Tpo -c -o libwebsockets_la-sha-1.lo `test -f 'sha-1.c' || echo '$(srcdir)/'`sha-1.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_la-sha-1.Tpo $(DEPDIR)/libwebsockets_la-sha-1.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sha-1.c' object='libwebsockets_la-sha-1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-sha-1.lo `test -f 'sha-1.c' || echo '$(srcdir)/'`sha-1.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) all-local +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES + + +all-local: + ../scripts/kernel-doc -html \ + libwebsockets.c \ + parsers.c \ + client-handshake.c \ + libwebsockets.h \ + > ../libwebsockets-api-doc.html + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libs/libwebsockets/lib/base64-decode.c b/libs/libwebsockets/lib/base64-decode.c new file mode 100644 index 0000000000..95d4ba4ac2 --- /dev/null +++ b/libs/libwebsockets/lib/base64-decode.c @@ -0,0 +1,188 @@ +/* + * This code originally came from here + * + * http://base64.sourceforge.net/b64.c + * + * with the following license: + * + * LICENCE: Copyright (c) 2001 Bob Trower, Trantor Standard Systems Inc. + * + * 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 AUTHORS + * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * VERSION HISTORY: + * Bob Trower 08/04/01 -- Create Version 0.00.00B + * + * I cleaned it up quite a bit to match the (linux kernel) style of the rest + * of libwebsockets; this version is under LGPL2 like the rest of libwebsockets + * since he explictly allows sublicensing, but I give the URL above so you can + * get the original with Bob's super-liberal terms directly if you prefer. + */ + + +#include +#include + +static const char encode[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char decode[] = "|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW" + "$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; + +int +lws_b64_encode_string(const char *in, int in_len, char *out, int out_size) +{ + unsigned char triple[3]; + int i; + int len; + int line = 0; + int done = 0; + + while (in_len) { + len = 0; + for (i = 0; i < 3; i++) { + if (in_len) { + triple[i] = *in++; + len++; + in_len--; + } else + triple[i] = 0; + } + if (!len) + continue; + + if (done + 4 >= out_size) + return -1; + + *out++ = encode[triple[0] >> 2]; + *out++ = encode[((triple[0] & 0x03) << 4) | + ((triple[1] & 0xf0) >> 4)]; + *out++ = (len > 1 ? encode[((triple[1] & 0x0f) << 2) | + ((triple[2] & 0xc0) >> 6)] : '='); + *out++ = (len > 2 ? encode[triple[2] & 0x3f] : '='); + + done += 4; + line += 4; + } + + if (done + 1 >= out_size) + return -1; + + *out++ = '\0'; + + return done; +} + +/* + * returns length of decoded string in out, or -1 if out was too small + * according to out_size + */ + +int +lws_b64_decode_string(const char *in, char *out, int out_size) +{ + int len; + int i; + int done = 0; + unsigned char v; + unsigned char quad[4]; + + while (*in) { + + len = 0; + for (i = 0; i < 4 && *in; i++) { + + v = 0; + while (*in && !v) { + + v = *in++; + v = (v < 43 || v > 122) ? 0 : decode[v - 43]; + if (v) + v = (v == '$') ? 0 : v - 61; + if (*in) { + len++; + if (v) + quad[i] = v - 1; + } else + quad[i] = 0; + } + } + if (!len) + continue; + + if (out_size < (done + len - 1)) + /* out buffer is too small */ + return -1; + + if (len >= 2) + *out++ = quad[0] << 2 | quad[1] >> 4; + if (len >= 3) + *out++ = quad[1] << 4 | quad[2] >> 2; + if (len >= 4) + *out++ = ((quad[2] << 6) & 0xc0) | quad[3]; + + done += len - 1; + } + + if (done + 1 >= out_size) + return -1; + + *out++ = '\0'; + + return done; +} + +int +lws_b64_selftest(void) +{ + char buf[64]; + int n; + int test; + static const char * const plaintext[] = { + "sanity check base 64" + }; + static const char * const coded[] = { + "c2FuaXR5IGNoZWNrIGJhc2UgNjQ=" + }; + + for (test = 0; test < sizeof plaintext / sizeof(plaintext[0]); test++) { + + buf[sizeof(buf) - 1] = '\0'; + n = lws_b64_encode_string(plaintext[test], + strlen(plaintext[test]), buf, sizeof buf); + if (n != strlen(coded[test]) || strcmp(buf, coded[test])) { + fprintf(stderr, "Failed lws_b64 encode selftest " + "%d result '%s' %d\n", test, buf, n); + return -1; + } + + buf[sizeof(buf) - 1] = '\0'; + n = lws_b64_decode_string(coded[test], buf, sizeof buf); + if (n != strlen(plaintext[test]) || + strcmp(buf, plaintext[test])) { + fprintf(stderr, "Failed lws_b64 decode selftest " + "%d result '%s' %d\n", test, buf, n); + return -1; + } + } + + return 0; +} diff --git a/libs/libwebsockets/lib/client-handshake.c b/libs/libwebsockets/lib/client-handshake.c new file mode 100644 index 0000000000..ceb5f76f22 --- /dev/null +++ b/libs/libwebsockets/lib/client-handshake.c @@ -0,0 +1,408 @@ +#include "private-libwebsockets.h" + +struct libwebsocket *__libwebsocket_client_connect_2( + struct libwebsocket_context *context, + struct libwebsocket *wsi +) { + struct pollfd pfd; + struct timeval tv; + struct hostent *server_hostent; + struct sockaddr_in server_addr; + int n; + int plen = 0; + char pkt[512]; + int opt = 1; +#if defined(__APPLE__) + struct protoent *tcp_proto; +#endif + + debug("__libwebsocket_client_connect_2\n"); + + wsi->candidate_children_list = NULL; + + /* + * proxy? + */ + + if (context->http_proxy_port) { + plen = sprintf(pkt, "CONNECT %s:%u HTTP/1.0\x0d\x0a" + "User-agent: libwebsockets\x0d\x0a" +/*Proxy-authorization: basic aGVsbG86d29ybGQ= */ + "\x0d\x0a", wsi->c_address, wsi->c_port); + + /* OK from now on we talk via the proxy */ + + free(wsi->c_address); + wsi->c_address = strdup(context->http_proxy_address); + wsi->c_port = context->http_proxy_port; + } + + /* + * prepare the actual connection (to the proxy, if any) + */ + + debug("__libwebsocket_client_connect_2: address %s", wsi->c_address); + + server_hostent = gethostbyname(wsi->c_address); + if (server_hostent == NULL) { + fprintf(stderr, "Unable to get host name from %s\n", + wsi->c_address); + goto oom4; + } + + wsi->sock = socket(AF_INET, SOCK_STREAM, 0); + + if (wsi->sock < 0) { + fprintf(stderr, "Unable to open socket\n"); + goto oom4; + } + + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons(wsi->c_port); + server_addr.sin_addr = *((struct in_addr *)server_hostent->h_addr); + bzero(&server_addr.sin_zero, 8); + + /* Disable Nagle */ +#if !defined(__APPLE__) + setsockopt(wsi->sock, SOL_TCP, TCP_NODELAY, + (const void *)&opt, sizeof(opt)); +#else + tcp_proto = getprotobyname("TCP"); + setsockopt(wsi->sock, tcp_proto->p_proto, TCP_NODELAY, + &opt, sizeof(opt)); +#endif + + /* Set receiving timeout */ + tv.tv_sec = 0; + tv.tv_usec = 100 * 1000; + setsockopt(wsi->sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof tv); + + if (connect(wsi->sock, (struct sockaddr *)&server_addr, + sizeof(struct sockaddr)) == -1) { + fprintf(stderr, "Connect failed\n"); +#ifdef WIN32 + closesocket(wsi->sock); +#else + close(wsi->sock); +#endif + goto oom4; + } + + debug("connected\n"); + + /* into fd -> wsi hashtable */ + + insert_wsi(context, wsi); + + /* into internal poll list */ + + context->fds[context->fds_count].fd = wsi->sock; + context->fds[context->fds_count].revents = 0; + context->fds[context->fds_count++].events = POLLIN; + + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_ADD_POLL_FD, + (void *)(long)wsi->sock, NULL, POLLIN); + + /* we are connected to server, or proxy */ + + if (context->http_proxy_port) { + + n = send(wsi->sock, pkt, plen, 0); + if (n < 0) { +#ifdef WIN32 + closesocket(wsi->sock); +#else + close(wsi->sock); +#endif + fprintf(stderr, "ERROR writing to proxy socket\n"); + goto bail1; + } + + libwebsocket_set_timeout(wsi, + PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE, 5); + + wsi->mode = LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY; + + return wsi; + } + + /* + * provoke service to issue the handshake directly + * we need to do it this way because in the proxy case, this is the + * next state and executed only if and when we get a good proxy + * response inside the state machine + */ + + wsi->mode = LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE; + pfd.fd = wsi->sock; + pfd.revents = POLLIN; + if (libwebsocket_service_fd(context, &pfd) < 0) + goto oom4; + + return wsi; + +oom4: + if (wsi->c_protocol) + free(wsi->c_protocol); + + if (wsi->c_origin) + free(wsi->c_origin); + + free(wsi->c_host); + free(wsi->c_path); + +bail1: + free(wsi); + + return NULL; +} + +/** + * libwebsocket_client_connect() - Connect to another websocket server + * @context: Websocket context + * @address: Remote server address, eg, "myserver.com" + * @port: Port to connect to on the remote server, eg, 80 + * @ssl_connection: 0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self + * signed certs + * @path: Websocket path on server + * @host: Hostname on server + * @origin: Socket origin name + * @protocol: Comma-separated list of protocols being asked for from + * the server, or just one. The server will pick the one it + * likes best. + * @ietf_version_or_minus_one: -1 to ask to connect using the default, latest + * protocol supported, or the specific protocol ordinal + * + * This function creates a connection to a remote server + */ + +struct libwebsocket * +libwebsocket_client_connect(struct libwebsocket_context *context, + const char *address, + int port, + int ssl_connection, + const char *path, + const char *host, + const char *origin, + const char *protocol, + int ietf_version_or_minus_one) +{ + struct libwebsocket *wsi; + int n; + int m; + struct libwebsocket_extension *ext; + int handled; +#ifndef LWS_OPENSSL_SUPPORT + if (ssl_connection) { + fprintf(stderr, "libwebsockets not configured for ssl\n"); + return NULL; + } +#endif + + wsi = malloc(sizeof(struct libwebsocket)); + if (wsi == NULL) + goto bail1; + + memset(wsi, 0, sizeof *wsi); + + /* -1 means just use latest supported */ + + if (ietf_version_or_minus_one == -1) + ietf_version_or_minus_one = SPEC_LATEST_SUPPORTED; + + wsi->ietf_spec_revision = ietf_version_or_minus_one; + wsi->name_buffer_pos = 0; + wsi->user_space = NULL; + wsi->state = WSI_STATE_CLIENT_UNCONNECTED; + wsi->pings_vs_pongs = 0; + wsi->protocol = NULL; + wsi->pending_timeout = NO_PENDING_TIMEOUT; + wsi->count_active_extensions = 0; +#ifdef LWS_OPENSSL_SUPPORT + wsi->use_ssl = ssl_connection; +#endif + + wsi->c_port = port; + wsi->c_address = strdup(address); + + /* copy parameters over so state machine has access */ + + wsi->c_path = malloc(strlen(path) + 1); + if (wsi->c_path == NULL) + goto bail1; + strcpy(wsi->c_path, path); + + wsi->c_host = malloc(strlen(host) + 1); + if (wsi->c_host == NULL) + goto oom1; + strcpy(wsi->c_host, host); + + if (origin) { + wsi->c_origin = malloc(strlen(origin) + 1); + strcpy(wsi->c_origin, origin); + if (wsi->c_origin == NULL) + goto oom2; + } else + wsi->c_origin = NULL; + + wsi->c_callback = NULL; + if (protocol) { + const char *pc; + struct libwebsocket_protocols *pp; + + wsi->c_protocol = malloc(strlen(protocol) + 1); + if (wsi->c_protocol == NULL) + goto oom3; + + strcpy(wsi->c_protocol, protocol); + + pc = protocol; + while (*pc && *pc != ',') + pc++; + n = pc - protocol; + pp = context->protocols; + while (pp->name && !wsi->c_callback) { + if (!strncmp(protocol, pp->name, n)) + wsi->c_callback = pp->callback; + pp++; + } + } else + wsi->c_protocol = NULL; + + if (!wsi->c_callback) + wsi->c_callback = context->protocols[0].callback; + + /* set up appropriate masking */ + + wsi->xor_mask = xor_no_mask; + + switch (wsi->ietf_spec_revision) { + case 0: + break; + case 4: + wsi->xor_mask = xor_mask_04; + break; + case 5: + case 6: + case 7: + case 8: + case 13: + wsi->xor_mask = xor_mask_05; + break; + default: + fprintf(stderr, + "Client ietf version %d not supported\n", + wsi->ietf_spec_revision); + goto oom4; + } + + /* force no mask if he asks for that though */ + + if (context->options & LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK) + wsi->xor_mask = xor_no_mask; + + for (n = 0; n < WSI_TOKEN_COUNT; n++) { + wsi->utf8_token[n].token = NULL; + wsi->utf8_token[n].token_len = 0; + } + + /* + * Check with each extension if it is able to route and proxy this + * connection for us. For example, an extension like x-google-mux + * can handle this and then we don't need an actual socket for this + * connection. + */ + + handled = 0; + ext = context->extensions; + n = 0; + + while (ext && ext->callback && !handled) { + m = ext->callback(context, ext, wsi, + LWS_EXT_CALLBACK_CAN_PROXY_CLIENT_CONNECTION, + (void *)(long)n, (void *)address, port); + if (m) + handled = 1; + + ext++; + n++; + } + + if (handled) { + debug("libwebsocket_client_connect: ext handling conn\n"); + + libwebsocket_set_timeout(wsi, + PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE, 5); + + wsi->mode = LWS_CONNMODE_WS_CLIENT_WAITING_EXTENSION_CONNECT; + return wsi; + } + + debug("libwebsocket_client_connect: direct conn\n"); + + return __libwebsocket_client_connect_2(context, wsi); + + +oom4: + if (wsi->c_protocol) + free(wsi->c_protocol); + +oom3: + if (wsi->c_origin) + free(wsi->c_origin); + +oom2: + free(wsi->c_host); + +oom1: + free(wsi->c_path); + +bail1: + free(wsi); + + return NULL; +} + + +/** + * libwebsocket_client_connect_extended() - Connect to another websocket server + * @context: Websocket context + * @address: Remote server address, eg, "myserver.com" + * @port: Port to connect to on the remote server, eg, 80 + * @ssl_connection: 0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self + * signed certs + * @path: Websocket path on server + * @host: Hostname on server + * @origin: Socket origin name + * @protocol: Comma-separated list of protocols being asked for from + * the server, or just one. The server will pick the one it + * likes best. + * @ietf_version_or_minus_one: -1 to ask to connect using the default, latest + * protocol supported, or the specific protocol ordinal + * @userdata: Pre-allocated user data + * + * This function creates a connection to a remote server + */ + +struct libwebsocket * +libwebsocket_client_connect_extended(struct libwebsocket_context *context, + const char *address, + int port, + int ssl_connection, + const char *path, + const char *host, + const char *origin, + const char *protocol, + int ietf_version_or_minus_one, + void *userdata) +{ + struct libwebsocket *ws = + libwebsocket_client_connect(context, address, port, ssl_connection, path, host, origin, protocol, ietf_version_or_minus_one) ; + + if (ws && !ws->user_space && userdata) + ws->user_space = userdata ; + + return ws ; + } diff --git a/libs/libwebsockets/lib/extension-deflate-stream.c b/libs/libwebsockets/lib/extension-deflate-stream.c new file mode 100644 index 0000000000..2e4ad6c1a4 --- /dev/null +++ b/libs/libwebsockets/lib/extension-deflate-stream.c @@ -0,0 +1,150 @@ +#include "private-libwebsockets.h" +#include "extension-deflate-stream.h" +#include +#include +#include + +#define LWS_ZLIB_WINDOW_BITS 15 +#define LWS_ZLIB_MEMLEVEL 8 + +int lws_extension_callback_deflate_stream( + struct libwebsocket_context *context, + struct libwebsocket_extension *ext, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons reason, + void *user, void *in, size_t len) +{ + struct lws_ext_deflate_stream_conn *conn = + (struct lws_ext_deflate_stream_conn *)user; + int n; + struct lws_tokens *eff_buf = (struct lws_tokens *)in; + + switch (reason) { + + /* + * for deflate-stream, both client and server sides act the same + */ + + case LWS_EXT_CALLBACK_CLIENT_CONSTRUCT: + case LWS_EXT_CALLBACK_CONSTRUCT: + conn->zs_in.zalloc = conn->zs_out.zalloc = Z_NULL; + conn->zs_in.zfree = conn->zs_out.zfree = Z_NULL; + conn->zs_in.opaque = conn->zs_out.opaque = Z_NULL; + n = inflateInit2(&conn->zs_in, -LWS_ZLIB_WINDOW_BITS); + if (n != Z_OK) { + fprintf(stderr, "deflateInit returned %d\n", n); + return 1; + } + n = deflateInit2(&conn->zs_out, + DEFLATE_STREAM_COMPRESSION_LEVEL, Z_DEFLATED, + -LWS_ZLIB_WINDOW_BITS, LWS_ZLIB_MEMLEVEL, + Z_DEFAULT_STRATEGY); + if (n != Z_OK) { + fprintf(stderr, "deflateInit returned %d\n", n); + return 1; + } + debug("zlibs constructed\n"); + break; + + case LWS_EXT_CALLBACK_DESTROY: + (void)inflateEnd(&conn->zs_in); + (void)deflateEnd(&conn->zs_out); + debug("zlibs destructed\n"); + break; + + case LWS_EXT_CALLBACK_PACKET_RX_PREPARSE: + + /* + * inflate the incoming compressed data + * Notice, length may be 0 and pointer NULL + * in the case we are flushing with nothing new coming in + */ + + conn->zs_in.next_in = (unsigned char *)eff_buf->token; + conn->zs_in.avail_in = eff_buf->token_len; + + conn->zs_in.next_out = conn->buf; + conn->zs_in.avail_out = sizeof(conn->buf); + + n = inflate(&conn->zs_in, Z_SYNC_FLUSH); + switch (n) { + case Z_NEED_DICT: + case Z_DATA_ERROR: + case Z_MEM_ERROR: + /* + * screwed.. close the connection... we will get a + * destroy callback to take care of closing nicely + */ + fprintf(stderr, "zlib error inflate %d\n", n); + return -1; + } + + /* rewrite the buffer pointers and length */ + + eff_buf->token = (char *)conn->buf; + eff_buf->token_len = sizeof(conn->buf) - conn->zs_in.avail_out; + + /* + * if we filled the output buffer, signal that we likely have + * more and need to be called again + */ + + if (eff_buf->token_len == sizeof(conn->buf)) + return 1; + + /* we don't need calling again until new input data comes */ + + return 0; + + case LWS_EXT_CALLBACK_FLUSH_PENDING_TX: + case LWS_EXT_CALLBACK_PACKET_TX_PRESEND: + + /* + * deflate the outgoing compressed data + */ + + conn->zs_out.next_in = (unsigned char *)eff_buf->token; + conn->zs_out.avail_in = eff_buf->token_len; + + conn->zs_out.next_out = conn->buf; + conn->zs_out.avail_out = sizeof(conn->buf); + + n = Z_PARTIAL_FLUSH; + if (reason == LWS_EXT_CALLBACK_FLUSH_PENDING_TX) + n = Z_FULL_FLUSH; + + n = deflate(&conn->zs_out, n); + if (n == Z_STREAM_ERROR) { + /* + * screwed.. close the connection... we will get a + * destroy callback to take care of closing nicely + */ + fprintf(stderr, "zlib error deflate\n"); + + return -1; + } + + /* rewrite the buffer pointers and length */ + + eff_buf->token = (char *)conn->buf; + eff_buf->token_len = sizeof(conn->buf) - conn->zs_out.avail_out; + + /* + * if we filled the output buffer, signal that we likely have + * more and need to be called again... even in deflate case + * we might sometimes need to spill more than came in + */ + + if (eff_buf->token_len == sizeof(conn->buf)) + return 1; + + /* we don't need calling again until new input data comes */ + + return 0; + + default: + break; + } + + return 0; +} diff --git a/libs/libwebsockets/lib/extension-deflate-stream.h b/libs/libwebsockets/lib/extension-deflate-stream.h new file mode 100644 index 0000000000..a8187bc3ac --- /dev/null +++ b/libs/libwebsockets/lib/extension-deflate-stream.h @@ -0,0 +1,18 @@ + +#include + +#define DEFLATE_STREAM_CHUNK 128 +#define DEFLATE_STREAM_COMPRESSION_LEVEL 1 + +struct lws_ext_deflate_stream_conn { + z_stream zs_in; + z_stream zs_out; + unsigned char buf[2000]; +}; + +extern int lws_extension_callback_deflate_stream( + struct libwebsocket_context *context, + struct libwebsocket_extension *ext, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons reason, + void *user, void *in, size_t len); diff --git a/libs/libwebsockets/lib/extension-x-google-mux.c b/libs/libwebsockets/lib/extension-x-google-mux.c new file mode 100644 index 0000000000..f501c925a5 --- /dev/null +++ b/libs/libwebsockets/lib/extension-x-google-mux.c @@ -0,0 +1,1223 @@ +#include "private-libwebsockets.h" +#include "extension-x-google-mux.h" + +#define MUX_REAL_CHILD_INDEX_OFFSET 2 + +static int ongoing_subchannel; +static struct libwebsocket * tag_with_parent = NULL; +static int client_handshake_generation_is_for_mux_child; + +static int lws_addheader_mux_opcode(unsigned char *pb, int len) +{ + unsigned char *start = pb; + + *pb++ = LWS_WS_OPCODE_07__NOSPEC__MUX | 0x80; + if (len < 126) + *pb++ = len; + else { + if (len > 65535) { + *pb++ = 127; + *pb++ = 0; + *pb++ = 0; + *pb++ = 0; + *pb++ = 0; + *pb++ = (len ) >> 24; + *pb++ = (len) >> 16; + *pb++ = (len) >> 8; + *pb++ = (len) >> 0; + } else { + *pb++ = 126; + *pb++ = (len) >> 8; + *pb++ = (len) >> 0; + } + } + + return pb - start; +} + +static int +lws_mux_subcommand_header(int cmd, int channel, unsigned char *pb, int len) +{ + unsigned char *start = pb; + + if (channel == 0) { + muxdebug("lws_mux_subcommand_header: given ch 0\n"); + *((int *)0) = 0; + } + + if (channel < 31) + *pb++ = (channel << 3) | cmd; + else { + *pb++ = (31 << 3) | cmd; + *pb++ = channel >> 8; + *pb++ = channel; + } + + if (len <= 253) + *pb++ = len; + else { + if (len <= 65535) { + *pb++ = 254; + *pb++ = len >> 8; + *pb++ = len; + } else { + *pb++ = 255; + *pb++ = len >> 24; + *pb++ = len >> 16; + *pb++ = len >> 8; + *pb++ = len; + } + } + + return pb - start; +} + +static int lws_ext_x_google_mux__send_addchannel( + struct libwebsocket_context *context, + struct libwebsocket *wsi, + struct lws_ext_x_google_mux_conn *parent_conn, + struct libwebsocket *wsi_child, + int channel, + const char *url +) { + + unsigned char send_buf[LWS_SEND_BUFFER_PRE_PADDING + 2048 + + LWS_SEND_BUFFER_POST_PADDING]; + unsigned char *pb = &send_buf[LWS_SEND_BUFFER_PRE_PADDING]; + char *p; + char delta_headers[1536]; + int delta_headers_len; + int subcommand_length; + int n; + + if (channel == 0) { + muxdebug("lws_ext_x_google_mux__send_addchannel: given ch 0\n"); + *((int *)0) = 0; + } + + wsi_child->ietf_spec_revision = wsi->ietf_spec_revision; + + client_handshake_generation_is_for_mux_child = 1; + p = libwebsockets_generate_client_handshake(context, wsi_child, + delta_headers); + client_handshake_generation_is_for_mux_child = 0; + delta_headers_len = p - delta_headers; + + subcommand_length = lws_mux_subcommand_header( + LWS_EXT_XGM_OPC__ADDCHANNEL, channel, pb, delta_headers_len); + + pb += lws_addheader_mux_opcode(pb, subcommand_length + delta_headers_len); + pb += lws_mux_subcommand_header(LWS_EXT_XGM_OPC__ADDCHANNEL, channel, + pb, delta_headers_len); + +// n = sprintf((char *)pb, "%s\x0d\x0a", url); +// pb += n; + + if (delta_headers_len) + memcpy(pb, delta_headers, delta_headers_len); + + pb += delta_headers_len; + + muxdebug("add channel sends %ld\n", + pb - &send_buf[LWS_SEND_BUFFER_PRE_PADDING]); + + parent_conn->defeat_mux_opcode_wrapping = 1; + + /* send the request to the server */ + + n = lws_issue_raw_ext_access(wsi, &send_buf[LWS_SEND_BUFFER_PRE_PADDING], + pb - &send_buf[LWS_SEND_BUFFER_PRE_PADDING]); + + parent_conn->defeat_mux_opcode_wrapping = 0; + + return n; +} + +/** + * lws_extension_x_google_mux_parser(): Parse mux buffer headers coming in + * from a muxed connection into subchannel + * specific actions + * @wsi: muxed websocket instance + * @conn: x-google-mux private data bound to that @wsi + * @c: next character in muxed stream + */ + +static int +lws_extension_x_google_mux_parser(struct libwebsocket_context *context, + struct libwebsocket *wsi, + struct libwebsocket_extension *this_ext, + struct lws_ext_x_google_mux_conn *conn, unsigned char c) +{ + struct libwebsocket *wsi_child = NULL; + struct libwebsocket_extension *ext; + struct lws_ext_x_google_mux_conn *child_conn = NULL; + int n; + void *v; + +// fprintf(stderr, "XRX: %02X %d %d\n", c, conn->state, conn->length); + + /* + * [ ] + * [ ] + */ + + switch (conn->state) { + + case LWS_EXT_XGM_STATE__MUX_BLOCK_1: +// fprintf(stderr, "LWS_EXT_XGM_STATE__MUX_BLOCK_1: opc=%d channel=%d\n", c & 7, c >> 3); + conn->block_subopcode = c & 7; + conn->block_subchannel = (c >> 3) & 0x1f; + conn->ignore_cmd = 0; + + if (conn->block_subchannel != 31) + goto interpret; + else + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_2; + break; + + case LWS_EXT_XGM_STATE__MUX_BLOCK_2: + conn->block_subchannel = c << 8; + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_3; + break; + + case LWS_EXT_XGM_STATE__MUX_BLOCK_3: + conn->block_subchannel |= c; + +interpret: +// fprintf(stderr, "LWS_EXT_XGM_STATE__MUX_BLOCK_3: subchannel=%d\n", conn->block_subchannel); + ongoing_subchannel = conn->block_subchannel; + + /* + * convert the subchannel index to a child wsi + */ + + /* act on the muxing opcode */ + + switch (conn->block_subopcode) { + case LWS_EXT_XGM_OPC__DATA: + conn->state = LWS_EXT_XGM_STATE__DATA; + break; + case LWS_EXT_XGM_OPC__ADDCHANNEL: + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_LEN; + switch (wsi->mode) { + + /* client: parse accepted headers returned by server */ + + case LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY: + case LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE: + case LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY: + case LWS_CONNMODE_WS_CLIENT: + wsi_child = conn->wsi_children[conn->block_subchannel - MUX_REAL_CHILD_INDEX_OFFSET]; + wsi_child->state = WSI_STATE_HTTP_HEADERS; + wsi_child->parser_state = WSI_TOKEN_NAME_PART; + break; + default: + wsi_child = libwebsocket_create_new_server_wsi(context); + conn->wsi_children[conn->block_subchannel - MUX_REAL_CHILD_INDEX_OFFSET] = wsi_child; + wsi_child->state = WSI_STATE_HTTP_HEADERS; + wsi_child->parser_state = WSI_TOKEN_NAME_PART; + wsi_child->extension_handles = wsi; + muxdebug("MUX LWS_EXT_XGM_OPC__ADDCHANNEL... " + "created child subchannel %d\n", conn->block_subchannel); + break; + } + break; + case LWS_EXT_XGM_OPC__DROPCHANNEL: + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + break; + case LWS_EXT_XGM_OPC__FLOWCONTROL: + conn->state = LWS_EXT_XGM_STATE__FLOWCONTROL_1; + break; + default: + fprintf(stderr, "xgm: unknown subopcode\n"); + return -1; + } + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_LEN: + switch (c) { + case 254: + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_LEN16_1; + break; + case 255: + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_1; + break; + default: + conn->length = c; + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS; + break; + } + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_LEN16_1: + conn->length = c << 8; + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_LEN16_2; + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_LEN16_2: + conn->length |= c; + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS; + muxdebug("conn->length in mux block is %d\n", conn->length); + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_1: + conn->length = c << 24; + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_2; + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_2: + conn->length |= c << 16; + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_3; + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_3: + conn->length |= c << 8; + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_4; + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_4: + conn->length |= c; + conn->state = LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS; + break; + + case LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS: + + if (conn->block_subchannel == 0 || conn->block_subchannel >= + (sizeof(conn->wsi_children) / + sizeof(conn->wsi_children[0]))) { + fprintf(stderr, "Illegal subchannel %d in " + "LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS, ignoring", + conn->block_subchannel); + conn->ignore_cmd = 1; + } + + if (conn->block_subchannel == 1 && !conn->original_ch1_closed) { + fprintf(stderr, "illegal request to add ch1 when it's still live, ignoring\n"); + conn->ignore_cmd = 1; + } + + if (conn->ignore_cmd) { + if (--conn->length) + return 0; + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + return 0; + } + + switch (wsi->mode) { + + /* client: parse accepted headers returned by server */ + + case LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY: + case LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE: + case LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY: + case LWS_CONNMODE_WS_CLIENT_WAITING_EXTENSION_CONNECT: + case LWS_CONNMODE_WS_CLIENT: + + muxdebug("Client LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS in %c\n", c); + if (conn->block_subchannel == 1) { + muxdebug("adding ch1\n"); + wsi_child = wsi; + child_conn = conn; + } else + wsi_child = conn->wsi_children[ + conn->block_subchannel - + MUX_REAL_CHILD_INDEX_OFFSET]; + + libwebsocket_parse(wsi_child, c); + + if (--conn->length) + return 0; + + /* it's here we create the actual ext conn via callback */ + tag_with_parent = wsi; + lws_client_interpret_server_handshake(context, wsi_child); + tag_with_parent = NULL; + + //if (wsi->parser_state != WSI_PARSING_COMPLETE) +// break; + + /* client: we received all server's ADD ack */ + + if (conn->block_subchannel != 1) { + child_conn = lws_get_extension_user_matching_ext( + wsi_child, this_ext); + muxdebug("Received server's ADD Channel ACK for " + "subchannel %d child_conn=%p!\n", + conn->block_subchannel, (void *)child_conn); + + wsi_child->xor_mask = xor_no_mask; + wsi_child->ietf_spec_revision = wsi->ietf_spec_revision; + + wsi_child->mode = LWS_CONNMODE_WS_CLIENT; + wsi_child->state = WSI_STATE_ESTABLISHED; + child_conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + } + + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + child_conn->subchannel = conn->block_subchannel; + + /* allocate the per-connection user memory (if any) */ + + if (wsi_child->protocol->per_session_data_size) { + wsi_child->user_space = malloc( + wsi_child->protocol->per_session_data_size); + if (wsi_child->user_space == NULL) { + fprintf(stderr, "Out of memory for " + "conn user space\n"); + goto bail2; + } + } else + wsi_child->user_space = NULL; + + /* clear his proxy connection timeout */ + + libwebsocket_set_timeout(wsi, NO_PENDING_TIMEOUT, 0); + + /* mark him as being alive */ + + wsi_child->state = WSI_STATE_ESTABLISHED; + wsi_child->mode = LWS_CONNMODE_WS_CLIENT; + + if (wsi_child->protocol) + muxdebug("mux handshake OK for protocol %s\n", + wsi_child->protocol->name); + else + muxdebug("mux child handshake ends up with no protocol!\n"); + + /* + * inform all extensions, not just active ones since they + * already know + */ + + ext = context->extensions; + + while (ext && ext->callback) { + v = NULL; + for (n = 0; n < wsi_child->count_active_extensions; n++) + if (wsi_child->active_extensions[n] == ext) { + v = wsi_child->active_extensions_user[n]; + } + + ext->callback(context, ext, wsi_child, + LWS_EXT_CALLBACK_ANY_WSI_ESTABLISHED, v, NULL, 0); + ext++; + } + + /* call him back to inform him he is up */ + + wsi->protocol->callback(context, wsi_child, + LWS_CALLBACK_CLIENT_ESTABLISHED, + wsi_child->user_space, + NULL, 0); + + return 0; + +bail2: + exit(1); + + /* server: parse proposed changed headers from client */ + + default: + break; + } + + /* + * SERVER + */ + + wsi_child = conn->wsi_children[conn->block_subchannel - MUX_REAL_CHILD_INDEX_OFFSET]; + + muxdebug("Server LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS in %d\n", conn->length); + + libwebsocket_read(context, wsi_child, &c, 1); + + if (--conn->length > 0) + break; + + muxdebug("Server LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS done\n"); + + /* + * server: header diffs are all seen, we must process + * the add action + */ + + /* reply with ADDCHANNEL to ack it */ + + wsi->xor_mask = xor_no_mask; + child_conn = lws_get_extension_user_matching_ext(wsi_child, + this_ext); + if (!child_conn) { + fprintf(stderr, "wsi_child %p has no child conn!", (void *)wsi_child); + break; + } + child_conn->wsi_parent = wsi; + conn->sticky_mux_used = 1; + child_conn->subchannel = conn->block_subchannel; + + + muxdebug("Setting child conn parent to %p\n", (void *)wsi); + + wsi_child->mode = LWS_CONNMODE_WS_SERVING; + wsi_child->state = WSI_STATE_ESTABLISHED; + wsi_child->lws_rx_parse_state = LWS_RXPS_NEW; + wsi_child->rx_packet_length = 0; + + /* allocate the per-connection user memory (if any) */ + + if (wsi_child->protocol->per_session_data_size) { + wsi_child->user_space = malloc( + wsi_child->protocol->per_session_data_size); + if (wsi_child->user_space == NULL) { + fprintf(stderr, "Out of memory for " + "conn user space\n"); + break; + } + } else + wsi_child->user_space = NULL; + + + conn->wsi_children[conn->block_subchannel - + MUX_REAL_CHILD_INDEX_OFFSET] = wsi_child; + if (conn->highest_child_subchannel <= + conn->block_subchannel - MUX_REAL_CHILD_INDEX_OFFSET) + conn->highest_child_subchannel = + conn->block_subchannel - + MUX_REAL_CHILD_INDEX_OFFSET + 1; + + + /* notify user code that we're ready to roll */ + + if (wsi_child->protocol->callback) + wsi_child->protocol->callback( + wsi_child->protocol->owning_server, + wsi_child, LWS_CALLBACK_ESTABLISHED, + wsi_child->user_space, NULL, 0); + + muxdebug("setting conn state LWS_EXT_XGM_STATE__MUX_BLOCK_1\n"); + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + break; + + case LWS_EXT_XGM_STATE__FLOWCONTROL_1: + conn->length = c << 24; + conn->state = LWS_EXT_XGM_STATE__FLOWCONTROL_2; + break; + + case LWS_EXT_XGM_STATE__FLOWCONTROL_2: + conn->length |= c << 16; + conn->state = LWS_EXT_XGM_STATE__FLOWCONTROL_3; + break; + + case LWS_EXT_XGM_STATE__FLOWCONTROL_3: + conn->length |= c << 8; + conn->state = LWS_EXT_XGM_STATE__FLOWCONTROL_4; + break; + + case LWS_EXT_XGM_STATE__FLOWCONTROL_4: + conn->length |= c; + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + break; + + case LWS_EXT_XGM_STATE__DATA: + +// fprintf(stderr, "LWS_EXT_XGM_STATE__DATA in\n"); + + /* + * we have cooked websocket frame content following just like + * it went on the wire without mux, including masking and any + * other extensions (including this guy can himself be another + * level of channel mux, there's no restriction). + * + * We deal with it by just feeding it to the child wsi's rx + * state machine. The only issue is, we need that state machine + * to tell us when it ate a full frame, so we watch its state + * afterwards + */ + if (conn->block_subchannel - MUX_REAL_CHILD_INDEX_OFFSET >= conn->highest_child_subchannel) { + fprintf(stderr, "Illegal subchannel %d\n", conn->block_subchannel); + return -1; + } + + // fprintf(stderr, "LWS_EXT_XGM_STATE__DATA: ch %d\n", conn->block_subchannel); + + if (conn->block_subchannel == 1) { + if (conn->original_ch1_closed) { + fprintf(stderr, "data sent to closed ch1\n"); + return -1; + } + wsi_child = wsi; + } else + wsi_child = conn->wsi_children[conn->block_subchannel - MUX_REAL_CHILD_INDEX_OFFSET]; + + if (!wsi_child) { + fprintf(stderr, "Bad subchannel %d\n", conn->block_subchannel); + return -1; + } + + switch (wsi_child->mode) { + + /* client receives something */ + + case LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY: + case LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE: + case LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY: + case LWS_CONNMODE_WS_CLIENT: +// fprintf(stderr, " client\n"); + if (libwebsocket_client_rx_sm(wsi_child, c) < 0) { + libwebsocket_close_and_free_session( + context, + wsi_child, + LWS_CLOSE_STATUS_GOINGAWAY); + } + + return 0; + + /* server is receiving from client */ + + default: +// fprintf(stderr, " server\n"); + if (libwebsocket_rx_sm(wsi_child, c) < 0) { + muxdebug("probs\n"); + libwebsocket_close_and_free_session( + context, + wsi_child, + LWS_CLOSE_STATUS_GOINGAWAY); + } + break; + } + break; + } + + return 0; +} + + + +int lws_extension_callback_x_google_mux( + struct libwebsocket_context *context, + struct libwebsocket_extension *ext, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons reason, + void *user, void *in, size_t len) +{ + unsigned char send_buf[LWS_SEND_BUFFER_PRE_PADDING + 4096 + + LWS_SEND_BUFFER_POST_PADDING]; + struct lws_ext_x_google_mux_conn *conn = + (struct lws_ext_x_google_mux_conn *)user; + struct lws_ext_x_google_mux_conn *parent_conn; + struct lws_ext_x_google_mux_conn *child_conn; + int n; + struct lws_tokens *eff_buf = (struct lws_tokens *)in; + unsigned char *p = NULL; + struct lws_ext_x_google_mux_context *mux_ctx = + ext->per_context_private_data; + struct libwebsocket *wsi_parent; + struct libwebsocket *wsi_child; + struct libwebsocket *wsi_temp; + unsigned char *pin = (unsigned char *)in; + unsigned char *basepin; + int m; + int done = 0; + unsigned char *pb = &send_buf[LWS_SEND_BUFFER_PRE_PADDING]; + int subcommand_length; + + if (eff_buf) + p = (unsigned char *)eff_buf->token; + + switch (reason) { + + /* these guys are once per context */ + + case LWS_EXT_CALLBACK_SERVER_CONTEXT_CONSTRUCT: + case LWS_EXT_CALLBACK_CLIENT_CONTEXT_CONSTRUCT: + + ext->per_context_private_data = malloc( + sizeof (struct lws_ext_x_google_mux_context)); + mux_ctx = (struct lws_ext_x_google_mux_context *) + ext->per_context_private_data; + mux_ctx->active_conns = 0; + break; + + case LWS_EXT_CALLBACK_SERVER_CONTEXT_DESTRUCT: + case LWS_EXT_CALLBACK_CLIENT_CONTEXT_DESTRUCT: + + if (!mux_ctx) + break; + for (n = 0; n < mux_ctx->active_conns; n++) + if (mux_ctx->wsi_muxconns[n]) { + libwebsocket_close_and_free_session( + context, mux_ctx->wsi_muxconns[n], + LWS_CLOSE_STATUS_GOINGAWAY); + mux_ctx->wsi_muxconns[n] = NULL; + } + + free(mux_ctx); + break; + + /* + * channel management + */ + + case LWS_EXT_CALLBACK_CAN_PROXY_CLIENT_CONNECTION: + + muxdebug("LWS_EXT_CALLBACK_CAN_PROXY_CLIENT_CONNECTION %s:%u\n", + (char *)in, (unsigned int)len); + + /* + * Does a physcial connection to the same server:port already + * exist so we can piggyback on it? + */ + + for (n = 0; n < mux_ctx->active_conns && !done; n++) { + + wsi_parent = mux_ctx->wsi_muxconns[n]; + if (!wsi_parent) + continue; + + muxdebug(" %s / %s\n", wsi_parent->c_address, (char *)in); + if (strcmp(wsi_parent->c_address, in)) + continue; + muxdebug(" %u / %u\n", wsi_parent->c_port, (unsigned int)len); + + if (wsi_parent->c_port != (unsigned int)len) + continue; + + /* + * does this potential parent already have an + * x-google-mux conn associated with him? + */ + + parent_conn = NULL; + for (m = 0; m < wsi_parent->count_active_extensions; m++) + if (ext == wsi_parent->active_extensions[m]) + parent_conn = (struct lws_ext_x_google_mux_conn *) + wsi_parent->active_extensions_user[m]; + + if (parent_conn == NULL) { + + /* + * he doesn't -- see if that's just because it + * is early in his connection sequence or if we + * should give up on him + */ + + switch (wsi_parent->mode) { + case LWS_CONNMODE_WS_SERVING: + case LWS_CONNMODE_WS_CLIENT: + continue; + default: + break; + } + + /* + * our putative parent is still connecting + * himself, we have to become a candidate child + * and find out our final fate when the parent + * completes connection + */ + + wsi->candidate_children_list = wsi_parent->candidate_children_list; + wsi_parent->candidate_children_list = wsi; + wsi->mode = LWS_CONNMODE_WS_CLIENT_PENDING_CANDIDATE_CHILD; + + done = 1; + continue; + } + + if (parent_conn->highest_child_subchannel >= + (sizeof(parent_conn->wsi_children) / + sizeof(parent_conn->wsi_children[0]))) { + fprintf(stderr, "Can't add any more children\n"); + continue; + } + /* + * this established connection will do, bind them + * from now on child will only operate through parent + * connection + */ + + wsi->candidate_children_list = wsi_parent->candidate_children_list; + wsi_parent->candidate_children_list = wsi; + wsi->mode = LWS_CONNMODE_WS_CLIENT_PENDING_CANDIDATE_CHILD; + + muxdebug("attaching to existing mux\n"); + + conn = parent_conn; + wsi = wsi_parent; + + goto handle_additions; + + } + + /* + * either way, note the existence of this connection in case + * he will become a possible mux parent later + */ + + mux_ctx->wsi_muxconns[mux_ctx->active_conns++] = wsi; + if (done) + return 1; + + muxdebug("x-google-mux: unable to mux connection\n"); + + break; + + /* these guys are once per connection */ + + case LWS_EXT_CALLBACK_CLIENT_CONSTRUCT: + muxdebug("LWS_EXT_CALLBACK_CLIENT_CONSTRUCT: setting parent = %p\n", (void *)tag_with_parent); + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + if (conn->block_subchannel != 1) + conn->wsi_parent = tag_with_parent; + break; + + case LWS_EXT_CALLBACK_CONSTRUCT: + muxdebug("LWS_EXT_CALLBACK_CONSTRUCT\n"); + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + break; + + case LWS_EXT_CALLBACK_CHECK_OK_TO_REALLY_CLOSE: + muxdebug("LWS_EXT_CALLBACK_CHECK_OK_TO_REALLY_CLOSE\n"); + + if (conn->subchannel == 1) { + + /* + * special case of original mux parent channel closing + */ + + conn->original_ch1_closed = 1; + + fprintf(stderr, "original mux parent channel closing\n"); + + parent_conn = conn; + } else { + + parent_conn = lws_get_extension_user_matching_ext(conn->wsi_parent, ext); + if (parent_conn == 0) { + muxdebug("failed to get parent conn\n"); + break; + } + } + + /* see if that was the end of the mux entirely */ + + if (!parent_conn->original_ch1_closed) + break; + + done = 0; + for (n = 0; n < !done && parent_conn->highest_child_subchannel; n++) + if (parent_conn->wsi_children[n]) + done = 1; + + /* if he has children, don't let him close for real! */ + + if (done) { + fprintf(stderr, "VETO closure\n"); + return 1; + } + + /* no children, ch1 is closed, let him destroy himself */ + + if (conn->subchannel == 1) + fprintf(stderr, "ALLOW closure of mux parent\n"); + + break; + + case LWS_EXT_CALLBACK_DESTROY: + muxdebug("LWS_EXT_CALLBACK_DESTROY\n"); + + /* + * remove us from parent if noted in parent + */ + + if (conn->subchannel == 1) { + + /* + * special case of original mux parent channel closing + */ + + conn->original_ch1_closed = 1; + + fprintf(stderr, "original mux parent channel closing\n"); + + parent_conn = conn; + wsi_parent = wsi; + } else { + + wsi_parent = conn->wsi_parent; + parent_conn = lws_get_extension_user_matching_ext(conn->wsi_parent, ext); + if (parent_conn == 0) { + muxdebug("failed to get parent conn\n"); + break; + } + for (n = 0; n < parent_conn->highest_child_subchannel; n++) + if (parent_conn->wsi_children[n] == wsi) + parent_conn->wsi_children[n] = NULL; + } + + /* see if that was the end of the mux entirely */ + + if (!parent_conn->original_ch1_closed) + break; + + done = 0; + for (n = 0; n < !done && parent_conn->highest_child_subchannel; n++) + if (parent_conn->wsi_children[n]) + done = 1; + + if (done == 0) + if (parent_conn != conn) + + /* + * parent closed last and no children left + * ... and we are not parent already ourselves + */ + + libwebsocket_close_and_free_session(context, wsi_parent, LWS_CLOSE_STATUS_NORMAL); + + break; + + case LWS_EXT_CALLBACK_DESTROY_ANY_WSI_CLOSING: + muxdebug("LWS_EXT_CALLBACK_DESTROY_ANY_WSI_CLOSING\n"); + + for (n = 0; n < mux_ctx->active_conns; n++) + if (mux_ctx->wsi_muxconns[n] == wsi) { + while (n++ < mux_ctx->active_conns) + mux_ctx->wsi_muxconns[n - 1] = + mux_ctx->wsi_muxconns[n]; + mux_ctx->active_conns--; + return 0; + } + + /* + * liberate any candidate children otherwise imprisoned + */ + + wsi_parent = wsi->candidate_children_list; + while (wsi_parent) { + wsi_temp = wsi_parent->candidate_children_list; + /* let them each connect privately then */ + __libwebsocket_client_connect_2(context, wsi_parent); + wsi_parent = wsi_temp; + } + + break; + + case LWS_EXT_CALLBACK_ANY_WSI_ESTABLISHED: + muxdebug("LWS_EXT_CALLBACK_ANY_WSI_ESTABLISHED\n"); + +handle_additions: + /* + * did this putative parent get x-google-mux authorized in the + * end? + */ + + if (!conn) { + + muxdebug(" Putative parent didn't get mux extension, let them go it alone\n"); + + /* + * no, we can't be a parent for mux children. Let + * them all go it alone + */ + + wsi_child = wsi->candidate_children_list; + while (wsi_child) { + wsi_temp = wsi_child->candidate_children_list; + /* let them each connect privately then */ + __libwebsocket_client_connect_2(context, wsi_child); + wsi_child = wsi_temp; + } + + return 1; + } + + /* + * we did get mux extension authorized by server, in that case + * if we have any candidate children let's try to attach them + * as mux subchannel real children + */ + + wsi_child = wsi->candidate_children_list; + n = 0; + while (wsi_child) { + + wsi_temp = wsi_child->candidate_children_list; + + /* find an empty subchannel */ + + while ((n < (sizeof(conn->wsi_children) / sizeof(conn->wsi_children[0]))) && + conn->wsi_children[n] != NULL) + n++; + + if (n >= (sizeof(conn->wsi_children) / sizeof(conn->wsi_children[0]))) { + /* no room at the inn */ + + /* let them each connect privately then */ + __libwebsocket_client_connect_2(context, wsi_child); + wsi_child = wsi_temp; + continue; + } + + muxdebug(" using mux addchannel action for candidate child\n"); + + /* pile the children on the parent */ + lws_ext_x_google_mux__send_addchannel(context, wsi, + conn, wsi_child, + n + MUX_REAL_CHILD_INDEX_OFFSET, wsi->c_path); + + conn->sticky_mux_used = 1; + + conn->wsi_children[n] = wsi_child; + if ((n + 1) > conn->highest_child_subchannel) + conn->highest_child_subchannel = n + 1; + + muxdebug("Setting CHILD LIST entry %d to %p\n", + n + MUX_REAL_CHILD_INDEX_OFFSET, (void *)wsi_parent); + wsi_child = wsi_temp; + } + wsi->candidate_children_list = NULL; + return 1; + + /* + * whenever we receive something on a muxed link + */ + + case LWS_EXT_CALLBACK_EXTENDED_PAYLOAD_RX: + + muxdebug("LWS_EXT_CALLBACK_EXTENDED_PAYLOAD_RX\n"); + + if (wsi->opcode != LWS_WS_OPCODE_07__NOSPEC__MUX) + return 0; /* unhandled */ + + conn->state = LWS_EXT_XGM_STATE__MUX_BLOCK_1; + + n = eff_buf->token_len; + while (n--) + if (lws_extension_x_google_mux_parser(context, wsi, ext, + conn, *p++) < 0) { + return -1; + } + return 1; /* handled */ + + /* + * when something might need sending on our transport + */ + + case LWS_EXT_CALLBACK_PACKET_TX_DO_SEND: + + muxdebug("LWS_EXT_CALLBACK_PACKET_TX_DO_SEND: %p, " + "my subchannel=%d\n", + (void *)conn->wsi_parent, conn->subchannel); + + pin = *((unsigned char **)in); + basepin = pin; + + wsi_parent = conn->wsi_parent; + + if (conn->subchannel == 1) { + + /* + * if we weren't 'closed', then we were the original + * connection that established this link, ie, it's + * the parent wsi + */ + + if (conn->original_ch1_closed) { + fprintf(stderr, "Trying to send on dead original ch1\n"); + return 0; + } + + /* send on ourselves */ + + wsi_parent = wsi; + + } else { + + /* + * he's not a child connection of a mux + */ + + if (!conn->wsi_parent) { + // fprintf(stderr, "conn %p has no parent\n", (void *)conn); + return 0; + } + + /* + * get parent / transport mux context + */ + + parent_conn = lws_get_extension_user_matching_ext(conn->wsi_parent, ext); + if (parent_conn == 0) { + muxdebug("failed to get parent conn\n"); + return 0; + } + + /* + * mux transport is in singular mode, let the caller send it + * no more muxified than it already is + */ + + if (!parent_conn->sticky_mux_used) { + // fprintf(stderr, "parent in singular mode\n"); + return 0; + } + } + + if (!conn->defeat_mux_opcode_wrapping) { + + n = 1; + if (conn->subchannel >= 31) + n = 3; + + /* + * otherwise we need to take care of the sending action using + * mux protocol. Prepend the channel + opcode + */ + + pin -= lws_addheader_mux_opcode(send_buf, len + n) + n; + basepin = pin; + pin += lws_addheader_mux_opcode(pin, len + n); + + if (conn->subchannel >= 31) { + *pin++ = (31 << 3) | LWS_EXT_XGM_OPC__DATA; + *pin++ = conn->subchannel >> 8; + *pin++ = conn->subchannel; + } else + *pin++ = (conn->subchannel << 3) | LWS_EXT_XGM_OPC__DATA; + } + + /* + * recurse to allow nesting + */ + + lws_issue_raw_ext_access(wsi_parent, basepin, (pin - basepin) + len); + + return 1; /* handled */ + + case LWS_EXT_CALLBACK_1HZ: + /* + * if we have children, service their timeouts using the same + * handler as toplevel guys to allow recursion + */ + for (n = 0; n < conn->highest_child_subchannel; n++) + if (conn->wsi_children[n]) + libwebsocket_service_timeout_check(context, + conn->wsi_children[n], len); + break; + + case LWS_EXT_CALLBACK_REQUEST_ON_WRITEABLE: + /* + * if a mux child is asking for callback on writable, we have + * to pass it up to his parent + */ + + muxdebug("LWS_EXT_CALLBACK_REQUEST_ON_WRITEABLE %s\n", wsi->protocol->name); + + if (conn->wsi_parent == NULL) { + muxdebug(" no parent\n"); + break; + } + + if (!conn->awaiting_POLLOUT) { + + muxdebug(" !conn->awaiting_POLLOUT\n"); + + conn->awaiting_POLLOUT = 1; + parent_conn = NULL; + for (m = 0; m < conn->wsi_parent->count_active_extensions; m++) + if (ext == conn->wsi_parent->active_extensions[m]) + parent_conn = (struct lws_ext_x_google_mux_conn *) + conn->wsi_parent->active_extensions_user[m]; + + if (parent_conn != NULL) { + parent_conn->count_children_needing_POLLOUT++; + muxdebug(" count_children_needing_POLLOUT bumped\n"); + } else + muxdebug("unable to identify parent conn\n"); + } + muxdebug(" requesting on parent %p\n", (void *)conn->wsi_parent); + libwebsocket_callback_on_writable(context, conn->wsi_parent); + + return 1; + + case LWS_EXT_CALLBACK_HANDSHAKE_REPLY_TX: + + muxdebug("LWS_EXT_CALLBACK_HANDSHAKE_REPLY_TX %p\n", + (void *)wsi->extension_handles); + + /* send raw if we're not a child */ + + if (!wsi->extension_handles) + return 0; + + subcommand_length = lws_mux_subcommand_header(LWS_EXT_XGM_OPC__ADDCHANNEL, ongoing_subchannel, pb, len); + + pb += lws_addheader_mux_opcode(pb, subcommand_length + len); + pb += lws_mux_subcommand_header(LWS_EXT_XGM_OPC__ADDCHANNEL, ongoing_subchannel, pb, len); + memcpy(pb, in, len); + pb += len; + + lws_issue_raw_ext_access(wsi->extension_handles, &send_buf[LWS_SEND_BUFFER_PRE_PADDING], + pb - &send_buf[LWS_SEND_BUFFER_PRE_PADDING]); + + + return 1; /* handled */ + + case LWS_EXT_CALLBACK_IS_WRITEABLE: + /* + * we are writable, inform children if any care + */ + muxdebug("LWS_EXT_CALLBACK_IS_WRITEABLE: %s\n", wsi->protocol->name); + + if (!conn->count_children_needing_POLLOUT) { + muxdebug(" no children need POLLOUT\n"); + return 0; + } + + for (n = 0; n < conn->highest_child_subchannel; n++) { + + if (!conn->wsi_children[n]) + continue; + + child_conn = NULL; + for (m = 0; m < conn->wsi_children[n]->count_active_extensions; m++) + if (ext == conn->wsi_children[n]->active_extensions[m]) + child_conn = (struct lws_ext_x_google_mux_conn *) + conn->wsi_children[n]->active_extensions_user[m]; + + if (!child_conn) { + muxdebug("unable to identify child conn\n"); + continue; + } + + if (!child_conn->awaiting_POLLOUT) + continue; + + child_conn->awaiting_POLLOUT = 0; + conn->count_children_needing_POLLOUT--; + lws_handle_POLLOUT_event(context, conn->wsi_children[n], NULL); + if (!conn->count_children_needing_POLLOUT) + return 2; /* all handled */ + else + return 1; /* handled but need more */ + } + break; + + case LWS_EXT_CALLBACK_CHECK_OK_TO_PROPOSE_EXTENSION: + + /* disallow deflate-stream if we are a mux child connection */ + + if (strcmp(in, "deflate-stream") == 0 && + client_handshake_generation_is_for_mux_child) { + + muxdebug("mux banned deflate-stream on child connection\n"); + return 1; /* disallow */ + } + break; + + default: + break; + } + + return 0; +} diff --git a/libs/libwebsockets/lib/extension-x-google-mux.h b/libs/libwebsockets/lib/extension-x-google-mux.h new file mode 100644 index 0000000000..4f4d397c2e --- /dev/null +++ b/libs/libwebsockets/lib/extension-x-google-mux.h @@ -0,0 +1,96 @@ + +#if 0 +#ifdef WIN32 +static +#else +static inline +#endif +void muxdebug(const char *format, ...) +{ + va_list ap; + va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); +} +#else +#ifdef WIN32 +static +#else +static inline +#endif +void muxdebug(const char *format, ...) +{ +} +#endif + +#define MAX_XGM_SUBCHANNELS 8192 + +enum lws_ext_x_google_mux__parser_states { + LWS_EXT_XGM_STATE__MUX_BLOCK_1, + LWS_EXT_XGM_STATE__MUX_BLOCK_2, + LWS_EXT_XGM_STATE__MUX_BLOCK_3, + LWS_EXT_XGM_STATE__ADDCHANNEL_LEN, + LWS_EXT_XGM_STATE__ADDCHANNEL_LEN16_1, + LWS_EXT_XGM_STATE__ADDCHANNEL_LEN16_2, + LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_1, + LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_2, + LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_3, + LWS_EXT_XGM_STATE__ADDCHANNEL_LEN32_4, + LWS_EXT_XGM_STATE__ADDCHANNEL_HEADERS, + LWS_EXT_XGM_STATE__FLOWCONTROL_1, + LWS_EXT_XGM_STATE__FLOWCONTROL_2, + LWS_EXT_XGM_STATE__FLOWCONTROL_3, + LWS_EXT_XGM_STATE__FLOWCONTROL_4, + LWS_EXT_XGM_STATE__DATA, +}; + +enum lws_ext_x_goole_mux__mux_opcodes { + LWS_EXT_XGM_OPC__DATA, + LWS_EXT_XGM_OPC__ADDCHANNEL, + LWS_EXT_XGM_OPC__DROPCHANNEL, + LWS_EXT_XGM_OPC__FLOWCONTROL, + LWS_EXT_XGM_OPC__RESERVED_4, + LWS_EXT_XGM_OPC__RESERVED_5, + LWS_EXT_XGM_OPC__RESERVED_6, + LWS_EXT_XGM_OPC__RESERVED_7, +}; + +/* one of these per context (server or client) */ + +struct lws_ext_x_google_mux_context { + /* + * these are listing physical connections, not children sharing a + * parent mux physical connection + */ + struct libwebsocket *wsi_muxconns[MAX_CLIENTS]; + /* + * when this is < 2, we do not do any mux blocks + * just pure websockets + */ + int active_conns; +}; + +/* one of these per connection (server or client) */ + +struct lws_ext_x_google_mux_conn { + enum lws_ext_x_goole_mux__mux_opcodes block_subopcode; + int block_subchannel; + unsigned int length; + enum lws_ext_x_google_mux__parser_states state; + /* child points to the mux wsi using this */ + struct libwebsocket *wsi_parent; + int subchannel; + struct libwebsocket *wsi_children[MAX_CLIENTS]; + int highest_child_subchannel; + char awaiting_POLLOUT; + int count_children_needing_POLLOUT; + int sticky_mux_used; + int defeat_mux_opcode_wrapping; + int original_ch1_closed; + int ignore_cmd; +}; + +extern int +lws_extension_callback_x_google_mux(struct libwebsocket_context *context, + struct libwebsocket_extension *ext, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons reason, + void *user, void *in, size_t len); diff --git a/libs/libwebsockets/lib/extension.c b/libs/libwebsockets/lib/extension.c new file mode 100644 index 0000000000..890930872a --- /dev/null +++ b/libs/libwebsockets/lib/extension.c @@ -0,0 +1,22 @@ +#include "private-libwebsockets.h" + +#include "extension-deflate-stream.h" +#include "extension-x-google-mux.h" + +struct libwebsocket_extension libwebsocket_internal_extensions[] = { +#ifdef LWS_EXT_GOOGLE_MUX + { + "x-google-mux", + lws_extension_callback_x_google_mux, + sizeof (struct lws_ext_x_google_mux_conn) + }, +#endif + { + "deflate-stream", + lws_extension_callback_deflate_stream, + sizeof (struct lws_ext_deflate_stream_conn) + }, + { /* terminator */ + NULL, NULL, 0 + } +}; diff --git a/libs/libwebsockets/lib/handshake.c b/libs/libwebsockets/lib/handshake.c new file mode 100644 index 0000000000..70fe3a87eb --- /dev/null +++ b/libs/libwebsockets/lib/handshake.c @@ -0,0 +1,722 @@ +/* + * libwebsockets - small server side websockets and web server implementation + * + * Copyright (C) 2010 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include "private-libwebsockets.h" + +#define LWS_CPYAPP(ptr, str) { strcpy(ptr, str); ptr += strlen(str); } +#define LWS_CPYAPP_TOKEN(ptr, tok) { strcpy(p, wsi->utf8_token[tok].token); \ + p += wsi->utf8_token[tok].token_len; } + +static int +interpret_key(const char *key, unsigned long *result) +{ + char digits[20]; + int digit_pos = 0; + const char *p = key; + unsigned int spaces = 0; + unsigned long acc = 0; + int rem = 0; + + while (*p) { + if (!isdigit(*p)) { + p++; + continue; + } + if (digit_pos == sizeof(digits) - 1) + return -1; + digits[digit_pos++] = *p++; + } + digits[digit_pos] = '\0'; + if (!digit_pos) + return -2; + + while (*key) { + if (*key == ' ') + spaces++; + key++; + } + + if (!spaces) + return -3; + + p = &digits[0]; + while (*p) { + rem = (rem * 10) + ((*p++) - '0'); + acc = (acc * 10) + (rem / spaces); + rem -= (rem / spaces) * spaces; + } + + if (rem) { + fprintf(stderr, "nonzero handshake remainder\n"); + return -1; + } + + *result = acc; + + return 0; +} + + +static int +handshake_00(struct libwebsocket_context *context, struct libwebsocket *wsi) +{ + unsigned long key1, key2; + unsigned char sum[16]; + char *response; + char *p; + int n; + + /* Confirm we have all the necessary pieces */ + + if (!wsi->utf8_token[WSI_TOKEN_ORIGIN].token_len || + !wsi->utf8_token[WSI_TOKEN_HOST].token_len || + !wsi->utf8_token[WSI_TOKEN_CHALLENGE].token_len || + !wsi->utf8_token[WSI_TOKEN_KEY1].token_len || + !wsi->utf8_token[WSI_TOKEN_KEY2].token_len) + /* completed header processing, but missing some bits */ + goto bail; + + /* allocate the per-connection user memory (if any) */ + if (wsi->protocol->per_session_data_size && + !libwebsocket_ensure_user_space(wsi)) + goto bail; + + /* create the response packet */ + + /* make a buffer big enough for everything */ + + response = malloc(256 + + wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len + + wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len + + wsi->utf8_token[WSI_TOKEN_HOST].token_len + + wsi->utf8_token[WSI_TOKEN_ORIGIN].token_len + + wsi->utf8_token[WSI_TOKEN_GET_URI].token_len + + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len); + if (!response) { + fprintf(stderr, "Out of memory for response buffer\n"); + goto bail; + } + + p = response; + LWS_CPYAPP(p, "HTTP/1.1 101 WebSocket Protocol Handshake\x0d\x0a" + "Upgrade: WebSocket\x0d\x0a" + "Connection: Upgrade\x0d\x0a" + "Sec-WebSocket-Origin: "); + strcpy(p, wsi->utf8_token[WSI_TOKEN_ORIGIN].token); + p += wsi->utf8_token[WSI_TOKEN_ORIGIN].token_len; +#ifdef LWS_OPENSSL_SUPPORT + if (wsi->ssl) { + LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Location: wss://"); + } else { + LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Location: ws://"); + } +#else + LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Location: ws://"); +#endif + + LWS_CPYAPP_TOKEN(p, WSI_TOKEN_HOST); + LWS_CPYAPP_TOKEN(p, WSI_TOKEN_GET_URI); + + if (wsi->utf8_token[WSI_TOKEN_PROTOCOL].token) { + LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Protocol: "); + LWS_CPYAPP_TOKEN(p, WSI_TOKEN_PROTOCOL); + } + + LWS_CPYAPP(p, "\x0d\x0a\x0d\x0a"); + + /* convert the two keys into 32-bit integers */ + + if (interpret_key(wsi->utf8_token[WSI_TOKEN_KEY1].token, &key1)) + goto bail; + if (interpret_key(wsi->utf8_token[WSI_TOKEN_KEY2].token, &key2)) + goto bail; + + /* lay them out in network byte order (MSB first */ + + sum[0] = key1 >> 24; + sum[1] = key1 >> 16; + sum[2] = key1 >> 8; + sum[3] = key1; + sum[4] = key2 >> 24; + sum[5] = key2 >> 16; + sum[6] = key2 >> 8; + sum[7] = key2; + + /* follow them with the challenge token we were sent */ + + memcpy(&sum[8], wsi->utf8_token[WSI_TOKEN_CHALLENGE].token, 8); + + /* + * compute the md5sum of that 16-byte series and use as our + * payload after our headers + */ + + MD5(sum, 16, (unsigned char *)p); + p += 16; + + /* it's complete: go ahead and send it */ + + debug("issuing response packet %d len\n", (int)(p - response)); +#ifdef DEBUG + fwrite(response, 1, p - response, stderr); +#endif + n = libwebsocket_write(wsi, (unsigned char *)response, + p - response, LWS_WRITE_HTTP); + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + goto bail; + } + + /* alright clean up and set ourselves into established state */ + + free(response); + wsi->state = WSI_STATE_ESTABLISHED; + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + + /* notify user code that we're ready to roll */ + + if (wsi->protocol->callback) + wsi->protocol->callback(wsi->protocol->owning_server, + wsi, LWS_CALLBACK_ESTABLISHED, + wsi->user_space, NULL, 0); + + return 0; + +bail: + return -1; +} + +/* + * Perform the newer BASE64-encoded handshake scheme + */ + +static int +handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi) +{ + static const char *websocket_magic_guid_04 = + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + static const char *websocket_magic_guid_04_masking = + "61AC5F19-FBBA-4540-B96F-6561F1AB40A8"; + char accept_buf[MAX_WEBSOCKET_04_KEY_LEN + 37]; + char nonce_buf[256]; + char mask_summing_buf[256 + MAX_WEBSOCKET_04_KEY_LEN + 37]; + unsigned char hash[20]; + int n; + char *response; + char *p; + char *m = mask_summing_buf; + int nonce_len = 0; + int accept_len; + char *c; + char ext_name[128]; + struct libwebsocket_extension *ext; + int ext_count = 0; + int more = 1; + + if (!wsi->utf8_token[WSI_TOKEN_HOST].token_len || + !wsi->utf8_token[WSI_TOKEN_KEY].token_len) { + debug("handshake_04 missing pieces\n"); + /* completed header processing, but missing some bits */ + goto bail; + } + + if (wsi->utf8_token[WSI_TOKEN_KEY].token_len >= + MAX_WEBSOCKET_04_KEY_LEN) { + fprintf(stderr, "Client sent handshake key longer " + "than max supported %d\n", MAX_WEBSOCKET_04_KEY_LEN); + goto bail; + } + + strcpy(accept_buf, wsi->utf8_token[WSI_TOKEN_KEY].token); + strcpy(accept_buf + wsi->utf8_token[WSI_TOKEN_KEY].token_len, + websocket_magic_guid_04); + + SHA1((unsigned char *)accept_buf, + wsi->utf8_token[WSI_TOKEN_KEY].token_len + + strlen(websocket_magic_guid_04), hash); + + accept_len = lws_b64_encode_string((char *)hash, 20, accept_buf, + sizeof accept_buf); + if (accept_len < 0) { + fprintf(stderr, "Base64 encoded hash too long\n"); + goto bail; + } + + /* allocate the per-connection user memory (if any) */ + if (wsi->protocol->per_session_data_size && + !libwebsocket_ensure_user_space(wsi)) + goto bail; + + /* create the response packet */ + + /* make a buffer big enough for everything */ + + response = malloc(256 + + wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len + + wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len + + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len); + if (!response) { + fprintf(stderr, "Out of memory for response buffer\n"); + goto bail; + } + + p = response; + LWS_CPYAPP(p, "HTTP/1.1 101 Switching Protocols\x0d\x0a" + "Upgrade: WebSocket\x0d\x0a" + "Connection: Upgrade\x0d\x0a" + "Sec-WebSocket-Accept: "); + strcpy(p, accept_buf); + p += accept_len; + + if (wsi->ietf_spec_revision == 4) { + LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Nonce: "); + + /* select the nonce */ + + n = libwebsockets_get_random(wsi->protocol->owning_server, + hash, 16); + if (n != 16) { + fprintf(stderr, "Unable to read random device %s %d\n", + SYSTEM_RANDOM_FILEPATH, n); + if (wsi->user_space) + free(wsi->user_space); + goto bail; + } + + /* encode the nonce */ + + nonce_len = lws_b64_encode_string((const char *)hash, 16, + nonce_buf, sizeof nonce_buf); + if (nonce_len < 0) { + fprintf(stderr, "Failed to base 64 encode the nonce\n"); + if (wsi->user_space) + free(wsi->user_space); + goto bail; + } + + /* apply the nonce */ + + strcpy(p, nonce_buf); + p += nonce_len; + } + + if (wsi->utf8_token[WSI_TOKEN_PROTOCOL].token) { + LWS_CPYAPP(p, "\x0d\x0aSec-WebSocket-Protocol: "); + LWS_CPYAPP_TOKEN(p, WSI_TOKEN_PROTOCOL); + } + + /* + * Figure out which extensions the client has that we want to + * enable on this connection, and give him back the list + */ + + if (wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token_len) { + + /* + * break down the list of client extensions + * and go through them + */ + + c = wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token; + debug("wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token = %s\n", + wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token); + wsi->count_active_extensions = 0; + n = 0; + while (more) { + + if (*c && (*c != ',' && *c != ' ' && *c != '\t')) { + ext_name[n] = *c++; + if (n < sizeof(ext_name) - 1) + n++; + continue; + } + ext_name[n] = '\0'; + if (!*c) + more = 0; + else { + c++; + if (!n) + continue; + } + + /* check a client's extension against our support */ + + ext = wsi->protocol->owning_server->extensions; + + while (ext && ext->callback) { + + if (strcmp(ext_name, ext->name)) { + ext++; + continue; + } + + /* + * oh, we do support this one he + * asked for... but let's ask user + * code if it's OK to apply it on this + * particular connection + protocol + */ + + n = wsi->protocol->owning_server-> + protocols[0].callback( + wsi->protocol->owning_server, + wsi, + LWS_CALLBACK_CONFIRM_EXTENSION_OKAY, + wsi->user_space, ext_name, 0); + + /* + * zero return from callback means + * go ahead and allow the extension, + * it's what we get if the callback is + * unhandled + */ + + if (n) { + ext++; + continue; + } + + /* apply it */ + + if (ext_count) + *p++ = ','; + else + LWS_CPYAPP(p, + "\x0d\x0aSec-WebSocket-Extensions: "); + p += sprintf(p, "%s", ext_name); + ext_count++; + + /* instantiate the extension on this conn */ + + wsi->active_extensions_user[ + wsi->count_active_extensions] = + malloc(ext->per_session_data_size); + memset(wsi->active_extensions_user[ + wsi->count_active_extensions], 0, + ext->per_session_data_size); + + wsi->active_extensions[ + wsi->count_active_extensions] = ext; + + /* allow him to construct his context */ + + ext->callback(wsi->protocol->owning_server, + ext, wsi, + LWS_EXT_CALLBACK_CONSTRUCT, + wsi->active_extensions_user[ + wsi->count_active_extensions], NULL, 0); + + wsi->count_active_extensions++; + debug("wsi->count_active_extensions <- %d", + wsi->count_active_extensions); + + ext++; + } + + n = 0; + } + } + + /* end of response packet */ + + LWS_CPYAPP(p, "\x0d\x0a\x0d\x0a"); + + if (wsi->ietf_spec_revision == 4) { + + /* + * precompute the masking key the client will use from the SHA1 + * hash of ( base 64 client key we were sent, concatenated with + * the bse 64 nonce we sent, concatenated with a magic constant + * guid specified by the 04 standard ) + * + * We store the hash in the connection's wsi ready to use with + * undoing the masking the client has done on framed data it + * sends (we send our data to the client in clear). + */ + + strcpy(mask_summing_buf, wsi->utf8_token[WSI_TOKEN_KEY].token); + m += wsi->utf8_token[WSI_TOKEN_KEY].token_len; + strcpy(m, nonce_buf); + m += nonce_len; + strcpy(m, websocket_magic_guid_04_masking); + m += strlen(websocket_magic_guid_04_masking); + + SHA1((unsigned char *)mask_summing_buf, m - mask_summing_buf, + wsi->masking_key_04); + } + + if (!lws_any_extension_handled(context, wsi, + LWS_EXT_CALLBACK_HANDSHAKE_REPLY_TX, + response, p - response)) { + + /* okay send the handshake response accepting the connection */ + + debug("issuing response packet %d len\n", (int)(p - response)); + #ifdef DEBUG + fwrite(response, 1, p - response, stderr); + #endif + n = libwebsocket_write(wsi, (unsigned char *)response, + p - response, LWS_WRITE_HTTP); + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + goto bail; + } + + } + + /* alright clean up and set ourselves into established state */ + + free(response); + wsi->state = WSI_STATE_ESTABLISHED; + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + wsi->rx_packet_length = 0; + + /* notify user code that we're ready to roll */ + + if (wsi->protocol->callback) + wsi->protocol->callback(wsi->protocol->owning_server, + wsi, LWS_CALLBACK_ESTABLISHED, + wsi->user_space, NULL, 0); + + return 0; + + +bail: + return -1; +} + + +/* + * -04 of the protocol (actually the 80th version) has a radically different + * handshake. The 04 spec gives the following idea + * + * The handshake from the client looks as follows: + * + * GET /chat HTTP/1.1 + * Host: server.example.com + * Upgrade: websocket + * Connection: Upgrade + * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== + * Sec-WebSocket-Origin: http://example.com + * Sec-WebSocket-Protocol: chat, superchat + * Sec-WebSocket-Version: 4 + * + * The handshake from the server looks as follows: + * + * HTTP/1.1 101 Switching Protocols + * Upgrade: websocket + * Connection: Upgrade + * Sec-WebSocket-Accept: me89jWimTRKTWwrS3aRrL53YZSo= + * Sec-WebSocket-Nonce: AQIDBAUGBwgJCgsMDQ4PEC== + * Sec-WebSocket-Protocol: chat + */ + +/* + * We have to take care about parsing because the headers may be split + * into multiple fragments. They may contain unknown headers with arbitrary + * argument lengths. So, we parse using a single-character at a time state + * machine that is completely independent of packet size. + */ + +int +libwebsocket_read(struct libwebsocket_context *context, + struct libwebsocket *wsi, unsigned char * buf, size_t len) +{ + size_t n; + + switch (wsi->state) { + case WSI_STATE_HTTP: + wsi->state = WSI_STATE_HTTP_HEADERS; + wsi->parser_state = WSI_TOKEN_NAME_PART; + /* fallthru */ + case WSI_STATE_HTTP_HEADERS: + + debug("issuing %d bytes to parser\n", (int)len); +#ifdef DEBUG + fwrite(buf, 1, len, stderr); +#endif + + switch (wsi->mode) { + case LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY: + case LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE: + case LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY: + case LWS_CONNMODE_WS_CLIENT_WAITING_EXTENSION_CONNECT: + case LWS_CONNMODE_WS_CLIENT: + for (n = 0; n < len; n++) + libwebsocket_client_rx_sm(wsi, *buf++); + + return 0; + default: + break; + } + + /* LWS_CONNMODE_WS_SERVING */ + + for (n = 0; n < len; n++) + libwebsocket_parse(wsi, *buf++); + + if (wsi->parser_state != WSI_PARSING_COMPLETE) + break; + + debug("seem to be serving, mode is %d\n", wsi->mode); + + debug("libwebsocket_parse sees parsing complete\n"); + + /* is this websocket protocol or normal http 1.0? */ + + if (!wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len || + !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len) { + wsi->state = WSI_STATE_HTTP; + if (wsi->protocol->callback) + (wsi->protocol->callback)(context, wsi, + LWS_CALLBACK_HTTP, wsi->user_space, + wsi->utf8_token[WSI_TOKEN_GET_URI].token, 0); + return 0; + } + + if (!wsi->protocol) + fprintf(stderr, "NULL protocol at libwebsocket_read\n"); + + /* + * It's websocket + * + * Make sure user side is happy about protocol + */ + + while (wsi->protocol->callback) { + + if (wsi->utf8_token[WSI_TOKEN_PROTOCOL].token == NULL) { + if (wsi->protocol->name == NULL) + break; + } else + if (wsi->protocol->name && strcmp( + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token, + wsi->protocol->name) == 0) + break; + + wsi->protocol++; + } + + /* we didn't find a protocol he wanted? */ + + if (wsi->protocol->callback == NULL) { + if (wsi->utf8_token[WSI_TOKEN_PROTOCOL].token == NULL) + fprintf(stderr, "[no protocol] " + "not supported (use NULL .name)\n"); + else + fprintf(stderr, "Requested protocol %s " + "not supported\n", + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token); + goto bail; + } + + /* + * find out which spec version the client is using + * if this header is not given, we default to 00 (aka 76) + */ + + if (wsi->utf8_token[WSI_TOKEN_VERSION].token_len) + wsi->ietf_spec_revision = + atoi(wsi->utf8_token[WSI_TOKEN_VERSION].token); + + /* + * Give the user code a chance to study the request and + * have the opportunity to deny it + */ + + if ((wsi->protocol->callback)(wsi->protocol->owning_server, wsi, + LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION, + &wsi->utf8_token[0], NULL, 0)) { + fprintf(stderr, "User code denied connection\n"); + goto bail; + } + + + /* + * Perform the handshake according to the protocol version the + * client announced + */ + + switch (wsi->ietf_spec_revision) { + case 0: /* applies to 76 and 00 */ + wsi->xor_mask = xor_no_mask; + if (handshake_00(context, wsi)) + goto bail; + break; + case 4: /* 04 */ + wsi->xor_mask = xor_mask_04; + debug("libwebsocket_parse calling handshake_04\n"); + if (handshake_0405(context, wsi)) + goto bail; + break; + case 5: + case 6: + case 7: + case 8: + case 13: + wsi->xor_mask = xor_mask_05; + debug("libwebsocket_parse calling handshake_04\n"); + if (handshake_0405(context, wsi)) + goto bail; + break; + + default: + fprintf(stderr, "Unknown client spec version %d\n", + wsi->ietf_spec_revision); + goto bail; + } + + debug("accepted v%02d connection\n", + wsi->ietf_spec_revision); + + break; + + case WSI_STATE_AWAITING_CLOSE_ACK: + case WSI_STATE_ESTABLISHED: + switch (wsi->mode) { + case LWS_CONNMODE_WS_CLIENT: + for (n = 0; n < len; n++) + if (libwebsocket_client_rx_sm(wsi, *buf++) < 0) + goto bail; + + return 0; + default: + break; + } + + /* LWS_CONNMODE_WS_SERVING */ + + if (libwebsocket_interpret_incoming_packet(wsi, buf, len) < 0) + goto bail; + + break; + default: + break; + } + + return 0; + +bail: + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + + return -1; +} diff --git a/libs/libwebsockets/lib/libwebsockets.c b/libs/libwebsockets/lib/libwebsockets.c new file mode 100644 index 0000000000..03147e16fd --- /dev/null +++ b/libs/libwebsockets/lib/libwebsockets.c @@ -0,0 +1,3183 @@ +/* + * libwebsockets - small server side websockets and web server implementation + * + * Copyright (C) 2010 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include "private-libwebsockets.h" + +#ifdef WIN32 + +#else +#include +#include +#include +#include +#endif + +#ifdef LWS_OPENSSL_SUPPORT +int openssl_websocket_private_data_index; +#endif + +#ifdef __MINGW32__ +#include "../win32port/win32helpers/websock-w32.c" +#else +#ifdef __MINGW64__ +#include "../win32port/win32helpers/websock-w32.c" +#endif +#endif + +/* + * In-place str to lower case + */ + +static void +strtolower(char *s) +{ + while (*s) { + *s = tolower(*s); + s++; + } +} + +/* file descriptor hash management */ + +struct libwebsocket * +wsi_from_fd(struct libwebsocket_context *context, int fd) +{ + int h = LWS_FD_HASH(fd); + int n = 0; + + for (n = 0; n < context->fd_hashtable[h].length; n++) + if (context->fd_hashtable[h].wsi[n]->sock == fd) + return context->fd_hashtable[h].wsi[n]; + + return NULL; +} + +int +insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi) +{ + int h = LWS_FD_HASH(wsi->sock); + + if (context->fd_hashtable[h].length == MAX_CLIENTS - 1) { + fprintf(stderr, "hash table overflow\n"); + return 1; + } + + context->fd_hashtable[h].wsi[context->fd_hashtable[h].length++] = wsi; + + return 0; +} + +int +delete_from_fd(struct libwebsocket_context *context, int fd) +{ + int h = LWS_FD_HASH(fd); + int n = 0; + + for (n = 0; n < context->fd_hashtable[h].length; n++) + if (context->fd_hashtable[h].wsi[n]->sock == fd) { + while (n < context->fd_hashtable[h].length) { + context->fd_hashtable[h].wsi[n] = + context->fd_hashtable[h].wsi[n + 1]; + n++; + } + context->fd_hashtable[h].length--; + + return 0; + } + + fprintf(stderr, "Failed to find fd %d requested for " + "delete in hashtable\n", fd); + return 1; +} + +#ifdef LWS_OPENSSL_SUPPORT +static void +libwebsockets_decode_ssl_error(void) +{ + char buf[256]; + u_long err; + + while ((err = ERR_get_error()) != 0) { + ERR_error_string_n(err, buf, sizeof(buf)); + fprintf(stderr, "*** %s\n", buf); + } +} +#endif + + +static int +interface_to_sa(const char *ifname, struct sockaddr_in *addr, size_t addrlen) +{ + int rc = -1; +#ifdef WIN32 + /* TODO */ +#else + struct ifaddrs *ifr; + struct ifaddrs *ifc; + struct sockaddr_in *sin; + + getifaddrs(&ifr); + for (ifc = ifr; ifc != NULL; ifc = ifc->ifa_next) { + if (strcmp(ifc->ifa_name, ifname)) + continue; + if (ifc->ifa_addr == NULL) + continue; + sin = (struct sockaddr_in *)ifc->ifa_addr; + if (sin->sin_family != AF_INET) + continue; + memcpy(addr, sin, addrlen); + rc = 0; + } + + freeifaddrs(ifr); +#endif + return rc; +} + +void +libwebsocket_close_and_free_session(struct libwebsocket_context *context, + struct libwebsocket *wsi, enum lws_close_status reason) +{ + int n; + int old_state; + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 2 + + LWS_SEND_BUFFER_POST_PADDING]; + int ret; + int m; + struct lws_tokens eff_buf; + struct libwebsocket_extension *ext; + + if (!wsi) + return; + + old_state = wsi->state; + + if (old_state == WSI_STATE_DEAD_SOCKET) + return; + + wsi->close_reason = reason; + + /* + * are his extensions okay with him closing? Eg he might be a mux + * parent and just his ch1 aspect is closing? + */ + + + for (n = 0; n < wsi->count_active_extensions; n++) { + if (!wsi->active_extensions[n]->callback) + continue; + + m = wsi->active_extensions[n]->callback(context, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_CHECK_OK_TO_REALLY_CLOSE, + wsi->active_extensions_user[n], NULL, 0); + + /* + * if somebody vetoed actually closing him at this time.... + * up to the extension to track the attempted close, let's + * just bail + */ + + if (m) { + debug("extension vetoed close\n"); + return; + } + } + + + + /* + * flush any tx pending from extensions, since we may send close packet + * if there are problems with send, just nuke the connection + */ + + ret = 1; + while (ret == 1) { + + /* default to nobody has more to spill */ + + ret = 0; + eff_buf.token = NULL; + eff_buf.token_len = 0; + + /* show every extension the new incoming data */ + + for (n = 0; n < wsi->count_active_extensions; n++) { + m = wsi->active_extensions[n]->callback( + wsi->protocol->owning_server, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_FLUSH_PENDING_TX, + wsi->active_extensions_user[n], &eff_buf, 0); + if (m < 0) { + fprintf(stderr, "Extension reports " + "fatal error\n"); + goto just_kill_connection; + } + if (m) + /* + * at least one extension told us he has more + * to spill, so we will go around again after + */ + ret = 1; + } + + /* assuming they left us something to send, send it */ + + if (eff_buf.token_len) + if (lws_issue_raw(wsi, (unsigned char *)eff_buf.token, + eff_buf.token_len)) + goto just_kill_connection; + } + + /* + * signal we are closing, libsocket_write will + * add any necessary version-specific stuff. If the write fails, + * no worries we are closing anyway. If we didn't initiate this + * close, then our state has been changed to + * WSI_STATE_RETURNED_CLOSE_ALREADY and we will skip this. + * + * Likewise if it's a second call to close this connection after we + * sent the close indication to the peer already, we are in state + * WSI_STATE_AWAITING_CLOSE_ACK and will skip doing this a second time. + */ + + if (old_state == WSI_STATE_ESTABLISHED && + reason != LWS_CLOSE_STATUS_NOSTATUS) { + + debug("sending close indication...\n"); + + n = libwebsocket_write(wsi, &buf[LWS_SEND_BUFFER_PRE_PADDING], + 0, LWS_WRITE_CLOSE); + if (!n) { + /* + * we have sent a nice protocol level indication we + * now wish to close, we should not send anything more + */ + + wsi->state = WSI_STATE_AWAITING_CLOSE_ACK; + + /* and we should wait for a reply for a bit */ + + libwebsocket_set_timeout(wsi, + PENDING_TIMEOUT_CLOSE_ACK, 5); + + debug("sent close indication, awaiting ack\n"); + + return; + } + + /* else, the send failed and we should just hang up */ + } + +just_kill_connection: + + debug("libwebsocket_close_and_free_session: just_kill_connection\n"); + + /* + * we won't be servicing or receiving anything further from this guy + * remove this fd from wsi mapping hashtable + */ + + if (wsi->sock) + delete_from_fd(context, wsi->sock); + + /* delete it from the internal poll list if still present */ + + for (n = 0; n < context->fds_count; n++) { + if (context->fds[n].fd != wsi->sock) + continue; + while (n < context->fds_count - 1) { + context->fds[n] = context->fds[n + 1]; + n++; + } + context->fds_count--; + /* we only have to deal with one */ + n = context->fds_count; + } + + /* remove also from external POLL support via protocol 0 */ + if (wsi->sock) + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_DEL_POLL_FD, (void *)(long)wsi->sock, NULL, 0); + + wsi->state = WSI_STATE_DEAD_SOCKET; + + /* tell the user it's all over for this guy */ + + if (wsi->protocol && wsi->protocol->callback && + ((old_state == WSI_STATE_ESTABLISHED) || + (old_state == WSI_STATE_RETURNED_CLOSE_ALREADY) || + (old_state == WSI_STATE_AWAITING_CLOSE_ACK))) { + debug("calling back CLOSED\n"); + wsi->protocol->callback(context, wsi, LWS_CALLBACK_CLOSED, + wsi->user_space, NULL, 0); + } else + debug("not calling back closed, old_state=%d\n", old_state); + + /* deallocate any active extension contexts */ + + for (n = 0; n < wsi->count_active_extensions; n++) { + if (!wsi->active_extensions[n]->callback) + continue; + + wsi->active_extensions[n]->callback(context, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_DESTROY, + wsi->active_extensions_user[n], NULL, 0); + + free(wsi->active_extensions_user[n]); + } + + /* + * inform all extensions in case they tracked this guy out of band + * even though not active on him specifically + */ + + ext = context->extensions; + while (ext && ext->callback) { + ext->callback(context, ext, wsi, + LWS_EXT_CALLBACK_DESTROY_ANY_WSI_CLOSING, + NULL, NULL, 0); + ext++; + } + + /* free up his parsing allocations */ + + for (n = 0; n < WSI_TOKEN_COUNT; n++) + if (wsi->utf8_token[n].token) + free(wsi->utf8_token[n].token); + + if (wsi->c_address) + free(wsi->c_address); + +/* fprintf(stderr, "closing fd=%d\n", wsi->sock); */ + +#ifdef LWS_OPENSSL_SUPPORT + if (wsi->ssl) { + n = SSL_get_fd(wsi->ssl); + SSL_shutdown(wsi->ssl); +#ifdef WIN32 + closesocket(n); +#else + close(n); +#endif + SSL_free(wsi->ssl); + } else { +#endif + shutdown(wsi->sock, SHUT_RDWR); +#ifdef WIN32 + if (wsi->sock) + closesocket(wsi->sock); +#else + if (wsi->sock) + close(wsi->sock); +#endif +#ifdef LWS_OPENSSL_SUPPORT + } +#endif + if (wsi->protocol && wsi->protocol->per_session_data_size && wsi->user_space) /* user code may own */ + free(wsi->user_space); + + free(wsi); +} + +/** + * libwebsockets_hangup_on_client() - Server calls to terminate client + * connection + * @context: libwebsockets context + * @fd: Connection socket descriptor + */ + +void +libwebsockets_hangup_on_client(struct libwebsocket_context *context, int fd) +{ + struct libwebsocket *wsi = wsi_from_fd(context, fd); + + if (wsi == NULL) + return; + + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); +} + + +/** + * libwebsockets_get_peer_addresses() - Get client address information + * @fd: Connection socket descriptor + * @name: Buffer to take client address name + * @name_len: Length of client address name buffer + * @rip: Buffer to take client address IP qotted quad + * @rip_len: Length of client address IP buffer + * + * This function fills in @name and @rip with the name and IP of + * the client connected with socket descriptor @fd. Names may be + * truncated if there is not enough room. If either cannot be + * determined, they will be returned as valid zero-length strings. + */ + +void +libwebsockets_get_peer_addresses(int fd, char *name, int name_len, + char *rip, int rip_len) +{ + unsigned int len; + struct sockaddr_in sin; + struct hostent *host; + struct hostent *host1; + char ip[128]; + unsigned char *p; + int n; + struct sockaddr_un *un; + + rip[0] = '\0'; + name[0] = '\0'; + + len = sizeof sin; + if (getpeername(fd, (struct sockaddr *) &sin, &len) < 0) { + perror("getpeername"); + return; + } + + host = gethostbyaddr((char *) &sin.sin_addr, sizeof sin.sin_addr, + AF_INET); + if (host == NULL) { + perror("gethostbyaddr"); + return; + } + + strncpy(name, host->h_name, name_len); + name[name_len - 1] = '\0'; + + host1 = gethostbyname(host->h_name); + if (host1 == NULL) + return; + p = (unsigned char *)host1; + n = 0; + while (p != NULL) { + p = (unsigned char *)host1->h_addr_list[n++]; + if (p == NULL) + continue; + if ((host1->h_addrtype != AF_INET) +#ifdef AF_LOCAL + && (host1->h_addrtype != AF_LOCAL) +#endif + ) + continue; + + if (host1->h_addrtype == AF_INET) + sprintf(ip, "%u.%u.%u.%u", p[0], p[1], p[2], p[3]); +#ifdef AF_LOCAL + else { + un = (struct sockaddr_un *)p; + strncpy(ip, un->sun_path, sizeof(ip) - 1); + ip[sizeof(ip) - 1] = '\0'; + } +#endif + p = NULL; + strncpy(rip, ip, rip_len); + rip[rip_len - 1] = '\0'; + } +} + +int libwebsockets_get_random(struct libwebsocket_context *context, + void *buf, int len) +{ + int n; + char *p = buf; + +#ifdef WIN32 + for (n = 0; n < len; n++) + p[n] = (unsigned char)rand(); +#else + n = read(context->fd_random, p, len); +#endif + + return n; +} + +unsigned char * +libwebsockets_SHA1(const unsigned char *d, size_t n, unsigned char *md) +{ + return SHA1(d, n, md); +} + +void libwebsockets_00_spaceout(char *key, int spaces, int seed) +{ + char *p; + + key++; + while (spaces--) { + if (*key && (seed & 1)) + key++; + seed >>= 1; + + p = key + strlen(key); + while (p >= key) { + p[1] = p[0]; + p--; + } + *key++ = ' '; + } +} + +void libwebsockets_00_spam(char *key, int count, int seed) +{ + char *p; + + key++; + while (count--) { + + if (*key && (seed & 1)) + key++; + seed >>= 1; + + p = key + strlen(key); + while (p >= key) { + p[1] = p[0]; + p--; + } + *key++ = 0x21 + ((seed & 0xffff) % 15); + /* 4 would use it up too fast.. not like it matters */ + seed >>= 1; + } +} + +int lws_send_pipe_choked(struct libwebsocket *wsi) +{ + struct pollfd fds; + + fds.fd = wsi->sock; + fds.events = POLLOUT; + fds.revents = 0; + + if (poll(&fds, 1, 0) != 1) + return 1; + + if ((fds.revents & POLLOUT) == 0) + return 1; + + /* okay to send another packet without blocking */ + + return 0; +} + +int +lws_handle_POLLOUT_event(struct libwebsocket_context *context, + struct libwebsocket *wsi, struct pollfd *pollfd) +{ + struct lws_tokens eff_buf; + int n; + int ret; + int m; + int handled = 0; + + for (n = 0; n < wsi->count_active_extensions; n++) { + if (!wsi->active_extensions[n]->callback) + continue; + + m = wsi->active_extensions[n]->callback(context, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_IS_WRITEABLE, + wsi->active_extensions_user[n], NULL, 0); + if (m > handled) + handled = m; + } + + if (handled == 1) + goto notify_action; + + if (!wsi->extension_data_pending || handled == 2) + goto user_service; + + /* + * check in on the active extensions, see if they + * had pending stuff to spill... they need to get the + * first look-in otherwise sequence will be disordered + * + * NULL, zero-length eff_buf means just spill pending + */ + + ret = 1; + while (ret == 1) { + + /* default to nobody has more to spill */ + + ret = 0; + eff_buf.token = NULL; + eff_buf.token_len = 0; + + /* give every extension a chance to spill */ + + for (n = 0; n < wsi->count_active_extensions; n++) { + m = wsi->active_extensions[n]->callback( + wsi->protocol->owning_server, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_PACKET_TX_PRESEND, + wsi->active_extensions_user[n], &eff_buf, 0); + if (m < 0) { + fprintf(stderr, "ext reports fatal error\n"); + return -1; + } + if (m) + /* + * at least one extension told us he has more + * to spill, so we will go around again after + */ + ret = 1; + } + + /* assuming they gave us something to send, send it */ + + if (eff_buf.token_len) { + if (lws_issue_raw(wsi, (unsigned char *)eff_buf.token, + eff_buf.token_len)) + return -1; + } else + continue; + + /* no extension has more to spill */ + + if (!ret) + continue; + + /* + * There's more to spill from an extension, but we just sent + * something... did that leave the pipe choked? + */ + + if (!lws_send_pipe_choked(wsi)) + /* no we could add more */ + continue; + + debug("choked in POLLOUT service\n"); + + /* + * Yes, he's choked. Leave the POLLOUT masked on so we will + * come back here when he is unchoked. Don't call the user + * callback to enforce ordering of spilling, he'll get called + * when we come back here and there's nothing more to spill. + */ + + return 0; + } + + wsi->extension_data_pending = 0; + +user_service: + /* one shot */ + + if (pollfd) { + pollfd->events &= ~POLLOUT; + + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_CLEAR_MODE_POLL_FD, + (void *)(long)wsi->sock, NULL, POLLOUT); + } + +notify_action: + + if (wsi->mode == LWS_CONNMODE_WS_CLIENT) + n = LWS_CALLBACK_CLIENT_WRITEABLE; + else + n = LWS_CALLBACK_SERVER_WRITEABLE; + + wsi->protocol->callback(context, wsi, n, wsi->user_space, NULL, 0); + + return 0; +} + + + +void +libwebsocket_service_timeout_check(struct libwebsocket_context *context, + struct libwebsocket *wsi, unsigned int sec) +{ + int n; + + /* + * if extensions want in on it (eg, we are a mux parent) + * give them a chance to service child timeouts + */ + + for (n = 0; n < wsi->count_active_extensions; n++) + wsi->active_extensions[n]->callback( + context, wsi->active_extensions[n], + wsi, LWS_EXT_CALLBACK_1HZ, + wsi->active_extensions_user[n], NULL, sec); + + if (!wsi->pending_timeout) + return; + + /* + * if we went beyond the allowed time, kill the + * connection + */ + + if (sec > wsi->pending_timeout_limit) { + debug("TIMEDOUT WAITING\n"); + libwebsocket_close_and_free_session(context, + wsi, LWS_CLOSE_STATUS_NOSTATUS); + } +} + +struct libwebsocket * +libwebsocket_create_new_server_wsi(struct libwebsocket_context *context) +{ + struct libwebsocket *new_wsi; + int n; + + new_wsi = malloc(sizeof(struct libwebsocket)); + if (new_wsi == NULL) { + fprintf(stderr, "Out of memory for new connection\n"); + return NULL; + } + + memset(new_wsi, 0, sizeof(struct libwebsocket)); + new_wsi->count_active_extensions = 0; + new_wsi->pending_timeout = NO_PENDING_TIMEOUT; + + /* intialize the instance struct */ + + new_wsi->state = WSI_STATE_HTTP; + new_wsi->name_buffer_pos = 0; + new_wsi->mode = LWS_CONNMODE_WS_SERVING; + + for (n = 0; n < WSI_TOKEN_COUNT; n++) { + new_wsi->utf8_token[n].token = NULL; + new_wsi->utf8_token[n].token_len = 0; + } + + /* + * these can only be set once the protocol is known + * we set an unestablished connection's protocol pointer + * to the start of the supported list, so it can look + * for matching ones during the handshake + */ + new_wsi->protocol = context->protocols; + new_wsi->user_space = NULL; + + /* + * Default protocol is 76 / 00 + * After 76, there's a header specified to inform which + * draft the client wants, when that's seen we modify + * the individual connection's spec revision accordingly + */ + new_wsi->ietf_spec_revision = 0; + + return new_wsi; +} + +char * +libwebsockets_generate_client_handshake(struct libwebsocket_context *context, + struct libwebsocket *wsi, char *pkt) +{ + char hash[20]; + char *p = pkt; + int n; + struct libwebsocket_extension *ext; + struct libwebsocket_extension *ext1; + int ext_count = 0; + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 1 + + MAX_BROADCAST_PAYLOAD + LWS_SEND_BUFFER_POST_PADDING]; + static const char magic_websocket_guid[] = + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + + /* + * create the random key + */ + + n = libwebsockets_get_random(context, hash, 16); + if (n != 16) { + fprintf(stderr, "Unable to read from random dev %s\n", + SYSTEM_RANDOM_FILEPATH); + free(wsi->c_path); + free(wsi->c_host); + if (wsi->c_origin) + free(wsi->c_origin); + if (wsi->c_protocol) + free(wsi->c_protocol); + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + return NULL; + } + + lws_b64_encode_string(hash, 16, wsi->key_b64, + sizeof wsi->key_b64); + + /* + * 00 example client handshake + * + * GET /socket.io/websocket HTTP/1.1 + * Upgrade: WebSocket + * Connection: Upgrade + * Host: 127.0.0.1:9999 + * Origin: http://127.0.0.1 + * Sec-WebSocket-Key1: 1 0 2#0W 9 89 7 92 ^ + * Sec-WebSocket-Key2: 7 7Y 4328 B2v[8(z1 + * Cookie: socketio=websocket + * + * (îÄ0¶†≥ + * + * 04 example client handshake + * + * GET /chat HTTP/1.1 + * Host: server.example.com + * Upgrade: websocket + * Connection: Upgrade + * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== + * Sec-WebSocket-Origin: http://example.com + * Sec-WebSocket-Protocol: chat, superchat + * Sec-WebSocket-Version: 4 + */ + + p += sprintf(p, "GET %s HTTP/1.1\x0d\x0a", wsi->c_path); + + if (wsi->ietf_spec_revision == 0) { + unsigned char spaces_1, spaces_2; + unsigned int max_1, max_2; + unsigned int num_1, num_2; + unsigned long product_1, product_2; + char key_1[40]; + char key_2[40]; + unsigned int seed; + unsigned int count; + char challenge[16]; + + libwebsockets_get_random(context, &spaces_1, sizeof(char)); + libwebsockets_get_random(context, &spaces_2, sizeof(char)); + + spaces_1 = (spaces_1 % 12) + 1; + spaces_2 = (spaces_2 % 12) + 1; + + max_1 = 4294967295 / spaces_1; + max_2 = 4294967295 / spaces_2; + + libwebsockets_get_random(context, &num_1, sizeof(int)); + libwebsockets_get_random(context, &num_2, sizeof(int)); + + num_1 = (num_1 % max_1); + num_2 = (num_2 % max_2); + + challenge[0] = num_1 >> 24; + challenge[1] = num_1 >> 16; + challenge[2] = num_1 >> 8; + challenge[3] = num_1; + challenge[4] = num_2 >> 24; + challenge[5] = num_2 >> 16; + challenge[6] = num_2 >> 8; + challenge[7] = num_2; + + product_1 = num_1 * spaces_1; + product_2 = num_2 * spaces_2; + + sprintf(key_1, "%lu", product_1); + sprintf(key_2, "%lu", product_2); + + libwebsockets_get_random(context, &seed, sizeof(int)); + libwebsockets_get_random(context, &count, sizeof(int)); + + libwebsockets_00_spam(key_1, (count % 12) + 1, seed); + + libwebsockets_get_random(context, &seed, sizeof(int)); + libwebsockets_get_random(context, &count, sizeof(int)); + + libwebsockets_00_spam(key_2, (count % 12) + 1, seed); + + libwebsockets_get_random(context, &seed, sizeof(int)); + + libwebsockets_00_spaceout(key_1, spaces_1, seed); + libwebsockets_00_spaceout(key_2, spaces_2, seed >> 16); + + p += sprintf(p, "Upgrade: WebSocket\x0d\x0a" + "Connection: Upgrade\x0d\x0aHost: %s\x0d\x0a", + wsi->c_host); + if (wsi->c_origin) + p += sprintf(p, "Origin: %s\x0d\x0a", wsi->c_origin); + + if (wsi->c_protocol) + p += sprintf(p, "Sec-WebSocket-Protocol: %s" + "\x0d\x0a", wsi->c_protocol); + + p += sprintf(p, "Sec-WebSocket-Key1: %s\x0d\x0a", key_1); + p += sprintf(p, "Sec-WebSocket-Key2: %s\x0d\x0a", key_2); + + /* give userland a chance to append, eg, cookies */ + + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER, + NULL, &p, (pkt + sizeof(pkt)) - p - 12); + + p += sprintf(p, "\x0d\x0a"); + + if (libwebsockets_get_random(context, p, 8) != 8) + return NULL; + memcpy(&challenge[8], p, 8); + p += 8; + + /* precompute what we want to see from the server */ + + MD5((unsigned char *)challenge, 16, + (unsigned char *)wsi->initial_handshake_hash_base64); + + goto issue_hdr; + } + + p += sprintf(p, "Host: %s\x0d\x0a", wsi->c_host); + p += sprintf(p, "Upgrade: websocket\x0d\x0a"); + p += sprintf(p, "Connection: Upgrade\x0d\x0a" + "Sec-WebSocket-Key: "); + strcpy(p, wsi->key_b64); + p += strlen(wsi->key_b64); + p += sprintf(p, "\x0d\x0a"); + if (wsi->c_origin) + p += sprintf(p, "Sec-WebSocket-Origin: %s\x0d\x0a", + wsi->c_origin); + if (wsi->c_protocol) + p += sprintf(p, "Sec-WebSocket-Protocol: %s\x0d\x0a", + wsi->c_protocol); + + /* tell the server what extensions we could support */ + + p += sprintf(p, "Sec-WebSocket-Extensions: "); + + ext = context->extensions; + while (ext && ext->callback) { + + n = 0; + ext1 = context->extensions; + + while (ext1 && ext1->callback) { + n |= ext1->callback(context, ext1, wsi, + LWS_EXT_CALLBACK_CHECK_OK_TO_PROPOSE_EXTENSION, + NULL, (char *)ext->name, 0); + + ext1++; + } + + if (n) { /* an extension vetos us */ + debug("ext %s vetoed\n", (char *)ext->name); + ext++; + continue; + } + + n = context->protocols[0].callback(context, wsi, + LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED, + wsi->user_space, (char *)ext->name, 0); + + /* + * zero return from callback means + * go ahead and allow the extension, + * it's what we get if the callback is + * unhandled + */ + + if (n) { + ext++; + continue; + } + + /* apply it */ + + if (ext_count) + *p++ = ','; + p += sprintf(p, "%s", ext->name); + ext_count++; + + ext++; + } + + p += sprintf(p, "\x0d\x0a"); + + if (wsi->ietf_spec_revision) + p += sprintf(p, "Sec-WebSocket-Version: %d\x0d\x0a", + wsi->ietf_spec_revision); + + /* give userland a chance to append, eg, cookies */ + + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER, + NULL, &p, (pkt + sizeof(pkt)) - p - 12); + + p += sprintf(p, "\x0d\x0a"); + + /* prepare the expected server accept response */ + + strcpy((char *)buf, wsi->key_b64); + strcpy((char *)&buf[strlen((char *)buf)], magic_websocket_guid); + + SHA1(buf, strlen((char *)buf), (unsigned char *)hash); + + lws_b64_encode_string(hash, 20, + wsi->initial_handshake_hash_base64, + sizeof wsi->initial_handshake_hash_base64); + +issue_hdr: + +#if 0 + puts(pkt); +#endif + + /* done with these now */ + + free(wsi->c_path); + free(wsi->c_host); + if (wsi->c_origin) + free(wsi->c_origin); + + return p; +} + +int +lws_client_interpret_server_handshake(struct libwebsocket_context *context, + struct libwebsocket *wsi) +{ + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 1 + + MAX_BROADCAST_PAYLOAD + LWS_SEND_BUFFER_POST_PADDING]; + char pkt[1024]; + char *p = &pkt[0]; + const char *pc; + const char *c; + int more = 1; + int okay = 0; + char ext_name[128]; + struct libwebsocket_extension *ext; + void *v; + int len = 0; + int n; + static const char magic_websocket_04_masking_guid[] = + "61AC5F19-FBBA-4540-B96F-6561F1AB40A8"; + + /* + * 00 / 76 --> + * + * HTTP/1.1 101 WebSocket Protocol Handshake + * Upgrade: WebSocket + * Connection: Upgrade + * Sec-WebSocket-Origin: http://127.0.0.1 + * Sec-WebSocket-Location: ws://127.0.0.1:9999/socket.io/websocket + * + * xxxxxxxxxxxxxxxx + */ + + if (wsi->ietf_spec_revision == 0) { + if (!wsi->utf8_token[WSI_TOKEN_HTTP].token_len || + !wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len || + !wsi->utf8_token[WSI_TOKEN_CHALLENGE].token_len || + !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len || + (!wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len && + wsi->c_protocol != NULL)) { + debug("libwebsocket_client_handshake " + "missing required header(s)\n"); + pkt[len] = '\0'; + debug("%s", pkt); + goto bail3; + } + + strtolower(wsi->utf8_token[WSI_TOKEN_HTTP].token); + if (strncmp(wsi->utf8_token[WSI_TOKEN_HTTP].token, "101", 3)) { + fprintf(stderr, "libwebsocket_client_handshake " + "server sent bad HTTP response '%s'\n", + wsi->utf8_token[WSI_TOKEN_HTTP].token); + goto bail3; + } + + if (wsi->utf8_token[WSI_TOKEN_CHALLENGE].token_len < 16) { + fprintf(stderr, "libwebsocket_client_handshake " + "challenge reply too short %d\n", + wsi->utf8_token[ + WSI_TOKEN_CHALLENGE].token_len); + pkt[len] = '\0'; + debug("%s", pkt); + goto bail3; + + } + + goto select_protocol; + } + + /* + * well, what the server sent looked reasonable for syntax. + * Now let's confirm it sent all the necessary headers + */ +#if 0 + fprintf(stderr, "WSI_TOKEN_HTTP: %d\n", + wsi->utf8_token[WSI_TOKEN_HTTP].token_len); + fprintf(stderr, "WSI_TOKEN_UPGRADE: %d\n", + wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len); + fprintf(stderr, "WSI_TOKEN_CONNECTION: %d\n", + wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len); + fprintf(stderr, "WSI_TOKEN_ACCEPT: %d\n", + wsi->utf8_token[WSI_TOKEN_ACCEPT].token_len); + fprintf(stderr, "WSI_TOKEN_NONCE: %d\n", + wsi->utf8_token[WSI_TOKEN_NONCE].token_len); + fprintf(stderr, "WSI_TOKEN_PROTOCOL: %d\n", + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len); +#endif + if (!wsi->utf8_token[WSI_TOKEN_HTTP].token_len || + !wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len || + !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len || + !wsi->utf8_token[WSI_TOKEN_ACCEPT].token_len || + (!wsi->utf8_token[WSI_TOKEN_NONCE].token_len && + wsi->ietf_spec_revision == 4) || + (!wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len && + wsi->c_protocol != NULL)) { + debug("libwebsocket_client_handshake " + "missing required header(s)\n"); + pkt[len] = '\0'; + debug("%s", pkt); + goto bail3; + } + + /* + * Everything seems to be there, now take a closer look at what + * is in each header + */ + + strtolower(wsi->utf8_token[WSI_TOKEN_HTTP].token); + if (strncmp(wsi->utf8_token[WSI_TOKEN_HTTP].token, "101", 3)) { + fprintf(stderr, "libwebsocket_client_handshake " + "server sent bad HTTP response '%s'\n", + wsi->utf8_token[WSI_TOKEN_HTTP].token); + goto bail3; + } + + strtolower(wsi->utf8_token[WSI_TOKEN_UPGRADE].token); + if (strcmp(wsi->utf8_token[WSI_TOKEN_UPGRADE].token, + "websocket")) { + fprintf(stderr, "libwebsocket_client_handshake server " + "sent bad Upgrade header '%s'\n", + wsi->utf8_token[WSI_TOKEN_UPGRADE].token); + goto bail3; + } + + strtolower(wsi->utf8_token[WSI_TOKEN_CONNECTION].token); + if (strcmp(wsi->utf8_token[WSI_TOKEN_CONNECTION].token, + "upgrade")) { + fprintf(stderr, "libwebsocket_client_handshake server " + "sent bad Connection hdr '%s'\n", + wsi->utf8_token[WSI_TOKEN_CONNECTION].token); + goto bail3; + } + +select_protocol: + pc = wsi->c_protocol; + if (pc == NULL) + fprintf(stderr, "lws_client_interpret_server_handshake: " + "NULL c_protocol\n"); + else + debug("lws_client_interpret_server_handshake: " + "cPprotocol='%s'\n", pc); + + /* + * confirm the protocol the server wants to talk was in the list + * of protocols we offered + */ + + if (!wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len) { + + fprintf(stderr, "lws_client_interpret_server_handshake " + "WSI_TOKEN_PROTOCOL is null\n"); + /* + * no protocol name to work from, + * default to first protocol + */ + wsi->protocol = &context->protocols[0]; + wsi->c_callback = wsi->protocol->callback; + free(wsi->c_protocol); + + goto check_accept; + } + + while (*pc && !okay) { + if ((!strncmp(pc, wsi->utf8_token[WSI_TOKEN_PROTOCOL].token, + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len)) && + (pc[wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len] == ',' || + pc[wsi->utf8_token[WSI_TOKEN_PROTOCOL].token_len] == '\0')) { + okay = 1; + continue; + } + while (*pc && *pc != ',') + pc++; + while (*pc && *pc != ' ') + pc++; + } + + /* done with him now */ + + if (wsi->c_protocol) + free(wsi->c_protocol); + + if (!okay) { + fprintf(stderr, "libwebsocket_client_handshake server " + "sent bad protocol '%s'\n", + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token); + goto bail2; + } + + /* + * identify the selected protocol struct and set it + */ + n = 0; + wsi->protocol = NULL; + while (context->protocols[n].callback && !wsi->protocol) { /* Stop after finding first one?? */ + if (strcmp(wsi->utf8_token[WSI_TOKEN_PROTOCOL].token, + context->protocols[n].name) == 0) { + wsi->protocol = &context->protocols[n]; + wsi->c_callback = wsi->protocol->callback; + } + n++; + } + + if (wsi->protocol == NULL) { + fprintf(stderr, "libwebsocket_client_handshake server " + "requested protocol '%s', which we " + "said we supported but we don't!\n", + wsi->utf8_token[WSI_TOKEN_PROTOCOL].token); + goto bail2; + } + + + /* instantiate the accepted extensions */ + + if (!wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token_len) { + debug("no client extenstions allowed by server\n"); + goto check_accept; + } + + /* + * break down the list of server accepted extensions + * and go through matching them or identifying bogons + */ + + c = wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token; + n = 0; + while (more) { + + if (*c && (*c != ',' && *c != ' ' && *c != '\t')) { + ext_name[n] = *c++; + if (n < sizeof(ext_name) - 1) + n++; + continue; + } + ext_name[n] = '\0'; + if (!*c) + more = 0; + else { + c++; + if (!n) + continue; + } + + /* check we actually support it */ + + debug("checking client ext %s\n", ext_name); + + n = 0; + ext = wsi->protocol->owning_server->extensions; + while (ext && ext->callback) { + + if (strcmp(ext_name, ext->name)) { + ext++; + continue; + } + + n = 1; + + debug("instantiating client ext %s\n", ext_name); + + /* instantiate the extension on this conn */ + + wsi->active_extensions_user[ + wsi->count_active_extensions] = + malloc(ext->per_session_data_size); + memset(wsi->active_extensions_user[ + wsi->count_active_extensions], 0, + ext->per_session_data_size); + wsi->active_extensions[ + wsi->count_active_extensions] = ext; + + /* allow him to construct his context */ + + ext->callback(wsi->protocol->owning_server, + ext, wsi, + LWS_EXT_CALLBACK_CLIENT_CONSTRUCT, + wsi->active_extensions_user[ + wsi->count_active_extensions], + NULL, 0); + + wsi->count_active_extensions++; + + ext++; + } + + if (n == 0) { + fprintf(stderr, "Server said we should use" + "an unknown extension '%s'!\n", ext_name); + goto bail2; + } + + n = 0; + } + + +check_accept: + + if (wsi->ietf_spec_revision == 0) { + + if (memcmp(wsi->initial_handshake_hash_base64, + wsi->utf8_token[WSI_TOKEN_CHALLENGE].token, 16)) { + fprintf(stderr, "libwebsocket_client_handshake " + "failed 00 challenge compare\n"); + pkt[len] = '\0'; + fprintf(stderr, "%s", pkt); + goto bail2; + } + + goto accept_ok; + } + + /* + * Confirm his accept token is the one we precomputed + */ + + if (strcmp(wsi->utf8_token[WSI_TOKEN_ACCEPT].token, + wsi->initial_handshake_hash_base64)) { + fprintf(stderr, "libwebsocket_client_handshake server " + "sent bad ACCEPT '%s' vs computed '%s'\n", + wsi->utf8_token[WSI_TOKEN_ACCEPT].token, + wsi->initial_handshake_hash_base64); + goto bail2; + } + + if (wsi->ietf_spec_revision == 4) { + /* + * Calculate the 04 masking key to use when + * sending data to server + */ + + strcpy((char *)buf, wsi->key_b64); + p = (char *)buf + strlen(wsi->key_b64); + strcpy(p, wsi->utf8_token[WSI_TOKEN_NONCE].token); + p += wsi->utf8_token[WSI_TOKEN_NONCE].token_len; + strcpy(p, magic_websocket_04_masking_guid); + SHA1(buf, strlen((char *)buf), wsi->masking_key_04); + } +accept_ok: + + /* allocate the per-connection user memory (if any) */ + if (wsi->protocol->per_session_data_size && + !libwebsocket_ensure_user_space(wsi)) + goto bail2; + + /* clear his proxy connection timeout */ + + libwebsocket_set_timeout(wsi, NO_PENDING_TIMEOUT, 0); + + /* mark him as being alive */ + + wsi->state = WSI_STATE_ESTABLISHED; + wsi->mode = LWS_CONNMODE_WS_CLIENT; + + debug("handshake OK for protocol %s\n", wsi->protocol->name); + + /* call him back to inform him he is up */ + + wsi->protocol->callback(context, wsi, + LWS_CALLBACK_CLIENT_ESTABLISHED, + wsi->user_space, NULL, 0); + + /* + * inform all extensions, not just active ones since they + * already know + */ + + ext = context->extensions; + + while (ext && ext->callback) { + v = NULL; + for (n = 0; n < wsi->count_active_extensions; n++) + if (wsi->active_extensions[n] == ext) + v = wsi->active_extensions_user[n]; + + ext->callback(context, ext, wsi, + LWS_EXT_CALLBACK_ANY_WSI_ESTABLISHED, v, NULL, 0); + ext++; + } + + return 0; + +bail3: + if (wsi->c_protocol) + free(wsi->c_protocol); + +bail2: + if (wsi->c_callback) wsi->c_callback(context, wsi, + LWS_CALLBACK_CLIENT_CONNECTION_ERROR, + wsi->user_space, + NULL, 0); + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); // But this should be LWS_CLOSE_STATUS_PROTOCOL_ERR + + return 1; +} + + + +/** + * libwebsocket_service_fd() - Service polled socket with something waiting + * @context: Websocket context + * @pollfd: The pollfd entry describing the socket fd and which events + * happened. + * + * This function closes any active connections and then frees the + * context. After calling this, any further use of the context is + * undefined. + */ + +int +libwebsocket_service_fd(struct libwebsocket_context *context, + struct pollfd *pollfd) +{ + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 1 + + MAX_BROADCAST_PAYLOAD + LWS_SEND_BUFFER_POST_PADDING]; + struct libwebsocket *wsi; + struct libwebsocket *new_wsi; + int n; + int m; + ssize_t len; + int accept_fd; + unsigned int clilen; + struct sockaddr_in cli_addr; + struct timeval tv; + char pkt[1024]; + char *p = &pkt[0]; + int more = 1; + struct lws_tokens eff_buf; + int opt = 1; + char c; + +#ifdef LWS_OPENSSL_SUPPORT + char ssl_err_buf[512]; +#endif + /* + * you can call us with pollfd = NULL to just allow the once-per-second + * global timeout checks; if less than a second since the last check + * it returns immediately then. + */ + + gettimeofday(&tv, NULL); + + if (context->last_timeout_check_s != tv.tv_sec) { + context->last_timeout_check_s = tv.tv_sec; + + /* global timeout check once per second */ + + for (n = 0; n < context->fds_count; n++) { + wsi = wsi_from_fd(context, context->fds[n].fd); + + libwebsocket_service_timeout_check(context, wsi, + tv.tv_sec); + } + } + + /* just here for timeout management? */ + + if (pollfd == NULL) + return 0; + + /* no, here to service a socket descriptor */ + + wsi = wsi_from_fd(context, pollfd->fd); + + if (wsi == NULL) + return 1; + + switch (wsi->mode) { + case LWS_CONNMODE_SERVER_LISTENER: + + /* pollin means a client has connected to us then */ + + if (!pollfd->revents & POLLIN) + break; + + if (context->fds_count >= MAX_CLIENTS) { + fprintf(stderr, "too busy to accept new client\n"); + break; + } + + /* listen socket got an unencrypted connection... */ + + clilen = sizeof(cli_addr); + accept_fd = accept(pollfd->fd, (struct sockaddr *)&cli_addr, + &clilen); + if (accept_fd < 0) { + debug("ERROR on accept\n"); + return -1; + } + + /* Disable Nagle */ + opt = 1; + setsockopt(accept_fd, IPPROTO_TCP, TCP_NODELAY, + (const void *)&opt, sizeof(opt)); + + /* + * look at who we connected to and give user code a chance + * to reject based on client IP. There's no protocol selected + * yet so we issue this to protocols[0] + */ + + if ((context->protocols[0].callback)(context, wsi, + LWS_CALLBACK_FILTER_NETWORK_CONNECTION, + (void *)(long)accept_fd, NULL, 0)) { + debug("Callback denied network connection\n"); +#ifdef WIN32 + closesocket(accept_fd); +#else + close(accept_fd); +#endif + break; + } + + /* accepting connection to main listener */ + + new_wsi = libwebsocket_create_new_server_wsi(context); + if (new_wsi == NULL) + break; + + new_wsi->sock = accept_fd; + + +#ifdef LWS_OPENSSL_SUPPORT + new_wsi->ssl = NULL; + + if (context->use_ssl) { + + new_wsi->ssl = SSL_new(context->ssl_ctx); + if (new_wsi->ssl == NULL) { + fprintf(stderr, "SSL_new failed: %s\n", + ERR_error_string(SSL_get_error( + new_wsi->ssl, 0), NULL)); + libwebsockets_decode_ssl_error(); + free(new_wsi); + break; + } + + SSL_set_fd(new_wsi->ssl, accept_fd); + + n = SSL_accept(new_wsi->ssl); + if (n != 1) { + /* + * browsers seem to probe with various + * ssl params which fail then retry + * and succeed + */ + debug("SSL_accept failed skt %u: %s\n", + pollfd->fd, + ERR_error_string(SSL_get_error( + new_wsi->ssl, n), NULL)); + SSL_free( + new_wsi->ssl); + free(new_wsi); + break; + } + + debug("accepted new SSL conn " + "port %u on fd=%d SSL ver %s\n", + ntohs(cli_addr.sin_port), accept_fd, + SSL_get_version(new_wsi->ssl)); + + } else +#endif + debug("accepted new conn port %u on fd=%d\n", + ntohs(cli_addr.sin_port), accept_fd); + + insert_wsi(context, new_wsi); + + /* + * make sure NO events are seen yet on this new socket + * (otherwise we inherit old fds[client].revents from + * previous socket there and die mysteriously! ) + */ + context->fds[context->fds_count].revents = 0; + + context->fds[context->fds_count].events = POLLIN; + context->fds[context->fds_count++].fd = accept_fd; + + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, new_wsi, + LWS_CALLBACK_ADD_POLL_FD, + (void *)(long)accept_fd, NULL, POLLIN); + + break; + + case LWS_CONNMODE_BROADCAST_PROXY_LISTENER: + + /* as we are listening, POLLIN means accept() is needed */ + + if (!pollfd->revents & POLLIN) + break; + + /* listen socket got an unencrypted connection... */ + + clilen = sizeof(cli_addr); + accept_fd = accept(pollfd->fd, (struct sockaddr *)&cli_addr, + &clilen); + if (accept_fd < 0) { + debug("ERROR on accept\n"); + return -1; + } + + if (context->fds_count >= MAX_CLIENTS) { + fprintf(stderr, "too busy to accept new broadcast " + "proxy client\n"); +#ifdef WIN32 + closesocket(accept_fd); +#else + close(accept_fd); +#endif + break; + } + + /* create a dummy wsi for the connection and add it */ + + new_wsi = malloc(sizeof(struct libwebsocket)); + memset(new_wsi, 0, sizeof(struct libwebsocket)); + new_wsi->sock = accept_fd; + new_wsi->mode = LWS_CONNMODE_BROADCAST_PROXY; + new_wsi->state = WSI_STATE_ESTABLISHED; + new_wsi->count_active_extensions = 0; + /* note which protocol we are proxying */ + new_wsi->protocol_index_for_broadcast_proxy = + wsi->protocol_index_for_broadcast_proxy; + insert_wsi(context, new_wsi); + + /* add connected socket to internal poll array */ + + context->fds[context->fds_count].revents = 0; + context->fds[context->fds_count].events = POLLIN; + context->fds[context->fds_count++].fd = accept_fd; + + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, new_wsi, + LWS_CALLBACK_ADD_POLL_FD, + (void *)(long)accept_fd, NULL, POLLIN); + + break; + + case LWS_CONNMODE_BROADCAST_PROXY: + + /* handle session socket closed */ + + if (pollfd->revents & (POLLERR | POLLHUP)) { + + debug("Session Socket %p (fd=%d) dead\n", + (void *)wsi, pollfd->fd); + + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NORMAL); + return 1; + } + + /* + * either extension code with stuff to spill, or the user code, + * requested a callback when it was OK to write + */ + + if (pollfd->revents & POLLOUT) + if (lws_handle_POLLOUT_event(context, wsi, + pollfd) < 0) { + libwebsocket_close_and_free_session( + context, wsi, LWS_CLOSE_STATUS_NORMAL); + return 1; + } + + /* any incoming data ready? */ + + if (!(pollfd->revents & POLLIN)) + break; + + /* get the issued broadcast payload from the socket */ + + len = read(pollfd->fd, buf + LWS_SEND_BUFFER_PRE_PADDING, + MAX_BROADCAST_PAYLOAD); + if (len < 0) { + fprintf(stderr, "Error reading broadcast payload\n"); + break; + } + + /* broadcast it to all guys with this protocol index */ + + for (n = 0; n < FD_HASHTABLE_MODULUS; n++) { + + for (m = 0; m < context->fd_hashtable[n].length; m++) { + + new_wsi = context->fd_hashtable[n].wsi[m]; + + /* only to clients we are serving to */ + + if (new_wsi->mode != LWS_CONNMODE_WS_SERVING) + continue; + + /* + * never broadcast to non-established + * connection + */ + + if (new_wsi->state != WSI_STATE_ESTABLISHED) + continue; + + /* + * only broadcast to connections using + * the requested protocol + */ + + if (new_wsi->protocol->protocol_index != + wsi->protocol_index_for_broadcast_proxy) + continue; + + /* broadcast it to this connection */ + + new_wsi->protocol->callback(context, new_wsi, + LWS_CALLBACK_BROADCAST, + new_wsi->user_space, + buf + LWS_SEND_BUFFER_PRE_PADDING, len); + } + } + break; + + case LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY: + + /* handle proxy hung up on us */ + + if (pollfd->revents & (POLLERR | POLLHUP)) { + + fprintf(stderr, "Proxy connection %p (fd=%d) dead\n", + (void *)wsi, pollfd->fd); + + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + return 1; + } + + n = recv(wsi->sock, pkt, sizeof pkt, 0); + if (n < 0) { + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + fprintf(stderr, "ERROR reading from proxy socket\n"); + return 1; + } + + pkt[13] = '\0'; + if (strcmp(pkt, "HTTP/1.0 200 ") != 0) { + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + fprintf(stderr, "ERROR from proxy: %s\n", pkt); + return 1; + } + + /* clear his proxy connection timeout */ + + libwebsocket_set_timeout(wsi, NO_PENDING_TIMEOUT, 0); + + /* fallthru */ + + case LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE: + + #ifdef LWS_OPENSSL_SUPPORT + if (wsi->use_ssl && !wsi->ssl) { + + wsi->ssl = SSL_new(context->ssl_client_ctx); + wsi->client_bio = BIO_new_socket(wsi->sock, + BIO_NOCLOSE); + SSL_set_bio(wsi->ssl, wsi->client_bio, wsi->client_bio); + + SSL_set_ex_data(wsi->ssl, + openssl_websocket_private_data_index, + context); + } + + if (wsi->use_ssl) { + if (SSL_connect(wsi->ssl) <= 0) { + + /* + * retry if new data comes until we + * run into the connection timeout or win + */ + + fprintf(stderr, "SSL connect error %s\n", + ERR_error_string(ERR_get_error(), + ssl_err_buf)); + return 0; + } + + n = SSL_get_verify_result(wsi->ssl); + if ((n != X509_V_OK) && ( + n != X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT || + wsi->use_ssl != 2)) { + + fprintf(stderr, "server's cert didn't " + "look good %d\n", n); + libwebsocket_close_and_free_session(context, + wsi, LWS_CLOSE_STATUS_NOSTATUS); + return 1; + } + } else + wsi->ssl = NULL; + #endif + + p = libwebsockets_generate_client_handshake(context, wsi, p); + if (p == NULL) + return 1; + + /* send our request to the server */ + + #ifdef LWS_OPENSSL_SUPPORT + if (wsi->use_ssl) + n = SSL_write(wsi->ssl, pkt, p - pkt); + else + #endif + n = send(wsi->sock, pkt, p - pkt, 0); + + if (n < 0) { + fprintf(stderr, "ERROR writing to client socket\n"); + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + return 1; + } + + wsi->parser_state = WSI_TOKEN_NAME_PART; + wsi->mode = LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY; + libwebsocket_set_timeout(wsi, + PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE, 5); + + break; + + case LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY: + + /* handle server hung up on us */ + + if (pollfd->revents & (POLLERR | POLLHUP)) { + + fprintf(stderr, "Server connection %p (fd=%d) dead\n", + (void *)wsi, pollfd->fd); + + goto bail3; + } + + + /* interpret the server response */ + + /* + * HTTP/1.1 101 Switching Protocols + * Upgrade: websocket + * Connection: Upgrade + * Sec-WebSocket-Accept: me89jWimTRKTWwrS3aRrL53YZSo= + * Sec-WebSocket-Nonce: AQIDBAUGBwgJCgsMDQ4PEC== + * Sec-WebSocket-Protocol: chat + */ + + /* + * we have to take some care here to only take from the + * socket bytewise. The browser may (and has been seen to + * in the case that onopen() performs websocket traffic) + * coalesce both handshake response and websocket traffic + * in one packet, since at that point the connection is + * definitively ready from browser pov. + */ + + len = 1; + while (wsi->parser_state != WSI_PARSING_COMPLETE && len > 0) { +#ifdef LWS_OPENSSL_SUPPORT + if (wsi->use_ssl) + len = SSL_read(wsi->ssl, &c, 1); + else +#endif + len = recv(wsi->sock, &c, 1, 0); + + libwebsocket_parse(wsi, c); + } + + /* + * hs may also be coming in multiple packets, there is a 5-sec + * libwebsocket timeout still active here too, so if parsing did + * not complete just wait for next packet coming in this state + */ + + if (wsi->parser_state != WSI_PARSING_COMPLETE) + break; + + /* + * otherwise deal with the handshake. If there's any + * packet traffic already arrived we'll trigger poll() again + * right away and deal with it that way + */ + + return lws_client_interpret_server_handshake(context, wsi); + +bail3: + if (wsi->c_protocol) + free(wsi->c_protocol); + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + return 1; + + case LWS_CONNMODE_WS_CLIENT_WAITING_EXTENSION_CONNECT: + fprintf(stderr, + "LWS_CONNMODE_WS_CLIENT_WAITING_EXTENSION_CONNECT\n"); + break; + + case LWS_CONNMODE_WS_CLIENT_PENDING_CANDIDATE_CHILD: + fprintf(stderr, + "LWS_CONNMODE_WS_CLIENT_PENDING_CANDIDATE_CHILD\n"); + break; + + + case LWS_CONNMODE_WS_SERVING: + case LWS_CONNMODE_WS_CLIENT: + + /* handle session socket closed */ + + if (pollfd->revents & (POLLERR | POLLHUP)) { + + fprintf(stderr, "Session Socket %p (fd=%d) dead\n", + (void *)wsi, pollfd->fd); + + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + return 1; + } + + /* the guy requested a callback when it was OK to write */ + + if ((pollfd->revents & POLLOUT) && + wsi->state == WSI_STATE_ESTABLISHED) + if (lws_handle_POLLOUT_event(context, wsi, + pollfd) < 0) { + libwebsocket_close_and_free_session( + context, wsi, LWS_CLOSE_STATUS_NORMAL); + return 1; + } + + + /* any incoming data ready? */ + + if (!(pollfd->revents & POLLIN)) + break; + +#ifdef LWS_OPENSSL_SUPPORT + if (wsi->ssl) + eff_buf.token_len = SSL_read(wsi->ssl, buf, sizeof buf); + else +#endif + eff_buf.token_len = + recv(pollfd->fd, buf, sizeof buf, 0); + + if (eff_buf.token_len < 0) { + fprintf(stderr, "Socket read returned %d\n", + eff_buf.token_len); + if (errno != EINTR) + libwebsocket_close_and_free_session(context, + wsi, LWS_CLOSE_STATUS_NOSTATUS); + return 1; + } + if (!eff_buf.token_len) { + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + return 1; + } + + /* + * give any active extensions a chance to munge the buffer + * before parse. We pass in a pointer to an lws_tokens struct + * prepared with the default buffer and content length that's in + * there. Rather than rewrite the default buffer, extensions + * that expect to grow the buffer can adapt .token to + * point to their own per-connection buffer in the extension + * user allocation. By default with no extensions or no + * extension callback handling, just the normal input buffer is + * used then so it is efficient. + */ + + eff_buf.token = (char *)buf; + + more = 1; + while (more) { + + more = 0; + + for (n = 0; n < wsi->count_active_extensions; n++) { + m = wsi->active_extensions[n]->callback(context, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_PACKET_RX_PREPARSE, + wsi->active_extensions_user[n], + &eff_buf, 0); + if (m < 0) { + fprintf(stderr, + "Extension reports fatal error\n"); + libwebsocket_close_and_free_session( + context, wsi, + LWS_CLOSE_STATUS_NOSTATUS); + return 1; + } + if (m) + more = 1; + } + + /* service incoming data */ + + if (eff_buf.token_len) { + n = libwebsocket_read(context, wsi, + (unsigned char *)eff_buf.token, + eff_buf.token_len); + if (n < 0) + /* we closed wsi */ + return 1; + } + + eff_buf.token = NULL; + eff_buf.token_len = 0; + } + break; + } + + return 0; +} + + +/** + * libwebsocket_context_destroy() - Destroy the websocket context + * @context: Websocket context + * + * This function closes any active connections and then frees the + * context. After calling this, any further use of the context is + * undefined. + */ +void +libwebsocket_context_destroy(struct libwebsocket_context *context) +{ + int n; + int m; + struct libwebsocket *wsi; + struct libwebsocket_extension *ext; + + for (n = 0; n < FD_HASHTABLE_MODULUS; n++) + for (m = 0; m < context->fd_hashtable[n].length; m++) { + wsi = context->fd_hashtable[n].wsi[m]; + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_GOINGAWAY); + } + + /* + * give all extensions a chance to clean up any per-context + * allocations they might have made + */ + + ext = context->extensions; + m = LWS_EXT_CALLBACK_CLIENT_CONTEXT_DESTRUCT; + if (context->listen_port) + m = LWS_EXT_CALLBACK_SERVER_CONTEXT_DESTRUCT; + while (ext && ext->callback) { + ext->callback(context, ext, NULL, m, NULL, NULL, 0); + ext++; + } + +#ifdef WIN32 +#else + close(context->fd_random); +#endif + +#ifdef LWS_OPENSSL_SUPPORT + if (context->ssl_ctx) + SSL_CTX_free(context->ssl_ctx); + if (context->ssl_client_ctx) + SSL_CTX_free(context->ssl_client_ctx); +#endif + + free(context); + +#ifdef WIN32 + WSACleanup(); +#endif +} + +/** + * libwebsocket_service() - Service any pending websocket activity + * @context: Websocket context + * @timeout_ms: Timeout for poll; 0 means return immediately if nothing needed + * service otherwise block and service immediately, returning + * after the timeout if nothing needed service. + * + * This function deals with any pending websocket traffic, for three + * kinds of event. It handles these events on both server and client + * types of connection the same. + * + * 1) Accept new connections to our context's server + * + * 2) Perform pending broadcast writes initiated from other forked + * processes (effectively serializing asynchronous broadcasts) + * + * 3) Call the receive callback for incoming frame data received by + * server or client connections. + * + * You need to call this service function periodically to all the above + * functions to happen; if your application is single-threaded you can + * just call it in your main event loop. + * + * Alternatively you can fork a new process that asynchronously handles + * calling this service in a loop. In that case you are happy if this + * call blocks your thread until it needs to take care of something and + * would call it with a large nonzero timeout. Your loop then takes no + * CPU while there is nothing happening. + * + * If you are calling it in a single-threaded app, you don't want it to + * wait around blocking other things in your loop from happening, so you + * would call it with a timeout_ms of 0, so it returns immediately if + * nothing is pending, or as soon as it services whatever was pending. + */ + + +int +libwebsocket_service(struct libwebsocket_context *context, int timeout_ms) +{ + int n; + + /* stay dead once we are dead */ + + if (context == NULL) + return 1; + + /* wait for something to need service */ + + n = poll(context->fds, context->fds_count, timeout_ms); + if (n == 0) /* poll timeout */ + return 0; + + if (n < 0) { + /* + fprintf(stderr, "Listen Socket dead\n"); + */ + return -1; + } + + /* handle accept on listening socket? */ + + for (n = 0; n < context->fds_count; n++) + if (context->fds[n].revents) + if (libwebsocket_service_fd(context, + &context->fds[n]) < 0) + return -1; + return 0; +} + +int +lws_any_extension_handled(struct libwebsocket_context *context, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons r, + void *v, size_t len) +{ + int n; + int handled = 0; + + /* maybe an extension will take care of it for us */ + + for (n = 0; n < wsi->count_active_extensions && !handled; n++) { + if (!wsi->active_extensions[n]->callback) + continue; + + handled |= wsi->active_extensions[n]->callback(context, + wsi->active_extensions[n], wsi, + r, wsi->active_extensions_user[n], v, len); + } + + return handled; +} + + +void * +lws_get_extension_user_matching_ext(struct libwebsocket *wsi, + struct libwebsocket_extension *ext) +{ + int n = 0; + + if (wsi == NULL) + return NULL; + + while (n < wsi->count_active_extensions) { + if (wsi->active_extensions[n] != ext) { + n++; + continue; + } + return wsi->active_extensions_user[n]; + } + + return NULL; +} + +/** + * libwebsocket_callback_on_writable() - Request a callback when this socket + * becomes able to be written to without + * blocking + * + * @context: libwebsockets context + * @wsi: Websocket connection instance to get callback for + */ + +int +libwebsocket_callback_on_writable(struct libwebsocket_context *context, + struct libwebsocket *wsi) +{ + int n; + int handled = 0; + + /* maybe an extension will take care of it for us */ + + for (n = 0; n < wsi->count_active_extensions; n++) { + if (!wsi->active_extensions[n]->callback) + continue; + + handled |= wsi->active_extensions[n]->callback(context, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_REQUEST_ON_WRITEABLE, + wsi->active_extensions_user[n], NULL, 0); + } + + if (handled) + return 1; + + for (n = 0; n < context->fds_count; n++) + if (context->fds[n].fd == wsi->sock) { + context->fds[n].events |= POLLOUT; + n = context->fds_count + 1; + } + + if (n == context->fds_count) + fprintf(stderr, "libwebsocket_callback_on_writable: " + "failed to find socket %d\n", wsi->sock); + + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_SET_MODE_POLL_FD, + (void *)(long)wsi->sock, NULL, POLLOUT); + + return 1; +} + +/** + * libwebsocket_callback_on_writable_all_protocol() - Request a callback for + * all connections using the given protocol when it + * becomes possible to write to each socket without + * blocking in turn. + * + * @protocol: Protocol whose connections will get callbacks + */ + +int +libwebsocket_callback_on_writable_all_protocol( + const struct libwebsocket_protocols *protocol) +{ + struct libwebsocket_context *context = protocol->owning_server; + int n; + int m; + struct libwebsocket *wsi; + + for (n = 0; n < FD_HASHTABLE_MODULUS; n++) { + + for (m = 0; m < context->fd_hashtable[n].length; m++) { + + wsi = context->fd_hashtable[n].wsi[m]; + + if (wsi->protocol == protocol) + libwebsocket_callback_on_writable(context, wsi); + } + } + + return 0; +} + +/** + * libwebsocket_set_timeout() - marks the wsi as subject to a timeout + * + * You will not need this unless you are doing something special + * + * @wsi: Websocket connection instance + * @reason: timeout reason + * @secs: how many seconds + */ + +void +libwebsocket_set_timeout(struct libwebsocket *wsi, + enum pending_timeout reason, int secs) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + + wsi->pending_timeout_limit = tv.tv_sec + secs; + wsi->pending_timeout = reason; +} + + +/** + * libwebsocket_get_socket_fd() - returns the socket file descriptor + * + * You will not need this unless you are doing something special + * + * @wsi: Websocket connection instance + */ + +int +libwebsocket_get_socket_fd(struct libwebsocket *wsi) +{ + return wsi->sock; +} + +/** + * libwebsocket_rx_flow_control() - Enable and disable socket servicing for + * receieved packets. + * + * If the output side of a server process becomes choked, this allows flow + * control for the input side. + * + * @wsi: Websocket connection instance to get callback for + * @enable: 0 = disable read servicing for this connection, 1 = enable + */ + +int +libwebsocket_rx_flow_control(struct libwebsocket *wsi, int enable) +{ + struct libwebsocket_context *context = wsi->protocol->owning_server; + int n; + + for (n = 0; n < context->fds_count; n++) + if (context->fds[n].fd == wsi->sock) { + if (enable) + context->fds[n].events |= POLLIN; + else + context->fds[n].events &= ~POLLIN; + + return 0; + } + + if (enable) + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_SET_MODE_POLL_FD, + (void *)(long)wsi->sock, NULL, POLLIN); + else + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_CLEAR_MODE_POLL_FD, + (void *)(long)wsi->sock, NULL, POLLIN); + +#if 0 + fprintf(stderr, "libwebsocket_rx_flow_control " + "unable to find socket\n"); +#endif + return 1; +} + +/** + * libwebsocket_canonical_hostname() - returns this host's hostname + * + * This is typically used by client code to fill in the host parameter + * when making a client connection. You can only call it after the context + * has been created. + * + * @context: Websocket context + */ + + +extern const char * +libwebsocket_canonical_hostname(struct libwebsocket_context *context) +{ + return (const char *)context->canonical_hostname; +} + + +static void sigpipe_handler(int x) +{ +} + +#ifdef LWS_OPENSSL_SUPPORT +static int +OpenSSL_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx) +{ + + SSL *ssl; + int n; + struct libwebsocket_context *context; + + ssl = X509_STORE_CTX_get_ex_data(x509_ctx, + SSL_get_ex_data_X509_STORE_CTX_idx()); + + /* + * !!! nasty openssl requires the index to come as a library-scope + * static + */ + context = SSL_get_ex_data(ssl, openssl_websocket_private_data_index); + + n = context->protocols[0].callback(NULL, NULL, + LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION, + x509_ctx, ssl, preverify_ok); + + /* convert return code from 0 = OK to 1 = OK */ + + if (!n) + n = 1; + else + n = 0; + + return n; +} +#endif + + +/** + * libwebsocket_create_context() - Create the websocket handler + * @port: Port to listen on... you can use 0 to suppress listening on + * any port, that's what you want if you are not running a + * websocket server at all but just using it as a client + * @interf: NULL to bind the listen socket to all interfaces, or the + * interface name, eg, "eth2" + * @protocols: Array of structures listing supported protocols and a protocol- + * specific callback for each one. The list is ended with an + * entry that has a NULL callback pointer. + * It's not const because we write the owning_server member + * @extensions: NULL or array of libwebsocket_extension structs listing the + * extensions this context supports + * @ssl_cert_filepath: If libwebsockets was compiled to use ssl, and you want + * to listen using SSL, set to the filepath to fetch the + * server cert from, otherwise NULL for unencrypted + * @ssl_private_key_filepath: filepath to private key if wanting SSL mode, + * else ignored + * @gid: group id to change to after setting listen socket, or -1. + * @uid: user id to change to after setting listen socket, or -1. + * @options: 0, or LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK + * + * This function creates the listening socket and takes care + * of all initialization in one step. + * + * After initialization, it returns a struct libwebsocket_context * that + * represents this server. After calling, user code needs to take care + * of calling libwebsocket_service() with the context pointer to get the + * server's sockets serviced. This can be done in the same process context + * or a forked process, or another thread, + * + * The protocol callback functions are called for a handful of events + * including http requests coming in, websocket connections becoming + * established, and data arriving; it's also called periodically to allow + * async transmission. + * + * HTTP requests are sent always to the FIRST protocol in @protocol, since + * at that time websocket protocol has not been negotiated. Other + * protocols after the first one never see any HTTP callack activity. + * + * The server created is a simple http server by default; part of the + * websocket standard is upgrading this http connection to a websocket one. + * + * This allows the same server to provide files like scripts and favicon / + * images or whatever over http and dynamic data over websockets all in + * one place; they're all handled in the user callback. + */ + +struct libwebsocket_context * +libwebsocket_create_context(int port, const char *interf, + struct libwebsocket_protocols *protocols, + struct libwebsocket_extension *extensions, + const char *ssl_cert_filepath, + const char *ssl_private_key_filepath, + int gid, int uid, unsigned int options) +{ + int n; + int m; + int sockfd = 0; + int fd; + struct sockaddr_in serv_addr, cli_addr; + int opt = 1; + struct libwebsocket_context *context = NULL; + unsigned int slen; + char *p; + char hostname[1024] = ""; +// struct hostent *he; + struct libwebsocket *wsi; + struct sockaddr sa; + +#ifdef LWS_OPENSSL_SUPPORT + SSL_METHOD *method; + char ssl_err_buf[512]; +#endif + +#ifdef _WIN32 + { + WORD wVersionRequested; + WSADATA wsaData; + int err; + HMODULE wsdll; + + /* Use the MAKEWORD(lowbyte, highbyte) macro from Windef.h */ + wVersionRequested = MAKEWORD(2, 2); + + err = WSAStartup(wVersionRequested, &wsaData); + if (err != 0) { + /* Tell the user that we could not find a usable */ + /* Winsock DLL. */ + fprintf(stderr, "WSAStartup failed with error: %d\n", + err); + return NULL; + } + + /* default to a poll() made out of select() */ + poll = emulated_poll; + + /* if windows socket lib available, use his WSAPoll */ + wsdll = GetModuleHandle("Ws2_32.dll"); + if (wsdll) + poll = (PFNWSAPOLL)GetProcAddress(wsdll, "WSAPoll"); + } +#endif + + + context = malloc(sizeof(struct libwebsocket_context)); + if (!context) { + fprintf(stderr, "No memory for websocket context\n"); + return NULL; + } + context->protocols = protocols; + context->listen_port = port; + context->http_proxy_port = 0; + context->http_proxy_address[0] = '\0'; + context->options = options; + context->fds_count = 0; + context->extensions = extensions; + context->last_timeout_check_s = 0; + +#ifdef WIN32 + context->fd_random = 0; +#else + context->fd_random = open(SYSTEM_RANDOM_FILEPATH, O_RDONLY); + if (context->fd_random < 0) { + fprintf(stderr, "Unable to open random device %s %d\n", + SYSTEM_RANDOM_FILEPATH, context->fd_random); + return NULL; + } +#endif + +#ifdef LWS_OPENSSL_SUPPORT + context->use_ssl = 0; + context->ssl_ctx = NULL; + context->ssl_client_ctx = NULL; + openssl_websocket_private_data_index = 0; +#endif + /* find canonical hostname */ + + hostname[(sizeof hostname) - 1] = '\0'; + memset(&sa, 0, sizeof(sa)); + sa.sa_family = AF_INET; + sa.sa_data[(sizeof sa.sa_data) - 1] = '\0'; + gethostname(hostname, (sizeof hostname) - 1); + + n = 0; + + if (strlen(hostname) < sizeof(sa.sa_data) - 1) { + strcpy(sa.sa_data, hostname); +// fprintf(stderr, "my host name is %s\n", sa.sa_data); + n = getnameinfo(&sa, sizeof(sa), hostname, + (sizeof hostname) - 1, NULL, 0, 0); + } + + if (!n) { + strncpy(context->canonical_hostname, hostname, + sizeof context->canonical_hostname - 1); + context->canonical_hostname[ + sizeof context->canonical_hostname - 1] = '\0'; + } else + strncpy(context->canonical_hostname, hostname, + sizeof context->canonical_hostname - 1); + +// fprintf(stderr, "context->canonical_hostname = %s\n", +// context->canonical_hostname); + + /* split the proxy ads:port if given */ + + p = getenv("http_proxy"); + if (p) { + strncpy(context->http_proxy_address, p, + sizeof context->http_proxy_address - 1); + context->http_proxy_address[ + sizeof context->http_proxy_address - 1] = '\0'; + + p = strchr(context->http_proxy_address, ':'); + if (p == NULL) { + fprintf(stderr, "http_proxy needs to be ads:port\n"); + return NULL; + } + *p = '\0'; + context->http_proxy_port = atoi(p + 1); + + fprintf(stderr, "Using proxy %s:%u\n", + context->http_proxy_address, + context->http_proxy_port); + } + + if (port) { + +#ifdef LWS_OPENSSL_SUPPORT + context->use_ssl = ssl_cert_filepath != NULL && + ssl_private_key_filepath != NULL; + if (context->use_ssl) + fprintf(stderr, " Compiled with SSL support, " + "using it\n"); + else + fprintf(stderr, " Compiled with SSL support, " + "not using it\n"); + +#else + if (ssl_cert_filepath != NULL && + ssl_private_key_filepath != NULL) { + fprintf(stderr, " Not compiled for OpenSSl support!\n"); + return NULL; + } + fprintf(stderr, " Compiled without SSL support, " + "serving unencrypted\n"); +#endif + } + + /* ignore SIGPIPE */ +#ifdef WIN32 +#else + signal(SIGPIPE, sigpipe_handler); +#endif + + +#ifdef LWS_OPENSSL_SUPPORT + + /* basic openssl init */ + + SSL_library_init(); + + OpenSSL_add_all_algorithms(); + SSL_load_error_strings(); + + openssl_websocket_private_data_index = + SSL_get_ex_new_index(0, "libwebsockets", NULL, NULL, NULL); + + /* + * Firefox insists on SSLv23 not SSLv3 + * Konq disables SSLv2 by default now, SSLv23 works + */ + + method = (SSL_METHOD *)SSLv23_server_method(); + if (!method) { + fprintf(stderr, "problem creating ssl method: %s\n", + ERR_error_string(ERR_get_error(), ssl_err_buf)); + return NULL; + } + context->ssl_ctx = SSL_CTX_new(method); /* create context */ + if (!context->ssl_ctx) { + fprintf(stderr, "problem creating ssl context: %s\n", + ERR_error_string(ERR_get_error(), ssl_err_buf)); + return NULL; + } + + /* client context */ + + if (port == CONTEXT_PORT_NO_LISTEN) { + method = (SSL_METHOD *)SSLv23_client_method(); + if (!method) { + fprintf(stderr, "problem creating ssl method: %s\n", + ERR_error_string(ERR_get_error(), ssl_err_buf)); + return NULL; + } + /* create context */ + context->ssl_client_ctx = SSL_CTX_new(method); + if (!context->ssl_client_ctx) { + fprintf(stderr, "problem creating ssl context: %s\n", + ERR_error_string(ERR_get_error(), ssl_err_buf)); + return NULL; + } + + /* openssl init for cert verification (for client sockets) */ + + if (!SSL_CTX_load_verify_locations( + context->ssl_client_ctx, NULL, + LWS_OPENSSL_CLIENT_CERTS)) + fprintf(stderr, + "Unable to load SSL Client certs from %s " + "(set by --with-client-cert-dir= in configure) -- " + " client ssl isn't going to work", + LWS_OPENSSL_CLIENT_CERTS); + + /* + * callback allowing user code to load extra verification certs + * helping the client to verify server identity + */ + + context->protocols[0].callback(context, NULL, + LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS, + context->ssl_client_ctx, NULL, 0); + } + + /* as a server, are we requiring clients to identify themselves? */ + + if (options & LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT) { + + /* absolutely require the client cert */ + + SSL_CTX_set_verify(context->ssl_ctx, + SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, + OpenSSL_verify_callback); + + /* + * give user code a chance to load certs into the server + * allowing it to verify incoming client certs + */ + + context->protocols[0].callback(context, NULL, + LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS, + context->ssl_ctx, NULL, 0); + } + + if (context->use_ssl) { + + /* openssl init for server sockets */ + + /* set the local certificate from CertFile */ + n = SSL_CTX_use_certificate_file(context->ssl_ctx, + ssl_cert_filepath, SSL_FILETYPE_PEM); + if (n != 1) { + fprintf(stderr, "problem getting cert '%s': %s\n", + ssl_cert_filepath, + ERR_error_string(ERR_get_error(), ssl_err_buf)); + return NULL; + } + /* set the private key from KeyFile */ + if (SSL_CTX_use_PrivateKey_file(context->ssl_ctx, + ssl_private_key_filepath, SSL_FILETYPE_PEM) != 1) { + fprintf(stderr, "ssl problem getting key '%s': %s\n", + ssl_private_key_filepath, + ERR_error_string(ERR_get_error(), ssl_err_buf)); + return NULL; + } + /* verify private key */ + if (!SSL_CTX_check_private_key(context->ssl_ctx)) { + fprintf(stderr, "Private SSL key doesn't match cert\n"); + return NULL; + } + + /* SSL is happy and has a cert it's content with */ + } +#endif + + /* selftest */ + + if (lws_b64_selftest()) + return NULL; + + /* fd hashtable init */ + + for (n = 0; n < FD_HASHTABLE_MODULUS; n++) + context->fd_hashtable[n].length = 0; + + /* set up our external listening socket we serve on */ + + if (port) { + + sockfd = socket(AF_INET, SOCK_STREAM, 0); + if (sockfd < 0) { + fprintf(stderr, "ERROR opening socket"); + return NULL; + } + + /* allow us to restart even if old sockets in TIME_WAIT */ + setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, + (const void *)&opt, sizeof(opt)); + + /* Disable Nagle */ + opt = 1; + setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, + (const void *)&opt, sizeof(opt)); + + bzero((char *) &serv_addr, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + if (interf == NULL) + serv_addr.sin_addr.s_addr = INADDR_ANY; + else + interface_to_sa(interf, &serv_addr, + sizeof(serv_addr)); + serv_addr.sin_port = htons(port); + + n = bind(sockfd, (struct sockaddr *) &serv_addr, + sizeof(serv_addr)); + if (n < 0) { + fprintf(stderr, "ERROR on binding to port %d (%d %d)\n", + port, n, errno); + return NULL; + } + + wsi = malloc(sizeof(struct libwebsocket)); + memset(wsi, 0, sizeof(struct libwebsocket)); + wsi->sock = sockfd; + wsi->count_active_extensions = 0; + wsi->mode = LWS_CONNMODE_SERVER_LISTENER; + insert_wsi(context, wsi); + + listen(sockfd, 5); + fprintf(stderr, " Listening on port %d\n", port); + + /* list in the internal poll array */ + + context->fds[context->fds_count].fd = sockfd; + context->fds[context->fds_count++].events = POLLIN; + + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_ADD_POLL_FD, + (void *)(long)sockfd, NULL, POLLIN); + + } + + /* + * drop any root privs for this process + * to listen on port < 1023 we would have needed root, but now we are + * listening, we don't want the power for anything else + */ +#ifdef WIN32 +#else + if (gid != -1) + if (setgid(gid)) + fprintf(stderr, "setgid: %s\n", strerror(errno)); + if (uid != -1) + if (setuid(uid)) + fprintf(stderr, "setuid: %s\n", strerror(errno)); +#endif + + /* set up our internal broadcast trigger sockets per-protocol */ + + for (context->count_protocols = 0; + protocols[context->count_protocols].callback; + context->count_protocols++) { + + debug(" Protocol: %s\n", protocols[context->count_protocols].name); + + protocols[context->count_protocols].owning_server = context; + protocols[context->count_protocols].protocol_index = + context->count_protocols; + + fd = socket(AF_INET, SOCK_STREAM, 0); + if (fd < 0) { + fprintf(stderr, "ERROR opening socket"); + return NULL; + } + + /* allow us to restart even if old sockets in TIME_WAIT */ + setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&opt, + sizeof(opt)); + + bzero((char *) &serv_addr, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); + serv_addr.sin_port = 0; /* pick the port for us */ + + n = bind(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)); + if (n < 0) { + fprintf(stderr, "ERROR on binding to port %d (%d %d)\n", + port, n, errno); + return NULL; + } + + slen = sizeof cli_addr; + n = getsockname(fd, (struct sockaddr *)&cli_addr, &slen); + if (n < 0) { + fprintf(stderr, "getsockname failed\n"); + return NULL; + } + protocols[context->count_protocols].broadcast_socket_port = + ntohs(cli_addr.sin_port); + listen(fd, 5); + + debug(" Protocol %s broadcast socket %d\n", + protocols[context->count_protocols].name, + ntohs(cli_addr.sin_port)); + + /* dummy wsi per broadcast proxy socket */ + + wsi = malloc(sizeof(struct libwebsocket)); + memset(wsi, 0, sizeof(struct libwebsocket)); + wsi->sock = fd; + wsi->mode = LWS_CONNMODE_BROADCAST_PROXY_LISTENER; + wsi->count_active_extensions = 0; + /* note which protocol we are proxying */ + wsi->protocol_index_for_broadcast_proxy = + context->count_protocols; + insert_wsi(context, wsi); + + /* list in internal poll array */ + + context->fds[context->fds_count].fd = fd; + context->fds[context->fds_count].events = POLLIN; + context->fds[context->fds_count].revents = 0; + context->fds_count++; + + /* external POLL support via protocol 0 */ + context->protocols[0].callback(context, wsi, + LWS_CALLBACK_ADD_POLL_FD, + (void *)(long)fd, NULL, POLLIN); + } + + /* + * give all extensions a chance to create any per-context + * allocations they need + */ + + m = LWS_EXT_CALLBACK_CLIENT_CONTEXT_CONSTRUCT; + if (port) + m = LWS_EXT_CALLBACK_SERVER_CONTEXT_CONSTRUCT; + + if (extensions) { + while (extensions->callback) { + debug(" Extension: %s\n", extensions->name); + extensions->callback(context, extensions, + NULL, m, NULL, NULL, 0); + extensions++; + } + } + + return context; +} + + +#ifndef LWS_NO_FORK + +/** + * libwebsockets_fork_service_loop() - Optional helper function forks off + * a process for the websocket server loop. + * You don't have to use this but if not, you + * have to make sure you are calling + * libwebsocket_service periodically to service + * the websocket traffic + * @context: server context returned by creation function + */ + +int +libwebsockets_fork_service_loop(struct libwebsocket_context *context) +{ + int fd; + struct sockaddr_in cli_addr; + int n; + int p; + + n = fork(); + if (n < 0) + return n; + + if (!n) { + + /* main process context */ + + /* + * set up the proxy sockets to allow broadcast from + * service process context + */ + + for (p = 0; p < context->count_protocols; p++) { + fd = socket(AF_INET, SOCK_STREAM, 0); + if (fd < 0) { + fprintf(stderr, "Unable to create socket\n"); + return -1; + } + cli_addr.sin_family = AF_INET; + cli_addr.sin_port = htons( + context->protocols[p].broadcast_socket_port); + cli_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); + n = connect(fd, (struct sockaddr *)&cli_addr, + sizeof cli_addr); + if (n < 0) { + fprintf(stderr, "Unable to connect to " + "broadcast socket %d, %s\n", + n, strerror(errno)); + return -1; + } + + context->protocols[p].broadcast_socket_user_fd = fd; + } + + return 0; + } + +#ifdef HAVE_SYS_PRCTL_H + /* we want a SIGHUP when our parent goes down */ + prctl(PR_SET_PDEATHSIG, SIGHUP); +#endif + + /* in this forked process, sit and service websocket connections */ + + while (1) { + if (libwebsocket_service(context, 1000)) + break; +#ifndef HAVE_SYS_PRCTL_H +/* + * on systems without prctl() (i.e. anything but linux) we can notice that our + * parent is dead if getppid() returns 1. FIXME apparently this is not true for + * solaris, could remember ppid right after fork and wait for it to change. + */ + + if (getppid() == 1) + break; +#endif + } + + + return 1; +} + +#endif + +/** + * libwebsockets_get_protocol() - Returns a protocol pointer from a websocket + * connection. + * @wsi: pointer to struct websocket you want to know the protocol of + * + * + * This is useful to get the protocol to broadcast back to from inside + * the callback. + */ + +const struct libwebsocket_protocols * +libwebsockets_get_protocol(struct libwebsocket *wsi) +{ + return wsi->protocol; +} + +/** + * libwebsockets_broadcast() - Sends a buffer to the callback for all active + * connections of the given protocol. + * @protocol: pointer to the protocol you will broadcast to all members of + * @buf: buffer containing the data to be broadcase. NOTE: this has to be + * allocated with LWS_SEND_BUFFER_PRE_PADDING valid bytes before + * the pointer and LWS_SEND_BUFFER_POST_PADDING afterwards in the + * case you are calling this function from callback context. + * @len: length of payload data in buf, starting from buf. + * + * This function allows bulk sending of a packet to every connection using + * the given protocol. It does not send the data directly; instead it calls + * the callback with a reason type of LWS_CALLBACK_BROADCAST. If the callback + * wants to actually send the data for that connection, the callback itself + * should call libwebsocket_write(). + * + * libwebsockets_broadcast() can be called from another fork context without + * having to take any care about data visibility between the processes, it'll + * "just work". + */ + + +int +libwebsockets_broadcast(const struct libwebsocket_protocols *protocol, + unsigned char *buf, size_t len) +{ + struct libwebsocket_context *context = protocol->owning_server; + int n; + int m; + struct libwebsocket *wsi; + + if (!protocol->broadcast_socket_user_fd) { + /* + * We are either running unforked / flat, or we are being + * called from poll thread context + * eg, from a callback. In that case don't use sockets for + * broadcast IPC (since we can't open a socket connection to + * a socket listening on our own thread) but directly do the + * send action. + * + * Locking is not needed because we are by definition being + * called in the poll thread context and are serialized. + */ + + for (n = 0; n < FD_HASHTABLE_MODULUS; n++) { + + for (m = 0; m < context->fd_hashtable[n].length; m++) { + + wsi = context->fd_hashtable[n].wsi[m]; + + if (wsi->mode != LWS_CONNMODE_WS_SERVING) + continue; + + /* + * never broadcast to + * non-established connections + */ + if (wsi->state != WSI_STATE_ESTABLISHED) + continue; + + /* only broadcast to guys using + * requested protocol + */ + if (wsi->protocol != protocol) + continue; + + wsi->protocol->callback(context, wsi, + LWS_CALLBACK_BROADCAST, + wsi->user_space, + buf, len); + } + } + + return 0; + } + + /* + * We're being called from a different process context than the server + * loop. Instead of broadcasting directly, we send our + * payload on a socket to do the IPC; the server process will serialize + * the broadcast action in its main poll() loop. + * + * There's one broadcast socket listening for each protocol supported + * set up when the websocket server initializes + */ + + n = send(protocol->broadcast_socket_user_fd, buf, len, MSG_NOSIGNAL); + + return n; +} + +int +libwebsocket_is_final_fragment(struct libwebsocket *wsi) +{ + return wsi->final; +} + +void * +libwebsocket_ensure_user_space(struct libwebsocket *wsi) +{ + /* allocate the per-connection user memory (if any) */ + + if (wsi->protocol->per_session_data_size && !wsi->user_space) { + wsi->user_space = malloc( + wsi->protocol->per_session_data_size); + if (wsi->user_space == NULL) { + fprintf(stderr, "Out of memory for " + "conn user space\n"); + return NULL; + } + memset(wsi->user_space, 0, + wsi->protocol->per_session_data_size); + } + return wsi->user_space; +} diff --git a/libs/libwebsockets/lib/libwebsockets.h b/libs/libwebsockets/lib/libwebsockets.h new file mode 100644 index 0000000000..60e7468cdc --- /dev/null +++ b/libs/libwebsockets/lib/libwebsockets.h @@ -0,0 +1,731 @@ +/* + * libwebsockets - small server side websockets and web server implementation + * + * Copyright (C) 2010 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef __LIBWEBSOCKET_H__ +#define __LIBWEBSOCKET_H__ + +#ifdef __cplusplus +extern "C" { +#include +#endif + +#ifdef WIN32 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include +#include "../win32port/win32helpers/websock-w32.h" + +#include "../win32port/win32helpers/gettimeofday.h" + +#define strcasecmp stricmp + +typedef int ssize_t; + +#ifdef LWS_DLL +#ifdef LWS_INTERNAL +#define LWS_EXTERN extern __declspec(dllexport) +#else +#define LWS_EXTERN extern __declspec(dllimport) +#endif +#endif + +#else +#include +#endif + +#ifndef LWS_EXTERN +#define LWS_EXTERN extern +#endif + +#define CONTEXT_PORT_NO_LISTEN 0 +#define MAX_MUX_RECURSION 2 + +enum libwebsocket_context_options { + LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK = 1, + LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT = 2, +}; + +enum libwebsocket_callback_reasons { + LWS_CALLBACK_ESTABLISHED, + LWS_CALLBACK_CLIENT_CONNECTION_ERROR, + LWS_CALLBACK_CLIENT_ESTABLISHED, + LWS_CALLBACK_CLOSED, + LWS_CALLBACK_RECEIVE, + LWS_CALLBACK_CLIENT_RECEIVE, + LWS_CALLBACK_CLIENT_RECEIVE_PONG, + LWS_CALLBACK_CLIENT_WRITEABLE, + LWS_CALLBACK_SERVER_WRITEABLE, + LWS_CALLBACK_HTTP, + LWS_CALLBACK_BROADCAST, + LWS_CALLBACK_FILTER_NETWORK_CONNECTION, + LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION, + LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS, + LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS, + LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION, + LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER, + LWS_CALLBACK_CONFIRM_EXTENSION_OKAY, + LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED, + /* external poll() management support */ + LWS_CALLBACK_ADD_POLL_FD, + LWS_CALLBACK_DEL_POLL_FD, + LWS_CALLBACK_SET_MODE_POLL_FD, + LWS_CALLBACK_CLEAR_MODE_POLL_FD, +}; + +enum libwebsocket_extension_callback_reasons { + LWS_EXT_CALLBACK_SERVER_CONTEXT_CONSTRUCT, + LWS_EXT_CALLBACK_CLIENT_CONTEXT_CONSTRUCT, + LWS_EXT_CALLBACK_SERVER_CONTEXT_DESTRUCT, + LWS_EXT_CALLBACK_CLIENT_CONTEXT_DESTRUCT, + LWS_EXT_CALLBACK_CONSTRUCT, + LWS_EXT_CALLBACK_CLIENT_CONSTRUCT, + LWS_EXT_CALLBACK_CHECK_OK_TO_REALLY_CLOSE, + LWS_EXT_CALLBACK_CHECK_OK_TO_PROPOSE_EXTENSION, + LWS_EXT_CALLBACK_DESTROY, + LWS_EXT_CALLBACK_DESTROY_ANY_WSI_CLOSING, + LWS_EXT_CALLBACK_ANY_WSI_ESTABLISHED, + LWS_EXT_CALLBACK_PACKET_RX_PREPARSE, + LWS_EXT_CALLBACK_PACKET_TX_PRESEND, + LWS_EXT_CALLBACK_PACKET_TX_DO_SEND, + LWS_EXT_CALLBACK_HANDSHAKE_REPLY_TX, + LWS_EXT_CALLBACK_FLUSH_PENDING_TX, + LWS_EXT_CALLBACK_EXTENDED_PAYLOAD_RX, + LWS_EXT_CALLBACK_CAN_PROXY_CLIENT_CONNECTION, + LWS_EXT_CALLBACK_1HZ, + LWS_EXT_CALLBACK_REQUEST_ON_WRITEABLE, + LWS_EXT_CALLBACK_IS_WRITEABLE, +}; + +enum libwebsocket_write_protocol { + LWS_WRITE_TEXT, + LWS_WRITE_BINARY, + LWS_WRITE_CONTINUATION, + LWS_WRITE_HTTP, + + /* special 04+ opcodes */ + + LWS_WRITE_CLOSE, + LWS_WRITE_PING, + LWS_WRITE_PONG, + + /* flags */ + + LWS_WRITE_NO_FIN = 0x40, + /* + * client packet payload goes out on wire unmunged + * only useful for security tests since normal servers cannot + * decode the content if used + */ + LWS_WRITE_CLIENT_IGNORE_XOR_MASK = 0x80 +}; + +/* + * you need these to look at headers that have been parsed if using the + * LWS_CALLBACK_FILTER_CONNECTION callback. If a header from the enum + * list below is absent, .token = NULL and token_len = 0. Otherwise .token + * points to .token_len chars containing that header content. + */ + +struct lws_tokens { + char *token; + int token_len; +}; + +enum lws_token_indexes { + WSI_TOKEN_GET_URI, + WSI_TOKEN_HOST, + WSI_TOKEN_CONNECTION, + WSI_TOKEN_KEY1, + WSI_TOKEN_KEY2, + WSI_TOKEN_PROTOCOL, + WSI_TOKEN_UPGRADE, + WSI_TOKEN_ORIGIN, + WSI_TOKEN_DRAFT, + WSI_TOKEN_CHALLENGE, + + /* new for 04 */ + WSI_TOKEN_KEY, + WSI_TOKEN_VERSION, + WSI_TOKEN_SWORIGIN, + + /* new for 05 */ + WSI_TOKEN_EXTENSIONS, + + /* client receives these */ + WSI_TOKEN_ACCEPT, + WSI_TOKEN_NONCE, + WSI_TOKEN_HTTP, + WSI_TOKEN_MUXURL, + + /* always last real token index*/ + WSI_TOKEN_COUNT, + /* parser state additions */ + WSI_TOKEN_NAME_PART, + WSI_TOKEN_SKIPPING, + WSI_TOKEN_SKIPPING_SAW_CR, + WSI_PARSING_COMPLETE, + WSI_INIT_TOKEN_MUXURL, +}; + +/* + * From 06 spec + 1000 + + 1000 indicates a normal closure, meaning whatever purpose the + connection was established for has been fulfilled. + + 1001 + + 1001 indicates that an endpoint is "going away", such as a server + going down, or a browser having navigated away from a page. + + 1002 + + 1002 indicates that an endpoint is terminating the connection due + to a protocol error. + + 1003 + + 1003 indicates that an endpoint is terminating the connection + because it has received a type of data it cannot accept (e.g. an + endpoint that understands only text data may send this if it + receives a binary message.) + + 1004 + + 1004 indicates that an endpoint is terminating the connection + because it has received a message that is too large. +*/ + +enum lws_close_status { + LWS_CLOSE_STATUS_NOSTATUS = 0, + LWS_CLOSE_STATUS_NORMAL = 1000, + LWS_CLOSE_STATUS_GOINGAWAY = 1001, + LWS_CLOSE_STATUS_PROTOCOL_ERR = 1002, + LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE = 1003, + LWS_CLOSE_STATUS_PAYLOAD_TOO_LARGE = 1004, +}; + +struct libwebsocket; +struct libwebsocket_context; +struct libwebsocket_extension; + +/** + * callback_function() - User server actions + * @context: Websockets context + * @wsi: Opaque websocket instance pointer + * @reason: The reason for the call + * @user: Pointer to per-session user data allocated by library + * @in: Pointer used for some callback reasons + * @len: Length set for some callback reasons + * + * This callback is the way the user controls what is served. All the + * protocol detail is hidden and handled by the library. + * + * For each connection / session there is user data allocated that is + * pointed to by "user". You set the size of this user data area when + * the library is initialized with libwebsocket_create_server. + * + * You get an opportunity to initialize user data when called back with + * LWS_CALLBACK_ESTABLISHED reason. + * + * LWS_CALLBACK_ESTABLISHED: after the server completes a handshake with + * an incoming client + * + * LWS_CALLBACK_CLIENT_CONNECTION_ERROR: the request client connection has + * been unable to complete a handshake with the remote server + * + * LWS_CALLBACK_CLIENT_ESTABLISHED: after your client connection completed + * a handshake with the remote server + * + * LWS_CALLBACK_CLOSED: when the websocket session ends + * + * LWS_CALLBACK_BROADCAST: signal to send to client (you would use + * libwebsocket_write() taking care about the + * special buffer requirements + * + * LWS_CALLBACK_RECEIVE: data has appeared for this server endpoint from a + * remote client, it can be found at *in and is + * len bytes long + * + * LWS_CALLBACK_CLIENT_RECEIVE_PONG: if you elected to see PONG packets, + * they appear with this callback reason. PONG + * packets only exist in 04+ protocol + * + * LWS_CALLBACK_CLIENT_RECEIVE: data has appeared from the server for the + * client connection, it can be found at *in and + * is len bytes long + * + * LWS_CALLBACK_HTTP: an http request has come from a client that is not + * asking to upgrade the connection to a websocket + * one. This is a chance to serve http content, + * for example, to send a script to the client + * which will then open the websockets connection. + * @in points to the URI path requested and + * libwebsockets_serve_http_file() makes it very + * simple to send back a file to the client. + * + * LWS_CALLBACK_CLIENT_WRITEABLE: + * LWS_CALLBACK_SERVER_WRITEABLE: If you call + * libwebsocket_callback_on_writable() on a connection, you will + * get one of these callbacks coming when the connection socket + * is able to accept another write packet without blocking. + * If it already was able to take another packet without blocking, + * you'll get this callback at the next call to the service loop + * function. Notice that CLIENTs get LWS_CALLBACK_CLIENT_WRITEABLE + * and servers get LWS_CALLBACK_SERVER_WRITEABLE. + * + * LWS_CALLBACK_FILTER_NETWORK_CONNECTION: called when a client connects to + * the server at network level; the connection is accepted but then + * passed to this callback to decide whether to hang up immediately + * or not, based on the client IP. @user contains the connection + * socket's descriptor. Return non-zero to terminate + * the connection before sending or receiving anything. + * Because this happens immediately after the network connection + * from the client, there's no websocket protocol selected yet so + * this callback is issued only to protocol 0. + * + * LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: called when the handshake has + * been received and parsed from the client, but the response is + * not sent yet. Return non-zero to disallow the connection. + * @user is a pointer to an array of struct lws_tokens, you can + * use the header enums lws_token_indexes from libwebsockets.h + * to check for and read the supported header presence and + * content before deciding to allow the handshake to proceed or + * to kill the connection. + * + * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS: if configured for + * including OpenSSL support, this callback allows your user code + * to perform extra SSL_CTX_load_verify_locations() or similar + * calls to direct OpenSSL where to find certificates the client + * can use to confirm the remote server identity. @user is the + * OpenSSL SSL_CTX* + * + * LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS: if configured for + * including OpenSSL support, this callback allows your user code + * to load extra certifcates into the server which allow it to + * verify the validity of certificates returned by clients. @user + * is the server's OpenSSL SSL_CTX* + * + * LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION: if the + * libwebsockets context was created with the option + * LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT, then this + * callback is generated during OpenSSL verification of the cert + * sent from the client. It is sent to protocol[0] callback as + * no protocol has been negotiated on the connection yet. + * Notice that the libwebsockets context and wsi are both NULL + * during this callback. See + * http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html + * to understand more detail about the OpenSSL callback that + * generates this libwebsockets callback and the meanings of the + * arguments passed. In this callback, @user is the x509_ctx, + * @in is the ssl pointer and @len is preverify_ok + * Notice that this callback maintains libwebsocket return + * conventions, return 0 to mean the cert is OK or 1 to fail it. + * This also means that if you don't handle this callback then + * the default callback action of returning 0 allows the client + * certificates. + * + * LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER: this callback happens + * when a client handshake is being compiled. @user is NULL, + * @in is a char **, it's pointing to a char * which holds the + * next location in the header buffer where you can add + * headers, and @len is the remaining space in the header buffer, + * which is typically some hundreds of bytes. So, to add a canned + * cookie, your handler code might look similar to: + * + * char **p = (char **)in; + * + * if (len < 100) + * return 1; + * + * *p += sprintf(*p, "Cookie: a=b\x0d\x0a"); + * + * return 0; + * + * Notice if you add anything, you just have to take care about + * the CRLF on the line you added. Obviously this callback is + * optional, if you don't handle it everything is fine. + * + * Notice the callback is coming to protocols[0] all the time, + * because there is no specific protocol handshook yet. + * + * LWS_CALLBACK_CONFIRM_EXTENSION_OKAY: When the server handshake code + * sees that it does support a requested extension, before + * accepting the extension by additing to the list sent back to + * the client it gives this callback just to check that it's okay + * to use that extension. It calls back to the requested protocol + * and with @in being the extension name, @len is 0 and @user is + * valid. Note though at this time the ESTABLISHED callback hasn't + * happened yet so if you initialize @user content there, @user + * content during this callback might not be useful for anything. + * Notice this callback comes to protocols[0]. + * + * LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED: When a client + * connection is being prepared to start a handshake to a server, + * each supported extension is checked with protocols[0] callback + * with this reason, giving the user code a chance to suppress the + * claim to support that extension by returning non-zero. If + * unhandled, by default 0 will be returned and the extension + * support included in the header to the server. Notice this + * callback comes to protocols[0]. + * + * The next four reasons are optional and only need taking care of if you + * will be integrating libwebsockets sockets into an external polling + * array. + * + * LWS_CALLBACK_ADD_POLL_FD: libwebsocket deals with its poll() loop + * internally, but in the case you are integrating with another + * server you will need to have libwebsocket sockets share a + * polling array with the other server. This and the other + * POLL_FD related callbacks let you put your specialized + * poll array interface code in the callback for protocol 0, the + * first protocol you support, usually the HTTP protocol in the + * serving case. This callback happens when a socket needs to be + * added to the polling loop: @user contains the fd, and + * @len is the events bitmap (like, POLLIN). If you are using the + * internal polling loop (the "service" callback), you can just + * ignore these callbacks. + * + * LWS_CALLBACK_DEL_POLL_FD: This callback happens when a socket descriptor + * needs to be removed from an external polling array. @user is + * the socket desricptor. If you are using the internal polling + * loop, you can just ignore it. + * + * LWS_CALLBACK_SET_MODE_POLL_FD: This callback happens when libwebsockets + * wants to modify the events for the socket descriptor in @user. + * The handler should OR @len on to the events member of the pollfd + * struct for this socket descriptor. If you are using the + * internal polling loop, you can just ignore it. + * + * LWS_CALLBACK_CLEAR_MODE_POLL_FD: This callback occurs when libwebsockets + * wants to modify the events for the socket descriptor in @user. + * The handler should AND ~@len on to the events member of the + * pollfd struct for this socket descriptor. If you are using the + * internal polling loop, you can just ignore it. + */ +LWS_EXTERN int callback(struct libwebsocket_context * context, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, void *user, + void *in, size_t len); + +typedef int (callback_function)(struct libwebsocket_context * context, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, void *user, + void *in, size_t len); + + +/** + * extension_callback_function() - Hooks to allow extensions to operate + * @context: Websockets context + * @ext: This extension + * @wsi: Opaque websocket instance pointer + * @reason: The reason for the call + * @user: Pointer to per-session user data allocated by library + * @in: Pointer used for some callback reasons + * @len: Length set for some callback reasons + * + * Each extension that is active on a particular connection receives + * callbacks during the connection lifetime to allow the extension to + * operate on websocket data and manage itself. + * + * Libwebsockets takes care of allocating and freeing "user" memory for + * each active extension on each connection. That is what is pointed to + * by the @user parameter. + * + * LWS_EXT_CALLBACK_CONSTRUCT: called when the server has decided to + * select this extension from the list provided by the client, + * just before the server will send back the handshake accepting + * the connection with this extension active. This gives the + * extension a chance to initialize its connection context found + * in @user. + * + * LWS_EXT_CALLBACK_CLIENT_CONSTRUCT: same as LWS_EXT_CALLBACK_CONSTRUCT + * but called when client is instantiating this extension. Some + * extensions will work the same on client and server side and then + * you can just merge handlers for both CONSTRUCTS. + * + * LWS_EXT_CALLBACK_DESTROY: called when the connection the extension was + * being used on is about to be closed and deallocated. It's the + * last chance for the extension to deallocate anything it has + * allocated in the user data (pointed to by @user) before the + * user data is deleted. This same callback is used whether you + * are in client or server instantiation context. + * + * LWS_EXT_CALLBACK_PACKET_RX_PREPARSE: when this extension was active on + * a connection, and a packet of data arrived at the connection, + * it is passed to this callback to give the extension a chance to + * change the data, eg, decompress it. @user is pointing to the + * extension's private connection context data, @in is pointing + * to an lws_tokens struct, it consists of a char * pointer called + * token, and an int called token_len. At entry, these are + * set to point to the received buffer and set to the content + * length. If the extension will grow the content, it should use + * a new buffer allocated in its private user context data and + * set the pointed-to lws_tokens members to point to its buffer. + * + * LWS_EXT_CALLBACK_PACKET_TX_PRESEND: this works the same way as + * LWS_EXT_CALLBACK_PACKET_RX_PREPARSE above, except it gives the + * extension a chance to change websocket data just before it will + * be sent out. Using the same lws_token pointer scheme in @in, + * the extension can change the buffer and the length to be + * transmitted how it likes. Again if it wants to grow the + * buffer safely, it should copy the data into its own buffer and + * set the lws_tokens token pointer to it. + */ +LWS_EXTERN int extension_callback(struct libwebsocket_context * context, + struct libwebsocket_extension *ext, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons reason, void *user, + void *in, size_t len); + +typedef int (extension_callback_function)(struct libwebsocket_context * context, + struct libwebsocket_extension *ext, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons reason, void *user, + void *in, size_t len); + +/** + * struct libwebsocket_protocols - List of protocols and handlers server + * supports. + * @name: Protocol name that must match the one given in the client + * Javascript new WebSocket(url, 'protocol') name + * @callback: The service callback used for this protocol. It allows the + * service action for an entire protocol to be encapsulated in + * the protocol-specific callback + * @per_session_data_size: Each new connection using this protocol gets + * this much memory allocated on connection establishment and + * freed on connection takedown. A pointer to this per-connection + * allocation is passed into the callback in the 'user' parameter + * @owning_server: the server init call fills in this opaque pointer when + * registering this protocol with the server. + * @broadcast_socket_port: the server init call fills this in with the + * localhost port number used to forward broadcasts for this + * protocol + * @broadcast_socket_user_fd: the server init call fills this in ... the main() + * process context can write to this socket to perform broadcasts + * (use the libwebsockets_broadcast() api to do this instead, + * it works from any process context) + * @protocol_index: which protocol we are starting from zero + * + * This structure represents one protocol supported by the server. An + * array of these structures is passed to libwebsocket_create_server() + * allows as many protocols as you like to be handled by one server. + */ + +struct libwebsocket_protocols { + const char *name; + callback_function *callback; + size_t per_session_data_size; + + /* + * below are filled in on server init and can be left uninitialized, + * no need for user to use them directly either + */ + + struct libwebsocket_context *owning_server; + int broadcast_socket_port; + int broadcast_socket_user_fd; + int protocol_index; +}; + +/** + * struct libwebsocket_extension - An extension we know how to cope with + * + * @name: Formal extension name, eg, "deflate-stream" + * @callback: Service callback + * @per_session_data_size: Libwebsockets will auto-malloc this much + * memory for the use of the extension, a pointer + * to it comes in the @user callback parameter + * @per_context_private_data: Optional storage for this externsion that + * is per-context, so it can track stuff across + * all sessions, etc, if it wants + */ + +struct libwebsocket_extension { + const char *name; + extension_callback_function *callback; + size_t per_session_data_size; + void * per_context_private_data; +}; + + + +LWS_EXTERN struct libwebsocket_context * +libwebsocket_create_context(int port, const char * interf, + struct libwebsocket_protocols *protocols, + struct libwebsocket_extension *extensions, + const char *ssl_cert_filepath, + const char *ssl_private_key_filepath, int gid, int uid, + unsigned int options); + +LWS_EXTERN void +libwebsocket_context_destroy(struct libwebsocket_context *context); + +LWS_EXTERN int +libwebsockets_fork_service_loop(struct libwebsocket_context *context); + +LWS_EXTERN int +libwebsocket_service(struct libwebsocket_context *context, int timeout_ms); + +LWS_EXTERN int +libwebsocket_service_fd(struct libwebsocket_context *context, + struct pollfd *pollfd); + +/* + * IMPORTANT NOTICE! + * + * When sending with websocket protocol (LWS_WRITE_TEXT or LWS_WRITE_BINARY) + * the send buffer has to have LWS_SEND_BUFFER_PRE_PADDING bytes valid BEFORE + * buf, and LWS_SEND_BUFFER_POST_PADDING bytes valid AFTER (buf + len). + * + * This allows us to add protocol info before and after the data, and send as + * one packet on the network without payload copying, for maximum efficiency. + * + * So for example you need this kind of code to use libwebsocket_write with a + * 128-byte payload + * + * char buf[LWS_SEND_BUFFER_PRE_PADDING + 128 + LWS_SEND_BUFFER_POST_PADDING]; + * + * // fill your part of the buffer... for example here it's all zeros + * memset(&buf[LWS_SEND_BUFFER_PRE_PADDING], 0, 128); + * + * libwebsocket_write(wsi, &buf[LWS_SEND_BUFFER_PRE_PADDING], 128); + * + * When sending LWS_WRITE_HTTP, there is no protocol addition and you can just + * use the whole buffer without taking care of the above. + */ + +/* + * this is the frame nonce plus two header plus 8 length + * there's an additional two for mux extension per mux nesting level + * 2 byte prepend on close will already fit because control frames cannot use + * the big length style + */ + +#define LWS_SEND_BUFFER_PRE_PADDING (4 + 10 + (2 * MAX_MUX_RECURSION)) +#define LWS_SEND_BUFFER_POST_PADDING 1 + +LWS_EXTERN int +libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf, size_t len, + enum libwebsocket_write_protocol protocol); + +LWS_EXTERN int +libwebsockets_serve_http_file(struct libwebsocket *wsi, const char *file, + const char *content_type); + +/* notice - you need the pre- and post- padding allocation for buf below */ + +LWS_EXTERN int +libwebsockets_broadcast(const struct libwebsocket_protocols *protocol, + unsigned char *buf, size_t len); + +LWS_EXTERN const struct libwebsocket_protocols * +libwebsockets_get_protocol(struct libwebsocket *wsi); + +LWS_EXTERN int +libwebsocket_callback_on_writable(struct libwebsocket_context *context, + struct libwebsocket *wsi); + +LWS_EXTERN int +libwebsocket_callback_on_writable_all_protocol( + const struct libwebsocket_protocols *protocol); + +LWS_EXTERN int +libwebsocket_get_socket_fd(struct libwebsocket *wsi); + +LWS_EXTERN int +libwebsocket_is_final_fragment(struct libwebsocket *wsi); + +LWS_EXTERN void * +libwebsocket_ensure_user_space(struct libwebsocket *wsi); + +LWS_EXTERN int +libwebsocket_rx_flow_control(struct libwebsocket *wsi, int enable); + +LWS_EXTERN size_t +libwebsockets_remaining_packet_payload(struct libwebsocket *wsi); + +LWS_EXTERN struct libwebsocket * +libwebsocket_client_connect(struct libwebsocket_context *clients, + const char *address, + int port, + int ssl_connection, + const char *path, + const char *host, + const char *origin, + const char *protocol, + int ietf_version_or_minus_one); + +LWS_EXTERN struct libwebsocket * +libwebsocket_client_connect_extended(struct libwebsocket_context *clients, + const char *address, + int port, + int ssl_connection, + const char *path, + const char *host, + const char *origin, + const char *protocol, + int ietf_version_or_minus_one, + void *userdata); + +LWS_EXTERN const char * +libwebsocket_canonical_hostname(struct libwebsocket_context *context); + + +LWS_EXTERN void +libwebsockets_get_peer_addresses(int fd, char *name, int name_len, + char *rip, int rip_len); + +LWS_EXTERN void +libwebsockets_hangup_on_client(struct libwebsocket_context *context, int fd); + +LWS_EXTERN void +libwebsocket_close_and_free_session(struct libwebsocket_context *context, + struct libwebsocket *wsi, enum lws_close_status); + +LWS_EXTERN int +libwebsockets_get_random(struct libwebsocket_context *context, + void *buf, int len); + +LWS_EXTERN int +lws_send_pipe_choked(struct libwebsocket *wsi); + +LWS_EXTERN unsigned char * +libwebsockets_SHA1(const unsigned char *d, size_t n, unsigned char *md); + +LWS_EXTERN int +lws_b64_encode_string(const char *in, int in_len, char *out, int out_size); + +LWS_EXTERN int +lws_b64_decode_string(const char *in, char *out, int out_size); + +LWS_EXTERN struct libwebsocket_extension libwebsocket_internal_extensions[]; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libs/libwebsockets/lib/md5.c b/libs/libwebsockets/lib/md5.c new file mode 100644 index 0000000000..042db3b8e4 --- /dev/null +++ b/libs/libwebsockets/lib/md5.c @@ -0,0 +1,217 @@ +/* + * Modified from Polarssl here + * http://polarssl.org/show_source?file=md5 + * under GPL2 or later + */ + +#include +#include + + +#define GET_ULONG_LE(n, b, i) \ +{ \ + (n) = ((unsigned long)(b)[i]) \ + | ((unsigned long)(b)[(i) + 1] << 8) \ + | ((unsigned long)(b)[(i) + 2] << 16) \ + | ((unsigned long)(b)[(i) + 3] << 24); \ +} + +#define PUT_ULONG_LE(n, b, i) \ +{ \ + (b)[i] = (unsigned char)(n); \ + (b)[(i) + 1] = (unsigned char)((n) >> 8); \ + (b)[(i) + 2] = (unsigned char)((n) >> 16); \ + (b)[(i) + 3] = (unsigned char)((n) >> 24); \ +} + +static const unsigned char md5_padding[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const unsigned long state_init[] = { + 0, 0, 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476 +}; + +static void +md5_process(unsigned long *state, const unsigned char *data) +{ + unsigned long X[16], A, B, C, D; + int v; + + for (v = 0; v < 16; v++) + GET_ULONG_LE(X[v], data, v << 2); + +#define S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) + +#define P(a, b, c, d, k, s, t) { a += F(b, c, d) + X[k] + t; a = S(a, s) + b; } + + A = state[0]; + B = state[1]; + C = state[2]; + D = state[3]; + +#define F(x, y, z) (z ^ (x & (y ^ z))) + + P(A, B, C, D, 0, 7, 0xD76AA478); + P(D, A, B, C, 1, 12, 0xE8C7B756); + P(C, D, A, B, 2, 17, 0x242070DB); + P(B, C, D, A, 3, 22, 0xC1BDCEEE); + P(A, B, C, D, 4, 7, 0xF57C0FAF); + P(D, A, B, C, 5, 12, 0x4787C62A); + P(C, D, A, B, 6, 17, 0xA8304613); + P(B, C, D, A, 7, 22, 0xFD469501); + P(A, B, C, D, 8, 7, 0x698098D8); + P(D, A, B, C, 9, 12, 0x8B44F7AF); + P(C, D, A, B, 10, 17, 0xFFFF5BB1); + P(B, C, D, A, 11, 22, 0x895CD7BE); + P(A, B, C, D, 12, 7, 0x6B901122); + P(D, A, B, C, 13, 12, 0xFD987193); + P(C, D, A, B, 14, 17, 0xA679438E); + P(B, C, D, A, 15, 22, 0x49B40821); + +#undef F + +#define F(x, y, z) (y ^ (z & (x ^ y))) + + P(A, B, C, D, 1, 5, 0xF61E2562); + P(D, A, B, C, 6, 9, 0xC040B340); + P(C, D, A, B, 11, 14, 0x265E5A51); + P(B, C, D, A, 0, 20, 0xE9B6C7AA); + P(A, B, C, D, 5, 5, 0xD62F105D); + P(D, A, B, C, 10, 9, 0x02441453); + P(C, D, A, B, 15, 14, 0xD8A1E681); + P(B, C, D, A, 4, 20, 0xE7D3FBC8); + P(A, B, C, D, 9, 5, 0x21E1CDE6); + P(D, A, B, C, 14, 9, 0xC33707D6); + P(C, D, A, B, 3, 14, 0xF4D50D87); + P(B, C, D, A, 8, 20, 0x455A14ED); + P(A, B, C, D, 13, 5, 0xA9E3E905); + P(D, A, B, C, 2, 9, 0xFCEFA3F8); + P(C, D, A, B, 7, 14, 0x676F02D9); + P(B, C, D, A, 12, 20, 0x8D2A4C8A); + +#undef F + +#define F(x, y, z) (x ^ y ^ z) + + P(A, B, C, D, 5, 4, 0xFFFA3942); + P(D, A, B, C, 8, 11, 0x8771F681); + P(C, D, A, B, 11, 16, 0x6D9D6122); + P(B, C, D, A, 14, 23, 0xFDE5380C); + P(A, B, C, D, 1, 4, 0xA4BEEA44); + P(D, A, B, C, 4, 11, 0x4BDECFA9); + P(C, D, A, B, 7, 16, 0xF6BB4B60); + P(B, C, D, A, 10, 23, 0xBEBFBC70); + P(A, B, C, D, 13, 4, 0x289B7EC6); + P(D, A, B, C, 0, 11, 0xEAA127FA); + P(C, D, A, B, 3, 16, 0xD4EF3085); + P(B, C, D, A, 6, 23, 0x04881D05); + P(A, B, C, D, 9, 4, 0xD9D4D039); + P(D, A, B, C, 12, 11, 0xE6DB99E5); + P(C, D, A, B, 15, 16, 0x1FA27CF8); + P(B, C, D, A, 2, 23, 0xC4AC5665); + +#undef F + +#define F(x, y, z) (y ^ (x | ~z)) + + P(A, B, C, D, 0, 6, 0xF4292244); + P(D, A, B, C, 7, 10, 0x432AFF97); + P(C, D, A, B, 14, 15, 0xAB9423A7); + P(B, C, D, A, 5, 21, 0xFC93A039); + P(A, B, C, D, 12, 6, 0x655B59C3); + P(D, A, B, C, 3, 10, 0x8F0CCC92); + P(C, D, A, B, 10, 15, 0xFFEFF47D); + P(B, C, D, A, 1, 21, 0x85845DD1); + P(A, B, C, D, 8, 6, 0x6FA87E4F); + P(D, A, B, C, 15, 10, 0xFE2CE6E0); + P(C, D, A, B, 6, 15, 0xA3014314); + P(B, C, D, A, 13, 21, 0x4E0811A1); + P(A, B, C, D, 4, 6, 0xF7537E82); + P(D, A, B, C, 11, 10, 0xBD3AF235); + P(C, D, A, B, 2, 15, 0x2AD7D2BB); + P(B, C, D, A, 9, 21, 0xEB86D391); + +#undef F + + state[0] += A; + state[1] += B; + state[2] += C; + state[3] += D; +} + +static +void md5_update(unsigned long *state, unsigned char *buffer, + const unsigned char *input, int ilen) +{ + int fill; + unsigned long left; + + if (ilen <= 0) + return; + + left = state[0] & 0x3F; + fill = 64 - left; + + state[0] += ilen; + state[0] &= 0xFFFFFFFF; + + if (state[0] < (unsigned long)ilen) + state[1]++; + + if (left && ilen >= fill) { + memcpy(buffer + left, input, fill); + md5_process(&state[2], buffer); + input += fill; + ilen -= fill; + left = 0; + } + + while (ilen >= 64) { + md5_process(&state[2], input); + input += 64; + ilen -= 64; + } + + if (ilen > 0) + memcpy(buffer + left, input, ilen); +} + +void +MD5(const unsigned char *input, int ilen, unsigned char *output) +{ + unsigned long last, padn; + unsigned long high, low; + unsigned char msglen[8]; + unsigned long state[6]; + unsigned char buffer[64]; + + memcpy(&state[0], &state_init[0], sizeof(state_init)); + + md5_update(state, buffer, input, ilen); + + high = (state[0] >> 29) | (state[1] << 3); + low = state[0] << 3; + + PUT_ULONG_LE(low, msglen, 0); + PUT_ULONG_LE(high, msglen, 4); + + last = state[0] & 0x3F; + padn = (last < 56) ? (56 - last) : (120 - last); + + md5_update(state, buffer, md5_padding, padn); + md5_update(state, buffer, msglen, 8); + + PUT_ULONG_LE(state[2], output, 0); + PUT_ULONG_LE(state[3], output, 4); + PUT_ULONG_LE(state[4], output, 8); + PUT_ULONG_LE(state[5], output, 12); +} + diff --git a/libs/libwebsockets/lib/parsers.c b/libs/libwebsockets/lib/parsers.c new file mode 100644 index 0000000000..a185971610 --- /dev/null +++ b/libs/libwebsockets/lib/parsers.c @@ -0,0 +1,1967 @@ +/* + * libwebsockets - small server side websockets and web server implementation + * + * Copyright (C) 2010 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include "private-libwebsockets.h" + +const struct lws_tokens lws_tokens[WSI_TOKEN_COUNT] = { + + /* win32 can't do C99 */ + +/* [WSI_TOKEN_GET_URI] = */{ "GET ", 4 }, +/* [WSI_TOKEN_HOST] = */{ "Host:", 5 }, +/* [WSI_TOKEN_CONNECTION] = */{ "Connection:", 11 }, +/* [WSI_TOKEN_KEY1] = */{ "Sec-WebSocket-Key1:", 19 }, +/* [WSI_TOKEN_KEY2] = */{ "Sec-WebSocket-Key2:", 19 }, +/* [WSI_TOKEN_PROTOCOL] = */{ "Sec-WebSocket-Protocol:", 23 }, +/* [WSI_TOKEN_UPGRADE] = */{ "Upgrade:", 8 }, +/* [WSI_TOKEN_ORIGIN] = */{ "Origin:", 7 }, +/* [WSI_TOKEN_DRAFT] = */{ "Sec-WebSocket-Draft:", 20 }, +/* [WSI_TOKEN_CHALLENGE] = */{ "\x0d\x0a", 2 }, + +/* [WSI_TOKEN_KEY] = */{ "Sec-WebSocket-Key:", 18 }, +/* [WSI_TOKEN_VERSION] = */{ "Sec-WebSocket-Version:", 22 }, +/* [WSI_TOKEN_SWORIGIN]= */{ "Sec-WebSocket-Origin:", 21 }, + +/* [WSI_TOKEN_EXTENSIONS] = */{ "Sec-WebSocket-Extensions:", 25 }, + +/* [WSI_TOKEN_ACCEPT] = */{ "Sec-WebSocket-Accept:", 21 }, +/* [WSI_TOKEN_NONCE] = */{ "Sec-WebSocket-Nonce:", 20 }, +/* [WSI_TOKEN_HTTP] = */{ "HTTP/1.1 ", 9 }, +/* [WSI_TOKEN_MUXURL] = */{ "", -1 }, + +}; + +int libwebsocket_parse(struct libwebsocket *wsi, unsigned char c) +{ + int n; + + switch (wsi->parser_state) { + case WSI_TOKEN_GET_URI: + case WSI_TOKEN_HOST: + case WSI_TOKEN_CONNECTION: + case WSI_TOKEN_KEY1: + case WSI_TOKEN_KEY2: + case WSI_TOKEN_PROTOCOL: + case WSI_TOKEN_UPGRADE: + case WSI_TOKEN_ORIGIN: + case WSI_TOKEN_SWORIGIN: + case WSI_TOKEN_DRAFT: + case WSI_TOKEN_CHALLENGE: + case WSI_TOKEN_KEY: + case WSI_TOKEN_VERSION: + case WSI_TOKEN_ACCEPT: + case WSI_TOKEN_NONCE: + case WSI_TOKEN_EXTENSIONS: + case WSI_TOKEN_HTTP: + case WSI_TOKEN_MUXURL: + + debug("WSI_TOKEN_(%d) '%c'\n", wsi->parser_state, c); + + /* collect into malloc'd buffers */ + /* optional space swallow */ + if (!wsi->utf8_token[wsi->parser_state].token_len && c == ' ') + break; + + /* special case space terminator for get-uri */ + if (wsi->parser_state == WSI_TOKEN_GET_URI && c == ' ') { + wsi->utf8_token[wsi->parser_state].token[ + wsi->utf8_token[wsi->parser_state].token_len] = '\0'; + wsi->parser_state = WSI_TOKEN_SKIPPING; + break; + } + + /* allocate appropriate memory */ + if (wsi->utf8_token[wsi->parser_state].token_len == + wsi->current_alloc_len - 1) { + /* need to extend */ + wsi->current_alloc_len += LWS_ADDITIONAL_HDR_ALLOC; + if (wsi->current_alloc_len >= LWS_MAX_HEADER_LEN) { + /* it's waaay to much payload, fail it */ + strcpy(wsi->utf8_token[wsi->parser_state].token, + "!!! Length exceeded maximum supported !!!"); + wsi->parser_state = WSI_TOKEN_SKIPPING; + break; + } + wsi->utf8_token[wsi->parser_state].token = + realloc(wsi->utf8_token[wsi->parser_state].token, + wsi->current_alloc_len); + } + + /* bail at EOL */ + if (wsi->parser_state != WSI_TOKEN_CHALLENGE && c == '\x0d') { + wsi->utf8_token[wsi->parser_state].token[ + wsi->utf8_token[wsi->parser_state].token_len] = '\0'; + wsi->parser_state = WSI_TOKEN_SKIPPING_SAW_CR; + debug("*\n"); + break; + } + + wsi->utf8_token[wsi->parser_state].token[ + wsi->utf8_token[wsi->parser_state].token_len++] = c; + + /* per-protocol end of headers management */ + + if (wsi->parser_state != WSI_TOKEN_CHALLENGE) + break; + + /* -76 has no version header ... server */ + if (!wsi->utf8_token[WSI_TOKEN_VERSION].token_len && + wsi->mode != LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY && + wsi->utf8_token[wsi->parser_state].token_len != 8) + break; + + /* -76 has no version header ... client */ + if (!wsi->utf8_token[WSI_TOKEN_VERSION].token_len && + wsi->mode == LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY && + wsi->utf8_token[wsi->parser_state].token_len != 16) + break; + + /* <= 03 has old handshake with version header needs 8 bytes */ + if (wsi->utf8_token[WSI_TOKEN_VERSION].token_len && + atoi(wsi->utf8_token[WSI_TOKEN_VERSION].token) < 4 && + wsi->utf8_token[wsi->parser_state].token_len != 8) + break; + + /* no payload challenge in 01 + */ + + if (wsi->utf8_token[WSI_TOKEN_VERSION].token_len && + atoi(wsi->utf8_token[WSI_TOKEN_VERSION].token) > 0) { + wsi->utf8_token[WSI_TOKEN_CHALLENGE].token_len = 0; + free(wsi->utf8_token[WSI_TOKEN_CHALLENGE].token); + wsi->utf8_token[WSI_TOKEN_CHALLENGE].token = NULL; + } + + /* For any supported protocol we have enough payload */ + + debug("Setting WSI_PARSING_COMPLETE\n"); + wsi->parser_state = WSI_PARSING_COMPLETE; + break; + + case WSI_INIT_TOKEN_MUXURL: + wsi->parser_state = WSI_TOKEN_MUXURL; + wsi->current_alloc_len = LWS_INITIAL_HDR_ALLOC; + + wsi->utf8_token[wsi->parser_state].token = + malloc(wsi->current_alloc_len); + wsi->utf8_token[wsi->parser_state].token_len = 0; + break; + + /* collecting and checking a name part */ + case WSI_TOKEN_NAME_PART: + debug("WSI_TOKEN_NAME_PART '%c'\n", c); + + if (wsi->name_buffer_pos == sizeof(wsi->name_buffer) - 1) { + /* name bigger than we can handle, skip until next */ + wsi->parser_state = WSI_TOKEN_SKIPPING; + break; + } + wsi->name_buffer[wsi->name_buffer_pos++] = c; + wsi->name_buffer[wsi->name_buffer_pos] = '\0'; + + for (n = 0; n < WSI_TOKEN_COUNT; n++) { + if (wsi->name_buffer_pos != lws_tokens[n].token_len) + continue; + if (strcasecmp(lws_tokens[n].token, wsi->name_buffer)) + continue; + debug("known hdr '%s'\n", wsi->name_buffer); + + /* + * WSORIGIN is protocol equiv to ORIGIN, + * JWebSocket likes to send it, map to ORIGIN + */ + if (n == WSI_TOKEN_SWORIGIN) + n = WSI_TOKEN_ORIGIN; + + wsi->parser_state = WSI_TOKEN_GET_URI + n; + + n = WSI_TOKEN_COUNT; + + /* If the header has been seen already, just append */ + if (wsi->utf8_token[wsi->parser_state].token) + continue; + + wsi->current_alloc_len = LWS_INITIAL_HDR_ALLOC; + wsi->utf8_token[wsi->parser_state].token = + malloc(wsi->current_alloc_len); + wsi->utf8_token[wsi->parser_state].token_len = 0; + } + + /* colon delimiter means we just don't know this name */ + + if (wsi->parser_state == WSI_TOKEN_NAME_PART && c == ':') { + debug("skipping unknown header '%s'\n", + wsi->name_buffer); + wsi->parser_state = WSI_TOKEN_SKIPPING; + break; + } + + if (wsi->parser_state != WSI_TOKEN_CHALLENGE) + break; + + /* don't look for payload when it can just be http headers */ + + if (!wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len) { + /* they're HTTP headers, not websocket upgrade! */ + debug("Setting WSI_PARSING_COMPLETE " + "from http headers\n"); + wsi->parser_state = WSI_PARSING_COMPLETE; + } + + /* 04 version has no packet content after end of hdrs */ + + if (wsi->utf8_token[WSI_TOKEN_VERSION].token_len && + atoi(wsi->utf8_token[WSI_TOKEN_VERSION].token) >= 4) { + debug("04 header completed\n"); + wsi->parser_state = WSI_PARSING_COMPLETE; + wsi->utf8_token[WSI_TOKEN_CHALLENGE].token_len = 0; + free(wsi->utf8_token[WSI_TOKEN_CHALLENGE].token); + wsi->utf8_token[WSI_TOKEN_CHALLENGE].token = NULL; + } + + /* client parser? */ + + if (wsi->ietf_spec_revision >= 4) { + debug("04 header completed\n"); + wsi->parser_state = WSI_PARSING_COMPLETE; + } + + break; + + /* skipping arg part of a name we didn't recognize */ + case WSI_TOKEN_SKIPPING: + debug("WSI_TOKEN_SKIPPING '%c'\n", c); + if (c == '\x0d') + wsi->parser_state = WSI_TOKEN_SKIPPING_SAW_CR; + break; + case WSI_TOKEN_SKIPPING_SAW_CR: + debug("WSI_TOKEN_SKIPPING_SAW_CR '%c'\n", c); + if (c == '\x0a') + wsi->parser_state = WSI_TOKEN_NAME_PART; + else + wsi->parser_state = WSI_TOKEN_SKIPPING; + wsi->name_buffer_pos = 0; + break; + /* we're done, ignore anything else */ + case WSI_PARSING_COMPLETE: + debug("WSI_PARSING_COMPLETE '%c'\n", c); + break; + + default: /* keep gcc happy */ + break; + } + + return 0; +} + +unsigned char +xor_no_mask(struct libwebsocket *wsi, unsigned char c) +{ + return c; +} + +unsigned char +xor_mask_04(struct libwebsocket *wsi, unsigned char c) +{ + c ^= wsi->masking_key_04[wsi->frame_mask_index++]; + if (wsi->frame_mask_index == 20) + wsi->frame_mask_index = 0; + + return c; +} + +unsigned char +xor_mask_05(struct libwebsocket *wsi, unsigned char c) +{ + return c ^ wsi->frame_masking_nonce_04[(wsi->frame_mask_index++) & 3]; +} + + + +int +libwebsocket_rx_sm(struct libwebsocket *wsi, unsigned char c) +{ + int n; + unsigned char buf[20 + 4]; + struct lws_tokens eff_buf; + int handled; + int m; + +#if 0 + fprintf(stderr, "RX: %02X ", c); +#endif + + switch (wsi->lws_rx_parse_state) { + case LWS_RXPS_NEW: + + switch (wsi->ietf_spec_revision) { + /* Firefox 4.0b6 likes this as of 30 Oct 2010 */ + case 0: + if (c == 0xff) + wsi->lws_rx_parse_state = LWS_RXPS_SEEN_76_FF; + if (c == 0) { + wsi->lws_rx_parse_state = + LWS_RXPS_EAT_UNTIL_76_FF; + wsi->rx_user_buffer_head = 0; + } + break; + case 4: + case 5: + case 6: + wsi->all_zero_nonce = 1; + wsi->frame_masking_nonce_04[0] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_04_MASK_NONCE_1; + break; + case 7: + case 8: + case 13: + /* + * no prepended frame key any more + */ + wsi->all_zero_nonce = 1; + goto handle_first; + + default: + fprintf(stderr, "libwebsocket_rx_sm doesn't know " + "about spec version %d\n", wsi->ietf_spec_revision); + break; + } + break; + case LWS_RXPS_04_MASK_NONCE_1: + wsi->frame_masking_nonce_04[1] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_04_MASK_NONCE_2; + break; + case LWS_RXPS_04_MASK_NONCE_2: + wsi->frame_masking_nonce_04[2] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_04_MASK_NONCE_3; + break; + case LWS_RXPS_04_MASK_NONCE_3: + wsi->frame_masking_nonce_04[3] = c; + if (c) + wsi->all_zero_nonce = 0; + + if (wsi->protocol->owning_server->options & + LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK) + goto post_mask; + + if (wsi->ietf_spec_revision > 4) + goto post_sha1; + + /* + * we are able to compute the frame key now + * it's a SHA1 of ( frame nonce we were just sent, concatenated + * with the connection masking key we computed at handshake + * time ) -- yeah every frame from the client invokes a SHA1 + * for no real reason so much for lightweight. + */ + + buf[0] = wsi->frame_masking_nonce_04[0]; + buf[1] = wsi->frame_masking_nonce_04[1]; + buf[2] = wsi->frame_masking_nonce_04[2]; + buf[3] = wsi->frame_masking_nonce_04[3]; + + memcpy(buf + 4, wsi->masking_key_04, 20); + + /* + * wsi->frame_mask_04 will be our recirculating 20-byte XOR key + * for this frame + */ + + SHA1((unsigned char *)buf, 4 + 20, wsi->frame_mask_04); + +post_sha1: + + /* + * start from the zero'th byte in the XOR key buffer since + * this is the start of a frame with a new key + */ + + wsi->frame_mask_index = 0; + +post_mask: + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_1; + break; + + /* + * 04 logical framing from the spec (all this is masked when incoming + * and has to be unmasked) + * + * We ignore the possibility of extension data because we don't + * negotiate any extensions at the moment. + * + * 0 1 2 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-------+-+-------------+-------------------------------+ + * |F|R|R|R| opcode|R| Payload len | Extended payload length | + * |I|S|S|S| (4) |S| (7) | (16/63) | + * |N|V|V|V| |V| | (if payload len==126/127) | + * | |1|2|3| |4| | | + * +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + + * | Extended payload length continued, if payload len == 127 | + * + - - - - - - - - - - - - - - - +-------------------------------+ + * | | Extension data | + * +-------------------------------+ - - - - - - - - - - - - - - - + + * : : + * +---------------------------------------------------------------+ + * : Application data : + * +---------------------------------------------------------------+ + * + * We pass payload through to userland as soon as we get it, ignoring + * FIN. It's up to userland to buffer it up if it wants to see a + * whole unfragmented block of the original size (which may be up to + * 2^63 long!) + */ + + case LWS_RXPS_04_FRAME_HDR_1: +handle_first: + + /* + * 04 spec defines the opcode like this: (1, 2, and 3 are + * "control frame" opcodes which may not be fragmented or + * have size larger than 126) + * + * frame-opcode = + * %x0 ; continuation frame + * / %x1 ; connection close + * / %x2 ; ping + * / %x3 ; pong + * / %x4 ; text frame + * / %x5 ; binary frame + * / %x6-F ; reserved + * + * FIN (b7) + */ + + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + + if (c & 0x70) + fprintf(stderr, + "Frame has unknown extension bits set 1 %02X\n", c); + + /* translate all incoming opcodes into v7+ map */ + if (wsi->ietf_spec_revision < 7) + switch (c & 0xf) { + case LWS_WS_OPCODE_04__CONTINUATION: + wsi->opcode = LWS_WS_OPCODE_07__CONTINUATION; + break; + case LWS_WS_OPCODE_04__CLOSE: + wsi->opcode = LWS_WS_OPCODE_07__CLOSE; + break; + case LWS_WS_OPCODE_04__PING: + wsi->opcode = LWS_WS_OPCODE_07__PING; + break; + case LWS_WS_OPCODE_04__PONG: + wsi->opcode = LWS_WS_OPCODE_07__PONG; + break; + case LWS_WS_OPCODE_04__TEXT_FRAME: + wsi->opcode = LWS_WS_OPCODE_07__TEXT_FRAME; + break; + case LWS_WS_OPCODE_04__BINARY_FRAME: + wsi->opcode = LWS_WS_OPCODE_07__BINARY_FRAME; + break; + default: + fprintf(stderr, "reserved opcodes not " + "usable pre v7 protocol\n"); + return -1; + } + else + wsi->opcode = c & 0xf; + + wsi->final = !!((c >> 7) & 1); + + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN: + + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + + if ((c & 0x80) && wsi->ietf_spec_revision < 7) { + fprintf(stderr, "Frame has extensions " + "set illegally 2\n"); + /* kill the connection */ + return -1; + } + + wsi->this_frame_masked = !!(c & 0x80); + + switch (c & 0x7f) { + case 126: + /* control frames are not allowed to have big lengths */ + if (wsi->opcode & 8) + goto illegal_ctl_length; + + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_2; + break; + case 127: + /* control frames are not allowed to have big lengths */ + if (wsi->opcode & 8) + goto illegal_ctl_length; + + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_8; + break; + default: + wsi->rx_packet_length = c & 0x7f; + if (wsi->this_frame_masked) + wsi->lws_rx_parse_state = + LWS_RXPS_07_COLLECT_FRAME_KEY_1; + else + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + break; + } + break; + + case LWS_RXPS_04_FRAME_HDR_LEN16_2: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + + wsi->rx_packet_length = c << 8; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_1; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN16_1: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + + wsi->rx_packet_length |= c; + if (wsi->this_frame_masked) + wsi->lws_rx_parse_state = + LWS_RXPS_07_COLLECT_FRAME_KEY_1; + else + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_8: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + if (c & 0x80) { + fprintf(stderr, "b63 of length must be zero\n"); + /* kill the connection */ + return -1; + } +#if defined __LP64__ + wsi->rx_packet_length = ((size_t)c) << 56; +#else + wsi->rx_packet_length = 0; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_7; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_7: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); +#if defined __LP64__ + wsi->rx_packet_length |= ((size_t)c) << 48; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_6; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_6: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); +#if defined __LP64__ + wsi->rx_packet_length |= ((size_t)c) << 40; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_5; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_5: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); +#if defined __LP64__ + wsi->rx_packet_length |= ((size_t)c) << 32; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_4; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_4: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + wsi->rx_packet_length |= ((size_t)c) << 24; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_3; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_3: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + wsi->rx_packet_length |= ((size_t)c) << 16; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_2; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_2: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + wsi->rx_packet_length |= ((size_t)c) << 8; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_1; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_1: + if (wsi->ietf_spec_revision < 7) + c = wsi->xor_mask(wsi, c); + wsi->rx_packet_length |= ((size_t)c); + if (wsi->this_frame_masked) + wsi->lws_rx_parse_state = + LWS_RXPS_07_COLLECT_FRAME_KEY_1; + else + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + break; + + case LWS_RXPS_EAT_UNTIL_76_FF: + if (c == 0xff) { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto issue; + } + wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + + (wsi->rx_user_buffer_head++)] = c; + + if (wsi->rx_user_buffer_head != MAX_USER_RX_BUFFER) + break; +issue: + if (wsi->protocol->callback) + wsi->protocol->callback(wsi->protocol->owning_server, + wsi, LWS_CALLBACK_RECEIVE, + wsi->user_space, + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head); + wsi->rx_user_buffer_head = 0; + break; + case LWS_RXPS_SEEN_76_FF: + if (c) + break; + + debug("Seen that client is requesting " + "a v76 close, sending ack\n"); + buf[0] = 0xff; + buf[1] = 0; + n = libwebsocket_write(wsi, buf, 2, LWS_WRITE_HTTP); + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + return -1; + } + debug(" v76 close ack sent, server closing skt\n"); + /* returning < 0 will get it closed in parent */ + return -1; + + case LWS_RXPS_PULLING_76_LENGTH: + break; + + + case LWS_RXPS_07_COLLECT_FRAME_KEY_1: + wsi->frame_masking_nonce_04[0] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_2; + break; + + case LWS_RXPS_07_COLLECT_FRAME_KEY_2: + wsi->frame_masking_nonce_04[1] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_3; + break; + + case LWS_RXPS_07_COLLECT_FRAME_KEY_3: + wsi->frame_masking_nonce_04[2] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_4; + break; + + case LWS_RXPS_07_COLLECT_FRAME_KEY_4: + wsi->frame_masking_nonce_04[3] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + wsi->frame_mask_index = 0; + break; + + + case LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED: + if (wsi->ietf_spec_revision < 4 || + (wsi->all_zero_nonce && wsi->ietf_spec_revision >= 5)) + wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + + (wsi->rx_user_buffer_head++)] = c; + else + wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + + (wsi->rx_user_buffer_head++)] = + wsi->xor_mask(wsi, c); + + if (--wsi->rx_packet_length == 0) { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto spill; + } + if (wsi->rx_user_buffer_head != MAX_USER_RX_BUFFER) + break; +spill: + /* + * is this frame a control packet we should take care of at this + * layer? If so service it and hide it from the user callback + */ + + debug("spill on %s\n", wsi->protocol->name); + + switch (wsi->opcode) { + case LWS_WS_OPCODE_07__CLOSE: + /* is this an acknowledgement of our close? */ + if (wsi->state == WSI_STATE_AWAITING_CLOSE_ACK) { + /* + * fine he has told us he is closing too, let's + * finish our close + */ + debug("seen client close ack\n"); + return -1; + } + debug("server sees client close packet\n"); + /* parrot the close packet payload back */ + n = libwebsocket_write(wsi, (unsigned char *) + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head, LWS_WRITE_CLOSE); + wsi->state = WSI_STATE_RETURNED_CLOSE_ALREADY; + /* close the connection */ + return -1; + + case LWS_WS_OPCODE_07__PING: + /* parrot the ping packet payload back as a pong */ + n = libwebsocket_write(wsi, (unsigned char *) + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head, LWS_WRITE_PONG); + /* ... then just drop it */ + wsi->rx_user_buffer_head = 0; + return 0; + + case LWS_WS_OPCODE_07__PONG: + /* keep the statistics... */ + wsi->pings_vs_pongs--; + /* ... then just drop it */ + wsi->rx_user_buffer_head = 0; + return 0; + + case LWS_WS_OPCODE_07__TEXT_FRAME: + case LWS_WS_OPCODE_07__BINARY_FRAME: + break; + + default: + + debug("passing opcode %x up to exts\n", wsi->opcode); + + /* + * It's something special we can't understand here. + * Pass the payload up to the extension's parsing + * state machine. + */ + + eff_buf.token = &wsi->rx_user_buffer[ + LWS_SEND_BUFFER_PRE_PADDING]; + eff_buf.token_len = wsi->rx_user_buffer_head; + + handled = 0; + for (n = 0; n < wsi->count_active_extensions; n++) { + m = wsi->active_extensions[n]->callback( + wsi->protocol->owning_server, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_EXTENDED_PAYLOAD_RX, + wsi->active_extensions_user[n], + &eff_buf, 0); + if (m) + handled = 1; + } + + if (!handled) + fprintf(stderr, "Unhandled extended opcode " + "0x%x - ignoring frame\n", wsi->opcode); + + wsi->rx_user_buffer_head = 0; + return 0; + } + + /* + * No it's real payload, pass it up to the user callback. + * It's nicely buffered with the pre-padding taken care of + * so it can be sent straight out again using libwebsocket_write + */ + + wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + + wsi->rx_user_buffer_head] = '\0'; + + if (wsi->protocol->callback) + wsi->protocol->callback(wsi->protocol->owning_server, + wsi, LWS_CALLBACK_RECEIVE, + wsi->user_space, + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head); + else + fprintf(stderr, "No callback on payload spill!\n"); + + wsi->rx_user_buffer_head = 0; + break; + } + + return 0; + +illegal_ctl_length: + + fprintf(stderr, "Control frame asking for " + "extended length is illegal\n"); + /* kill the connection */ + return -1; +} + + +int libwebsocket_client_rx_sm(struct libwebsocket *wsi, unsigned char c) +{ + int n; + unsigned char buf[20 + 4]; + int callback_action = LWS_CALLBACK_CLIENT_RECEIVE; + int handled; + struct lws_tokens eff_buf; + int m; + + debug(" CRX: %02X %d\n", c, wsi->lws_rx_parse_state); + + switch (wsi->lws_rx_parse_state) { + case LWS_RXPS_NEW: + + switch (wsi->ietf_spec_revision) { + /* Firefox 4.0b6 likes this as of 30 Oct */ + case 0: + if (c == 0xff) + wsi->lws_rx_parse_state = LWS_RXPS_SEEN_76_FF; + if (c == 0) { + wsi->lws_rx_parse_state = + LWS_RXPS_EAT_UNTIL_76_FF; + wsi->rx_user_buffer_head = 0; + } + break; + case 4: + case 5: + case 6: + case 7: + case 8: + case 13: + /* + * 04 logical framing from the spec (all this is masked when + * incoming and has to be unmasked) + * + * We ignore the possibility of extension data because we don't + * negotiate any extensions at the moment. + * + * 0 1 2 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-------+-+-------------+-------------------------------+ + * |F|R|R|R| opcode|R| Payload len | Extended payload length | + * |I|S|S|S| (4) |S| (7) | (16/63) | + * |N|V|V|V| |V| | (if payload len==126/127) | + * | |1|2|3| |4| | | + * +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - + + * | Extended payload length continued, if payload len == 127 | + * + - - - - - - - - - - - - - - - +-------------------------------+ + * | | Extension data | + * +-------------------------------+ - - - - - - - - - - - - - - - + + * : : + * +---------------------------------------------------------------+ + * : Application data : + * +---------------------------------------------------------------+ + * + * We pass payload through to userland as soon as we get it, ignoring + * FIN. It's up to userland to buffer it up if it wants to see a + * whole unfragmented block of the original size (which may be up to + * 2^63 long!) + * + * Notice in v7 RSV4 is set to indicate 32-bit frame key is coming in + * after length, unlike extension data which is now deprecated, this + * does not impact the payload length calculation. + */ + + /* + * 04 spec defines the opcode like this: (1, 2, and 3 are + * "control frame" opcodes which may not be fragmented or + * have size larger than 126) + * + * frame-opcode = + * %x0 ; continuation frame + * / %x1 ; connection close + * / %x2 ; ping + * / %x3 ; pong + * / %x4 ; text frame + * / %x5 ; binary frame + * / %x6-F ; reserved + * + * FIN (b7) + */ + + if (c & 0x70) + fprintf(stderr, "Frame has unknown extension " + "bits set on first framing byte %02X\n", c); + + if (wsi->ietf_spec_revision < 7) + switch (c & 0xf) { + case LWS_WS_OPCODE_04__CONTINUATION: + wsi->opcode = + LWS_WS_OPCODE_07__CONTINUATION; + break; + case LWS_WS_OPCODE_04__CLOSE: + wsi->opcode = LWS_WS_OPCODE_07__CLOSE; + break; + case LWS_WS_OPCODE_04__PING: + wsi->opcode = LWS_WS_OPCODE_07__PING; + break; + case LWS_WS_OPCODE_04__PONG: + wsi->opcode = LWS_WS_OPCODE_07__PONG; + break; + case LWS_WS_OPCODE_04__TEXT_FRAME: + wsi->opcode = + LWS_WS_OPCODE_07__TEXT_FRAME; + break; + case LWS_WS_OPCODE_04__BINARY_FRAME: + wsi->opcode = + LWS_WS_OPCODE_07__BINARY_FRAME; + break; + default: + fprintf(stderr, "reserved opcodes not " + "usable pre v7 protocol\n"); + return -1; + } + else + wsi->opcode = c & 0xf; + + wsi->final = !!((c >> 7) & 1); + + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN; + break; + + default: + fprintf(stderr, "client_rx_sm doesn't know how " + "to handle spec version %02d\n", + wsi->ietf_spec_revision); + break; + } + break; + + + case LWS_RXPS_04_FRAME_HDR_LEN: + + if ((c & 0x80) && wsi->ietf_spec_revision < 7) { + fprintf(stderr, + "Frame has extensions set illegally 4\n"); + /* kill the connection */ + return -1; + } + + wsi->this_frame_masked = !!(c & 0x80); + + switch (c & 0x7f) { + case 126: + /* control frames are not allowed to have big lengths */ + if (wsi->opcode & 8) + goto illegal_ctl_length; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_2; + break; + case 127: + /* control frames are not allowed to have big lengths */ + if (wsi->opcode & 8) + goto illegal_ctl_length; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_8; + break; + default: + wsi->rx_packet_length = c; + if (wsi->this_frame_masked) + wsi->lws_rx_parse_state = + LWS_RXPS_07_COLLECT_FRAME_KEY_1; + else { + if (c) + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + else { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto spill; + } + } + break; + } + break; + + case LWS_RXPS_04_FRAME_HDR_LEN16_2: + wsi->rx_packet_length = c << 8; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN16_1; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN16_1: + wsi->rx_packet_length |= c; + if (wsi->this_frame_masked) + wsi->lws_rx_parse_state = + LWS_RXPS_07_COLLECT_FRAME_KEY_1; + else { + if (wsi->rx_packet_length) + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + else { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto spill; + } + } + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_8: + if (c & 0x80) { + fprintf(stderr, "b63 of length must be zero\n"); + /* kill the connection */ + return -1; + } +#if defined __LP64__ + wsi->rx_packet_length = ((size_t)c) << 56; +#else + wsi->rx_packet_length = 0; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_7; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_7: +#if defined __LP64__ + wsi->rx_packet_length |= ((size_t)c) << 48; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_6; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_6: +#if defined __LP64__ + wsi->rx_packet_length |= ((size_t)c) << 40; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_5; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_5: +#if defined __LP64__ + wsi->rx_packet_length |= ((size_t)c) << 32; +#endif + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_4; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_4: + wsi->rx_packet_length |= ((size_t)c) << 24; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_3; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_3: + wsi->rx_packet_length |= ((size_t)c) << 16; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_2; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_2: + wsi->rx_packet_length |= ((size_t)c) << 8; + wsi->lws_rx_parse_state = LWS_RXPS_04_FRAME_HDR_LEN64_1; + break; + + case LWS_RXPS_04_FRAME_HDR_LEN64_1: + wsi->rx_packet_length |= (size_t)c; + if (wsi->this_frame_masked) + wsi->lws_rx_parse_state = + LWS_RXPS_07_COLLECT_FRAME_KEY_1; + else { + if (wsi->rx_packet_length) + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + else { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto spill; + } + } + break; + + case LWS_RXPS_07_COLLECT_FRAME_KEY_1: + wsi->frame_masking_nonce_04[0] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_2; + break; + + case LWS_RXPS_07_COLLECT_FRAME_KEY_2: + wsi->frame_masking_nonce_04[1] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_3; + break; + + case LWS_RXPS_07_COLLECT_FRAME_KEY_3: + wsi->frame_masking_nonce_04[2] = c; + if (c) + wsi->all_zero_nonce = 0; + wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_4; + break; + + case LWS_RXPS_07_COLLECT_FRAME_KEY_4: + wsi->frame_masking_nonce_04[3] = c; + if (c) + wsi->all_zero_nonce = 0; + + if (wsi->rx_packet_length) + wsi->lws_rx_parse_state = + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + else { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto spill; + } + break; + + case LWS_RXPS_EAT_UNTIL_76_FF: + if (c == 0xff) { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto issue; + } + wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + + (wsi->rx_user_buffer_head++)] = c; + + if (wsi->rx_user_buffer_head != MAX_USER_RX_BUFFER) + break; +issue: + if (wsi->protocol->callback) + wsi->protocol->callback(wsi->protocol->owning_server, + wsi, + LWS_CALLBACK_CLIENT_RECEIVE, + wsi->user_space, + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head); + wsi->rx_user_buffer_head = 0; + break; + case LWS_RXPS_SEEN_76_FF: + if (c) + break; + + debug("Seen that client is requesting " + "a v76 close, sending ack\n"); + buf[0] = 0xff; + buf[1] = 0; + n = libwebsocket_write(wsi, buf, 2, LWS_WRITE_HTTP); + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + return -1; + } + debug(" v76 close ack sent, server closing skt\n"); + /* returning < 0 will get it closed in parent */ + return -1; + + case LWS_RXPS_PULLING_76_LENGTH: + break; + + case LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED: + if ((!wsi->this_frame_masked) || wsi->all_zero_nonce) + wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + + (wsi->rx_user_buffer_head++)] = c; + else + wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + + (wsi->rx_user_buffer_head++)] = + wsi->xor_mask(wsi, c); + + if (--wsi->rx_packet_length == 0) { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto spill; + } + if (wsi->rx_user_buffer_head != MAX_USER_RX_BUFFER) + break; +spill: + + handled = 0; + + /* + * is this frame a control packet we should take care of at this + * layer? If so service it and hide it from the user callback + */ + + switch (wsi->opcode) { + case LWS_WS_OPCODE_07__CLOSE: + /* is this an acknowledgement of our close? */ + if (wsi->state == WSI_STATE_AWAITING_CLOSE_ACK) { + /* + * fine he has told us he is closing too, let's + * finish our close + */ + debug("seen server's close ack\n"); + return -1; + } + debug("client sees server close packet len = %d\n", wsi->rx_user_buffer_head); + /* parrot the close packet payload back */ + n = libwebsocket_write(wsi, (unsigned char *) + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head, LWS_WRITE_CLOSE); + debug("client writing close ack returned %d\n", n); + wsi->state = WSI_STATE_RETURNED_CLOSE_ALREADY; + /* close the connection */ + return -1; + + case LWS_WS_OPCODE_07__PING: + /* parrot the ping packet payload back as a pong*/ + n = libwebsocket_write(wsi, (unsigned char *) + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head, LWS_WRITE_PONG); + handled = 1; + break; + + case LWS_WS_OPCODE_07__PONG: + /* keep the statistics... */ + wsi->pings_vs_pongs--; + + /* issue it */ + callback_action = LWS_CALLBACK_CLIENT_RECEIVE_PONG; + break; + + case LWS_WS_OPCODE_07__CONTINUATION: + case LWS_WS_OPCODE_07__TEXT_FRAME: + case LWS_WS_OPCODE_07__BINARY_FRAME: + break; + + default: + + debug("Reserved opcode 0x%2X\n", wsi->opcode); + /* + * It's something special we can't understand here. + * Pass the payload up to the extension's parsing + * state machine. + */ + + eff_buf.token = &wsi->rx_user_buffer[ + LWS_SEND_BUFFER_PRE_PADDING]; + eff_buf.token_len = wsi->rx_user_buffer_head; + + for (n = 0; n < wsi->count_active_extensions; n++) { + m = wsi->active_extensions[n]->callback( + wsi->protocol->owning_server, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_EXTENDED_PAYLOAD_RX, + wsi->active_extensions_user[n], + &eff_buf, 0); + if (m) + handled = 1; + } + + if (!handled) { + fprintf(stderr, "Unhandled extended opcode " + "0x%x - ignoring frame\n", wsi->opcode); + wsi->rx_user_buffer_head = 0; + + return 0; + } + + break; + } + + /* + * No it's real payload, pass it up to the user callback. + * It's nicely buffered with the pre-padding taken care of + * so it can be sent straight out again using libwebsocket_write + */ + + if (!handled && wsi->protocol->callback) + wsi->protocol->callback(wsi->protocol->owning_server, + wsi, callback_action, + wsi->user_space, + &wsi->rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING], + wsi->rx_user_buffer_head); + wsi->rx_user_buffer_head = 0; + break; + default: + fprintf(stderr, "client rx illegal state\n"); + return 1; + } + + return 0; + +illegal_ctl_length: + + fprintf(stderr, "Control frame asking for " + "extended length is illegal\n"); + /* kill the connection */ + return -1; + +} + + + +int libwebsocket_interpret_incoming_packet(struct libwebsocket *wsi, + unsigned char *buf, size_t len) +{ + int n; + +#ifdef DEBUG + fprintf(stderr, "received %d byte packet\n", (int)len); + for (n = 0; n < len; n++) + fprintf(stderr, "%02X ", buf[n]); + fprintf(stderr, "\n"); +#endif + + /* let the rx protocol state machine have as much as it needs */ + + n = 0; + while (n < len) + if (libwebsocket_rx_sm(wsi, buf[n++]) < 0) + return -1; + + return 0; +} + + +static int +libwebsocket_0405_frame_mask_generate(struct libwebsocket *wsi) +{ + char buf[4 + 20]; + int n; + + /* fetch the per-frame nonce */ + + n = libwebsockets_get_random(wsi->protocol->owning_server, + wsi->frame_masking_nonce_04, 4); + if (n != 4) { + fprintf(stderr, "Unable to read from random device %s %d\n", + SYSTEM_RANDOM_FILEPATH, n); + return 1; + } + + /* start masking from first byte of masking key buffer */ + wsi->frame_mask_index = 0; + + if (wsi->ietf_spec_revision != 4) + return 0; + + /* 04 only does SHA-1 more complex key */ + + /* + * the frame key is the frame nonce (4 bytes) followed by the + * connection masking key, hashed by SHA1 + */ + + memcpy(buf, wsi->frame_masking_nonce_04, 4); + + memcpy(buf + 4, wsi->masking_key_04, 20); + + /* concatenate the nonce with the connection key then hash it */ + + SHA1((unsigned char *)buf, 4 + 20, wsi->frame_mask_04); + + return 0; +} + +void lws_stderr_hexdump(unsigned char *buf, size_t len) +{ + int n; + int m; + int start; + + fprintf(stderr, "\n"); + + for (n = 0; n < len;) { + start = n; + + fprintf(stderr, "%04X: ", start); + + for (m = 0; m < 16 && n < len; m++) + fprintf(stderr, "%02X ", buf[n++]); + while (m++ < 16) + fprintf(stderr, " "); + + fprintf(stderr, " "); + + for (m = 0; m < 16 && (start + m) < len; m++) { + if (buf[start + m] >= ' ' && buf[start + m] <= 127) + fprintf(stderr, "%c", buf[start + m]); + else + fprintf(stderr, "."); + } + while (m++ < 16) + fprintf(stderr, " "); + + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); +} + +int lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len) +{ + int n; + int m; + + /* + * one of the extensions is carrying our data itself? Like mux? + */ + + for (n = 0; n < wsi->count_active_extensions; n++) { + /* + * there can only be active extensions after handshake completed + * so we can rely on protocol being set already in here + */ + m = wsi->active_extensions[n]->callback( + wsi->protocol->owning_server, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_PACKET_TX_DO_SEND, + wsi->active_extensions_user[n], &buf, len); + if (m < 0) { + fprintf(stderr, "Extension reports fatal error\n"); + return -1; + } + if (m) /* handled */ { +/* fprintf(stderr, "ext sent it\n"); */ + return 0; + } + } + + if (!wsi->sock) + fprintf(stderr, "** error 0 sock but expected to send\n"); + + /* + * nope, send it on the socket directly + */ + +#if 0 + fprintf(stderr, " TX: "); + lws_stderr_hexdump(buf, len); +#endif + +#ifdef LWS_OPENSSL_SUPPORT + if (wsi->ssl) { + n = SSL_write(wsi->ssl, buf, len); + if (n < 0) { + fprintf(stderr, + "ERROR writing to socket\n"); + return -1; + } + } else { +#endif + n = send(wsi->sock, buf, len, MSG_NOSIGNAL); + if (n < 0) { + fprintf(stderr, + "ERROR writing to socket\n"); + return -1; + } +#ifdef LWS_OPENSSL_SUPPORT + } +#endif + return 0; +} + +int +lws_issue_raw_ext_access(struct libwebsocket *wsi, + unsigned char *buf, size_t len) +{ + int ret; + struct lws_tokens eff_buf; + int m; + int n; + + eff_buf.token = (char *)buf; + eff_buf.token_len = len; + + /* + * while we have original buf to spill ourselves, or extensions report + * more in their pipeline + */ + + ret = 1; + while (ret == 1) { + + /* default to nobody has more to spill */ + + ret = 0; + + /* show every extension the new incoming data */ + + for (n = 0; n < wsi->count_active_extensions; n++) { + m = wsi->active_extensions[n]->callback( + wsi->protocol->owning_server, + wsi->active_extensions[n], wsi, + LWS_EXT_CALLBACK_PACKET_TX_PRESEND, + wsi->active_extensions_user[n], &eff_buf, 0); + if (m < 0) { + fprintf(stderr, "Extension: fatal error\n"); + return -1; + } + if (m) + /* + * at least one extension told us he has more + * to spill, so we will go around again after + */ + ret = 1; + } + + /* assuming they left us something to send, send it */ + + if (eff_buf.token_len) + if (lws_issue_raw(wsi, (unsigned char *)eff_buf.token, + eff_buf.token_len)) + return -1; + + /* we used up what we had */ + + eff_buf.token = NULL; + eff_buf.token_len = 0; + + /* + * Did that leave the pipe choked? + */ + + if (!lws_send_pipe_choked(wsi)) + /* no we could add more */ + continue; + + debug("choked\n"); + + /* + * Yes, he's choked. Don't spill the rest now get a callback + * when he is ready to send and take care of it there + */ + libwebsocket_callback_on_writable( + wsi->protocol->owning_server, wsi); + wsi->extension_data_pending = 1; + ret = 0; + } + + debug("written %d bytes to client\n", eff_buf.token_len); + + return 0; +} + +/** + * libwebsocket_write() - Apply protocol then write data to client + * @wsi: Websocket instance (available from user callback) + * @buf: The data to send. For data being sent on a websocket + * connection (ie, not default http), this buffer MUST have + * LWS_SEND_BUFFER_PRE_PADDING bytes valid BEFORE the pointer + * and an additional LWS_SEND_BUFFER_POST_PADDING bytes valid + * in the buffer after (buf + len). This is so the protocol + * header and trailer data can be added in-situ. + * @len: Count of the data bytes in the payload starting from buf + * @protocol: Use LWS_WRITE_HTTP to reply to an http connection, and one + * of LWS_WRITE_BINARY or LWS_WRITE_TEXT to send appropriate + * data on a websockets connection. Remember to allow the extra + * bytes before and after buf if LWS_WRITE_BINARY or LWS_WRITE_TEXT + * are used. + * + * This function provides the way to issue data back to the client + * for both http and websocket protocols. + * + * In the case of sending using websocket protocol, be sure to allocate + * valid storage before and after buf as explained above. This scheme + * allows maximum efficiency of sending data and protocol in a single + * packet while not burdening the user code with any protocol knowledge. + */ + +int libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf, + size_t len, enum libwebsocket_write_protocol protocol) +{ + int n; + int pre = 0; + int post = 0; + int shift = 7; + int masked7 = wsi->mode == LWS_CONNMODE_WS_CLIENT && + wsi->xor_mask != xor_no_mask; + unsigned char *dropmask = NULL; + unsigned char is_masked_bit = 0; + + if (len == 0 && protocol != LWS_WRITE_CLOSE) { + fprintf(stderr, "zero length libwebsocket_write attempt\n"); + return 0; + } + + if (protocol == LWS_WRITE_HTTP) + goto send_raw; + + /* websocket protocol, either binary or text */ + + if (wsi->state != WSI_STATE_ESTABLISHED) + return -1; + + switch (wsi->ietf_spec_revision) { + /* chrome likes this as of 30 Oct 2010 */ + /* Firefox 4.0b6 likes this as of 30 Oct 2010 */ + case 0: + if ((protocol & 0xf) == LWS_WRITE_BINARY) { + /* in binary mode we send 7-bit used length blocks */ + pre = 1; + while (len & (127 << shift)) { + pre++; + shift += 7; + } + n = 0; + shift -= 7; + while (shift >= 0) { + if (shift) + buf[0 - pre + n] = + ((len >> shift) & 127) | 0x80; + else + buf[0 - pre + n] = + ((len >> shift) & 127); + n++; + shift -= 7; + } + break; + } + + /* frame type = text, length-free spam mode */ + + pre = 1; + buf[-pre] = 0; + buf[len] = 0xff; /* EOT marker */ + post = 1; + break; + + case 7: + case 8: + case 13: + if (masked7) { + pre += 4; + dropmask = &buf[0 - pre]; + is_masked_bit = 0x80; + } + /* fallthru */ + case 4: + case 5: + case 6: + switch (protocol & 0xf) { + case LWS_WRITE_TEXT: + if (wsi->ietf_spec_revision < 7) + n = LWS_WS_OPCODE_04__TEXT_FRAME; + else + n = LWS_WS_OPCODE_07__TEXT_FRAME; + break; + case LWS_WRITE_BINARY: + if (wsi->ietf_spec_revision < 7) + n = LWS_WS_OPCODE_04__BINARY_FRAME; + else + n = LWS_WS_OPCODE_07__BINARY_FRAME; + break; + case LWS_WRITE_CONTINUATION: + if (wsi->ietf_spec_revision < 7) + n = LWS_WS_OPCODE_04__CONTINUATION; + else + n = LWS_WS_OPCODE_07__CONTINUATION; + break; + + case LWS_WRITE_CLOSE: + if (wsi->ietf_spec_revision < 7) + n = LWS_WS_OPCODE_04__CLOSE; + else + n = LWS_WS_OPCODE_07__CLOSE; + + /* + * v5 mandates the first byte of close packet + * in both client and server directions + */ + + switch (wsi->ietf_spec_revision) { + case 0: + case 4: + break; + case 5: + /* we can do this because we demand post-buf */ + + if (len < 1) + len = 1; + + switch (wsi->mode) { + case LWS_CONNMODE_WS_SERVING: + /* + fprintf(stderr, "LWS_WRITE_CLOSE S\n"); + */ + buf[0] = 'S'; + break; + case LWS_CONNMODE_WS_CLIENT: + /* + fprintf(stderr, "LWS_WRITE_CLOSE C\n"); + */ + buf[0] = 'C'; + break; + default: + break; + } + break; + default: + /* + * 06 has a 2-byte status code in network order + * we can do this because we demand post-buf + */ + + if (wsi->close_reason) { + /* reason codes count as data bytes */ + buf -= 2; + buf[0] = wsi->close_reason >> 8; + buf[1] = wsi->close_reason; + len += 2; + } + break; + } + break; + case LWS_WRITE_PING: + if (wsi->ietf_spec_revision < 7) + n = LWS_WS_OPCODE_04__PING; + else + n = LWS_WS_OPCODE_07__PING; + + wsi->pings_vs_pongs++; + break; + case LWS_WRITE_PONG: + if (wsi->ietf_spec_revision < 7) + n = LWS_WS_OPCODE_04__PONG; + else + n = LWS_WS_OPCODE_07__PONG; + break; + default: + fprintf(stderr, "libwebsocket_write: unknown write " + "opcode / protocol\n"); + return -1; + } + + if (!(protocol & LWS_WRITE_NO_FIN)) + n |= 1 << 7; + + if (len < 126) { + pre += 2; + buf[-pre] = n; + buf[-pre + 1] = len | is_masked_bit; + } else { + if (len < 65536) { + pre += 4; + buf[-pre] = n; + buf[-pre + 1] = 126 | is_masked_bit; + buf[-pre + 2] = len >> 8; + buf[-pre + 3] = len; + } else { + pre += 10; + buf[-pre] = n; + buf[-pre + 1] = 127 | is_masked_bit; +#if defined __LP64__ + buf[-pre + 2] = (len >> 56) & 0x7f; + buf[-pre + 3] = len >> 48; + buf[-pre + 4] = len >> 40; + buf[-pre + 5] = len >> 32; +#else + buf[-pre + 2] = 0; + buf[-pre + 3] = 0; + buf[-pre + 4] = 0; + buf[-pre + 5] = 0; +#endif + buf[-pre + 6] = len >> 24; + buf[-pre + 7] = len >> 16; + buf[-pre + 8] = len >> 8; + buf[-pre + 9] = len; + } + } + break; + } + + /* + * Deal with masking if we are in client -> server direction and + * the protocol demands it + */ + + if (wsi->mode == LWS_CONNMODE_WS_CLIENT && + wsi->ietf_spec_revision >= 4) { + + /* + * this is only useful for security tests where it's required + * to control the raw packet payload content + */ + + if (!(protocol & LWS_WRITE_CLIENT_IGNORE_XOR_MASK) && + wsi->xor_mask != xor_no_mask) { + + if (libwebsocket_0405_frame_mask_generate(wsi)) { + fprintf(stderr, "libwebsocket_write: " + "frame mask generation failed\n"); + return 1; + } + + + if (wsi->ietf_spec_revision < 7) + /* + * use the XOR masking against everything we + * send past the frame key + */ + for (n = -pre; n < ((int)len + post); n++) + buf[n] = wsi->xor_mask(wsi, buf[n]); + else + /* + * in v7, just mask the payload + */ + for (n = 0; n < (int)len; n++) + dropmask[n + 4] = + wsi->xor_mask(wsi, dropmask[n + 4]); + + + if (wsi->ietf_spec_revision < 7) { + /* make space for the frame nonce in clear */ + pre += 4; + + dropmask = &buf[0 - pre]; + } + + if (dropmask) + /* copy the frame nonce into place */ + memcpy(dropmask, + wsi->frame_masking_nonce_04, 4); + + } else { + if (wsi->ietf_spec_revision < 7) { + + /* make space for the frame nonce in clear */ + pre += 4; + + buf[0 - pre] = 0; + buf[1 - pre] = 0; + buf[2 - pre] = 0; + buf[3 - pre] = 0; + } else { + if (dropmask && wsi->xor_mask != xor_no_mask) { + dropmask[0] = 0; + dropmask[1] = 0; + dropmask[2] = 0; + dropmask[3] = 0; + } + } + } + + } + +send_raw: + +#if 0 + fprintf(stderr, "send %ld: ", len + post); + for (n = -pre; n < ((int)len + post); n++) + fprintf(stderr, "%02X ", buf[n]); + + fprintf(stderr, "\n"); +#endif + + if (protocol == LWS_WRITE_HTTP) { + if (lws_issue_raw(wsi, (unsigned char *)buf - pre, + len + pre + post)) + return -1; + + return 0; + } + + /* + * give any active extensions a chance to munge the buffer + * before send. We pass in a pointer to an lws_tokens struct + * prepared with the default buffer and content length that's in + * there. Rather than rewrite the default buffer, extensions + * that expect to grow the buffer can adapt .token to + * point to their own per-connection buffer in the extension + * user allocation. By default with no extensions or no + * extension callback handling, just the normal input buffer is + * used then so it is efficient. + * + * callback returns 1 in case it wants to spill more buffers + */ + + return lws_issue_raw_ext_access(wsi, buf - pre, len + pre + post); +} + + +/** + * libwebsockets_serve_http_file() - Send a file back to the client using http + * @wsi: Websocket instance (available from user callback) + * @file: The file to issue over http + * @content_type: The http content type, eg, text/html + * + * This function is intended to be called from the callback in response + * to http requests from the client. It allows the callback to issue + * local files down the http link in a single step. + */ + +int libwebsockets_serve_http_file(struct libwebsocket *wsi, const char *file, + const char *content_type) +{ + int fd; + struct stat stat_buf; + char buf[512]; + char *p = buf; + int n; + +#ifdef WIN32 + fd = open(file, O_RDONLY | _O_BINARY); +#else + fd = open(file, O_RDONLY); +#endif + if (fd < 1) { + p += sprintf(p, "HTTP/1.0 400 Bad\x0d\x0a" + "Server: libwebsockets\x0d\x0a" + "\x0d\x0a" + ); + libwebsocket_write(wsi, (unsigned char *)buf, p - buf, + LWS_WRITE_HTTP); + + return -1; + } + + fstat(fd, &stat_buf); + p += sprintf(p, "HTTP/1.0 200 OK\x0d\x0a" + "Server: libwebsockets\x0d\x0a" + "Content-Type: %s\x0d\x0a" + "Content-Length: %u\x0d\x0a" + "\x0d\x0a", content_type, + (unsigned int)stat_buf.st_size); + + libwebsocket_write(wsi, (unsigned char *)buf, p - buf, LWS_WRITE_HTTP); + + n = 1; + while (n > 0) { + n = read(fd, buf, 512); + if (n <= 0) + continue; + libwebsocket_write(wsi, (unsigned char *)buf, n, + LWS_WRITE_HTTP); + } + + close(fd); + + return 0; +} + + +/** + * libwebsockets_remaining_packet_payload() - Bytes to come before "overall" + * rx packet is complete + * @wsi: Websocket instance (available from user callback) + * + * This function is intended to be called from the callback if the + * user code is interested in "complete packets" from the client. + * libwebsockets just passes through payload as it comes and issues a buffer + * additionally when it hits a built-in limit. The LWS_CALLBACK_RECEIVE + * callback handler can use this API to find out if the buffer it has just + * been given is the last piece of a "complete packet" from the client -- + * when that is the case libwebsockets_remaining_packet_payload() will return + * 0. + * + * Many protocols won't care becuse their packets are always small. + */ + +size_t +libwebsockets_remaining_packet_payload(struct libwebsocket *wsi) +{ + return wsi->rx_packet_length; +} diff --git a/libs/libwebsockets/lib/private-libwebsockets.h b/libs/libwebsockets/lib/private-libwebsockets.h new file mode 100644 index 0000000000..3c9776fd86 --- /dev/null +++ b/libs/libwebsockets/lib/private-libwebsockets.h @@ -0,0 +1,445 @@ +/* + * libwebsockets - small server side websockets and web server implementation + * + * Copyright (C) 2010 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __MINGW64__ +#else +#ifdef __MINGW32__ +#else +#include +#endif +#endif +#include + +#include + +#ifdef WIN32 +#ifdef __MINGW64__ +#else +#ifdef __MINGW32__ +#else +#include +#endif +#endif +#include +#include +#include + +#else + +#include +#include +#ifndef LWS_NO_FORK +#ifdef HAVE_SYS_PRCTL_H +#include +#endif +#endif +#include +#include +#include + +#include +#include +#include + +#endif + +#ifdef LWS_OPENSSL_SUPPORT +#include +#include +#include +#include +#include +#endif + + +#include "libwebsockets.h" + +#if 0 +#define DEBUG +#endif + +#ifdef DEBUG +#ifdef WIN32 +static +#else +static inline +#endif +void debug(const char *format, ...) +{ + va_list ap; + va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); +} +#else +#ifdef WIN32 +static +#else +static inline +#endif +void debug(const char *format, ...) +{ +} +#endif + + +/* + * Mac OSX as well as iOS do not define the MSG_NOSIGNAL flag, + * but happily have something equivalent in the SO_NOSIGPIPE flag. + */ +#ifdef __APPLE__ +#define MSG_NOSIGNAL SO_NOSIGPIPE +#endif + + +#define FD_HASHTABLE_MODULUS 32 +#define MAX_CLIENTS 100 +#define LWS_MAX_HEADER_NAME_LENGTH 64 +#define LWS_MAX_HEADER_LEN 4096 +#define LWS_INITIAL_HDR_ALLOC 256 +#define LWS_ADDITIONAL_HDR_ALLOC 64 +#define MAX_USER_RX_BUFFER 4096 +#define MAX_BROADCAST_PAYLOAD 2048 +#define LWS_MAX_PROTOCOLS 10 +#define LWS_MAX_EXTENSIONS_ACTIVE 10 +#define SPEC_LATEST_SUPPORTED 13 + +#define MAX_WEBSOCKET_04_KEY_LEN 128 +#define SYSTEM_RANDOM_FILEPATH "/dev/urandom" + +enum lws_websocket_opcodes_04 { + LWS_WS_OPCODE_04__CONTINUATION = 0, + LWS_WS_OPCODE_04__CLOSE = 1, + LWS_WS_OPCODE_04__PING = 2, + LWS_WS_OPCODE_04__PONG = 3, + LWS_WS_OPCODE_04__TEXT_FRAME = 4, + LWS_WS_OPCODE_04__BINARY_FRAME = 5, + + LWS_WS_OPCODE_04__RESERVED_6 = 6, + LWS_WS_OPCODE_04__RESERVED_7 = 7, + LWS_WS_OPCODE_04__RESERVED_8 = 8, + LWS_WS_OPCODE_04__RESERVED_9 = 9, + LWS_WS_OPCODE_04__RESERVED_A = 0xa, + LWS_WS_OPCODE_04__RESERVED_B = 0xb, + LWS_WS_OPCODE_04__RESERVED_C = 0xc, + LWS_WS_OPCODE_04__RESERVED_D = 0xd, + LWS_WS_OPCODE_04__RESERVED_E = 0xe, + LWS_WS_OPCODE_04__RESERVED_F = 0xf, +}; + +enum lws_websocket_opcodes_07 { + LWS_WS_OPCODE_07__CONTINUATION = 0, + LWS_WS_OPCODE_07__TEXT_FRAME = 1, + LWS_WS_OPCODE_07__BINARY_FRAME = 2, + + LWS_WS_OPCODE_07__NOSPEC__MUX = 7, + + /* control extensions 8+ */ + + LWS_WS_OPCODE_07__CLOSE = 8, + LWS_WS_OPCODE_07__PING = 9, + LWS_WS_OPCODE_07__PONG = 0xa, +}; + + +enum lws_connection_states { + WSI_STATE_HTTP, + WSI_STATE_HTTP_HEADERS, + WSI_STATE_DEAD_SOCKET, + WSI_STATE_ESTABLISHED, + WSI_STATE_CLIENT_UNCONNECTED, + WSI_STATE_RETURNED_CLOSE_ALREADY, + WSI_STATE_AWAITING_CLOSE_ACK, +}; + +enum lws_rx_parse_state { + LWS_RXPS_NEW, + + LWS_RXPS_SEEN_76_FF, + LWS_RXPS_PULLING_76_LENGTH, + LWS_RXPS_EAT_UNTIL_76_FF, + + LWS_RXPS_04_MASK_NONCE_1, + LWS_RXPS_04_MASK_NONCE_2, + LWS_RXPS_04_MASK_NONCE_3, + + LWS_RXPS_04_FRAME_HDR_1, + LWS_RXPS_04_FRAME_HDR_LEN, + LWS_RXPS_04_FRAME_HDR_LEN16_2, + LWS_RXPS_04_FRAME_HDR_LEN16_1, + LWS_RXPS_04_FRAME_HDR_LEN64_8, + LWS_RXPS_04_FRAME_HDR_LEN64_7, + LWS_RXPS_04_FRAME_HDR_LEN64_6, + LWS_RXPS_04_FRAME_HDR_LEN64_5, + LWS_RXPS_04_FRAME_HDR_LEN64_4, + LWS_RXPS_04_FRAME_HDR_LEN64_3, + LWS_RXPS_04_FRAME_HDR_LEN64_2, + LWS_RXPS_04_FRAME_HDR_LEN64_1, + + LWS_RXPS_07_COLLECT_FRAME_KEY_1, + LWS_RXPS_07_COLLECT_FRAME_KEY_2, + LWS_RXPS_07_COLLECT_FRAME_KEY_3, + LWS_RXPS_07_COLLECT_FRAME_KEY_4, + + LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED +}; + + +enum connection_mode { + LWS_CONNMODE_WS_SERVING, + LWS_CONNMODE_WS_CLIENT, + + /* transient modes */ + LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY, + LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE, + LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY, + LWS_CONNMODE_WS_CLIENT_WAITING_EXTENSION_CONNECT, + LWS_CONNMODE_WS_CLIENT_PENDING_CANDIDATE_CHILD, + + /* special internal types */ + LWS_CONNMODE_SERVER_LISTENER, + LWS_CONNMODE_BROADCAST_PROXY_LISTENER, + LWS_CONNMODE_BROADCAST_PROXY +}; + + +#define LWS_FD_HASH(fd) ((fd ^ (fd >> 8) ^ (fd >> 16)) % FD_HASHTABLE_MODULUS) + +struct libwebsocket_fd_hashtable { + struct libwebsocket *wsi[MAX_CLIENTS + 1]; + int length; +}; + +struct libwebsocket_protocols; + +struct libwebsocket_context { + struct libwebsocket_fd_hashtable fd_hashtable[FD_HASHTABLE_MODULUS]; + struct pollfd fds[MAX_CLIENTS * FD_HASHTABLE_MODULUS + 1]; + int fds_count; + int listen_port; + char http_proxy_address[256]; + char canonical_hostname[1024]; + unsigned int http_proxy_port; + unsigned int options; + unsigned long last_timeout_check_s; + + int fd_random; + +#ifdef LWS_OPENSSL_SUPPORT + int use_ssl; + SSL_CTX *ssl_ctx; + SSL_CTX *ssl_client_ctx; +#endif + struct libwebsocket_protocols *protocols; + int count_protocols; + struct libwebsocket_extension *extensions; +}; + + +enum pending_timeout { + NO_PENDING_TIMEOUT = 0, + PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE, + PENDING_TIMEOUT_ESTABLISH_WITH_SERVER, + PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE, + PENDING_TIMEOUT_AWAITING_PING, + PENDING_TIMEOUT_CLOSE_ACK, + PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE, +}; + + +/* + * This is totally opaque to code using the library. It's exported as a + * forward-reference pointer-only declaration; the user can use the pointer with + * other APIs to get information out of it. + */ + +struct libwebsocket { + const struct libwebsocket_protocols *protocol; + struct libwebsocket_extension * + active_extensions[LWS_MAX_EXTENSIONS_ACTIVE]; + void *active_extensions_user[LWS_MAX_EXTENSIONS_ACTIVE]; + int count_active_extensions; + + enum lws_connection_states state; + + char name_buffer[LWS_MAX_HEADER_NAME_LENGTH]; + int name_buffer_pos; + int current_alloc_len; + enum lws_token_indexes parser_state; + struct lws_tokens utf8_token[WSI_TOKEN_COUNT]; + int ietf_spec_revision; + char rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING + MAX_USER_RX_BUFFER + + LWS_SEND_BUFFER_POST_PADDING]; + int rx_user_buffer_head; + enum libwebsocket_write_protocol rx_frame_type; + int protocol_index_for_broadcast_proxy; + enum pending_timeout pending_timeout; + unsigned long pending_timeout_limit; + + int sock; + + enum lws_rx_parse_state lws_rx_parse_state; + char extension_data_pending; + struct libwebsocket *candidate_children_list; + struct libwebsocket *extension_handles; + + /* 04 protocol specific */ + + char key_b64[150]; + unsigned char masking_key_04[20]; + unsigned char frame_masking_nonce_04[4]; + unsigned char frame_mask_04[20]; + unsigned char frame_mask_index; + size_t rx_packet_length; + unsigned char opcode; + unsigned char final; + + int pings_vs_pongs; + unsigned char (*xor_mask)(struct libwebsocket *, unsigned char); + char all_zero_nonce; + + enum lws_close_status close_reason; + + /* 07 specific */ + char this_frame_masked; + + /* client support */ + char initial_handshake_hash_base64[30]; + enum connection_mode mode; + char *c_path; + char *c_host; + char *c_origin; + char *c_protocol; + callback_function *c_callback; + + char *c_address; + int c_port; + + +#ifdef LWS_OPENSSL_SUPPORT + SSL *ssl; + BIO *client_bio; + int use_ssl; +#endif + + void *user_space; +}; + +extern int +libwebsocket_client_rx_sm(struct libwebsocket *wsi, unsigned char c); + +extern int +libwebsocket_parse(struct libwebsocket *wsi, unsigned char c); + +extern int +libwebsocket_interpret_incoming_packet(struct libwebsocket *wsi, + unsigned char *buf, size_t len); + +extern int +libwebsocket_read(struct libwebsocket_context *context, + struct libwebsocket *wsi, + unsigned char *buf, size_t len); + +extern int +lws_b64_selftest(void); + +extern unsigned char +xor_no_mask(struct libwebsocket *wsi, unsigned char c); + +extern unsigned char +xor_mask_04(struct libwebsocket *wsi, unsigned char c); + +extern unsigned char +xor_mask_05(struct libwebsocket *wsi, unsigned char c); + +extern struct libwebsocket * +wsi_from_fd(struct libwebsocket_context *context, int fd); + +extern int +insert_wsi(struct libwebsocket_context *context, struct libwebsocket *wsi); + +extern int +delete_from_fd(struct libwebsocket_context *context, int fd); + +extern void +libwebsocket_set_timeout(struct libwebsocket *wsi, + enum pending_timeout reason, int secs); + +extern int +lws_issue_raw(struct libwebsocket *wsi, unsigned char *buf, size_t len); + + +extern void +libwebsocket_service_timeout_check(struct libwebsocket_context *context, + struct libwebsocket *wsi, unsigned int sec); + +extern struct libwebsocket * +__libwebsocket_client_connect_2(struct libwebsocket_context *context, + struct libwebsocket *wsi); + +extern struct libwebsocket * +libwebsocket_create_new_server_wsi(struct libwebsocket_context *context); + +extern char * +libwebsockets_generate_client_handshake(struct libwebsocket_context *context, + struct libwebsocket *wsi, char *pkt); + +extern int +lws_handle_POLLOUT_event(struct libwebsocket_context *context, + struct libwebsocket *wsi, struct pollfd *pollfd); + +extern int +lws_any_extension_handled(struct libwebsocket_context *context, + struct libwebsocket *wsi, + enum libwebsocket_extension_callback_reasons r, + void *v, size_t len); + +extern void * +lws_get_extension_user_matching_ext(struct libwebsocket *wsi, + struct libwebsocket_extension *ext); + +extern int +lws_client_interpret_server_handshake(struct libwebsocket_context *context, + struct libwebsocket *wsi); + +extern int +libwebsocket_rx_sm(struct libwebsocket *wsi, unsigned char c); + +extern int +lws_issue_raw_ext_access(struct libwebsocket *wsi, + unsigned char *buf, size_t len); + +#ifndef LWS_OPENSSL_SUPPORT + +unsigned char * +SHA1(const unsigned char *d, size_t n, unsigned char *md); + +void +MD5(const unsigned char *input, int ilen, unsigned char *output); + +#endif diff --git a/libs/libwebsockets/lib/sha-1.c b/libs/libwebsockets/lib/sha-1.c new file mode 100644 index 0000000000..f30f3ed63b --- /dev/null +++ b/libs/libwebsockets/lib/sha-1.c @@ -0,0 +1,326 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 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. + */ +/* + * FIPS pub 180-1: Secure Hash Algorithm (SHA-1) + * based on: http://csrc.nist.gov/fips/fip180-1.txt + * implemented by Jun-ichiro itojun Itoh + */ + +#include +#ifdef WIN32 + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 /* to show byte order (taken from gcc) */ +#endif +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif +#ifndef BYTE_ORDER +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +typedef unsigned __int64 u_int64_t; + +#undef __P +#ifndef __P +#if __STDC__ +#define __P(protos) protos +#else +#define __P(protos) () +#endif +#endif + +#define bzero(b, len) (memset((b), '\0', (len)), (void) 0) + +#else +#include +#include +#include +#endif + +#include + +struct sha1_ctxt { + union { + unsigned char b8[20]; + unsigned int b32[5]; + } h; + union { + unsigned char b8[8]; + u_int64_t b64[1]; + } c; + union { + unsigned char b8[64]; + unsigned int b32[16]; + } m; + unsigned char count; +}; + +/* sanity check */ +#if BYTE_ORDER != BIG_ENDIAN +# if BYTE_ORDER != LITTLE_ENDIAN +# define unsupported 1 +# endif +#endif + +#ifndef unsupported + +/* constant table */ +static unsigned int _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 }; +#define K(t) _K[(t) / 20] + +#define F0(b, c, d) (((b) & (c)) | ((~(b)) & (d))) +#define F1(b, c, d) (((b) ^ (c)) ^ (d)) +#define F2(b, c, d) (((b) & (c)) | ((b) & (d)) | ((c) & (d))) +#define F3(b, c, d) (((b) ^ (c)) ^ (d)) + +#define S(n, x) (((x) << (n)) | ((x) >> (32 - n))) + +#define H(n) (ctxt->h.b32[(n)]) +#define COUNT (ctxt->count) +#define BCOUNT (ctxt->c.b64[0] / 8) +#define W(n) (ctxt->m.b32[(n)]) + +#define PUTBYTE(x) { \ + ctxt->m.b8[(COUNT % 64)] = (x); \ + COUNT++; \ + COUNT %= 64; \ + ctxt->c.b64[0] += 8; \ + if (COUNT % 64 == 0) \ + sha1_step(ctxt); \ + } + +#define PUTPAD(x) { \ + ctxt->m.b8[(COUNT % 64)] = (x); \ + COUNT++; \ + COUNT %= 64; \ + if (COUNT % 64 == 0) \ + sha1_step(ctxt); \ + } + +static void sha1_step __P((struct sha1_ctxt *)); + +static void +sha1_step(struct sha1_ctxt *ctxt) +{ + unsigned int a, b, c, d, e, tmp; + size_t t, s; + +#if BYTE_ORDER == LITTLE_ENDIAN + struct sha1_ctxt tctxt; + + memcpy(&tctxt.m.b8[0], &ctxt->m.b8[0], 64); + ctxt->m.b8[0] = tctxt.m.b8[3]; ctxt->m.b8[1] = tctxt.m.b8[2]; + ctxt->m.b8[2] = tctxt.m.b8[1]; ctxt->m.b8[3] = tctxt.m.b8[0]; + ctxt->m.b8[4] = tctxt.m.b8[7]; ctxt->m.b8[5] = tctxt.m.b8[6]; + ctxt->m.b8[6] = tctxt.m.b8[5]; ctxt->m.b8[7] = tctxt.m.b8[4]; + ctxt->m.b8[8] = tctxt.m.b8[11]; ctxt->m.b8[9] = tctxt.m.b8[10]; + ctxt->m.b8[10] = tctxt.m.b8[9]; ctxt->m.b8[11] = tctxt.m.b8[8]; + ctxt->m.b8[12] = tctxt.m.b8[15]; ctxt->m.b8[13] = tctxt.m.b8[14]; + ctxt->m.b8[14] = tctxt.m.b8[13]; ctxt->m.b8[15] = tctxt.m.b8[12]; + ctxt->m.b8[16] = tctxt.m.b8[19]; ctxt->m.b8[17] = tctxt.m.b8[18]; + ctxt->m.b8[18] = tctxt.m.b8[17]; ctxt->m.b8[19] = tctxt.m.b8[16]; + ctxt->m.b8[20] = tctxt.m.b8[23]; ctxt->m.b8[21] = tctxt.m.b8[22]; + ctxt->m.b8[22] = tctxt.m.b8[21]; ctxt->m.b8[23] = tctxt.m.b8[20]; + ctxt->m.b8[24] = tctxt.m.b8[27]; ctxt->m.b8[25] = tctxt.m.b8[26]; + ctxt->m.b8[26] = tctxt.m.b8[25]; ctxt->m.b8[27] = tctxt.m.b8[24]; + ctxt->m.b8[28] = tctxt.m.b8[31]; ctxt->m.b8[29] = tctxt.m.b8[30]; + ctxt->m.b8[30] = tctxt.m.b8[29]; ctxt->m.b8[31] = tctxt.m.b8[28]; + ctxt->m.b8[32] = tctxt.m.b8[35]; ctxt->m.b8[33] = tctxt.m.b8[34]; + ctxt->m.b8[34] = tctxt.m.b8[33]; ctxt->m.b8[35] = tctxt.m.b8[32]; + ctxt->m.b8[36] = tctxt.m.b8[39]; ctxt->m.b8[37] = tctxt.m.b8[38]; + ctxt->m.b8[38] = tctxt.m.b8[37]; ctxt->m.b8[39] = tctxt.m.b8[36]; + ctxt->m.b8[40] = tctxt.m.b8[43]; ctxt->m.b8[41] = tctxt.m.b8[42]; + ctxt->m.b8[42] = tctxt.m.b8[41]; ctxt->m.b8[43] = tctxt.m.b8[40]; + ctxt->m.b8[44] = tctxt.m.b8[47]; ctxt->m.b8[45] = tctxt.m.b8[46]; + ctxt->m.b8[46] = tctxt.m.b8[45]; ctxt->m.b8[47] = tctxt.m.b8[44]; + ctxt->m.b8[48] = tctxt.m.b8[51]; ctxt->m.b8[49] = tctxt.m.b8[50]; + ctxt->m.b8[50] = tctxt.m.b8[49]; ctxt->m.b8[51] = tctxt.m.b8[48]; + ctxt->m.b8[52] = tctxt.m.b8[55]; ctxt->m.b8[53] = tctxt.m.b8[54]; + ctxt->m.b8[54] = tctxt.m.b8[53]; ctxt->m.b8[55] = tctxt.m.b8[52]; + ctxt->m.b8[56] = tctxt.m.b8[59]; ctxt->m.b8[57] = tctxt.m.b8[58]; + ctxt->m.b8[58] = tctxt.m.b8[57]; ctxt->m.b8[59] = tctxt.m.b8[56]; + ctxt->m.b8[60] = tctxt.m.b8[63]; ctxt->m.b8[61] = tctxt.m.b8[62]; + ctxt->m.b8[62] = tctxt.m.b8[61]; ctxt->m.b8[63] = tctxt.m.b8[60]; +#endif + + a = H(0); b = H(1); c = H(2); d = H(3); e = H(4); + + for (t = 0; t < 20; t++) { + s = t & 0x0f; + if (t >= 16) + W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ + W((s+2) & 0x0f) ^ W(s)); + + tmp = S(5, a) + F0(b, c, d) + e + W(s) + K(t); + e = d; d = c; c = S(30, b); b = a; a = tmp; + } + for (t = 20; t < 40; t++) { + s = t & 0x0f; + W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ + W((s+2) & 0x0f) ^ W(s)); + tmp = S(5, a) + F1(b, c, d) + e + W(s) + K(t); + e = d; d = c; c = S(30, b); b = a; a = tmp; + } + for (t = 40; t < 60; t++) { + s = t & 0x0f; + W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ + W((s+2) & 0x0f) ^ W(s)); + tmp = S(5, a) + F2(b, c, d) + e + W(s) + K(t); + e = d; d = c; c = S(30, b); b = a; a = tmp; + } + for (t = 60; t < 80; t++) { + s = t & 0x0f; + W(s) = S(1, W((s+13) & 0x0f) ^ W((s+8) & 0x0f) ^ + W((s+2) & 0x0f) ^ W(s)); + tmp = S(5, a) + F3(b, c, d) + e + W(s) + K(t); + e = d; d = c; c = S(30, b); b = a; a = tmp; + } + + H(0) = H(0) + a; + H(1) = H(1) + b; + H(2) = H(2) + c; + H(3) = H(3) + d; + H(4) = H(4) + e; + + bzero(&ctxt->m.b8[0], 64); +} + +/*------------------------------------------------------------*/ + +void +sha1_init(struct sha1_ctxt *ctxt) +{ + bzero(ctxt, sizeof(struct sha1_ctxt)); + H(0) = 0x67452301; + H(1) = 0xefcdab89; + H(2) = 0x98badcfe; + H(3) = 0x10325476; + H(4) = 0xc3d2e1f0; +} + +void +sha1_pad(struct sha1_ctxt *ctxt) +{ + size_t padlen; /*pad length in bytes*/ + size_t padstart; + + PUTPAD(0x80); + + padstart = COUNT % 64; + padlen = 64 - padstart; + if (padlen < 8) { + bzero(&ctxt->m.b8[padstart], padlen); + COUNT += padlen; + COUNT %= 64; + sha1_step(ctxt); + padstart = COUNT % 64; /* should be 0 */ + padlen = 64 - padstart; /* should be 64 */ + } + bzero(&ctxt->m.b8[padstart], padlen - 8); + COUNT += (padlen - 8); + COUNT %= 64; +#if BYTE_ORDER == BIG_ENDIAN + PUTPAD(ctxt->c.b8[0]); PUTPAD(ctxt->c.b8[1]); + PUTPAD(ctxt->c.b8[2]); PUTPAD(ctxt->c.b8[3]); + PUTPAD(ctxt->c.b8[4]); PUTPAD(ctxt->c.b8[5]); + PUTPAD(ctxt->c.b8[6]); PUTPAD(ctxt->c.b8[7]); +#else + PUTPAD(ctxt->c.b8[7]); PUTPAD(ctxt->c.b8[6]); + PUTPAD(ctxt->c.b8[5]); PUTPAD(ctxt->c.b8[4]); + PUTPAD(ctxt->c.b8[3]); PUTPAD(ctxt->c.b8[2]); + PUTPAD(ctxt->c.b8[1]); PUTPAD(ctxt->c.b8[0]); +#endif +} + +void +sha1_loop(struct sha1_ctxt *ctxt, const unsigned char *input, size_t len) +{ + size_t gaplen; + size_t gapstart; + size_t off; + size_t copysiz; + + off = 0; + + while (off < len) { + gapstart = COUNT % 64; + gaplen = 64 - gapstart; + + copysiz = (gaplen < len - off) ? gaplen : len - off; + memcpy(&ctxt->m.b8[gapstart], &input[off], copysiz); + COUNT += copysiz; + COUNT %= 64; + ctxt->c.b64[0] += copysiz * 8; + if (COUNT % 64 == 0) + sha1_step(ctxt); + off += copysiz; + } +} + +void +sha1_result(struct sha1_ctxt *ctxt, void *digest0) +{ + unsigned char *digest; + + digest = (unsigned char *)digest0; + sha1_pad(ctxt); +#if BYTE_ORDER == BIG_ENDIAN + memcpy(digest, &ctxt->h.b8[0], 20); +#else + digest[0] = ctxt->h.b8[3]; digest[1] = ctxt->h.b8[2]; + digest[2] = ctxt->h.b8[1]; digest[3] = ctxt->h.b8[0]; + digest[4] = ctxt->h.b8[7]; digest[5] = ctxt->h.b8[6]; + digest[6] = ctxt->h.b8[5]; digest[7] = ctxt->h.b8[4]; + digest[8] = ctxt->h.b8[11]; digest[9] = ctxt->h.b8[10]; + digest[10] = ctxt->h.b8[9]; digest[11] = ctxt->h.b8[8]; + digest[12] = ctxt->h.b8[15]; digest[13] = ctxt->h.b8[14]; + digest[14] = ctxt->h.b8[13]; digest[15] = ctxt->h.b8[12]; + digest[16] = ctxt->h.b8[19]; digest[17] = ctxt->h.b8[18]; + digest[18] = ctxt->h.b8[17]; digest[19] = ctxt->h.b8[16]; +#endif +} + +/* + * This should look and work like the libcrypto implementation + */ + +unsigned char * +SHA1(const unsigned char *d, size_t n, unsigned char *md) +{ + struct sha1_ctxt ctx; + + sha1_init(&ctx); + sha1_loop(&ctx, d, n); + sha1_result(&ctx, (void *)md); + + return md; +} + +#endif /*unsupported*/ diff --git a/libs/libwebsockets/libwebsockets-api-doc.html b/libs/libwebsockets/libwebsockets-api-doc.html new file mode 100644 index 0000000000..18b1620e50 --- /dev/null +++ b/libs/libwebsockets/libwebsockets-api-doc.html @@ -0,0 +1,933 @@ +

libwebsockets_hangup_on_client - Server calls to terminate client connection

+void +libwebsockets_hangup_on_client +(struct libwebsocket_context * context, +int fd) +

Arguments

+
+
context +
libwebsockets context +
fd +
Connection socket descriptor +
+
+

libwebsockets_get_peer_addresses - Get client address information

+void +libwebsockets_get_peer_addresses +(int fd, +char * name, +int name_len, +char * rip, +int rip_len) +

Arguments

+
+
fd +
Connection socket descriptor +
name +
Buffer to take client address name +
name_len +
Length of client address name buffer +
rip +
Buffer to take client address IP qotted quad +
rip_len +
Length of client address IP buffer +
+

Description

+
+This function fills in name and rip with the name and IP of +the client connected with socket descriptor fd. Names may be +truncated if there is not enough room. If either cannot be +determined, they will be returned as valid zero-length strings. +
+
+

libwebsocket_service_fd - Service polled socket with something waiting

+int +libwebsocket_service_fd +(struct libwebsocket_context * context, +struct pollfd * pollfd) +

Arguments

+
+
context +
Websocket context +
pollfd +
The pollfd entry describing the socket fd and which events +happened. +
+

Description

+
+This function closes any active connections and then frees the +context. After calling this, any further use of the context is +undefined. +
+
+

libwebsocket_context_destroy - Destroy the websocket context

+void +libwebsocket_context_destroy +(struct libwebsocket_context * context) +

Arguments

+
+
context +
Websocket context +
+

Description

+
+This function closes any active connections and then frees the +context. After calling this, any further use of the context is +undefined. +
+
+

libwebsocket_service - Service any pending websocket activity

+int +libwebsocket_service +(struct libwebsocket_context * context, +int timeout_ms) +

Arguments

+
+
context +
Websocket context +
timeout_ms +
Timeout for poll; 0 means return immediately if nothing needed +service otherwise block and service immediately, returning +after the timeout if nothing needed service. +
+

Description

+
+This function deals with any pending websocket traffic, for three +kinds of event. It handles these events on both server and client +types of connection the same. +

+1) Accept new connections to our context's server +

+2) Perform pending broadcast writes initiated from other forked +processes (effectively serializing asynchronous broadcasts) +

+3) Call the receive callback for incoming frame data received by +server or client connections. +

+You need to call this service function periodically to all the above +functions to happen; if your application is single-threaded you can +just call it in your main event loop. +

+Alternatively you can fork a new process that asynchronously handles +calling this service in a loop. In that case you are happy if this +call blocks your thread until it needs to take care of something and +would call it with a large nonzero timeout. Your loop then takes no +CPU while there is nothing happening. +

+If you are calling it in a single-threaded app, you don't want it to +wait around blocking other things in your loop from happening, so you +would call it with a timeout_ms of 0, so it returns immediately if +nothing is pending, or as soon as it services whatever was pending. +

+
+

libwebsocket_callback_on_writable - Request a callback when this socket becomes able to be written to without blocking

+int +libwebsocket_callback_on_writable +(struct libwebsocket_context * context, +struct libwebsocket * wsi) +

Arguments

+
+
context +
libwebsockets context +
wsi +
Websocket connection instance to get callback for +
+
+

libwebsocket_callback_on_writable_all_protocol - Request a callback for all connections using the given protocol when it becomes possible to write to each socket without blocking in turn.

+int +libwebsocket_callback_on_writable_all_protocol +(const struct libwebsocket_protocols * protocol) +

Arguments

+
+
protocol +
Protocol whose connections will get callbacks +
+
+

libwebsocket_set_timeout - marks the wsi as subject to a timeout

+void +libwebsocket_set_timeout +(struct libwebsocket * wsi, +enum pending_timeout reason, +int secs) +

Arguments

+
+
wsi +
Websocket connection instance +
reason +
timeout reason +
secs +
how many seconds +
+

Description

+
+

+You will not need this unless you are doing something special +

+
+

libwebsocket_get_socket_fd - returns the socket file descriptor

+int +libwebsocket_get_socket_fd +(struct libwebsocket * wsi) +

Arguments

+
+
wsi +
Websocket connection instance +
+

Description

+
+

+You will not need this unless you are doing something special +

+
+

libwebsocket_rx_flow_control - Enable and disable socket servicing for receieved packets.

+int +libwebsocket_rx_flow_control +(struct libwebsocket * wsi, +int enable) +

Arguments

+
+
wsi +
Websocket connection instance to get callback for +
enable +
0 = disable read servicing for this connection, 1 = enable +
+

Description

+
+

+If the output side of a server process becomes choked, this allows flow +control for the input side. +

+
+

libwebsocket_canonical_hostname - returns this host's hostname

+const char * +libwebsocket_canonical_hostname +(struct libwebsocket_context * context) +

Arguments

+
+
context +
Websocket context +
+

Description

+
+

+This is typically used by client code to fill in the host parameter +when making a client connection. You can only call it after the context +has been created. +

+
+

libwebsocket_create_context - Create the websocket handler

+struct libwebsocket_context * +libwebsocket_create_context +(int port, +const char * interf, +struct libwebsocket_protocols * protocols, +struct libwebsocket_extension * extensions, +const char * ssl_cert_filepath, +const char * ssl_private_key_filepath, +int gid, +int uid, +unsigned int options) +

Arguments

+
+
port +
Port to listen on... you can use 0 to suppress listening on +any port, that's what you want if you are not running a +websocket server at all but just using it as a client +
interf +
NULL to bind the listen socket to all interfaces, or the +interface name, eg, "eth2" +
protocols +
Array of structures listing supported protocols and a protocol- +specific callback for each one. The list is ended with an +entry that has a NULL callback pointer. +It's not const because we write the owning_server member +
extensions +
NULL or array of libwebsocket_extension structs listing the +extensions this context supports +
ssl_cert_filepath +
If libwebsockets was compiled to use ssl, and you want +to listen using SSL, set to the filepath to fetch the +server cert from, otherwise NULL for unencrypted +
ssl_private_key_filepath +
filepath to private key if wanting SSL mode, +else ignored +
gid +
group id to change to after setting listen socket, or -1. +
uid +
user id to change to after setting listen socket, or -1. +
options +
0, or LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK +
+

Description

+
+This function creates the listening socket and takes care +of all initialization in one step. +

+After initialization, it returns a struct libwebsocket_context * that +represents this server. After calling, user code needs to take care +of calling libwebsocket_service with the context pointer to get the +server's sockets serviced. This can be done in the same process context +or a forked process, or another thread, +

+The protocol callback functions are called for a handful of events +including http requests coming in, websocket connections becoming +established, and data arriving; it's also called periodically to allow +async transmission. +

+HTTP requests are sent always to the FIRST protocol in protocol, since +at that time websocket protocol has not been negotiated. Other +protocols after the first one never see any HTTP callack activity. +

+The server created is a simple http server by default; part of the +websocket standard is upgrading this http connection to a websocket one. +

+This allows the same server to provide files like scripts and favicon / +images or whatever over http and dynamic data over websockets all in +one place; they're all handled in the user callback. +

+
+

libwebsockets_fork_service_loop - Optional helper function forks off a process for the websocket server loop. You don't have to use this but if not, you have to make sure you are calling libwebsocket_service periodically to service the websocket traffic

+int +libwebsockets_fork_service_loop +(struct libwebsocket_context * context) +

Arguments

+
+
context +
server context returned by creation function +
+
+

libwebsockets_get_protocol - Returns a protocol pointer from a websocket connection.

+const struct libwebsocket_protocols * +libwebsockets_get_protocol +(struct libwebsocket * wsi) +

Arguments

+
+
wsi +
pointer to struct websocket you want to know the protocol of +
+

Description

+
+

+This is useful to get the protocol to broadcast back to from inside +the callback. +

+
+

libwebsockets_broadcast - Sends a buffer to the callback for all active connections of the given protocol.

+int +libwebsockets_broadcast +(const struct libwebsocket_protocols * protocol, +unsigned char * buf, +size_t len) +

Arguments

+
+
protocol +
pointer to the protocol you will broadcast to all members of +
buf +
buffer containing the data to be broadcase. NOTE: this has to be +allocated with LWS_SEND_BUFFER_PRE_PADDING valid bytes before +the pointer and LWS_SEND_BUFFER_POST_PADDING afterwards in the +case you are calling this function from callback context. +
len +
length of payload data in buf, starting from buf. +
+

Description

+
+This function allows bulk sending of a packet to every connection using +the given protocol. It does not send the data directly; instead it calls +the callback with a reason type of LWS_CALLBACK_BROADCAST. If the callback +wants to actually send the data for that connection, the callback itself +should call libwebsocket_write. +

+libwebsockets_broadcast can be called from another fork context without +having to take any care about data visibility between the processes, it'll +"just work". +

+
+

libwebsocket_write - Apply protocol then write data to client

+int +libwebsocket_write +(struct libwebsocket * wsi, +unsigned char * buf, +size_t len, +enum libwebsocket_write_protocol protocol) +

Arguments

+
+
wsi +
Websocket instance (available from user callback) +
buf +
The data to send. For data being sent on a websocket +connection (ie, not default http), this buffer MUST have +LWS_SEND_BUFFER_PRE_PADDING bytes valid BEFORE the pointer +and an additional LWS_SEND_BUFFER_POST_PADDING bytes valid +in the buffer after (buf + len). This is so the protocol +header and trailer data can be added in-situ. +
len +
Count of the data bytes in the payload starting from buf +
protocol +
Use LWS_WRITE_HTTP to reply to an http connection, and one +of LWS_WRITE_BINARY or LWS_WRITE_TEXT to send appropriate +data on a websockets connection. Remember to allow the extra +bytes before and after buf if LWS_WRITE_BINARY or LWS_WRITE_TEXT +are used. +
+

Description

+
+This function provides the way to issue data back to the client +for both http and websocket protocols. +

+In the case of sending using websocket protocol, be sure to allocate +valid storage before and after buf as explained above. This scheme +allows maximum efficiency of sending data and protocol in a single +packet while not burdening the user code with any protocol knowledge. +

+
+

libwebsockets_serve_http_file - Send a file back to the client using http

+int +libwebsockets_serve_http_file +(struct libwebsocket * wsi, +const char * file, +const char * content_type) +

Arguments

+
+
wsi +
Websocket instance (available from user callback) +
file +
The file to issue over http +
content_type +
The http content type, eg, text/html +
+

Description

+
+This function is intended to be called from the callback in response +to http requests from the client. It allows the callback to issue +local files down the http link in a single step. +
+
+

libwebsockets_remaining_packet_payload - Bytes to come before "overall" rx packet is complete

+size_t +libwebsockets_remaining_packet_payload +(struct libwebsocket * wsi) +

Arguments

+
+
wsi +
Websocket instance (available from user callback) +
+

Description

+
+This function is intended to be called from the callback if the +user code is interested in "complete packets" from the client. +libwebsockets just passes through payload as it comes and issues a buffer +additionally when it hits a built-in limit. The LWS_CALLBACK_RECEIVE +callback handler can use this API to find out if the buffer it has just +been given is the last piece of a "complete packet" from the client -- +when that is the case libwebsockets_remaining_packet_payload will return +0. +

+Many protocols won't care becuse their packets are always small. +

+
+

libwebsocket_client_connect - Connect to another websocket server

+struct libwebsocket * +libwebsocket_client_connect +(struct libwebsocket_context * context, +const char * address, +int port, +int ssl_connection, +const char * path, +const char * host, +const char * origin, +const char * protocol, +int ietf_version_or_minus_one) +

Arguments

+
+
context +
Websocket context +
address +
Remote server address, eg, "myserver.com" +
port +
Port to connect to on the remote server, eg, 80 +
ssl_connection +
0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self +signed certs +
path +
Websocket path on server +
host +
Hostname on server +
origin +
Socket origin name +
protocol +
Comma-separated list of protocols being asked for from +the server, or just one. The server will pick the one it +likes best. +
ietf_version_or_minus_one +
-1 to ask to connect using the default, latest +protocol supported, or the specific protocol ordinal +
+

Description

+
+This function creates a connection to a remote server +
+
+

libwebsocket_client_connect_extended - Connect to another websocket server

+struct libwebsocket * +libwebsocket_client_connect_extended +(struct libwebsocket_context * context, +const char * address, +int port, +int ssl_connection, +const char * path, +const char * host, +const char * origin, +const char * protocol, +int ietf_version_or_minus_one, +void * userdata) +

Arguments

+
+
context +
Websocket context +
address +
Remote server address, eg, "myserver.com" +
port +
Port to connect to on the remote server, eg, 80 +
ssl_connection +
0 = ws://, 1 = wss:// encrypted, 2 = wss:// allow self +signed certs +
path +
Websocket path on server +
host +
Hostname on server +
origin +
Socket origin name +
protocol +
Comma-separated list of protocols being asked for from +the server, or just one. The server will pick the one it +likes best. +
ietf_version_or_minus_one +
-1 to ask to connect using the default, latest +protocol supported, or the specific protocol ordinal +
userdata +
Pre-allocated user data +
+

Description

+
+This function creates a connection to a remote server +
+
+

callback - User server actions

+LWS_EXTERN int +callback +(struct libwebsocket_context * context, +struct libwebsocket * wsi, +enum libwebsocket_callback_reasons reason, +void * user, +void * in, +size_t len) +

Arguments

+
+
context +
Websockets context +
wsi +
Opaque websocket instance pointer +
reason +
The reason for the call +
user +
Pointer to per-session user data allocated by library +
in +
Pointer used for some callback reasons +
len +
Length set for some callback reasons +
+

Description

+
+This callback is the way the user controls what is served. All the +protocol detail is hidden and handled by the library. +

+For each connection / session there is user data allocated that is +pointed to by "user". You set the size of this user data area when +the library is initialized with libwebsocket_create_server. +

+You get an opportunity to initialize user data when called back with +LWS_CALLBACK_ESTABLISHED reason. +

+

LWS_CALLBACK_ESTABLISHED

+
+after the server completes a handshake with +an incoming client +
+

LWS_CALLBACK_CLIENT_CONNECTION_ERROR

+
+the request client connection has +been unable to complete a handshake with the remote server +
+

LWS_CALLBACK_CLIENT_ESTABLISHED

+
+after your client connection completed +a handshake with the remote server +
+

LWS_CALLBACK_CLOSED

+
+when the websocket session ends +
+

LWS_CALLBACK_BROADCAST

+
+signal to send to client (you would use +libwebsocket_write taking care about the +special buffer requirements +
+

LWS_CALLBACK_RECEIVE

+
+data has appeared for this server endpoint from a +remote client, it can be found at *in and is +len bytes long +
+

LWS_CALLBACK_CLIENT_RECEIVE_PONG

+
+if you elected to see PONG packets, +they appear with this callback reason. PONG +packets only exist in 04+ protocol +
+

LWS_CALLBACK_CLIENT_RECEIVE

+
+data has appeared from the server for the +client connection, it can be found at *in and +is len bytes long +
+

LWS_CALLBACK_HTTP

+
+an http request has come from a client that is not +asking to upgrade the connection to a websocket +one. This is a chance to serve http content, +for example, to send a script to the client +which will then open the websockets connection. +in points to the URI path requested and +libwebsockets_serve_http_file makes it very +simple to send back a file to the client. +
+

LWS_CALLBACK_SERVER_WRITEABLE

+
+If you call +libwebsocket_callback_on_writable on a connection, you will +get one of these callbacks coming when the connection socket +is able to accept another write packet without blocking. +If it already was able to take another packet without blocking, +you'll get this callback at the next call to the service loop +function. Notice that CLIENTs get LWS_CALLBACK_CLIENT_WRITEABLE +and servers get LWS_CALLBACK_SERVER_WRITEABLE. +
+

LWS_CALLBACK_FILTER_NETWORK_CONNECTION

+
+called when a client connects to +the server at network level; the connection is accepted but then +passed to this callback to decide whether to hang up immediately +or not, based on the client IP. user contains the connection +socket's descriptor. Return non-zero to terminate +the connection before sending or receiving anything. +Because this happens immediately after the network connection +from the client, there's no websocket protocol selected yet so +this callback is issued only to protocol 0. +
+

LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION

+
+called when the handshake has +been received and parsed from the client, but the response is +not sent yet. Return non-zero to disallow the connection. +user is a pointer to an array of struct lws_tokens, you can +use the header enums lws_token_indexes from libwebsockets.h +to check for and read the supported header presence and +content before deciding to allow the handshake to proceed or +to kill the connection. +
+

LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS

+
+if configured for +including OpenSSL support, this callback allows your user code +to perform extra SSL_CTX_load_verify_locations or similar +calls to direct OpenSSL where to find certificates the client +can use to confirm the remote server identity. user is the +OpenSSL SSL_CTX* +
+

LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS

+
+if configured for +including OpenSSL support, this callback allows your user code +to load extra certifcates into the server which allow it to +verify the validity of certificates returned by clients. user +is the server's OpenSSL SSL_CTX* +
+

LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION

+
+if the +libwebsockets context was created with the option +LWS_SERVER_OPTION_REQUIRE_VALID_OPENSSL_CLIENT_CERT, then this +callback is generated during OpenSSL verification of the cert +sent from the client. It is sent to protocol[0] callback as +no protocol has been negotiated on the connection yet. +Notice that the libwebsockets context and wsi are both NULL +during this callback. See +
+

http

+
+//www.openssl.org/docs/ssl/SSL_CTX_set_verify.html +to understand more detail about the OpenSSL callback that +generates this libwebsockets callback and the meanings of the +arguments passed. In this callback, user is the x509_ctx, +in is the ssl pointer and len is preverify_ok +Notice that this callback maintains libwebsocket return +conventions, return 0 to mean the cert is OK or 1 to fail it. +This also means that if you don't handle this callback then +the default callback action of returning 0 allows the client +certificates. +
+

LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER

+
+this callback happens +when a client handshake is being compiled. user is NULL, +in is a char **, it's pointing to a char * which holds the +next location in the header buffer where you can add +headers, and len is the remaining space in the header buffer, +which is typically some hundreds of bytes. So, to add a canned +cookie, your handler code might look similar to: +

+char **p = (char **)in; +

+if (len < 100) +return 1; +

+*p += sprintf(*p, "Cookie: a=b\x0d\x0a"); +

+return 0; +

+Notice if you add anything, you just have to take care about +the CRLF on the line you added. Obviously this callback is +optional, if you don't handle it everything is fine. +

+Notice the callback is coming to protocols[0] all the time, +because there is no specific protocol handshook yet. +

+

LWS_CALLBACK_CONFIRM_EXTENSION_OKAY

+
+When the server handshake code +sees that it does support a requested extension, before +accepting the extension by additing to the list sent back to +the client it gives this callback just to check that it's okay +to use that extension. It calls back to the requested protocol +and with in being the extension name, len is 0 and user is +valid. Note though at this time the ESTABLISHED callback hasn't +happened yet so if you initialize user content there, user +content during this callback might not be useful for anything. +Notice this callback comes to protocols[0]. +
+

LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED

+
+When a client +connection is being prepared to start a handshake to a server, +each supported extension is checked with protocols[0] callback +with this reason, giving the user code a chance to suppress the +claim to support that extension by returning non-zero. If +unhandled, by default 0 will be returned and the extension +support included in the header to the server. Notice this +callback comes to protocols[0]. +

+The next four reasons are optional and only need taking care of if you +will be integrating libwebsockets sockets into an external polling +array. +

+

LWS_CALLBACK_ADD_POLL_FD

+
+libwebsocket deals with its poll loop +internally, but in the case you are integrating with another +server you will need to have libwebsocket sockets share a +polling array with the other server. This and the other +POLL_FD related callbacks let you put your specialized +poll array interface code in the callback for protocol 0, the +first protocol you support, usually the HTTP protocol in the +serving case. This callback happens when a socket needs to be +
+

added to the polling loop

+
+user contains the fd, and +len is the events bitmap (like, POLLIN). If you are using the +internal polling loop (the "service" callback), you can just +ignore these callbacks. +
+

LWS_CALLBACK_DEL_POLL_FD

+
+This callback happens when a socket descriptor +needs to be removed from an external polling array. user is +the socket desricptor. If you are using the internal polling +loop, you can just ignore it. +
+

LWS_CALLBACK_SET_MODE_POLL_FD

+
+This callback happens when libwebsockets +wants to modify the events for the socket descriptor in user. +The handler should OR len on to the events member of the pollfd +struct for this socket descriptor. If you are using the +internal polling loop, you can just ignore it. +
+

LWS_CALLBACK_CLEAR_MODE_POLL_FD

+
+This callback occurs when libwebsockets +wants to modify the events for the socket descriptor in user. +The handler should AND ~len on to the events member of the +pollfd struct for this socket descriptor. If you are using the +internal polling loop, you can just ignore it. +
+
+

extension_callback - Hooks to allow extensions to operate

+LWS_EXTERN int +extension_callback +(struct libwebsocket_context * context, +struct libwebsocket_extension * ext, +struct libwebsocket * wsi, +enum libwebsocket_extension_callback_reasons reason, +void * user, +void * in, +size_t len) +

Arguments

+
+
context +
Websockets context +
ext +
This extension +
wsi +
Opaque websocket instance pointer +
reason +
The reason for the call +
user +
Pointer to per-session user data allocated by library +
in +
Pointer used for some callback reasons +
len +
Length set for some callback reasons +
+

Description

+
+Each extension that is active on a particular connection receives +callbacks during the connection lifetime to allow the extension to +operate on websocket data and manage itself. +

+Libwebsockets takes care of allocating and freeing "user" memory for +each active extension on each connection. That is what is pointed to +by the user parameter. +

+

LWS_EXT_CALLBACK_CONSTRUCT

+
+called when the server has decided to +select this extension from the list provided by the client, +just before the server will send back the handshake accepting +the connection with this extension active. This gives the +extension a chance to initialize its connection context found +in user. +
+

LWS_EXT_CALLBACK_CLIENT_CONSTRUCT

+
+same as LWS_EXT_CALLBACK_CONSTRUCT +but called when client is instantiating this extension. Some +extensions will work the same on client and server side and then +you can just merge handlers for both CONSTRUCTS. +
+

LWS_EXT_CALLBACK_DESTROY

+
+called when the connection the extension was +being used on is about to be closed and deallocated. It's the +last chance for the extension to deallocate anything it has +allocated in the user data (pointed to by user) before the +user data is deleted. This same callback is used whether you +are in client or server instantiation context. +
+

LWS_EXT_CALLBACK_PACKET_RX_PREPARSE

+
+when this extension was active on +a connection, and a packet of data arrived at the connection, +it is passed to this callback to give the extension a chance to +change the data, eg, decompress it. user is pointing to the +extension's private connection context data, in is pointing +to an lws_tokens struct, it consists of a char * pointer called +token, and an int called token_len. At entry, these are +set to point to the received buffer and set to the content +length. If the extension will grow the content, it should use +a new buffer allocated in its private user context data and +set the pointed-to lws_tokens members to point to its buffer. +
+

LWS_EXT_CALLBACK_PACKET_TX_PRESEND

+
+this works the same way as +LWS_EXT_CALLBACK_PACKET_RX_PREPARSE above, except it gives the +extension a chance to change websocket data just before it will +be sent out. Using the same lws_token pointer scheme in in, +the extension can change the buffer and the length to be +transmitted how it likes. Again if it wants to grow the +buffer safely, it should copy the data into its own buffer and +set the lws_tokens token pointer to it. +
+
+

struct libwebsocket_protocols - List of protocols and handlers server supports.

+struct libwebsocket_protocols {
+    const char * name;
+    callback_function * callback;
+    size_t per_session_data_size;
+    struct libwebsocket_context * owning_server;
+    int broadcast_socket_port;
+    int broadcast_socket_user_fd;
+    int protocol_index;
+};
+

Members

+
+
name +
Protocol name that must match the one given in the client +Javascript new WebSocket(url, 'protocol') name +
callback +
The service callback used for this protocol. It allows the +service action for an entire protocol to be encapsulated in +the protocol-specific callback +
per_session_data_size +
Each new connection using this protocol gets +this much memory allocated on connection establishment and +freed on connection takedown. A pointer to this per-connection +allocation is passed into the callback in the 'user' parameter +
owning_server +
the server init call fills in this opaque pointer when +registering this protocol with the server. +
broadcast_socket_port +
the server init call fills this in with the +localhost port number used to forward broadcasts for this +protocol +
broadcast_socket_user_fd +
the server init call fills this in ... the main +process context can write to this socket to perform broadcasts +(use the libwebsockets_broadcast api to do this instead, +it works from any process context) +
protocol_index +
which protocol we are starting from zero +
+

Description

+
+This structure represents one protocol supported by the server. An +array of these structures is passed to libwebsocket_create_server +allows as many protocols as you like to be handled by one server. +
+
+

struct libwebsocket_extension - An extension we know how to cope with

+struct libwebsocket_extension {
+    const char * name;
+    extension_callback_function * callback;
+    size_t per_session_data_size;
+    void * per_context_private_data;
+};
+

Members

+
+
name +
Formal extension name, eg, "deflate-stream" +
callback +
Service callback +
per_session_data_size +
Libwebsockets will auto-malloc this much +memory for the use of the extension, a pointer +to it comes in the user callback parameter +
per_context_private_data +
Optional storage for this externsion that +is per-context, so it can track stuff across +all sessions, etc, if it wants +
+
diff --git a/libs/libwebsockets/libwebsockets.spec b/libs/libwebsockets/libwebsockets.spec new file mode 100644 index 0000000000..18e4b82f14 --- /dev/null +++ b/libs/libwebsockets/libwebsockets.spec @@ -0,0 +1,63 @@ +Name: libwebsockets +Version: 0.1 +Release: 45.gmaster_f1d2113d%{?dist} +Summary: Websocket Server Library + +Group: System +License: GPL +URL: http://warmcat.com +Source0: %{name}-%{version}.tar.gz +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) + +BuildRequires: openssl-devel +Requires: openssl-devel + +%description +Webserver server library + +%package devel +Summary: Development files for libwebsockets +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: openssl-devel + +%description devel +Development files for libwebsockets + +%prep +%setup -q + +%build +./configure --prefix=/usr --libdir=%{_libdir} --enable-openssl +make + + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT + + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%attr(755,root,root) /usr/bin/libwebsockets-test-server +%attr(755,root,root) +/%{_libdir}/libwebsockets.so.0.0.3 +/%{_libdir}/libwebsockets.so.0 +/%{_libdir}/libwebsockets.so +/%{_libdir}/libwebsockets.la +%attr(755,root,root) /usr/share/libwebsockets-test-server +%attr(755,root,root) /usr/share/libwebsockets-test-server-extpoll +%attr(755,root,root) /usr/share/libwebsockets-test-client +%attr(755,root,root) /usr/share/libwebsockets-test-ping +%doc +%files devel +%defattr(-,root,root,-) +/usr/include/* +%attr(755,root,root) +/%{_libdir}/libwebsockets.a + +%changelog + diff --git a/libs/libwebsockets/scripts/kernel-doc b/libs/libwebsockets/scripts/kernel-doc new file mode 100755 index 0000000000..241310e59c --- /dev/null +++ b/libs/libwebsockets/scripts/kernel-doc @@ -0,0 +1,2238 @@ +#!/usr/bin/perl -w + +use strict; + +## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## +## Copyright (C) 2000, 1 Tim Waugh ## +## Copyright (C) 2001 Simon Huggins ## +## Copyright (C) 2005-2009 Randy Dunlap ## +## ## +## #define enhancements by Armin Kuster ## +## Copyright (c) 2000 MontaVista Software, Inc. ## +## ## +## This software falls under the GNU General Public License. ## +## Please read the COPYING file for more information ## + +# w.o. 03-11-2000: added the '-filelist' option. + +# 18/01/2001 - Cleanups +# Functions prototyped as foo(void) same as foo() +# Stop eval'ing where we don't need to. +# -- huggie@earth.li + +# 27/06/2001 - Allowed whitespace after initial "/**" and +# allowed comments before function declarations. +# -- Christian Kreibich + +# Still to do: +# - add perldoc documentation +# - Look more closely at some of the scarier bits :) + +# 26/05/2001 - Support for separate source and object trees. +# Return error code. +# Keith Owens + +# 23/09/2001 - Added support for typedefs, structs, enums and unions +# Support for Context section; can be terminated using empty line +# Small fixes (like spaces vs. \s in regex) +# -- Tim Jansen + + +# +# This will read a 'c' file and scan for embedded comments in the +# style of gnome comments (+minor extensions - see below). +# + +# Note: This only supports 'c'. + +# usage: +# kernel-doc [ -docbook | -html | -text | -man ] [ -no-doc-sections ] +# [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile +# or +# [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile +# +# Set output format using one of -docbook -html -text or -man. Default is man. +# +# -no-doc-sections +# Do not output DOC: sections +# +# -function funcname +# If set, then only generate documentation for the given function(s) or +# DOC: section titles. All other functions and DOC: sections are ignored. +# +# -nofunction funcname +# If set, then only generate documentation for the other function(s)/DOC: +# sections. Cannot be used together with -function (yes, that's a bug -- +# perl hackers can fix it 8)) +# +# c files - list of 'c' files to process +# +# All output goes to stdout, with errors to stderr. + +# +# format of comments. +# In the following table, (...)? signifies optional structure. +# (...)* signifies 0 or more structure elements +# /** +# * function_name(:)? (- short description)? +# (* @parameterx: (description of parameter x)?)* +# (* a blank line)? +# * (Description:)? (Description of function)? +# * (section header: (section description)? )* +# (*)?*/ +# +# So .. the trivial example would be: +# +# /** +# * my_function +# */ +# +# If the Description: header tag is omitted, then there must be a blank line +# after the last parameter specification. +# e.g. +# /** +# * my_function - does my stuff +# * @my_arg: its mine damnit +# * +# * Does my stuff explained. +# */ +# +# or, could also use: +# /** +# * my_function - does my stuff +# * @my_arg: its mine damnit +# * Description: Does my stuff explained. +# */ +# etc. +# +# Besides functions you can also write documentation for structs, unions, +# enums and typedefs. Instead of the function name you must write the name +# of the declaration; the struct/union/enum/typedef must always precede +# the name. Nesting of declarations is not supported. +# Use the argument mechanism to document members or constants. +# e.g. +# /** +# * struct my_struct - short description +# * @a: first member +# * @b: second member +# * +# * Longer description +# */ +# struct my_struct { +# int a; +# int b; +# /* private: */ +# int c; +# }; +# +# All descriptions can be multiline, except the short function description. +# +# You can also add additional sections. When documenting kernel functions you +# should document the "Context:" of the function, e.g. whether the functions +# can be called form interrupts. Unlike other sections you can end it with an +# empty line. +# Example-sections should contain the string EXAMPLE so that they are marked +# appropriately in DocBook. +# +# Example: +# /** +# * user_function - function that can only be called in user context +# * @a: some argument +# * Context: !in_interrupt() +# * +# * Some description +# * Example: +# * user_function(22); +# */ +# ... +# +# +# All descriptive text is further processed, scanning for the following special +# patterns, which are highlighted appropriately. +# +# 'funcname()' - function +# '$ENVVAR' - environmental variable +# '&struct_name' - name of a structure (up to two words including 'struct') +# '@parameter' - name of a parameter +# '%CONST' - name of a constant. + +my $errors = 0; +my $warnings = 0; +my $anon_struct_union = 0; + +# match expressions used to find embedded type information +my $type_constant = '\%([-_\w]+)'; +my $type_func = '(\w+)\(\)'; +my $type_param = '\@(\w+)'; +my $type_struct = '\&((struct\s*)*[_\w]+)'; +my $type_struct_xml = '\\&((struct\s*)*[_\w]+)'; +my $type_env = '(\$\w+)'; + +# Output conversion substitutions. +# One for each output format + +# these work fairly well +my %highlights_html = ( $type_constant, "\$1", + $type_func, "\$1", + $type_struct_xml, "\$1", + $type_env, "\$1", + $type_param, "\$1" ); +my $local_lt = "\\\\\\\\lt:"; +my $local_gt = "\\\\\\\\gt:"; +my $blankline_html = $local_lt . "p" . $local_gt; # was "

" + +# XML, docbook format +my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1\$2", + $type_constant, "\$1", + $type_func, "\$1", + $type_struct_xml, "\$1", + $type_env, "\$1", + $type_param, "\$1" ); +my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; + +# gnome, docbook format +my %highlights_gnome = ( $type_constant, "\$1", + $type_func, "\$1", + $type_struct, "\$1", + $type_env, "\$1", + $type_param, "\$1" ); +my $blankline_gnome = "\n"; + +# these are pretty rough +my %highlights_man = ( $type_constant, "\$1", + $type_func, "\\\\fB\$1\\\\fP", + $type_struct, "\\\\fI\$1\\\\fP", + $type_param, "\\\\fI\$1\\\\fP" ); +my $blankline_man = ""; + +# text-mode +my %highlights_text = ( $type_constant, "\$1", + $type_func, "\$1", + $type_struct, "\$1", + $type_param, "\$1" ); +my $blankline_text = ""; + + +sub usage { + print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man ] [ -no-doc-sections ]\n"; + print " [ -function funcname [ -function funcname ...] ]\n"; + print " [ -nofunction funcname [ -nofunction funcname ...] ]\n"; + print " c source file(s) > outputfile\n"; + print " -v : verbose output, more warnings & other info listed\n"; + exit 1; +} + +# read arguments +if ($#ARGV == -1) { + usage(); +} + +my $verbose = 0; +my $output_mode = "man"; +my $no_doc_sections = 0; +my %highlights = %highlights_man; +my $blankline = $blankline_man; +my $modulename = "Kernel API"; +my $function_only = 0; +my $man_date = ('January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', + 'November', 'December')[(localtime)[4]] . + " " . ((localtime)[5]+1900); + +# Essentially these are globals +# They probably want to be tidied up, made more localised or something. +# CAVEAT EMPTOR! Some of the others I localised may not want to be, which +# could cause "use of undefined value" or other bugs. +my ($function, %function_table, %parametertypes, $declaration_purpose); +my ($type, $declaration_name, $return_type); +my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map); + +if (defined($ENV{'KBUILD_VERBOSE'})) { + $verbose = "$ENV{'KBUILD_VERBOSE'}"; +} + +# Generated docbook code is inserted in a template at a point where +# docbook v3.1 requires a non-zero sequence of RefEntry's; see: +# http://www.oasis-open.org/docbook/documentation/reference/html/refentry.html +# We keep track of number of generated entries and generate a dummy +# if needs be to ensure the expanded template can be postprocessed +# into html. +my $section_counter = 0; + +my $lineprefix=""; + +# states +# 0 - normal code +# 1 - looking for function name +# 2 - scanning field start. +# 3 - scanning prototype. +# 4 - documentation block +my $state; +my $in_doc_sect; + +#declaration types: can be +# 'function', 'struct', 'union', 'enum', 'typedef' +my $decl_type; + +my $doc_special = "\@\%\$\&"; + +my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. +my $doc_end = '\*/'; +my $doc_com = '\s*\*\s*'; +my $doc_decl = $doc_com . '(\w+)'; +my $doc_sect = $doc_com . '([' . $doc_special . ']?[\w\s]+):(.*)'; +my $doc_content = $doc_com . '(.*)'; +my $doc_block = $doc_com . 'DOC:\s*(.*)?'; + +my %constants; +my %parameterdescs; +my @parameterlist; +my %sections; +my @sectionlist; +my $sectcheck; +my $struct_actual; + +my $contents = ""; +my $section_default = "Description"; # default section +my $section_intro = "Introduction"; +my $section = $section_default; +my $section_context = "Context"; + +my $undescribed = "-- undescribed --"; + +reset_state(); + +while ($ARGV[0] =~ m/^-(.*)/) { + my $cmd = shift @ARGV; + if ($cmd eq "-html") { + $output_mode = "html"; + %highlights = %highlights_html; + $blankline = $blankline_html; + } elsif ($cmd eq "-man") { + $output_mode = "man"; + %highlights = %highlights_man; + $blankline = $blankline_man; + } elsif ($cmd eq "-text") { + $output_mode = "text"; + %highlights = %highlights_text; + $blankline = $blankline_text; + } elsif ($cmd eq "-docbook") { + $output_mode = "xml"; + %highlights = %highlights_xml; + $blankline = $blankline_xml; + } elsif ($cmd eq "-gnome") { + $output_mode = "gnome"; + %highlights = %highlights_gnome; + $blankline = $blankline_gnome; + } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document + $modulename = shift @ARGV; + } elsif ($cmd eq "-function") { # to only output specific functions + $function_only = 1; + $function = shift @ARGV; + $function_table{$function} = 1; + } elsif ($cmd eq "-nofunction") { # to only output specific functions + $function_only = 2; + $function = shift @ARGV; + $function_table{$function} = 1; + } elsif ($cmd eq "-v") { + $verbose = 1; + } elsif (($cmd eq "-h") || ($cmd eq "--help")) { + usage(); + } elsif ($cmd eq '-filelist') { + $filelist = shift @ARGV; + } elsif ($cmd eq '-no-doc-sections') { + $no_doc_sections = 1; + } +} + +# get kernel version from env +sub get_kernel_version() { + my $version = 'unknown kernel version'; + + if (defined($ENV{'KERNELVERSION'})) { + $version = $ENV{'KERNELVERSION'}; + } + return $version; +} +my $kernelversion = get_kernel_version(); + +# generate a sequence of code that will splice in highlighting information +# using the s// operator. +my $dohighlight = ""; +foreach my $pattern (keys %highlights) { +# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n"; + $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n"; +} + +## +# dumps section contents to arrays/hashes intended for that purpose. +# +sub dump_section { + my $file = shift; + my $name = shift; + my $contents = join "\n", @_; + + if ($name =~ m/$type_constant/) { + $name = $1; +# print STDERR "constant section '$1' = '$contents'\n"; + $constants{$name} = $contents; + } elsif ($name =~ m/$type_param/) { +# print STDERR "parameter def '$1' = '$contents'\n"; + $name = $1; + $parameterdescs{$name} = $contents; + $sectcheck = $sectcheck . $name . " "; + } elsif ($name eq "@\.\.\.") { +# print STDERR "parameter def '...' = '$contents'\n"; + $name = "..."; + $parameterdescs{$name} = $contents; + $sectcheck = $sectcheck . $name . " "; + } else { +# print STDERR "other section '$name' = '$contents'\n"; + if (defined($sections{$name}) && ($sections{$name} ne "")) { + print STDERR "Error(${file}:$.): duplicate section name '$name'\n"; + ++$errors; + } + $sections{$name} = $contents; + push @sectionlist, $name; + } +} + +## +# dump DOC: section after checking that it should go out +# +sub dump_doc_section { + my $file = shift; + my $name = shift; + my $contents = join "\n", @_; + + if ($no_doc_sections) { + return; + } + + if (($function_only == 0) || + ( $function_only == 1 && defined($function_table{$name})) || + ( $function_only == 2 && !defined($function_table{$name}))) + { + dump_section($file, $name, $contents); + output_blockhead({'sectionlist' => \@sectionlist, + 'sections' => \%sections, + 'module' => $modulename, + 'content-only' => ($function_only != 0), }); + } +} + +## +# output function +# +# parameterdescs, a hash. +# function => "function name" +# parameterlist => @list of parameters +# parameterdescs => %parameter descriptions +# sectionlist => @list of sections +# sections => %section descriptions +# + +sub output_highlight { + my $contents = join "\n",@_; + my $line; + +# DEBUG +# if (!defined $contents) { +# use Carp; +# confess "output_highlight got called with no args?\n"; +# } + + if ($output_mode eq "html" || $output_mode eq "xml") { + $contents = local_unescape($contents); + # convert data read & converted thru xml_escape() into &xyz; format: + $contents =~ s/\\\\\\/&/g; + } +# print STDERR "contents b4:$contents\n"; + eval $dohighlight; + die $@ if $@; +# print STDERR "contents af:$contents\n"; + + foreach $line (split "\n", $contents) { + if ($line eq ""){ + print $lineprefix, local_unescape($blankline); + } else { + $line =~ s/\\\\\\/\&/g; + if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { + print "\\&$line"; + } else { + print $lineprefix, $line; + } + } + print "\n"; + } +} + +#output sections in html +sub output_section_html(%) { + my %args = %{$_[0]}; + my $section; + + foreach $section (@{$args{'sectionlist'}}) { + print "

$section

\n"; + print "
\n"; + output_highlight($args{'sections'}{$section}); + print "
\n"; + } +} + +# output enum in html +sub output_enum_html(%) { + my %args = %{$_[0]}; + my ($parameter); + my $count; + print "

enum " . $args{'enum'} . "

\n"; + + print "enum " . $args{'enum'} . " {
\n"; + $count = 0; + foreach $parameter (@{$args{'parameterlist'}}) { + print " " . $parameter . ""; + if ($count != $#{$args{'parameterlist'}}) { + $count++; + print ",\n"; + } + print "
"; + } + print "};
\n"; + + print "

Constants

\n"; + print "
\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + print "
" . $parameter . "\n"; + print "
"; + output_highlight($args{'parameterdescs'}{$parameter}); + } + print "
\n"; + output_section_html(@_); + print "
\n"; +} + +# output typedef in html +sub output_typedef_html(%) { + my %args = %{$_[0]}; + my ($parameter); + my $count; + print "

typedef " . $args{'typedef'} . "

\n"; + + print "typedef " . $args{'typedef'} . "\n"; + output_section_html(@_); + print "
\n"; +} + +# output struct in html +sub output_struct_html(%) { + my %args = %{$_[0]}; + my ($parameter); + + print "

" . $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "

\n"; + print "" . $args{'type'} . " " . $args{'struct'} . " {
\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + if ($parameter =~ /^#/) { + print "$parameter
\n"; + next; + } + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print "    $1$parameter) ($2);
\n"; + } elsif ($type =~ m/^(.*?)\s*(:.*)/) { + # bitfield + print "    $1 $parameter$2;
\n"; + } else { + print "    $type $parameter;
\n"; + } + } + print "};
\n"; + + print "

Members

\n"; + print "
\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + ($parameter =~ /^#/) && next; + + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + print "
" . $parameter . "\n"; + print "
"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + print "
\n"; + output_section_html(@_); + print "
\n"; +} + +# output function in html +sub output_function_html(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + + print "

" . $args{'function'} . " - " . $args{'purpose'} . "

\n"; + print "" . $args{'functiontype'} . "\n"; + print "" . $args{'function'} . "\n"; + print "("; + $count = 0; + foreach $parameter (@{$args{'parameterlist'}}) { + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print "$1$parameter) ($2)"; + } else { + print "" . $type . " " . $parameter . ""; + } + if ($count != $#{$args{'parameterlist'}}) { + $count++; + print ",\n"; + } + } + print ")\n"; + + print "

Arguments

\n"; + print "
\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + print "
" . $parameter . "\n"; + print "
"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + print "
\n"; + output_section_html(@_); + print "
\n"; +} + +# output DOC: block header in html +sub output_blockhead_html(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + + foreach $section (@{$args{'sectionlist'}}) { + print "

$section

\n"; + print "
    \n"; + output_highlight($args{'sections'}{$section}); + print "
\n"; + } + print "
\n"; +} + +sub output_section_xml(%) { + my %args = %{$_[0]}; + my $section; + # print out each section + $lineprefix=" "; + foreach $section (@{$args{'sectionlist'}}) { + print "\n"; + print "$section\n"; + if ($section =~ m/EXAMPLE/i) { + print "\n"; + } else { + print "\n"; + } + output_highlight($args{'sections'}{$section}); + if ($section =~ m/EXAMPLE/i) { + print "\n"; + } else { + print "\n"; + } + print "\n"; + } +} + +# output function in XML DocBook +sub output_function_xml(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + my $id; + + $id = "API-" . $args{'function'}; + $id =~ s/[^A-Za-z0-9]/-/g; + + print "\n"; + print "\n"; + print " LINUX\n"; + print " Kernel Hackers Manual\n"; + print " $man_date\n"; + print "\n"; + print "\n"; + print " " . $args{'function'} . "\n"; + print " 9\n"; + print " " . $kernelversion . "\n"; + print "\n"; + print "\n"; + print " " . $args{'function'} . "\n"; + print " \n"; + print " "; + output_highlight ($args{'purpose'}); + print " \n"; + print "\n"; + + print "\n"; + print " Synopsis\n"; + print " \n"; + print " " . $args{'functiontype'} . " "; + print "" . $args{'function'} . " \n"; + + $count = 0; + if ($#{$args{'parameterlist'}} >= 0) { + foreach $parameter (@{$args{'parameterlist'}}) { + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print " $1$parameter)\n"; + print " $2\n"; + } else { + print " " . $type; + print " $parameter\n"; + } + } + } else { + print " \n"; + } + print " \n"; + print "\n"; + + # print parameters + print "\n Arguments\n"; + if ($#{$args{'parameterlist'}} >= 0) { + print " \n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + print " \n $parameter\n"; + print " \n \n"; + $lineprefix=" "; + output_highlight($args{'parameterdescs'}{$parameter_name}); + print " \n \n \n"; + } + print " \n"; + } else { + print " \n None\n \n"; + } + print "\n"; + + output_section_xml(@_); + print "\n\n"; +} + +# output struct in XML DocBook +sub output_struct_xml(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $id; + + $id = "API-struct-" . $args{'struct'}; + $id =~ s/[^A-Za-z0-9]/-/g; + + print "\n"; + print "\n"; + print " LINUX\n"; + print " Kernel Hackers Manual\n"; + print " $man_date\n"; + print "\n"; + print "\n"; + print " " . $args{'type'} . " " . $args{'struct'} . "\n"; + print " 9\n"; + print " " . $kernelversion . "\n"; + print "\n"; + print "\n"; + print " " . $args{'type'} . " " . $args{'struct'} . "\n"; + print " \n"; + print " "; + output_highlight ($args{'purpose'}); + print " \n"; + print "\n"; + + print "\n"; + print " Synopsis\n"; + print " \n"; + print $args{'type'} . " " . $args{'struct'} . " {\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + if ($parameter =~ /^#/) { + print "$parameter\n"; + next; + } + + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + defined($args{'parameterdescs'}{$parameter_name}) || next; + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print " $1 $parameter) ($2);\n"; + } elsif ($type =~ m/^(.*?)\s*(:.*)/) { + # bitfield + print " $1 $parameter$2;\n"; + } else { + print " " . $type . " " . $parameter . ";\n"; + } + } + print "};"; + print " \n"; + print "\n"; + + print " \n"; + print " Members\n"; + + if ($#{$args{'parameterlist'}} >= 0) { + print " \n"; + foreach $parameter (@{$args{'parameterlist'}}) { + ($parameter =~ /^#/) && next; + + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + defined($args{'parameterdescs'}{$parameter_name}) || next; + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + print " "; + print " $parameter\n"; + print " \n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + print " \n"; + print " \n"; + } + print " \n"; + } else { + print " \n None\n \n"; + } + print " \n"; + + output_section_xml(@_); + + print "\n\n"; +} + +# output enum in XML DocBook +sub output_enum_xml(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + my $id; + + $id = "API-enum-" . $args{'enum'}; + $id =~ s/[^A-Za-z0-9]/-/g; + + print "\n"; + print "\n"; + print " LINUX\n"; + print " Kernel Hackers Manual\n"; + print " $man_date\n"; + print "\n"; + print "\n"; + print " enum " . $args{'enum'} . "\n"; + print " 9\n"; + print " " . $kernelversion . "\n"; + print "\n"; + print "\n"; + print " enum " . $args{'enum'} . "\n"; + print " \n"; + print " "; + output_highlight ($args{'purpose'}); + print " \n"; + print "\n"; + + print "\n"; + print " Synopsis\n"; + print " \n"; + print "enum " . $args{'enum'} . " {\n"; + $count = 0; + foreach $parameter (@{$args{'parameterlist'}}) { + print " $parameter"; + if ($count != $#{$args{'parameterlist'}}) { + $count++; + print ","; + } + print "\n"; + } + print "};"; + print " \n"; + print "\n"; + + print "\n"; + print " Constants\n"; + print " \n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + print " "; + print " $parameter\n"; + print " \n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + print " \n"; + print " \n"; + } + print " \n"; + print "\n"; + + output_section_xml(@_); + + print "\n\n"; +} + +# output typedef in XML DocBook +sub output_typedef_xml(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $id; + + $id = "API-typedef-" . $args{'typedef'}; + $id =~ s/[^A-Za-z0-9]/-/g; + + print "\n"; + print "\n"; + print " LINUX\n"; + print " Kernel Hackers Manual\n"; + print " $man_date\n"; + print "\n"; + print "\n"; + print " typedef " . $args{'typedef'} . "\n"; + print " 9\n"; + print "\n"; + print "\n"; + print " typedef " . $args{'typedef'} . "\n"; + print " \n"; + print " "; + output_highlight ($args{'purpose'}); + print " \n"; + print "\n"; + + print "\n"; + print " Synopsis\n"; + print " typedef " . $args{'typedef'} . ";\n"; + print "\n"; + + output_section_xml(@_); + + print "\n\n"; +} + +# output in XML DocBook +sub output_blockhead_xml(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + + my $id = $args{'module'}; + $id =~ s/[^A-Za-z0-9]/-/g; + + # print out each section + $lineprefix=" "; + foreach $section (@{$args{'sectionlist'}}) { + if (!$args{'content-only'}) { + print "\n $section\n"; + } + if ($section =~ m/EXAMPLE/i) { + print "\n"; + } else { + print "\n"; + } + output_highlight($args{'sections'}{$section}); + if ($section =~ m/EXAMPLE/i) { + print "\n"; + } else { + print ""; + } + if (!$args{'content-only'}) { + print "\n\n"; + } + } + + print "\n\n"; +} + +# output in XML DocBook +sub output_function_gnome { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + my $id; + + $id = $args{'module'} . "-" . $args{'function'}; + $id =~ s/[^A-Za-z0-9]/-/g; + + print "\n"; + print " " . $args{'function'} . "\n"; + + print " \n"; + print " " . $args{'functiontype'} . " "; + print "" . $args{'function'} . " "; + print "\n"; + + $count = 0; + if ($#{$args{'parameterlist'}} >= 0) { + foreach $parameter (@{$args{'parameterlist'}}) { + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print " $1 $parameter)\n"; + print " $2\n"; + } else { + print " " . $type; + print " $parameter\n"; + } + } + } else { + print " \n"; + } + print " \n"; + if ($#{$args{'parameterlist'}} >= 0) { + print " \n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + print " $parameter\n"; + print " \n"; + $lineprefix=" "; + output_highlight($args{'parameterdescs'}{$parameter_name}); + print " \n"; + } + print " \n"; + } else { + print " \n None\n \n"; + } + + # print out each section + $lineprefix=" "; + foreach $section (@{$args{'sectionlist'}}) { + print "\n $section\n"; + if ($section =~ m/EXAMPLE/i) { + print "\n"; + } else { + } + print "\n"; + output_highlight($args{'sections'}{$section}); + print "\n"; + if ($section =~ m/EXAMPLE/i) { + print "\n"; + } else { + } + print " \n"; + } + + print "\n\n"; +} + +## +# output function in man +sub output_function_man(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + + print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n"; + + print ".SH NAME\n"; + print $args{'function'} . " \\- " . $args{'purpose'} . "\n"; + + print ".SH SYNOPSIS\n"; + if ($args{'functiontype'} ne "") { + print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n"; + } else { + print ".B \"" . $args{'function'} . "\n"; + } + $count = 0; + my $parenth = "("; + my $post = ","; + foreach my $parameter (@{$args{'parameterlist'}}) { + if ($count == $#{$args{'parameterlist'}}) { + $post = ");"; + } + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 . ")" . $post . "\"\n"; + } else { + $type =~ s/([^\*])$/$1 /; + print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $post . "\"\n"; + } + $count++; + $parenth = ""; + } + + print ".SH ARGUMENTS\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + print ".IP \"" . $parameter . "\" 12\n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"", uc $section, "\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output enum in man +sub output_enum_man(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + + print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n"; + + print ".SH NAME\n"; + print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n"; + + print ".SH SYNOPSIS\n"; + print "enum " . $args{'enum'} . " {\n"; + $count = 0; + foreach my $parameter (@{$args{'parameterlist'}}) { + print ".br\n.BI \" $parameter\"\n"; + if ($count == $#{$args{'parameterlist'}}) { + print "\n};\n"; + last; + } + else { + print ", \n.br\n"; + } + $count++; + } + + print ".SH Constants\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + print ".IP \"" . $parameter . "\" 12\n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output struct in man +sub output_struct_man(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + + print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n"; + + print ".SH NAME\n"; + print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n"; + + print ".SH SYNOPSIS\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n.br\n"; + + foreach my $parameter (@{$args{'parameterlist'}}) { + if ($parameter =~ /^#/) { + print ".BI \"$parameter\"\n.br\n"; + next; + } + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print ".BI \" " . $1 . "\" " . $parameter . " \") (" . $2 . ")" . "\"\n;\n"; + } elsif ($type =~ m/^(.*?)\s*(:.*)/) { + # bitfield + print ".BI \" " . $1 . "\ \" " . $parameter . $2 . " \"" . "\"\n;\n"; + } else { + $type =~ s/([^\*])$/$1 /; + print ".BI \" " . $type . "\" " . $parameter . " \"" . "\"\n;\n"; + } + print "\n.br\n"; + } + print "};\n.br\n"; + + print ".SH Members\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + ($parameter =~ /^#/) && next; + + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + print ".IP \"" . $parameter . "\" 12\n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output typedef in man +sub output_typedef_man(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + + print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n"; + + print ".SH NAME\n"; + print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n"; + + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +sub output_blockhead_man(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $count; + + print ".TH \"$args{'module'}\" 9 \"$args{'module'}\" \"$man_date\" \"API Manual\" LINUX\n"; + + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output in text +sub output_function_text(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + my $start; + + print "Name:\n\n"; + print $args{'function'} . " - " . $args{'purpose'} . "\n"; + + print "\nSynopsis:\n\n"; + if ($args{'functiontype'} ne "") { + $start = $args{'functiontype'} . " " . $args{'function'} . " ("; + } else { + $start = $args{'function'} . " ("; + } + print $start; + + my $count = 0; + foreach my $parameter (@{$args{'parameterlist'}}) { + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print $1 . $parameter . ") (" . $2; + } else { + print $type . " " . $parameter; + } + if ($count != $#{$args{'parameterlist'}}) { + $count++; + print ",\n"; + print " " x length($start); + } else { + print ");\n\n"; + } + } + + print "Arguments:\n\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + print $parameter . "\n\t" . $args{'parameterdescs'}{$parameter_name} . "\n"; + } + output_section_text(@_); +} + +#output sections in text +sub output_section_text(%) { + my %args = %{$_[0]}; + my $section; + + print "\n"; + foreach $section (@{$args{'sectionlist'}}) { + print "$section:\n\n"; + output_highlight($args{'sections'}{$section}); + } + print "\n\n"; +} + +# output enum in text +sub output_enum_text(%) { + my %args = %{$_[0]}; + my ($parameter); + my $count; + print "Enum:\n\n"; + + print "enum " . $args{'enum'} . " - " . $args{'purpose'} . "\n\n"; + print "enum " . $args{'enum'} . " {\n"; + $count = 0; + foreach $parameter (@{$args{'parameterlist'}}) { + print "\t$parameter"; + if ($count != $#{$args{'parameterlist'}}) { + $count++; + print ","; + } + print "\n"; + } + print "};\n\n"; + + print "Constants:\n\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + print "$parameter\n\t"; + print $args{'parameterdescs'}{$parameter} . "\n"; + } + + output_section_text(@_); +} + +# output typedef in text +sub output_typedef_text(%) { + my %args = %{$_[0]}; + my ($parameter); + my $count; + print "Typedef:\n\n"; + + print "typedef " . $args{'typedef'} . " - " . $args{'purpose'} . "\n"; + output_section_text(@_); +} + +# output struct as text +sub output_struct_text(%) { + my %args = %{$_[0]}; + my ($parameter); + + print $args{'type'} . " " . $args{'struct'} . " - " . $args{'purpose'} . "\n\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + if ($parameter =~ /^#/) { + print "$parameter\n"; + next; + } + + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + $type = $args{'parametertypes'}{$parameter}; + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print "\t$1 $parameter) ($2);\n"; + } elsif ($type =~ m/^(.*?)\s*(:.*)/) { + # bitfield + print "\t$1 $parameter$2;\n"; + } else { + print "\t" . $type . " " . $parameter . ";\n"; + } + } + print "};\n\n"; + + print "Members:\n\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + ($parameter =~ /^#/) && next; + + my $parameter_name = $parameter; + $parameter_name =~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + print "$parameter\n\t"; + print $args{'parameterdescs'}{$parameter_name} . "\n"; + } + print "\n"; + output_section_text(@_); +} + +sub output_blockhead_text(%) { + my %args = %{$_[0]}; + my ($parameter, $section); + + foreach $section (@{$args{'sectionlist'}}) { + print " $section:\n"; + print " -> "; + output_highlight($args{'sections'}{$section}); + } +} + +## +# generic output function for all types (function, struct/union, typedef, enum); +# calls the generated, variable output_ function name based on +# functype and output_mode +sub output_declaration { + no strict 'refs'; + my $name = shift; + my $functype = shift; + my $func = "output_${functype}_$output_mode"; + if (($function_only==0) || + ( $function_only == 1 && defined($function_table{$name})) || + ( $function_only == 2 && !defined($function_table{$name}))) + { + &$func(@_); + $section_counter++; + } +} + +## +# generic output function - calls the right one based on current output mode. +sub output_blockhead { + no strict 'refs'; + my $func = "output_blockhead_" . $output_mode; + &$func(@_); + $section_counter++; +} + +## +# takes a declaration (struct, union, enum, typedef) and +# invokes the right handler. NOT called for functions. +sub dump_declaration($$) { + no strict 'refs'; + my ($prototype, $file) = @_; + my $func = "dump_" . $decl_type; + &$func(@_); +} + +sub dump_union($$) { + dump_struct(@_); +} + +sub dump_struct($$) { + my $x = shift; + my $file = shift; + my $nested; + + if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { + #my $decl_type = $1; + $declaration_name = $2; + my $members = $3; + + # ignore embedded structs or unions + $members =~ s/({.*})//g; + $nested = $1; + + # ignore members marked private: + $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gos; + $members =~ s/\/\*\s*private:.*//gos; + # strip comments: + $members =~ s/\/\*.*?\*\///gos; + $nested =~ s/\/\*.*?\*\///gos; + # strip kmemcheck_bitfield_{begin,end}.*; + $members =~ s/kmemcheck_bitfield_.*?;//gos; + + create_parameterlist($members, ';', $file); + check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); + + output_declaration($declaration_name, + 'struct', + {'struct' => $declaration_name, + 'module' => $modulename, + 'parameterlist' => \@parameterlist, + 'parameterdescs' => \%parameterdescs, + 'parametertypes' => \%parametertypes, + 'sectionlist' => \@sectionlist, + 'sections' => \%sections, + 'purpose' => $declaration_purpose, + 'type' => $decl_type + }); + } + else { + print STDERR "Error(${file}:$.): Cannot parse struct or union!\n"; + ++$errors; + } +} + +sub dump_enum($$) { + my $x = shift; + my $file = shift; + + $x =~ s@/\*.*?\*/@@gos; # strip comments. + if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { + $declaration_name = $1; + my $members = $2; + + foreach my $arg (split ',', $members) { + $arg =~ s/^\s*(\w+).*/$1/; + push @parameterlist, $arg; + if (!$parameterdescs{$arg}) { + $parameterdescs{$arg} = $undescribed; + print STDERR "Warning(${file}:$.): Enum value '$arg' ". + "not described in enum '$declaration_name'\n"; + } + + } + + output_declaration($declaration_name, + 'enum', + {'enum' => $declaration_name, + 'module' => $modulename, + 'parameterlist' => \@parameterlist, + 'parameterdescs' => \%parameterdescs, + 'sectionlist' => \@sectionlist, + 'sections' => \%sections, + 'purpose' => $declaration_purpose + }); + } + else { + print STDERR "Error(${file}:$.): Cannot parse enum!\n"; + ++$errors; + } +} + +sub dump_typedef($$) { + my $x = shift; + my $file = shift; + + $x =~ s@/\*.*?\*/@@gos; # strip comments. + while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) { + $x =~ s/\(*.\)\s*;$/;/; + $x =~ s/\[*.\]\s*;$/;/; + } + + if ($x =~ /typedef.*\s+(\w+)\s*;/) { + $declaration_name = $1; + + output_declaration($declaration_name, + 'typedef', + {'typedef' => $declaration_name, + 'module' => $modulename, + 'sectionlist' => \@sectionlist, + 'sections' => \%sections, + 'purpose' => $declaration_purpose + }); + } + else { + print STDERR "Error(${file}:$.): Cannot parse typedef!\n"; + ++$errors; + } +} + +sub save_struct_actual($) { + my $actual = shift; + + # strip all spaces from the actual param so that it looks like one string item + $actual =~ s/\s*//g; + $struct_actual = $struct_actual . $actual . " "; +} + +sub create_parameterlist($$$) { + my $args = shift; + my $splitter = shift; + my $file = shift; + my $type; + my $param; + + # temporarily replace commas inside function pointer definition + while ($args =~ /(\([^\),]+),/) { + $args =~ s/(\([^\),]+),/$1#/g; + } + + foreach my $arg (split($splitter, $args)) { + # strip comments + $arg =~ s/\/\*.*\*\///; + # strip leading/trailing spaces + $arg =~ s/^\s*//; + $arg =~ s/\s*$//; + $arg =~ s/\s+/ /; + + if ($arg =~ /^#/) { + # Treat preprocessor directive as a typeless variable just to fill + # corresponding data structures "correctly". Catch it later in + # output_* subs. + push_parameter($arg, "", $file); + } elsif ($arg =~ m/\(.+\)\s*\(/) { + # pointer-to-function + $arg =~ tr/#/,/; + $arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/; + $param = $1; + $type = $arg; + $type =~ s/([^\(]+\(\*?)\s*$param/$1/; + save_struct_actual($param); + push_parameter($param, $type, $file); + } elsif ($arg) { + $arg =~ s/\s*:\s*/:/g; + $arg =~ s/\s*\[/\[/g; + + my @args = split('\s*,\s*', $arg); + if ($args[0] =~ m/\*/) { + $args[0] =~ s/(\*+)\s*/ $1/; + } + + my @first_arg; + if ($args[0] =~ /^(.*\s+)(.*?\[.*\].*)$/) { + shift @args; + push(@first_arg, split('\s+', $1)); + push(@first_arg, $2); + } else { + @first_arg = split('\s+', shift @args); + } + + unshift(@args, pop @first_arg); + $type = join " ", @first_arg; + + foreach $param (@args) { + if ($param =~ m/^(\*+)\s*(.*)/) { + save_struct_actual($2); + push_parameter($2, "$type $1", $file); + } + elsif ($param =~ m/(.*?):(\d+)/) { + if ($type ne "") { # skip unnamed bit-fields + save_struct_actual($1); + push_parameter($1, "$type:$2", $file) + } + } + else { + save_struct_actual($param); + push_parameter($param, $type, $file); + } + } + } + } +} + +sub push_parameter($$$) { + my $param = shift; + my $type = shift; + my $file = shift; + + if (($anon_struct_union == 1) && ($type eq "") && + ($param eq "}")) { + return; # ignore the ending }; from anon. struct/union + } + + $anon_struct_union = 0; + my $param_name = $param; + $param_name =~ s/\[.*//; + + if ($type eq "" && $param =~ /\.\.\.$/) + { + if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") { + $parameterdescs{$param} = "variable arguments"; + } + } + elsif ($type eq "" && ($param eq "" or $param eq "void")) + { + $param="void"; + $parameterdescs{void} = "no arguments"; + } + elsif ($type eq "" && ($param eq "struct" or $param eq "union")) + # handle unnamed (anonymous) union or struct: + { + $type = $param; + $param = "{unnamed_" . $param . "}"; + $parameterdescs{$param} = "anonymous\n"; + $anon_struct_union = 1; + } + + # warn if parameter has no description + # (but ignore ones starting with # as these are not parameters + # but inline preprocessor statements); + # also ignore unnamed structs/unions; + if (!$anon_struct_union) { + if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) { + + $parameterdescs{$param_name} = $undescribed; + + if (($type eq 'function') || ($type eq 'enum')) { + print STDERR "Warning(${file}:$.): Function parameter ". + "or member '$param' not " . + "described in '$declaration_name'\n"; + } + print STDERR "Warning(${file}:$.):" . + " No description found for parameter '$param'\n"; + ++$warnings; + } + } + + # strip spaces from $param so that it is one continous string + # on @parameterlist; + # this fixes a problem where check_sections() cannot find + # a parameter like "addr[6 + 2]" because it actually appears + # as "addr[6", "+", "2]" on the parameter list; + # but it's better to maintain the param string unchanged for output, + # so just weaken the string compare in check_sections() to ignore + # "[blah" in a parameter string; + ###$param =~ s/\s*//g; + push @parameterlist, $param; + $parametertypes{$param} = $type; +} + +sub check_sections($$$$$$) { + my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck, $nested) = @_; + my @sects = split ' ', $sectcheck; + my @prms = split ' ', $prmscheck; + my $err; + my ($px, $sx); + my $prm_clean; # strip trailing "[array size]" and/or beginning "*" + + foreach $sx (0 .. $#sects) { + $err = 1; + foreach $px (0 .. $#prms) { + $prm_clean = $prms[$px]; + $prm_clean =~ s/\[.*\]//; + $prm_clean =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//; + # ignore array size in a parameter string; + # however, the original param string may contain + # spaces, e.g.: addr[6 + 2] + # and this appears in @prms as "addr[6" since the + # parameter list is split at spaces; + # hence just ignore "[..." for the sections check; + $prm_clean =~ s/\[.*//; + + ##$prm_clean =~ s/^\**//; + if ($prm_clean eq $sects[$sx]) { + $err = 0; + last; + } + } + if ($err) { + if ($decl_type eq "function") { + print STDERR "Warning(${file}:$.): " . + "Excess function parameter " . + "'$sects[$sx]' " . + "description in '$decl_name'\n"; + ++$warnings; + } else { + if ($nested !~ m/\Q$sects[$sx]\E/) { + print STDERR "Warning(${file}:$.): " . + "Excess struct/union/enum/typedef member " . + "'$sects[$sx]' " . + "description in '$decl_name'\n"; + ++$warnings; + } + } + } + } +} + +## +# takes a function prototype and the name of the current file being +# processed and spits out all the details stored in the global +# arrays/hashes. +sub dump_function($$) { + my $prototype = shift; + my $file = shift; + + $prototype =~ s/^static +//; + $prototype =~ s/^extern +//; + $prototype =~ s/^asmlinkage +//; + $prototype =~ s/^inline +//; + $prototype =~ s/^__inline__ +//; + $prototype =~ s/^__inline +//; + $prototype =~ s/^__always_inline +//; + $prototype =~ s/^noinline +//; + $prototype =~ s/__devinit +//; + $prototype =~ s/__init +//; + $prototype =~ s/^#\s*define\s+//; #ak added + $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//; + + # Yes, this truly is vile. We are looking for: + # 1. Return type (may be nothing if we're looking at a macro) + # 2. Function name + # 3. Function parameters. + # + # All the while we have to watch out for function pointer parameters + # (which IIRC is what the two sections are for), C types (these + # regexps don't even start to express all the possibilities), and + # so on. + # + # If you mess with these regexps, it's a good idea to check that + # the following functions' documentation still comes out right: + # - parport_register_device (function pointer parameters) + # - atomic_set (macro) + # - pci_match_device, __copy_to_user (long return type) + + if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =~ m/^(\w+\s+\w+\s*\*\s*\w+\s*\*\s*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/) { + $return_type = $1; + $declaration_name = $2; + my $args = $3; + + create_parameterlist($args, ',', $file); + } else { + print STDERR "Error(${file}:$.): cannot understand prototype: '$prototype'\n"; + ++$errors; + return; + } + + my $prms = join " ", @parameterlist; + check_sections($file, $declaration_name, "function", $sectcheck, $prms, ""); + + output_declaration($declaration_name, + 'function', + {'function' => $declaration_name, + 'module' => $modulename, + 'functiontype' => $return_type, + 'parameterlist' => \@parameterlist, + 'parameterdescs' => \%parameterdescs, + 'parametertypes' => \%parametertypes, + 'sectionlist' => \@sectionlist, + 'sections' => \%sections, + 'purpose' => $declaration_purpose + }); +} + +sub process_file($); + +# Read the file that maps relative names to absolute names for +# separate source and object directories and for shadow trees. +if (open(SOURCE_MAP, "<.tmp_filelist.txt")) { + my ($relname, $absname); + while() { + chop(); + ($relname, $absname) = (split())[0..1]; + $relname =~ s:^/+::; + $source_map{$relname} = $absname; + } + close(SOURCE_MAP); +} + +if ($filelist) { + open(FLIST,"<$filelist") or die "Can't open file list $filelist"; + while() { + chop; + process_file($_); + } +} + +foreach (@ARGV) { + chomp; + process_file($_); +} +if ($verbose && $errors) { + print STDERR "$errors errors\n"; +} +if ($verbose && $warnings) { + print STDERR "$warnings warnings\n"; +} + +exit($errors); + +sub reset_state { + $function = ""; + %constants = (); + %parameterdescs = (); + %parametertypes = (); + @parameterlist = (); + %sections = (); + @sectionlist = (); + $sectcheck = ""; + $struct_actual = ""; + $prototype = ""; + + $state = 0; +} + +sub tracepoint_munge($) { + my $file = shift; + my $tracepointname = 0; + my $tracepointargs = 0; + + if ($prototype =~ m/TRACE_EVENT\((.*?),/) { + $tracepointname = $1; + } + if ($prototype =~ m/DEFINE_SINGLE_EVENT\((.*?),/) { + $tracepointname = $1; + } + if ($prototype =~ m/DEFINE_EVENT\((.*?),(.*?),/) { + $tracepointname = $2; + } + $tracepointname =~ s/^\s+//; #strip leading whitespace + if ($prototype =~ m/TP_PROTO\((.*?)\)/) { + $tracepointargs = $1; + } + if (($tracepointname eq 0) || ($tracepointargs eq 0)) { + print STDERR "Warning(${file}:$.): Unrecognized tracepoint format: \n". + "$prototype\n"; + } else { + $prototype = "static inline void trace_$tracepointname($tracepointargs)"; + } +} + +sub syscall_munge() { + my $void = 0; + + $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs +## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { + if ($prototype =~ m/SYSCALL_DEFINE0/) { + $void = 1; +## $prototype = "long sys_$1(void)"; + } + + $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name + if ($prototype =~ m/long (sys_.*?),/) { + $prototype =~ s/,/\(/; + } elsif ($void) { + $prototype =~ s/\)/\(void\)/; + } + + # now delete all of the odd-number commas in $prototype + # so that arg types & arg names don't have a comma between them + my $count = 0; + my $len = length($prototype); + if ($void) { + $len = 0; # skip the for-loop + } + for (my $ix = 0; $ix < $len; $ix++) { + if (substr($prototype, $ix, 1) eq ',') { + $count++; + if ($count % 2 == 1) { + substr($prototype, $ix, 1) = ' '; + } + } + } +} + +sub process_state3_function($$) { + my $x = shift; + my $file = shift; + + $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line + + if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#\s*define/)) { + # do nothing + } + elsif ($x =~ /([^\{]*)/) { + $prototype .= $1; + } + + if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { + $prototype =~ s@/\*.*?\*/@@gos; # strip comments. + $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. + $prototype =~ s@^\s+@@gos; # strip leading spaces + if ($prototype =~ /SYSCALL_DEFINE/) { + syscall_munge(); + } + if ($prototype =~ /TRACE_EVENT/ || $prototype =~ /DEFINE_EVENT/ || + $prototype =~ /DEFINE_SINGLE_EVENT/) + { + tracepoint_munge($file); + } + dump_function($prototype, $file); + reset_state(); + } +} + +sub process_state3_type($$) { + my $x = shift; + my $file = shift; + + $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's. + $x =~ s@^\s+@@gos; # strip leading spaces + $x =~ s@\s+$@@gos; # strip trailing spaces + $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line + + if ($x =~ /^#/) { + # To distinguish preprocessor directive from regular declaration later. + $x .= ";"; + } + + while (1) { + if ( $x =~ /([^{};]*)([{};])(.*)/ ) { + $prototype .= $1 . $2; + ($2 eq '{') && $brcount++; + ($2 eq '}') && $brcount--; + if (($2 eq ';') && ($brcount == 0)) { + dump_declaration($prototype, $file); + reset_state(); + last; + } + $x = $3; + } else { + $prototype .= $x; + last; + } + } +} + +# xml_escape: replace <, >, and & in the text stream; +# +# however, formatting controls that are generated internally/locally in the +# kernel-doc script are not escaped here; instead, they begin life like +# $blankline_html (4 of '\' followed by a mnemonic + ':'), then these strings +# are converted to their mnemonic-expected output, without the 4 * '\' & ':', +# just before actual output; (this is done by local_unescape()) +sub xml_escape($) { + my $text = shift; + if (($output_mode eq "text") || ($output_mode eq "man")) { + return $text; + } + $text =~ s/\&/\\\\\\amp;/g; + $text =~ s/\/\\\\\\gt;/g; + return $text; +} + +# convert local escape strings to html +# local escape strings look like: '\\\\menmonic:' (that's 4 backslashes) +sub local_unescape($) { + my $text = shift; + if (($output_mode eq "text") || ($output_mode eq "man")) { + return $text; + } + $text =~ s/\\\\\\\\lt://g; + return $text; +} + +sub process_file($) { + my $file; + my $identifier; + my $func; + my $descr; + my $in_purpose = 0; + my $initial_section_counter = $section_counter; + + if (defined($ENV{'SRCTREE'})) { + $file = "$ENV{'SRCTREE'}" . "/" . "@_"; + } + else { + $file = "@_"; + } + if (defined($source_map{$file})) { + $file = $source_map{$file}; + } + + if (!open(IN,"<$file")) { + print STDERR "Error: Cannot open file $file\n"; + ++$errors; + return; + } + + $section_counter = 0; + while () { + if ($state == 0) { + if (/$doc_start/o) { + $state = 1; # next line is always the function name + $in_doc_sect = 0; + } + } elsif ($state == 1) { # this line is the function name (always) + if (/$doc_block/o) { + $state = 4; + $contents = ""; + if ( $1 eq "" ) { + $section = $section_intro; + } else { + $section = $1; + } + } + elsif (/$doc_decl/o) { + $identifier = $1; + if (/\s*([\w\s]+?)\s*-/) { + $identifier = $1; + } + + $state = 2; + if (/-(.*)/) { + # strip leading/trailing/multiple spaces + $descr= $1; + $descr =~ s/^\s*//; + $descr =~ s/\s*$//; + $descr =~ s/\s+/ /; + $declaration_purpose = xml_escape($descr); + $in_purpose = 1; + } else { + $declaration_purpose = ""; + } + + if (($declaration_purpose eq "") && $verbose) { + print STDERR "Warning(${file}:$.): missing initial short description on line:\n"; + print STDERR $_; + ++$warnings; + } + + if ($identifier =~ m/^struct/) { + $decl_type = 'struct'; + } elsif ($identifier =~ m/^union/) { + $decl_type = 'union'; + } elsif ($identifier =~ m/^enum/) { + $decl_type = 'enum'; + } elsif ($identifier =~ m/^typedef/) { + $decl_type = 'typedef'; + } else { + $decl_type = 'function'; + } + + if ($verbose) { + print STDERR "Info(${file}:$.): Scanning doc for $identifier\n"; + } + } else { + print STDERR "Warning(${file}:$.): Cannot understand $_ on line $.", + " - I thought it was a doc line\n"; + ++$warnings; + $state = 0; + } + } elsif ($state == 2) { # look for head: lines, and include content + if (/$doc_sect/o) { + $newsection = $1; + $newcontents = $2; + + if (($contents ne "") && ($contents ne "\n")) { + if (!$in_doc_sect && $verbose) { + print STDERR "Warning(${file}:$.): contents before sections\n"; + ++$warnings; + } + dump_section($file, $section, xml_escape($contents)); + $section = $section_default; + } + + $in_doc_sect = 1; + $in_purpose = 0; + $contents = $newcontents; + if ($contents ne "") { + while ((substr($contents, 0, 1) eq " ") || + substr($contents, 0, 1) eq "\t") { + $contents = substr($contents, 1); + } + $contents .= "\n"; + } + $section = $newsection; + } elsif (/$doc_end/) { + + if ($contents ne "") { + dump_section($file, $section, xml_escape($contents)); + $section = $section_default; + $contents = ""; + } + # look for doc_com + + doc_end: + if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') { + print STDERR "Warning(${file}:$.): suspicious ending line: $_"; + ++$warnings; + } + + $prototype = ""; + $state = 3; + $brcount = 0; +# print STDERR "end of doc comment, looking for prototype\n"; + } elsif (/$doc_content/) { + # miguel-style comment kludge, look for blank lines after + # @parameter line to signify start of description + if ($1 eq "") { + if ($section =~ m/^@/ || $section eq $section_context) { + dump_section($file, $section, xml_escape($contents)); + $section = $section_default; + $contents = ""; + } else { + $contents .= "\n"; + } + $in_purpose = 0; + } elsif ($in_purpose == 1) { + # Continued declaration purpose + chomp($declaration_purpose); + $declaration_purpose .= " " . xml_escape($1); + } else { + $contents .= $1 . "\n"; + } + } else { + # i dont know - bad line? ignore. + print STDERR "Warning(${file}:$.): bad line: $_"; + ++$warnings; + } + } elsif ($state == 3) { # scanning for function '{' (end of prototype) + if ($decl_type eq 'function') { + process_state3_function($_, $file); + } else { + process_state3_type($_, $file); + } + } elsif ($state == 4) { + # Documentation block + if (/$doc_block/) { + dump_doc_section($file, $section, xml_escape($contents)); + $contents = ""; + $function = ""; + %constants = (); + %parameterdescs = (); + %parametertypes = (); + @parameterlist = (); + %sections = (); + @sectionlist = (); + $prototype = ""; + if ( $1 eq "" ) { + $section = $section_intro; + } else { + $section = $1; + } + } + elsif (/$doc_end/) + { + dump_doc_section($file, $section, xml_escape($contents)); + $contents = ""; + $function = ""; + %constants = (); + %parameterdescs = (); + %parametertypes = (); + @parameterlist = (); + %sections = (); + @sectionlist = (); + $prototype = ""; + $state = 0; + } + elsif (/$doc_content/) + { + if ( $1 eq "" ) + { + $contents .= $blankline; + } + else + { + $contents .= $1 . "\n"; + } + } + } + } + if ($initial_section_counter == $section_counter) { + print STDERR "Warning(${file}): no structured comments found\n"; + if ($output_mode eq "xml") { + # The template wants at least one RefEntry here; make one. + print "\n"; + print " \n"; + print " \n"; + print " ${file}\n"; + print " \n"; + print " \n"; + print " Document generation inconsistency\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " Oops\n"; + print " \n"; + print " \n"; + print " \n"; + print " The template for this document tried to insert\n"; + print " the structured comment from the file\n"; + print " ${file} at this point,\n"; + print " but none was found.\n"; + print " This dummy section is inserted to allow\n"; + print " generation to continue.\n"; + print " \n"; + print " \n"; + print " \n"; + print "\n"; + } + } +} diff --git a/libs/libwebsockets/test-server/Makefile.am b/libs/libwebsockets/test-server/Makefile.am new file mode 100644 index 0000000000..a74b0e6148 --- /dev/null +++ b/libs/libwebsockets/test-server/Makefile.am @@ -0,0 +1,61 @@ +bin_PROGRAMS=libwebsockets-test-server libwebsockets-test-client libwebsockets-test-server-extpoll libwebsockets-test-fraggle +libwebsockets_test_server_SOURCES=test-server.c +libwebsockets_test_server_LDADD=-L../lib -lwebsockets -lz +libwebsockets_test_client_SOURCES=test-client.c +libwebsockets_test_client_LDADD=-L../lib -lwebsockets -lz +libwebsockets_test_server_extpoll_SOURCES=test-server-extpoll.c +libwebsockets_test_server_extpoll_LDADD=-L../lib -lwebsockets -lz +libwebsockets_test_fraggle_SOURCES=test-fraggle.c +libwebsockets_test_fraggle_LDADD=-L../lib -lwebsockets -lz + +if MINGW +libwebsockets_test_server_CFLAGS:= -w -I../win32port/win32helpers +libwebsockets_test_client_CFLAGS:= -w -I../win32port/win32helpers +libwebsockets_test_server_extpoll_CFLAGS:= -w -I../win32port/win32helpers +libwebsockets_test_fraggle_CFLAGS:= -w -I../win32port/win32helpers + +libwebsockets_test_server_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz +libwebsockets_test_client_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz +libwebsockets_test_server_extpoll_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz +libwebsockets_test_fraggle_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz + +else +libwebsockets_test_server_CFLAGS:= -Werror +libwebsockets_test_client_CFLAGS:= -Werror +libwebsockets_test_server_extpoll_CFLAGS:= -Werror +libwebsockets_test_fraggle_CFLAGS:= -Werror +endif + +libwebsockets_test_server_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +libwebsockets_test_client_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +libwebsockets_test_server_extpoll_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +libwebsockets_test_fraggle_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" + + +if NOPING +else +bin_PROGRAMS+=libwebsockets-test-ping +libwebsockets_test_ping_SOURCES=test-ping.c +libwebsockets_test_ping_LDADD=-L../lib -lwebsockets +libwebsockets_test_ping_CFLAGS:= -Wall -Werror -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +endif + + +# +# cook a random test cert and key +# notice your real cert and key will want to be 0600 permissions +libwebsockets-test-server.pem libwebsockets-test-server.key.pem: + printf "GB\nErewhon\nAll around\nlibwebsockets-test\n\nlocalhost\nnone@invalid.org\n" | \ + openssl req -new -newkey rsa:1024 -days 10000 -nodes -x509 -keyout \ + ./libwebsockets-test-server.key.pem -out ./libwebsockets-test-server.pem >/dev/null 2>&1 && \ + chmod 644 ./libwebsockets-test-server.key.pem \ + ./libwebsockets-test-server.pem + +clean-local: + rm -f ./libwebsockets-test-server.key.pem ./libwebsockets-test-server.pem + +install-data-local:libwebsockets-test-server.key.pem libwebsockets-test-server.pem + mkdir -p $(DESTDIR)$(datadir)/libwebsockets-test-server + cp -a test.html favicon.ico libwebsockets-test-server.key.pem libwebsockets-test-server.pem \ + $(DESTDIR)$(datadir)/libwebsockets-test-server + diff --git a/libs/libwebsockets/test-server/Makefile.in b/libs/libwebsockets/test-server/Makefile.in new file mode 100644 index 0000000000..919c8aecc3 --- /dev/null +++ b/libs/libwebsockets/test-server/Makefile.in @@ -0,0 +1,722 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = libwebsockets-test-server$(EXEEXT) \ + libwebsockets-test-client$(EXEEXT) \ + libwebsockets-test-server-extpoll$(EXEEXT) \ + libwebsockets-test-fraggle$(EXEEXT) $(am__EXEEXT_1) +@MINGW_TRUE@am__append_1 = -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz +@MINGW_TRUE@am__append_2 = -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz +@MINGW_TRUE@am__append_3 = -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz +@MINGW_TRUE@am__append_4 = -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz +@NOPING_FALSE@am__append_5 = libwebsockets-test-ping +subdir = test-server +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@NOPING_FALSE@am__EXEEXT_1 = libwebsockets-test-ping$(EXEEXT) +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_libwebsockets_test_client_OBJECTS = \ + libwebsockets_test_client-test-client.$(OBJEXT) +libwebsockets_test_client_OBJECTS = \ + $(am_libwebsockets_test_client_OBJECTS) +am__DEPENDENCIES_1 = +libwebsockets_test_client_DEPENDENCIES = $(am__DEPENDENCIES_1) +libwebsockets_test_client_LINK = $(LIBTOOL) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libwebsockets_test_client_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_libwebsockets_test_fraggle_OBJECTS = \ + libwebsockets_test_fraggle-test-fraggle.$(OBJEXT) +libwebsockets_test_fraggle_OBJECTS = \ + $(am_libwebsockets_test_fraggle_OBJECTS) +libwebsockets_test_fraggle_DEPENDENCIES = $(am__DEPENDENCIES_1) +libwebsockets_test_fraggle_LINK = $(LIBTOOL) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libwebsockets_test_fraggle_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__libwebsockets_test_ping_SOURCES_DIST = test-ping.c +@NOPING_FALSE@am_libwebsockets_test_ping_OBJECTS = \ +@NOPING_FALSE@ libwebsockets_test_ping-test-ping.$(OBJEXT) +libwebsockets_test_ping_OBJECTS = \ + $(am_libwebsockets_test_ping_OBJECTS) +libwebsockets_test_ping_DEPENDENCIES = +libwebsockets_test_ping_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libwebsockets_test_ping_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_libwebsockets_test_server_OBJECTS = \ + libwebsockets_test_server-test-server.$(OBJEXT) +libwebsockets_test_server_OBJECTS = \ + $(am_libwebsockets_test_server_OBJECTS) +libwebsockets_test_server_DEPENDENCIES = $(am__DEPENDENCIES_1) +libwebsockets_test_server_LINK = $(LIBTOOL) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libwebsockets_test_server_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_libwebsockets_test_server_extpoll_OBJECTS = libwebsockets_test_server_extpoll-test-server-extpoll.$(OBJEXT) +libwebsockets_test_server_extpoll_OBJECTS = \ + $(am_libwebsockets_test_server_extpoll_OBJECTS) +libwebsockets_test_server_extpoll_DEPENDENCIES = \ + $(am__DEPENDENCIES_1) +libwebsockets_test_server_extpoll_LINK = $(LIBTOOL) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libwebsockets_test_server_extpoll_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libwebsockets_test_client_SOURCES) \ + $(libwebsockets_test_fraggle_SOURCES) \ + $(libwebsockets_test_ping_SOURCES) \ + $(libwebsockets_test_server_SOURCES) \ + $(libwebsockets_test_server_extpoll_SOURCES) +DIST_SOURCES = $(libwebsockets_test_client_SOURCES) \ + $(libwebsockets_test_fraggle_SOURCES) \ + $(am__libwebsockets_test_ping_SOURCES_DIST) \ + $(libwebsockets_test_server_SOURCES) \ + $(libwebsockets_test_server_extpoll_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +clientcertdir = @clientcertdir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +libwebsockets_test_server_SOURCES = test-server.c +libwebsockets_test_server_LDADD = -L../lib -lwebsockets -lz \ + $(am__append_1) +libwebsockets_test_client_SOURCES = test-client.c +libwebsockets_test_client_LDADD = -L../lib -lwebsockets -lz \ + $(am__append_2) +libwebsockets_test_server_extpoll_SOURCES = test-server-extpoll.c +libwebsockets_test_server_extpoll_LDADD = -L../lib -lwebsockets -lz \ + $(am__append_3) +libwebsockets_test_fraggle_SOURCES = test-fraggle.c +libwebsockets_test_fraggle_LDADD = -L../lib -lwebsockets -lz \ + $(am__append_4) +@MINGW_FALSE@libwebsockets_test_server_CFLAGS := -Werror -Wall \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@MINGW_TRUE@libwebsockets_test_server_CFLAGS := -w \ +@MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@MINGW_FALSE@libwebsockets_test_client_CFLAGS := -Werror -Wall \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@MINGW_TRUE@libwebsockets_test_client_CFLAGS := -w \ +@MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@MINGW_FALSE@libwebsockets_test_server_extpoll_CFLAGS := -Werror -Wall \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@MINGW_TRUE@libwebsockets_test_server_extpoll_CFLAGS := -w \ +@MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@MINGW_FALSE@libwebsockets_test_fraggle_CFLAGS := -Werror -Wall \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@MINGW_TRUE@libwebsockets_test_fraggle_CFLAGS := -w \ +@MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@NOPING_FALSE@libwebsockets_test_ping_SOURCES = test-ping.c +@NOPING_FALSE@libwebsockets_test_ping_LDADD = -L../lib -lwebsockets +@NOPING_FALSE@libwebsockets_test_ping_CFLAGS := -Wall -Werror -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test-server/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test-server/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +libwebsockets-test-client$(EXEEXT): $(libwebsockets_test_client_OBJECTS) $(libwebsockets_test_client_DEPENDENCIES) $(EXTRA_libwebsockets_test_client_DEPENDENCIES) + @rm -f libwebsockets-test-client$(EXEEXT) + $(libwebsockets_test_client_LINK) $(libwebsockets_test_client_OBJECTS) $(libwebsockets_test_client_LDADD) $(LIBS) +libwebsockets-test-fraggle$(EXEEXT): $(libwebsockets_test_fraggle_OBJECTS) $(libwebsockets_test_fraggle_DEPENDENCIES) $(EXTRA_libwebsockets_test_fraggle_DEPENDENCIES) + @rm -f libwebsockets-test-fraggle$(EXEEXT) + $(libwebsockets_test_fraggle_LINK) $(libwebsockets_test_fraggle_OBJECTS) $(libwebsockets_test_fraggle_LDADD) $(LIBS) +libwebsockets-test-ping$(EXEEXT): $(libwebsockets_test_ping_OBJECTS) $(libwebsockets_test_ping_DEPENDENCIES) $(EXTRA_libwebsockets_test_ping_DEPENDENCIES) + @rm -f libwebsockets-test-ping$(EXEEXT) + $(libwebsockets_test_ping_LINK) $(libwebsockets_test_ping_OBJECTS) $(libwebsockets_test_ping_LDADD) $(LIBS) +libwebsockets-test-server$(EXEEXT): $(libwebsockets_test_server_OBJECTS) $(libwebsockets_test_server_DEPENDENCIES) $(EXTRA_libwebsockets_test_server_DEPENDENCIES) + @rm -f libwebsockets-test-server$(EXEEXT) + $(libwebsockets_test_server_LINK) $(libwebsockets_test_server_OBJECTS) $(libwebsockets_test_server_LDADD) $(LIBS) +libwebsockets-test-server-extpoll$(EXEEXT): $(libwebsockets_test_server_extpoll_OBJECTS) $(libwebsockets_test_server_extpoll_DEPENDENCIES) $(EXTRA_libwebsockets_test_server_extpoll_DEPENDENCIES) + @rm -f libwebsockets-test-server-extpoll$(EXEEXT) + $(libwebsockets_test_server_extpoll_LINK) $(libwebsockets_test_server_extpoll_OBJECTS) $(libwebsockets_test_server_extpoll_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_test_client-test-client.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_test_fraggle-test-fraggle.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_test_ping-test-ping.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_test_server-test-server.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_test_server_extpoll-test-server-extpoll.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libwebsockets_test_client-test-client.o: test-client.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_client_CFLAGS) $(CFLAGS) -MT libwebsockets_test_client-test-client.o -MD -MP -MF $(DEPDIR)/libwebsockets_test_client-test-client.Tpo -c -o libwebsockets_test_client-test-client.o `test -f 'test-client.c' || echo '$(srcdir)/'`test-client.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_client-test-client.Tpo $(DEPDIR)/libwebsockets_test_client-test-client.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-client.c' object='libwebsockets_test_client-test-client.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_client_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_client-test-client.o `test -f 'test-client.c' || echo '$(srcdir)/'`test-client.c + +libwebsockets_test_client-test-client.obj: test-client.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_client_CFLAGS) $(CFLAGS) -MT libwebsockets_test_client-test-client.obj -MD -MP -MF $(DEPDIR)/libwebsockets_test_client-test-client.Tpo -c -o libwebsockets_test_client-test-client.obj `if test -f 'test-client.c'; then $(CYGPATH_W) 'test-client.c'; else $(CYGPATH_W) '$(srcdir)/test-client.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_client-test-client.Tpo $(DEPDIR)/libwebsockets_test_client-test-client.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-client.c' object='libwebsockets_test_client-test-client.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_client_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_client-test-client.obj `if test -f 'test-client.c'; then $(CYGPATH_W) 'test-client.c'; else $(CYGPATH_W) '$(srcdir)/test-client.c'; fi` + +libwebsockets_test_fraggle-test-fraggle.o: test-fraggle.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_fraggle_CFLAGS) $(CFLAGS) -MT libwebsockets_test_fraggle-test-fraggle.o -MD -MP -MF $(DEPDIR)/libwebsockets_test_fraggle-test-fraggle.Tpo -c -o libwebsockets_test_fraggle-test-fraggle.o `test -f 'test-fraggle.c' || echo '$(srcdir)/'`test-fraggle.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_fraggle-test-fraggle.Tpo $(DEPDIR)/libwebsockets_test_fraggle-test-fraggle.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-fraggle.c' object='libwebsockets_test_fraggle-test-fraggle.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_fraggle_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_fraggle-test-fraggle.o `test -f 'test-fraggle.c' || echo '$(srcdir)/'`test-fraggle.c + +libwebsockets_test_fraggle-test-fraggle.obj: test-fraggle.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_fraggle_CFLAGS) $(CFLAGS) -MT libwebsockets_test_fraggle-test-fraggle.obj -MD -MP -MF $(DEPDIR)/libwebsockets_test_fraggle-test-fraggle.Tpo -c -o libwebsockets_test_fraggle-test-fraggle.obj `if test -f 'test-fraggle.c'; then $(CYGPATH_W) 'test-fraggle.c'; else $(CYGPATH_W) '$(srcdir)/test-fraggle.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_fraggle-test-fraggle.Tpo $(DEPDIR)/libwebsockets_test_fraggle-test-fraggle.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-fraggle.c' object='libwebsockets_test_fraggle-test-fraggle.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_fraggle_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_fraggle-test-fraggle.obj `if test -f 'test-fraggle.c'; then $(CYGPATH_W) 'test-fraggle.c'; else $(CYGPATH_W) '$(srcdir)/test-fraggle.c'; fi` + +libwebsockets_test_ping-test-ping.o: test-ping.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_ping_CFLAGS) $(CFLAGS) -MT libwebsockets_test_ping-test-ping.o -MD -MP -MF $(DEPDIR)/libwebsockets_test_ping-test-ping.Tpo -c -o libwebsockets_test_ping-test-ping.o `test -f 'test-ping.c' || echo '$(srcdir)/'`test-ping.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_ping-test-ping.Tpo $(DEPDIR)/libwebsockets_test_ping-test-ping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-ping.c' object='libwebsockets_test_ping-test-ping.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_ping_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_ping-test-ping.o `test -f 'test-ping.c' || echo '$(srcdir)/'`test-ping.c + +libwebsockets_test_ping-test-ping.obj: test-ping.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_ping_CFLAGS) $(CFLAGS) -MT libwebsockets_test_ping-test-ping.obj -MD -MP -MF $(DEPDIR)/libwebsockets_test_ping-test-ping.Tpo -c -o libwebsockets_test_ping-test-ping.obj `if test -f 'test-ping.c'; then $(CYGPATH_W) 'test-ping.c'; else $(CYGPATH_W) '$(srcdir)/test-ping.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_ping-test-ping.Tpo $(DEPDIR)/libwebsockets_test_ping-test-ping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-ping.c' object='libwebsockets_test_ping-test-ping.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_ping_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_ping-test-ping.obj `if test -f 'test-ping.c'; then $(CYGPATH_W) 'test-ping.c'; else $(CYGPATH_W) '$(srcdir)/test-ping.c'; fi` + +libwebsockets_test_server-test-server.o: test-server.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_CFLAGS) $(CFLAGS) -MT libwebsockets_test_server-test-server.o -MD -MP -MF $(DEPDIR)/libwebsockets_test_server-test-server.Tpo -c -o libwebsockets_test_server-test-server.o `test -f 'test-server.c' || echo '$(srcdir)/'`test-server.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_server-test-server.Tpo $(DEPDIR)/libwebsockets_test_server-test-server.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-server.c' object='libwebsockets_test_server-test-server.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_server-test-server.o `test -f 'test-server.c' || echo '$(srcdir)/'`test-server.c + +libwebsockets_test_server-test-server.obj: test-server.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_CFLAGS) $(CFLAGS) -MT libwebsockets_test_server-test-server.obj -MD -MP -MF $(DEPDIR)/libwebsockets_test_server-test-server.Tpo -c -o libwebsockets_test_server-test-server.obj `if test -f 'test-server.c'; then $(CYGPATH_W) 'test-server.c'; else $(CYGPATH_W) '$(srcdir)/test-server.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_server-test-server.Tpo $(DEPDIR)/libwebsockets_test_server-test-server.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-server.c' object='libwebsockets_test_server-test-server.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_server-test-server.obj `if test -f 'test-server.c'; then $(CYGPATH_W) 'test-server.c'; else $(CYGPATH_W) '$(srcdir)/test-server.c'; fi` + +libwebsockets_test_server_extpoll-test-server-extpoll.o: test-server-extpoll.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_extpoll_CFLAGS) $(CFLAGS) -MT libwebsockets_test_server_extpoll-test-server-extpoll.o -MD -MP -MF $(DEPDIR)/libwebsockets_test_server_extpoll-test-server-extpoll.Tpo -c -o libwebsockets_test_server_extpoll-test-server-extpoll.o `test -f 'test-server-extpoll.c' || echo '$(srcdir)/'`test-server-extpoll.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_server_extpoll-test-server-extpoll.Tpo $(DEPDIR)/libwebsockets_test_server_extpoll-test-server-extpoll.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-server-extpoll.c' object='libwebsockets_test_server_extpoll-test-server-extpoll.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_extpoll_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_server_extpoll-test-server-extpoll.o `test -f 'test-server-extpoll.c' || echo '$(srcdir)/'`test-server-extpoll.c + +libwebsockets_test_server_extpoll-test-server-extpoll.obj: test-server-extpoll.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_extpoll_CFLAGS) $(CFLAGS) -MT libwebsockets_test_server_extpoll-test-server-extpoll.obj -MD -MP -MF $(DEPDIR)/libwebsockets_test_server_extpoll-test-server-extpoll.Tpo -c -o libwebsockets_test_server_extpoll-test-server-extpoll.obj `if test -f 'test-server-extpoll.c'; then $(CYGPATH_W) 'test-server-extpoll.c'; else $(CYGPATH_W) '$(srcdir)/test-server-extpoll.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libwebsockets_test_server_extpoll-test-server-extpoll.Tpo $(DEPDIR)/libwebsockets_test_server_extpoll-test-server-extpoll.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-server-extpoll.c' object='libwebsockets_test_server_extpoll-test-server-extpoll.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_test_server_extpoll_CFLAGS) $(CFLAGS) -c -o libwebsockets_test_server_extpoll-test-server-extpoll.obj `if test -f 'test-server-extpoll.c'; then $(CYGPATH_W) 'test-server-extpoll.c'; else $(CYGPATH_W) '$(srcdir)/test-server-extpoll.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-data-local + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-local ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-data-local install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS + + +# +# cook a random test cert and key +# notice your real cert and key will want to be 0600 permissions +libwebsockets-test-server.pem libwebsockets-test-server.key.pem: + printf "GB\nErewhon\nAll around\nlibwebsockets-test\n\nlocalhost\nnone@invalid.org\n" | \ + openssl req -new -newkey rsa:1024 -days 10000 -nodes -x509 -keyout \ + ./libwebsockets-test-server.key.pem -out ./libwebsockets-test-server.pem >/dev/null 2>&1 && \ + chmod 644 ./libwebsockets-test-server.key.pem \ + ./libwebsockets-test-server.pem + +clean-local: + rm -f ./libwebsockets-test-server.key.pem ./libwebsockets-test-server.pem + +install-data-local:libwebsockets-test-server.key.pem libwebsockets-test-server.pem + mkdir -p $(DESTDIR)$(datadir)/libwebsockets-test-server + cp -a test.html favicon.ico libwebsockets-test-server.key.pem libwebsockets-test-server.pem \ + $(DESTDIR)$(datadir)/libwebsockets-test-server + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libs/libwebsockets/test-server/favicon.ico b/libs/libwebsockets/test-server/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..c0cc2e3dff34012ba3d4a7848a7ed17579788ec5 GIT binary patch literal 1406 zcmZQzU<5(|0R}M0U}azs1F|%L7$l?s#Ec9aKoZP=&`9i!<^REA8>%80(yxAC$j<-A zkb5S8;qL6446ipNFl>5#fuVR6L=8goC~GtXMnhmYga9MSfQgBTk&TUw5$JocUP63y z3phA97+G0a8QIy{!BT|y==xb$SQt4uIT@LmnZZ(o_~`mk`Tv1M8w?+DXJCL~kQj^& JqOtKoVgQl$ETjMc literal 0 HcmV?d00001 diff --git a/libs/libwebsockets/test-server/test-client.c b/libs/libwebsockets/test-server/test-client.c new file mode 100644 index 0000000000..ffd636569b --- /dev/null +++ b/libs/libwebsockets/test-server/test-client.c @@ -0,0 +1,341 @@ +/* + * libwebsockets-test-client - libwebsockets test implementation + * + * Copyright (C) 2011 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include + +#include "../lib/libwebsockets.h" + +static unsigned int opts; +static int was_closed; +static int deny_deflate; +static int deny_mux; +static struct libwebsocket *wsi_mirror; + +/* + * This demo shows how to connect multiple websockets simultaneously to a + * websocket server (there is no restriction on their having to be the same + * server just it simplifies the demo). + * + * dumb-increment-protocol: we connect to the server and print the number + * we are given + * + * lws-mirror-protocol: draws random circles, which are mirrored on to every + * client (see them being drawn in every browser + * session also using the test server) + */ + +enum demo_protocols { + + PROTOCOL_DUMB_INCREMENT, + PROTOCOL_LWS_MIRROR, + + /* always last */ + DEMO_PROTOCOL_COUNT +}; + + +/* dumb_increment protocol */ + +static int +callback_dumb_increment(struct libwebsocket_context *this, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + switch (reason) { + + case LWS_CALLBACK_CLOSED: + fprintf(stderr, "LWS_CALLBACK_CLOSED\n"); + was_closed = 1; + break; + + case LWS_CALLBACK_CLIENT_RECEIVE: + ((char *)in)[len] = '\0'; + fprintf(stderr, "rx %d '%s'\n", (int)len, (char *)in); + break; + + /* because we are protocols[0] ... */ + + case LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED: + if ((strcmp(in, "deflate-stream") == 0) && deny_deflate) { + fprintf(stderr, "denied deflate-stream extension\n"); + return 1; + } + if ((strcmp(in, "x-google-mux") == 0) && deny_mux) { + fprintf(stderr, "denied x-google-mux extension\n"); + return 1; + } + + break; + + default: + break; + } + + return 0; +} + + +/* lws-mirror_protocol */ + + +static int +callback_lws_mirror(struct libwebsocket_context *this, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 4096 + + LWS_SEND_BUFFER_POST_PADDING]; + int l; + + switch (reason) { + + case LWS_CALLBACK_CLOSED: + fprintf(stderr, "mirror: LWS_CALLBACK_CLOSED\n"); + wsi_mirror = NULL; + break; + + case LWS_CALLBACK_CLIENT_ESTABLISHED: + + /* + * start the ball rolling, + * LWS_CALLBACK_CLIENT_WRITEABLE will come next service + */ + + libwebsocket_callback_on_writable(this, wsi); + break; + + case LWS_CALLBACK_CLIENT_RECEIVE: +/* fprintf(stderr, "rx %d '%s'\n", (int)len, (char *)in); */ + break; + + case LWS_CALLBACK_CLIENT_WRITEABLE: + + l = sprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING], + "c #%06X %d %d %d;", + (int)random() & 0xffffff, + (int)random() % 500, + (int)random() % 250, + (int)random() % 24); + + libwebsocket_write(wsi, + &buf[LWS_SEND_BUFFER_PRE_PADDING], l, opts | LWS_WRITE_TEXT); + + /* get notified as soon as we can write again */ + + libwebsocket_callback_on_writable(this, wsi); + + /* + * without at least this delay, we choke the browser + * and the connection stalls, despite we now take care about + * flow control + */ + + usleep(200); + break; + + default: + break; + } + + return 0; +} + + +/* list of supported protocols and callbacks */ + +static struct libwebsocket_protocols protocols[] = { + { + "dumb-increment-protocol", + callback_dumb_increment, + 0, + }, + { + "lws-mirror-protocol", + callback_lws_mirror, + 0, + }, + { /* end of list */ + NULL, + NULL, + 0 + } +}; + +static struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "port", required_argument, NULL, 'p' }, + { "ssl", no_argument, NULL, 's' }, + { "killmask", no_argument, NULL, 'k' }, + { "version", required_argument, NULL, 'v' }, + { "undeflated", no_argument, NULL, 'u' }, + { "nomux", no_argument, NULL, 'n' }, + { NULL, 0, 0, 0 } +}; + + +int main(int argc, char **argv) +{ + int n = 0; + int port = 7681; + int use_ssl = 0; + struct libwebsocket_context *context; + const char *address; + struct libwebsocket *wsi_dumb; + int ietf_version = -1; /* latest */ + int mirror_lifetime = 0; + + fprintf(stderr, "libwebsockets test client\n" + "(C) Copyright 2010 Andy Green " + "licensed under LGPL2.1\n"); + + if (argc < 2) + goto usage; + + while (n >= 0) { + n = getopt_long(argc, argv, "nuv:khsp:", options, NULL); + if (n < 0) + continue; + switch (n) { + case 's': + use_ssl = 2; /* 2 = allow selfsigned */ + break; + case 'p': + port = atoi(optarg); + break; + case 'k': + opts = LWS_WRITE_CLIENT_IGNORE_XOR_MASK; + break; + case 'v': + ietf_version = atoi(optarg); + break; + case 'u': + deny_deflate = 1; + break; + case 'n': + deny_mux = 1; + break; + case 'h': + goto usage; + } + } + + if (optind >= argc) + goto usage; + + address = argv[optind]; + + /* + * create the websockets context. This tracks open connections and + * knows how to route any traffic and which protocol version to use, + * and if each connection is client or server side. + * + * For this client-only demo, we tell it to not listen on any port. + */ + + context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL, + protocols, libwebsocket_internal_extensions, + NULL, NULL, -1, -1, 0); + if (context == NULL) { + fprintf(stderr, "Creating libwebsocket context failed\n"); + return 1; + } + + + /* create a client websocket using dumb increment protocol */ + + wsi_dumb = libwebsocket_client_connect(context, address, port, use_ssl, + "/", argv[optind], argv[optind], + protocols[PROTOCOL_DUMB_INCREMENT].name, ietf_version); + + if (wsi_dumb == NULL) { + fprintf(stderr, "libwebsocket dumb connect failed\n"); + return -1; + } + + fprintf(stderr, "Websocket connections opened\n"); + + /* + * sit there servicing the websocket context to handle incoming + * packets, and drawing random circles on the mirror protocol websocket + */ + + n = 0; + while (n >= 0 && !was_closed) { + n = libwebsocket_service(context, 1000); + + if (n < 0) + continue; + + if (wsi_mirror == NULL) { + + /* create a client websocket using mirror protocol */ + + wsi_mirror = libwebsocket_client_connect(context, + address, port, use_ssl, "/", + argv[optind], argv[optind], + protocols[PROTOCOL_LWS_MIRROR].name, + ietf_version); + + if (wsi_mirror == NULL) { + fprintf(stderr, "libwebsocket " + "dumb connect failed\n"); + return -1; + } + + mirror_lifetime = 10 + (random() & 1023); + + fprintf(stderr, "opened mirror connection with " + "%d lifetime\n", mirror_lifetime); + + } else { + + mirror_lifetime--; + if (mirror_lifetime == 0) { + fprintf(stderr, "closing mirror session\n"); + libwebsocket_close_and_free_session(context, + wsi_mirror, LWS_CLOSE_STATUS_GOINGAWAY); + + /* + * wsi_mirror will get set to NULL in + * callback when close completes + */ + } + } + } + + fprintf(stderr, "Exiting\n"); + + libwebsocket_context_destroy(context); + + return 0; + +usage: + fprintf(stderr, "Usage: libwebsockets-test-client " + " [--port=

] " + "[--ssl] [-k] [-v ]\n"); + return 1; +} diff --git a/libs/libwebsockets/test-server/test-fraggle.c b/libs/libwebsockets/test-server/test-fraggle.c new file mode 100644 index 0000000000..1c77d59fe8 --- /dev/null +++ b/libs/libwebsockets/test-server/test-fraggle.c @@ -0,0 +1,333 @@ +/* + * libwebsockets-test-fraggle - random fragmentation test + * + * Copyright (C) 2010-2011 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include + +#include "../lib/libwebsockets.h" + +#define LOCAL_RESOURCE_PATH INSTALL_DATADIR"/libwebsockets-test-server" + +static int client; +static int terminate; + +enum demo_protocols { + PROTOCOL_FRAGGLE, + + /* always last */ + DEMO_PROTOCOL_COUNT +}; + +/* fraggle protocol */ + +enum fraggle_states { + FRAGSTATE_START_MESSAGE, + FRAGSTATE_RANDOM_PAYLOAD, + FRAGSTATE_POST_PAYLOAD_SUM, +}; + +struct per_session_data__fraggle { + int packets_left; + int total_message; + unsigned long sum; + enum fraggle_states state; +}; + +static int +callback_fraggle(struct libwebsocket_context *context, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + int n; + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 2048 + + LWS_SEND_BUFFER_POST_PADDING]; + struct per_session_data__fraggle *psf = user; + int chunk; + int write_mode = LWS_WRITE_CONTINUATION; + unsigned long sum; + unsigned char *p = (unsigned char *)in; + unsigned char *bp = &buf[LWS_SEND_BUFFER_PRE_PADDING]; + + switch (reason) { + + case LWS_CALLBACK_ESTABLISHED: + + fprintf(stderr, "server sees client connect\n"); + psf->state = FRAGSTATE_START_MESSAGE; + /* start the ball rolling */ + libwebsocket_callback_on_writable(context, wsi); + break; + + case LWS_CALLBACK_CLIENT_ESTABLISHED: + + fprintf(stderr, "client connects to server\n"); + psf->state = FRAGSTATE_START_MESSAGE; + break; + + case LWS_CALLBACK_CLIENT_RECEIVE: + + switch (psf->state) { + + case FRAGSTATE_START_MESSAGE: + + psf->state = FRAGSTATE_RANDOM_PAYLOAD; + psf->sum = 0; + psf->total_message = 0; + psf->packets_left = 0; + + /* fallthru */ + + case FRAGSTATE_RANDOM_PAYLOAD: + + for (n = 0; n < len; n++) + psf->sum += p[n]; + + psf->total_message += len; + psf->packets_left++; + + if (libwebsocket_is_final_fragment(wsi)) + psf->state = FRAGSTATE_POST_PAYLOAD_SUM; + break; + + case FRAGSTATE_POST_PAYLOAD_SUM: + + sum = p[0] << 24; + sum |= p[1] << 16; + sum |= p[2] << 8; + sum |= p[3]; + if (sum == psf->sum) + fprintf(stderr, "EOM received %d correctly " + "from %d fragments\n", + psf->total_message, psf->packets_left); + else + fprintf(stderr, "**** ERROR at EOM: " + "length %d, rx sum = 0x%lX, " + "server says it sent 0x%lX\n", + psf->total_message, psf->sum, sum); + + psf->state = FRAGSTATE_START_MESSAGE; + break; + } + break; + + case LWS_CALLBACK_SERVER_WRITEABLE: + + switch (psf->state) { + + case FRAGSTATE_START_MESSAGE: + + psf->packets_left = (random() % 1024) + 1; + fprintf(stderr, "Spamming %d random fragments\n", + psf->packets_left); + psf->sum = 0; + psf->total_message = 0; + write_mode = LWS_WRITE_BINARY; + psf->state = FRAGSTATE_RANDOM_PAYLOAD; + + /* fallthru */ + + case FRAGSTATE_RANDOM_PAYLOAD: + + chunk = (random() % 2000) + 1; + psf->total_message += chunk; + + libwebsockets_get_random(context, bp, chunk); + for (n = 0; n < chunk; n++) + psf->sum += bp[n]; + + psf->packets_left--; + if (psf->packets_left) + write_mode |= LWS_WRITE_NO_FIN; + else + psf->state = FRAGSTATE_POST_PAYLOAD_SUM; + + n = libwebsocket_write(wsi, bp, chunk, write_mode); + + libwebsocket_callback_on_writable(context, wsi); + break; + + case FRAGSTATE_POST_PAYLOAD_SUM: + + fprintf(stderr, "Spamming session over, " + "len = %d. sum = 0x%lX\n", + psf->total_message, psf->sum); + + bp[0] = psf->sum >> 24; + bp[1] = psf->sum >> 16; + bp[2] = psf->sum >> 8; + bp[3] = psf->sum; + + n = libwebsocket_write(wsi, (unsigned char *)bp, + 4, LWS_WRITE_BINARY); + + psf->state = FRAGSTATE_START_MESSAGE; + + libwebsocket_callback_on_writable(context, wsi); + break; + } + break; + + case LWS_CALLBACK_CLOSED: + + terminate = 1; + break; + + /* because we are protocols[0] ... */ + + case LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED: + if (strcmp(in, "deflate-stream") == 0) { + fprintf(stderr, "denied deflate-stream extension\n"); + return 1; + } + break; + + default: + break; + } + + return 0; +} + + + +/* list of supported protocols and callbacks */ + +static struct libwebsocket_protocols protocols[] = { + { + "fraggle-protocol", + callback_fraggle, + sizeof(struct per_session_data__fraggle), + }, + { + NULL, NULL, 0 /* End of list */ + } +}; + +static struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "port", required_argument, NULL, 'p' }, + { "ssl", no_argument, NULL, 's' }, + { "killmask", no_argument, NULL, 'k' }, + { "interface", required_argument, NULL, 'i' }, + { "client", no_argument, NULL, 'c' }, + { NULL, 0, 0, 0 } +}; + +int main(int argc, char **argv) +{ + int n = 0; + const char *cert_path = + LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem"; + const char *key_path = + LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem"; + int port = 7681; + int use_ssl = 0; + struct libwebsocket_context *context; + int opts = 0; + char interface_name[128] = ""; + const char *interface = NULL; + struct libwebsocket *wsi; + const char *address; + int server_port = port; + + fprintf(stderr, "libwebsockets test fraggle\n" + "(C) Copyright 2010-2011 Andy Green " + "licensed under LGPL2.1\n"); + + while (n >= 0) { + n = getopt_long(argc, argv, "ci:khsp:", options, NULL); + if (n < 0) + continue; + switch (n) { + case 's': + use_ssl = 1; + break; + case 'k': + opts = LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK; + break; + case 'p': + port = atoi(optarg); + server_port = port; + break; + case 'i': + strncpy(interface_name, optarg, sizeof interface_name); + interface_name[(sizeof interface_name) - 1] = '\0'; + interface = interface_name; + break; + case 'c': + client = 1; + fprintf(stderr, " Client mode\n"); + break; + case 'h': + fprintf(stderr, "Usage: libwebsockets-test-fraggle " + "[--port=

] [--ssl] [--client]\n"); + exit(1); + } + } + + if (client) { + server_port = CONTEXT_PORT_NO_LISTEN; + if (optind >= argc) { + fprintf(stderr, "Must give address of server\n"); + return 1; + } + } + + if (!use_ssl) + cert_path = key_path = NULL; + + context = libwebsocket_create_context(server_port, interface, protocols, + libwebsocket_internal_extensions, + cert_path, key_path, -1, -1, opts); + if (context == NULL) { + fprintf(stderr, "libwebsocket init failed\n"); + return -1; + } + + if (client) { + address = argv[optind]; + fprintf(stderr, "Connecting to %s:%u\n", address, port); + wsi = libwebsocket_client_connect(context, address, + port, use_ssl, "/", address, + "origin", protocols[PROTOCOL_FRAGGLE].name, + -1); + if (wsi == NULL) { + fprintf(stderr, "Client connect to server failed\n"); + goto bail; + } + } + + n = 0; + while (!n && !terminate) + n = libwebsocket_service(context, 50); + + fprintf(stderr, "Terminating...\n"); + +bail: + libwebsocket_context_destroy(context); + + return 0; +} diff --git a/libs/libwebsockets/test-server/test-ping.c b/libs/libwebsockets/test-server/test-ping.c new file mode 100644 index 0000000000..672f62cc0d --- /dev/null +++ b/libs/libwebsockets/test-server/test-ping.c @@ -0,0 +1,512 @@ +/* + * libwebsockets-test-ping - libwebsockets floodping + * + * Copyright (C) 2011 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "../lib/libwebsockets.h" +#include + +/* + * this is specified in the 04 standard, control frames can only have small + * payload length styles + */ +#define MAX_PING_PAYLOAD 125 +#define MAX_MIRROR_PAYLOAD 4096 +#define MAX_PING_CLIENTS 256 +#define PING_RINGBUFFER_SIZE 256 + +static struct libwebsocket *ping_wsi[MAX_PING_CLIENTS]; +static unsigned int interval_us = 1000000; +static unsigned int size = 64; +static int flood; +static const char *address; +static unsigned char pingbuf[LWS_SEND_BUFFER_PRE_PADDING + MAX_MIRROR_PAYLOAD + + LWS_SEND_BUFFER_POST_PADDING]; +static char peer_name[128]; +static unsigned long started; +static int screen_width = 80; +static int use_mirror; +static unsigned int write_options; + +static unsigned long rtt_min = 100000000; +static unsigned long rtt_max; +static unsigned long rtt_avg; +static unsigned long global_rx_count; +static unsigned long global_tx_count; +static int clients = 1; +static unsigned long interrupted_time; + +struct ping { + unsigned long issue_timestamp; + unsigned long index; + unsigned int seen; +}; + +struct per_session_data__ping { + unsigned long ping_index; + + struct ping ringbuffer[PING_RINGBUFFER_SIZE]; + int ringbuffer_head; + int ringbuffer_tail; + + unsigned long rx_count; +}; + +/* + * uses the ping pong protocol features to provide an equivalent for the + * ping utility for 04+ websockets + */ + +enum demo_protocols { + + PROTOCOL_LWS_MIRROR, + + /* always last */ + DEMO_PROTOCOL_COUNT +}; + + +static int +callback_lws_mirror(struct libwebsocket_context * this, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + struct timeval tv; + unsigned char *p; + int shift; + unsigned long l; + unsigned long iv; + int n; + int match = 0; + struct per_session_data__ping *psd = user; + + switch (reason) { + case LWS_CALLBACK_CLOSED: + + fprintf(stderr, "LWS_CALLBACK_CLOSED on %p\n", (void *)wsi); + + /* remove closed guy */ + + for (n = 0; n < clients; n++) + if (ping_wsi[n] == wsi) { + clients--; + while (n < clients) { + ping_wsi[n] = ping_wsi[n + 1]; + n++; + } + } + + break; + + case LWS_CALLBACK_CLIENT_ESTABLISHED: + + psd->rx_count = 0; + psd->ping_index = 1; + psd->ringbuffer_head = 0; + psd->ringbuffer_tail = 0; + + /* + * start the ball rolling, + * LWS_CALLBACK_CLIENT_WRITEABLE will come next service + */ + + libwebsocket_callback_on_writable(this, wsi); + break; + + case LWS_CALLBACK_CLIENT_RECEIVE: + case LWS_CALLBACK_CLIENT_RECEIVE_PONG: + gettimeofday(&tv, NULL); + iv = (tv.tv_sec * 1000000) + tv.tv_usec; + + psd->rx_count++; + + shift = 56; + p = in; + l = 0; + + while (shift >= 0) { + l |= (*p++) << shift; + shift -= 8; + } + + /* find it in the ringbuffer, look backwards from head */ + n = psd->ringbuffer_head; + while (!match) { + + if (psd->ringbuffer[n].index == l) { + psd->ringbuffer[n].seen++; + match = 1; + continue; + } + + if (n == psd->ringbuffer_tail) { + match = -1; + continue; + } + + if (n == 0) + n = PING_RINGBUFFER_SIZE - 1; + else + n--; + } + + if (match < 1) { + + if (!flood) + fprintf(stderr, "%d bytes from %s: req=%ld " + "time=(unknown)\n", (int)len, address, l); + else + fprintf(stderr, "\b \b"); + + break; + } + + if (psd->ringbuffer[n].seen > 1) + fprintf(stderr, "DUP! "); + + if ((iv - psd->ringbuffer[n].issue_timestamp) < rtt_min) + rtt_min = iv - psd->ringbuffer[n].issue_timestamp; + + if ((iv - psd->ringbuffer[n].issue_timestamp) > rtt_max) + rtt_max = iv - psd->ringbuffer[n].issue_timestamp; + + rtt_avg += iv - psd->ringbuffer[n].issue_timestamp; + global_rx_count++; + + if (!flood) + fprintf(stderr, "%d bytes from %s: req=%ld " + "time=%lu.%lums\n", (int)len, address, l, + (iv - psd->ringbuffer[n].issue_timestamp) / 1000, + ((iv - psd->ringbuffer[n].issue_timestamp) / 100) % 10); + else + fprintf(stderr, "\b \b"); + break; + + case LWS_CALLBACK_CLIENT_WRITEABLE: + + shift = 56; + p = &pingbuf[LWS_SEND_BUFFER_PRE_PADDING]; + + /* 64-bit ping index in network byte order */ + + while (shift >= 0) { + *p++ = psd->ping_index >> shift; + shift -= 8; + } + + gettimeofday(&tv, NULL); + + psd->ringbuffer[psd->ringbuffer_head].issue_timestamp = + (tv.tv_sec * 1000000) + tv.tv_usec; + psd->ringbuffer[psd->ringbuffer_head].index = psd->ping_index++; + psd->ringbuffer[psd->ringbuffer_head].seen = 0; + + if (psd->ringbuffer_head == PING_RINGBUFFER_SIZE - 1) + psd->ringbuffer_head = 0; + else + psd->ringbuffer_head++; + + /* snip any re-used tail so we keep to the ring length */ + + if (psd->ringbuffer_tail == psd->ringbuffer_head) { + if (psd->ringbuffer_tail == PING_RINGBUFFER_SIZE - 1) + psd->ringbuffer_tail = 0; + else + psd->ringbuffer_tail++; + } + + global_tx_count++; + + if (use_mirror) + libwebsocket_write(wsi, + &pingbuf[LWS_SEND_BUFFER_PRE_PADDING], + size, write_options | LWS_WRITE_BINARY); + else + libwebsocket_write(wsi, + &pingbuf[LWS_SEND_BUFFER_PRE_PADDING], + size, write_options | LWS_WRITE_PING); + + if (flood && + (psd->ping_index - psd->rx_count) < (screen_width - 1)) + fprintf(stderr, "."); + break; + + default: + break; + } + + return 0; +} + + +/* list of supported protocols and callbacks */ + +static struct libwebsocket_protocols protocols[] = { + + [PROTOCOL_LWS_MIRROR] = { + .name = "lws-mirror-protocol", + .callback = callback_lws_mirror, + .per_session_data_size = sizeof (struct per_session_data__ping), + }, + [DEMO_PROTOCOL_COUNT] = { /* end of list */ + .callback = NULL + } +}; + +static struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "port", required_argument, NULL, 'p' }, + { "ssl", no_argument, NULL, 't' }, + { "interval", required_argument, NULL, 'i' }, + { "size", required_argument, NULL, 's' }, + { "protocol", required_argument, NULL, 'n' }, + { "flood", no_argument, NULL, 'f' }, + { "mirror", no_argument, NULL, 'm' }, + { "replicate", required_argument, NULL, 'r' }, + { "killmask", no_argument, NULL, 'k' }, + { "version", required_argument, NULL, 'v' }, + { NULL, 0, 0, 0 } +}; + + +static void +signal_handler(int sig, siginfo_t *si, void *v) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + interrupted_time = (tv.tv_sec * 1000000) + tv.tv_usec; +} + + +int main(int argc, char **argv) +{ + int n = 0; + int port = 7681; + int use_ssl = 0; + struct libwebsocket_context *context; + char protocol_name[256]; + char ip[30]; + struct sigaction sa; + struct timeval tv; + struct winsize w; + unsigned long oldus = 0; + unsigned long l; + int ietf_version = -1; + + if (argc < 2) + goto usage; + + address = argv[1]; + optind++; + + while (n >= 0) { + n = getopt_long(argc, argv, "v:kr:hmfts:n:i:p:", options, NULL); + if (n < 0) + continue; + switch (n) { + case 'm': + use_mirror = 1; + break; + case 't': + use_ssl = 2; /* 2 = allow selfsigned */ + break; + case 'p': + port = atoi(optarg); + break; + case 'n': + strncpy(protocol_name, optarg, sizeof protocol_name); + protocol_name[(sizeof protocol_name) - 1] = '\0'; + protocols[PROTOCOL_LWS_MIRROR].name = protocol_name; + break; + case 'i': + interval_us = 1000000.0 * atof(optarg); + break; + case 's': + size = atoi(optarg); + break; + case 'f': + flood = 1; + break; + case 'r': + clients = atoi(optarg); + if (clients > MAX_PING_CLIENTS || clients < 1) { + fprintf(stderr, "Max clients supportd = %d\n", + MAX_PING_CLIENTS); + return 1; + } + break; + case 'k': + write_options = LWS_WRITE_CLIENT_IGNORE_XOR_MASK; + break; + case 'v': + ietf_version = atoi(optarg); + break; + + case 'h': + goto usage; + } + } + + if (!use_mirror) { + if (size > MAX_PING_PAYLOAD) { + fprintf(stderr, "Max ping opcode payload size %d\n", + MAX_PING_PAYLOAD); + return 1; + } + } else { + if (size > MAX_MIRROR_PAYLOAD) { + fprintf(stderr, "Max mirror payload size %d\n", + MAX_MIRROR_PAYLOAD); + return 1; + } + } + + + if (isatty(STDOUT_FILENO)) + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1) + if (w.ws_col > 0) + screen_width = w.ws_col; + + context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL, + protocols, + libwebsocket_internal_extensions, + NULL, NULL, -1, -1, 0); + if (context == NULL) { + fprintf(stderr, "Creating libwebsocket context failed\n"); + return 1; + } + + /* create client websockets using dumb increment protocol */ + + for (n = 0; n < clients; n++) { + ping_wsi[n] = libwebsocket_client_connect(context, address, + port, use_ssl, "/", address, + "origin", protocols[PROTOCOL_LWS_MIRROR].name, + ietf_version); + if (ping_wsi[n] == NULL) { + fprintf(stderr, "client connnection %d failed to " + "connect\n", n); + return 1; + } + } + + libwebsockets_get_peer_addresses( + libwebsocket_get_socket_fd(ping_wsi[0]), + peer_name, sizeof peer_name, ip, sizeof ip); + + fprintf(stderr, "Websocket PING %s (%s) %d bytes of data.\n", + peer_name, ip, size); + + /* set the ^C handler */ + + sa.sa_sigaction = signal_handler; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + sigaction(SIGINT, &sa, NULL); + + gettimeofday(&tv, NULL); + started = (tv.tv_sec * 1000000) + tv.tv_usec; + + /* service loop */ + + n = 0; + while (n >= 0) { + + gettimeofday(&tv, NULL); + l = (tv.tv_sec * 1000000) + tv.tv_usec; + + /* servers can hang up on us */ + + if (clients == 0) { + n = -1; + continue; + } + + if (!interrupted_time) { + if ((l - oldus) > interval_us) { + for (n = 0; n < clients; n++) + libwebsocket_callback_on_writable( + context, ping_wsi[n]); + oldus = l; + } + } else + + /* allow time for in-flight pongs to come */ + + if ((l - interrupted_time) > 250000) { + n = -1; + continue; + } + + if (!interval_us) + n = libwebsocket_service(context, 0); + else + n = libwebsocket_service(context, 1); + } + + /* stats */ + + fprintf(stderr, "\n--- %s websocket ping statistics " + "using %d connections ---\n" + "%lu packets transmitted, %lu received, " + "%lu%% packet loss, time %ldms\n" + "rtt min/avg/max = %0.3f/%0.3f/%0.3f ms\n" + "payload bandwidth average %0.3f KiBytes/sec\n", + peer_name, clients, global_tx_count, global_rx_count, + ((global_tx_count - global_rx_count) * 100) / global_tx_count, + (l - started) / 1000, + ((double)rtt_min) / 1000.0, + ((double)rtt_avg / global_rx_count) / 1000.0, + ((double)rtt_max) / 1000.0, + ((double)global_rx_count * (double)size) / + ((double)(l - started) / 1000000.0) / 1024.0); + + libwebsocket_context_destroy(context); + + return 0; + +usage: + fprintf(stderr, "Usage: libwebsockets-test-ping " + " [--port=

] " + "[--ssl] [--interval=] " + "[--size=] " + "[--protocol=] " + "[--mirror] " + "[--replicate=clients>]" + "[--version ]" + "\n"); + return 1; +} diff --git a/libs/libwebsockets/test-server/test-server-extpoll.c b/libs/libwebsockets/test-server/test-server-extpoll.c new file mode 100644 index 0000000000..8131412fe3 --- /dev/null +++ b/libs/libwebsockets/test-server/test-server-extpoll.c @@ -0,0 +1,553 @@ +/* + * libwebsockets-test-server-extpoll - libwebsockets external poll loop sample + * + * This acts the same as libwebsockets-test-server but works with the poll + * loop taken out of libwebsockets and into this app. It's an example of how + * you can integrate libwebsockets polling into an app that already has its + * own poll loop. + * + * Copyright (C) 2010-2011 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#ifdef __MINGW32__ +#include "../win32port/win32helpers/websock-w32.h" +#else +#ifdef __MINGW64__ +#include "../win32port/win32helpers/websock-w32.h" +#else +#include +#endif +#endif + +#include "../lib/libwebsockets.h" + + +/* + * This demo server shows how to use libwebsockets for one or more + * websocket protocols in the same server + * + * It defines the following websocket protocols: + * + * dumb-increment-protocol: once the socket is opened, an incrementing + * ascii string is sent down it every 50ms. + * If you send "reset\n" on the websocket, then + * the incrementing number is reset to 0. + * + * lws-mirror-protocol: copies any received packet to every connection also + * using this protocol, including the sender + */ + +#define MAX_POLL_ELEMENTS 100 +struct pollfd pollfds[100]; +int count_pollfds = 0; + + + +enum demo_protocols { + /* always first */ + PROTOCOL_HTTP = 0, + + PROTOCOL_DUMB_INCREMENT, + PROTOCOL_LWS_MIRROR, + + /* always last */ + DEMO_PROTOCOL_COUNT +}; + + +#define LOCAL_RESOURCE_PATH INSTALL_DATADIR"/libwebsockets-test-server" + +/* this protocol server (always the first one) just knows how to do HTTP */ + +static int callback_http(struct libwebsocket_context * this, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, void *user, + void *in, size_t len) +{ + int n; + char client_name[128]; + char client_ip[128]; + + switch (reason) { + case LWS_CALLBACK_HTTP: + fprintf(stderr, "serving HTTP URI %s\n", (char *)in); + + if (in && strcmp(in, "/favicon.ico") == 0) { + if (libwebsockets_serve_http_file(wsi, + LOCAL_RESOURCE_PATH"/favicon.ico", "image/x-icon")) + fprintf(stderr, "Failed to send favicon\n"); + break; + } + + /* send the script... when it runs it'll start websockets */ + + if (libwebsockets_serve_http_file(wsi, + LOCAL_RESOURCE_PATH"/test.html", "text/html")) + fprintf(stderr, "Failed to send HTTP file\n"); + break; + + /* + * callback for confirming to continue with client IP appear in + * protocol 0 callback since no websocket protocol has been agreed + * yet. You can just ignore this if you won't filter on client IP + * since the default uhandled callback return is 0 meaning let the + * connection continue. + */ + + case LWS_CALLBACK_FILTER_NETWORK_CONNECTION: + + libwebsockets_get_peer_addresses((int)(long)user, client_name, + sizeof(client_name), client_ip, sizeof(client_ip)); + + fprintf(stderr, "Received network connect from %s (%s)\n", + client_name, client_ip); + + /* if we returned non-zero from here, we kill the connection */ + break; + + /* + * callbacks for managing the external poll() array appear in + * protocol 0 callback + */ + + case LWS_CALLBACK_ADD_POLL_FD: + pollfds[count_pollfds].fd = (int)(long)user; + pollfds[count_pollfds].events = (int)len; + pollfds[count_pollfds++].revents = 0; + break; + + case LWS_CALLBACK_DEL_POLL_FD: + for (n = 0; n < count_pollfds; n++) + if (pollfds[n].fd == (int)(long)user) + while (n < count_pollfds) { + pollfds[n] = pollfds[n + 1]; + n++; + } + count_pollfds--; + break; + + case LWS_CALLBACK_SET_MODE_POLL_FD: + for (n = 0; n < count_pollfds; n++) + if (pollfds[n].fd == (int)(long)user) + pollfds[n].events |= (int)(long)len; + break; + + case LWS_CALLBACK_CLEAR_MODE_POLL_FD: + for (n = 0; n < count_pollfds; n++) + if (pollfds[n].fd == (int)(long)user) + pollfds[n].events &= ~(int)(long)len; + break; + + default: + break; + } + + return 0; +} + +/* + * this is just an example of parsing handshake headers, you don't need this + * in your code unless you will filter allowing connections by the header + * content + */ + +static void +dump_handshake_info(struct lws_tokens *lwst) +{ + int n; + static const char *token_names[] = { + [WSI_TOKEN_GET_URI] = "GET URI", + [WSI_TOKEN_HOST] = "Host", + [WSI_TOKEN_CONNECTION] = "Connection", + [WSI_TOKEN_KEY1] = "key 1", + [WSI_TOKEN_KEY2] = "key 2", + [WSI_TOKEN_PROTOCOL] = "Protocol", + [WSI_TOKEN_UPGRADE] = "Upgrade", + [WSI_TOKEN_ORIGIN] = "Origin", + [WSI_TOKEN_DRAFT] = "Draft", + [WSI_TOKEN_CHALLENGE] = "Challenge", + + /* new for 04 */ + [WSI_TOKEN_KEY] = "Key", + [WSI_TOKEN_VERSION] = "Version", + [WSI_TOKEN_SWORIGIN] = "Sworigin", + + /* new for 05 */ + [WSI_TOKEN_EXTENSIONS] = "Extensions", + + /* client receives these */ + [WSI_TOKEN_ACCEPT] = "Accept", + [WSI_TOKEN_NONCE] = "Nonce", + [WSI_TOKEN_HTTP] = "Http", + [WSI_TOKEN_MUXURL] = "MuxURL", + }; + + for (n = 0; n < WSI_TOKEN_COUNT; n++) { + if (lwst[n].token == NULL) + continue; + + fprintf(stderr, " %s = %s\n", token_names[n], lwst[n].token); + } +} + +/* dumb_increment protocol */ + +/* + * one of these is auto-created for each connection and a pointer to the + * appropriate instance is passed to the callback in the user parameter + * + * for this example protocol we use it to individualize the count for each + * connection. + */ + +struct per_session_data__dumb_increment { + int number; +}; + +static int +callback_dumb_increment(struct libwebsocket_context * this, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + int n; + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + + LWS_SEND_BUFFER_POST_PADDING]; + unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING]; + struct per_session_data__dumb_increment *pss = user; + + switch (reason) { + + case LWS_CALLBACK_ESTABLISHED: + pss->number = 0; + break; + + /* + * in this protocol, we just use the broadcast action as the chance to + * send our own connection-specific data and ignore the broadcast info + * that is available in the 'in' parameter + */ + + case LWS_CALLBACK_BROADCAST: + n = sprintf((char *)p, "%d", pss->number++); + n = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT); + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + return 1; + } + break; + + case LWS_CALLBACK_RECEIVE: + fprintf(stderr, "rx %d\n", (int)len); + if (len < 6) + break; + if (strcmp(in, "reset\n") == 0) + pss->number = 0; + break; + + /* + * this just demonstrates how to use the protocol filter. If you won't + * study and reject connections based on header content, you don't need + * to handle this callback + */ + + case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: + dump_handshake_info((struct lws_tokens *)(long)user); + /* you could return non-zero here and kill the connection */ + break; + + default: + break; + } + + return 0; +} + + +/* lws-mirror_protocol */ + +#define MAX_MESSAGE_QUEUE 64 + +struct per_session_data__lws_mirror { + struct libwebsocket *wsi; + int ringbuffer_tail; +}; + +struct a_message { + void *payload; + size_t len; +}; + +static struct a_message ringbuffer[MAX_MESSAGE_QUEUE]; +static int ringbuffer_head; + + +static int +callback_lws_mirror(struct libwebsocket_context * this, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + int n; + struct per_session_data__lws_mirror *pss = user; + + switch (reason) { + + case LWS_CALLBACK_ESTABLISHED: + pss->ringbuffer_tail = ringbuffer_head; + pss->wsi = wsi; + libwebsocket_callback_on_writable(this, wsi); + break; + + case LWS_CALLBACK_SERVER_WRITEABLE: + + if (pss->ringbuffer_tail != ringbuffer_head) { + + n = libwebsocket_write(wsi, (unsigned char *) + ringbuffer[pss->ringbuffer_tail].payload + + LWS_SEND_BUFFER_PRE_PADDING, + ringbuffer[pss->ringbuffer_tail].len, + LWS_WRITE_TEXT); + + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + exit(1); + } + + if (pss->ringbuffer_tail == (MAX_MESSAGE_QUEUE - 1)) + pss->ringbuffer_tail = 0; + else + pss->ringbuffer_tail++; + + if (((ringbuffer_head - pss->ringbuffer_tail) % + MAX_MESSAGE_QUEUE) < (MAX_MESSAGE_QUEUE - 15)) + libwebsocket_rx_flow_control(wsi, 1); + + libwebsocket_callback_on_writable(this, wsi); + + } + break; + + case LWS_CALLBACK_BROADCAST: + n = libwebsocket_write(wsi, in, len, LWS_WRITE_TEXT); + if (n < 0) + fprintf(stderr, "mirror write failed\n"); + break; + + case LWS_CALLBACK_RECEIVE: + + if (ringbuffer[ringbuffer_head].payload) + free(ringbuffer[ringbuffer_head].payload); + + ringbuffer[ringbuffer_head].payload = + malloc(LWS_SEND_BUFFER_PRE_PADDING + len + + LWS_SEND_BUFFER_POST_PADDING); + ringbuffer[ringbuffer_head].len = len; + memcpy((char *)ringbuffer[ringbuffer_head].payload + + LWS_SEND_BUFFER_PRE_PADDING, in, len); + if (ringbuffer_head == (MAX_MESSAGE_QUEUE - 1)) + ringbuffer_head = 0; + else + ringbuffer_head++; + + if (((ringbuffer_head - pss->ringbuffer_tail) % + MAX_MESSAGE_QUEUE) > (MAX_MESSAGE_QUEUE - 10)) + libwebsocket_rx_flow_control(wsi, 0); + + libwebsocket_callback_on_writable_all_protocol( + libwebsockets_get_protocol(wsi)); + break; + + /* + * this just demonstrates how to use the protocol filter. If you won't + * study and reject connections based on header content, you don't need + * to handle this callback + */ + + case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: + dump_handshake_info((struct lws_tokens *)(long)user); + /* you could return non-zero here and kill the connection */ + break; + + default: + break; + } + + return 0; +} + + +/* list of supported protocols and callbacks */ + +static struct libwebsocket_protocols protocols[] = { + /* first protocol must always be HTTP handler */ + + { + "http-only", /* name */ + callback_http, /* callback */ + 0 /* per_session_data_size */ + }, + { + "dumb-increment-protocol", + callback_dumb_increment, + sizeof(struct per_session_data__dumb_increment), + }, + { + "lws-mirror-protocol", + callback_lws_mirror, + sizeof(struct per_session_data__lws_mirror) + }, + { + NULL, NULL, 0 /* End of list */ + } +}; + +static struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "port", required_argument, NULL, 'p' }, + { "ssl", no_argument, NULL, 's' }, + { "killmask", no_argument, NULL, 'k' }, + { "interface", required_argument, NULL, 'i' }, + { NULL, 0, 0, 0 } +}; + +int main(int argc, char **argv) +{ + int n = 0; + const char *cert_path = + LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem"; + const char *key_path = + LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem"; + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 1024 + + LWS_SEND_BUFFER_POST_PADDING]; + int port = 7681; + int use_ssl = 0; + struct libwebsocket_context *context; + int opts = 0; + unsigned int oldus = 0; + char interface_name[128] = ""; + const char *interface_ptr = NULL; + + fprintf(stderr, "libwebsockets test server with external poll()\n" + "(C) Copyright 2010-2011 Andy Green " + "licensed under LGPL2.1\n"); + + while (n >= 0) { + n = getopt_long(argc, argv, "i:khsp:", options, NULL); + if (n < 0) + continue; + switch (n) { + case 's': + use_ssl = 1; + break; + case 'k': + opts = LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK; + break; + case 'p': + port = atoi(optarg); + break; + case 'i': + strncpy(interface_name, optarg, sizeof interface_name); + interface_name[(sizeof interface_name) - 1] = '\0'; + interface_ptr = interface_name; + break; + case 'h': + fprintf(stderr, "Usage: test-server " + "[--port=

] [--ssl]\n"); + exit(1); + } + } + + if (!use_ssl) + cert_path = key_path = NULL; + + context = libwebsocket_create_context(port, interface_ptr, protocols, + libwebsocket_internal_extensions, + cert_path, key_path, -1, -1, opts); + if (context == NULL) { + fprintf(stderr, "libwebsocket init failed\n"); + return -1; + } + + buf[LWS_SEND_BUFFER_PRE_PADDING] = 'x'; + + /* + * This is an example of an existing application's explicit poll() + * loop that libwebsockets can integrate with. + */ + + while (1) { + struct timeval tv; + + /* + * this represents an existing server's single poll action + * which also includes libwebsocket sockets + */ + + n = poll(pollfds, count_pollfds, 25); + if (n < 0) + goto done; + + if (n) + for (n = 0; n < count_pollfds; n++) + if (pollfds[n].revents) + /* + * returns immediately if the fd does not + * match anything under libwebsockets + * control + */ + if (libwebsocket_service_fd(context, + &pollfds[n])) + goto done; + + /* do our broadcast periodically */ + + gettimeofday(&tv, NULL); + + /* + * This broadcasts to all dumb-increment-protocol connections + * at 20Hz. + * + * We're just sending a character 'x', in these examples the + * callbacks send their own per-connection content. + * + * You have to send something with nonzero length to get the + * callback actions delivered. + * + * We take care of pre-and-post padding allocation. + */ + + if (((unsigned int)tv.tv_usec - oldus) > 50000) { + libwebsockets_broadcast( + &protocols[PROTOCOL_DUMB_INCREMENT], + &buf[LWS_SEND_BUFFER_PRE_PADDING], 1); + oldus = tv.tv_usec; + } + } + +done: + libwebsocket_context_destroy(context); + + return 0; +} diff --git a/libs/libwebsockets/test-server/test-server.c b/libs/libwebsockets/test-server/test-server.c new file mode 100644 index 0000000000..516deff7bd --- /dev/null +++ b/libs/libwebsockets/test-server/test-server.c @@ -0,0 +1,551 @@ +/* + * libwebsockets-test-server - libwebsockets test implementation + * + * Copyright (C) 2010-2011 Andy Green + * + * 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: + * version 2.1 of the License. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include + +#include "../lib/libwebsockets.h" + +static int close_testing; + +/* + * This demo server shows how to use libwebsockets for one or more + * websocket protocols in the same server + * + * It defines the following websocket protocols: + * + * dumb-increment-protocol: once the socket is opened, an incrementing + * ascii string is sent down it every 50ms. + * If you send "reset\n" on the websocket, then + * the incrementing number is reset to 0. + * + * lws-mirror-protocol: copies any received packet to every connection also + * using this protocol, including the sender + */ + +enum demo_protocols { + /* always first */ + PROTOCOL_HTTP = 0, + + PROTOCOL_DUMB_INCREMENT, + PROTOCOL_LWS_MIRROR, + + /* always last */ + DEMO_PROTOCOL_COUNT +}; + + +#define LOCAL_RESOURCE_PATH INSTALL_DATADIR"/libwebsockets-test-server" + +/* this protocol server (always the first one) just knows how to do HTTP */ + +static int callback_http(struct libwebsocket_context *context, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, void *user, + void *in, size_t len) +{ + char client_name[128]; + char client_ip[128]; + + switch (reason) { + case LWS_CALLBACK_HTTP: + fprintf(stderr, "serving HTTP URI %s\n", (char *)in); + + if (in && strcmp(in, "/favicon.ico") == 0) { + if (libwebsockets_serve_http_file(wsi, + LOCAL_RESOURCE_PATH"/favicon.ico", "image/x-icon")) + fprintf(stderr, "Failed to send favicon\n"); + break; + } + + /* send the script... when it runs it'll start websockets */ + + if (libwebsockets_serve_http_file(wsi, + LOCAL_RESOURCE_PATH"/test.html", "text/html")) + fprintf(stderr, "Failed to send HTTP file\n"); + break; + + /* + * callback for confirming to continue with client IP appear in + * protocol 0 callback since no websocket protocol has been agreed + * yet. You can just ignore this if you won't filter on client IP + * since the default uhandled callback return is 0 meaning let the + * connection continue. + */ + + case LWS_CALLBACK_FILTER_NETWORK_CONNECTION: + + libwebsockets_get_peer_addresses((int)(long)user, client_name, + sizeof(client_name), client_ip, sizeof(client_ip)); + + fprintf(stderr, "Received network connect from %s (%s)\n", + client_name, client_ip); + + /* if we returned non-zero from here, we kill the connection */ + break; + + default: + break; + } + + return 0; +} + + +/* + * this is just an example of parsing handshake headers, you don't need this + * in your code unless you will filter allowing connections by the header + * content + */ + +static void +dump_handshake_info(struct lws_tokens *lwst) +{ + int n; + static const char *token_names[WSI_TOKEN_COUNT] = { + /*[WSI_TOKEN_GET_URI] =*/ "GET URI", + /*[WSI_TOKEN_HOST] =*/ "Host", + /*[WSI_TOKEN_CONNECTION] =*/ "Connection", + /*[WSI_TOKEN_KEY1] =*/ "key 1", + /*[WSI_TOKEN_KEY2] =*/ "key 2", + /*[WSI_TOKEN_PROTOCOL] =*/ "Protocol", + /*[WSI_TOKEN_UPGRADE] =*/ "Upgrade", + /*[WSI_TOKEN_ORIGIN] =*/ "Origin", + /*[WSI_TOKEN_DRAFT] =*/ "Draft", + /*[WSI_TOKEN_CHALLENGE] =*/ "Challenge", + + /* new for 04 */ + /*[WSI_TOKEN_KEY] =*/ "Key", + /*[WSI_TOKEN_VERSION] =*/ "Version", + /*[WSI_TOKEN_SWORIGIN] =*/ "Sworigin", + + /* new for 05 */ + /*[WSI_TOKEN_EXTENSIONS] =*/ "Extensions", + + /* client receives these */ + /*[WSI_TOKEN_ACCEPT] =*/ "Accept", + /*[WSI_TOKEN_NONCE] =*/ "Nonce", + /*[WSI_TOKEN_HTTP] =*/ "Http", + /*[WSI_TOKEN_MUXURL] =*/ "MuxURL", + }; + + for (n = 0; n < WSI_TOKEN_COUNT; n++) { + if (lwst[n].token == NULL) + continue; + + fprintf(stderr, " %s = %s\n", token_names[n], lwst[n].token); + } +} + +/* dumb_increment protocol */ + +/* + * one of these is auto-created for each connection and a pointer to the + * appropriate instance is passed to the callback in the user parameter + * + * for this example protocol we use it to individualize the count for each + * connection. + */ + +struct per_session_data__dumb_increment { + int number; +}; + +static int +callback_dumb_increment(struct libwebsocket_context *context, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + int n; + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + + LWS_SEND_BUFFER_POST_PADDING]; + unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING]; + struct per_session_data__dumb_increment *pss = user; + + switch (reason) { + + case LWS_CALLBACK_ESTABLISHED: + fprintf(stderr, "callback_dumb_increment: " + "LWS_CALLBACK_ESTABLISHED\n"); + pss->number = 0; + break; + + /* + * in this protocol, we just use the broadcast action as the chance to + * send our own connection-specific data and ignore the broadcast info + * that is available in the 'in' parameter + */ + + case LWS_CALLBACK_BROADCAST: + n = sprintf((char *)p, "%d", pss->number++); + n = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT); + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + return 1; + } + if (close_testing && pss->number == 50) { + fprintf(stderr, "close tesing limit, closing\n"); + libwebsocket_close_and_free_session(context, wsi, + LWS_CLOSE_STATUS_NORMAL); + } + break; + + case LWS_CALLBACK_RECEIVE: + fprintf(stderr, "rx %d\n", (int)len); + if (len < 6) + break; + if (strcmp(in, "reset\n") == 0) + pss->number = 0; + break; + /* + * this just demonstrates how to use the protocol filter. If you won't + * study and reject connections based on header content, you don't need + * to handle this callback + */ + + case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: + dump_handshake_info((struct lws_tokens *)(long)user); + /* you could return non-zero here and kill the connection */ + break; + + default: + break; + } + + return 0; +} + + +/* lws-mirror_protocol */ + +#define MAX_MESSAGE_QUEUE 64 + +struct per_session_data__lws_mirror { + struct libwebsocket *wsi; + int ringbuffer_tail; +}; + +struct a_message { + void *payload; + size_t len; +}; + +static struct a_message ringbuffer[MAX_MESSAGE_QUEUE]; +static int ringbuffer_head; + + +static int +callback_lws_mirror(struct libwebsocket_context *context, + struct libwebsocket *wsi, + enum libwebsocket_callback_reasons reason, + void *user, void *in, size_t len) +{ + int n; + struct per_session_data__lws_mirror *pss = user; + + switch (reason) { + + case LWS_CALLBACK_ESTABLISHED: + fprintf(stderr, "callback_lws_mirror: " + "LWS_CALLBACK_ESTABLISHED\n"); + pss->ringbuffer_tail = ringbuffer_head; + pss->wsi = wsi; + break; + + case LWS_CALLBACK_SERVER_WRITEABLE: + if (close_testing) + break; + if (pss->ringbuffer_tail != ringbuffer_head) { + + n = libwebsocket_write(wsi, (unsigned char *) + ringbuffer[pss->ringbuffer_tail].payload + + LWS_SEND_BUFFER_PRE_PADDING, + ringbuffer[pss->ringbuffer_tail].len, + LWS_WRITE_TEXT); + if (n < 0) { + fprintf(stderr, "ERROR writing to socket"); + exit(1); + } + + if (pss->ringbuffer_tail == (MAX_MESSAGE_QUEUE - 1)) + pss->ringbuffer_tail = 0; + else + pss->ringbuffer_tail++; + + if (((ringbuffer_head - pss->ringbuffer_tail) % + MAX_MESSAGE_QUEUE) < (MAX_MESSAGE_QUEUE - 15)) + libwebsocket_rx_flow_control(wsi, 1); + + libwebsocket_callback_on_writable(context, wsi); + + } + break; + + case LWS_CALLBACK_BROADCAST: + n = libwebsocket_write(wsi, in, len, LWS_WRITE_TEXT); + if (n < 0) + fprintf(stderr, "mirror write failed\n"); + break; + + case LWS_CALLBACK_RECEIVE: + + if (ringbuffer[ringbuffer_head].payload) + free(ringbuffer[ringbuffer_head].payload); + + ringbuffer[ringbuffer_head].payload = + malloc(LWS_SEND_BUFFER_PRE_PADDING + len + + LWS_SEND_BUFFER_POST_PADDING); + ringbuffer[ringbuffer_head].len = len; + memcpy((char *)ringbuffer[ringbuffer_head].payload + + LWS_SEND_BUFFER_PRE_PADDING, in, len); + if (ringbuffer_head == (MAX_MESSAGE_QUEUE - 1)) + ringbuffer_head = 0; + else + ringbuffer_head++; + + if (((ringbuffer_head - pss->ringbuffer_tail) % + MAX_MESSAGE_QUEUE) > (MAX_MESSAGE_QUEUE - 10)) + libwebsocket_rx_flow_control(wsi, 0); + + libwebsocket_callback_on_writable_all_protocol( + libwebsockets_get_protocol(wsi)); + break; + /* + * this just demonstrates how to use the protocol filter. If you won't + * study and reject connections based on header content, you don't need + * to handle this callback + */ + + case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: + dump_handshake_info((struct lws_tokens *)(long)user); + /* you could return non-zero here and kill the connection */ + break; + + default: + break; + } + + return 0; +} + + +/* list of supported protocols and callbacks */ + +static struct libwebsocket_protocols protocols[] = { + /* first protocol must always be HTTP handler */ + + { + "http-only", /* name */ + callback_http, /* callback */ + 0 /* per_session_data_size */ + }, + { + "dumb-increment-protocol", + callback_dumb_increment, + sizeof(struct per_session_data__dumb_increment), + }, + { + "lws-mirror-protocol", + callback_lws_mirror, + sizeof(struct per_session_data__lws_mirror) + }, + { + NULL, NULL, 0 /* End of list */ + } +}; + +static struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "port", required_argument, NULL, 'p' }, + { "ssl", no_argument, NULL, 's' }, + { "killmask", no_argument, NULL, 'k' }, + { "interface", required_argument, NULL, 'i' }, + { "closetest", no_argument, NULL, 'c' }, + { NULL, 0, 0, 0 } +}; + +int main(int argc, char **argv) +{ + int n = 0; + const char *cert_path = + LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem"; + const char *key_path = + LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem"; + unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 1024 + + LWS_SEND_BUFFER_POST_PADDING]; + int port = 7681; + int use_ssl = 0; + struct libwebsocket_context *context; + int opts = 0; + char interface_name[128] = ""; + const char *interface = NULL; +#ifdef LWS_NO_FORK + unsigned int oldus = 0; +#endif + + fprintf(stderr, "libwebsockets test server\n" + "(C) Copyright 2010-2011 Andy Green " + "licensed under LGPL2.1\n"); + + while (n >= 0) { + n = getopt_long(argc, argv, "ci:khsp:", options, NULL); + if (n < 0) + continue; + switch (n) { + case 's': + use_ssl = 1; + break; + case 'k': + opts = LWS_SERVER_OPTION_DEFEAT_CLIENT_MASK; + break; + case 'p': + port = atoi(optarg); + break; + case 'i': + strncpy(interface_name, optarg, sizeof interface_name); + interface_name[(sizeof interface_name) - 1] = '\0'; + interface = interface_name; + break; + case 'c': + close_testing = 1; + fprintf(stderr, " Close testing mode -- closes on " + "client after 50 dumb increments" + "and suppresses lws_mirror spam\n"); + break; + case 'h': + fprintf(stderr, "Usage: test-server " + "[--port=

] [--ssl]\n"); + exit(1); + } + } + + if (!use_ssl) + cert_path = key_path = NULL; + + context = libwebsocket_create_context(port, interface, protocols, + libwebsocket_internal_extensions, + cert_path, key_path, -1, -1, opts); + if (context == NULL) { + fprintf(stderr, "libwebsocket init failed\n"); + return -1; + } + + buf[LWS_SEND_BUFFER_PRE_PADDING] = 'x'; + +#ifdef LWS_NO_FORK + + /* + * This example shows how to work with no forked service loop + */ + + fprintf(stderr, " Using no-fork service loop\n"); + + n = 0; + while (n >= 0) { + struct timeval tv; + + gettimeofday(&tv, NULL); + + /* + * This broadcasts to all dumb-increment-protocol connections + * at 20Hz. + * + * We're just sending a character 'x', in these examples the + * callbacks send their own per-connection content. + * + * You have to send something with nonzero length to get the + * callback actions delivered. + * + * We take care of pre-and-post padding allocation. + */ + + if (((unsigned int)tv.tv_usec - oldus) > 50000) { + libwebsockets_broadcast( + &protocols[PROTOCOL_DUMB_INCREMENT], + &buf[LWS_SEND_BUFFER_PRE_PADDING], 1); + oldus = tv.tv_usec; + } + + /* + * This example server does not fork or create a thread for + * websocket service, it all runs in this single loop. So, + * we have to give the websockets an opportunity to service + * "manually". + * + * If no socket is needing service, the call below returns + * immediately and quickly. Negative return means we are + * in process of closing + */ + + n = libwebsocket_service(context, 50); + } + +#else + + /* + * This example shows how to work with the forked websocket service loop + */ + + fprintf(stderr, " Using forked service loop\n"); + + /* + * This forks the websocket service action into a subprocess so we + * don't have to take care about it. + */ + + n = libwebsockets_fork_service_loop(context); + if (n < 0) { + fprintf(stderr, "Unable to fork service loop %d\n", n); + return 1; + } + + while (1) { + + usleep(50000); + + /* + * This broadcasts to all dumb-increment-protocol connections + * at 20Hz. + * + * We're just sending a character 'x', in these examples the + * callbacks send their own per-connection content. + * + * You have to send something with nonzero length to get the + * callback actions delivered. + * + * We take care of pre-and-post padding allocation. + */ + + libwebsockets_broadcast(&protocols[PROTOCOL_DUMB_INCREMENT], + &buf[LWS_SEND_BUFFER_PRE_PADDING], 1); + } + +#endif + + libwebsocket_context_destroy(context); + + return 0; +} diff --git a/libs/libwebsockets/test-server/test.html b/libs/libwebsockets/test-server/test.html new file mode 100644 index 0000000000..99d6236b83 --- /dev/null +++ b/libs/libwebsockets/test-server/test.html @@ -0,0 +1,361 @@ + + + + + Minimal Websocket test app + + + +

Detected Browser:
...

+

libwebsockets "dumb-increment-protocol" test applet

+The incrementing number is coming from the server and is individual for +each connection to the server... try opening a second browser window. +Click the button to send the server a websocket message to +reset the number.

+ + + + + + + +
Not initialized
+ +

libwebsockets "lws-mirror-protocol" test applet

+Use the mouse to draw on the canvas below -- all other browser windows open +on this page see your drawing in realtime and you can see any of theirs as +well. +

+The lws-mirror protocol doesn't interpret what is being sent to it, it just +re-sends it to every other websocket it has a connection with using that +protocol, including the guy who sent the packet. +

libwebsockets-test-client spams circles on to this shared canvas when +run.

+

+ + + + + + + + + +
Drawing color: + +
Not initialized
+ + + + + diff --git a/libs/libwebsockets/win32port/client/client.vcxproj b/libs/libwebsockets/win32port/client/client.vcxproj new file mode 100644 index 0000000000..1192afc142 --- /dev/null +++ b/libs/libwebsockets/win32port/client/client.vcxproj @@ -0,0 +1,259 @@ + + + + + Debug static + Win32 + + + Debug + Win32 + + + Debug + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release static + Win32 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + {332bf17e-fd30-4363-975a-aa731a827b4f} + + + {4156fc56-8443-2973-4fe2-a0bb2c621525} + + + + + + + + {6265650C-4799-451C-A687-94DE48759A8B} + Win32Proj + client + + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + false + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + true + + + true + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + false + + + Console + true + ws2_32.lib;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) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + MultiThreadedDebug + false + + + Console + true + ws2_32.lib;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) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + + + Console + true + ws2_32.lib;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) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + + + Console + true + ws2_32.lib;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) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + MultiThreaded + false + + + Console + true + true + true + ws2_32.lib;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) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + + + Console + true + true + true + ws2_32.lib;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) + + + + + false + ../win32helpers + WIN32;_CONSOLE + MultiThreaded + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + false + MultiThreaded + false + ../win32helpers + WIN32;_CONSOLE;LWS_DLL + + + + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/client/client.vcxproj.filters b/libs/libwebsockets/win32port/client/client.vcxproj.filters new file mode 100644 index 0000000000..76f11219e3 --- /dev/null +++ b/libs/libwebsockets/win32port/client/client.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {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;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj b/libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj new file mode 100644 index 0000000000..8c371f3ffe --- /dev/null +++ b/libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj @@ -0,0 +1,274 @@ + + + + + Debug static + Win32 + + + Debug + Win32 + + + Debug + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release static + Win32 + + + Release + Win32 + + + Release + x64 + + + + {332BF17E-FD30-4363-975A-AA731A827B4F} + Win32Proj + libwebsocketswin32 + + + + StaticLibrary + true + Unicode + + + StaticLibrary + true + Unicode + + + StaticLibrary + true + Unicode + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + StaticLibrary + false + true + Unicode + + + StaticLibrary + + + DynamicLibrary + true + + + + + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)..\output\ + D:\Libraries\libwebsockets\output\;$(LibraryPath) + libwebsockets_vc100-mt-sgd + + + D:\Libraries\libwebsockets\output\;$(LibraryPath) + + + D:\Libraries\libwebsockets\output\;$(LibraryPath) + + + libwebsockets_vc100-mt-s + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + ../win32helpers;../zlib + false + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + ../win32helpers;../zlib + MultiThreadedDebug + false + + + Windows + true + + + $(OutDir)libwebsockets_vc100-mt-sgd$(TargetExt) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + ../win32helpers;../zlib + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + ../win32helpers;../zlib + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + ../win32helpers;../zlib + MultiThreaded + false + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + ../win32helpers;../zlib + + + Windows + true + true + true + + + + + ../win32helpers;../zlib + WIN32 + false + MultiThreaded + + + $(OutDir)libwebsockets_vc100-mt-s.lib + + + + + ../win32helpers;../zlib + WIN32;LWS_INTERNAL;LWS_DLL + false + MultiThreaded + false + Speed + true + + + $(OutDir)libwebsockets_vc100-mt-s.lib + + + Ws2_32.lib;..\..\output\ZLib_vc100-mt-s.lib;%(AdditionalDependencies) + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj.filters b/libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj.filters new file mode 100644 index 0000000000..3c6edbb327 --- /dev/null +++ b/libs/libwebsockets/win32port/libwebsocketswin32/libwebsocketswin32.vcxproj.filters @@ -0,0 +1,72 @@ + + + + + {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;mfcribbon-ms + + + + + 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 + + + Source Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/server/server.vcxproj b/libs/libwebsockets/win32port/server/server.vcxproj new file mode 100644 index 0000000000..7fe50a8550 --- /dev/null +++ b/libs/libwebsockets/win32port/server/server.vcxproj @@ -0,0 +1,276 @@ + + + + + Debug static + Win32 + + + Debug + Win32 + + + Debug + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release static + Win32 + + + Release + Win32 + + + Release + x64 + + + + + ../win32helpers + ../win32helpers + ../win32helpers + ../win32helpers + + + + + + + + + + + + + + + + {332bf17e-fd30-4363-975a-aa731a827b4f} + + + {4156fc56-8443-2973-4fe2-a0bb2c621525} + + + + {E585B64F-9365-4C58-9EF8-56393EB27F8B} + Win32Proj + server + + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + true + Unicode + + + Application + false + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + true + + + true + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + false + + + Console + true + + + ws2_32.lib;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) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + MultiThreadedDebug + false + + + Console + true + + + ws2_32.lib;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) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + + + Console + true + + + ws2_32.lib;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) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + + + Console + true + + + ws2_32.lib;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) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + MultiThreaded + false + + + Console + true + true + true + ws2_32.lib;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) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ../win32helpers + + + Console + true + true + true + ws2_32.lib;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) + + + + + false + ../win32helpers + WIN32;_CONSOLE + MultiThreaded + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + false + MultiThreaded + false + ../win32helpers + WIN32;_CONSOLE;LWS_DLL + + + + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/server/server.vcxproj.filters b/libs/libwebsockets/win32port/server/server.vcxproj.filters new file mode 100644 index 0000000000..d4a9c7da53 --- /dev/null +++ b/libs/libwebsockets/win32port/server/server.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {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;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/win32helpers/getopt.c b/libs/libwebsockets/win32port/win32helpers/getopt.c new file mode 100644 index 0000000000..2181f1cb12 --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/getopt.c @@ -0,0 +1,153 @@ +/* $NetBSD: getopt.c,v 1.16 1999/12/02 13:15:56 kleink Exp $ */ + +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if 0 +static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; +#endif + +#include +#include +#include +#include + +#define __P(x) x +#define _DIAGASSERT(x) assert(x) + +#ifdef __weak_alias +__weak_alias(getopt,_getopt); +#endif + + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +static char * _progname __P((char *)); +int getopt_internal __P((int, char * const *, const char *)); + +static char * +_progname(nargv0) + char * nargv0; +{ + char * tmp; + + _DIAGASSERT(nargv0 != NULL); + + tmp = strrchr(nargv0, '/'); + if (tmp) + tmp++; + else + tmp = nargv0; + return(tmp); +} + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt(nargc, nargv, ostr) + int nargc; + char * const nargv[]; + const char *ostr; +{ + static char *__progname = 0; + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + __progname = __progname?__progname:_progname(*nargv); + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(ostr != NULL); + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (-1); + } + if (place[1] && *++place == '-' /* found "--" */ + && place[1] == '\0') { + ++optind; + place = EMSG; + return (-1); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means -1. + */ + if (optopt == (int)'-') + return (-1); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", __progname, optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + __progname, optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} + diff --git a/libs/libwebsockets/win32port/win32helpers/getopt.h b/libs/libwebsockets/win32port/win32helpers/getopt.h new file mode 100644 index 0000000000..5a88c2df6b --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/getopt.h @@ -0,0 +1,33 @@ +#ifndef __GETOPT_H__ +#define __GETOPT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int opterr; /* if error message should be printed */ +extern int optind; /* index into parent argv vector */ +extern int optopt; /* character checked for validity */ +extern int optreset; /* reset getopt */ +extern char *optarg; /* argument associated with option */ + +struct option +{ + const char *name; + int has_arg; + int *flag; + int val; +}; + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +int getopt(int, char**, char*); +int getopt_long(int, char**, char*, struct option*, int*); + +#ifdef __cplusplus +} +#endif + +#endif /* __GETOPT_H__ */ diff --git a/libs/libwebsockets/win32port/win32helpers/getopt_long.c b/libs/libwebsockets/win32port/win32helpers/getopt_long.c new file mode 100644 index 0000000000..43a5cba79a --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/getopt_long.c @@ -0,0 +1,237 @@ + +/* + * Copyright (c) 1987, 1993, 1994, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +#include +#include +#include +#include +#include "getopt.h" + +extern int opterr; /* if error message should be printed */ +extern int optind; /* index into parent argv vector */ +extern int optopt; /* character checked for validity */ +extern int optreset; /* reset getopt */ +extern char *optarg; /* argument associated with option */ + +#define __P(x) x +#define _DIAGASSERT(x) assert(x) + +static char * __progname __P((char *)); +int getopt_internal __P((int, char * const *, const char *)); + +static char * +__progname(nargv0) + char * nargv0; +{ + char * tmp; + + _DIAGASSERT(nargv0 != NULL); + + tmp = strrchr(nargv0, '/'); + if (tmp) + tmp++; + else + tmp = nargv0; + return(tmp); +} + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt_internal(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(ostr != NULL); + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (-1); + } + if (place[1] && *++place == '-') { /* found "--" */ + /* ++optind; */ + place = EMSG; + return (-2); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means -1. + */ + if (optopt == (int)'-') + return (-1); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", __progname(nargv[0]), optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if ((opterr) && (*ostr != ':')) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + __progname(nargv[0]), optopt); + return (BADARG); + } else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} + +#if 0 +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt2(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + int retval; + + if ((retval = getopt_internal(nargc, nargv, ostr)) == -2) { + retval = -1; + ++optind; + } + return(retval); +} +#endif + +/* + * getopt_long -- + * Parse argc/argv argument vector. + */ +int +getopt_long(nargc, nargv, options, long_options, index) + int nargc; + char ** nargv; + char * options; + struct option * long_options; + int * index; +{ + int retval; + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(options != NULL); + _DIAGASSERT(long_options != NULL); + /* index may be NULL */ + + if ((retval = getopt_internal(nargc, nargv, options)) == -2) { + char *current_argv = nargv[optind++] + 2, *has_equal; + int i, current_argv_len, match = -1; + + if (*current_argv == '\0') { + return(-1); + } + if ((has_equal = strchr(current_argv, '=')) != NULL) { + current_argv_len = has_equal - current_argv; + has_equal++; + } else + current_argv_len = strlen(current_argv); + + for (i = 0; long_options[i].name; i++) { + if (strncmp(current_argv, long_options[i].name, current_argv_len)) + continue; + + if (strlen(long_options[i].name) == (unsigned)current_argv_len) { + match = i; + break; + } + if (match == -1) + match = i; + } + if (match != -1) { + if (long_options[match].has_arg == required_argument || + long_options[match].has_arg == optional_argument) { + if (has_equal) + optarg = has_equal; + else + optarg = nargv[optind++]; + } + if ((long_options[match].has_arg == required_argument) + && (optarg == NULL)) { + /* + * Missing argument, leading : + * indicates no error should be generated + */ + if ((opterr) && (*options != ':')) + (void)fprintf(stderr, + "%s: option requires an argument -- %s\n", + __progname(nargv[0]), current_argv); + return (BADARG); + } + } else { /* No matching argument */ + if ((opterr) && (*options != ':')) + (void)fprintf(stderr, + "%s: illegal option -- %s\n", __progname(nargv[0]), current_argv); + return (BADCH); + } + if (long_options[match].flag) { + *long_options[match].flag = long_options[match].val; + retval = 0; + } else + retval = long_options[match].val; + if (index) + *index = match; + } + return(retval); +} diff --git a/libs/libwebsockets/win32port/win32helpers/gettimeofday.c b/libs/libwebsockets/win32port/win32helpers/gettimeofday.c new file mode 100644 index 0000000000..a424db923b --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/gettimeofday.c @@ -0,0 +1,48 @@ +#include < time.h > +#include //I've ommited context line. +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +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 -= DELTA_EPOCH_IN_MICROSECS; + tmpres /= 10; /*convert into microseconds*/ + 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; +} diff --git a/libs/libwebsockets/win32port/win32helpers/gettimeofday.h b/libs/libwebsockets/win32port/win32helpers/gettimeofday.h new file mode 100644 index 0000000000..223ceeed8b --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/gettimeofday.h @@ -0,0 +1,28 @@ +#ifndef _GET_TIME_OF_DAY_H +#define _GET_TIME_OF_DAY_H + +#ifdef __MINGW64__ +#else +#ifdef __MINGW32__ +#else +#include < time.h > +#endif +#endif + +#include //I've ommited context line. +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +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 diff --git a/libs/libwebsockets/win32port/win32helpers/netdb.h b/libs/libwebsockets/win32port/win32helpers/netdb.h new file mode 100644 index 0000000000..45304b7673 --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/netdb.h @@ -0,0 +1 @@ +// Left blank for win32 \ No newline at end of file diff --git a/libs/libwebsockets/win32port/win32helpers/strings.h b/libs/libwebsockets/win32port/win32helpers/strings.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/libwebsockets/win32port/win32helpers/sys/time.h b/libs/libwebsockets/win32port/win32helpers/sys/time.h new file mode 100644 index 0000000000..258af63bcd --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/sys/time.h @@ -0,0 +1 @@ +// left blank \ No newline at end of file diff --git a/libs/libwebsockets/win32port/win32helpers/unistd.h b/libs/libwebsockets/win32port/win32helpers/unistd.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/libwebsockets/win32port/win32helpers/websock-w32.c b/libs/libwebsockets/win32port/win32helpers/websock-w32.c new file mode 100644 index 0000000000..bec150b179 --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/websock-w32.c @@ -0,0 +1,104 @@ +#define FD_SETSIZE 256 + +#ifdef __MINGW32__ +#include +#else +#ifdef __MINGW64__ +#include +#else +#include +#endif +#endif + +#include +#include +#include "websock-w32.h" + +PFNWSAPOLL poll = NULL; + +INT WSAAPI emulated_poll(LPWSAPOLLFD fdarray, ULONG nfds, INT timeout) +{ + fd_set readfds; + fd_set writefds; + struct timeval tv; + struct timeval *ptv = &tv; + SOCKET max_socket = 0; + ULONG n = 0; + int waiting; + int pending = 0; + WSAPOLLFD * poll_fd = fdarray; + + if (NULL == fdarray) { + errno = EFAULT; + return -1; + } + + FD_ZERO(&readfds); + FD_ZERO(&writefds); + + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + + if (timeout < 0) + ptv = NULL; + + while (n < nfds) { + + poll_fd->revents = 0; + + if (poll_fd->fd < 0 || !poll_fd->events) + goto skip1; + + if (max_socket < poll_fd->fd) + max_socket = poll_fd->fd; + + if (poll_fd->events & POLLIN) + FD_SET(poll_fd->fd, &readfds); + + if (poll_fd->events & POLLOUT) + FD_SET(poll_fd->fd, &writefds); +skip1: + poll_fd++; + n++; + } + + waiting = select((int)max_socket + 1, &readfds, &writefds, NULL, ptv); + + if (waiting <= 0) + return waiting; + + poll_fd = fdarray; + + while (waiting && nfds--) { + + if (!poll_fd->events) + goto skip2; + + if (poll_fd->fd <= 0) { + poll_fd->revents = POLLNVAL; + goto skip2; + } + + if (FD_ISSET(poll_fd->fd, &readfds)) { + + /* defer POLLHUP / error detect to false read attempt */ + + poll_fd->revents |= POLLIN; + waiting--; + } + + if (FD_ISSET(poll_fd->fd, &writefds)) { + + poll_fd->revents |= poll_fd->events & POLLOUT; + waiting--; + } + + if (poll_fd->revents) + pending++; + +skip2: + poll_fd++; + } + + return pending; +} diff --git a/libs/libwebsockets/win32port/win32helpers/websock-w32.h b/libs/libwebsockets/win32port/win32helpers/websock-w32.h new file mode 100644 index 0000000000..dfd99ca917 --- /dev/null +++ b/libs/libwebsockets/win32port/win32helpers/websock-w32.h @@ -0,0 +1,64 @@ +#ifndef __WEB_SOCK_W32_H__ +#define __WEB_SOCK_W32_H__ + +// Windows uses _DEBUG and NDEBUG +#ifdef _DEBUG +#undef DEBUG +#define DEBUG 1 +#endif + +#pragma warning(disable : 4996) + +#define bzero(b,len) (memset((b), '\0', (len)), (void) 0) + +#define MSG_NOSIGNAL 0 +#define SHUT_RDWR SD_BOTH + +#define SOL_TCP IPPROTO_TCP + +#define random rand +#define usleep _sleep + +#ifdef __MINGW64__ +#define DEF_POLL_STUFF +#endif +#ifdef __MINGW32__ +#define DEF_POLL_STUFF +#endif + +#ifdef DEF_POLL_STUFF + +#include + +typedef struct pollfd { + SOCKET fd; + short events; + short revents; +} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD; + +#define POLLIN 0x0001 /* any readable data available */ +#define POLLOUT 0x0004 /* file descriptor is writeable */ +#define POLLERR 0x0008 /* some poll error occurred */ +#define POLLHUP 0x0010 /* file descriptor was "hung up" */ +#define POLLNVAL 0x0020 /* requested events "invalid" */ + +#endif + +typedef INT (WSAAPI *PFNWSAPOLL)(LPWSAPOLLFD fdarray, ULONG nfds, INT timeout); +extern PFNWSAPOLL poll; + +extern INT WSAAPI emulated_poll(LPWSAPOLLFD fdarray, ULONG nfds, INT timeout); + +/* override configure because we are not using Makefiles */ + +#define LWS_NO_FORK + +/* windows can't cope with this idea, needs assets in cwd */ + +#ifdef INSTALL_DATADIR +#undef INSTALL_DATADIR +#endif + +#define INSTALL_DATADIR "." + +#endif diff --git a/libs/libwebsockets/win32port/win32port.sln b/libs/libwebsockets/win32port/win32port.sln new file mode 100644 index 0000000000..fc7ca7c2eb --- /dev/null +++ b/libs/libwebsockets/win32port/win32port.sln @@ -0,0 +1,100 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "server\server.vcxproj", "{E585B64F-9365-4C58-9EF8-56393EB27F8B}" + ProjectSection(ProjectDependencies) = postProject + {332BF17E-FD30-4363-975A-AA731A827B4F} = {332BF17E-FD30-4363-975A-AA731A827B4F} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libwebsocketswin32", "libwebsocketswin32\libwebsocketswin32.vcxproj", "{332BF17E-FD30-4363-975A-AA731A827B4F}" + ProjectSection(ProjectDependencies) = postProject + {4156FC56-8443-2973-4FE2-A0BB2C621525} = {4156FC56-8443-2973-4FE2-A0BB2C621525} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "client\client.vcxproj", "{6265650C-4799-451C-A687-94DE48759A8B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZLib", "zlib\ZLib.vcxproj", "{4156FC56-8443-2973-4FE2-A0BB2C621525}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug static|Win32 = Debug static|Win32 + Debug static|x64 = Debug static|x64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release static|Win32 = Release static|Win32 + Release static|x64 = Release static|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {332BF17E-FD30-4363-975A-AA731A827B4F}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Debug static|Win32.Build.0 = Debug static|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Debug static|x64.ActiveCfg = Debug static|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Debug|Win32.ActiveCfg = Debug|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Debug|Win32.Build.0 = Debug|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Debug|x64.ActiveCfg = Debug|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release DLL|x64.Build.0 = Release DLL|x64 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release static|Win32.ActiveCfg = Release static|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release static|Win32.Build.0 = Release static|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release static|x64.ActiveCfg = Release static|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release|Win32.ActiveCfg = Release|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release|Win32.Build.0 = Release|Win32 + {332BF17E-FD30-4363-975A-AA731A827B4F}.Release|x64.ActiveCfg = Release|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Debug static|Win32.Build.0 = Debug static|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Debug static|x64.ActiveCfg = Debug static|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Debug|Win32.ActiveCfg = Debug|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Debug|Win32.Build.0 = Debug|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Debug|x64.ActiveCfg = Debug|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release DLL|x64.Build.0 = Release DLL|x64 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release static|Win32.ActiveCfg = Release static|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release static|Win32.Build.0 = Release static|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release static|x64.ActiveCfg = Release static|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release|Win32.ActiveCfg = Release|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release|Win32.Build.0 = Release|Win32 + {4156FC56-8443-2973-4FE2-A0BB2C621525}.Release|x64.ActiveCfg = Release|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Debug static|Win32.Build.0 = Debug static|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Debug static|x64.ActiveCfg = Debug static|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Debug|Win32.ActiveCfg = Debug|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Debug|Win32.Build.0 = Debug|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Debug|x64.ActiveCfg = Debug|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {6265650C-4799-451C-A687-94DE48759A8B}.Release DLL|x64.Build.0 = Release DLL|x64 + {6265650C-4799-451C-A687-94DE48759A8B}.Release static|Win32.ActiveCfg = Release static|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release static|Win32.Build.0 = Release static|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release static|x64.ActiveCfg = Release static|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release|Win32.ActiveCfg = Release|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release|Win32.Build.0 = Release|Win32 + {6265650C-4799-451C-A687-94DE48759A8B}.Release|x64.ActiveCfg = Release|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Debug static|Win32.Build.0 = Debug static|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Debug static|x64.ActiveCfg = Debug static|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Debug|Win32.ActiveCfg = Debug|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Debug|Win32.Build.0 = Debug|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Debug|x64.ActiveCfg = Debug|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release DLL|x64.Build.0 = Release DLL|x64 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release static|Win32.ActiveCfg = Release static|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release static|Win32.Build.0 = Release static|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release static|x64.ActiveCfg = Release static|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release|Win32.ActiveCfg = Release|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release|Win32.Build.0 = Release|Win32 + {E585B64F-9365-4C58-9EF8-56393EB27F8B}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libs/libwebsockets/win32port/zlib/ZLib.vcxproj b/libs/libwebsockets/win32port/zlib/ZLib.vcxproj new file mode 100644 index 0000000000..0afc43c923 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/ZLib.vcxproj @@ -0,0 +1,374 @@ + + + + + Debug static + Win32 + + + Debug + Win32 + + + Debug + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release static + Win32 + + + Release + Win32 + + + Release + x64 + + + + {4156FC56-8443-2973-4FE2-A0BB2C621525} + + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + + + StaticLibrary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DebugV10\ + DebugV10\ + + + $(SolutionDir)..\output\ + DebugV10\ + ZLib_vc100-mt-sgd + + + DebugV10\ + DebugV10\ + + + DebugV10\ + DebugV10\ + + + .\Release\ + .\Release\ + + + .\Release\ + .\Release\ + + + $(SolutionDir)..\output\ + ZLib_vc100-mt-s + + + $(SolutionDir)..\output\ + ZLib_vc100-mt-s + + + + MultiThreadedDebugDLL + Default + false + Disabled + true + Level3 + true + EditAndContinue + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + DebugV10\ + DebugV10\ZLib.pch + DebugV10\ + DebugV10\ + EnableFastChecks + false + false + + + 0x1c09 + _DEBUG;%(PreprocessorDefinitions) + + + true + DebugV10\ZLib.bsc + + + true + DebugV10\ZLib.lib + + + + + MultiThreadedDebug + Default + false + Disabled + true + Level3 + true + EditAndContinue + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + DebugV10\ + DebugV10\ZLib.pch + DebugV10\ + DebugV10\ + EnableFastChecks + false + false + + + 0x1c09 + _DEBUG;%(PreprocessorDefinitions) + + + true + DebugV10\ZLib.bsc + + + true + $(OutDir)ZLib_vc100-mt-sgd.lib + + + + + MultiThreadedDebugDLL + Default + false + Disabled + true + Level3 + ProgramDatabase + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + DebugV10\ + DebugV10\ZLib.pch + DebugV10\ + DebugV10\ + EnableFastChecks + false + + + 0x1c09 + _DEBUG;%(PreprocessorDefinitions) + + + true + DebugV10\ZLib.bsc + + + true + DebugV10\ZLib.lib + + + + + MultiThreadedDebugDLL + Default + false + Disabled + true + Level3 + ProgramDatabase + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + DebugV10\ + DebugV10\ZLib.pch + DebugV10\ + DebugV10\ + EnableFastChecks + false + + + 0x1c09 + _DEBUG;%(PreprocessorDefinitions) + + + true + DebugV10\ZLib.bsc + + + true + DebugV10\ZLib.lib + + + + + MultiThreaded + OnlyExplicitInline + true + true + MaxSpeed + true + Level3 + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + .\Release\ + .\Release\ZLib.pch + .\Release\ + .\Release\ + false + false + + + 0x1c09 + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\ZLib.bsc + + + true + .\Release\ZLib.lib + + + + + MultiThreadedDLL + OnlyExplicitInline + true + true + MaxSpeed + true + Level3 + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + .\Release\ + .\Release\ZLib.pch + .\Release\ + .\Release\ + false + + + 0x1c09 + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\ZLib.bsc + + + true + .\Release\ZLib.lib + + + + + $(OutDir)ZLib_vc100-mt-s.lib + + + MultiThreaded + false + + + + + $(OutDir)ZLib_vc100-mt-s.lib + true + + + MultiThreaded + false + false + true + Speed + WIN32 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/zlib/ZLib.vcxproj.filters b/libs/libwebsockets/win32port/zlib/ZLib.vcxproj.filters new file mode 100644 index 0000000000..3e6c18da25 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/ZLib.vcxproj.filters @@ -0,0 +1,95 @@ + + + + + {2e5deede-b2ef-40bd-950a-a7f7f0fc0413} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {85d35343-9068-43e8-875e-60b528a03c9b} + h;hpp;hxx;hm;inl + + + + + 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 + + + \ No newline at end of file diff --git a/libs/libwebsockets/win32port/zlib/adler32.c b/libs/libwebsockets/win32port/zlib/adler32.c new file mode 100644 index 0000000000..5f2bc6bf4f --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/adler32.c @@ -0,0 +1,169 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2007 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#define local static + +local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); + +#define BASE 65521UL /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* use NO_DIVIDE if your processor does not do division in hardware */ +#ifdef NO_DIVIDE +# define MOD(a) \ + do { \ + if (a >= (BASE << 16)) a -= (BASE << 16); \ + if (a >= (BASE << 15)) a -= (BASE << 15); \ + if (a >= (BASE << 14)) a -= (BASE << 14); \ + if (a >= (BASE << 13)) a -= (BASE << 13); \ + if (a >= (BASE << 12)) a -= (BASE << 12); \ + if (a >= (BASE << 11)) a -= (BASE << 11); \ + if (a >= (BASE << 10)) a -= (BASE << 10); \ + if (a >= (BASE << 9)) a -= (BASE << 9); \ + if (a >= (BASE << 8)) a -= (BASE << 8); \ + if (a >= (BASE << 7)) a -= (BASE << 7); \ + if (a >= (BASE << 6)) a -= (BASE << 6); \ + if (a >= (BASE << 5)) a -= (BASE << 5); \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +# define MOD4(a) \ + do { \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +# define MOD4(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + adler += buf[0]; + if (adler >= BASE) + adler -= BASE; + sum2 += adler; + if (sum2 >= BASE) + sum2 -= BASE; + return adler | (sum2 << 16); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == Z_NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + while (len--) { + adler += *buf++; + sum2 += adler; + } + if (adler >= BASE) + adler -= BASE; + MOD4(sum2); /* only added so many BASE's */ + return adler | (sum2 << 16); + } + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; + n = NMAX / 16; /* NMAX is divisible by 16 */ + do { + DO16(buf); /* 16 sums unrolled */ + buf += 16; + } while (--n); + MOD(adler); + MOD(sum2); + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + if (len) { /* avoid modulos if none remaining */ + while (len >= 16) { + len -= 16; + DO16(buf); + buf += 16; + } + while (len--) { + adler += *buf++; + sum2 += adler; + } + MOD(adler); + MOD(sum2); + } + + /* return recombined sums */ + return adler | (sum2 << 16); +} + +/* ========================================================================= */ +local uLong adler32_combine_(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + unsigned long sum1; + unsigned long sum2; + unsigned rem; + + /* the derivation of this formula is left as an exercise for the reader */ + rem = (unsigned)(len2 % BASE); + sum1 = adler1 & 0xffff; + sum2 = rem * sum1; + MOD(sum2); + sum1 += (adler2 & 0xffff) + BASE - 1; + sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; + if (sum1 >= BASE) sum1 -= BASE; + if (sum1 >= BASE) sum1 -= BASE; + if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 >= BASE) sum2 -= BASE; + return sum1 | (sum2 << 16); +} + +/* ========================================================================= */ +uLong ZEXPORT adler32_combine(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} + +uLong ZEXPORT adler32_combine64(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} diff --git a/libs/libwebsockets/win32port/zlib/compress.c b/libs/libwebsockets/win32port/zlib/compress.c new file mode 100644 index 0000000000..c46727a416 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/compress.c @@ -0,0 +1,80 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13; +} diff --git a/libs/libwebsockets/win32port/zlib/crc32.c b/libs/libwebsockets/win32port/zlib/crc32.c new file mode 100644 index 0000000000..8cb3d8fffd --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/crc32.c @@ -0,0 +1,442 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2006, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results in about a + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifndef NOBYFOUR +# ifdef STDC /* need ANSI C limits.h to determine sizes */ +# include +# define BYFOUR +# if (UINT_MAX == 0xffffffffUL) + typedef unsigned int u4; +# else +# if (ULONG_MAX == 0xffffffffUL) + typedef unsigned long u4; +# else +# if (USHRT_MAX == 0xffffffffUL) + typedef unsigned short u4; +# else +# undef BYFOUR /* can't find a four-byte integer type! */ +# endif +# endif +# endif +# endif /* STDC */ +#endif /* !NOBYFOUR */ + +/* Definitions for doing the crc four data bytes at a time. */ +#ifdef BYFOUR +# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ + (((w)&0xff00)<<8)+(((w)&0xff)<<24)) + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +/* Local functions for crc concatenation */ +local unsigned long gf2_matrix_times OF((unsigned long *mat, + unsigned long vec)); +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); +local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); + + +#ifdef DYNAMIC_CRC_TABLE + +local volatile int crc_table_empty = 1; +local unsigned long FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const unsigned long FAR *)); +#endif /* MAKECRCH */ +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + unsigned long c; + int n, k; + unsigned long poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static volatile int first = 1; /* flag to limit concurrent making */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* See if another task is already doing this (not thread-safe, but better + than nothing -- significantly reduces duration of vulnerability in + case the advice about DYNAMIC_CRC_TABLE is ignored) */ + if (first) { + first = 0; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0UL; + for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + poly |= 1UL << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (unsigned long)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, + and then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = REV(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = REV(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + } + else { /* not first */ + /* wait for the other guy to finish (not efficient, but rare) */ + while (crc_table_empty) + ; + } + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const unsigned long FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const unsigned long FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const unsigned long FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const unsigned long FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + u4 endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return crc32_little(crc, buf, len); + else + return crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = (u4)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = REV((u4)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(REV(c)); +} + +#endif /* BYFOUR */ + +#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ + +/* ========================================================================= */ +local unsigned long gf2_matrix_times(mat, vec) + unsigned long *mat; + unsigned long vec; +{ + unsigned long sum; + + sum = 0; + while (vec) { + if (vec & 1) + sum ^= *mat; + vec >>= 1; + mat++; + } + return sum; +} + +/* ========================================================================= */ +local void gf2_matrix_square(square, mat) + unsigned long *square; + unsigned long *mat; +{ + int n; + + for (n = 0; n < GF2_DIM; n++) + square[n] = gf2_matrix_times(mat, mat[n]); +} + +/* ========================================================================= */ +local uLong crc32_combine_(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + int n; + unsigned long row; + unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ + unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ + + /* degenerate case (also disallow negative lengths) */ + if (len2 <= 0) + return crc1; + + /* put operator for one zero bit in odd */ + odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ + row = 1; + for (n = 1; n < GF2_DIM; n++) { + odd[n] = row; + row <<= 1; + } + + /* put operator for two zero bits in even */ + gf2_matrix_square(even, odd); + + /* put operator for four zero bits in odd */ + gf2_matrix_square(odd, even); + + /* apply len2 zeros to crc1 (first square will put the operator for one + zero byte, eight zero bits, in even) */ + do { + /* apply zeros operator for this bit of len2 */ + gf2_matrix_square(even, odd); + if (len2 & 1) + crc1 = gf2_matrix_times(even, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + if (len2 == 0) + break; + + /* another iteration of the loop with odd and even swapped */ + gf2_matrix_square(odd, even); + if (len2 & 1) + crc1 = gf2_matrix_times(odd, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + } while (len2 != 0); + + /* return combined crc */ + crc1 ^= crc2; + return crc1; +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} + +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} diff --git a/libs/libwebsockets/win32port/zlib/crc32.h b/libs/libwebsockets/win32port/zlib/crc32.h new file mode 100644 index 0000000000..5de49bc978 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/crc32.h @@ -0,0 +1,441 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/libs/libwebsockets/win32port/zlib/deflate.c b/libs/libwebsockets/win32port/zlib/deflate.c new file mode 100644 index 0000000000..fa00181166 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/deflate.c @@ -0,0 +1,1834 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in http://www.ietf.org/rfc/rfc1951.txt + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id$ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST +local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif +local block_state deflate_rle OF((deflate_state *s, int flush)); +local block_state deflate_huff OF((deflate_state *s, int flush)); +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +#ifndef NO_DUMMY_DECL +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->wrap = wrap; + s->gzhead = Z_NULL; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->high_water = 0; /* nothing written to s->window yet */ + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt length = dictLength; + uInt n; + IPos hash_head = 0; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || + strm->state->wrap == 2 || + (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + return Z_STREAM_ERROR; + + s = strm->state; + if (s->wrap) + strm->adler = adler32(strm->adler, dictionary, dictLength); + + if (length < MIN_MATCH) return Z_OK; + if (length > s->w_size) { + length = s->w_size; + dictionary += dictLength - length; /* use the tail of the dictionary */ + } + zmemcpy(s->window, dictionary, length); + s->strstart = length; + s->block_start = (long)length; + + /* Insert all strings in the hash table (except for the last two bytes). + * s->lookahead stays null, so s->ins_h will be recomputed at the next + * call of fill_window. + */ + s->ins_h = s->window[0]; + UPDATE_HASH(s, s->ins_h, s->window[1]); + for (n = 0; n <= length - MIN_MATCH; n++) { + INSERT_STRING(s, n, hash_head); + } + if (hash_head) hash_head = 0; /* to make compiler happy */ + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ + } + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + lm_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateSetHeader (strm, head) + z_streamp strm; + gz_headerp head; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (strm->state->wrap != 2) return Z_STREAM_ERROR; + strm->state->gzhead = head; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + strm->state->bi_valid = bits; + strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if ((strategy != s->strategy || func != configuration_table[level].func) && + strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_BLOCK); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= */ +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) + z_streamp strm; + int good_length; + int max_lazy; + int nice_length; + int max_chain; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + s->good_match = good_length; + s->max_lazy_match = max_lazy; + s->nice_match = nice_length; + s->max_chain_length = max_chain; + return Z_OK; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds for + * every combination of windowBits and memLevel. But even the conservative + * upper bound of about 14% expansion does not seem onerous for output buffer + * allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong complen, wraplen; + Bytef *str; + + /* conservative upper bound for compressed data */ + complen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + + /* if can't get parameters, return conservative bound plus zlib wrapper */ + if (strm == Z_NULL || strm->state == Z_NULL) + return complen + 6; + + /* compute wrapper length */ + s = strm->state; + switch (s->wrap) { + case 0: /* raw deflate */ + wraplen = 0; + break; + case 1: /* zlib wrapper */ + wraplen = 6 + (s->strstart ? 4 : 0); + break; + case 2: /* gzip wrapper */ + wraplen = 18; + if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ + if (s->gzhead->extra != Z_NULL) + wraplen += 2 + s->gzhead->extra_len; + str = s->gzhead->name; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + str = s->gzhead->comment; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + if (s->gzhead->hcrc) + wraplen += 2; + } + break; + default: /* for compiler happiness */ + wraplen = 6; + } + + /* if not default parameters, return conservative bound */ + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return complen + wraplen; + + /* default settings: return tight bound for that case */ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13 - 6 + wraplen; +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len = strm->state->pending; + + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, strm->state->pending_out, len); + strm->next_out += len; + strm->state->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + strm->state->pending -= len; + if (strm->state->pending == 0) { + strm->state->pending_out = strm->state->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_BLOCK || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the header */ + if (s->status == INIT_STATE) { +#ifdef GZIP + if (s->wrap == 2) { + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == Z_NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s->status = BUSY_STATE; + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != Z_NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; + } + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + } + } +#ifdef GZIP + if (s->status == EXTRA_STATE) { + if (s->gzhead->extra != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + + while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) + break; + } + put_byte(s, s->gzhead->extra[s->gzindex]); + s->gzindex++; + } + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (s->gzindex == s->gzhead->extra_len) { + s->gzindex = 0; + s->status = NAME_STATE; + } + } + else + s->status = NAME_STATE; + } + if (s->status == NAME_STATE) { + if (s->gzhead->name != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->name[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) { + s->gzindex = 0; + s->status = COMMENT_STATE; + } + } + else + s->status = COMMENT_STATE; + } + if (s->status == COMMENT_STATE) { + if (s->gzhead->comment != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->comment[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) + s->status = HCRC_STATE; + } + else + s->status = HCRC_STATE; + } + if (s->status == HCRC_STATE) { + if (s->gzhead->hcrc) { + if (s->pending + 2 > s->pending_buf_size) + flush_pending(strm); + if (s->pending + 2 <= s->pending_buf_size) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + } + } + else + s->status = BUSY_STATE; + } +#endif + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && flush <= old_flush && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : + (s->strategy == Z_RLE ? deflate_rle(s, flush) : + (*(configuration_table[s->level].func))(s, flush)); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + if (s->lookahead == 0) { + s->strstart = 0; + s->block_start = 0L; + } + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->wrap <= 0) return Z_STREAM_END; + + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && + status != EXTRA_STATE && + status != NAME_STATE && + status != COMMENT_STATE && + status != HCRC_STATE && + status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + zmemcpy(dest, source, sizeof(z_stream)); + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + zmemcpy(ds, ss, sizeof(deflate_state)); + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif /* MAXSEG_64K */ +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, strm->next_in, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, strm->next_in, len); + } +#endif + zmemcpy(buf, strm->next_in, len); + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifndef FASTEST +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +#endif +} + +#ifndef FASTEST +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} +#endif /* ASMV */ + +#else /* FASTEST */ + +/* --------------------------------------------------------------------------- + * Optimized version for FASTEST only + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; +} + +#endif /* FASTEST */ + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif /* DEBUG */ + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) return; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead >= MIN_MATCH) { + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ + if (s->high_water < s->window_size) { + ulg curr = s->strstart + (ulg)(s->lookahead); + ulg init; + + if (s->high_water < curr) { + /* Previous high water mark below current data -- zero WIN_INIT + * bytes or up to end of window, whichever is less. + */ + init = s->window_size - curr; + if (init > WIN_INIT) + init = WIN_INIT; + zmemzero(s->window + curr, (unsigned)init); + s->high_water = curr + init; + } + else if (s->high_water < (ulg)curr + WIN_INIT) { + /* High water mark at or above current data, but below current data + * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up + * to end of window, whichever is less. + */ + init = (ulg)curr + WIN_INIT - s->high_water; + if (init > s->window_size - s->high_water) + init = s->window_size - s->high_water; + zmemzero(s->window + s->high_water, (unsigned)init); + s->high_water += init; + } + } +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, last) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (last)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, last) { \ + FLUSH_BLOCK_ONLY(s, last); \ + if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +#ifndef FASTEST +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif /* FASTEST */ + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +local block_state deflate_rle(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + uInt prev; /* byte at distance one to match */ + Bytef *scan, *strend; /* scan goes up to strend for length of run */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest encodable run. + */ + if (s->lookahead < MAX_MATCH) { + fill_window(s); + if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s->match_length = 0; + if (s->lookahead >= MIN_MATCH && s->strstart > 0) { + scan = s->window + s->strstart - 1; + prev = *scan; + if (prev == *++scan && prev == *++scan && prev == *++scan) { + strend = s->window + s->strstart + MAX_MATCH; + do { + } while (prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + scan < strend); + s->match_length = MAX_MATCH - (int)(strend - scan); + if (s->match_length > s->lookahead) + s->match_length = s->lookahead; + } + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->strstart - 1, s->match_length); + + _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + s->strstart += s->match_length; + s->match_length = 0; + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +local block_state deflate_huff(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s->lookahead == 0) { + fill_window(s); + if (s->lookahead == 0) { + if (flush == Z_NO_FLUSH) + return need_more; + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s->match_length = 0; + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} diff --git a/libs/libwebsockets/win32port/zlib/deflate.h b/libs/libwebsockets/win32port/zlib/deflate.h new file mode 100644 index 0000000000..e9044c1da2 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/deflate.h @@ -0,0 +1,342 @@ +/* deflate.h -- internal compression state + * Copyright (C) 1995-2010 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef DEFLATE_H +#define DEFLATE_H + +#include "zutil.h" + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define INIT_STATE 42 +#define EXTRA_STATE 69 +#define NAME_STATE 73 +#define COMMENT_STATE 91 +#define HCRC_STATE 103 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + uInt pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + gz_headerp gzhead; /* gzip header information to write */ + uInt gzindex; /* where in extra, name, or comment */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to supress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + int last_eob_len; /* bit length of EOB code for last block */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + ulg high_water; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + +#define WIN_INIT MAX_MATCH +/* Number of bytes after end of data in window to initialize in order to avoid + memory checker errors from longest match routines */ + + /* in trees.c */ +void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); +int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); +void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); +void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch ZLIB_INTERNAL _length_code[]; + extern uch ZLIB_INTERNAL _dist_code[]; +#else + extern const uch ZLIB_INTERNAL _length_code[]; + extern const uch ZLIB_INTERNAL _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif /* DEFLATE_H */ diff --git a/libs/libwebsockets/win32port/zlib/gzclose.c b/libs/libwebsockets/win32port/zlib/gzclose.c new file mode 100755 index 0000000000..cbf0db663b --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/gzclose.c @@ -0,0 +1,25 @@ +/* gzclose.c -- zlib gzclose() function + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* gzclose() is in a separate file so that it is linked in only if it is used. + That way the other gzclose functions can be used instead to avoid linking in + unneeded compression or decompression routines. */ +int ZEXPORT gzclose(file) + gzFile file; +{ +#ifndef NO_GZCOMPRESS + gz_statep state; + + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); +#else + return gzclose_r(file); +#endif +} diff --git a/libs/libwebsockets/win32port/zlib/gzguts.h b/libs/libwebsockets/win32port/zlib/gzguts.h new file mode 100755 index 0000000000..7ff93a8dd8 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/gzguts.h @@ -0,0 +1,132 @@ +/* gzguts.h -- zlib internal header definitions for gz* operations + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef _LARGEFILE64_SOURCE +# ifndef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# endif +# ifdef _FILE_OFFSET_BITS +# undef _FILE_OFFSET_BITS +# endif +#endif + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include +#include "zlib.h" +#ifdef STDC +# include +# include +# include +#endif +#include + +#ifdef NO_DEFLATE /* for compatibility with old definition */ +# define NO_GZCOMPRESS +#endif + +#ifdef _MSC_VER +# include +# define vsnprintf _vsnprintf +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +/* gz* functions always use library allocation functions */ +#ifndef STDC + extern voidp malloc OF((uInt size)); + extern void free OF((voidpf ptr)); +#endif + +/* get errno and strerror definition */ +#if defined UNDER_CE +# include +# define zstrerror() gz_strwinerror((DWORD)GetLastError()) +#else +# ifdef STDC +# include +# define zstrerror() strerror(errno) +# else +# define zstrerror() "stdio error (consult errno)" +# endif +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); +#endif + +/* default i/o buffer size -- double this for output when reading */ +#define GZBUFSIZE 8192 + +/* gzip modes, also provide a little integrity check on the passed structure */ +#define GZ_NONE 0 +#define GZ_READ 7247 +#define GZ_WRITE 31153 +#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ + +/* values for gz_state how */ +#define LOOK 0 /* look for a gzip header */ +#define COPY 1 /* copy input directly */ +#define GZIP 2 /* decompress a gzip stream */ + +/* internal gzip file state data structure */ +typedef struct { + /* used for both reading and writing */ + int mode; /* see gzip modes above */ + int fd; /* file descriptor */ + char *path; /* path or fd for error messages */ + z_off64_t pos; /* current position in uncompressed data */ + unsigned size; /* buffer size, zero if not allocated yet */ + unsigned want; /* requested buffer size, default is GZBUFSIZE */ + unsigned char *in; /* input buffer */ + unsigned char *out; /* output buffer (double-sized when reading) */ + unsigned char *next; /* next output data to deliver or write */ + /* just for reading */ + unsigned have; /* amount of output data unused at next */ + int eof; /* true if end of input file reached */ + z_off64_t start; /* where the gzip data started, for rewinding */ + z_off64_t raw; /* where the raw data started, for seeking */ + int how; /* 0: get header, 1: copy, 2: decompress */ + int direct; /* true if last read direct, false if gzip */ + /* just for writing */ + int level; /* compression level */ + int strategy; /* compression strategy */ + /* seek request */ + z_off64_t skip; /* amount to skip (already rewound if backwards) */ + int seek; /* true if seek request pending */ + /* error information */ + int err; /* error code */ + char *msg; /* error message */ + /* zlib inflate or deflate stream */ + z_stream strm; /* stream structure in-place (not a pointer) */ +} gz_state; +typedef gz_state FAR *gz_statep; + +/* shared functions */ +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +#if defined UNDER_CE +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +#endif + +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t + value -- needed when comparing unsigned to z_off64_t, which is signed + (possible z_off64_t types off_t, off64_t, and long are all signed) */ +#ifdef INT_MAX +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) +#else +unsigned ZLIB_INTERNAL gz_intmax OF((void)); +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) +#endif diff --git a/libs/libwebsockets/win32port/zlib/gzio.c b/libs/libwebsockets/win32port/zlib/gzio.c new file mode 100644 index 0000000000..26f2da1e97 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/gzio.c @@ -0,0 +1,1005 @@ +/* gzio.c -- IO on .gz files + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. + */ + +/* @(#) $Id$ */ + +#include + +#include "zutil.h" + +#ifdef NO_DEFLATE /* for compatiblity with old definition */ +# define NO_GZCOMPRESS +#endif + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +#ifndef Z_BUFSIZE +# ifdef MAXSEG_64K +# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ +# else +# define Z_BUFSIZE 16384 +# endif +#endif +#ifndef Z_PRINTF_BUFSIZE +# define Z_PRINTF_BUFSIZE 4096 +#endif + +#ifdef __MVS__ +# pragma map (fdopen , "\174\174FDOPEN") + FILE *fdopen(int, const char *); +#endif + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern void free OF((voidpf ptr)); +#endif + +#define ALLOC(size) malloc(size) +#define TRYFREE(p) {if (p) free(p);} + +static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +typedef struct gz_stream { + z_stream stream; + int z_err; /* error code for last stream operation */ + int z_eof; /* set if end of input file */ + FILE *file; /* .gz file */ + Byte *inbuf; /* input buffer */ + Byte *outbuf; /* output buffer */ + uLong crc; /* crc32 of uncompressed data */ + char *msg; /* error message */ + char *path; /* path name for debugging only */ + int transparent; /* 1 if input file is not a .gz file */ + char mode; /* 'w' or 'r' */ + z_off_t start; /* start of compressed data in file (header skipped) */ + z_off_t in; /* bytes into deflate or inflate */ + z_off_t out; /* bytes out of deflate or inflate */ + int back; /* one character push-back */ + int last; /* true if push-back is last character */ +} gz_stream; + + +local gzFile gz_open OF((const char *path, const char *mode, int fd)); +local int do_flush OF((gzFile file, int flush)); +local int get_byte OF((gz_stream *s)); +local void check_header OF((gz_stream *s)); +local int destroy OF((gz_stream *s)); +local void putLong OF((FILE *file, uLong x)); +local uLong getLong OF((gz_stream *s)); + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb"). The file is given either by file descriptor + or path name (if fd == -1). + gz_open returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). +*/ +local gzFile gz_open (path, mode, fd) + const char *path; + const char *mode; + int fd; +{ + int err; + int level = Z_DEFAULT_COMPRESSION; /* compression level */ + int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ + char *p = (char*)mode; + gz_stream *s; + char fmode[80]; /* copy of mode, without the compression level */ + char *m = fmode; + + if (!path || !mode) return Z_NULL; + + s = (gz_stream *)ALLOC(sizeof(gz_stream)); + if (!s) return Z_NULL; + + s->stream.zalloc = (alloc_func)0; + s->stream.zfree = (free_func)0; + s->stream.opaque = (voidpf)0; + s->stream.next_in = s->inbuf = Z_NULL; + s->stream.next_out = s->outbuf = Z_NULL; + s->stream.avail_in = s->stream.avail_out = 0; + s->file = NULL; + s->z_err = Z_OK; + s->z_eof = 0; + s->in = 0; + s->out = 0; + s->back = EOF; + s->crc = crc32(0L, Z_NULL, 0); + s->msg = NULL; + s->transparent = 0; + + s->path = (char*)ALLOC(strlen(path)+1); + if (s->path == NULL) { + return destroy(s), (gzFile)Z_NULL; + } + strcpy(s->path, path); /* do this early for debugging */ + + s->mode = '\0'; + do { + if (*p == 'r') s->mode = 'r'; + if (*p == 'w' || *p == 'a') s->mode = 'w'; + if (*p >= '0' && *p <= '9') { + level = *p - '0'; + } else if (*p == 'f') { + strategy = Z_FILTERED; + } else if (*p == 'h') { + strategy = Z_HUFFMAN_ONLY; + } else if (*p == 'R') { + strategy = Z_RLE; + } else { + *m++ = *p; /* copy the mode */ + } + } while (*p++ && m != fmode + sizeof(fmode)); + if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; + + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + err = Z_STREAM_ERROR; +#else + err = deflateInit2(&(s->stream), level, + Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); + /* windowBits is passed < 0 to suppress zlib header */ + + s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); +#endif + if (err != Z_OK || s->outbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } else { + s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); + + err = inflateInit2(&(s->stream), -MAX_WBITS); + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are + * present after the compressed stream. + */ + if (err != Z_OK || s->inbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } + s->stream.avail_out = Z_BUFSIZE; + + errno = 0; + s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); + + if (s->file == NULL) { + return destroy(s), (gzFile)Z_NULL; + } + if (s->mode == 'w') { + /* Write a very simple .gz header: + */ + fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], + Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); + s->start = 10L; + /* We use 10L instead of ftell(s->file) to because ftell causes an + * fflush on some systems. This version of the library doesn't use + * start anyway in write mode, so this initialization is not + * necessary. + */ + } else { + check_header(s); /* skip the .gz header */ + s->start = ftell(s->file) - s->stream.avail_in; + } + + return (gzFile)s; +} + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. +*/ +gzFile ZEXPORT gzopen (path, mode) + const char *path; + const char *mode; +{ + return gz_open (path, mode, -1); +} + +/* =========================================================================== + Associate a gzFile with the file descriptor fd. fd is not dup'ed here + to mimic the behavio(u)r of fdopen. +*/ +gzFile ZEXPORT gzdopen (fd, mode) + int fd; + const char *mode; +{ + char name[20]; + + if (fd < 0) return (gzFile)Z_NULL; + sprintf(name, "", fd); /* for debugging */ + + return gz_open (name, mode, fd); +} + +/* =========================================================================== + * Update the compression level and strategy + */ +int ZEXPORT gzsetparams (file, level, strategy) + gzFile file; + int level; + int strategy; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + /* Make room to allow flushing */ + if (s->stream.avail_out == 0) { + + s->stream.next_out = s->outbuf; + if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + } + s->stream.avail_out = Z_BUFSIZE; + } + + return deflateParams (&(s->stream), level, strategy); +} + +/* =========================================================================== + Read a byte from a gz_stream; update next_in and avail_in. Return EOF + for end of file. + IN assertion: the stream s has been sucessfully opened for reading. +*/ +local int get_byte(s) + gz_stream *s; +{ + if (s->z_eof) return EOF; + if (s->stream.avail_in == 0) { + errno = 0; + s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (ferror(s->file)) s->z_err = Z_ERRNO; + return EOF; + } + s->stream.next_in = s->inbuf; + } + s->stream.avail_in--; + return *(s->stream.next_in)++; +} + +/* =========================================================================== + Check the gzip header of a gz_stream opened for reading. Set the stream + mode to transparent if the gzip magic header is not present; set s->err + to Z_DATA_ERROR if the magic header is present but the rest of the header + is incorrect. + IN assertion: the stream s has already been created sucessfully; + s->stream.avail_in is zero for the first time, but may be non-zero + for concatenated .gz files. +*/ +local void check_header(s) + gz_stream *s; +{ + int method; /* method byte */ + int flags; /* flags byte */ + uInt len; + int c; + + /* Assure two bytes in the buffer so we can peek ahead -- handle case + where first byte of header is at the end of the buffer after the last + gzip segment */ + len = s->stream.avail_in; + if (len < 2) { + if (len) s->inbuf[0] = s->stream.next_in[0]; + errno = 0; + len = fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); + if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; + s->stream.avail_in += len; + s->stream.next_in = s->inbuf; + if (s->stream.avail_in < 2) { + s->transparent = s->stream.avail_in; + return; + } + } + + /* Peek ahead to check the gzip magic header */ + if (s->stream.next_in[0] != gz_magic[0] || + s->stream.next_in[1] != gz_magic[1]) { + s->transparent = 1; + return; + } + s->stream.avail_in -= 2; + s->stream.next_in += 2; + + /* Check the rest of the gzip header */ + method = get_byte(s); + flags = get_byte(s); + if (method != Z_DEFLATED || (flags & RESERVED) != 0) { + s->z_err = Z_DATA_ERROR; + return; + } + + /* Discard time, xflags and OS code: */ + for (len = 0; len < 6; len++) (void)get_byte(s); + + if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ + len = (uInt)get_byte(s); + len += ((uInt)get_byte(s))<<8; + /* len is garbage if EOF but the loop below will quit anyway */ + while (len-- != 0 && get_byte(s) != EOF) ; + } + if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ + for (len = 0; len < 2; len++) (void)get_byte(s); + } + s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; +} + + /* =========================================================================== + * Cleanup then free the given gz_stream. Return a zlib error code. + Try freeing in the reverse order of allocations. + */ +local int destroy (s) + gz_stream *s; +{ + int err = Z_OK; + + if (!s) return Z_STREAM_ERROR; + + TRYFREE(s->msg); + + if (s->stream.state != NULL) { + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + err = Z_STREAM_ERROR; +#else + err = deflateEnd(&(s->stream)); +#endif + } else if (s->mode == 'r') { + err = inflateEnd(&(s->stream)); + } + } + if (s->file != NULL && fclose(s->file)) { +#ifdef ESPIPE + if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ +#endif + err = Z_ERRNO; + } + if (s->z_err < 0) err = s->z_err; + + TRYFREE(s->inbuf); + TRYFREE(s->outbuf); + TRYFREE(s->path); + TRYFREE(s); + return err; +} + +/* =========================================================================== + Reads the given number of uncompressed bytes from the compressed file. + gzread returns the number of bytes actually read (0 for end of file). +*/ +int ZEXPORT gzread (file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + gz_stream *s = (gz_stream*)file; + Bytef *start = (Bytef*)buf; /* starting point for crc computation */ + Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ + + if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; + + if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; + if (s->z_err == Z_STREAM_END) return 0; /* EOF */ + + next_out = (Byte*)buf; + s->stream.next_out = (Bytef*)buf; + s->stream.avail_out = len; + + if (s->stream.avail_out && s->back != EOF) { + *next_out++ = s->back; + s->stream.next_out++; + s->stream.avail_out--; + s->back = EOF; + s->out++; + if (s->last) { + s->z_err = Z_STREAM_END; + return 1; + } + } + + while (s->stream.avail_out != 0) { + + if (s->transparent) { + /* Copy first the lookahead bytes: */ + uInt n = s->stream.avail_in; + if (n > s->stream.avail_out) n = s->stream.avail_out; + if (n > 0) { + zmemcpy(s->stream.next_out, s->stream.next_in, n); + next_out += n; + s->stream.next_out = next_out; + s->stream.next_in += n; + s->stream.avail_out -= n; + s->stream.avail_in -= n; + } + if (s->stream.avail_out > 0) { + s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, + s->file); + } + len -= s->stream.avail_out; + s->in += len; + s->out += len; + if (len == 0) s->z_eof = 1; + return (int)len; + } + if (s->stream.avail_in == 0 && !s->z_eof) { + + errno = 0; + s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (ferror(s->file)) { + s->z_err = Z_ERRNO; + break; + } + } + s->stream.next_in = s->inbuf; + } + s->in += s->stream.avail_in; + s->out += s->stream.avail_out; + s->z_err = inflate(&(s->stream), Z_NO_FLUSH); + s->in -= s->stream.avail_in; + s->out -= s->stream.avail_out; + + if (s->z_err == Z_STREAM_END) { + /* Check CRC and original size */ + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + start = s->stream.next_out; + + if (getLong(s) != s->crc) { + s->z_err = Z_DATA_ERROR; + } else { + (void)getLong(s); + /* The uncompressed length returned by above getlong() may be + * different from s->out in case of concatenated .gz files. + * Check for such files: + */ + check_header(s); + if (s->z_err == Z_OK) { + inflateReset(&(s->stream)); + s->crc = crc32(0L, Z_NULL, 0); + } + } + } + if (s->z_err != Z_OK || s->z_eof) break; + } + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + + return (int)(len - s->stream.avail_out); +} + + +/* =========================================================================== + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ +int ZEXPORT gzgetc(file) + gzFile file; +{ + unsigned char c; + + return gzread(file, &c, 1) == 1 ? c : -1; +} + + +/* =========================================================================== + Push one byte back onto the stream. +*/ +int ZEXPORT gzungetc(c, file) + int c; + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; + s->back = c; + s->out--; + s->last = (s->z_err == Z_STREAM_END); + if (s->last) s->z_err = Z_OK; + s->z_eof = 0; + return c; +} + + +/* =========================================================================== + Reads bytes from the compressed file until len-1 characters are + read, or a newline character is read and transferred to buf, or an + end-of-file condition is encountered. The string is then terminated + with a null character. + gzgets returns buf, or Z_NULL in case of error. + + The current implementation is not optimized at all. +*/ +char * ZEXPORT gzgets(file, buf, len) + gzFile file; + char *buf; + int len; +{ + char *b = buf; + if (buf == Z_NULL || len <= 0) return Z_NULL; + + while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; + *buf = '\0'; + return b == buf && len > 0 ? Z_NULL : b; +} + + +#ifndef NO_GZCOMPRESS +/* =========================================================================== + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of bytes actually written (0 in case of error). +*/ +int ZEXPORT gzwrite (file, buf, len) + gzFile file; + voidpc buf; + unsigned len; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.next_in = (Bytef*)buf; + s->stream.avail_in = len; + + while (s->stream.avail_in != 0) { + + if (s->stream.avail_out == 0) { + + s->stream.next_out = s->outbuf; + if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + break; + } + s->stream.avail_out = Z_BUFSIZE; + } + s->in += s->stream.avail_in; + s->out += s->stream.avail_out; + s->z_err = deflate(&(s->stream), Z_NO_FLUSH); + s->in -= s->stream.avail_in; + s->out -= s->stream.avail_out; + if (s->z_err != Z_OK) break; + } + s->crc = crc32(s->crc, (const Bytef *)buf, len); + + return (int)(len - s->stream.avail_in); +} + + +/* =========================================================================== + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). +*/ +#ifdef STDC +#include + +int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) +{ + char buf[Z_PRINTF_BUFSIZE]; + va_list va; + int len; + + buf[sizeof(buf) - 1] = 0; + va_start(va, format); +#ifdef NO_vsnprintf +# ifdef HAS_vsprintf_void + (void)vsprintf(buf, format, va); + va_end(va); + for (len = 0; len < sizeof(buf); len++) + if (buf[len] == 0) break; +# else + len = vsprintf(buf, format, va); + va_end(va); +# endif +#else +# ifdef HAS_vsnprintf_void + (void)vsnprintf(buf, sizeof(buf), format, va); + va_end(va); + len = strlen(buf); +# else + len = vsnprintf(buf, sizeof(buf), format, va); + va_end(va); +# endif +#endif + if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) + return 0; + return gzwrite(file, buf, (unsigned)len); +} +#else /* not ANSI C */ + +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + gzFile file; + const char *format; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ + char buf[Z_PRINTF_BUFSIZE]; + int len; + + buf[sizeof(buf) - 1] = 0; +#ifdef NO_snprintf +# ifdef HAS_sprintf_void + sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + for (len = 0; len < sizeof(buf); len++) + if (buf[len] == 0) break; +# else + len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#else +# ifdef HAS_snprintf_void + snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(buf); +# else + len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#endif + if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) + return 0; + return gzwrite(file, buf, len); +} +#endif + +/* =========================================================================== + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ +int ZEXPORT gzputc(file, c) + gzFile file; + int c; +{ + unsigned char cc = (unsigned char) c; /* required for big endian systems */ + + return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; +} + + +/* =========================================================================== + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ +int ZEXPORT gzputs(file, s) + gzFile file; + const char *s; +{ + return gzwrite(file, (char*)s, (unsigned)strlen(s)); +} + + +/* =========================================================================== + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. +*/ +local int do_flush (file, flush) + gzFile file; + int flush; +{ + uInt len; + int done = 0; + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.avail_in = 0; /* should be zero already anyway */ + + for (;;) { + len = Z_BUFSIZE - s->stream.avail_out; + + if (len != 0) { + if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { + s->z_err = Z_ERRNO; + return Z_ERRNO; + } + s->stream.next_out = s->outbuf; + s->stream.avail_out = Z_BUFSIZE; + } + if (done) break; + s->out += s->stream.avail_out; + s->z_err = deflate(&(s->stream), flush); + s->out -= s->stream.avail_out; + + /* Ignore the second of two consecutive flushes: */ + if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; + + /* deflate has finished flushing only when it hasn't used up + * all the available space in the output buffer: + */ + done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); + + if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; + } + return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; +} + +int ZEXPORT gzflush (file, flush) + gzFile file; + int flush; +{ + gz_stream *s = (gz_stream*)file; + int err = do_flush (file, flush); + + if (err) return err; + fflush(s->file); + return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; +} +#endif /* NO_GZCOMPRESS */ + +/* =========================================================================== + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error. + SEEK_END is not implemented, returns error. + In this version of the library, gzseek can be extremely slow. +*/ +z_off_t ZEXPORT gzseek (file, offset, whence) + gzFile file; + z_off_t offset; + int whence; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || whence == SEEK_END || + s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { + return -1L; + } + + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + return -1L; +#else + if (whence == SEEK_SET) { + offset -= s->in; + } + if (offset < 0) return -1L; + + /* At this point, offset is the number of zero bytes to write. */ + if (s->inbuf == Z_NULL) { + s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ + if (s->inbuf == Z_NULL) return -1L; + zmemzero(s->inbuf, Z_BUFSIZE); + } + while (offset > 0) { + uInt size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (uInt)offset; + + size = gzwrite(file, s->inbuf, size); + if (size == 0) return -1L; + + offset -= size; + } + return s->in; +#endif + } + /* Rest of function is for reading only */ + + /* compute absolute position */ + if (whence == SEEK_CUR) { + offset += s->out; + } + if (offset < 0) return -1L; + + if (s->transparent) { + /* map to fseek */ + s->back = EOF; + s->stream.avail_in = 0; + s->stream.next_in = s->inbuf; + if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; + + s->in = s->out = offset; + return offset; + } + + /* For a negative seek, rewind and use positive seek */ + if (offset >= s->out) { + offset -= s->out; + } else if (gzrewind(file) < 0) { + return -1L; + } + /* offset is now the number of bytes to skip. */ + + if (offset != 0 && s->outbuf == Z_NULL) { + s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); + if (s->outbuf == Z_NULL) return -1L; + } + if (offset && s->back != EOF) { + s->back = EOF; + s->out++; + offset--; + if (s->last) s->z_err = Z_STREAM_END; + } + while (offset > 0) { + int size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (int)offset; + + size = gzread(file, s->outbuf, (uInt)size); + if (size <= 0) return -1L; + offset -= size; + } + return s->out; +} + +/* =========================================================================== + Rewinds input file. +*/ +int ZEXPORT gzrewind (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'r') return -1; + + s->z_err = Z_OK; + s->z_eof = 0; + s->back = EOF; + s->stream.avail_in = 0; + s->stream.next_in = s->inbuf; + s->crc = crc32(0L, Z_NULL, 0); + if (!s->transparent) (void)inflateReset(&s->stream); + s->in = 0; + s->out = 0; + return fseek(s->file, s->start, SEEK_SET); +} + +/* =========================================================================== + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. +*/ +z_off_t ZEXPORT gztell (file) + gzFile file; +{ + return gzseek(file, 0L, SEEK_CUR); +} + +/* =========================================================================== + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ +int ZEXPORT gzeof (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + /* With concatenated compressed files that can have embedded + * crc trailers, z_eof is no longer the only/best indicator of EOF + * on a gz_stream. Handle end-of-stream error explicitly here. + */ + if (s == NULL || s->mode != 'r') return 0; + if (s->z_eof) return 1; + return s->z_err == Z_STREAM_END; +} + +/* =========================================================================== + Outputs a long in LSB order to the given file +*/ +local void putLong (file, x) + FILE *file; + uLong x; +{ + int n; + for (n = 0; n < 4; n++) { + fputc((int)(x & 0xff), file); + x >>= 8; + } +} + +/* =========================================================================== + Reads a long in LSB order from the given gz_stream. Sets z_err in case + of error. +*/ +local uLong getLong (s) + gz_stream *s; +{ + uLong x = (uLong)get_byte(s); + int c; + + x += ((uLong)get_byte(s))<<8; + x += ((uLong)get_byte(s))<<16; + c = get_byte(s); + if (c == EOF) s->z_err = Z_DATA_ERROR; + x += ((uLong)c)<<24; + return x; +} + +/* =========================================================================== + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. +*/ +int ZEXPORT gzclose (file) + gzFile file; +{ + int err; + gz_stream *s = (gz_stream*)file; + + if (s == NULL) return Z_STREAM_ERROR; + + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + return Z_STREAM_ERROR; +#else + err = do_flush (file, Z_FINISH); + if (err != Z_OK) return destroy((gz_stream*)file); + + putLong (s->file, s->crc); + putLong (s->file, (uLong)(s->in & 0xffffffff)); +#endif + } + return destroy((gz_stream*)file); +} + +/* =========================================================================== + Returns the error message for the last error which occured on the + given compressed file. errnum is set to zlib error number. If an + error occured in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ +const char * ZEXPORT gzerror (file, errnum) + gzFile file; + int *errnum; +{ + char *m; + gz_stream *s = (gz_stream*)file; + + if (s == NULL) { + *errnum = Z_STREAM_ERROR; + return (const char*)ERR_MSG(Z_STREAM_ERROR); + } + *errnum = s->z_err; + if (*errnum == Z_OK) return (const char*)""; + + m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); + + if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); + + TRYFREE(s->msg); + s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); + if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); + strcpy(s->msg, s->path); + strcat(s->msg, ": "); + strcat(s->msg, m); + return (const char*)s->msg; +} + +/* =========================================================================== + Clear the error and end-of-file flags, and do the same for the real file. +*/ +void ZEXPORT gzclearerr (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL) return; + if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; + s->z_eof = 0; + clearerr(s->file); +} diff --git a/libs/libwebsockets/win32port/zlib/gzlib.c b/libs/libwebsockets/win32port/zlib/gzlib.c new file mode 100755 index 0000000000..65efced42a --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/gzlib.c @@ -0,0 +1,537 @@ +/* gzlib.c -- zlib functions common to reading and writing gzip files + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define LSEEK lseek64 +#else +# define LSEEK lseek +#endif + +/* Local functions */ +local void gz_reset OF((gz_statep)); +local gzFile gz_open OF((const char *, int, const char *)); + +#if defined UNDER_CE + +/* Map the Windows error number in ERROR to a locale-dependent error message + string and return a pointer to it. Typically, the values for ERROR come + from GetLastError. + + The string pointed to shall not be modified by the application, but may be + overwritten by a subsequent call to gz_strwinerror + + The gz_strwinerror function does not change the current setting of + GetLastError. */ +char ZLIB_INTERNAL *gz_strwinerror (error) + DWORD error; +{ + static char buf[1024]; + + wchar_t *msgbuf; + DWORD lasterr = GetLastError(); + DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, /* Default language */ + (LPVOID)&msgbuf, + 0, + NULL); + if (chars != 0) { + /* If there is an \r\n appended, zap it. */ + if (chars >= 2 + && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { + chars -= 2; + msgbuf[chars] = 0; + } + + if (chars > sizeof (buf) - 1) { + chars = sizeof (buf) - 1; + msgbuf[chars] = 0; + } + + wcstombs(buf, msgbuf, chars + 1); + LocalFree(msgbuf); + } + else { + sprintf(buf, "unknown win32 error (%ld)", error); + } + + SetLastError(lasterr); + return buf; +} + +#endif /* UNDER_CE */ + +/* Reset gzip file state */ +local void gz_reset(state) + gz_statep state; +{ + if (state->mode == GZ_READ) { /* for reading ... */ + state->have = 0; /* no output data available */ + state->eof = 0; /* not at end of file */ + state->how = LOOK; /* look for gzip header */ + state->direct = 1; /* default for empty file */ + } + state->seek = 0; /* no seek request pending */ + gz_error(state, Z_OK, NULL); /* clear error */ + state->pos = 0; /* no uncompressed data yet */ + state->strm.avail_in = 0; /* no input data yet */ +} + +/* Open a gzip file either by name or file descriptor. */ +local gzFile gz_open(path, fd, mode) + const char *path; + int fd; + const char *mode; +{ + gz_statep state; + + /* allocate gzFile structure to return */ + state = malloc(sizeof(gz_state)); + if (state == NULL) + return NULL; + state->size = 0; /* no buffers allocated yet */ + state->want = GZBUFSIZE; /* requested buffer size */ + state->msg = NULL; /* no error message yet */ + + /* interpret mode */ + state->mode = GZ_NONE; + state->level = Z_DEFAULT_COMPRESSION; + state->strategy = Z_DEFAULT_STRATEGY; + while (*mode) { + if (*mode >= '0' && *mode <= '9') + state->level = *mode - '0'; + else + switch (*mode) { + case 'r': + state->mode = GZ_READ; + break; +#ifndef NO_GZCOMPRESS + case 'w': + state->mode = GZ_WRITE; + break; + case 'a': + state->mode = GZ_APPEND; + break; +#endif + case '+': /* can't read and write at the same time */ + free(state); + return NULL; + case 'b': /* ignore -- will request binary anyway */ + break; + case 'f': + state->strategy = Z_FILTERED; + break; + case 'h': + state->strategy = Z_HUFFMAN_ONLY; + break; + case 'R': + state->strategy = Z_RLE; + break; + case 'F': + state->strategy = Z_FIXED; + default: /* could consider as an error, but just ignore */ + ; + } + mode++; + } + + /* must provide an "r", "w", or "a" */ + if (state->mode == GZ_NONE) { + free(state); + return NULL; + } + + /* save the path name for error messages */ + state->path = malloc(strlen(path) + 1); + if (state->path == NULL) { + free(state); + return NULL; + } + strcpy(state->path, path); + + /* open the file with the appropriate mode (or just use fd) */ + state->fd = fd != -1 ? fd : + open(path, +#ifdef O_LARGEFILE + O_LARGEFILE | +#endif +#ifdef O_BINARY + O_BINARY | +#endif + (state->mode == GZ_READ ? + O_RDONLY : + (O_WRONLY | O_CREAT | ( + state->mode == GZ_WRITE ? + O_TRUNC : + O_APPEND))), + 0666); + if (state->fd == -1) { + free(state->path); + free(state); + return NULL; + } + if (state->mode == GZ_APPEND) + state->mode = GZ_WRITE; /* simplify later checks */ + + /* save the current position for rewinding (only if reading) */ + if (state->mode == GZ_READ) { + state->start = LSEEK(state->fd, 0, SEEK_CUR); + if (state->start == -1) state->start = 0; + } + + /* initialize stream */ + gz_reset(state); + + /* return stream */ + return (gzFile)state; +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen64(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzdopen(fd, mode) + int fd; + const char *mode; +{ + char *path; /* identifier for error messages */ + gzFile gz; + + if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) + return NULL; + sprintf(path, "", fd); /* for debugging */ + gz = gz_open(path, fd, mode); + free(path); + return gz; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzbuffer(file, size) + gzFile file; + unsigned size; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* make sure we haven't already allocated memory */ + if (state->size != 0) + return -1; + + /* check and set requested size */ + if (size == 0) + return -1; + state->want = size; + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzrewind(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* back up and start over */ + if (LSEEK(state->fd, state->start, SEEK_SET) == -1) + return -1; + gz_reset(state); + return 0; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzseek64(file, offset, whence) + gzFile file; + z_off64_t offset; + int whence; +{ + unsigned n; + z_off64_t ret; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* check that there's no error */ + if (state->err != Z_OK) + return -1; + + /* can only seek from start or relative to current position */ + if (whence != SEEK_SET && whence != SEEK_CUR) + return -1; + + /* normalize offset to a SEEK_CUR specification */ + if (whence == SEEK_SET) + offset -= state->pos; + else if (state->seek) + offset += state->skip; + state->seek = 0; + + /* if within raw area while reading, just go there */ + if (state->mode == GZ_READ && state->how == COPY && + state->pos + offset >= state->raw) { + ret = LSEEK(state->fd, offset - state->have, SEEK_CUR); + if (ret == -1) + return -1; + state->have = 0; + state->eof = 0; + state->seek = 0; + gz_error(state, Z_OK, NULL); + state->strm.avail_in = 0; + state->pos += offset; + return state->pos; + } + + /* calculate skip amount, rewinding if needed for back seek when reading */ + if (offset < 0) { + if (state->mode != GZ_READ) /* writing -- can't go backwards */ + return -1; + offset += state->pos; + if (offset < 0) /* before start of file! */ + return -1; + if (gzrewind(file) == -1) /* rewind, then skip to offset */ + return -1; + } + + /* if reading, skip what's in output buffer (one less gzgetc() check) */ + if (state->mode == GZ_READ) { + n = GT_OFF(state->have) || (z_off64_t)state->have > offset ? + (unsigned)offset : state->have; + state->have -= n; + state->next += n; + state->pos += n; + offset -= n; + } + + /* request skip (if not zero) */ + if (offset) { + state->seek = 1; + state->skip = offset; + } + return state->pos + offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzseek(file, offset, whence) + gzFile file; + z_off_t offset; + int whence; +{ + z_off64_t ret; + + ret = gzseek64(file, (z_off64_t)offset, whence); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gztell64(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* return position */ + return state->pos + (state->seek ? state->skip : 0); +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gztell(file) + gzFile file; +{ + z_off64_t ret; + + ret = gztell64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzoffset64(file) + gzFile file; +{ + z_off64_t offset; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* compute and return effective offset in file */ + offset = LSEEK(state->fd, 0, SEEK_CUR); + if (offset == -1) + return -1; + if (state->mode == GZ_READ) /* reading */ + offset -= state->strm.avail_in; /* don't count buffered input */ + return offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzoffset(file) + gzFile file; +{ + z_off64_t ret; + + ret = gzoffset64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzeof(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return 0; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return 0; + + /* return end-of-file state */ + return state->mode == GZ_READ ? + (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0; +} + +/* -- see zlib.h -- */ +const char * ZEXPORT gzerror(file, errnum) + gzFile file; + int *errnum; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return NULL; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return NULL; + + /* return error information */ + if (errnum != NULL) + *errnum = state->err; + return state->msg == NULL ? "" : state->msg; +} + +/* -- see zlib.h -- */ +void ZEXPORT gzclearerr(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return; + + /* clear error and end-of-file */ + if (state->mode == GZ_READ) + state->eof = 0; + gz_error(state, Z_OK, NULL); +} + +/* Create an error message in allocated memory and set state->err and + state->msg accordingly. Free any previous error message already there. Do + not try to free or allocate space if the error is Z_MEM_ERROR (out of + memory). Simply save the error message as a static string. If there is an + allocation failure constructing the error message, then convert the error to + out of memory. */ +void ZLIB_INTERNAL gz_error(state, err, msg) + gz_statep state; + int err; + const char *msg; +{ + /* free previously allocated message and clear */ + if (state->msg != NULL) { + if (state->err != Z_MEM_ERROR) + free(state->msg); + state->msg = NULL; + } + + /* set error code, and if no message, then done */ + state->err = err; + if (msg == NULL) + return; + + /* for an out of memory error, save as static string */ + if (err == Z_MEM_ERROR) { + state->msg = (char *)msg; + return; + } + + /* construct error message with path */ + if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { + state->err = Z_MEM_ERROR; + state->msg = (char *)"out of memory"; + return; + } + strcpy(state->msg, state->path); + strcat(state->msg, ": "); + strcat(state->msg, msg); + return; +} + +#ifndef INT_MAX +/* portably return maximum value for an int (when limits.h presumed not + available) -- we need to do this to cover cases where 2's complement not + used, since C standard permits 1's complement and sign-bit representations, + otherwise we could just use ((unsigned)-1) >> 1 */ +unsigned ZLIB_INTERNAL gz_intmax() +{ + unsigned p, q; + + p = 1; + do { + q = p; + p <<= 1; + p++; + } while (p > q); + return q >> 1; +} +#endif diff --git a/libs/libwebsockets/win32port/zlib/gzread.c b/libs/libwebsockets/win32port/zlib/gzread.c new file mode 100755 index 0000000000..0f8649b32f --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/gzread.c @@ -0,0 +1,653 @@ +/* gzread.c -- zlib functions for reading gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); +local int gz_avail OF((gz_statep)); +local int gz_next4 OF((gz_statep, unsigned long *)); +local int gz_head OF((gz_statep)); +local int gz_decomp OF((gz_statep)); +local int gz_make OF((gz_statep)); +local int gz_skip OF((gz_statep, z_off64_t)); + +/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from + state->fd, and update state->eof, state->err, and state->msg as appropriate. + This function needs to loop on read(), since read() is not guaranteed to + read the number of bytes requested, depending on the type of descriptor. */ +local int gz_load(state, buf, len, have) + gz_statep state; + unsigned char *buf; + unsigned len; + unsigned *have; +{ + int ret; + + *have = 0; + do { + ret = read(state->fd, buf + *have, len - *have); + if (ret <= 0) + break; + *have += ret; + } while (*have < len); + if (ret < 0) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (ret == 0) + state->eof = 1; + return 0; +} + +/* Load up input buffer and set eof flag if last data loaded -- return -1 on + error, 0 otherwise. Note that the eof flag is set when the end of the input + file is reached, even though there may be unused data in the buffer. Once + that data has been used, no more attempts will be made to read the file. + gz_avail() assumes that strm->avail_in == 0. */ +local int gz_avail(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->err != Z_OK) + return -1; + if (state->eof == 0) { + if (gz_load(state, state->in, state->size, + (unsigned *)&(strm->avail_in)) == -1) + return -1; + strm->next_in = state->in; + } + return 0; +} + +/* Get next byte from input, or -1 if end or error. */ +#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \ + (strm->avail_in == 0 ? -1 : \ + (strm->avail_in--, *(strm->next_in)++))) + +/* Get a four-byte little-endian integer and return 0 on success and the value + in *ret. Otherwise -1 is returned and *ret is not modified. */ +local int gz_next4(state, ret) + gz_statep state; + unsigned long *ret; +{ + int ch; + unsigned long val; + z_streamp strm = &(state->strm); + + val = NEXT(); + val += (unsigned)NEXT() << 8; + val += (unsigned long)NEXT() << 16; + ch = NEXT(); + if (ch == -1) + return -1; + val += (unsigned long)ch << 24; + *ret = val; + return 0; +} + +/* Look for gzip header, set up for inflate or copy. state->have must be zero. + If this is the first time in, allocate required memory. state->how will be + left unchanged if there is no more input data available, will be set to COPY + if there is no gzip header and direct copying will be performed, or it will + be set to GZIP for decompression, and the gzip header will be skipped so + that the next available input data is the raw deflate stream. If direct + copying, then leftover input data from the input buffer will be copied to + the output buffer. In that case, all further file reads will be directly to + either the output buffer or a user buffer. If decompressing, the inflate + state and the check value will be initialized. gz_head() will return 0 on + success or -1 on failure. Failures may include read errors or gzip header + errors. */ +local int gz_head(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + int flags; + unsigned len; + + /* allocate read buffers and inflate memory */ + if (state->size == 0) { + /* allocate buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want << 1); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + state->size = state->want; + + /* allocate inflate memory */ + state->strm.zalloc = Z_NULL; + state->strm.zfree = Z_NULL; + state->strm.opaque = Z_NULL; + state->strm.avail_in = 0; + state->strm.next_in = Z_NULL; + if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */ + free(state->out); + free(state->in); + state->size = 0; + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + } + + /* get some data in the input buffer */ + if (strm->avail_in == 0) { + if (gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) + return 0; + } + + /* look for the gzip magic header bytes 31 and 139 */ + if (strm->next_in[0] == 31) { + strm->avail_in--; + strm->next_in++; + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in && strm->next_in[0] == 139) { + /* we have a gzip header, woo hoo! */ + strm->avail_in--; + strm->next_in++; + + /* skip rest of header */ + if (NEXT() != 8) { /* compression method */ + gz_error(state, Z_DATA_ERROR, "unknown compression method"); + return -1; + } + flags = NEXT(); + if (flags & 0xe0) { /* reserved flag bits */ + gz_error(state, Z_DATA_ERROR, "unknown header flags set"); + return -1; + } + NEXT(); /* modification time */ + NEXT(); + NEXT(); + NEXT(); + NEXT(); /* extra flags */ + NEXT(); /* operating system */ + if (flags & 4) { /* extra field */ + len = (unsigned)NEXT(); + len += (unsigned)NEXT() << 8; + while (len--) + if (NEXT() < 0) + break; + } + if (flags & 8) /* file name */ + while (NEXT() > 0) + ; + if (flags & 16) /* comment */ + while (NEXT() > 0) + ; + if (flags & 2) { /* header crc */ + NEXT(); + NEXT(); + } + /* an unexpected end of file is not checked for here -- it will be + noticed on the first request for uncompressed data */ + + /* set up for decompression */ + inflateReset(strm); + strm->adler = crc32(0L, Z_NULL, 0); + state->how = GZIP; + state->direct = 0; + return 0; + } + else { + /* not a gzip file -- save first byte (31) and fall to raw i/o */ + state->out[0] = 31; + state->have = 1; + } + } + + /* doing raw i/o, save start of raw data for seeking, copy any leftover + input to output -- this assumes that the output buffer is larger than + the input buffer, which also assures space for gzungetc() */ + state->raw = state->pos; + state->next = state->out; + if (strm->avail_in) { + memcpy(state->next + state->have, strm->next_in, strm->avail_in); + state->have += strm->avail_in; + strm->avail_in = 0; + } + state->how = COPY; + state->direct = 1; + return 0; +} + +/* Decompress from input to the provided next_out and avail_out in the state. + If the end of the compressed data is reached, then verify the gzip trailer + check value and length (modulo 2^32). state->have and state->next are set + to point to the just decompressed data, and the crc is updated. If the + trailer is verified, state->how is reset to LOOK to look for the next gzip + stream or raw data, once state->have is depleted. Returns 0 on success, -1 + on failure. Failures may include invalid compressed data or a failed gzip + trailer verification. */ +local int gz_decomp(state) + gz_statep state; +{ + int ret; + unsigned had; + unsigned long crc, len; + z_streamp strm = &(state->strm); + + /* fill output buffer up to end of deflate stream */ + had = strm->avail_out; + do { + /* get more input for inflate() */ + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + + /* decompress and handle errors */ + ret = inflate(strm, Z_NO_FLUSH); + if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { + gz_error(state, Z_STREAM_ERROR, + "internal error: inflate stream corrupt"); + return -1; + } + if (ret == Z_MEM_ERROR) { + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ + gz_error(state, Z_DATA_ERROR, + strm->msg == NULL ? "compressed data error" : strm->msg); + return -1; + } + } while (strm->avail_out && ret != Z_STREAM_END); + + /* update available output and crc check value */ + state->have = had - strm->avail_out; + state->next = strm->next_out - state->have; + strm->adler = crc32(strm->adler, state->next, state->have); + + /* check gzip trailer if at end of deflate stream */ + if (ret == Z_STREAM_END) { + if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + if (crc != strm->adler) { + gz_error(state, Z_DATA_ERROR, "incorrect data check"); + return -1; + } + if (len != (strm->total_out & 0xffffffffL)) { + gz_error(state, Z_DATA_ERROR, "incorrect length check"); + return -1; + } + state->how = LOOK; /* ready for next stream, once have is 0 (leave + state->direct unchanged to remember how) */ + } + + /* good decompression */ + return 0; +} + +/* Make data and put in the output buffer. Assumes that state->have == 0. + Data is either copied from the input file or decompressed from the input + file depending on state->how. If state->how is LOOK, then a gzip header is + looked for (and skipped if found) to determine wither to copy or decompress. + Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY + or GZIP unless the end of the input file has been reached and all data has + been processed. */ +local int gz_make(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->how == LOOK) { /* look for gzip header */ + if (gz_head(state) == -1) + return -1; + if (state->have) /* got some data from gz_head() */ + return 0; + } + if (state->how == COPY) { /* straight copy */ + if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1) + return -1; + state->next = state->out; + } + else if (state->how == GZIP) { /* decompress */ + strm->avail_out = state->size << 1; + strm->next_out = state->out; + if (gz_decomp(state) == -1) + return -1; + } + return 0; +} + +/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ +local int gz_skip(state, len) + gz_statep state; + z_off64_t len; +{ + unsigned n; + + /* skip over len bytes or reach end-of-file, whichever comes first */ + while (len) + /* skip over whatever is in output buffer */ + if (state->have) { + n = GT_OFF(state->have) || (z_off64_t)state->have > len ? + (unsigned)len : state->have; + state->have -= n; + state->next += n; + state->pos += n; + len -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && state->strm.avail_in == 0) + break; + + /* need more data to skip -- load up output buffer */ + else { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzread(file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + unsigned got, n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return -1; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* get len bytes to buf, or less than len if at the end */ + got = 0; + do { + /* first just try copying data from the output buffer */ + if (state->have) { + n = state->have > len ? len : state->have; + memcpy(buf, state->next, n); + state->next += n; + state->have -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && strm->avail_in == 0) + break; + + /* need output data -- for small len or new stream load up our output + buffer */ + else if (state->how == LOOK || len < (state->size << 1)) { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + continue; /* no progress yet -- go back to memcpy() above */ + /* the copy above assures that we will leave with space in the + output buffer, allowing at least one gzungetc() to succeed */ + } + + /* large len -- read directly into user buffer */ + else if (state->how == COPY) { /* read directly */ + if (gz_load(state, buf, len, &n) == -1) + return -1; + } + + /* large len -- decompress directly into user buffer */ + else { /* state->how == GZIP */ + strm->avail_out = len; + strm->next_out = buf; + if (gz_decomp(state) == -1) + return -1; + n = state->have; + state->have = 0; + } + + /* update progress */ + len -= n; + buf = (char *)buf + n; + got += n; + state->pos += n; + } while (len); + + /* return number of bytes read into user buffer (will fit in int) */ + return (int)got; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzgetc(file) + gzFile file; +{ + int ret; + unsigned char buf[1]; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* try output buffer (no need to check for skip request) */ + if (state->have) { + state->have--; + state->pos++; + return *(state->next)++; + } + + /* nothing there -- try gzread() */ + ret = gzread(file, buf, 1); + return ret < 1 ? -1 : buf[0]; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzungetc(c, file) + int c; + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* can't push EOF */ + if (c < 0) + return -1; + + /* if output buffer empty, put byte at end (allows more pushing) */ + if (state->have == 0) { + state->have = 1; + state->next = state->out + (state->size << 1) - 1; + state->next[0] = c; + state->pos--; + return c; + } + + /* if no room, give up (must have already done a gzungetc()) */ + if (state->have == (state->size << 1)) { + gz_error(state, Z_BUF_ERROR, "out of room to push characters"); + return -1; + } + + /* slide output data if needed and insert byte before existing data */ + if (state->next == state->out) { + unsigned char *src = state->out + state->have; + unsigned char *dest = state->out + (state->size << 1); + while (src > state->out) + *--dest = *--src; + state->next = dest; + } + state->have++; + state->next--; + state->next[0] = c; + state->pos--; + return c; +} + +/* -- see zlib.h -- */ +char * ZEXPORT gzgets(file, buf, len) + gzFile file; + char *buf; + int len; +{ + unsigned left, n; + char *str; + unsigned char *eol; + gz_statep state; + + /* check parameters and get internal structure */ + if (file == NULL || buf == NULL || len < 1) + return NULL; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return NULL; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return NULL; + } + + /* copy output bytes up to new line or len - 1, whichever comes first -- + append a terminating zero to the string (we don't check for a zero in + the contents, let the user worry about that) */ + str = buf; + left = (unsigned)len - 1; + if (left) do { + /* assure that something is in the output buffer */ + if (state->have == 0) { + if (gz_make(state) == -1) + return NULL; /* error */ + if (state->have == 0) { /* end of file */ + if (buf == str) /* got bupkus */ + return NULL; + break; /* got something -- return it */ + } + } + + /* look for end-of-line in current output buffer */ + n = state->have > left ? left : state->have; + eol = memchr(state->next, '\n', n); + if (eol != NULL) + n = (unsigned)(eol - state->next) + 1; + + /* copy through end-of-line, or remainder if not found */ + memcpy(buf, state->next, n); + state->have -= n; + state->next += n; + state->pos += n; + left -= n; + buf += n; + } while (left && eol == NULL); + + /* found end-of-line or out of space -- terminate string and return it */ + buf[0] = 0; + return str; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzdirect(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return 0; + + /* if the state is not known, but we can find out, then do so (this is + mainly for right after a gzopen() or gzdopen()) */ + if (state->how == LOOK && state->have == 0) + (void)gz_head(state); + + /* return 1 if reading direct, 0 if decompressing a gzip stream */ + return state->direct; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_r(file) + gzFile file; +{ + int ret; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return Z_STREAM_ERROR; + + /* free memory and close file */ + if (state->size) { + inflateEnd(&(state->strm)); + free(state->out); + free(state->in); + } + gz_error(state, Z_OK, NULL); + free(state->path); + ret = close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/libs/libwebsockets/win32port/zlib/gzwrite.c b/libs/libwebsockets/win32port/zlib/gzwrite.c new file mode 100755 index 0000000000..e2bcf9d2b8 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/gzwrite.c @@ -0,0 +1,531 @@ +/* gzwrite.c -- zlib functions for writing gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_init OF((gz_statep)); +local int gz_comp OF((gz_statep, int)); +local int gz_zero OF((gz_statep, z_off64_t)); + +/* Initialize state for writing a gzip file. Mark initialization by setting + state->size to non-zero. Return -1 on failure or 0 on success. */ +local int gz_init(state) + gz_statep state; +{ + int ret; + z_streamp strm = &(state->strm); + + /* allocate input and output buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* allocate deflate memory, set up for gzip compression */ + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; + strm->opaque = Z_NULL; + ret = deflateInit2(strm, state->level, Z_DEFLATED, + 15 + 16, 8, state->strategy); + if (ret != Z_OK) { + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* mark state as initialized */ + state->size = state->want; + + /* initialize write buffer */ + strm->avail_out = state->size; + strm->next_out = state->out; + state->next = strm->next_out; + return 0; +} + +/* Compress whatever is at avail_in and next_in and write to the output file. + Return -1 if there is an error writing to the output file, otherwise 0. + flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, + then the deflate() state is reset to start a new gzip stream. */ +local int gz_comp(state, flush) + gz_statep state; + int flush; +{ + int ret, got; + unsigned have; + z_streamp strm = &(state->strm); + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return -1; + + /* run deflate() on provided input until it produces no more output */ + ret = Z_OK; + do { + /* write out current buffer contents if full, or if flushing, but if + doing Z_FINISH then don't write until we get to Z_STREAM_END */ + if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && + (flush != Z_FINISH || ret == Z_STREAM_END))) { + have = (unsigned)(strm->next_out - state->next); + if (have && ((got = write(state->fd, state->next, have)) < 0 || + (unsigned)got != have)) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (strm->avail_out == 0) { + strm->avail_out = state->size; + strm->next_out = state->out; + } + state->next = strm->next_out; + } + + /* compress */ + have = strm->avail_out; + ret = deflate(strm, flush); + if (ret == Z_STREAM_ERROR) { + gz_error(state, Z_STREAM_ERROR, + "internal error: deflate stream corrupt"); + return -1; + } + have -= strm->avail_out; + } while (have); + + /* if that completed a deflate stream, allow another to start */ + if (flush == Z_FINISH) + deflateReset(strm); + + /* all done, no errors */ + return 0; +} + +/* Compress len zeros to output. Return -1 on error, 0 on success. */ +local int gz_zero(state, len) + gz_statep state; + z_off64_t len; +{ + int first; + unsigned n; + z_streamp strm = &(state->strm); + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + + /* compress len zeros (len guaranteed > 0) */ + first = 1; + while (len) { + n = GT_OFF(state->size) || (z_off64_t)state->size > len ? + (unsigned)len : state->size; + if (first) { + memset(state->in, 0, n); + first = 0; + } + strm->avail_in = n; + strm->next_in = state->in; + state->pos += n; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + len -= n; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzwrite(file, buf, len) + gzFile file; + voidpc buf; + unsigned len; +{ + unsigned put = len; + unsigned n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return 0; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* for small len, copy to input buffer, otherwise compress directly */ + if (len < state->size) { + /* copy to input buffer, compress when full */ + do { + if (strm->avail_in == 0) + strm->next_in = state->in; + n = state->size - strm->avail_in; + if (n > len) + n = len; + memcpy(strm->next_in + strm->avail_in, buf, n); + strm->avail_in += n; + state->pos += n; + buf = (char *)buf + n; + len -= n; + if (len && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } while (len); + } + else { + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* directly compress user buffer to file */ + strm->avail_in = len; + strm->next_in = (voidp)buf; + state->pos += len; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } + + /* input was all buffered or compressed (put will fit in int) */ + return (int)put; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputc(file, c) + gzFile file; + int c; +{ + unsigned char buf[1]; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return -1; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* try writing to input buffer for speed (state->size == 0 if buffer not + initialized) */ + if (strm->avail_in < state->size) { + if (strm->avail_in == 0) + strm->next_in = state->in; + strm->next_in[strm->avail_in++] = c; + state->pos++; + return c; + } + + /* no room in buffer or not initialized, use gz_write() */ + buf[0] = c; + if (gzwrite(file, buf, 1) != 1) + return -1; + return c; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputs(file, str) + gzFile file; + const char *str; +{ + int ret; + unsigned len; + + /* write string */ + len = (unsigned)strlen(str); + ret = gzwrite(file, str, len); + return ret == 0 && len != 0 ? -1 : ret; +} + +#ifdef STDC +#include + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) +{ + int size, len; + gz_statep state; + z_streamp strm; + va_list va; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; + va_start(va, format); +#ifdef NO_vsnprintf +# ifdef HAS_vsprintf_void + (void)vsprintf(state->in, format, va); + va_end(va); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = vsprintf(state->in, format, va); + va_end(va); +# endif +#else +# ifdef HAS_vsnprintf_void + (void)vsnprintf(state->in, size, format, va); + va_end(va); + len = strlen(state->in); +# else + len = vsnprintf((char *)(state->in), size, format, va); + va_end(va); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#else /* !STDC */ + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + gzFile file; + const char *format; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ + int size, len; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; +#ifdef NO_snprintf +# ifdef HAS_sprintf_void + sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#else +# ifdef HAS_snprintf_void + snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(state->in); +# else + len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#endif + +/* -- see zlib.h -- */ +int ZEXPORT gzflush(file, flush) + gzFile file; + int flush; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* check flush parameter */ + if (flush < 0 || flush > Z_FINISH) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* compress remaining data with requested flush */ + gz_comp(state, flush); + return state->err; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzsetparams(file, level, strategy) + gzFile file; + int level; + int strategy; +{ + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* if no change is requested, then do nothing */ + if (level == state->level && strategy == state->strategy) + return Z_OK; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* change compression parameters for subsequent input */ + if (state->size) { + /* flush previous input with previous parameters before changing */ + if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) + return state->err; + deflateParams(strm, level, strategy); + } + state->level = level; + state->strategy = strategy; + return Z_OK; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_w(file) + gzFile file; +{ + int ret = 0; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're writing */ + if (state->mode != GZ_WRITE) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + ret += gz_zero(state, state->skip); + } + + /* flush, free memory, and close file */ + ret += gz_comp(state, Z_FINISH); + (void)deflateEnd(&(state->strm)); + free(state->out); + free(state->in); + gz_error(state, Z_OK, NULL); + free(state->path); + ret += close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/libs/libwebsockets/win32port/zlib/infback.c b/libs/libwebsockets/win32port/zlib/infback.c new file mode 100644 index 0000000000..14770c5635 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/infback.c @@ -0,0 +1,632 @@ +/* infback.c -- inflate using a call-back interface + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + This code is largely copied from inflate.c. Normally either infback.o or + inflate.o would be linked into an application--not both. The interface + with inffast.c is retained so that optimized assembler-coded versions of + inflate_fast() can be used with either inflate.c or infback.c. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); + +/* + strm provides memory allocation functions in zalloc and zfree, or + Z_NULL to use the library memory allocation functions. + + windowBits is in the range 8..15, and window is a user-supplied + window and output buffer that is 2**windowBits bytes. + */ +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) +z_streamp strm; +int windowBits; +unsigned char FAR *window; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL || window == Z_NULL || + windowBits < 8 || windowBits > 15) + return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *)ZALLOC(strm, 1, + sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->dmax = 32768U; + state->wbits = windowBits; + state->wsize = 1U << windowBits; + state->window = window; + state->wnext = 0; + state->whave = 0; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +/* Macros for inflateBack(): */ + +/* Load returned state from inflate_fast() */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Set state from registers for inflate_fast() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Assure that some input is available. If input is requested, but denied, + then return a Z_BUF_ERROR from inflateBack(). */ +#define PULL() \ + do { \ + if (have == 0) { \ + have = in(in_desc, &next); \ + if (have == 0) { \ + next = Z_NULL; \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflateBack() + with an error if there is no input available. */ +#define PULLBYTE() \ + do { \ + PULL(); \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflateBack() with + an error. */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Assure that some output space is available, by writing out the window + if it's full. If the write fails, return from inflateBack() with a + Z_BUF_ERROR. */ +#define ROOM() \ + do { \ + if (left == 0) { \ + put = state->window; \ + left = state->wsize; \ + state->whave = left; \ + if (out(out_desc, put, left)) { \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* + strm provides the memory allocation functions and window buffer on input, + and provides information on the unused input on return. For Z_DATA_ERROR + returns, strm will also provide an error message. + + in() and out() are the call-back input and output functions. When + inflateBack() needs more input, it calls in(). When inflateBack() has + filled the window with output, or when it completes with data in the + window, it calls out() to write out the data. The application must not + change the provided input until in() is called again or inflateBack() + returns. The application must not change the window/output buffer until + inflateBack() returns. + + in() and out() are called with a descriptor parameter provided in the + inflateBack() call. This parameter can be a structure that provides the + information required to do the read or write, as well as accumulated + information on the input and output such as totals and check values. + + in() should return zero on failure. out() should return non-zero on + failure. If either in() or out() fails, than inflateBack() returns a + Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it + was in() or out() that caused in the error. Otherwise, inflateBack() + returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format + error, or Z_MEM_ERROR if it could not allocate memory for the state. + inflateBack() can also return Z_STREAM_ERROR if the input parameters + are not correct, i.e. strm is Z_NULL or the state was not initialized. + */ +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) +z_streamp strm; +in_func in; +void FAR *in_desc; +out_func out; +void FAR *out_desc; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + /* Check that the strm exists and that the state was initialized */ + if (strm == Z_NULL || strm->state == Z_NULL) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* Reset the state */ + strm->msg = Z_NULL; + state->mode = TYPE; + state->last = 0; + state->whave = 0; + next = strm->next_in; + have = next != Z_NULL ? strm->avail_in : 0; + hold = 0; + bits = 0; + put = state->window; + left = state->wsize; + + /* Inflate until end of block marked as last */ + for (;;) + switch (state->mode) { + case TYPE: + /* determine and dispatch block type */ + if (state->last) { + BYTEBITS(); + state->mode = DONE; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + + case STORED: + /* get and verify stored block length */ + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + + /* copy stored block from input to output */ + while (state->length != 0) { + copy = state->length; + PULL(); + ROOM(); + if (copy > have) copy = have; + if (copy > left) copy = left; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + + case TABLE: + /* get dynamic table entries descriptor */ + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + + /* get code length code lengths (not a typo) */ + state->have = 0; + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + + /* get length and distance code code lengths */ + state->have = 0; + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = (unsigned)(state->lens[state->have - 1]); + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { + RESTORE(); + if (state->whave < state->wsize) + state->whave = state->wsize - left; + inflate_fast(strm, state->wsize); + LOAD(); + break; + } + + /* get a literal, length, or end-of-block code */ + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + state->length = (unsigned)here.val; + + /* process literal */ + if (here.op == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + ROOM(); + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + } + + /* process end of block */ + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + + /* invalid code */ + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + + /* length code -- get extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + + /* get distance code */ + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + + /* get distance extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->wsize - (state->whave < state->wsize ? + left : 0)) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + + /* copy match from window to output */ + do { + ROOM(); + copy = state->wsize - state->offset; + if (copy < left) { + from = put + copy; + copy = left - copy; + } + else { + from = put - state->offset; + copy = left; + } + if (copy > state->length) copy = state->length; + state->length -= copy; + left -= copy; + do { + *put++ = *from++; + } while (--copy); + } while (state->length != 0); + break; + + case DONE: + /* inflate stream terminated properly -- write leftover output */ + ret = Z_STREAM_END; + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left)) + ret = Z_BUF_ERROR; + } + goto inf_leave; + + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + + default: /* can't happen, but makes compilers happy */ + ret = Z_STREAM_ERROR; + goto inf_leave; + } + + /* Return unused input */ + inf_leave: + strm->next_in = next; + strm->avail_in = have; + return ret; +} + +int ZEXPORT inflateBackEnd(strm) +z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} diff --git a/libs/libwebsockets/win32port/zlib/inffast.c b/libs/libwebsockets/win32port/zlib/inffast.c new file mode 100644 index 0000000000..2dfd4127db --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/inffast.c @@ -0,0 +1,340 @@ +/* inffast.c -- fast decoding + * Copyright (C) 1995-2008, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifndef ASMINF + +/* Allow machine dependent optimization for post-increment or pre-increment. + Based on testing to date, + Pre-increment preferred for: + - PowerPC G3 (Adler) + - MIPS R5000 (Randers-Pehrson) + Post-increment preferred for: + - none + No measurable difference: + - Pentium III (Anderson) + - M68060 (Nikl) + */ +#ifdef POSTINC +# define OFF 0 +# define PUP(a) *(a)++ +#else +# define OFF 1 +# define PUP(a) *++(a) +#endif + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state->mode == LEN + strm->avail_in >= 6 + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 + + On return, state->mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm->avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +void ZLIB_INTERNAL inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ +{ + struct inflate_state FAR *state; + unsigned char FAR *in; /* local strm->next_in */ + unsigned char FAR *last; /* while in < last, enough input available */ + unsigned char FAR *out; /* local strm->next_out */ + unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ + unsigned char FAR *end; /* while out < end, enough space available */ +#ifdef INFLATE_STRICT + unsigned dmax; /* maximum distance from zlib header */ +#endif + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ + unsigned long hold; /* local strm->hold */ + unsigned bits; /* local strm->bits */ + code const FAR *lcode; /* local strm->lencode */ + code const FAR *dcode; /* local strm->distcode */ + unsigned lmask; /* mask for first level of length codes */ + unsigned dmask; /* mask for first level of distance codes */ + code here; /* retrieved table entry */ + unsigned op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + unsigned len; /* match length, unused bytes */ + unsigned dist; /* match distance */ + unsigned char FAR *from; /* where to copy match from */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; + in = strm->next_in - OFF; + last = in + (strm->avail_in - 5); + out = strm->next_out - OFF; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); +#ifdef INFLATE_STRICT + dmax = state->dmax; +#endif + wsize = state->wsize; + whave = state->whave; + wnext = state->wnext; + window = state->window; + hold = state->hold; + bits = state->bits; + lcode = state->lencode; + dcode = state->distcode; + lmask = (1U << state->lenbits) - 1; + dmask = (1U << state->distbits) - 1; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + do { + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op == 0) { /* literal */ + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + PUP(out) = (unsigned char)(here.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op & 16) { /* distance base */ + dist = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + } + dist += (unsigned)hold & ((1U << op) - 1); +#ifdef INFLATE_STRICT + if (dist > dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + hold >>= op; + bits -= op; + Tracevv((stderr, "inflate: distance %u\n", dist)); + op = (unsigned)(out - beg); /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state->sane) { + strm->msg = + (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + if (len <= op - whave) { + do { + PUP(out) = 0; + } while (--len); + continue; + } + len -= op - whave; + do { + PUP(out) = 0; + } while (--op > whave); + if (op == 0) { + from = out - dist; + do { + PUP(out) = PUP(from); + } while (--len); + continue; + } +#endif + } + from = window - OFF; + if (wnext == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = window - OFF; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } while (len > 2); + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + } + else if ((op & 64) == 0) { /* 2nd level distance code */ + here = dcode[here.val + (hold & ((1U << op) - 1))]; + goto dodist; + } + else { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + } + else if ((op & 64) == 0) { /* 2nd level length code */ + here = lcode[here.val + (hold & ((1U << op) - 1))]; + goto dolen; + } + else if (op & 32) { /* end-of-block */ + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + else { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + } while (in < last && out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + in -= len; + bits -= len << 3; + hold &= (1U << bits) - 1; + + /* update state and return */ + strm->next_in = in + OFF; + strm->next_out = out + OFF; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); + state->hold = hold; + state->bits = bits; + return; +} + +/* + inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): + - Using bit fields for code structure + - Different op definition to avoid & for extra bits (do & for table bits) + - Three separate decoding do-loops for direct, window, and wnext == 0 + - Special case for distance > 1 copies to do overlapped load and store copy + - Explicit branch predictions (based on measured branch probabilities) + - Deferring match copy and interspersed it with decoding subsequent codes + - Swapping literal/length else + - Swapping window/direct else + - Larger unrolled copy loops (three is about right) + - Moving len -= 3 statement into middle of loop + */ + +#endif /* !ASMINF */ diff --git a/libs/libwebsockets/win32port/zlib/inffast.h b/libs/libwebsockets/win32port/zlib/inffast.h new file mode 100644 index 0000000000..e1e6db4ac5 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/inffast.h @@ -0,0 +1,11 @@ +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/libs/libwebsockets/win32port/zlib/inffixed.h b/libs/libwebsockets/win32port/zlib/inffixed.h new file mode 100644 index 0000000000..423d5c5b50 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/inffixed.h @@ -0,0 +1,94 @@ + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. It + is part of the implementation of the compression library and + is subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/libs/libwebsockets/win32port/zlib/inflate.c b/libs/libwebsockets/win32port/zlib/inflate.c new file mode 100644 index 0000000000..5bec31e2ec --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/inflate.c @@ -0,0 +1,1480 @@ +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common wnext == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + strm->adler = 1; /* to support ill-conceived Java test suite */ + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->dmax = 32768U; + state->head = Z_NULL; + state->wsize = 0; + state->whave = 0; + state->wnext = 0; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + state->sane = 1; + state->back = -1; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflateReset2(strm, windowBits) +z_streamp strm; +int windowBits; +{ + int wrap; + struct inflate_state FAR *state; + + /* get the state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) + windowBits &= 15; +#endif + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) + return Z_STREAM_ERROR; + if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { + ZFREE(strm, state->window); + state->window = Z_NULL; + } + + /* update state and reset the rest of it */ + state->wrap = wrap; + state->wbits = (unsigned)windowBits; + return inflateReset(strm); +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ + int ret; + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL) return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *) + ZALLOC(strm, 1, sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->window = Z_NULL; + ret = inflateReset2(strm, windowBits); + if (ret != Z_OK) { + ZFREE(strm, state); + strm->state = Z_NULL; + } + return ret; +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +int ZEXPORT inflatePrime(strm, bits, value) +z_streamp strm; +int bits; +int value; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (bits < 0) { + state->hold = 0; + state->bits = 0; + return Z_OK; + } + if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + value &= (1L << bits) - 1; + state->hold += value << state->bits; + state->bits += bits; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +#ifdef MAKEFIXED +#include + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, + state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->wnext = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->wnext = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->wnext; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->wnext = copy; + state->whave = state->wsize; + } + else { + state->wnext += dist; + if (state->wnext == state->wsize) state->wnext = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Restore state from registers in inflate() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflate(). */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Reverse the bytes in a 32-bit value */ +#define REVERSE(q) \ + ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned in, out; /* save starting available input and output */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (state->head != Z_NULL) + state->head->done = -1; + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + len = BITS(4) + 8; + if (state->wbits == 0) + state->wbits = len; + else if (len > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + state->dmax = 1U << len; + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->head != Z_NULL) + state->head->text = (int)((hold >> 8) & 1); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->head != Z_NULL) + state->head->time = hold; + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->head != Z_NULL) { + state->head->xflags = (int)(hold & 0xff); + state->head->os = (int)(hold >> 8); + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->head != Z_NULL) + state->head->extra_len = (unsigned)hold; + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->head != Z_NULL && + state->head->extra != Z_NULL) { + len = state->head->extra_len - state->length; + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); + } + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->length = 0; + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->name != Z_NULL && + state->length < state->head->name_max) + state->head->name[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->comment != Z_NULL && + state->length < state->head->comm_max) + state->head->comment[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + if (state->head != Z_NULL) { + state->head->hcrc = (int)((state->flags >> 9) & 1); + state->head->done = 1; + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = REVERSE(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN_; /* decode codes */ + if (flush == Z_TREES) { + DROPBITS(2); + goto inf_leave; + } + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + case STORED: + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + state->mode = COPY_; + if (flush == Z_TREES) goto inf_leave; + case COPY_: + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = state->lens[state->have - 1]; + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN_; + if (flush == Z_TREES) goto inf_leave; + case LEN_: + state->mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + if (state->mode == TYPE) + state->back = -1; + break; + } + state->back = 0; + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + state->length = (unsigned)here.val; + if ((int)(here.op) == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + state->mode = LIT; + break; + } + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->back = -1; + state->mode = TYPE; + break; + } + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(here.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->was = state->length; + state->mode = DIST; + case DIST: + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + state->extra = (unsigned)(here.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } +#ifdef INFLATE_STRICT + if (state->offset > state->dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->whave) { + if (state->sane) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + Trace((stderr, "inflate.c too far\n")); + copy -= state->whave; + if (copy > state->length) copy = state->length; + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = 0; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; +#endif + } + if (copy > state->wnext) { + copy -= state->wnext; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->wnext - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + REVERSE(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0) + + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long id; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->wrap != 0 && state->mode != DICT) + return Z_STREAM_ERROR; + + /* check for correct dictionary id */ + if (state->mode == DICT) { + id = adler32(0L, Z_NULL, 0); + id = adler32(id, dictionary, dictLength); + if (id != state->check) + return Z_DATA_ERROR; + } + + /* copy dictionary to window */ + if (updatewindow(strm, strm->avail_out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + if (dictLength > state->wsize) { + zmemcpy(state->window, dictionary + dictLength - state->wsize, + state->wsize); + state->whave = state->wsize; + } + else { + zmemcpy(state->window + state->wsize - dictLength, dictionary, + dictLength); + state->whave = dictLength; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +int ZEXPORT inflateGetHeader(strm, head) +z_streamp strm; +gz_headerp head; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; + + /* save header structure */ + state->head = head; + head->done = 0; + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + unsigned long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + unsigned wsize; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + zmemcpy(dest, source, sizeof(z_stream)); + zmemcpy(copy, state, sizeof(struct inflate_state)); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) { + wsize = 1U << state->wbits; + zmemcpy(window, state->window, wsize); + } + copy->window = window; + dest->state = (struct internal_state FAR *)copy; + return Z_OK; +} + +int ZEXPORT inflateUndermine(strm, subvert) +z_streamp strm; +int subvert; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + state->sane = !subvert; +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + return Z_OK; +#else + state->sane = 1; + return Z_DATA_ERROR; +#endif +} + +long ZEXPORT inflateMark(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + state = (struct inflate_state FAR *)strm->state; + return ((long)(state->back) << 16) + + (state->mode == COPY ? state->length : + (state->mode == MATCH ? state->was - state->length : 0)); +} diff --git a/libs/libwebsockets/win32port/zlib/inflate.h b/libs/libwebsockets/win32port/zlib/inflate.h new file mode 100644 index 0000000000..a8ef4287df --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/inflate.h @@ -0,0 +1,122 @@ +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY_, /* i/o: same as COPY below, but only first time in */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN_, /* i: same as LEN below, but only first time in */ + LEN, /* i: waiting for length/lit/eob code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to BAD or MEM on error -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) or (raw) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> + HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + (raw) -> TYPEDO + Read deflate blocks: + TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK + STORED -> COPY_ -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN_ + LEN_ -> LEN + Read deflate codes in fixed or dynamic block: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 10K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ + int sane; /* if false, allow invalid distance too far */ + int back; /* bits back of last unprocessed length/lit */ + unsigned was; /* initial length of match */ +}; diff --git a/libs/libwebsockets/win32port/zlib/inftrees.c b/libs/libwebsockets/win32port/zlib/inftrees.c new file mode 100644 index 0000000000..9dbaec3368 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/inftrees.c @@ -0,0 +1,330 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.5 Copyright 1995-2010 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code here; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) { /* no symbols to code at all */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)1; + here.val = (unsigned short)0; + *(*table)++ = here; /* make a table to force an error */ + *(*table)++ = here; + *bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || max != 1)) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + here.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + here.op = (unsigned char)0; + here.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + here.op = (unsigned char)(extra[work[sym]]); + here.val = base[work[sym]]; + } + else { + here.op = (unsigned char)(32 + 64); /* end of block */ + here.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + next[(huff >> drop) + fill] = here; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* + Fill in rest of table for incomplete codes. This loop is similar to the + loop above in incrementing huff for table indices. It is assumed that + len is equal to curr + drop, so there is no loop needed to increment + through high index bits. When the current sub-table is filled, the loop + drops back to the root table to fill in any remaining entries there. + */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)(len - drop); + here.val = (unsigned short)0; + while (huff != 0) { + /* when done with sub-table, drop back to root table */ + if (drop != 0 && (huff & mask) != low) { + drop = 0; + len = root; + next = *table; + here.bits = (unsigned char)len; + } + + /* put invalid code marker in table */ + next[huff >> drop] = here; + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/libs/libwebsockets/win32port/zlib/inftrees.h b/libs/libwebsockets/win32port/zlib/inftrees.h new file mode 100644 index 0000000000..a685d8c6ea --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/inftrees.h @@ -0,0 +1,62 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of the dynamic table. The maximum number of code structures is + 1444, which is the sum of 852 for literal/length codes and 592 for distance + codes. These values were found by exhaustive searches using the program + examples/enough.c found in the zlib distribtution. The arguments to that + program are the number of symbols, the initial root table size, and the + maximum bit length of a code. "enough 286 9 15" for literal/length codes + returns returns 852, and "enough 30 6 15" for distance codes returns 592. + The initial root table size (9 or 6) is found in the fifth argument of the + inflate_table() calls in inflate.c and infback.c. If the root table size is + changed, then these maximum sizes would be need to be recalculated and + updated. */ +#define ENOUGH_LENS 852 +#define ENOUGH_DISTS 592 +#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) + +/* Type of code to build for inflate_table() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/libs/libwebsockets/win32port/zlib/trees.c b/libs/libwebsockets/win32port/zlib/trees.c new file mode 100644 index 0000000000..b4a317aced --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/trees.c @@ -0,0 +1,1244 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2010 Jean-loup Gailly + * detect_data_type() function provided freely by Cosmin Truta, 2006 + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id$ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +#define Buf_size (8 * 2*sizeof(char)) +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local int detect_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (ush)value << s->bi_valid; + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= (ush)value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (ush)val << s->bi_valid;\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (ush)(value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ +#ifdef NO_INIT_GLOBAL_POINTERS + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; +#endif + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, + "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void ZLIB_INTERNAL _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->last_eob_len = 8; /* enough lookahead for inflate */ +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if ((unsigned) tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + * The current inflate code requires 9 bits of lookahead. If the + * last two codes for the previous block (real code plus EOB) were coded + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode + * the last real code. In this case we send two empty static blocks instead + * of one. (There are no problems if the previous block is stored or fixed.) + * To simplify the code, we assume the worst case of last real code encoded + * on one bit only. + */ +void ZLIB_INTERNAL _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); + /* Of the 10 bits for the empty block, we have already sent + * (10 - bi_valid) bits. The lookahead for the last real code (before + * the EOB of the previous block) was thus at least one plus the length + * of the EOB plus what we have just sent of the empty static block. + */ + if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; +#endif + bi_flush(s); + } + s->last_eob_len = 7; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is binary or text */ + if (s->strm->data_type == Z_UNKNOWN) + s->strm->data_type = detect_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+last, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+last, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int ZLIB_INTERNAL _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); + s->last_eob_len = ltree[END_BLOCK].Len; +} + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local int detect_data_type(s) + deflate_state *s; +{ + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + unsigned long black_mask = 0xf3ffc07fUL; + int n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>= 1) + if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + return Z_BINARY; + + /* Check for textual ("white-listed") bytes. */ + if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 + || s->dyn_ltree[13].Freq != 0) + return Z_TEXT; + for (n = 32; n < LITERALS; n++) + if (s->dyn_ltree[n].Freq != 0) + return Z_TEXT; + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + s->last_eob_len = 8; /* enough lookahead for inflate */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/libs/libwebsockets/win32port/zlib/trees.h b/libs/libwebsockets/win32port/zlib/trees.h new file mode 100644 index 0000000000..ce8f620444 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/libs/libwebsockets/win32port/zlib/uncompr.c b/libs/libwebsockets/win32port/zlib/uncompr.c new file mode 100644 index 0000000000..f07773c9de --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/uncompr.c @@ -0,0 +1,59 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/libs/libwebsockets/win32port/zlib/zconf.h b/libs/libwebsockets/win32port/zlib/zconf.h new file mode 100644 index 0000000000..88f90f90f4 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/zconf.h @@ -0,0 +1,428 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define uncompress z_uncompress +# define zError z_zError +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# define gzFile z_gzFile +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef STDC +# include /* for off_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define z_off64_t off64_t +#else +# define z_off64_t z_off_t +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/libs/libwebsockets/win32port/zlib/zlib.h b/libs/libwebsockets/win32port/zlib/zlib.h new file mode 100644 index 0000000000..cba7ab2fb3 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/zlib.h @@ -0,0 +1,1613 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.5, April 19th, 2010 + + Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.5" +#define ZLIB_VERNUM 0x1250 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 5 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all the uncompressed data. (The size + of the uncompressed data may have been saved by the compressor for this + purpose.) The next operation on this stream must be inflateEnd to deallocate + the decompression state. The use of Z_FINISH is never required, but can be + used to inform inflate that a faster approach may be used for the single + inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK or Z_TREES is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any call + of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. The + stream will keep the same compression level and any other attributes that + may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression level is changed, the input available so far is + compressed with the old level (and may be flushed); the new level will take + effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to be + compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if + strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been + found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the + success case, the application may save the current current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above or -1 << 16 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the normal + behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef voidp gzFile; /* opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) Also "a" + can be used instead of "w" to request that the gzip stream that will be + written be appended to the file. "+" will result in an error, since reading + and writing to the same gzip file is not supported. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Two buffers are allocated, either both of the specified size when + writing, or one of the specified size and the other twice that size when + reading. A larger buffer size of, for example, 64K or 128K bytes will + noticeably increase the speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file was not in gzip format, gzread copies the given number of + bytes into the buffer. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream, or failing that, reading the rest + of the input file directly without decompression. The entire input file + will be read if gzread is called until it returns less than the requested + len. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or 0 in case of error. The number of + uncompressed bytes written is limited to 8191, or one less than the buffer + size given to gzbuffer(). The caller should assure that this limit is not + exceeded. If it is exceeded, then gzprintf() will return an error (0) with + nothing written. In this case, there may also be a buffer overflow with + unpredictable consequences, which is possible only if zlib was compiled with + the insecure functions sprintf() or vsprintf() because the secure snprintf() + or vsnprintf() functions were not available. This can be determined using + zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatented gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. This state can change from + false to true while reading the input file if the end of a gzip stream is + reached, but is followed by data that is not another gzip stream. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the for the crc. Pre- and post-conditioning (one's + complement) is performed within this function so it shouldn't be done by the + application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# ifdef _LARGEFILE64_SOURCE + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +/* hack for buggy compilers */ +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; +#endif + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/libs/libwebsockets/win32port/zlib/zutil.c b/libs/libwebsockets/win32port/zlib/zutil.c new file mode 100644 index 0000000000..e33ae8bb5a --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/zutil.c @@ -0,0 +1,318 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +const char * const z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch ((int)(sizeof(uInt))) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch ((int)(sizeof(uLong))) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch ((int)(sizeof(voidpf))) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch ((int)(sizeof(z_off_t))) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#ifdef STDC +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int ZLIB_INTERNAL z_verbose = verbose; + +void ZLIB_INTERNAL z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void ZLIB_INTERNAL zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int ZLIB_INTERNAL zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void ZLIB_INTERNAL zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void ZLIB_INTERNAL zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ diff --git a/libs/libwebsockets/win32port/zlib/zutil.h b/libs/libwebsockets/win32port/zlib/zutil.h new file mode 100644 index 0000000000..a36a406ed9 --- /dev/null +++ b/libs/libwebsockets/win32port/zlib/zutil.h @@ -0,0 +1,274 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include "zlib.h" + +#ifdef STDC +# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) +# include +# endif +# include +# include +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# ifdef M_I86 +# include +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + +#if defined(__BORLANDC__) + #pragma warn -8004 + #pragma warn -8008 + #pragma warn -8066 +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# define vsnprintf _vsnprintf +# endif +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif +#ifdef VMS +# define NO_vsnprintf +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); +void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* ZUTIL_H */ From e9ce6ae0e9b1f40bf765e42140802c0efad251dc Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 8 Aug 2012 21:18:06 -0500 Subject: [PATCH 0881/1057] FS-4504 vs2010 only - plus mod_sofia fix - anybody want to help with 2008 --- Freeswitch.2010.sln | 38 +++ libs/spandsp/src/libspandsp.2010.vcxproj | 17 +- .../src/libspandsp.2010.vcxproj.filters | 3 + libs/spandsp/src/msvc/config.h | 2 + libs/spandsp/src/t42.c | 6 +- libs/win32/Download libjpeg.2010.vcxproj | 81 +++++++ libs/win32/libjpeg/libjpeg.2010.vcxproj | 226 ++++++++++++++++++ .../libjpeg/libjpeg.2010.vcxproj.filters | 186 ++++++++++++++ .../mod_sofia/mod_sofia.2010.vcxproj | 1 + src/mod/endpoints/mod_sofia/rtp.c | 34 ++- 10 files changed, 579 insertions(+), 15 deletions(-) create mode 100644 libs/win32/Download libjpeg.2010.vcxproj create mode 100644 libs/win32/libjpeg/libjpeg.2010.vcxproj create mode 100644 libs/win32/libjpeg/libjpeg.2010.vcxproj.filters diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index cd22423f5b..588637f438 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -529,6 +529,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libs\libzrtp\pro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_redis", "src\mod\applications\mod_redis\mod_redis.2010.vcxproj", "{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download libjpeg", "libs\win32\Download libjpeg.2010.vcxproj", "{652AD5F7-8488-489F-AAD0-7FBE064703B6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libs\win32\libjpeg\libjpeg.2010.vcxproj", "{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3608,6 +3612,38 @@ Global {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Release|x64.ActiveCfg = Release|x64 {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Release|x64 Setup.ActiveCfg = Release|x64 {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.Release|x86 Setup.ActiveCfg = Release|x64 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.Build.0 = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|x64.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|x64 Setup.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|x86 Setup.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.ActiveCfg = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.Build.0 = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64.ActiveCfg = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x86 Setup.ActiveCfg = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.Build.0 = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64 Setup.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x86 Setup.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|Win32.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|Win32.Build.0 = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|x64.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|x64 Setup.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|x86 Setup.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|Win32.Build.0 = Debug|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|x64.ActiveCfg = Debug|x64 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|x64.Build.0 = Debug|x64 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|x64 Setup.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|x86 Setup.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|Win32.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|Win32.Build.0 = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|x64.ActiveCfg = Release|x64 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|x64.Build.0 = Release|x64 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|x64 Setup.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|x86 Setup.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3723,6 +3759,7 @@ Global {23B4D303-79FC-49E0-89E2-2280E7E28940} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {C13CC324-0032-4492-9A30-310A6BD64FF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {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} @@ -3761,6 +3798,7 @@ Global {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19} = {C120A020-773F-4EA3-923F-B67AF28B750D} {B808178B-82F0-4CF4-A2B1-921939FA24D0} = {C120A020-773F-4EA3-923F-B67AF28B750D} {D578E676-7EC8-4548-BD8B-845C635F14AD} = {C120A020-773F-4EA3-923F-B67AF28B750D} + {652AD5F7-8488-489F-AAD0-7FBE064703B6} = {C120A020-773F-4EA3-923F-B67AF28B750D} {988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj b/libs/spandsp/src/libspandsp.2010.vcxproj index 253863f975..0ef3d481b0 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj +++ b/libs/spandsp/src/libspandsp.2010.vcxproj @@ -76,7 +76,7 @@ Disabled - .;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -97,7 +97,7 @@ $(IntDir)BuildLog $(ProjectName).htm - .;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + .;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) MultiThreadedDLL Level4 @@ -118,7 +118,7 @@ Disabled - .;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + .;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -139,7 +139,7 @@ $(IntDir)BuildLog $(ProjectName).htm - .;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + .;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) MultiThreadedDLL Level4 @@ -208,6 +208,7 @@ + @@ -409,6 +410,14 @@
+ + {019dbd2a-273d-4ba4-bf86-b5efe2ed76b1} + true + false + false + true + false + {401a40cd-5db4-4e34-ac68-fa99e9fac014} false diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj.filters b/libs/spandsp/src/libspandsp.2010.vcxproj.filters index 0c445ef07c..c7d1210235 100644 --- a/libs/spandsp/src/libspandsp.2010.vcxproj.filters +++ b/libs/spandsp/src/libspandsp.2010.vcxproj.filters @@ -277,6 +277,9 @@ Source Files + + Source Files + diff --git a/libs/spandsp/src/msvc/config.h b/libs/spandsp/src/msvc/config.h index a1eaae16a6..42494d345f 100644 --- a/libs/spandsp/src/msvc/config.h +++ b/libs/spandsp/src/msvc/config.h @@ -74,6 +74,8 @@ #define _MMX_H_ + #define cbrtf(value) pow((float)value, (float).333) + #include // To get alloca #endif diff --git a/libs/spandsp/src/t42.c b/libs/spandsp/src/t42.c index f7f7e1e062..a9eb7afc9c 100644 --- a/libs/spandsp/src/t42.c +++ b/libs/spandsp/src/t42.c @@ -929,7 +929,7 @@ SPAN_DECLARE(int) t42_srgb_to_itulab(logging_state_t *logging, lab_params_t *s, for (pos = 0; pos < srclen; pos += compressor.image_width*compressor.num_components) { - scan_line_in = src + pos; + scan_line_in = (JSAMPROW)src + pos; srgb_to_lab(s, scan_line_out, scan_line_in, compressor.image_width); jpeg_write_scanlines(&compressor, &scan_line_out, 1); } @@ -1033,7 +1033,7 @@ SPAN_DECLARE(int) t42_itulab_to_itulab(logging_state_t *logging, tdata_t *dst, t for (pos = 0; pos < srclen; pos += compressor.image_width*compressor.num_components) { - scan_line_in = src + pos; + scan_line_in = (JSAMPROW)src + pos; jpeg_write_scanlines(&compressor, &scan_line_in, 1); } @@ -1150,7 +1150,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s, for (pos = 0; decompressor.output_scanline < decompressor.output_height; pos += decompressor.output_width*decompressor.num_components) { - scan_line_out = dst + pos; + scan_line_out = (JSAMPROW)dst + pos; jpeg_read_scanlines(&decompressor, &scan_line_in, 1); lab_to_srgb(s, scan_line_out, scan_line_in, decompressor.output_width); } diff --git a/libs/win32/Download libjpeg.2010.vcxproj b/libs/win32/Download libjpeg.2010.vcxproj new file mode 100644 index 0000000000..56844e037c --- /dev/null +++ b/libs/win32/Download libjpeg.2010.vcxproj @@ -0,0 +1,81 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + Download libjpeg + {652AD5F7-8488-489F-AAD0-7FBE064703B6} + Download libjpeg + Win32Proj + + + + Utility + MultiByte + + + Utility + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\jpeg-8d\$(Configuration)\ + $(PlatformName)\jpeg-8d\$(Configuration)\ + + + + $(IntDir)BuildLog $(ProjectName).htm + + + + + + + + + $(IntDir)BuildLog $(ProjectName).htm + + + + + + + + + + + + + Document + Downloading libjpeg. + if not exist "$(ProjectDir)..\jpeg-8d" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://www.ijg.org/files/jpegsrc.v8d.tar.gz "$(ProjectDir).." + + $(ProjectDir)..\jpeg-8d;%(Outputs) + Downloading libjpeg. + if not exist "$(ProjectDir)..\jpeg-8d" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://www.ijg.org/files/jpegsrc.v8d.tar.gz "$(ProjectDir).." + + $(ProjectDir)..\jpeg-8d;%(Outputs) + + + + + + \ No newline at end of file diff --git a/libs/win32/libjpeg/libjpeg.2010.vcxproj b/libs/win32/libjpeg/libjpeg.2010.vcxproj new file mode 100644 index 0000000000..734f4b8446 --- /dev/null +++ b/libs/win32/libjpeg/libjpeg.2010.vcxproj @@ -0,0 +1,226 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + Disabled + Disabled + Disabled + false + false + false + false + + + + libjpeg + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} + Win32Proj + libjpeg + + + + StaticLibrary + false + true + Unicode + + + StaticLibrary + false + true + Unicode + + + StaticLibrary + false + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + NotUsing + Full + true + false + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS + true + true + ..\..\jpeg-8d;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + Level3 + NotUsing + Full + true + false + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS + true + true + ..\..\jpeg-8d;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + Level3 + NotUsing + Full + true + false + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS + true + true + ..\..\jpeg-8d;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + if not exist "$(ProjectDir)..\..\jpeg-8d\jconfig.h" type "$(ProjectDir)..\..\jpeg-8d\jconfig.vc" > "$(ProjectDir)..\..\jpeg-8d\jconfig.h" + + + + + Level3 + NotUsing + Full + true + false + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS + true + true + ..\..\jpeg-8d;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + if not exist "$(ProjectDir)..\..\jpeg-8d\jconfig.h" type "$(ProjectDir)..\..\jpeg-8d\jconfig.vc" > "$(ProjectDir)..\..\jpeg-8d\jconfig.h" + + + + + + \ No newline at end of file diff --git a/libs/win32/libjpeg/libjpeg.2010.vcxproj.filters b/libs/win32/libjpeg/libjpeg.2010.vcxproj.filters new file mode 100644 index 0000000000..6a63450cb4 --- /dev/null +++ b/libs/win32/libjpeg/libjpeg.2010.vcxproj.filters @@ -0,0 +1,186 @@ + + + + + {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;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header 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 + + + Source Files + + + \ No newline at end of file diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj b/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj index 5432c3323f..c5b0b0772f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj +++ b/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj @@ -138,6 +138,7 @@ + diff --git a/src/mod/endpoints/mod_sofia/rtp.c b/src/mod/endpoints/mod_sofia/rtp.c index bf3e36ca19..9e927402e7 100644 --- a/src/mod/endpoints/mod_sofia/rtp.c +++ b/src/mod/endpoints/mod_sofia/rtp.c @@ -96,17 +96,35 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event); switch_state_handler_table_t crtp_state_handlers = { - .on_init = channel_on_init, - .on_destroy = channel_on_destroy + /*on_init */channel_on_init, + /*on_routing */ NULL, + /*on_execute */ NULL, + /*on_hangup*/ NULL, + /*on_exchange_media*/ NULL, + /*on_soft_execute*/ NULL, + /*on_consume_media*/ NULL, + /*on_hibernate*/ NULL, + /*on_reset*/ NULL, + /*on_park*/ NULL, + /*on_reporting*/ NULL, + /*on_destroy*/ channel_on_destroy + }; switch_io_routines_t crtp_io_routines = { - .outgoing_channel = channel_outgoing_channel, - .read_frame = channel_read_frame, - .write_frame = channel_write_frame, - .receive_message = channel_receive_message, - .receive_event = channel_receive_event, - .send_dtmf = channel_send_dtmf + /*outgoing_channel*/ channel_outgoing_channel, + /*read_frame*/ channel_read_frame, + /*write_frame*/ channel_write_frame, + /*kill_channel*/ NULL, + /*send_dtmf*/ channel_send_dtmf, + /*receive_message*/ channel_receive_message, + /*receive_event*/ channel_receive_event, + /*state_change*/ NULL, + /*read_video_frame*/ NULL, + /*write_video_frame*/ NULL, + /*state_run*/ NULL, + /* resurrect_session*/ NULL + }; From 3389f323636b379ff314a750e1700dabfa312bfe Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 8 Aug 2012 21:29:06 -0500 Subject: [PATCH 0882/1057] FS-4504 - tweak --- libs/win32/libjpeg/libjpeg.2010.vcxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/win32/libjpeg/libjpeg.2010.vcxproj b/libs/win32/libjpeg/libjpeg.2010.vcxproj index 734f4b8446..437fb66198 100644 --- a/libs/win32/libjpeg/libjpeg.2010.vcxproj +++ b/libs/win32/libjpeg/libjpeg.2010.vcxproj @@ -156,6 +156,9 @@ true true + + if not exist "$(ProjectDir)..\..\jpeg-8d\jconfig.h" type "$(ProjectDir)..\..\jpeg-8d\jconfig.vc" > "$(ProjectDir)..\..\jpeg-8d\jconfig.h" + @@ -175,6 +178,9 @@ true true + + if not exist "$(ProjectDir)..\..\jpeg-8d\jconfig.h" type "$(ProjectDir)..\..\jpeg-8d\jconfig.vc" > "$(ProjectDir)..\..\jpeg-8d\jconfig.h" + From a21e4ad681d23358d6d6b7567ceccb7f74bcf4cc Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 9 Aug 2012 08:31:12 -0500 Subject: [PATCH 0883/1057] FS-4504 vs2010 update x64 download settings for libjpeg --- Freeswitch.2010.sln | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 588637f438..505e448276 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -3620,11 +3620,13 @@ Global {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.ActiveCfg = Debug|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.Build.0 = Debug|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64.ActiveCfg = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64.Build.0 = Debug|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64 Setup.ActiveCfg = Debug|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.ActiveCfg = Release|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.Build.0 = Release|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64.Build.0 = Release|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64 Setup.ActiveCfg = Release|Win32 {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x86 Setup.ActiveCfg = Release|Win32 {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|Win32.ActiveCfg = Release|Win32 From a4115a099be77ae001a1d13d0ba0a1cc1e0f624c Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 9 Aug 2012 08:34:26 -0500 Subject: [PATCH 0884/1057] FS-4504 vs2010 add libjpeg download dependency --- Freeswitch.2010.sln | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 505e448276..26c0348421 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -532,6 +532,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download libjpeg", "libs\win32\Download libjpeg.2010.vcxproj", "{652AD5F7-8488-489F-AAD0-7FBE064703B6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libs\win32\libjpeg\libjpeg.2010.vcxproj", "{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}" + ProjectSection(ProjectDependencies) = postProject + {652AD5F7-8488-489F-AAD0-7FBE064703B6} = {652AD5F7-8488-489F-AAD0-7FBE064703B6} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From d1b45ae65b49e602c4fb649d0220cfb79ca7e3b4 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Thu, 9 Aug 2012 21:58:22 +0800 Subject: [PATCH 0885/1057] A couple of typos in spandsp Improvements to image flattening in spandsp's image translate code --- libs/spandsp/src/image_translate.c | 16 +++++++--------- libs/spandsp/src/spandsp/ima_adpcm.h | 2 +- libs/spandsp/src/spandsp/private/ima_adpcm.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c index 54037990fc..4ee2c211bf 100644 --- a/libs/spandsp/src/image_translate.c +++ b/libs/spandsp/src/image_translate.c @@ -163,10 +163,9 @@ static int image_gray16_to_colour16_row(uint16_t colour16[], uint16_t gray16[], for (i = pixels - 1; i >= 0; i--) { - /* TODO: need to balance the colours */ - colour16[3*i] = gray16[i]; - colour16[3*i + 1] = gray16[i]; - colour16[3*i + 2] = gray16[i]; + colour16[3*i] = saturateu16((gray16[i]*36532) >> 15); + colour16[3*i + 1] = saturateu16((gray16[i]*37216) >> 16); + colour16[3*i + 2] = saturateu16((gray16[i]*47900) >> 14); } return pixels; } @@ -178,10 +177,9 @@ static int image_gray16_to_colour8_row(uint8_t colour8[], uint16_t gray16[], int for (i = pixels - 1; i >= 0; i--) { - /* TODO: need to balance the colours */ - colour8[3*i] = gray16[i] >> 8; - colour8[3*i + 1] = gray16[i] >> 8; - colour8[3*i + 2] = gray16[i] >> 8; + colour8[3*i] = saturateu8((gray16[i]*36532) >> 23); + colour8[3*i + 1] = saturateu8((gray16[i]*37216) >> 24); + colour8[3*i + 2] = saturateu8((gray16[i]*47900) >> 22); } return pixels; } @@ -530,7 +528,7 @@ SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[], else { i = s->output_width*s->output_bytes_per_pixel; - memcpy(buf, s->pixel_row[1], i); + memcpy(buf, s->pixel_row[0], i); } return i; } diff --git a/libs/spandsp/src/spandsp/ima_adpcm.h b/libs/spandsp/src/spandsp/ima_adpcm.h index 292bdd5d83..2942efa859 100644 --- a/libs/spandsp/src/spandsp/ima_adpcm.h +++ b/libs/spandsp/src/spandsp/ima_adpcm.h @@ -1,7 +1,7 @@ /* * SpanDSP - a series of DSP components for telephony * - * ima_adpcm.c - Conversion routines between linear 16 bit PCM data and + * ima_adpcm.h - Conversion routines between linear 16 bit PCM data and * IMA/DVI/Intel ADPCM format. * * Written by Steve Underwood diff --git a/libs/spandsp/src/spandsp/private/ima_adpcm.h b/libs/spandsp/src/spandsp/private/ima_adpcm.h index 21ead941af..2fc7d2c114 100644 --- a/libs/spandsp/src/spandsp/private/ima_adpcm.h +++ b/libs/spandsp/src/spandsp/private/ima_adpcm.h @@ -1,7 +1,7 @@ /* * SpanDSP - a series of DSP components for telephony * - * private/ima_adpcm.c - Conversion routines between linear 16 bit PCM data + * private/ima_adpcm.h - Conversion routines between linear 16 bit PCM data * and IMA/DVI/Intel ADPCM format. * * Written by Steve Underwood From d3c89bae347f64cc37b483138010db767d97d4b4 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Thu, 9 Aug 2012 22:19:49 +0800 Subject: [PATCH 0886/1057] Fixed a misplaced #endif that only causes trouble when you hit the right combination --- libs/spandsp/tests/v27ter_tests.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/spandsp/tests/v27ter_tests.c b/libs/spandsp/tests/v27ter_tests.c index db5a13d29f..93bda4c815 100644 --- a/libs/spandsp/tests/v27ter_tests.c +++ b/libs/spandsp/tests/v27ter_tests.c @@ -231,7 +231,11 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex { printf("Equalizer B:\n"); for (i = 0; i < len; i++) +#if defined(SPANDSP_USE_FIXED_POINT) printf("%3d (%15.5f, %15.5f)\n", i, coeffs[i].re/V27TER_CONSTELLATION_SCALING_FACTOR, coeffs[i].im/V27TER_CONSTELLATION_SCALING_FACTOR); +#else + printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); +#endif #if defined(ENABLE_GUI) if (use_gui) { @@ -241,10 +245,10 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex qam_monitor_update_equalizer(qam_monitor, coeffs, len); #endif } +#endif } update_interval = 100; } -#endif } else { @@ -601,7 +605,7 @@ int main(int argc, char *argv[]) exit(2); } } - return 0; + return 0; } /*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ From f254f2a5fe2a39f1cbe42d033a219ffdd24d85d3 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Thu, 9 Aug 2012 15:57:51 +0000 Subject: [PATCH 0887/1057] Add default configuration example to mod_speex/conf/autoload_configs --- .../conf/autoload_configs/speex.conf.xml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/mod/codecs/mod_speex/conf/autoload_configs/speex.conf.xml diff --git a/src/mod/codecs/mod_speex/conf/autoload_configs/speex.conf.xml b/src/mod/codecs/mod_speex/conf/autoload_configs/speex.conf.xml new file mode 100644 index 0000000000..220229037a --- /dev/null +++ b/src/mod/codecs/mod_speex/conf/autoload_configs/speex.conf.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f044f4625034319693f6dd81645483c4a4a9be7c Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 9 Aug 2012 11:56:29 -0500 Subject: [PATCH 0888/1057] add apr stub to get the real OS socket --- src/include/switch_apr.h | 1 + src/include/switch_types.h | 8 ++++++++ src/switch_apr.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index e7a41d03d9..bd19353991 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -1443,6 +1443,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollset(switch_pollfd_t ** */ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **pollfd, switch_socket_t *sock, int16_t flags, void *client_data, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *p); +SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock); SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock); /** diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b4ec368021..696078a06e 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1784,6 +1784,14 @@ typedef enum { SSH_FLAG_STICKY = (1 << 0) } switch_state_handler_flag_t; +#ifdef WIN32 +typedef SOCKET apr_os_sock_t; +#else +typedef int apr_os_sock_t; +#endif + +typedef apr_os_sock_t switch_os_socket_t; + typedef struct apr_pool_t switch_memory_pool_t; typedef uint16_t switch_port_t; typedef uint8_t switch_payload_t; diff --git a/src/switch_apr.c b/src/switch_apr.c index 5936c7223e..c854c97617 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -665,6 +665,11 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre /* socket stubs */ +SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock) +{ + return apr_os_sock_get(thesock, sock); +} + SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock) { return apr_socket_addr_get(sa, (apr_interface_e) remote, sock); From 6e8736bb0609c6633adc1ac6abf7f6caf2a8be58 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 9 Aug 2012 13:42:21 -0500 Subject: [PATCH 0889/1057] FS-4504 vs2008 pro still need express --- Freeswitch.2008.sln | 32 ++ libs/spandsp/src/libspandsp.2008.vcproj | 28 +- libs/win32/Download libjpeg.2008.vcproj | 97 +++++ libs/win32/libjpeg/libjpeg.2008.vcproj | 531 ++++++++++++++++++++++++ 4 files changed, 676 insertions(+), 12 deletions(-) create mode 100644 libs/win32/Download libjpeg.2008.vcproj create mode 100644 libs/win32/libjpeg/libjpeg.2008.vcproj diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 781fdcb766..62b24591a7 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -718,6 +718,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libs\spandsp\src EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2008.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}" ProjectSection(ProjectDependencies) = postProject + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A} = {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A} {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838} {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330} {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} @@ -960,6 +961,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsmopen", "src\mod\endp EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsmlib", "src\mod\endpoints\mod_gsmopen\gsmlib\gsmlib-1.10-patched-13ubuntu\win32\gsmlib.vcproj", "{26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libs\win32\libjpeg\libjpeg.2008.vcproj", "{FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}" + ProjectSection(ProjectDependencies) = postProject + {21A7DA70-555E-49FA-942B-D84A38B61243} = {21A7DA70-555E-49FA-942B-D84A38B61243} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download libjpeg", "libs\win32\Download libjpeg.2008.vcproj", "{21A7DA70-555E-49FA-942B-D84A38B61243}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2719,6 +2727,28 @@ Global {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Debug|x64.ActiveCfg = Debug|x64 {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|Win32.ActiveCfg = Release|Win32 {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|x64.ActiveCfg = Release|x64 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.All|Win32.ActiveCfg = Debug|x64 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.All|x64.ActiveCfg = Debug|x64 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.All|x64.Build.0 = Debug|x64 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Debug|Win32.ActiveCfg = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Debug|Win32.Build.0 = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Debug|x64.ActiveCfg = Debug|x64 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Debug|x64.Build.0 = Debug|x64 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Release|Win32.ActiveCfg = Release|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Release|Win32.Build.0 = Release|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Release|x64.ActiveCfg = Release|x64 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Release|x64.Build.0 = Release|x64 + {21A7DA70-555E-49FA-942B-D84A38B61243}.All|Win32.ActiveCfg = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.All|Win32.Build.0 = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.All|x64.ActiveCfg = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Debug|Win32.ActiveCfg = Debug|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Debug|Win32.Build.0 = Debug|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Debug|x64.ActiveCfg = Debug|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Debug|x64.Build.0 = Debug|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Release|Win32.ActiveCfg = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Release|Win32.Build.0 = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Release|x64.ActiveCfg = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Release|x64.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2845,6 +2875,7 @@ Global {B376D494-D7DD-4B2A-99E2-52916D5A8CD8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {23B4D303-79FC-49E0-89E2-2280E7E28940} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A} = {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} @@ -2863,6 +2894,7 @@ Global {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19} = {C120A020-773F-4EA3-923F-B67AF28B750D} {B808178B-82F0-4CF4-A2B1-921939FA24D0} = {C120A020-773F-4EA3-923F-B67AF28B750D} {D578E676-7EC8-4548-BD8B-845C635F14AD} = {C120A020-773F-4EA3-923F-B67AF28B750D} + {21A7DA70-555E-49FA-942B-D84A38B61243} = {C120A020-773F-4EA3-923F-B67AF28B750D} {988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} diff --git a/libs/spandsp/src/libspandsp.2008.vcproj b/libs/spandsp/src/libspandsp.2008.vcproj index cf68451ede..4ed0560d5e 100644 --- a/libs/spandsp/src/libspandsp.2008.vcproj +++ b/libs/spandsp/src/libspandsp.2008.vcproj @@ -45,7 +45,7 @@
+ + @@ -699,11 +703,11 @@ Name="Header Files" > - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/win32/libjpeg/libjpeg.2008.vcproj b/libs/win32/libjpeg/libjpeg.2008.vcproj new file mode 100644 index 0000000000..881078ca9b --- /dev/null +++ b/libs/win32/libjpeg/libjpeg.2008.vcproj @@ -0,0 +1,531 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 75abcd20995713c1b325b2169b40198981d9812d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 9 Aug 2012 16:27:15 -0500 Subject: [PATCH 0890/1057] fix build --- src/include/switch_types.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 696078a06e..381ab22012 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1785,13 +1785,11 @@ typedef enum { } switch_state_handler_flag_t; #ifdef WIN32 -typedef SOCKET apr_os_sock_t; +typedef SOCKET switch_os_socket_t; #else -typedef int apr_os_sock_t; +typedef int switch_os_socket_t; #endif -typedef apr_os_sock_t switch_os_socket_t; - typedef struct apr_pool_t switch_memory_pool_t; typedef uint16_t switch_port_t; typedef uint8_t switch_payload_t; From 72f1d392fb71f5890e40a27c269cb23f55ff60cc Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 9 Aug 2012 21:39:28 -0600 Subject: [PATCH 0891/1057] FS-4504 --resolve --- Freeswitch.2008.express.sln | 26 ++++++++++++++++++++++++++ Freeswitch.2010.express.sln | 28 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Freeswitch.2008.express.sln b/Freeswitch.2008.express.sln index cd0033bba2..c077efb7ff 100644 --- a/Freeswitch.2008.express.sln +++ b/Freeswitch.2008.express.sln @@ -542,6 +542,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lcr", "src\mod\applicat EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2008.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}" ProjectSection(ProjectDependencies) = postProject + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A} = {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A} {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838} {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330} {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} @@ -667,6 +668,13 @@ 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.2008.vcproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download libjpeg", "libs\win32\Download libjpeg.2008.vcproj", "{21A7DA70-555E-49FA-942B-D84A38B61243}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libs\win32\libjpeg\libjpeg.2008.vcproj", "{FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}" + ProjectSection(ProjectDependencies) = postProject + {21A7DA70-555E-49FA-942B-D84A38B61243} = {21A7DA70-555E-49FA-942B-D84A38B61243} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2138,6 +2146,24 @@ 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 + {21A7DA70-555E-49FA-942B-D84A38B61243}.All|Win32.ActiveCfg = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.All|Win32.Build.0 = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.All|x64.ActiveCfg = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Debug|Win32.ActiveCfg = Debug|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Debug|Win32.Build.0 = Debug|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Debug|x64.ActiveCfg = Debug|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Release|Win32.ActiveCfg = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Release|Win32.Build.0 = Release|Win32 + {21A7DA70-555E-49FA-942B-D84A38B61243}.Release|x64.ActiveCfg = Release|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.All|Win32.ActiveCfg = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.All|Win32.Build.0 = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.All|x64.ActiveCfg = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Debug|Win32.ActiveCfg = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Debug|Win32.Build.0 = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Debug|x64.ActiveCfg = Debug|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Release|Win32.ActiveCfg = Release|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Release|Win32.Build.0 = Release|Win32 + {FE02CD06-DD97-489C-8F61-B5E7F89BCC0A}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index baea4a0c35..6833f61bc3 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -219,6 +219,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lcr", "src\mod\applications\mod_lcr\mod_lcr.2010.vcxproj", "{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2010.vcxproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}" + ProjectSection(ProjectDependencies) = postProject + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\speex\win32\VS2008\libspeex\libspeex.vcxproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}" EndProject @@ -322,6 +325,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre Generate pcre_chart EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libs\libzrtp\projects\win\libzrtp.2010.vcxproj", "{C13CC324-0032-4492-9A30-310A6BD64FF5}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download libjpeg", "libs\win32\Download libjpeg.2010.vcxproj", "{652AD5F7-8488-489F-AAD0-7FBE064703B6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libs\win32\libjpeg\libjpeg.2010.vcxproj", "{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}" + ProjectSection(ProjectDependencies) = postProject + {652AD5F7-8488-489F-AAD0-7FBE064703B6} = {652AD5F7-8488-489F-AAD0-7FBE064703B6} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2002,6 +2012,24 @@ Global {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|Win32.Build.0 = Release|Win32 {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64.ActiveCfg = Release|x64 {C13CC324-0032-4492-9A30-310A6BD64FF5}.Release|x64.Build.0 = Release|x64 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.Build.0 = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|x64.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.ActiveCfg = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.Build.0 = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64.ActiveCfg = Debug|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.ActiveCfg = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.Build.0 = Release|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|Win32.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|Win32.Build.0 = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.All|x64.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|Win32.Build.0 = Debug|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Debug|x64.ActiveCfg = Debug|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|Win32.ActiveCfg = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|Win32.Build.0 = Release|Win32 + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 659c06d356b248b7e232e43f97226c7b1761d868 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 10 Aug 2012 07:47:10 -0500 Subject: [PATCH 0892/1057] FS-4219 -- resolve windows version string. thanks Peter --- libs/win32/util.vbs | 68 +++++++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/libs/win32/util.vbs b/libs/win32/util.vbs index 4f13e21ad0..a6f3cf835d 100644 --- a/libs/win32/util.vbs +++ b/libs/win32/util.vbs @@ -314,6 +314,31 @@ Function GetTimeUTC() End Function +Function GetWeekDay(DateTime) + + DayOfWeek = DatePart("w", DateTime) + + Select Case DayOfWeek + Case 1 GetWeekDay = "Sun" + Case 2 GetWeekDay = "Mon" + Case 3 GetWeekDay = "Tue" + Case 4 GetWeekDay = "Wed" + Case 5 GetWeekDay = "Thu" + Case 6 GetWeekDay = "Fri" + Case 7 GetWeekDay = "Sat" + End Select + +End Function + +Function GetMonthName(DateTime) + + Val = MonthName(Month(DateTime), True) + Val = UCase(Left(Val, 1)) & Mid(Val, 2, 4) + + GetMonthName = Val + +End Function + Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) Dim oExec @@ -321,6 +346,7 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) strVerMinor = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MINOR") strVerMicro = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MICRO") strVerRev = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION") + strVerHuman = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION_HUMAN") 'Set version to the one reported by configure.in If strVerRev <> "" Then @@ -329,6 +355,7 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) Dim sLastFile Const ForReading = 1 + Const ShowUnclean = False 'Don't show unclean state for now 'Try To read revision from git If FSO.FolderExists(VersionDir & ".git") Then @@ -337,30 +364,38 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) If IsNumeric(strFromProc) Then lastChangedDateTime = DateAdd("s", strFromProc, "01/01/1970 00:00:00") strLastCommit = YEAR(lastChangedDateTime) & Pd(Month(lastChangedDateTime), 2) & Pd(DAY(lastChangedDateTime), 2) & "T" & Pd(Hour(lastChangedDateTime), 2) & Pd(Minute(lastChangedDateTime), 2) & Pd(Second(lastChangedDateTime), 2) & "Z" + strLastCommitHuman = GetWeekDay(lastChangedDateTime) & ", " & Pd(DAY(lastChangedDateTime), 2) & " " & GetMonthName(lastChangedDateTime) & " " & YEAR(lastChangedDateTime) & " " & Pd(Hour(lastChangedDateTime), 2) & ":" & Pd(Minute(lastChangedDateTime), 2) & ":" & Pd(Second(lastChangedDateTime), 2) & " Z" Else - strLastCommit = "UNKNOWN" + strLastCommit = "" + strLastCommitHuman = "" End If 'Get revision hash strRevision = ExecAndGetResult(tmpFolder, VersionDir, "git rev-list -n1 --abbrev=10 --abbrev-commit HEAD") - If strRevision = "" Then - strRevision = "UNKNOWN" - End If + If strLastCommit <> "" And strLastCommitHuman <> "" And strRevision <> "" Then + 'Bild version string + strGitVer = "git~" & strLastCommit & "~" & strRevision + strVerHuman = "; git at commit " & strRevision & " on " & strLastCommitHuman - 'Bild version string - strGitVer="git~" & strLastCommit & "~" & strRevision - - 'Check for local changes, if found, append to git revision string - If ExecAndGetExitCode(tmpFolder, VersionDir, "git diff-index --quiet HEAD") <> 0 Then - lastChangedDateTime = GetTimeUTC() - strGitVer = strGitVer & "+unclean~" & YEAR(lastChangedDateTime) & Pd(Month(lastChangedDateTime), 2) & Pd(DAY(lastChangedDateTime), 2) & "T" & Pd(Hour(lastChangedDateTime), 2) & Pd(Minute(lastChangedDateTime), 2) & Pd(Second(lastChangedDateTime), 2) & "Z" + 'Check for local changes, if found, append to git revision string + If ShowUnclean Then + If ExecAndGetExitCode(tmpFolder, VersionDir, "git diff-index --quiet HEAD") <> 0 Then + lastChangedDateTime = GetTimeUTC() + strGitVer = strGitVer & "+unclean~" & YEAR(lastChangedDateTime) & Pd(Month(lastChangedDateTime), 2) & Pd(DAY(lastChangedDateTime), 2) & "T" & Pd(Hour(lastChangedDateTime), 2) & Pd(Minute(lastChangedDateTime), 2) & Pd(Second(lastChangedDateTime), 2) & "Z" + End If + End If + Else + strGitVer = "" + strVerHuman = "" End If If strVerRev = "" Then VERSION=strGitVer Else - VERSION=VERSION & "+" & strGitVer + If strGitVer <> "" Then + VERSION=VERSION & "+" & strGitVer + End If End If sLastVersion = "" @@ -371,13 +406,9 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) sLastFile.Close End If - If VERSION = "" Then - VERSION = "-UNKNOWN" - End If - - If VERSION <> sLastVersion Then + If VERSION & " " & strVerHuman <> sLastVersion Then Set MyFile = fso.CreateTextFile(tmpFolder & "lastversion", True) - MyFile.WriteLine(VERSION) + MyFile.WriteLine(VERSION & " " & strVerHuman) MyFile.Close FSO.CopyFile includebase, includedest, true @@ -385,6 +416,7 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) FindReplaceInFile includedest, "@SWITCH_VERSION_MAJOR@", strVerMajor FindReplaceInFile includedest, "@SWITCH_VERSION_MINOR@", strVerMinor FindReplaceInFile includedest, "@SWITCH_VERSION_MICRO@", strVerMicro + FindReplaceInFile includedest, "@SWITCH_VERSION_REVISION_HUMAN@", strVerHuman End If End Sub From 036063d2a9ed56eb123acc77c2a7d1d9c733263d Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Wed, 8 Aug 2012 17:30:03 +0200 Subject: [PATCH 0893/1057] mod_freetdm: Fix typo. Signed-off-by: Stefan Knoblich --- 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 64d34f232c..2f66edd019 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -864,7 +864,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc 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 note ready) in channel %s device %d:%d!\n", name, span_id, chan_id); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write not ready) in channel %s device %d:%d!\n", name, span_id, chan_id); return SWITCH_STATUS_SUCCESS; } From 2ad2b6d31bf201b0779a5c217039860e2e009395 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 10 Aug 2012 17:05:46 +0200 Subject: [PATCH 0894/1057] ftmod_isdn: Avoid stack smashing buffer overflow in isdn_tones_run(). The len variable can, in certain situations (large burst of incoming non-SLIN audio), exceed the size of the on-stack frame buffer, which causes ftdm_buffer_read_loop() to overwrite the dt_buffer pointer. Use ftdm_min() to make sure len (after conversion to SLIN units) isn't larger than the frame buffer size. Also adds are couple more code comments. Signed-off-by: Stefan Knoblich --- .../freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 11139f7fb4..99ff253835 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1936,6 +1936,11 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) continue; } + /* + * Teletone operates on SLIN data (2 bytes per sample). + * Convert the length of non-SLIN codecs, so we read + * the right amount of samples from the buffer. + */ if (chan->effective_codec != FTDM_CODEC_SLIN) { len *= 2; } @@ -1943,6 +1948,12 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) /* seek to current offset */ ftdm_buffer_seek(dt_buffer, data->offset); + /* + * ftdm_channel_read() can read up to sizeof(frame) bytes + * (in certain situations). Avoid overflowing the stack (and smashing dt_buffer) + * if the codec is not slin and we had to double the length. + */ + len = ftdm_min(len, sizeof(frame)); rlen = ftdm_buffer_read_loop(dt_buffer, frame, len); if (chan->effective_codec != FTDM_CODEC_SLIN) { @@ -1954,6 +1965,12 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) codec_func = fio_slin2alaw; } + /* + * Convert SLIN to native format (a-law/u-law), + * input size is 2 bytes per sample, output size + * (after conversion) is one byte per sample + * (= max. half the input size). + */ if (codec_func) { status = codec_func(frame, sizeof(frame), &rlen); } else { @@ -1968,11 +1985,12 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) * of data actually written to channel. */ if (chan->effective_codec != FTDM_CODEC_SLIN) { - data->offset += rlen << 1; /* teletone buffer is slin (= len * 2) */ + data->offset += rlen << 1; /* Teletone buffer is in SLIN (= rlen * 2) */ } else { data->offset += rlen; } + /* Limit offset to [0..Rate(Samples/s)-1] in SLIN (2 bytes per sample) units. */ data->offset %= (ts.rate << 1); } } From 618392299b831f09b683f2e98c0d93b5b6ef342e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 10 Aug 2012 20:12:20 -0500 Subject: [PATCH 0895/1057] add javascript chatplan app --- .../mod_spidermonkey/mod_spidermonkey.c | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 83e723e061..7ba7975e98 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -3628,7 +3628,7 @@ static int env_init(JSContext * cx, JSObject * javascript_object) return 1; } -static void js_parse_and_execute(switch_core_session_t *session, const char *input_code, struct request_obj *ro) +static void js_parse_and_execute(switch_core_session_t *session, const char *input_code, struct request_obj *ro, switch_event_t *message) { JSObject *javascript_global_object = NULL; char buf[1024], *arg, *argv[512]; @@ -3657,6 +3657,12 @@ static void js_parse_and_execute(switch_core_session_t *session, const char *inp if (!(session && new_js_session(cx, javascript_global_object, session, &jss, "session", flags))) { switch_snprintf(buf, sizeof(buf), "~var session = false;"); eval_some_js(buf, cx, javascript_global_object, &rval); + + if (message) { + new_js_event(message, "message", cx, javascript_global_object); + } + + } if (ro) { new_request(cx, javascript_global_object, ro); @@ -3704,7 +3710,16 @@ static void js_parse_and_execute(switch_core_session_t *session, const char *inp SWITCH_STANDARD_APP(js_dp_function) { - js_parse_and_execute(session, data, NULL); + js_parse_and_execute(session, data, NULL, NULL); +} + +SWITCH_STANDARD_CHAT_APP(js_chat_function) +{ + + js_parse_and_execute(NULL, data, NULL, message); + + return SWITCH_STATUS_SUCCESS; + } struct js_task { @@ -3717,7 +3732,7 @@ static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t *thread, void *obj struct js_task *task = (struct js_task *) obj; switch_memory_pool_t *pool; - js_parse_and_execute(NULL, task->code, NULL); + js_parse_and_execute(NULL, task->code, NULL, NULL); if ((pool = task->pool)) { switch_core_destroy_memory_pool(&pool); @@ -3775,7 +3790,7 @@ SWITCH_STANDARD_API(jsapi_function) ro.session = session; ro.stream = stream; - js_parse_and_execute(session, (char *) cmd, &ro); + js_parse_and_execute(session, (char *) cmd, &ro, NULL); return SWITCH_STATUS_SUCCESS; } @@ -3795,6 +3810,8 @@ SWITCH_STANDARD_API(launch_async) SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load) { switch_application_interface_t *app_interface; + switch_chat_application_interface_t *chat_app_interface; + //switch_status_t status; //if ((status = init_js()) != SWITCH_STATUS_SUCCESS) { @@ -3812,6 +3829,8 @@ 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, "

y?NWl|-xxOBP>;aWs+( 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�tXTZ`Nv+9T#Ymn-Q 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‰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�$k_J@TZ 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 From d642c2c1a6a30b1298d29cbd0be39be7aed3f418 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Apr 2012 12:16:53 -0500 Subject: [PATCH 0036/1057] add loopback_initial_codec variable to specifiy the codec of a one legeded loopback channel --- src/include/switch_loadable_module.h | 2 ++ src/mod/endpoints/mod_loopback/mod_loopback.c | 13 +++++++++++-- src/switch_loadable_module.c | 6 +++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index 62fcac2343..f1fde8d7d6 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -115,6 +115,8 @@ SWITCH_DECLARE(switch_endpoint_interface_t *) switch_loadable_module_get_endpoin */ SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name); +SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit); + /*! \brief Retrieve the dialplan interface by it's registered name \param name the name of the dialplan diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index b333cebda9..9ad780f838 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -122,8 +122,8 @@ static void clear_queue(private_t *tech_pvt) static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session, switch_codec_t *codec) { const char *iananame = "L16"; - int rate = 8000; - int interval = 20; + uint32_t rate = 8000; + uint32_t interval = 20; switch_status_t status = SWITCH_STATUS_SUCCESS; switch_channel_t *channel = switch_core_session_get_channel(session); const switch_codec_implementation_t *read_impl; @@ -132,6 +132,15 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses iananame = codec->implementation->iananame; rate = codec->implementation->samples_per_second; interval = codec->implementation->microseconds_per_packet / 1000; + } else { + const char *var; + + if ((var = switch_channel_get_variable(channel, "loopback_initial_codec"))) { + char *dup = switch_core_session_strdup(session, var); + uint32_t bit; + iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit); + } + } if (switch_core_codec_ready(&tech_pvt->read_codec)) { diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 812afe785b..51f343a70e 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -2075,7 +2075,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme } -char *parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit) +SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit) { char *cur, *next = NULL, *name, *p; @@ -2119,7 +2119,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ uint32_t interval = 0, rate = 0, bit = 0; switch_copy_string(buf, prefs[x], sizeof(buf)); - name = parse_codec_buf(buf, &interval, &rate, &bit); + name = switch_parse_codec_buf(buf, &interval, &rate, &bit); for(j = 0; j < x; j++) { char *jname; @@ -2135,7 +2135,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ } switch_copy_string(jbuf, prefs[j], sizeof(jbuf)); - jname = parse_codec_buf(jbuf, &jinterval, &jrate, &jbit); + jname = switch_parse_codec_buf(jbuf, &jinterval, &jrate, &jbit); if (jinterval == 0) { jinterval = switch_default_ptime(jname, 0); From d5766ceaa05b4cd4583b248133886951e8b76f67 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Apr 2012 13:25:21 -0500 Subject: [PATCH 0037/1057] FS-4115 --resolve this should fix it in all circumstances --- src/switch_core_media_bug.c | 37 +++++++++++++++++++++++++------------ src/switch_core_session.c | 5 +++++ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 52151b9681..f5d14137b7 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -129,7 +129,6 @@ SWITCH_DECLARE(void) switch_core_media_bug_flush(switch_media_bug_t *bug) bug->record_frame_size = 0; bug->record_pre_buffer_count = 0; - } SWITCH_DECLARE(void) switch_core_media_bug_inuse(switch_media_bug_t *bug, switch_size_t *readp, switch_size_t *writep) @@ -207,7 +206,31 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b bug->record_pre_buffer_count++; return SWITCH_STATUS_FALSE; } - + + if (!bug->record_frame_size) { + if (do_read && do_write) { + switch_size_t frame_size; + switch_codec_implementation_t read_impl = { 0 }; + switch_codec_implementation_t other_read_impl = { 0 }; + switch_core_session_t *other_session; + + switch_core_session_get_read_impl(bug->session, &read_impl); + frame_size = read_impl.decoded_bytes_per_packet; + + if (switch_core_session_get_partner(bug->session, &other_session) == SWITCH_STATUS_SUCCESS) { + switch_core_session_get_read_impl(other_session, &other_read_impl); + switch_core_session_rwunlock(other_session); + + if (read_impl.decoded_bytes_per_packet < other_read_impl.decoded_bytes_per_packet) { + frame_size = other_read_impl.decoded_bytes_per_packet; + } + } + + bug->record_frame_size = frame_size; + } + } + + if (bug->record_frame_size) { if ((do_read && do_read < bug->record_frame_size) || (do_write && do_write < bug->record_frame_size)) { return SWITCH_STATUS_FALSE; @@ -220,16 +243,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b if (do_write && do_write > bug->record_frame_size) { do_write = bug->record_frame_size; } - } else { - if (do_read && do_write) { - if (do_read > do_write) { - do_read = do_write; - } else if (do_write > do_read) { - do_write = do_read; - } - - bug->record_frame_size = do_read; - } } fill_read = !do_read; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index f42104bdc3..6551158522 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -724,11 +724,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit } } + message->_file = NULL; message->_func = NULL; message->_line = 0; if (switch_channel_up_nosig(session->channel)) { + if (message->message_id == SWITCH_MESSAGE_INDICATE_BRIDGE || message->message_id == SWITCH_MESSAGE_INDICATE_UNBRIDGE) { + switch_core_media_bug_flush_all(session); + } + switch (message->message_id) { case SWITCH_MESSAGE_REDIRECT_AUDIO: case SWITCH_MESSAGE_INDICATE_ANSWER: From 0ec4e826641a05405303342f836d86b9258c919e Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 24 Apr 2012 04:00:43 +0000 Subject: [PATCH 0038/1057] getsounds.sh: look for a locally-cached copy first This lets you specify a FS_SOUNDS_DIR in which to look for the sound tarballs. This makes it easier to use git clean -fdx without downloading the sounds every time. --- build/getsounds.sh.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/build/getsounds.sh.in b/build/getsounds.sh.in index 09105fd280..c4a434ad28 100755 --- a/build/getsounds.sh.in +++ b/build/getsounds.sh.in @@ -23,10 +23,15 @@ pwd echo "# $0 $1 $2" if [ ! -f $tarfile ] ; then - $DOWNLOAD_CMD $base$tarfile - if [ ! -f $tarfile ] ; then - echo cannot find $tarfile - exit 1 + if [ -f $FS_SOUNDS_DIR/$tarfile ]; then + test ! cp -l $FS_SOUNDS_DIR/$tarfile . \ + || cp $FS_SOUNDS_DIR/$tarfile . + else + $DOWNLOAD_CMD $base$tarfile + if [ ! -f $tarfile ] ; then + echo cannot find $tarfile + exit 1 + fi fi fi From a3367b2da2672bf07eb7924c4704019eff88d23b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 24 Apr 2012 04:42:36 +0000 Subject: [PATCH 0039/1057] getsounds.sh: adjust last commit --- build/getsounds.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/getsounds.sh.in b/build/getsounds.sh.in index c4a434ad28..f25922c7ef 100755 --- a/build/getsounds.sh.in +++ b/build/getsounds.sh.in @@ -24,7 +24,7 @@ echo "# $0 $1 $2" if [ ! -f $tarfile ] ; then if [ -f $FS_SOUNDS_DIR/$tarfile ]; then - test ! cp -l $FS_SOUNDS_DIR/$tarfile . \ + cp -l $FS_SOUNDS_DIR/$tarfile . \ || cp $FS_SOUNDS_DIR/$tarfile . else $DOWNLOAD_CMD $base$tarfile From fbbbd06e28afc1a2008802abf7664cc8052ab433 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Tue, 24 Apr 2012 14:31:39 +0200 Subject: [PATCH 0040/1057] gsmopen: send out those pesky DTMFs --- src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp | 2 +- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index e422c9570b..2b90706d8c 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -2660,7 +2660,7 @@ int gsmopen_senddigit(private_t *tech_pvt, char digit) char at_command[256]; memset(at_command, '\0', 256); - sprintf(at_command, "%s=\"%c\"", tech_pvt->at_send_dtmf, digit); + sprintf(at_command, "%s=1,%c", tech_pvt->at_send_dtmf, digit); res = gsmopen_serial_write_AT_ack(tech_pvt, at_command); if (res) { ERRORA("senddigit command failed, command used: '%s=\"%c\"', giving up\n", GSMOPEN_P_LOG, tech_pvt->at_send_dtmf, digit); diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 8ccfeda0ae..d9a5668e80 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1190,7 +1190,7 @@ static switch_status_t load_config(int reload_type) const char *at_hangup_expect = "OK"; const char *at_answer = "ATA"; const char *at_answer_expect = "OK"; - const char *at_send_dtmf = "AT+VTS"; + const char *at_send_dtmf = "AT^DTMF"; const char *at_preinit_1 = ""; const char *at_preinit_1_expect = ""; const char *at_preinit_2 = ""; From 273aa89423e84fd59008965c2c55d64ec0c7969e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 24 Apr 2012 07:46:06 -0500 Subject: [PATCH 0041/1057] set uniq header flag --- src/mod/applications/mod_httapi/mod_httapi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index bc1731d21e..9d5b8003a5 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2161,6 +2161,7 @@ SWITCH_STANDARD_APP(httapi_function) if (!zstr(url) && switch_stristr("://", url)) { if (!params) { switch_event_create(¶ms, SWITCH_EVENT_CLONE); + params->flags |= EF_UNIQ_HEADERS; } switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "url", url); } From 2a25c4f2e70208a4e76df3e9f3668a7b1742ea30 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Tue, 24 Apr 2012 16:30:12 +0200 Subject: [PATCH 0042/1057] gsmopen: AT commands cosmetics --- src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 2b90706d8c..b59860356d 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -2218,7 +2218,7 @@ int gsmopen_serial_hangup_AT(private_t *tech_pvt) res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CHUP"); if (res) { - ERRORA("at_hangup command failed, command used: 'AT+CHUP'\n", GSMOPEN_P_LOG); + DEBUGA_GSMOPEN("at_hangup command timeout, command used: 'AT+CHUP'\n", GSMOPEN_P_LOG); //return -1; } @@ -2663,7 +2663,7 @@ int gsmopen_senddigit(private_t *tech_pvt, char digit) sprintf(at_command, "%s=1,%c", tech_pvt->at_send_dtmf, digit); res = gsmopen_serial_write_AT_ack(tech_pvt, at_command); if (res) { - ERRORA("senddigit command failed, command used: '%s=\"%c\"', giving up\n", GSMOPEN_P_LOG, tech_pvt->at_send_dtmf, digit); + DEBUGA_GSMOPEN("XXX answer (OK) takes long to come, goes into timeout. command used: '%s=1,%c'\n", GSMOPEN_P_LOG, tech_pvt->at_send_dtmf, digit); } } From d79982e72cc8070fc53ee2b95eadbc3344ebb2a8 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Wed, 25 Apr 2012 00:18:56 +0000 Subject: [PATCH 0043/1057] added SSL support to mod_http_cache --- .../conf/autoload_configs/http_cache.conf.xml | 3 + .../mod_http_cache/conf/cacert.pem | 3366 +++++++++++++++++ .../mod_http_cache/mod_http_cache.c | 62 +- 3 files changed, 3422 insertions(+), 9 deletions(-) create mode 100644 src/mod/applications/mod_http_cache/conf/cacert.pem diff --git a/src/mod/applications/mod_http_cache/conf/autoload_configs/http_cache.conf.xml b/src/mod/applications/mod_http_cache/conf/autoload_configs/http_cache.conf.xml index 4150d6472e..d4b5475ec9 100644 --- a/src/mod/applications/mod_http_cache/conf/autoload_configs/http_cache.conf.xml +++ b/src/mod/applications/mod_http_cache/conf/autoload_configs/http_cache.conf.xml @@ -3,6 +3,9 @@ + + + diff --git a/src/mod/applications/mod_http_cache/conf/cacert.pem b/src/mod/applications/mod_http_cache/conf/cacert.pem new file mode 100644 index 0000000000..72e14177c9 --- /dev/null +++ b/src/mod/applications/mod_http_cache/conf/cacert.pem @@ -0,0 +1,3366 @@ +## +## ca-bundle.crt -- Bundle of CA Root Certificates +## +## Certificate data from Mozilla as of: Sun Feb 19 04:03:37 2012 +## +## This is a bundle of X.509 certificates of public Certificate Authorities +## (CA). These were automatically extracted from Mozilla's root certificates +## file (certdata.txt). This file can be found in the mozilla source tree: +## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1 +## +## It contains the certificates in PEM format and therefore +## can be directly used with curl / libcurl / php_curl, or with +## an Apache+mod_ssl webserver for SSL client authentication. +## Just configure this file as the SSLCACertificateFile. +## + +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.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 the Netscape security libraries. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1994-2000 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +# @(#) $RCSfile: certdata.txt,v $ $Revision: 1.82 $ $Date: 2012/02/18 21:41:46 $ + +GTE CyberTrust Global Root +========================== +-----BEGIN CERTIFICATE----- +MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUg +Q29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEG +A1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEz +MjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQL +Ex5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0 +IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4u +sJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcql +HHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8FLztimQID +AQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMW +M4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OF +NMQkpw0PlZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ +-----END CERTIFICATE----- + +Thawte Server CA +================ +-----BEGIN CERTIFICATE----- +MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT +DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs +dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UE +AxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5j +b20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNV +BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29u +c3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcG +A1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0 +ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl +/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg7 +1CcEJRCXL+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzAR +MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9J +GubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZ +GCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc= +-----END CERTIFICATE----- + +Thawte Premium Server CA +======================== +-----BEGIN CERTIFICATE----- +MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT +DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs +dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE +AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl +ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT +AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU +VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2 +aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ +cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2 +aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh +Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/ +qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm +SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf +8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t +UCemDaYj+bvLpgcUQg== +-----END CERTIFICATE----- + +Equifax Secure CA +================= +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE +ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 +MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT +B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB +nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR +fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW +8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG +A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE +CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG +A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS +spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB +Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961 +zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB +BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95 +70+sB3c4 +-----END CERTIFICATE----- + +Digital Signature Trust Co. Global CA 1 +======================================= +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIENnAVljANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJVUzEkMCIGA1UE +ChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQLEwhEU1RDQSBFMTAeFw05ODEy +MTAxODEwMjNaFw0xODEyMTAxODQwMjNaMEYxCzAJBgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFs +IFNpZ25hdHVyZSBUcnVzdCBDby4xETAPBgNVBAsTCERTVENBIEUxMIGdMA0GCSqGSIb3DQEBAQUA +A4GLADCBhwKBgQCgbIGpzzQeJN3+hijM3oMv+V7UQtLodGBmE5gGHKlREmlvMVW5SXIACH7TpWJE +NySZj9mDSI+ZbZUTu0M7LklOiDfBu1h//uG9+LthzfNHwJmm8fOR6Hh8AMthyUQncWlVSn5JTe2i +o74CTADKAqjuAQIxZA9SLRN0dja1erQtcQIBA6OCASQwggEgMBEGCWCGSAGG+EIBAQQEAwIABzBo +BgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0 +dXJlIFRydXN0IENvLjERMA8GA1UECxMIRFNUQ0EgRTExDTALBgNVBAMTBENSTDEwKwYDVR0QBCQw +IoAPMTk5ODEyMTAxODEwMjNagQ8yMDE4MTIxMDE4MTAyM1owCwYDVR0PBAQDAgEGMB8GA1UdIwQY +MBaAFGp5fpFpRhgTCgJ3pVlbYJglDqL4MB0GA1UdDgQWBBRqeX6RaUYYEwoCd6VZW2CYJQ6i+DAM +BgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4GB +ACIS2Hod3IEGtgllsofIH160L+nEHvI8wbsEkBFKg05+k7lNQseSJqBcNJo4cvj9axY+IO6CizEq +kzaFI4iKPANo08kJD038bKTaKHKTDomAsH3+gG9lbRgzl4vCa4nuYD3Im+9/KzJic5PLPON74nZ4 +RbyhkwS7hp86W0N6w4pl +-----END CERTIFICATE----- + +Digital Signature Trust Co. Global CA 3 +======================================= +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIENm7TzjANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJVUzEkMCIGA1UE +ChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQLEwhEU1RDQSBFMjAeFw05ODEy +MDkxOTE3MjZaFw0xODEyMDkxOTQ3MjZaMEYxCzAJBgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFs +IFNpZ25hdHVyZSBUcnVzdCBDby4xETAPBgNVBAsTCERTVENBIEUyMIGdMA0GCSqGSIb3DQEBAQUA +A4GLADCBhwKBgQC/k48Xku8zExjrEH9OFr//Bo8qhbxe+SSmJIi2A7fBw18DW9Fvrn5C6mYjuGOD +VvsoLeE4i7TuqAHhzhy2iCoiRoX7n6dwqUcUP87eZfCocfdPJmyMvMa1795JJ/9IKn3oTQPMx7JS +xhcxEzu1TdvIxPbDDyQq2gyd55FbgM2UnQIBA6OCASQwggEgMBEGCWCGSAGG+EIBAQQEAwIABzBo +BgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0 +dXJlIFRydXN0IENvLjERMA8GA1UECxMIRFNUQ0EgRTIxDTALBgNVBAMTBENSTDEwKwYDVR0QBCQw +IoAPMTk5ODEyMDkxOTE3MjZagQ8yMDE4MTIwOTE5MTcyNlowCwYDVR0PBAQDAgEGMB8GA1UdIwQY +MBaAFB6CTShlgDzJQW6sNS5ay97u+DlbMB0GA1UdDgQWBBQegk0oZYA8yUFurDUuWsve7vg5WzAM +BgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4GB +AEeNg61i8tuwnkUiBbmi1gMOOHLnnvx75pO2mqWilMg0HZHRxdf0CiUPPXiBng+xZ8SQTGPdXqfi +up/1902lMXucKS1M/mQ+7LZT/uqb7YLbdHVLB3luHtgZg3Pe9T7Qtd7nS2h9Qy4qIOF+oHhEngj1 +mPnHfxsb1gYgAlihw6ID +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority +======================================================= +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx +FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5 +IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow +XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz +IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94 +f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol +hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA +TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah +WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf +Tqj/ZA1k +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority - G2 +============================================================ +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT +MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy +eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln +biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz +dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT +MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy +eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln +biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz +dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO +FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71 +lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB +MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT +1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD +Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9 +-----END CERTIFICATE----- + +GlobalSign Root CA +================== +-----BEGIN CERTIFICATE----- +MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx +GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds +b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV +BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD +VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa +DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc +THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb +Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP +c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX +gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF +AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj +Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG +j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH +hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC +X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== +-----END CERTIFICATE----- + +GlobalSign Root CA - R2 +======================= +-----BEGIN CERTIFICATE----- +MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv +YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh +bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT +aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln +bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6 +ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp +s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN +S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL +TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C +ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i +YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN +BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp +9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu +01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7 +9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 +TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== +-----END CERTIFICATE----- + +ValiCert Class 1 VA +=================== +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp +b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh +bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIy +MjM0OFoXDTE5MDYyNTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0 +d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEg +UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0 +LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9YLqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIi +GQj4/xEjm84H9b9pGib+TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCm +DuJWBQ8YTfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0LBwG +lN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLWI8sogTLDAHkY7FkX +icnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPwnXS3qT6gpf+2SQMT2iLM7XGCK5nP +Orf1LXLI +-----END CERTIFICATE----- + +ValiCert Class 2 VA +=================== +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp +b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh +bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw +MTk1NFoXDTE5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0 +d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIg +UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0 +LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDOOnHK5avIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVC +CSRrCl6zfN1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7Rf +ZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9vUJSZ +SWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTuIYEZoDJJKPTEjlbV +UjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8 +W9ViH0Pd +-----END CERTIFICATE----- + +RSA Root Certificate 1 +====================== +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp +b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh +bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw +MjIzM1oXDTE5MDYyNjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0 +d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMg +UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0 +LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDjmFGWHOjVsQaBalfDcnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td +3zZxFJmP3MKS8edgkpfs2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89H +BFx1cQqYJJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliEZwgs +3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJn0WuPIqpsHEzXcjF +V9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/APhmcGcwTTYJBtYze4D1gCCAPRX5r +on+jjBXu +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority - G3 +============================================================ +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV +UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv +cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy +dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv +cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1 +EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc +cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw +EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj +055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA +ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f +j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC +/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0 +xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa +t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== +-----END CERTIFICATE----- + +Verisign Class 4 Public Primary Certification Authority - G3 +============================================================ +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV +UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv +cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy +dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv +cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS +tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM +8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW +Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX +Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA +j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt +mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm +fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd +RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG +UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg== +-----END CERTIFICATE----- + +Entrust.net Secure Server CA +============================ +-----BEGIN CERTIFICATE----- +MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMCVVMxFDASBgNV +BAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5uZXQvQ1BTIGluY29ycC4gYnkg +cmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRl +ZDE6MDgGA1UEAxMxRW50cnVzdC5uZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhv +cml0eTAeFw05OTA1MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIG +A1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBi +eSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1p +dGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQ +aO2f55M28Qpku0f1BBc/I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5 +gXpa0zf3wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OCAdcw +ggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHboIHYpIHVMIHSMQsw +CQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5l +dC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF +bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENl +cnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu +dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0MFqBDzIwMTkw +NTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0Bow +HQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAaMAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EA +BAwwChsEVjQuMAMCBJAwDQYJKoZIhvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyN +Ewr75Ji174z4xRAN95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9 +n9cd2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= +-----END CERTIFICATE----- + +Entrust.net Premium 2048 Secure Server CA +========================================= +-----BEGIN CERTIFICATE----- +MIIEXDCCA0SgAwIBAgIEOGO5ZjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u +ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp +bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV +BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx +NzUwNTFaFw0xOTEyMjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3 +d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl +MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u +ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL +Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr +hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW +nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi +VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo3QwcjARBglghkgBhvhC +AQEEBAMCAAcwHwYDVR0jBBgwFoAUVeSB0RGAvtiJuQijMfmhJAkWuXAwHQYDVR0OBBYEFFXkgdER +gL7YibkIozH5oSQJFrlwMB0GCSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0B +AQUFAAOCAQEAWUesIYSKF8mciVMeuoCFGsY8Tj6xnLZ8xpJdGGQC49MGCBFhfGPjK50xA3B20qMo +oPS7mmNz7W3lKtvtFKkrxjYR0CvrB4ul2p5cGZ1WEvVUKcgF7bISKo30Axv/55IQh7A6tcOdBTcS +o8f0FbnVpDkWm1M6I5HxqIKiaohowXkCIryqptau37AUX7iH0N18f3v/rxzP5tsHrV7bhZ3QKw0z +2wTR5klAEyt2+z7pnIkPFc4YsIV4IU9rTw76NmfNB/L/CNDi3tm/Kq+4h4YhPATKt5Rof8886ZjX +OP/swNlQ8C5LWK5Gb9Auw2DaclVyvUxFnmG6v4SBkgPR0ml8xQ== +-----END CERTIFICATE----- + +Baltimore CyberTrust Root +========================= +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE +ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li +ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC +SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs +dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME +uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB +UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C +G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9 +XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr +l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI +VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB +BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh +cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5 +hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa +Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H +RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp +-----END CERTIFICATE----- + +Equifax Secure Global eBusiness CA +================================== +-----BEGIN CERTIFICATE----- +MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT +RXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBTZWN1cmUgR2xvYmFsIGVCdXNp +bmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIwMDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMx +HDAaBgNVBAoTE0VxdWlmYXggU2VjdXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEds +b2JhbCBlQnVzaW5lc3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRV +PEnCUdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc58O/gGzN +qfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/o5brhTMhHD4ePmBudpxn +hcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAHMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j +BBgwFoAUvqigdHJQa0S3ySPY+6j/s1draGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hs +MA0GCSqGSIb3DQEBBAUAA4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okEN +I7SS+RkAZ70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv8qIY +NMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV +-----END CERTIFICATE----- + +Equifax Secure eBusiness CA 1 +============================= +-----BEGIN CERTIFICATE----- +MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT +RXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENB +LTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQwMDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UE +ChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNz +IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ +1MRoRvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBuWqDZQu4a +IZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKwEnv+j6YDAgMBAAGjZjBk +MBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEp4MlIR21kW +Nl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRKeDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQF +AAOBgQB1W6ibAxHm6VZMzfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5 +lSE/9dR+WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN/Bf+ +KpYrtWKmpj29f5JZzVoqgrI3eQ== +-----END CERTIFICATE----- + +Equifax Secure eBusiness CA 2 +============================= +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIEN3DPtTANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEXMBUGA1UE +ChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2VjdXJlIGVCdXNpbmVzcyBDQS0y +MB4XDTk5MDYyMzEyMTQ0NVoXDTE5MDYyMzEyMTQ0NVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoT +DkVxdWlmYXggU2VjdXJlMSYwJAYDVQQLEx1FcXVpZmF4IFNlY3VyZSBlQnVzaW5lc3MgQ0EtMjCB +nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5Dk5kx5SBhsoNviyoynF7Y6yEb3+6+e0dMKP/wXn +2Z0GvxLIPw7y1tEkshHe0XMJitSxLJgJDR5QRrKDpkWNYmi7hRsgcDKqQM2mll/EcTc/BPO3QSQ5 +BxoeLmFYoBIL5aXfxavqN3HMHMg3OrmXUqesxWoklE6ce8/AatbfIb0CAwEAAaOCAQkwggEFMHAG +A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORXF1aWZheCBTZWN1cmUx +JjAkBgNVBAsTHUVxdWlmYXggU2VjdXJlIGVCdXNpbmVzcyBDQS0yMQ0wCwYDVQQDEwRDUkwxMBoG +A1UdEAQTMBGBDzIwMTkwNjIzMTIxNDQ1WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUUJ4L6q9e +uSBIplBqy/3YIHqngnYwHQYDVR0OBBYEFFCeC+qvXrkgSKZQasv92CB6p4J2MAwGA1UdEwQFMAMB +Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAAyGgq3oThr1 +jokn4jVYPSm0B482UJW/bsGe68SQsoWou7dC4A8HOd/7npCy0cE+U58DRLB+S/Rv5Hwf5+Kx5Lia +78O9zt4LMjTZ3ijtM2vE1Nc9ElirfQkty3D1E4qUoSek1nDFbZS1yX2doNLGCEnZZpum0/QL3MUm +V+GRMOrN +-----END CERTIFICATE----- + +AddTrust Low-Value Services Root +================================ +-----BEGIN CERTIFICATE----- +MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML +QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU +cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw +CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO +ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6 +54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr +oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1 +Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui +GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w +HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD +AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT +RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw +HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt +ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph +iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY +eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr +mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj +ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk= +-----END CERTIFICATE----- + +AddTrust External Root +====================== +-----BEGIN CERTIFICATE----- +MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML +QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD +VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw +NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU +cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg +Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821 ++iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw +Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo +aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy +2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7 +7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P +BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL +VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk +VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB +IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl +j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 +6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355 +e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u +G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= +-----END CERTIFICATE----- + +AddTrust Public Services Root +============================= +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML +QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU +cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ +BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l +dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu +nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i +d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG +Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw +HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G +A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux +FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G +A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4 +JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL ++YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao +GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9 +Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H +EufOX1362KqxMy3ZdvJOOjMMK7MtkAY= +-----END CERTIFICATE----- + +AddTrust Qualified Certificates Root +==================================== +-----BEGIN CERTIFICATE----- +MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML +QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU +cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx +CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ +IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx +64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3 +KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o +L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR +wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU +MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE +BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y +azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD +ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG +GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X +dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze +RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB +iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE= +-----END CERTIFICATE----- + +Entrust Root Certification Authority +==================================== +-----BEGIN CERTIFICATE----- +MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV +BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw +b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG +A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0 +MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu +MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu +Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v +dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz +A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww +Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68 +j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN +rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw +DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1 +MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH +hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA +A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM +Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa +v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS +W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0 +tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8 +-----END CERTIFICATE----- + +RSA Security 2048 v3 +==================== +-----BEGIN CERTIFICATE----- +MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK +ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy +MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb +BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7 +Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb +WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH +KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP ++Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/ +MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E +FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY +v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj +0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj +VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395 +nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA +pKnXwiJPZ9d37CAFYd4= +-----END CERTIFICATE----- + +GeoTrust Global CA +================== +-----BEGIN CERTIFICATE----- +MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK +Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw +MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j +LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo +BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet +8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc +T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU +vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk +DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q +zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4 +d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2 +mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p +XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm +Mw== +-----END CERTIFICATE----- + +GeoTrust Global CA 2 +==================== +-----BEGIN CERTIFICATE----- +MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN +R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw +MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j +LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/ +NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k +LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA +Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b +HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH +K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7 +srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh +ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL +OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC +x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF +H4z1Ir+rzoPz4iIprn2DQKi6bA== +-----END CERTIFICATE----- + +GeoTrust Universal CA +===================== +-----BEGIN CERTIFICATE----- +MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN +R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1 +MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu +Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t +JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e +RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs +7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d +8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V +qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga +Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB +Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu +KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08 +ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0 +XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB +hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc +aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2 +qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL +oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK +xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF +KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2 +DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK +xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU +p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI +P/rmMuGNG2+k5o7Y+SlIis5z/iw= +-----END CERTIFICATE----- + +GeoTrust Universal CA 2 +======================= +-----BEGIN CERTIFICATE----- +MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN +R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0 +MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg +SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0 +DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17 +j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q +JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a +QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2 +WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP +20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn +ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC +SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG +8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2 ++/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E +BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z +dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ +4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+ +mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq +A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg +Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP +pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d +FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp +gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm +X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS +-----END CERTIFICATE----- + +America Online Root Certification Authority 1 +============================================= +-----BEGIN CERTIFICATE----- +MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT +QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkG +A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg +T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CG +v2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44z +DyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145LcxVR5lu9Rh +sCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP +8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0T +AQH/BAUwAwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Z +o/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQB8itEf +GDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkFZu90821fnZmv9ov761KyBZiibyrF +VL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft +3OJvx8Fi8eNy1gTIdGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g +Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds +sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 +-----END CERTIFICATE----- + +America Online Root Certification Authority 2 +============================================= +-----BEGIN CERTIFICATE----- +MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT +QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkG +A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg +T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC206B89en +fHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFciKtZHgVdEglZTvYYUAQv8 +f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2JxhP7JsowtS013wMPgwr38oE18aO6lhO +qKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JN +RvCAOVIyD+OEsnpD8l7eXz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0 +gBe4lL8BPeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67Xnfn +6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEqZ8A9W6Wa6897Gqid +FEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZo2C7HK2JNDJiuEMhBnIMoVxtRsX6 +Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnj +B453cMor9H124HhnAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3Op +aaEg5+31IqEjFNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmnxPBUlgtk87FY +T15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2LHo1YGwRgJfMqZJS5ivmae2p ++DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzcccobGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXg +JXUjhx5c3LqdsKyzadsXg8n33gy8CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//Zoy +zH1kUQ7rVyZ2OuMeIjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgO +ZtMADjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2FAjgQ5ANh +1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUXOm/9riW99XJZZLF0Kjhf +GEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPbAZO1XB4Y3WRayhgoPmMEEf0cjQAPuDff +Z4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQlZvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuP +cX/9XhmgD0uRuMRUvAawRY8mkaKO/qk= +-----END CERTIFICATE----- + +Visa eCommerce Root +=================== +-----BEGIN CERTIFICATE----- +MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG +EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug +QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2 +WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm +VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv +bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL +F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b +RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0 +TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI +/k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs +GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG +MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc +CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW +YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz +zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu +YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt +398znM/jra6O1I7mT1GvFpLgXPYHDw== +-----END CERTIFICATE----- + +Certum Root CA +============== +-----BEGIN CERTIFICATE----- +MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK +ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla +Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u +by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x +wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL +kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ +89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K +Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P +NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq +hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+ +GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg +GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/ +0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS +qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw== +-----END CERTIFICATE----- + +Comodo AAA Services root +======================== +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS +R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg +TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw +MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl +c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV +BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG +C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs +i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW +Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH +Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK +Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f +BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl +cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz +LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm +7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz +Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z +8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C +12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== +-----END CERTIFICATE----- + +Comodo Secure Services root +=========================== +-----BEGIN CERTIFICATE----- +MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS +R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg +TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw +MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu +Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi +BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP +9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc +rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC +oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V +p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E +FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w +gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj +YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm +aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm +4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj +Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL +DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw +pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H +RR3B7Hzs/Sk= +-----END CERTIFICATE----- + +Comodo Trusted Services root +============================ +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS +R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg +TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw +MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h +bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw +IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7 +3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y +/9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6 +juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS +ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud +DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp +ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl +cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw +uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32 +pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA +BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l +R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O +9y5Xt5hwXsjEeLBi +-----END CERTIFICATE----- + +QuoVadis Root CA +================ +-----BEGIN CERTIFICATE----- +MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE +ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz +MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp +cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD +EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk +J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL +F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL +YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen +AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w +PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y +ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7 +MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj +YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs +ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh +Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW +Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu +BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw +FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6 +tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo +fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul +LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x +gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi +5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi +5nrQNiOKSnQ2+Q== +-----END CERTIFICATE----- + +QuoVadis Root CA 2 +================== +-----BEGIN CERTIFICATE----- +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 +-----END CERTIFICATE----- + +QuoVadis Root CA 3 +================== +-----BEGIN CERTIFICATE----- +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 +-----END CERTIFICATE----- + +Security Communication Root CA +============================== +-----BEGIN CERTIFICATE----- +MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP +U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw +HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP +U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw +8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM +DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX +5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd +DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2 +JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw +DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g +0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a +mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ +s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ +6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi +FL39vmwLAw== +-----END CERTIFICATE----- + +Sonera Class 2 Root CA +====================== +-----BEGIN CERTIFICATE----- +MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG +U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw +NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh +IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3 +/Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT +dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG +f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P +tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH +nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT +XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt +0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI +cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph +Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx +EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH +llpwrN9M +-----END CERTIFICATE----- + +Staat der Nederlanden Root CA +============================= +-----BEGIN CERTIFICATE----- +MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE +ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g +Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w +HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh +bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt +vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P +jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca +C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth +vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6 +22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV +HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v +dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN +BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR +EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw +MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y +nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR +iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw== +-----END CERTIFICATE----- + +TDC Internet Root CA +==================== +-----BEGIN CERTIFICATE----- +MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJESzEVMBMGA1UE +ChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTAeFw0wMTA0MDUx +NjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNVBAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJu +ZXQxHTAbBgNVBAsTFFREQyBJbnRlcm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAxLhAvJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20j +xsNuZp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a0vnRrEvL +znWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc14izbSysseLlJ28TQx5yc +5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGNeGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6 +otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcDR0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZI +AYb4QgEBBAQDAgAHMGUGA1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMM +VERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxMEQ1JM +MTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3WjALBgNVHQ8EBAMC +AQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAwHQYDVR0OBBYEFGxkAcf9hW2syNqe +UAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJKoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0G +CSqGSIb3DQEBBQUAA4IBAQBOQ8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540m +gwV5dOy0uaOXwTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+ +2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm899qNLPg7kbWzb +O0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0jUNAE4z9mQNUecYu6oah9jrU +Cbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38aQNiuJkFBT1reBK9sG9l +-----END CERTIFICATE----- + +TDC OCES Root CA +================ +-----BEGIN CERTIFICATE----- +MIIFGTCCBAGgAwIBAgIEPki9xDANBgkqhkiG9w0BAQUFADAxMQswCQYDVQQGEwJESzEMMAoGA1UE +ChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAeFw0wMzAyMTEwODM5MzBaFw0zNzAyMTEwOTA5 +MzBaMDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMTC1REQyBPQ0VTIENBMIIB +IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGL2YSCyz8DGhdfjeebM7fI5kqSXLmSjhFuH +nEz9pPPEXyG9VhDr2y5h7JNp46PMvZnDBfwGuMo2HP6QjklMxFaaL1a8z3sM8W9Hpg1DTeLpHTk0 +zY0s2RKY+ePhwUp8hjjEqcRhiNJerxomTdXkoCJHhNlktxmW/OwZ5LKXJk5KTMuPJItUGBxIYXvV +iGjaXbXqzRowwYCDdlCqT9HU3Tjw7xb04QxQBr/q+3pJoSgrHPb8FTKjdGqPqcNiKXEx5TukYBde +dObaE+3pHx8b0bJoc8YQNHVGEBDjkAB2QMuLt0MJIf+rTpPGWOmlgtt3xDqZsXKVSQTwtyv6e1mO +3QIDAQABo4ICNzCCAjMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgewGA1UdIASB +5DCB4TCB3gYIKoFQgSkBAQEwgdEwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5k +ay9yZXBvc2l0b3J5MIGdBggrBgEFBQcCAjCBkDAKFgNUREMwAwIBARqBgUNlcnRpZmlrYXRlciBm +cmEgZGVubmUgQ0EgdWRzdGVkZXMgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEuMS4xLiBDZXJ0aWZp +Y2F0ZXMgZnJvbSB0aGlzIENBIGFyZSBpc3N1ZWQgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEuMS4x +LjARBglghkgBhvhCAQEEBAMCAAcwgYEGA1UdHwR6MHgwSKBGoESkQjBAMQswCQYDVQQGEwJESzEM +MAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTENMAsGA1UEAxMEQ1JMMTAsoCqgKIYm +aHR0cDovL2NybC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwKwYDVR0QBCQwIoAPMjAwMzAy +MTEwODM5MzBagQ8yMDM3MDIxMTA5MDkzMFowHwYDVR0jBBgwFoAUYLWF7FZkfhIZJ2cdUBVLc647 ++RIwHQYDVR0OBBYEFGC1hexWZH4SGSdnHVAVS3OuO/kSMB0GCSqGSIb2fQdBAAQQMA4bCFY2LjA6 +NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEACromJkbTc6gJ82sLMJn9iuFXehHTuJTXCRBuo7E4 +A9G28kNBKWKnctj7fAXmMXAnVBhOinxO5dHKjHiIzxvTkIvmI/gLDjNDfZziChmPyQE+dF10yYsc +A+UYyAFMP8uXBV2YcaaYb7Z8vTd/vuGTJW1v8AqtFxjhA7wHKcitJuj4YfD9IQl+mo6paH1IYnK9 +AOoBmbgGglGBTvH1tJFUuSN6AJqfXY3gPGS5GhKSKseCRHI53OI8xthV9RVOyAUO28bQYqbsFbS1 +AoLbrIyigfCbmTH1ICCoiGEKB5+U/NDXG8wuF/MEJ3Zn61SD/aSQfgY9BKNDLdr8C2LqL19iUw== +-----END CERTIFICATE----- + +UTN DATACorp SGC Root CA +======================== +-----BEGIN CERTIFICATE----- +MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UE +BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl +IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZ +BgNVBAMTElVUTiAtIERBVEFDb3JwIFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBa +MIGTMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4w +HAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRy +dXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ys +raP6LnD43m77VkIVni5c7yPeIbkFdicZD0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlo +wHDyUwDAXlCCpVZvNvlK4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA +9P4yPykqlXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulWbfXv +33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQABo4GrMIGoMAsGA1Ud +DwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRTMtGzz3/64PGgXYVOktKeRR20TzA9 +BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dD +LmNybDAqBgNVHSUEIzAhBggrBgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3 +DQEBBQUAA4IBAQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft +Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyjj98C5OBxOvG0 +I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVHKWss5nbZqSl9Mt3JNjy9rjXx +EZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwP +DPafepE39peC4N1xaf92P2BNPM/3mfnGV/TJVTl4uix5yaaIK/QI +-----END CERTIFICATE----- + +UTN USERFirst Hardware Root CA +============================== +-----BEGIN CERTIFICATE----- +MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE +BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl +IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd +BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx +OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0 +eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz +ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI +wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd +tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8 +i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf +Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw +gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF +lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF +UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF +BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM +//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW +XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2 +lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn +iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67 +nfhmqA== +-----END CERTIFICATE----- + +Camerfirma Chambers of Commerce Root +==================================== +-----BEGIN CERTIFICATE----- +MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe +QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i +ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx +NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp +cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn +MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC +AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU +xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH +NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW +DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV +d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud +EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v +cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P +AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh +bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD +VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz +aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi +fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD +L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN +UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n +ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1 +erfutGWaIZDgqtCYvDi1czyL+Nw= +-----END CERTIFICATE----- + +Camerfirma Global Chambersign Root +================================== +-----BEGIN CERTIFICATE----- +MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe +QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i +ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx +NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt +YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg +MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw +ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J +1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O +by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl +6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c +8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/ +BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j +aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B +Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj +aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y +ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh +bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA +PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y +gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ +PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4 +IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes +t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A== +-----END CERTIFICATE----- + +NetLock Notary (Class A) Root +============================= +-----BEGIN CERTIFICATE----- +MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI +EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6 +dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j +ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX +DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH +EwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYD +VQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFz +cyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSM +D7tM9DceqQWC2ObhbHDqeLVu0ThEDaiDzl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZ +z+qMkjvN9wfcZnSX9EUi3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC +/tmwqcm8WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LYOph7 +tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2EsiNCubMvJIH5+hCoR6 +4sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCCApswDgYDVR0PAQH/BAQDAgAGMBIG +A1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaC +Ak1GSUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pv +bGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu +IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2Vn +LWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0 +ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFz +IGxlaXJhc2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBh +IGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVu +b3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBh +bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sg +Q1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFp +bCBhdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5 +ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP +ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB +CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr +KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM +8CgHrTwXZoi1/baI +-----END CERTIFICATE----- + +NetLock Business (Class B) Root +=============================== +-----BEGIN CERTIFICATE----- +MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUxETAPBgNVBAcT +CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV +BAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQDEylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikg +VGFudXNpdHZhbnlraWFkbzAeFw05OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYD +VQQGEwJIVTERMA8GA1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRv +bnNhZ2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5ldExvY2sg +VXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB +iQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xKgZjupNTKihe5In+DCnVMm8Bp2GQ5o+2S +o/1bXHQawEfKOml2mrriRBf8TKPV/riXiK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr +1nGTLbO/CVRY7QbrqHvcQ7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNV +HQ8BAf8EBAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZ +RUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRh +dGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQuIEEgaGl0 +ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRv +c2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUg +YXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh +c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBz +Oi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6ZXNA +bmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhl +IHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2 +YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBj +cHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06sPgzTEdM +43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXan3BukxowOR0w2y7jfLKR +stE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKSNitjrFgBazMpUIaD8QFI +-----END CERTIFICATE----- + +NetLock Express (Class C) Root +============================== +-----BEGIN CERTIFICATE----- +MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUxETAPBgNVBAcT +CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV +BAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQDEytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBD +KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJ +BgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6 +dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMrTmV0TG9j +ayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzANBgkqhkiG9w0BAQEFAAOB +jQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNAOoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3Z +W3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63 +euyucYT2BDMIJTLrdKwWRMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQw +DgYDVR0PAQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEWggJN +RklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0YWxhbm9zIFN6b2xn +YWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFzb2sgYWxhcGphbiBrZXN6dWx0LiBB +IGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBOZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1i +aXp0b3NpdGFzYSB2ZWRpLiBBIGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0 +ZWxlIGF6IGVsb2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs +ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25sYXBqYW4gYSBo +dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kga2VyaGV0byBheiBlbGxlbm9y +emVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4gSU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5k +IHRoZSB1c2Ugb2YgdGhpcyBjZXJ0aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQ +UyBhdmFpbGFibGUgYXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwg +YXQgY3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmYta3UzbM2 +xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2gpO0u9f38vf5NNwgMvOOW +gyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4Fp1hBWeAyNDYpQcCNJgEjTME1A== +-----END CERTIFICATE----- + +XRamp Global CA Root +==================== +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE +BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj +dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx +HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg +U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu +IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx +foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE +zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs +AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry +xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap +oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC +AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc +/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt +qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n +nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz +8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw= +-----END CERTIFICATE----- + +Go Daddy Class 2 CA +=================== +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY +VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG +A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g +RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD +ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv +2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32 +qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j +YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY +vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O +BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o +atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu +MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG +A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim +PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt +I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI +Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b +vZ8= +-----END CERTIFICATE----- + +Starfield Class 2 CA +==================== +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc +U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo +MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG +A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG +SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY +bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ +JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm +epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN +F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF +MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f +hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo +bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs +afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM +PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl +xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD +KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3 +QBFGmh95DmK/D5fs4C8fF5Q= +-----END CERTIFICATE----- + +StartCom Certification Authority +================================ +-----BEGIN CERTIFICATE----- +MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN +U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu +ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0 +NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk +LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg +U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y +o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/ +Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d +eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt +2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z +6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ +osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/ +untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc +UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT +37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE +FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0 +Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj +YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH +AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw +Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg +U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5 +LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl +cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh +cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT +dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC +AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh +3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm +vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk +fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3 +fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ +EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq +yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl +1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/ +lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro +g14= +-----END CERTIFICATE----- + +Taiwan GRCA +=========== +-----BEGIN CERTIFICATE----- +MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG +EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X +DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv +dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN +w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5 +BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O +1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO +htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov +J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7 +Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t +B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB +O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8 +lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV +HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2 +09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ +TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj +Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2 +Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU +D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz +DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk +Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk +7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ +CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy ++fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS +-----END CERTIFICATE----- + +Firmaprofesional Root CA +======================== +-----BEGIN CERTIFICATE----- +MIIEVzCCAz+gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnTELMAkGA1UEBhMCRVMxIjAgBgNVBAcT +GUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMTOUF1dG9yaWRhZCBkZSBDZXJ0aWZp +Y2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODEmMCQGCSqGSIb3DQEJARYXY2FA +ZmlybWFwcm9mZXNpb25hbC5jb20wHhcNMDExMDI0MjIwMDAwWhcNMTMxMDI0MjIwMDAwWjCBnTEL +MAkGA1UEBhMCRVMxIjAgBgNVBAcTGUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMT +OUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2 +ODEmMCQGCSqGSIb3DQEJARYXY2FAZmlybWFwcm9mZXNpb25hbC5jb20wggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDnIwNvbyOlXnjOlSztlB5uCp4Bx+ow0Syd3Tfom5h5VtP8c9/Qit5V +j1H5WuretXDE7aTt/6MNbg9kUDGvASdYrv5sp0ovFy3Tc9UTHI9ZpTQsHVQERc1ouKDAA6XPhUJH +lShbz++AbOCQl4oBPB3zhxAwJkh91/zpnZFx/0GaqUC1N5wpIE8fUuOgfRNtVLcK3ulqTgesrBlf +3H5idPayBQC6haD9HThuy1q7hryUZzM1gywfI834yJFxzJeL764P3CkDG8A563DtwW4O2GcLiam8 +NeTvtjS0pbbELaW+0MOUJEjb35bTALVmGotmBQ/dPz/LP6pemkr4tErvlTcbAgMBAAGjgZ8wgZww +KgYDVR0RBCMwIYYfaHR0cDovL3d3dy5maXJtYXByb2Zlc2lvbmFsLmNvbTASBgNVHRMBAf8ECDAG +AQH/AgEBMCsGA1UdEAQkMCKADzIwMDExMDI0MjIwMDAwWoEPMjAxMzEwMjQyMjAwMDBaMA4GA1Ud +DwEB/wQEAwIBBjAdBgNVHQ4EFgQUMwugZtHq2s7eYpMEKFK1FH84aLcwDQYJKoZIhvcNAQEFBQAD +ggEBAEdz/o0nVPD11HecJ3lXV7cVVuzH2Fi3AQL0M+2TUIiefEaxvT8Ub/GzR0iLjJcG1+p+o1wq +u00vR+L4OQbJnC4xGgN49Lw4xiKLMzHwFgQEffl25EvXwOaD7FnMP97/T2u3Z36mhoEyIwOdyPdf +wUpgpZKpsaSgYMN4h7Mi8yrrW6ntBas3D7Hi05V2Y1Z0jFhyGzflZKG+TQyTmAyX9odtsz/ny4Cm +7YjHX1BiAuiZdBbQ5rQ58SfLyEDW44YQqSMSkuBpQWOnryULwMWSyx6Yo1q6xTMPoJcB3X/ge9YG +VM+h4k0460tQtcsm9MracEpqoeJ5quGnM/b9Sh/22WA= +-----END CERTIFICATE----- + +Wells Fargo Root CA +=================== +-----BEGIN CERTIFICATE----- +MIID5TCCAs2gAwIBAgIEOeSXnjANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UEBhMCVVMxFDASBgNV +BAoTC1dlbGxzIEZhcmdvMSwwKgYDVQQLEyNXZWxscyBGYXJnbyBDZXJ0aWZpY2F0aW9uIEF1dGhv +cml0eTEvMC0GA1UEAxMmV2VsbHMgRmFyZ28gUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN +MDAxMDExMTY0MTI4WhcNMjEwMTE0MTY0MTI4WjCBgjELMAkGA1UEBhMCVVMxFDASBgNVBAoTC1dl +bGxzIEZhcmdvMSwwKgYDVQQLEyNXZWxscyBGYXJnbyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEv +MC0GA1UEAxMmV2VsbHMgRmFyZ28gUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVqDM7Jvk0/82bfuUER84A4n135zHCLielTWi5MbqNQ1mX +x3Oqfz1cQJ4F5aHiidlMuD+b+Qy0yGIZLEWukR5zcUHESxP9cMIlrCL1dQu3U+SlK93OvRw6esP3 +E48mVJwWa2uv+9iWsWCaSOAlIiR5NM4OJgALTqv9i86C1y8IcGjBqAr5dE8Hq6T54oN+J3N0Prj5 +OEL8pahbSCOz6+MlsoCultQKnMJ4msZoGK43YjdeUXWoWGPAUe5AeH6orxqg4bB4nVCMe+ez/I4j +sNtlAHCEAQgAFG5Uhpq6zPk3EPbg3oQtnaSFN9OH4xXQwReQfhkhahKpdv0SAulPIV4XAgMBAAGj +YTBfMA8GA1UdEwEB/wQFMAMBAf8wTAYDVR0gBEUwQzBBBgtghkgBhvt7hwcBCzAyMDAGCCsGAQUF +BwIBFiRodHRwOi8vd3d3LndlbGxzZmFyZ28uY29tL2NlcnRwb2xpY3kwDQYJKoZIhvcNAQEFBQAD +ggEBANIn3ZwKdyu7IvICtUpKkfnRLb7kuxpo7w6kAOnu5+/u9vnldKTC2FJYxHT7zmu1Oyl5GFrv +m+0fazbuSCUlFLZWohDo7qd/0D+j0MNdJu4HzMPBJCGHHt8qElNvQRbn7a6U+oxy+hNH8Dx+rn0R +OhPs7fpvcmR7nX1/Jv16+yWt6j4pf0zjAFcysLPp7VMX2YuyFA4w6OXVE8Zkr8QA1dhYJPz1j+zx +x32l2w8n0cbyQIjmH/ZhqPRCyLk306m+LFZ4wnKbWV01QIroTmMatukgalHizqSQ33ZwmVxwQ023 +tqcZZE6St8WRPH9IFmV7Fv3L/PvZ1dZPIWU7Sn9Ho/s= +-----END CERTIFICATE----- + +Swisscom Root CA 1 +================== +-----BEGIN CERTIFICATE----- +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 +NY6E0F/6MBr1mmz0DlP5OlvRHA== +-----END CERTIFICATE----- + +DigiCert Assured ID Root CA +=========================== +-----BEGIN CERTIFICATE----- +MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw +IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx +MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL +ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO +9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy +UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW +/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy +oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf +GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF +66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq +hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc +EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn +SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i +8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe ++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== +-----END CERTIFICATE----- + +DigiCert Global Root CA +======================= +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw +HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw +MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3 +dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn +TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5 +BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H +4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y +7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB +o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm +8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF +BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr +EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt +tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886 +UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- + +DigiCert High Assurance EV Root CA +================================== +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw +KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw +MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ +MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu +Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t +Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS +OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3 +MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ +NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe +h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB +Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY +JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ +V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp +myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK +mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe +vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K +-----END CERTIFICATE----- + +Certplus Class 2 Primary CA +=========================== +-----BEGIN CERTIFICATE----- +MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE +BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN +OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy +dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR +5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ +Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO +YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e +e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME +CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ +YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t +L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD +P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R +TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+ +7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW +//1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 +l7+ijrRU +-----END CERTIFICATE----- + +DST Root CA X3 +============== +-----BEGIN CERTIFICATE----- +MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK +ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X +DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1 +cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT +rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9 +UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy +xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d +utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ +MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug +dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE +GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw +RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS +fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ +-----END CERTIFICATE----- + +DST ACES CA X6 +============== +-----BEGIN CERTIFICATE----- +MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG +EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT +MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha +MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE +CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI +DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa +pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow +GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy +MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud +EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu +Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy +dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU +CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2 +5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t +Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq +nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs +vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3 +oKfN5XozNmr6mis= +-----END CERTIFICATE----- + +TURKTRUST Certificate Services Provider Root 1 +============================================== +-----BEGIN CERTIFICATE----- +MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOcUktUUlVTVCBF +bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGDAJUUjEP +MA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykgMjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV0 +acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMx +MDI3MTdaFw0xNTAzMjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsg +U2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYDVQQHDAZB +TktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBC +aWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GX +yGl8hMW0kWxsE2qkVa2kheiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8i +Si9BB35JYbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5CurKZ +8y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1JuTm5Rh8i27fbMx4 +W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51b0dewQIDAQABoxAwDjAMBgNVHRME +BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu46 +sWrv7/hg0Uw2ZkUd82YCdAR7kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxE +q8Sn5RTOPEFhfEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy +B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdAaLX/7KfS0zgY +nNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKSRGQDJereW26fyfJOrN3H +-----END CERTIFICATE----- + +TURKTRUST Certificate Services Provider Root 2 +============================================== +-----BEGIN CERTIFICATE----- +MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF +bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP +MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg +QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN +MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr +dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G +A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls +acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe +LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI +x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g +QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr +5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB +AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G +A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt +Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4 +Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+ +hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P +9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5 +UrbnBEI= +-----END CERTIFICATE----- + +SwissSign Gold CA - G2 +====================== +-----BEGIN CERTIFICATE----- +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 +-----END CERTIFICATE----- + +SwissSign Silver CA - G2 +======================== +-----BEGIN CERTIFICATE----- +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 +-----END CERTIFICATE----- + +GeoTrust Primary Certification Authority +======================================== +-----BEGIN CERTIFICATE----- +MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG +EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx +CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ +cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN +b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9 +nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge +RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt +tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI +hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K +Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN +NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa +Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG +1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk= +-----END CERTIFICATE----- + +thawte Primary Root CA +====================== +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE +BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2 +aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv +cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3 +MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg +SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv +KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT +FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs +oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ +1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc +q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K +aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p +afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF +AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE +uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX +xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89 +jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH +z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA== +-----END CERTIFICATE----- + +VeriSign Class 3 Public Primary Certification Authority - G5 +============================================================ +-----BEGIN CERTIFICATE----- +MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE +BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO +ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk +IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB +yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln +biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh +dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz +j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD +Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/ +Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r +fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/ +BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv +Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy +aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG +SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+ +X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE +KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC +Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE +ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq +-----END CERTIFICATE----- + +SecureTrust CA +============== +-----BEGIN CERTIFICATE----- +MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG +EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy +dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe +BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX +OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t +DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH +GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b +01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH +ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj +aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ +KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu +SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf +mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ +nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR +3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= +-----END CERTIFICATE----- + +Secure Global CA +================ +-----BEGIN CERTIFICATE----- +MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG +EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH +bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg +MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg +Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx +YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ +bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g +8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV +HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi +0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn +oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA +MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+ +OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn +CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5 +3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc +f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW +-----END CERTIFICATE----- + +COMODO Certification Authority +============================== +-----BEGIN CERTIFICATE----- +MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE +BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG +A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1 +dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb +MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD +T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH ++7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww +xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV +4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA +1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI +rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k +b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC +AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP +OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ +RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc +IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN ++8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ== +-----END CERTIFICATE----- + +Network Solutions Certificate Authority +======================================= +-----BEGIN CERTIFICATE----- +MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG +EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr +IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx +MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu +MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx +jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT +aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT +crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc +/Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB +AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv +bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA +A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q +4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/ +GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv +wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD +ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey +-----END CERTIFICATE----- + +WellsSecure Public Root Certificate Authority +============================================= +-----BEGIN CERTIFICATE----- +MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM +F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw +NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN +MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl +bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD +VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1 +iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13 +i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8 +bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB +K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB +AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu +cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm +lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB +i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww +GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg +Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI +K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0 +bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj +qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es +E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ +tylv2G0xffX8oRAHh84vWdw+WNs= +-----END CERTIFICATE----- + +COMODO ECC Certification Authority +================================== +-----BEGIN CERTIFICATE----- +MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC +R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE +ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix +GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR +Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo +b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X +4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni +wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG +FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA +U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= +-----END CERTIFICATE----- + +IGC/A +===== +-----BEGIN CERTIFICATE----- +MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD +VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE +Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy +MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI +EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT +STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB +IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2 +TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW +So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy +HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd +frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ +tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB +egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC +iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK +q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q +MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg +Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI +lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF +0mBWWg== +-----END CERTIFICATE----- + +Security Communication EV RootCA1 +================================= +-----BEGIN CERTIFICATE----- +MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc +U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh +dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE +BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl +Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO +/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX +WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z +ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4 +bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK +9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG +SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm +iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG +Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW +mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW +T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490 +-----END CERTIFICATE----- + +OISTE WISeKey Global Root GA CA +=============================== +-----BEGIN CERTIFICATE----- +MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE +BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG +A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH +bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD +VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw +IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5 +IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9 +Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg +Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD +d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ +/yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R +LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ +KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm +MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4 ++vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa +hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY +okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0= +-----END CERTIFICATE----- + +Microsec e-Szigno Root CA +========================= +-----BEGIN CERTIFICATE----- +MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE +BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL +EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0 +MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz +dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT +GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG +d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N +oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc +QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ +PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb +MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG +IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD +VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3 +LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A +dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn +AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA +4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg +AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA +egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6 +Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO +PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv +c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h +cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw +IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT +WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV +MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER +MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp +Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal +HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT +nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE +aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a +86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK +yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB +S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU= +-----END CERTIFICATE----- + +Certigna +======== +-----BEGIN CERTIFICATE----- +MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw +EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3 +MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI +Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q +XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH +GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p +ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg +DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf +Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ +tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ +BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J +SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA +hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+ +ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu +PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY +1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw +WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== +-----END CERTIFICATE----- + +AC Ra\xC3\xADz Certic\xC3\xA1mara S.A. +====================================== +-----BEGIN CERTIFICATE----- +MIIGZjCCBE6gAwIBAgIPB35Sk3vgFeNX8GmMy+wMMA0GCSqGSIb3DQEBBQUAMHsxCzAJBgNVBAYT +AkNPMUcwRQYDVQQKDD5Tb2NpZWRhZCBDYW1lcmFsIGRlIENlcnRpZmljYWNpw7NuIERpZ2l0YWwg +LSBDZXJ0aWPDoW1hcmEgUy5BLjEjMCEGA1UEAwwaQUMgUmHDrXogQ2VydGljw6FtYXJhIFMuQS4w +HhcNMDYxMTI3MjA0NjI5WhcNMzAwNDAyMjE0MjAyWjB7MQswCQYDVQQGEwJDTzFHMEUGA1UECgw+ +U29jaWVkYWQgQ2FtZXJhbCBkZSBDZXJ0aWZpY2FjacOzbiBEaWdpdGFsIC0gQ2VydGljw6FtYXJh +IFMuQS4xIzAhBgNVBAMMGkFDIFJhw616IENlcnRpY8OhbWFyYSBTLkEuMIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEAq2uJo1PMSCMI+8PPUZYILrgIem08kBeGqentLhM0R7LQcNzJPNCN +yu5LF6vQhbCnIwTLqKL85XXbQMpiiY9QngE9JlsYhBzLfDe3fezTf3MZsGqy2IiKLUV0qPezuMDU +2s0iiXRNWhU5cxh0T7XrmafBHoi0wpOQY5fzp6cSsgkiBzPZkc0OnB8OIMfuuzONj8LSWKdf/WU3 +4ojC2I+GdV75LaeHM/J4Ny+LvB2GNzmxlPLYvEqcgxhaBvzz1NS6jBUJJfD5to0EfhcSM2tXSExP +2yYe68yQ54v5aHxwD6Mq0Do43zeX4lvegGHTgNiRg0JaTASJaBE8rF9ogEHMYELODVoqDA+bMMCm +8Ibbq0nXl21Ii/kDwFJnmxL3wvIumGVC2daa49AZMQyth9VXAnow6IYm+48jilSH5L887uvDdUhf +HjlvgWJsxS3EF1QZtzeNnDeRyPYL1epjb4OsOMLzP96a++EjYfDIJss2yKHzMI+ko6Kh3VOz3vCa +Mh+DkXkwwakfU5tTohVTP92dsxA7SH2JD/ztA/X7JWR1DhcZDY8AFmd5ekD8LVkH2ZD6mq093ICK +5lw1omdMEWux+IBkAC1vImHFrEsm5VoQgpukg3s0956JkSCXjrdCx2bD0Omk1vUgjcTDlaxECp1b +czwmPS9KvqfJpxAe+59QafMCAwEAAaOB5jCB4zAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE +AwIBBjAdBgNVHQ4EFgQU0QnQ6dfOeXRU+Tows/RtLAMDG2gwgaAGA1UdIASBmDCBlTCBkgYEVR0g +ADCBiTArBggrBgEFBQcCARYfaHR0cDovL3d3dy5jZXJ0aWNhbWFyYS5jb20vZHBjLzBaBggrBgEF +BQcCAjBOGkxMaW1pdGFjaW9uZXMgZGUgZ2FyYW507WFzIGRlIGVzdGUgY2VydGlmaWNhZG8gc2Ug +cHVlZGVuIGVuY29udHJhciBlbiBsYSBEUEMuMA0GCSqGSIb3DQEBBQUAA4ICAQBclLW4RZFNjmEf +AygPU3zmpFmps4p6xbD/CHwso3EcIRNnoZUSQDWDg4902zNc8El2CoFS3UnUmjIz75uny3XlesuX +EpBcunvFm9+7OSPI/5jOCk0iAUgHforA1SBClETvv3eiiWdIG0ADBaGJ7M9i4z0ldma/Jre7Ir5v +/zlXdLp6yQGVwZVR6Kss+LGGIOk/yzVb0hfpKv6DExdA7ohiZVvVO2Dpezy4ydV/NgIlqmjCMRW3 +MGXrfx1IebHPOeJCgBbT9ZMj/EyXyVo3bHwi2ErN0o42gzmRkBDI8ck1fj+404HGIGQatlDCIaR4 +3NAvO2STdPCWkPHv+wlaNECW8DYSwaN0jJN+Qd53i+yG2dIPPy3RzECiiWZIHiCznCNZc6lEc7wk +eZBWN7PGKX6jD/EpOe9+XCgycDWs2rjIdWb8m0w5R44bb5tNAlQiM+9hup4phO9OSzNHdpdqy35f +/RWmnkJDW2ZaiogN9xa5P1FlK2Zqi9E4UqLWRhH6/JocdJ6PlwsCT2TG9WjTSy3/pDceiz+/RL5h +RqGEPQgnTIEgd4kI6mdAXmwIUV80WoyWaM3X94nCHNMyAK9Sy9NgWyo6R35rMDOhYil/SrnhLecU +Iw4OGEfhefwVVdCx/CVxY3UzHCMrr1zZ7Ud3YA47Dx7SwNxkBYn8eNZcLCZDqQ== +-----END CERTIFICATE----- + +TC TrustCenter Class 2 CA II +============================ +-----BEGIN CERTIFICATE----- +MIIEqjCCA5KgAwIBAgIOLmoAAQACH9dSISwRXDswDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC +REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy +IENsYXNzIDIgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDIgQ0EgSUkwHhcNMDYw +MTEyMTQzODQzWhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1 +c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQTElMCMGA1UE +AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAKuAh5uO8MN8h9foJIIRszzdQ2Lu+MNF2ujhoF/RKrLqk2jftMjWQ+nEdVl//OEd+DFw +IxuInie5e/060smp6RQvkL4DUsFJzfb95AhmC1eKokKguNV/aVyQMrKXDcpK3EY+AlWJU+MaWss2 +xgdW94zPEfRMuzBwBJWl9jmM/XOBCH2JXjIeIqkiRUuwZi4wzJ9l/fzLganx4Duvo4bRierERXlQ +Xa7pIXSSTYtZgo+U4+lK8edJsBTj9WLL1XK9H7nSn6DNqPoByNkN39r8R52zyFTfSUrxIan+GE7u +SNQZu+995OKdy1u2bv/jzVrndIIFuoAlOMvkaZ6vQaoahPUCAwEAAaOCATQwggEwMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjq1RMgKHbVkO3kUrL84J6E1wIqzCB +7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90 +Y19jbGFzc18yX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU +cnVzdENlbnRlciUyMENsYXNzJTIwMiUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i +SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u +TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEAjNfffu4bgBCzg/XbEeprS6iSGNn3Bzn1LL4G +dXpoUxUc6krtXvwjshOg0wn/9vYua0Fxec3ibf2uWWuFHbhOIprtZjluS5TmVfwLG4t3wVMTZonZ +KNaL80VKY7f9ewthXbhtvsPcW3nS7Yblok2+XnR8au0WOB9/WIFaGusyiC2y8zl3gK9etmF1Kdsj +TYjKUCjLhdLTEKJZbtOTVAB6okaVhgWcqRmY5TFyDADiZ9lA4CQze28suVyrZZ0srHbqNZn1l7kP +JOzHdiEoZa5X6AeIdUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfk +vQ== +-----END CERTIFICATE----- + +TC TrustCenter Class 3 CA II +============================ +-----BEGIN CERTIFICATE----- +MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC +REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy +IENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYw +MTEyMTQ0MTU3WhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1 +c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UE +AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJWHt4bNwcwIi9v8Qbxq63W +yKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+QVl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo +6SI7dYnWRBpl8huXJh0obazovVkdKyT21oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZ +uV3bOx4a+9P/FRQI2AlqukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk +2ZyqBwi1Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NXXAek0CSnwPIA1DCB +7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90 +Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU +cnVzdENlbnRlciUyMENsYXNzJTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i +SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u +TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlNirTzwppVMXzE +O2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8TtXqluJucsG7Kv5sbviRmEb8 +yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9 +IJqDnxrcOfHFcqMRA/07QlIp2+gB95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal +092Y+tTmBvTwtiBjS+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc +5A== +-----END CERTIFICATE----- + +TC TrustCenter Universal CA I +============================= +-----BEGIN CERTIFICATE----- +MIID3TCCAsWgAwIBAgIOHaIAAQAC7LdggHiNtgYwDQYJKoZIhvcNAQEFBQAweTELMAkGA1UEBhMC +REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy +IFVuaXZlcnNhbCBDQTEmMCQGA1UEAxMdVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIEkwHhcN +MDYwMzIyMTU1NDI4WhcNMjUxMjMxMjI1OTU5WjB5MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMg +VHJ1c3RDZW50ZXIgR21iSDEkMCIGA1UECxMbVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBMSYw +JAYDVQQDEx1UQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0EgSTCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAKR3I5ZEr5D0MacQ9CaHnPM42Q9e3s9B6DGtxnSRJJZ4Hgmgm5qVSkr1YnwC +qMqs+1oEdjneX/H5s7/zA1hV0qq34wQi0fiU2iIIAI3TfCZdzHd55yx4Oagmcw6iXSVphU9VDprv +xrlE4Vc93x9UIuVvZaozhDrzznq+VZeujRIPFDPiUHDDSYcTvFHe15gSWu86gzOSBnWLknwSaHtw +ag+1m7Z3W0hZneTvWq3zwZ7U10VOylY0Ibw+F1tvdwxIAUMpsN0/lm7mlaoMwCC2/T42J5zjXM9O +gdwZu5GQfezmlwQek8wiSdeXhrYTCjxDI3d+8NzmzSQfO4ObNDqDNOMCAwEAAaNjMGEwHwYDVR0j +BBgwFoAUkqR1LKSevoFE63n8isWVpesQdXMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AYYwHQYDVR0OBBYEFJKkdSyknr6BROt5/IrFlaXrEHVzMA0GCSqGSIb3DQEBBQUAA4IBAQAo0uCG +1eb4e/CX3CJrO5UUVg8RMKWaTzqwOuAGy2X17caXJ/4l8lfmXpWMPmRgFVp/Lw0BxbFg/UU1z/Cy +vwbZ71q+s2IhtNerNXxTPqYn8aEt2hojnczd7Dwtnic0XQ/CNnm8yUpiLe1r2X1BQ3y2qsrtYbE3 +ghUJGooWMNjsydZHcnhLEEYUjl8Or+zHL6sQ17bxbuyGssLoDZJz3KL0Dzq/YSMQiZxIQG5wALPT +ujdEWBF6AmqI8Dc08BnprNRlc/ZpjGSUOnmFKbAWKwyCPwacx/0QK54PLLae4xW/2TYcuiUaUj0a +7CIMHOCkoj3w6DnPgcB77V0fb8XQC9eY +-----END CERTIFICATE----- + +Deutsche Telekom Root CA 2 +========================== +-----BEGIN CERTIFICATE----- +MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT +RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG +A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5 +MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G +A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS +b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5 +bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI +KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY +AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK +Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV +jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV +HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr +E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy +zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8 +rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G +dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU +Cm26OWMohpLzGITY+9HPBVZkVw== +-----END CERTIFICATE----- + +ComSign Secured CA +================== +-----BEGIN CERTIFICATE----- +MIIDqzCCApOgAwIBAgIRAMcoRwmzuGxFjB36JPU2TukwDQYJKoZIhvcNAQEFBQAwPDEbMBkGA1UE +AxMSQ29tU2lnbiBTZWN1cmVkIENBMRAwDgYDVQQKEwdDb21TaWduMQswCQYDVQQGEwJJTDAeFw0w +NDAzMjQxMTM3MjBaFw0yOTAzMTYxNTA0NTZaMDwxGzAZBgNVBAMTEkNvbVNpZ24gU2VjdXJlZCBD +QTEQMA4GA1UEChMHQ29tU2lnbjELMAkGA1UEBhMCSUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQDGtWhfHZQVw6QIVS3joFd67+l0Kru5fFdJGhFeTymHDEjWaueP1H5XJLkGieQcPOqs +49ohgHMhCu95mGwfCP+hUH3ymBvJVG8+pSjsIQQPRbsHPaHA+iqYHU4Gk/v1iDurX8sWv+bznkqH +7Rnqwp9D5PGBpX8QTz7RSmKtUxvLg/8HZaWSLWapW7ha9B20IZFKF3ueMv5WJDmyVIRD9YTC2LxB +kMyd1mja6YJQqTtoz7VdApRgFrFD2UNd3V2Hbuq7s8lr9gOUCXDeFhF6K+h2j0kQmHe5Y1yLM5d1 +9guMsqtb3nQgJT/j8xH5h2iGNXHDHYwt6+UarA9z1YJZQIDTAgMBAAGjgacwgaQwDAYDVR0TBAUw +AwEB/zBEBgNVHR8EPTA7MDmgN6A1hjNodHRwOi8vZmVkaXIuY29tc2lnbi5jby5pbC9jcmwvQ29t +U2lnblNlY3VyZWRDQS5jcmwwDgYDVR0PAQH/BAQDAgGGMB8GA1UdIwQYMBaAFMFL7XC29z58ADsA +j8c+DkWfHl3sMB0GA1UdDgQWBBTBS+1wtvc+fAA7AI/HPg5Fnx5d7DANBgkqhkiG9w0BAQUFAAOC +AQEAFs/ukhNQq3sUnjO2QiBq1BW9Cav8cujvR3qQrFHBZE7piL1DRYHjZiM/EoZNGeQFsOY3wo3a +BijJD4mkU6l1P7CW+6tMM1X5eCZGbxs2mPtCdsGCuY7e+0X5YxtiOzkGynd6qDwJz2w2PQ8KRUtp +FhpFfTMDZflScZAmlaxMDPWLkz/MdXSFmLr/YnpNH4n+rr2UAJm/EaXc4HnFFgt9AmEd6oX5AhVP +51qJThRv4zdLhfXBPGHg/QVBspJ/wx2g0K5SZGBrGMYmnNj1ZOQ2GmKfig8+/21OGVZOIJFsnzQz +OjRXUDpvgV4GxvU+fE6OK85lBi5d0ipTdF7Tbieejw== +-----END CERTIFICATE----- + +Cybertrust Global Root +====================== +-----BEGIN CERTIFICATE----- +MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li +ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4 +MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD +ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA ++Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW +0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL +AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin +89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT +8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2 +MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G +A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO +lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi +5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2 +hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T +X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW +WL1WMRJOEcgh4LMRkWXbtKaIOM5V +-----END CERTIFICATE----- + +ePKI Root Certification Authority +================================= +-----BEGIN CERTIFICATE----- +MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG +EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg +Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx +MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq +MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs +IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi +lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv +qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX +12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O +WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+ +ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao +lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/ +vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi +Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi +MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH +ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0 +1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq +KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV +xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP +NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r +GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE +xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx +gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy +sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD +BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw= +-----END CERTIFICATE----- + +T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3 +============================================================================================================================= +-----BEGIN CERTIFICATE----- +MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH +DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q +aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry +b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV +BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg +S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4 +MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl +IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF +n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl +IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft +dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl +cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO +Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1 +xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR +6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL +hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd +BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4 +N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT +y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh +LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M +dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI= +-----END CERTIFICATE----- + +Buypass Class 2 CA 1 +==================== +-----BEGIN CERTIFICATE----- +MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU +QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2 +MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh +c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M +cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83 +0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4 +0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R +uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P +AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV +1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt +7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2 +fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w +wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho +-----END CERTIFICATE----- + +Buypass Class 3 CA 1 +==================== +-----BEGIN CERTIFICATE----- +MIIDUzCCAjugAwIBAgIBAjANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU +QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMyBDQSAxMB4XDTA1 +MDUwOTE0MTMwM1oXDTE1MDUwOTE0MTMwM1owSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh +c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDMgQ0EgMTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAKSO13TZKWTeXx+HgJHqTjnmGcZEC4DVC69TB4sSveZn8AKx +ifZgisRbsELRwCGoy+Gb72RRtqfPFfV0gGgEkKBYouZ0plNTVUhjP5JW3SROjvi6K//zNIqeKNc0 +n6wv1g/xpC+9UrJJhW05NfBEMJNGJPO251P7vGGvqaMU+8IXF4Rs4HyI+MkcVyzwPX6UvCWThOia +AJpFBUJXgPROztmuOfbIUxAMZTpHe2DC1vqRycZxbL2RhzyRhkmr8w+gbCZ2Xhysm3HljbybIR6c +1jh+JIAVMYKWsUnTYjdbiAwKYjT+p0h+mbEwi5A3lRyoH6UsjfRVyNvdWQrCrXig9IsCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUOBTmyPCppAP0Tj4io1vy1uCtQHQwDgYDVR0P +AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQABZ6OMySU9E2NdFm/soT4JXJEVKirZgCFPBdy7 +pYmrEzMqnji3jG8CcmPHc3ceCQa6Oyh7pEfJYWsICCD8igWKH7y6xsL+z27sEzNxZy5p+qksP2bA +EllNC1QCkoS72xLvg3BweMhT+t/Gxv/ciC8HwEmdMldg0/L2mSlf56oBzKwzqBwKu5HEA6BvtjT5 +htOzdlSY9EqBs1OdTUDs5XcTRa9bqh/YL0yCe/4qxFi7T/ye/QNlGioOw6UgFpRreaaiErS7GqQj +el/wroQk5PMr+4okoyeYZdowdXb8GZHo2+ubPzK/QJcHJrrM85SFSnonk8+QQtS4Wxam58tAA915 +-----END CERTIFICATE----- + +EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 +========================================================================== +-----BEGIN CERTIFICATE----- +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 +-----END CERTIFICATE----- + +certSIGN ROOT CA +================ +-----BEGIN CERTIFICATE----- +MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD +VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa +Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE +CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I +JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH +rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2 +ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD +0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943 +AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B +Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB +AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8 +SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0 +x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt +vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz +TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD +-----END CERTIFICATE----- + +CNNIC ROOT +========== +-----BEGIN CERTIFICATE----- +MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE +ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw +OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD +o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz +VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT +VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or +czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK +y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC +wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S +lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5 +Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM +O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8 +BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2 +G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m +mxE= +-----END CERTIFICATE----- + +ApplicationCA - Japanese Government +=================================== +-----BEGIN CERTIFICATE----- +MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT +SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw +MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl +cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4 +fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN +wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE +jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu +nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU +WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV +BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD +vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs +o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g +/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD +io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW +dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL +rosot4LKGAfmt1t06SAZf7IbiVQ= +-----END CERTIFICATE----- + +GeoTrust Primary Certification Authority - G3 +============================================= +-----BEGIN CERTIFICATE----- +MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE +BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0 +IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy +eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz +NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo +YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT +LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j +K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE +c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C +IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu +dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr +2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9 +cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE +Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD +AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s +t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt +-----END CERTIFICATE----- + +thawte Primary Root CA - G2 +=========================== +-----BEGIN CERTIFICATE----- +MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC +VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu +IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg +Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV +MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG +b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt +IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS +LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5 +8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU +mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN +G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K +rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg== +-----END CERTIFICATE----- + +thawte Primary Root CA - G3 +=========================== +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE +BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2 +aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv +cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w +ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh +d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD +VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG +A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At +P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC ++BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY +7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW +vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ +KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK +A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu +t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC +8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm +er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A= +-----END CERTIFICATE----- + +GeoTrust Primary Certification Authority - G2 +============================================= +-----BEGIN CERTIFICATE----- +MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu +Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1 +OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg +MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl +b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG +BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc +KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD +VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+ +EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m +ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2 +npaqBA+K +-----END CERTIFICATE----- + +VeriSign Universal Root Certification Authority +=============================================== +-----BEGIN CERTIFICATE----- +MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE +BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO +ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk +IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u +IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV +UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv +cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj +1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP +MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72 +9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I +AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR +tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G +CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O +a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud +DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3 +Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx +Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx +P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P +wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4 +mJO37M2CYfE45k+XmCpajQ== +-----END CERTIFICATE----- + +VeriSign Class 3 Public Primary Certification Authority - G4 +============================================================ +-----BEGIN CERTIFICATE----- +MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC +VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3 +b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz +ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL +MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU +cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo +b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5 +IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8 +Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz +rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw +HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u +Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD +A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx +AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA== +-----END CERTIFICATE----- + +NetLock Arany (Class Gold) FÅ‘tanúsítvány +============================================ +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G +A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610 +dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB +cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx +MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO +ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6 +c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu +0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw +/HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk +H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw +fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1 +neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW +qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta +YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC +bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna +NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu +dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= +-----END CERTIFICATE----- + +Staat der Nederlanden Root CA - G2 +================================== +-----BEGIN CERTIFICATE----- +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 +66+KAQ== +-----END CERTIFICATE----- + +CA Disig +======== +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK +QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwHhcNMDYw +MzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlz +bGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgm +GErENx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnXmjxUizkD +Pw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYDXcDtab86wYqg6I7ZuUUo +hwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhWS8+2rT+MitcE5eN4TPWGqvWP+j1scaMt +ymfraHtuM6kMgiioTGohQBUgDCZbg8KpFhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8w +gfwwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0P +AQH/BAQDAgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cuZGlz +aWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5zay9jYS9jcmwvY2Ff +ZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2svY2EvY3JsL2NhX2Rpc2lnLmNybDAa +BgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEwDQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59t +WDYcPQuBDRIrRhCA/ec8J9B6yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3 +mkkp7M5+cTxqEEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/ +CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeBEicTXxChds6K +ezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFNPGO+I++MzVpQuGhU+QqZMxEA +4Z7CRneC9VkGjCFMhwnN5ag= +-----END CERTIFICATE----- + +Juur-SK +======= +-----BEGIN CERTIFICATE----- +MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA +c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw +DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG +SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy +aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf +TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC ++Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw +UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa +Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF +MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD +HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh +AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA +cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr +AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw +cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE +FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G +A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo +ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL +abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678 +IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh +Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2 +yyqcjg== +-----END CERTIFICATE----- + +Hongkong Post Root CA 1 +======================= +-----BEGIN CERTIFICATE----- +MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT +DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx +NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n +IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1 +ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr +auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh +qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY +V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV +HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i +h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio +l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei +IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps +T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT +c4afU9hDDl3WY4JxHYB0yvbiAmvZWg== +-----END CERTIFICATE----- + +SecureSign RootCA11 +=================== +-----BEGIN CERTIFICATE----- +MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi +SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS +b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw +KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1 +cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL +TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO +wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq +g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP +O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA +bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX +t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh +OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r +bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ +Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01 +y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061 +lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I= +-----END CERTIFICATE----- + +ACEDICOM Root +============= +-----BEGIN CERTIFICATE----- +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 +-----END CERTIFICATE----- + +Verisign Class 3 Public Primary Certification Authority +======================================================= +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx +FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5 +IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow +XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz +IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94 +f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol +hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky +CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX +bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/ +D/xwzoiQ +-----END CERTIFICATE----- + +Microsec e-Szigno Root CA 2009 +============================== +-----BEGIN CERTIFICATE----- +MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER +MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv +c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o +dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE +BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt +U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA +fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG +0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA +pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm +1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC +AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf +QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE +FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o +lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX +I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 +tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02 +yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi +LXpUq3DDfSJlgnCW +-----END CERTIFICATE----- + +E-Guven Kok Elektronik Sertifika Hizmet Saglayicisi +=================================================== +-----BEGIN CERTIFICATE----- +MIIDtjCCAp6gAwIBAgIQRJmNPMADJ72cdpW56tustTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG +EwJUUjEoMCYGA1UEChMfRWxla3Ryb25payBCaWxnaSBHdXZlbmxpZ2kgQS5TLjE8MDoGA1UEAxMz +ZS1HdXZlbiBLb2sgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhZ2xheWljaXNpMB4XDTA3 +MDEwNDExMzI0OFoXDTE3MDEwNDExMzI0OFowdTELMAkGA1UEBhMCVFIxKDAmBgNVBAoTH0VsZWt0 +cm9uaWsgQmlsZ2kgR3V2ZW5saWdpIEEuUy4xPDA6BgNVBAMTM2UtR3V2ZW4gS29rIEVsZWt0cm9u +aWsgU2VydGlmaWthIEhpem1ldCBTYWdsYXlpY2lzaTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAMMSIJ6wXgBljU5Gu4Bc6SwGl9XzcslwuedLZYDBS75+PNdUMZTe1RK6UxYC6lhj71vY +8+0qGqpxSKPcEC1fX+tcS5yWCEIlKBHMilpiAVDV6wlTL/jDj/6z/P2douNffb7tC+Bg62nsM+3Y +jfsSSYMAyYuXjDtzKjKzEve5TfL0TW3H5tYmNwjy2f1rXKPlSFxYvEK+A1qBuhw1DADT9SN+cTAI +JjjcJRFHLfO6IxClv7wC90Nex/6wN1CZew+TzuZDLMN+DfIcQ2Zgy2ExR4ejT669VmxMvLz4Bcpk +9Ok0oSy1c+HCPujIyTQlCFzz7abHlJ+tiEMl1+E5YP6sOVkCAwEAAaNCMEAwDgYDVR0PAQH/BAQD +AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ/uRLOU1fqRTy7ZVZoEVtstxNulMA0GCSqG +SIb3DQEBBQUAA4IBAQB/X7lTW2M9dTLn+sR0GstG30ZpHFLPqk/CaOv/gKlR6D1id4k9CnU58W5d +F4dvaAXBlGzZXd/aslnLpRCKysw5zZ/rTt5S/wzw9JKp8mxTq5vSR6AfdPebmvEvFZ96ZDAYBzwq +D2fK/A+JYZ1lpTzlvBNbCNvj/+27BrtqBrF6T2XGgv0enIu1De5Iu7i9qgi0+6N8y5/NkHZchpZ4 +Vwpm+Vganf2XKWDeEaaQHBkc7gGWIjQ0LpH5t8Qn0Xvmv/uARFoW5evg1Ao4vOSR49XrXMGs3xtq +fJ7lddK2l4fbzIcrQzqECK+rPNv3PGYxhrCdU3nt+CPeQuMtgvEP5fqX +-----END CERTIFICATE----- + +GlobalSign Root CA - R3 +======================= +-----BEGIN CERTIFICATE----- +MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv +YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh +bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT +aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln +bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt +iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ +0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3 +rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl +OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2 +xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7 +lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8 +EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E +bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18 +YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r +kpeDMdmztcpHWD9f +-----END CERTIFICATE----- + +TC TrustCenter Universal CA III +=============================== +-----BEGIN CERTIFICATE----- +MIID4TCCAsmgAwIBAgIOYyUAAQACFI0zFQLkbPQwDQYJKoZIhvcNAQEFBQAwezELMAkGA1UEBhMC +REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy +IFVuaXZlcnNhbCBDQTEoMCYGA1UEAxMfVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIElJSTAe +Fw0wOTA5MDkwODE1MjdaFw0yOTEyMzEyMzU5NTlaMHsxCzAJBgNVBAYTAkRFMRwwGgYDVQQKExNU +QyBUcnVzdENlbnRlciBHbWJIMSQwIgYDVQQLExtUQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0Ex +KDAmBgNVBAMTH1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQSBJSUkwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDC2pxisLlxErALyBpXsq6DFJmzNEubkKLF5+cvAqBNLaT6hdqbJYUt +QCggbergvbFIgyIpRJ9Og+41URNzdNW88jBmlFPAQDYvDIRlzg9uwliT6CwLOunBjvvya8o84pxO +juT5fdMnnxvVZ3iHLX8LR7PH6MlIfK8vzArZQe+f/prhsq75U7Xl6UafYOPfjdN/+5Z+s7Vy+Eut +CHnNaYlAJ/Uqwa1D7KRTyGG299J5KmcYdkhtWyUB0SbFt1dpIxVbYYqt8Bst2a9c8SaQaanVDED1 +M4BDj5yjdipFtK+/fz6HP3bFzSreIMUWWMv5G/UPyw0RUmS40nZid4PxWJ//AgMBAAGjYzBhMB8G +A1UdIwQYMBaAFFbn4VslQ4Dg9ozhcbyO5YAvxEjiMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ +BAQDAgEGMB0GA1UdDgQWBBRW5+FbJUOA4PaM4XG8juWAL8RI4jANBgkqhkiG9w0BAQUFAAOCAQEA +g8ev6n9NCjw5sWi+e22JLumzCecYV42FmhfzdkJQEw/HkG8zrcVJYCtsSVgZ1OK+t7+rSbyUyKu+ +KGwWaODIl0YgoGhnYIg5IFHYaAERzqf2EQf27OysGh+yZm5WZ2B6dF7AbZc2rrUNXWZzwCUyRdhK +BgePxLcHsU0GDeGl6/R1yrqc0L2z0zIkTO5+4nYES0lT2PLpVDP85XEfPRRclkvxOvIAu2y0+pZV +CIgJwcyRGSmwIC3/yzikQOEXvnlhgP8HA4ZMTnsGnxGGjYnuJ8Tb4rwZjgvDwxPHLQNjO9Po5KIq +woIIlBZU8O8fJ5AluA0OKBtHd0e9HKgl8ZS0Zg== +-----END CERTIFICATE----- + +Autoridad de Certificacion Firmaprofesional CIF A62634068 +========================================================= +-----BEGIN CERTIFICATE----- +MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA +BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2 +MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw +QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB +NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD +Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P +B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY +7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH +ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI +plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX +MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX +LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK +bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU +vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud +EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH +DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp +cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA +bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx +ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx +51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk +R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP +T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f +Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl +osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR +crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR +saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD +KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi +6Et8Vcad+qMUu2WFbm5PEn4KPJ2V +-----END CERTIFICATE----- + +Izenpe.com +========== +-----BEGIN CERTIFICATE----- +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 +-----END CERTIFICATE----- + +Chambers of Commerce Root - 2008 +================================ +-----BEGIN CERTIFICATE----- +MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD +MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv +bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu +QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy +Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl +ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF +EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl +cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC +AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA +XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj +h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/ +ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk +NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g +D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331 +lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ +0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj +ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2 +EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI +G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ +BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh +bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh +bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC +CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH +AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1 +wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH +3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU +RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6 +M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1 +YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF +9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK +zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG +nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg +OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ +-----END CERTIFICATE----- + +Global Chambersign Root - 2008 +============================== +-----BEGIN CERTIFICATE----- +MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD +MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv +bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu +QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx +NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg +Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ +QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD +aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf +VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf +XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0 +ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB +/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA +TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M +H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe +Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF +HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh +wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB +AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT +BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE +BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm +aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm +aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp +1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0 +dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG +/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6 +ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s +dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg +9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH +foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du +qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr +P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq +c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z +09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B +-----END CERTIFICATE----- + +Go Daddy Root Certificate Authority - G2 +======================================== +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT +B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu +MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 +MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 +b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G +A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq +9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD ++qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd +fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl +NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9 +BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac +vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r +5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV +N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO +LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1 +-----END CERTIFICATE----- + +Starfield Root Certificate Authority - G2 +========================================= +-----BEGIN CERTIFICATE----- +MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT +B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s +b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0 +eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw +DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg +VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB +dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv +W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs +bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk +N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf +ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU +JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol +TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx +4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw +F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K +pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ +c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 +-----END CERTIFICATE----- + +Starfield Services Root Certificate Authority - G2 +================================================== +-----BEGIN CERTIFICATE----- +MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT +B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s +b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl +IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV +BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT +dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg +Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2 +h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa +hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP +LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB +rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw +AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG +SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP +E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy +xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd +iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza +YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6 +-----END CERTIFICATE----- + +AffirmTrust Commercial +====================== +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS +BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw +MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly +bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb +DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV +C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6 +BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww +MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV +HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG +hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi +qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv +0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh +sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= +-----END CERTIFICATE----- + +AffirmTrust Networking +====================== +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS +BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw +MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly +bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE +Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI +dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24 +/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb +h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV +HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu +UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6 +12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23 +WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9 +/ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= +-----END CERTIFICATE----- + +AffirmTrust Premium +=================== +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS +BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy +OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy +dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn +BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV +5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs ++7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd +GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R +p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI +S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04 +6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5 +/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo ++Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv +MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg +Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC +6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S +L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK ++4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV +BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg +IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60 +g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb +zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw== +-----END CERTIFICATE----- + +AffirmTrust Premium ECC +======================= +-----BEGIN CERTIFICATE----- +MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV +BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx +MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U +cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ +N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW +BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK +BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X +57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM +eQ== +-----END CERTIFICATE----- + +Certum Trusted Network CA +========================= +-----BEGIN CERTIFICATE----- +MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK +ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy +MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU +ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC +l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J +J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4 +fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0 +cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB +Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw +DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj +jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1 +mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj +Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI +03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= +-----END CERTIFICATE----- + +Certinomis - Autorité Racine +============================= +-----BEGIN CERTIFICATE----- +MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK +Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg +LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG +A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw +JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa +wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly +Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw +2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N +jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q +c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC +lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb +xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g +530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna +4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ +KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x +WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva +R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40 +nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B +CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv +JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE +qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b +WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE +wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/ +vgt2Fl43N+bYdJeimUV5 +-----END CERTIFICATE----- + +Root CA Generalitat Valenciana +============================== +-----BEGIN CERTIFICATE----- +MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE +ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290 +IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3 +WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE +CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2 +F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B +ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ +D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte +JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB +AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n +dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB +ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl +AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA +YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy +AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA +aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt +AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA +YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu +AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA +OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0 +dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV +BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G +A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S +b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh +TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz +Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63 +NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH +iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt ++GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM= +-----END CERTIFICATE----- + +A-Trust-nQual-03 +================ +-----BEGIN CERTIFICATE----- +MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJBVDFIMEYGA1UE +Cgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBpbSBlbGVrdHIuIERhdGVudmVy +a2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5RdWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5R +dWFsLTAzMB4XDTA1MDgxNzIyMDAwMFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgw +RgYDVQQKDD9BLVRydXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0 +ZW52ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMMEEEtVHJ1 +c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtPWFuA/OQO8BBC4SA +zewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUjlUC5B3ilJfYKvUWG6Nm9wASOhURh73+n +yfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZznF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPE +SU7l0+m0iKsMrmKS1GWH2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4 +iHQF63n1k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs2e3V +cuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECERqlWdV +eRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAVdRU0VlIXLOThaq/Yy/kgM40 +ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fGKOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmr +sQd7TZjTXLDR8KdCoLXEjq/+8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZd +JXDRZslo+S4RFGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS +mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmEDNuxUCAKGkq6 +ahq97BvIxYSazQ== +-----END CERTIFICATE----- + +TWCA Root Certification Authority +================================= +-----BEGIN CERTIFICATE----- +MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ +VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG +EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB +IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx +QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC +oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP +4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r +y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB +BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG +9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC +mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW +QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY +T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny +Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== +-----END CERTIFICATE----- + +Security Communication RootCA2 +============================== +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc +U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh +dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC +SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy +aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++ ++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R +3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV +spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K +EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8 +QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB +CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj +u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk +3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q +tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29 +mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 +-----END CERTIFICATE----- + +EC-ACC +====== +-----BEGIN CERTIFICATE----- +MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE +BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w +ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD +VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE +CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT +BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7 +MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt +SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl +Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh +cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK +w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT +ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4 +HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a +E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw +0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD +VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0 +Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l +dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ +lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa +Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe +l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2 +E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D +5EI= +-----END CERTIFICATE----- diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 452eadc656..9ea3435ea1 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -96,12 +96,12 @@ struct http_get_data { }; typedef struct http_get_data http_get_data_t; -static switch_status_t http_get(cached_url_t *url, switch_core_session_t *session); +static switch_status_t http_get(url_cache_t *cache, cached_url_t *url, switch_core_session_t *session); static size_t get_file_callback(void *ptr, size_t size, size_t nmemb, void *get); static size_t get_header_callback(void *ptr, size_t size, size_t nmemb, void *url); static void process_cache_control_header(cached_url_t *url, char *data); -static switch_status_t http_put(switch_core_session_t *session, const char *url, const char *filename); +static switch_status_t http_put(url_cache_t *cache, switch_core_session_t *session, const char *url, const char *filename); /** * Queue used for clock cache replacement algorithm. This @@ -159,6 +159,12 @@ struct url_cache { int shutdown; /** Synchronizes shutdown of cache */ switch_thread_rwlock_t *shutdown_lock; + /** SSL cert filename */ + char *ssl_cacert; + /** Verify certificate */ + int ssl_verifypeer; + /** Verify that hostname matches certificate */ + int ssl_verifyhost; }; static url_cache_t gcache; @@ -173,12 +179,13 @@ static void url_cache_clear(url_cache_t *cache, switch_core_session_t *session); /** * Put a file to the URL + * @param cache the cache * @param session the (optional) session uploading the file * @param url The URL * @param filename The file to upload * @return SWITCH_STATUS_SUCCESS if successful */ -static switch_status_t http_put(switch_core_session_t *session, const char *url, const char *filename) +static switch_status_t http_put(url_cache_t *cache, switch_core_session_t *session, const char *url, const char *filename) { switch_status_t status = SWITCH_STATUS_SUCCESS; CURL *curl_handle = NULL; @@ -223,6 +230,18 @@ static switch_status_t http_put(switch_core_session_t *session, const char *url, switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10); switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-http-cache/1.0"); + if (!cache->ssl_verifypeer) { + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); + } else { + /* this is the file with all the trusted certificate authorities */ + if (!zstr(cache->ssl_cacert)) { + switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, cache->ssl_cacert); + } + /* verify that the host name matches the cert */ + if (!cache->ssl_verifyhost) { + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L); + } + } switch_curl_easy_perform(curl_handle); switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes); switch_curl_easy_cleanup(curl_handle); @@ -485,7 +504,7 @@ static char *url_cache_get(url_cache_t *cache, switch_core_session_t *session, c /* download the file */ url_cache_unlock(cache, session); - if (http_get(u, session) == SWITCH_STATUS_SUCCESS) { + if (http_get(cache, u, session) == SWITCH_STATUS_SUCCESS) { /* Got the file, let the waiters know it is available */ url_cache_lock(cache, session); u->status = CACHED_URL_AVAILABLE; @@ -708,11 +727,12 @@ static void cached_url_destroy(cached_url_t *url, switch_memory_pool_t *pool) /** * Fetch a file via HTTP + * @param cache the cache * @param url The cached URL entry * @param session the (optional) session * @return SWITCH_STATUS_SUCCESS if successful */ -static switch_status_t http_get(cached_url_t *url, switch_core_session_t *session) +static switch_status_t http_get(url_cache_t *cache, cached_url_t *url, switch_core_session_t *session) { switch_status_t status = SWITCH_STATUS_SUCCESS; switch_CURL *curl_handle = NULL; @@ -734,7 +754,19 @@ static switch_status_t http_get(cached_url_t *url, switch_core_session_t *sessio switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &get_data); switch_curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, get_header_callback); switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, (void *) url); - switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-http-cache/1.0"); + switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-http-cache/1.0"); + if (!cache->ssl_verifypeer) { + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); + } else { + /* this is the file with all the trusted certificate authorities */ + if (!zstr(cache->ssl_cacert)) { + switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, cache->ssl_cacert); + } + /* verify that the host name matches the cert */ + if (!cache->ssl_verifyhost) { + switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L); + } + } switch_curl_easy_perform(curl_handle); switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes); switch_curl_easy_cleanup(curl_handle); @@ -791,7 +823,7 @@ static void setup_dir(url_cache_t *cache) static int isUrl(const char *filename) { - return !zstr(filename) && !strncmp("http://", filename, strlen("http://")); + return !zstr(filename) && (!strncmp("http://", filename, strlen("http://")) || !strncmp("https://", filename, strlen("https://"))); } #define HTTP_PREFETCH_SYNTAX "" @@ -910,7 +942,7 @@ SWITCH_STANDARD_API(http_cache_put) char *argv[10] = { 0 }; int argc = 0; - if (zstr(cmd) || strncmp("http://", cmd, strlen("http://"))) { + if (zstr(cmd) || (strncmp("http://", cmd, strlen("http://")) && strncmp("https://", cmd, strlen("https://")))) { stream->write_function(stream, "USAGE: %s\n", HTTP_PUT_SYNTAX); status = SWITCH_STATUS_SUCCESS; goto done; @@ -924,7 +956,7 @@ SWITCH_STANDARD_API(http_cache_put) goto done; } - status = http_put(session, argv[0], argv[1]); + status = http_put(&gcache, session, argv[0], argv[1]); if (status == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { @@ -1013,6 +1045,9 @@ static switch_status_t do_config(url_cache_t *cache) cache->location = SWITCH_PREFIX_DIR "/http_cache"; cache->prefetch_queue_size = 100; cache->prefetch_thread_count = 8; + cache->ssl_cacert = SWITCH_PREFIX_DIR "/conf/cacert.pem"; + cache->ssl_verifyhost = 1; + cache->ssl_verifypeer = 1; /* get params */ settings = switch_xml_child(cfg, "settings"); @@ -1035,6 +1070,15 @@ static switch_status_t do_config(url_cache_t *cache) } else if (!strcasecmp(var, "prefetch-thread-count")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting prefetch-thread-count to %s\n", val); cache->prefetch_thread_count = atoi(val); + } else if (!strcasecmp(var, "ssl-cacert")) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting ssl-cacert to %s\n", val); + cache->ssl_cacert = switch_core_strdup(cache->pool, val); + } else if (!strcasecmp(var, "ssl-verifyhost")) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting ssl-verifyhost to %s\n", val); + cache->ssl_verifyhost = !switch_false(val); /* only disable if explicitly set to false */ + } else if (!strcasecmp(var, "ssl-verifypeer")) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting ssl-verifypeer to %s\n", val); + cache->ssl_verifypeer = !switch_false(val); /* only disable if explicitly set to false */ } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unsupported param: %s\n", var); } From 4178393a73dc3ed2137491e1da0dfcf92fcd9fbf Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Wed, 25 Apr 2012 01:30:47 +0000 Subject: [PATCH 0044/1057] fix bug with max-age --- src/mod/applications/mod_http_cache/mod_http_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 9ea3435ea1..1e40ce2e15 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -365,7 +365,7 @@ static void process_cache_control_header(cached_url_t *url, char *data) return; } - url->max_age = switch_time_now() + (max_age * 1000 * 1000); + url->max_age = max_age * 1000 * 1000; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting max age to %u seconds from now\n", (int)max_age); } From 0e4fa9e23bd0bc2f3c639e47ee764552f6384755 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 25 Apr 2012 09:11:27 +0200 Subject: [PATCH 0045/1057] gsmopen: AT+CREG erratic behavior does no more give errors or warnings when badly formatted unsolicited signaling --- .../mod_gsmopen/gsmopen_protocol.cpp | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index b59860356d..33afb72e29 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -949,28 +949,29 @@ read: if (option_debug > 1) DEBUGA_GSMOPEN("|%s| +CREG: Display: %d, Registration=%d\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], n, stat); if (err < 2) { - WARNINGA("|%s| is not formatted as: |+CREG: xx,yy|\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); - } - if (stat == 0) { - ERRORA - ("|%s| CELLPHONE is not registered to network, consider to move it or additional antenna\n", - GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); - tech_pvt->not_registered = 1; - tech_pvt->home_network_registered = 0; - tech_pvt->roaming_registered = 0; - alarm_event(tech_pvt, ALARM_NO_NETWORK_REGISTRATION, + DEBUGA_GSMOPEN("|%s| is not formatted as: |+CREG: xx,yy|\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); + }else{ + if (stat == 0) { + ERRORA + ("|%s| CELLPHONE is not registered to network, consider to move it or additional antenna\n", + GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); + tech_pvt->not_registered = 1; + tech_pvt->home_network_registered = 0; + tech_pvt->roaming_registered = 0; + alarm_event(tech_pvt, ALARM_NO_NETWORK_REGISTRATION, "CELLPHONE is not registered to network, consider to move it or additional antenna"); - } else if (stat == 1) { - DEBUGA_GSMOPEN("|%s| CELLPHONE is registered to the HOME network\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); - tech_pvt->not_registered = 0; - tech_pvt->home_network_registered = 1; - tech_pvt->roaming_registered = 0; - } else { - ERRORA("|%s| CELLPHONE is registered to a ROAMING network\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); - tech_pvt->not_registered = 0; - tech_pvt->home_network_registered = 0; - tech_pvt->roaming_registered = 1; - alarm_event(tech_pvt, ALARM_ROAMING_NETWORK_REGISTRATION, "CELLPHONE is registered to a ROAMING network"); + } else if (stat == 1) { + DEBUGA_GSMOPEN("|%s| CELLPHONE is registered to the HOME network\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); + tech_pvt->not_registered = 0; + tech_pvt->home_network_registered = 1; + tech_pvt->roaming_registered = 0; + } else { + ERRORA("|%s| CELLPHONE is registered to a ROAMING network\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); + tech_pvt->not_registered = 0; + tech_pvt->home_network_registered = 0; + tech_pvt->roaming_registered = 1; + alarm_event(tech_pvt, ALARM_ROAMING_NETWORK_REGISTRATION, "CELLPHONE is registered to a ROAMING network"); + } } } From 7821e8ad9d4df05a6ade4f25b5305636c41458b3 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 25 Apr 2012 08:03:10 +0000 Subject: [PATCH 0046/1057] getsounds.sh: avoid copying sound files --- build/getsounds.sh.in | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/build/getsounds.sh.in b/build/getsounds.sh.in index f25922c7ef..de6cc72947 100755 --- a/build/getsounds.sh.in +++ b/build/getsounds.sh.in @@ -22,17 +22,17 @@ echo -n "#" pwd echo "# $0 $1 $2" -if [ ! -f $tarfile ] ; then - if [ -f $FS_SOUNDS_DIR/$tarfile ]; then - cp -l $FS_SOUNDS_DIR/$tarfile . \ - || cp $FS_SOUNDS_DIR/$tarfile . - else - $DOWNLOAD_CMD $base$tarfile - if [ ! -f $tarfile ] ; then - echo cannot find $tarfile - exit 1 - fi - fi +if [ -n "$FS_SOUNDS_DIR" ] ; then + [ -d $FS_SOUNDS_DIR ] || mkdir -p $FS_SOUNDS_DIR + DIR=$FS_SOUNDS_DIR +fi + +if [ ! -f $DIR/$tarfile ] ; then + (cd $DIR && $DOWNLOAD_CMD $base$tarfile) + if [ ! -f $DIR/$tarfile ] ; then + echo cannot find $tarfile + exit 1 + fi fi if [ ! -z $install ] ; then From 9a2b82dace36c4db2821820dd01fc6cc76946318 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 25 Apr 2012 08:04:00 +0000 Subject: [PATCH 0047/1057] getsounds.sh: add mode-line and reindent --- build/getsounds.sh.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build/getsounds.sh.in b/build/getsounds.sh.in index de6cc72947..1e3c760a3c 100755 --- a/build/getsounds.sh.in +++ b/build/getsounds.sh.in @@ -1,4 +1,5 @@ #!/bin/sh +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- TAR=@TAR@ ZCAT=@ZCAT@ @@ -8,10 +9,10 @@ CURL=@CURL@ DIR=`pwd` if [ -x "$WGET" ] ; then - DOWNLOAD_CMD=$WGET + DOWNLOAD_CMD=$WGET fi if [ "x${DOWNLOAD_CMD}" = "x" -a -x "$CURL" ] ; then - DOWNLOAD_CMD="$CURL -O" + DOWNLOAD_CMD="$CURL -O" fi base=http://files.freeswitch.org/ @@ -23,8 +24,8 @@ pwd echo "# $0 $1 $2" if [ -n "$FS_SOUNDS_DIR" ] ; then - [ -d $FS_SOUNDS_DIR ] || mkdir -p $FS_SOUNDS_DIR - DIR=$FS_SOUNDS_DIR + [ -d $FS_SOUNDS_DIR ] || mkdir -p $FS_SOUNDS_DIR + DIR=$FS_SOUNDS_DIR fi if [ ! -f $DIR/$tarfile ] ; then @@ -36,8 +37,8 @@ if [ ! -f $DIR/$tarfile ] ; then fi if [ ! -z $install ] ; then - test -d $install || mkdir $install - cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR xf - + test -d $install || mkdir $install + cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR xf - fi exit 0 From 59d08bd033f05aacc89fb13029b4a99a89fcd768 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 25 Apr 2012 08:05:42 +0000 Subject: [PATCH 0048/1057] getsounds.sh: style tweaks --- build/getsounds.sh.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build/getsounds.sh.in b/build/getsounds.sh.in index 1e3c760a3c..3f14eab822 100755 --- a/build/getsounds.sh.in +++ b/build/getsounds.sh.in @@ -8,7 +8,7 @@ CURL=@CURL@ DIR=`pwd` -if [ -x "$WGET" ] ; then +if [ -x "$WGET" ]; then DOWNLOAD_CMD=$WGET fi if [ "x${DOWNLOAD_CMD}" = "x" -a -x "$CURL" ] ; then @@ -23,22 +23,22 @@ echo -n "#" pwd echo "# $0 $1 $2" -if [ -n "$FS_SOUNDS_DIR" ] ; then +if [ -n "$FS_SOUNDS_DIR" ]; then [ -d $FS_SOUNDS_DIR ] || mkdir -p $FS_SOUNDS_DIR DIR=$FS_SOUNDS_DIR fi -if [ ! -f $DIR/$tarfile ] ; then +if [ ! -f $DIR/$tarfile ]; then (cd $DIR && $DOWNLOAD_CMD $base$tarfile) - if [ ! -f $DIR/$tarfile ] ; then - echo cannot find $tarfile + if [ ! -f $DIR/$tarfile ]; then + echo "cannot find $tarfile" exit 1 fi fi -if [ ! -z $install ] ; then +if [ ! -z "$install" ]; then test -d $install || mkdir $install - cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR xf - + (cd $install && $ZCAT -c -d $DIR/$tarfile | $TAR xf -) fi exit 0 From 893d7eff9d112a7392152668abec772626b253e2 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 25 Apr 2012 11:21:55 +0200 Subject: [PATCH 0049/1057] gsmopen: correct sequence of callflow when got CEND: (nocarrier)->(hangup)->(idle) --- .../mod_gsmopen/gsmopen_protocol.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 33afb72e29..33b06c82d6 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -988,16 +988,6 @@ read: } if ((strncmp(tech_pvt->line_array.result[i], "^CEND:1", 7) == 0)) { - tech_pvt->phone_callflow = CALLFLOW_CALL_IDLE; - if (option_debug > 1) - DEBUGA_GSMOPEN("|%s| CALLFLOW_CALL_IDLE\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); - if (tech_pvt->interface_state != GSMOPEN_STATE_DOWN && tech_pvt->owner) { - DEBUGA_GSMOPEN("just received a remote HANGUP\n", GSMOPEN_P_LOG); - tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_NORMAL; - gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); - DEBUGA_GSMOPEN("just sent GSMOPEN_CONTROL_HANGUP\n", GSMOPEN_P_LOG); - } - tech_pvt->phone_callflow = CALLFLOW_CALL_NOCARRIER; if (option_debug > 1) DEBUGA_GSMOPEN("|%s| CALLFLOW_CALL_NOCARRIER\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); @@ -1015,6 +1005,17 @@ read: switch_core_session_rwunlock(session); switch_channel_hangup(channel, SWITCH_CAUSE_NONE); } + tech_pvt->phone_callflow = CALLFLOW_CALL_IDLE; + if (option_debug > 1) + DEBUGA_GSMOPEN("|%s| CALLFLOW_CALL_IDLE\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); + if (tech_pvt->interface_state != GSMOPEN_STATE_DOWN && tech_pvt->owner) { + DEBUGA_GSMOPEN("just received a remote HANGUP\n", GSMOPEN_P_LOG); + tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_NORMAL; + gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); + DEBUGA_GSMOPEN("just sent GSMOPEN_CONTROL_HANGUP\n", GSMOPEN_P_LOG); + } + + // //tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; //gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); From 65c4f76f407670a506998228c87580d3fdda7293 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Wed, 25 Apr 2012 17:58:41 +0000 Subject: [PATCH 0050/1057] allow space after filename in play_and_detect_speech --- src/mod/applications/mod_dptools/mod_dptools.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index d40e74d017..3331226e9d 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -464,6 +464,7 @@ SWITCH_STANDARD_APP(play_and_detect_speech_function) char *lbuf = NULL; const char *response = "DONE"; char *detect = NULL; + char *s; switch_channel_set_variable(channel, "detect_speech_result", ""); @@ -474,6 +475,12 @@ SWITCH_STANDARD_APP(play_and_detect_speech_function) goto done; } + /* trim any trailing space */ + s = detect; + while (--s >= lbuf && switch_isspace(*s)) { + *s = '\0'; + } + /* split input at "detect:" */ detect[0] = '\0'; detect += 7; From ba4280e61f3bf2f033e3c483d207083a31fcdf65 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 25 Apr 2012 15:15:15 -0400 Subject: [PATCH 0051/1057] try to add a tag to disable timer autorequire NUTAG_TIMER_AUTOREQUIRE(0) --- .../libsofia-sip-ua/nua/nua_params.c | 6 ++++++ .../libsofia-sip-ua/nua/nua_params.h | 3 +++ .../libsofia-sip-ua/nua/nua_session.c | 21 ++++++++++++------- libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c | 2 ++ .../libsofia-sip-ua/nua/sofia-sip/nua_tag.h | 5 +++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c index 58b480440a..0f6a491dff 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c @@ -139,6 +139,7 @@ int nua_stack_set_defaults(nua_handle_t *nh, NHP_SET(nhp, only183_100rel, 0); NHP_SET(nhp, auto_answer, 0); NHP_SET(nhp, auto_ack, 1); + NHP_SET(nhp, timer_autorequire, 1); NHP_SET(nhp, invite_timeout, 120); nhp->nhp_session_timer = 1800; @@ -741,6 +742,10 @@ static int nhp_set_tags(su_home_t *home, else if (tag == nutag_autoack) { NHP_SET(nhp, auto_ack, value != 0); } + /* NUTAG_TIMER_AUTOREQUIRE(timer_autorequire) */ + else if (tag == nutag_timer_autorequire) { + NHP_SET(nhp, timer_autorequire, value != 0); + } /* NUTAG_INVITE_TIMER(invite_timeout) */ else if (tag == nutag_invite_timer) { NHP_SET(nhp, invite_timeout, (unsigned)value); @@ -1647,6 +1652,7 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e, TIF(NUTAG_ONLY183_100REL, only183_100rel), TIF(NUTAG_AUTOANSWER, auto_answer), TIF(NUTAG_AUTOACK, auto_ack), + TIF(NUTAG_TIMER_AUTOREQUIRE, timer_autorequire), TIF(NUTAG_INVITE_TIMER, invite_timeout), TIFD(NUTAG_SESSION_TIMER, session_timer), diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h index 1904a080c5..9fe4a98652 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h @@ -109,6 +109,8 @@ struct nua_handle_preferences /** Always include id with Event: refer */ unsigned nhp_refer_with_id:1; + + unsigned nhp_timer_autorequire:1; unsigned:0; /* Default lifetime for implicit subscriptions created by REFER */ @@ -207,6 +209,7 @@ struct nua_handle_preferences unsigned nhb_appl_method:1; unsigned nhb_initial_route:1; unsigned nhb_proxy:1; + unsigned nhb_timer_autorequire:1; unsigned :0; } set_bits; unsigned set_unsigned[2]; 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 1958b5645a..25ec7c9460 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -370,7 +370,8 @@ static int session_timer_check_min_se(msg_t *msg, sip_t *sip, static int session_timer_add_headers(struct session_timer *t, int initial, - msg_t *msg, sip_t *sip); + msg_t *msg, sip_t *sip, + nua_handle_t *nh); static void session_timer_negotiate(struct session_timer *t, int uas); @@ -791,7 +792,7 @@ static int nua_invite_client_request(nua_client_request_t *cr, /* Add session timer headers */ if (session_timer_is_supported(ss->ss_timer)) session_timer_add_headers(ss->ss_timer, ss->ss_state == nua_callstate_init, - msg, sip); + msg, sip, nh); ss->ss_100rel = NH_PGET(nh, early_media); ss->ss_precondition = sip_has_feature(sip->sip_require, "precondition"); @@ -2436,7 +2437,7 @@ int nua_invite_server_respond(nua_server_request_t *sr, tagi_t const *tags) NH_PGET(nh, min_se)); if (session_timer_is_supported(ss->ss_timer)) - session_timer_add_headers(ss->ss_timer, 0, msg, sip); + session_timer_add_headers(ss->ss_timer, 0, msg, sip, nh); } return nua_base_server_respond(sr, tags); @@ -3354,7 +3355,7 @@ static int nua_update_client_request(nua_client_request_t *cr, if (session_timer_is_supported(ss->ss_timer)) session_timer_add_headers(ss->ss_timer, ss->ss_state < nua_callstate_ready, - msg, sip); + msg, sip, nh); retval = nua_base_client_request(cr, msg, sip, NULL); @@ -3610,7 +3611,7 @@ int nua_update_server_respond(nua_server_request_t *sr, tagi_t const *tags) nua_server_request_t *sr0; int uas; - session_timer_add_headers(ss->ss_timer, 0, msg, sip); + session_timer_add_headers(ss->ss_timer, 0, msg, sip, nh); for (sr0 = nh->nh_ds->ds_sr; sr0; sr0 = sr0->sr_next) if (sr0->sr_method == sip_method_invite) @@ -4426,18 +4427,24 @@ static int session_timer_add_headers(struct session_timer *t, int initial, msg_t *msg, - sip_t *sip) + sip_t *sip, + nua_handle_t *nh) { unsigned long expires, min; sip_min_se_t min_se[1]; sip_session_expires_t x[1]; int uas; + int autorequire = 1; enum nua_session_refresher refresher = nua_any_refresher; static sip_param_t const x_params_uac[] = {"refresher=uac", NULL}; static sip_param_t const x_params_uas[] = {"refresher=uas", NULL}; + if ( !NH_PGET(nh, timer_autorequire) && NH_PISSET(nh, timer_autorequire)) { + autorequire = 0; + } + if (!t->local.supported) return 0; @@ -4491,7 +4498,7 @@ session_timer_add_headers(struct session_timer *t, /* Min-SE: 0 is optional with initial INVITE */ || !initial, SIPTAG_MIN_SE(min_se)), - //TAG_IF(refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")), + //TAG_IF(autorequire && refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")), TAG_END()); return 1; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c index 96ca20baee..491d485731 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c @@ -1329,6 +1329,8 @@ tag_typedef_t nutag_autoanswer = BOOLTAG_TYPEDEF(autoAnswer); */ tag_typedef_t nutag_autoack = BOOLTAG_TYPEDEF(autoACK); +tag_typedef_t nutag_timer_autorequire = BOOLTAG_TYPEDEF(timerAutorequire); + /**@def NUTAG_AUTOACK_REF(x) * Reference tag for NUTAG_AUTOACK(). */ diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h b/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h index 9e710d052d..813e0d757a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h +++ b/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h @@ -199,6 +199,11 @@ SOFIAPUBVAR tag_typedef_t nutag_autoack; #define NUTAG_AUTOACK_REF(x) nutag_autoack_ref, tag_bool_vr(&(x)) SOFIAPUBVAR tag_typedef_t nutag_autoack_ref; +#define NUTAG_TIMER_AUTOREQUIRE(x) nutag_timer_autorequire, tag_bool_v(x) +SOFIAPUBVAR tag_typedef_t nutag_timer_autorequire; +#define NUTAG_TIMER_AUTOREQUIRE_REF(x) nutag_timer_autorequire_ref, tag_bool_vr(&(x)) +SOFIAPUBVAR tag_typedef_t nutag_timer_autorequire_ref; + #define NUTAG_AUTOANSWER(x) nutag_autoanswer, tag_bool_v(x) SOFIAPUBVAR tag_typedef_t nutag_autoanswer; #define NUTAG_AUTOANSWER_REF(x) nutag_autoanswer_ref, tag_bool_vr(&(x)) From 7d3816dbea4af4f9e764eef8eb489896e1c76081 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 25 Apr 2012 15:19:47 -0400 Subject: [PATCH 0052/1057] silence set but not used --- libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 25ec7c9460..cc857a3716 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -4498,7 +4498,7 @@ session_timer_add_headers(struct session_timer *t, /* Min-SE: 0 is optional with initial INVITE */ || !initial, SIPTAG_MIN_SE(min_se)), - //TAG_IF(autorequire && refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")), + TAG_IF(0 && autorequire && refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")), TAG_END()); return 1; From 7a147e47629b00a9b544e2eb6ed721b39d56661b Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 25 Apr 2012 17:14:55 -0500 Subject: [PATCH 0053/1057] Update a ton of copyright statements to make sure the dates are proper --- build/ignore_helper.pl | 2 +- freeswitch.spec | 6 +++--- fscomm/call.cpp | 2 +- fscomm/call.h | 2 +- fscomm/debugtools/sortfilterproxymodel.h | 2 +- fscomm/fshost.cpp | 2 +- fscomm/fshost.h | 2 +- fscomm/main.cpp | 2 +- fscomm/mainwindow.cpp | 2 +- fscomm/mainwindow.h | 2 +- libs/esl/ivrd.c | 2 +- libs/esl/src/esl.c | 2 +- libs/esl/src/esl_buffer.c | 2 +- libs/esl/src/esl_config.c | 2 +- libs/esl/src/esl_event.c | 2 +- libs/esl/src/include/esl.h | 2 +- libs/esl/src/include/esl_buffer.h | 2 +- libs/esl/src/include/esl_config.h | 2 +- libs/esl/src/include/esl_event.h | 2 +- libs/esl/src/include/esl_oop.h | 2 +- libs/freetdm/Makefile.am | 2 +- libs/freetdm/src/ftdm_buffer.c | 2 +- libs/freetdm/src/ftdm_config.c | 2 +- libs/freetdm/src/ftdm_io.c | 2 +- libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h | 2 +- libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c | 2 +- libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h | 2 +- libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c | 2 +- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 2 +- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h | 2 +- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 2 +- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h | 2 +- libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c | 2 +- libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h | 2 +- libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h | 2 +- libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c | 2 +- libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c | 2 +- libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 2 +- libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c | 2 +- libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h | 2 +- libs/freetdm/src/include/freetdm.h | 2 +- libs/freetdm/src/include/private/ftdm_buffer.h | 2 +- libs/freetdm/src/include/private/ftdm_config.h | 2 +- libs/freetdm/src/include/private/ftdm_types.h | 2 +- libs/freetdm/src/include/private/libteletone.h | 2 +- libs/freetdm/src/include/private/libteletone_detect.h | 2 +- libs/freetdm/src/include/private/libteletone_generate.h | 2 +- libs/freetdm/src/priserver.c | 2 +- libs/freetdm/src/sangoma_pri.c | 2 +- libs/freetdm/src/sangoma_pri.h | 2 +- libs/libdingaling/src/ldl_compat.h | 2 +- libs/libdingaling/src/libdingaling.h | 2 +- libs/libteletone/src/libteletone.h | 2 +- libs/libteletone/src/libteletone_detect.h | 2 +- libs/libteletone/src/libteletone_generate.h | 2 +- libs/openzap/Makefile.am | 2 +- libs/openzap/src/include/libteletone.h | 4 ++-- libs/openzap/src/include/libteletone_detect.h | 2 +- libs/openzap/src/include/libteletone_generate.h | 4 +--- libs/openzap/src/include/openzap.h | 2 +- libs/openzap/src/include/zap_buffer.h | 2 +- libs/openzap/src/include/zap_config.h | 2 +- libs/openzap/src/include/zap_types.h | 2 +- libs/openzap/src/libteletone_detect.c | 2 +- libs/openzap/src/libteletone_generate.c | 2 +- libs/openzap/src/m3ua_client.h | 2 +- libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c | 2 +- libs/openzap/src/ozmod/ozmod_analog/zap_analog.h | 2 +- libs/openzap/src/ozmod/ozmod_analog_em/ozmod_analog_em.c | 2 +- libs/openzap/src/ozmod/ozmod_analog_em/zap_analog_em.h | 2 +- libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c | 2 +- libs/openzap/src/ozmod/ozmod_isdn/zap_isdn.h | 2 +- libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.c | 2 +- libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.h | 2 +- libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c | 2 +- libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.h | 2 +- libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c | 2 +- libs/openzap/src/ozmod/ozmod_pika/zap_pika.h | 2 +- .../src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c | 2 +- .../src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c | 2 +- .../src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.h | 2 +- .../src/ozmod/ozmod_sangoma_boost/zap_sangoma_boost.h | 2 +- libs/openzap/src/ozmod/ozmod_skel/ozmod_skel.c | 2 +- libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c | 2 +- libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c | 2 +- libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.h | 2 +- libs/openzap/src/priserver.c | 2 +- libs/openzap/src/sangoma_pri.c | 2 +- libs/openzap/src/sangoma_pri.h | 2 +- libs/openzap/src/zap_buffer.c | 2 +- libs/openzap/src/zap_config.c | 2 +- libs/openzap/src/zap_io.c | 2 +- libs/openzap/src/zap_m3ua.c | 2 +- libs/stfu/stfu.c | 2 +- libs/stfu/stfu.h | 2 +- scripts/c/socket2me/socket2me.c | 2 +- scripts/javascript/api.js | 2 +- scripts/javascript/js_modules/SpeechTools.jm | 2 +- scripts/javascript/pizza.js | 2 +- scripts/javascript/ps_pizza.js | 2 +- scripts/python/freepy/__init__.py | 2 +- scripts/python/freepy/fseventlistener.py | 2 +- scripts/python/freepy/fshelper.py | 2 +- scripts/python/freepy/models.py | 2 +- scripts/python/freepy/request.py | 2 +- scripts/rss/rss2ivr.pl | 2 +- src/include/private/switch_core_pvt.h | 2 +- src/include/switch.h | 2 +- src/include/switch_apr.h | 2 +- src/include/switch_bitpack.h | 2 +- src/include/switch_buffer.h | 2 +- src/include/switch_caller.h | 2 +- src/include/switch_channel.h | 2 +- src/include/switch_config.h | 2 +- src/include/switch_console.h | 2 +- src/include/switch_core.h | 2 +- src/include/switch_core_db.h | 2 +- src/include/switch_core_event_hook.h | 2 +- src/include/switch_curl.h | 2 +- src/include/switch_event.h | 2 +- src/include/switch_frame.h | 2 +- src/include/switch_ivr.h | 2 +- src/include/switch_limit.h | 2 +- src/include/switch_loadable_module.h | 2 +- src/include/switch_log.h | 2 +- src/include/switch_module_interfaces.h | 2 +- src/include/switch_nat.h | 2 +- src/include/switch_odbc.h | 2 +- src/include/switch_platform.h | 2 +- src/include/switch_regex.h | 2 +- src/include/switch_resample.h | 2 +- src/include/switch_rtcp_frame.h | 2 +- src/include/switch_rtp.h | 2 +- src/include/switch_scheduler.h | 2 +- src/include/switch_ssl.h | 2 +- src/include/switch_stun.h | 2 +- src/include/switch_types.h | 2 +- src/include/switch_utils.h | 2 +- src/include/switch_version.h.cmake | 2 +- src/include/switch_version.h.template | 2 +- src/include/switch_xml.h | 2 +- src/include/switch_xml_config.h | 2 +- src/include/timerfd_wrap.h | 2 +- src/mod/applications/mod_fsk/fsk_callerid.h | 2 +- src/mod/applications/mod_mongo/mod_mongo.cpp | 2 +- src/mod/applications/mod_mongo/mod_mongo.h | 2 +- src/mod/applications/mod_mongo/mongo_conn.cpp | 2 +- src/mod/applications/mod_mp4/mod_mp4.cpp | 2 +- src/mod/applications/mod_osp/mod_osp.c | 2 +- src/mod/applications/mod_soundtouch/mod_soundtouch.cpp | 2 +- src/mod/applications/mod_spandsp/mod_spandsp.h | 2 +- src/mod/applications/mod_spandsp/mod_spandsp_modem.h | 2 +- src/mod/applications/mod_stress/mod_stress.cpp | 2 +- src/mod/applications/mod_voicemail_ivr/config.h | 2 +- src/mod/applications/mod_voicemail_ivr/ivr.h | 2 +- src/mod/applications/mod_voicemail_ivr/menu.h | 2 +- src/mod/applications/mod_voicemail_ivr/utils.h | 2 +- src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 2 +- src/mod/codecs/mod_silk/mod_silk.c | 2 +- .../alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h | 2 +- src/mod/endpoints/mod_gsmopen/gsmopen.h | 2 +- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 2 +- src/mod/endpoints/mod_khomp/mod_khomp.cpp | 2 +- src/mod/endpoints/mod_skypopen/skypopen.h | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_unicall/mod_unicall.c | 2 +- src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h | 2 +- src/mod/event_handlers/mod_snmp/FREESWITCH-MIB | 2 +- src/mod/event_handlers/mod_snmp/subagent.h | 2 +- src/mod/languages/mod_lua/mod_lua.cpp | 2 +- src/mod/languages/mod_spidermonkey/mod_spidermonkey.h | 2 +- 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 +- src/switch_cpp.cpp | 2 +- src/switch_limit.c | 2 +- src/switch_nat.c | 2 +- 187 files changed, 190 insertions(+), 192 deletions(-) diff --git a/build/ignore_helper.pl b/build/ignore_helper.pl index cc89c6814c..154afc7d4c 100644 --- a/build/ignore_helper.pl +++ b/build/ignore_helper.pl @@ -1,6 +1,6 @@ ################################################################################ # ignore_helper.pl -# Copyright (c) 2007-2009 Anthony Minessale II +# Copyright (c) 2007-2012 Anthony Minessale II # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation diff --git a/freeswitch.spec b/freeswitch.spec index 6fd9ad706e..de2bc65ebe 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1,4 +1,4 @@ -###################################################################################################################### +2012 ###################################################################################################################### # # spec file for package freeswitch @@ -11,7 +11,7 @@ # # This file is part of: # FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -# Copyright (C) 2005-2010, Anthony Minessale II +# Copyright (C) 2005-2012, Anthony Minessale II # # This file and all modifications and additions to the pristine package are under the same license as the package itself. # @@ -24,7 +24,7 @@ # Anthony Minessale II # # -# Maintainer(s): Michal Bielicki # ###################################################################################################################### # Module build settings diff --git a/fscomm/call.cpp b/fscomm/call.cpp index 3b91d7ee90..d60084d483 100644 --- a/fscomm/call.cpp +++ b/fscomm/call.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/fscomm/call.h b/fscomm/call.h index d2626f35af..72ea93f6de 100644 --- a/fscomm/call.h +++ b/fscomm/call.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/fscomm/debugtools/sortfilterproxymodel.h b/fscomm/debugtools/sortfilterproxymodel.h index c0b1c53890..d157856bfc 100644 --- a/fscomm/debugtools/sortfilterproxymodel.h +++ b/fscomm/debugtools/sortfilterproxymodel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/fscomm/fshost.cpp b/fscomm/fshost.cpp index 2bb5b36cd6..a113b33958 100644 --- a/fscomm/fshost.cpp +++ b/fscomm/fshost.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/fscomm/fshost.h b/fscomm/fshost.h index ce4371191d..59cf2024e9 100644 --- a/fscomm/fshost.h +++ b/fscomm/fshost.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/fscomm/main.cpp b/fscomm/main.cpp index c1069eded1..18a97e2757 100644 --- a/fscomm/main.cpp +++ b/fscomm/main.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/fscomm/mainwindow.cpp b/fscomm/mainwindow.cpp index 30450e1215..8f1323b374 100644 --- a/fscomm/mainwindow.cpp +++ b/fscomm/mainwindow.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/fscomm/mainwindow.h b/fscomm/mainwindow.h index 84f4103b3e..33f36b87ba 100644 --- a/fscomm/mainwindow.h +++ b/fscomm/mainwindow.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/esl/ivrd.c b/libs/esl/ivrd.c index c71e392117..3032a81cd3 100644 --- a/libs/esl/ivrd.c +++ b/libs/esl/ivrd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Anthony Minessale II + * Copyright (c) 2009-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index f6caeca0b3..fb50c6d0da 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/esl_buffer.c b/libs/esl/src/esl_buffer.c index 173c9cb76c..97f6b5813b 100644 --- a/libs/esl/src/esl_buffer.c +++ b/libs/esl/src/esl_buffer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Anthony Minessale II + * Copyright (c) 2010-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/esl_config.c b/libs/esl/src/esl_config.c index 2e24007799..8954c874a1 100644 --- a/libs/esl/src/esl_config.c +++ b/libs/esl/src/esl_config.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 1271e46e4f..6ebd6669b6 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index 2f1a50949a..7ba705359e 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/include/esl_buffer.h b/libs/esl/src/include/esl_buffer.h index c7901e4ede..9be62110d9 100644 --- a/libs/esl/src/include/esl_buffer.h +++ b/libs/esl/src/include/esl_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Anthony Minessale II + * Copyright (c) 2010-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/include/esl_config.h b/libs/esl/src/include/esl_config.h index 44fb23c911..515fd73cdb 100644 --- a/libs/esl/src/include/esl_config.h +++ b/libs/esl/src/include/esl_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/include/esl_event.h b/libs/esl/src/include/esl_event.h index 1cc6134e42..b7dea736c9 100644 --- a/libs/esl/src/include/esl_event.h +++ b/libs/esl/src/include/esl_event.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/esl/src/include/esl_oop.h b/libs/esl/src/include/esl_oop.h index 0ea1e5da89..9ffdae73a7 100644 --- a/libs/esl/src/include/esl_oop.h +++ b/libs/esl/src/include/esl_oop.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 35f1cecd1e..ab7bbff2b2 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2007, Anthony Minessale II +# Copyright (c) 2007-2012, Anthony Minessale II # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftdm_buffer.c b/libs/freetdm/src/ftdm_buffer.c index 000cddd3f9..015402556f 100644 --- a/libs/freetdm/src/ftdm_buffer.c +++ b/libs/freetdm/src/ftdm_buffer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftdm_config.c b/libs/freetdm/src/ftdm_config.c index 4dfc395e06..42b93cd78e 100644 --- a/libs/freetdm/src/ftdm_config.c +++ b/libs/freetdm/src/ftdm_config.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index caab35143a..252cbdb06c 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h b/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h index a2339120c5..47a7a43491 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 85da471739..25e2a5ac77 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h b/libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h index 83d5bb31d9..22a1c25132 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Anthony Minessale II + * Copyright (c) 2008-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c index 907a8cb034..f7f0683673 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Anthony Minessale II + * Copyright (c) 2008-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 4abddf16e1..be5ab50965 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h index 6b17f2cbef..dff3d21276 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 2e11f52f26..aef0d0ddff 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * Copyright (c) 2010, Stefan Knoblich * All rights reserved. * diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h index 27b1763fec..b54d0b1dcf 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Anthony Minessale II + * Copyright (c) 2009-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index bfb67e4c78..facbc27033 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Anthony Minessale II + * Copyright (c) 2009-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h index b62e5fb176..052f3b080d 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Anthony Minessale II + * Copyright (c) 2009-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h b/libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h index 882eaba411..1bcf82e285 100644 --- a/libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h +++ b/libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c index aaafdb33cc..0e1ed24afe 100644 --- a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c +++ b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c b/libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c index ee06a0716d..96475f58d9 100644 --- a/libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c +++ b/libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index a6c6e8cd5a..19d5e14f69 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 5be2e79872..2569ea49fd 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h index 40b5a4e71d..c9bb171b55 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 0fbc4bf29b..7009d171e1 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/include/private/ftdm_buffer.h b/libs/freetdm/src/include/private/ftdm_buffer.h index e069e2d44b..0ad969b721 100644 --- a/libs/freetdm/src/include/private/ftdm_buffer.h +++ b/libs/freetdm/src/include/private/ftdm_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/include/private/ftdm_config.h b/libs/freetdm/src/include/private/ftdm_config.h index 0f96a8f872..91b0ca5a15 100644 --- a/libs/freetdm/src/include/private/ftdm_config.h +++ b/libs/freetdm/src/include/private/ftdm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 2ed9fd04c5..7e2b946486 100755 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/freetdm/src/include/private/libteletone.h b/libs/freetdm/src/include/private/libteletone.h index b039f1f078..54537562bf 100644 --- a/libs/freetdm/src/include/private/libteletone.h +++ b/libs/freetdm/src/include/private/libteletone.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/freetdm/src/include/private/libteletone_detect.h b/libs/freetdm/src/include/private/libteletone_detect.h index 28ae2f5492..3ecac062bd 100644 --- a/libs/freetdm/src/include/private/libteletone_detect.h +++ b/libs/freetdm/src/include/private/libteletone_detect.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/freetdm/src/include/private/libteletone_generate.h b/libs/freetdm/src/include/private/libteletone_generate.h index 8e49afaabe..853f9da81b 100644 --- a/libs/freetdm/src/include/private/libteletone_generate.h +++ b/libs/freetdm/src/include/private/libteletone_generate.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/freetdm/src/priserver.c b/libs/freetdm/src/priserver.c index 4e5ec8706d..033934c32e 100644 --- a/libs/freetdm/src/priserver.c +++ b/libs/freetdm/src/priserver.c @@ -4,7 +4,7 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 2005-2012 Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/libs/freetdm/src/sangoma_pri.c b/libs/freetdm/src/sangoma_pri.c index 4adcf017cf..60d0154a39 100644 --- a/libs/freetdm/src/sangoma_pri.c +++ b/libs/freetdm/src/sangoma_pri.c @@ -4,7 +4,7 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 2005-2012 Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/libs/freetdm/src/sangoma_pri.h b/libs/freetdm/src/sangoma_pri.h index d37622a6da..2072c8b08a 100644 --- a/libs/freetdm/src/sangoma_pri.h +++ b/libs/freetdm/src/sangoma_pri.h @@ -4,7 +4,7 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 2005-2012 Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/libs/libdingaling/src/ldl_compat.h b/libs/libdingaling/src/ldl_compat.h index 26ae586632..2507cd5957 100644 --- a/libs/libdingaling/src/ldl_compat.h +++ b/libs/libdingaling/src/ldl_compat.h @@ -1,6 +1,6 @@ /* * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h index 1f43167dab..6cf8bd846b 100644 --- a/libs/libdingaling/src/libdingaling.h +++ b/libs/libdingaling/src/libdingaling.h @@ -1,6 +1,6 @@ /* * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/libteletone/src/libteletone.h b/libs/libteletone/src/libteletone.h index 61078b4984..026f10141b 100644 --- a/libs/libteletone/src/libteletone.h +++ b/libs/libteletone/src/libteletone.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/libteletone/src/libteletone_detect.h b/libs/libteletone/src/libteletone_detect.h index 4da368969c..b4b70fcd92 100644 --- a/libs/libteletone/src/libteletone_detect.h +++ b/libs/libteletone/src/libteletone_detect.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/libteletone/src/libteletone_generate.h b/libs/libteletone/src/libteletone_generate.h index 0ff39e0dfa..a49e45a658 100644 --- a/libs/libteletone/src/libteletone_generate.h +++ b/libs/libteletone/src/libteletone_generate.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/libs/openzap/Makefile.am b/libs/openzap/Makefile.am index e8c9fbf3db..52af5e3082 100644 --- a/libs/openzap/Makefile.am +++ b/libs/openzap/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2007, Anthony Minessale II +# Copyright (c) 2007-2012, Anthony Minessale II # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/include/libteletone.h b/libs/openzap/src/include/libteletone.h index b54098c8ee..4fb3d9975d 100644 --- a/libs/openzap/src/include/libteletone.h +++ b/libs/openzap/src/include/libteletone.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * @@ -37,7 +37,7 @@ * source code outside the scope of the openzap library will nullify the * following license and reinact the MPL 1.1 as stated above. * - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2005-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/include/libteletone_detect.h b/libs/openzap/src/include/libteletone_detect.h index c8c667d282..173f2b563b 100644 --- a/libs/openzap/src/include/libteletone_detect.h +++ b/libs/openzap/src/include/libteletone_detect.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * libteletone_detect.c Tone Detection Code * diff --git a/libs/openzap/src/include/libteletone_generate.h b/libs/openzap/src/include/libteletone_generate.h index 1b774206ff..212dbbb19b 100644 --- a/libs/openzap/src/include/libteletone_generate.h +++ b/libs/openzap/src/include/libteletone_generate.h @@ -1,8 +1,6 @@ /* * libteletone - * Copyright (C) 2005-2011, Anthony Minessale II - * - * Copyright (c) 2007, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/include/openzap.h b/libs/openzap/src/include/openzap.h index 32cce92c69..ab33b00bf4 100644 --- a/libs/openzap/src/include/openzap.h +++ b/libs/openzap/src/include/openzap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/include/zap_buffer.h b/libs/openzap/src/include/zap_buffer.h index 9a05420979..ed23ce4dd7 100644 --- a/libs/openzap/src/include/zap_buffer.h +++ b/libs/openzap/src/include/zap_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/include/zap_config.h b/libs/openzap/src/include/zap_config.h index f2f2e374bf..6345750821 100644 --- a/libs/openzap/src/include/zap_config.h +++ b/libs/openzap/src/include/zap_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/include/zap_types.h b/libs/openzap/src/include/zap_types.h index 165533ff22..0b65ea865a 100644 --- a/libs/openzap/src/include/zap_types.h +++ b/libs/openzap/src/include/zap_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/libteletone_detect.c b/libs/openzap/src/libteletone_detect.c index 2c4253b314..758142f53e 100644 --- a/libs/openzap/src/libteletone_detect.c +++ b/libs/openzap/src/libteletone_detect.c @@ -10,7 +10,7 @@ * * libteletone_detect.c Tone Detection Code * - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/libteletone_generate.c b/libs/openzap/src/libteletone_generate.c index 1d5d696af2..e40c8f5729 100644 --- a/libs/openzap/src/libteletone_generate.c +++ b/libs/openzap/src/libteletone_generate.c @@ -1,7 +1,7 @@ /* * libteletone_generate.c -- Tone Generator * - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/m3ua_client.h b/libs/openzap/src/m3ua_client.h index b80309017c..7d9834f1b4 100644 --- a/libs/openzap/src/m3ua_client.h +++ b/libs/openzap/src/m3ua_client.h @@ -5,7 +5,7 @@ * Created by Shane Burrell on 4/3/08. * Copyright 2008 Shane Burrell. All rights reserved. * - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic + * Copyright (c) 2007-2012, Anthony Minessale II, Nenad Corbic * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c b/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c index d878b9195e..5a36a23359 100644 --- a/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c +++ b/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_analog/zap_analog.h b/libs/openzap/src/ozmod/ozmod_analog/zap_analog.h index 3ffa422ead..f1ae31cc14 100644 --- a/libs/openzap/src/ozmod/ozmod_analog/zap_analog.h +++ b/libs/openzap/src/ozmod/ozmod_analog/zap_analog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_analog_em/ozmod_analog_em.c b/libs/openzap/src/ozmod/ozmod_analog_em/ozmod_analog_em.c index 581c6dd45a..9d4573f3a6 100644 --- a/libs/openzap/src/ozmod/ozmod_analog_em/ozmod_analog_em.c +++ b/libs/openzap/src/ozmod/ozmod_analog_em/ozmod_analog_em.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Anthony Minessale II + * Copyright (c) 2008-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_analog_em/zap_analog_em.h b/libs/openzap/src/ozmod/ozmod_analog_em/zap_analog_em.h index eb9f9f3d20..1a0e355106 100644 --- a/libs/openzap/src/ozmod/ozmod_analog_em/zap_analog_em.h +++ b/libs/openzap/src/ozmod/ozmod_analog_em/zap_analog_em.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Anthony Minessale II + * Copyright (c) 2008-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c b/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c index fc998b126f..529e87d10d 100644 --- a/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c +++ b/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_isdn/zap_isdn.h b/libs/openzap/src/ozmod/ozmod_isdn/zap_isdn.h index c5e0e5a711..3542a550ab 100644 --- a/libs/openzap/src/ozmod/ozmod_isdn/zap_isdn.h +++ b/libs/openzap/src/ozmod/ozmod_isdn/zap_isdn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.c b/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.c index 3df1d54d89..bd8f72202d 100644 --- a/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.c +++ b/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Anthony Minessale II + * Copyright (c) 2009-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.h b/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.h index 4c79526b9e..bd63db15c2 100644 --- a/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.h +++ b/libs/openzap/src/ozmod/ozmod_libpri/lpwrap_pri.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Anthony Minessale II + * Copyright (c) 2009-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c b/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c index f18aa1fc54..511746afa8 100644 --- a/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c +++ b/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.h b/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.h index 8c929516ba..f31671735c 100644 --- a/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.h +++ b/libs/openzap/src/ozmod/ozmod_libpri/ozmod_libpri.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Anthony Minessale II + * Copyright (c) 2009-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c b/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c index 154c1618ff..2084848235 100644 --- a/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c +++ b/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h b/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h index 27c455a429..758ea32763 100644 --- a/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h +++ b/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c b/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c index dc2218012e..a1bdaa77b1 100644 --- a/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c +++ b/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c b/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c index 5b3e5b87ad..96e2ae72ec 100644 --- a/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c +++ b/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic + * Copyright (c) 2007-2012, Anthony Minessale II, Nenad Corbic * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.h b/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.h index 861f941ceb..8ae6e74101 100644 --- a/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.h +++ b/libs/openzap/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic + * Copyright (c) 2007-2012, Anthony Minessale II, Nenad Corbic * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_sangoma_boost/zap_sangoma_boost.h b/libs/openzap/src/ozmod/ozmod_sangoma_boost/zap_sangoma_boost.h index a48060812b..10ac69d63d 100644 --- a/libs/openzap/src/ozmod/ozmod_sangoma_boost/zap_sangoma_boost.h +++ b/libs/openzap/src/ozmod/ozmod_sangoma_boost/zap_sangoma_boost.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_skel/ozmod_skel.c b/libs/openzap/src/ozmod/ozmod_skel/ozmod_skel.c index 949e0fbf31..b4bc8676ee 100644 --- a/libs/openzap/src/ozmod/ozmod_skel/ozmod_skel.c +++ b/libs/openzap/src/ozmod/ozmod_skel/ozmod_skel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c index 8423aac34b..109e34cd9c 100644 --- a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c +++ b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c index ca42c2c578..4b2836d5b2 100644 --- a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c +++ b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.h b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.h index 687269a983..c496df9bae 100644 --- a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.h +++ b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/priserver.c b/libs/openzap/src/priserver.c index 080e5d4cef..fddec03e5b 100644 --- a/libs/openzap/src/priserver.c +++ b/libs/openzap/src/priserver.c @@ -4,7 +4,7 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 2005-2012 Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/libs/openzap/src/sangoma_pri.c b/libs/openzap/src/sangoma_pri.c index c160eedd28..9da5c951af 100644 --- a/libs/openzap/src/sangoma_pri.c +++ b/libs/openzap/src/sangoma_pri.c @@ -4,7 +4,7 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 2005-2012 Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/libs/openzap/src/sangoma_pri.h b/libs/openzap/src/sangoma_pri.h index 880fc85cea..5829a699ea 100644 --- a/libs/openzap/src/sangoma_pri.h +++ b/libs/openzap/src/sangoma_pri.h @@ -4,7 +4,7 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 2005-2012 Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/libs/openzap/src/zap_buffer.c b/libs/openzap/src/zap_buffer.c index 0e2279d7e3..1a3b6a8311 100644 --- a/libs/openzap/src/zap_buffer.c +++ b/libs/openzap/src/zap_buffer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/zap_config.c b/libs/openzap/src/zap_config.c index ca0315594b..54119e1e8c 100644 --- a/libs/openzap/src/zap_config.c +++ b/libs/openzap/src/zap_config.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/zap_io.c b/libs/openzap/src/zap_io.c index 283a9fe332..6235f92392 100644 --- a/libs/openzap/src/zap_io.c +++ b/libs/openzap/src/zap_io.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/libs/openzap/src/zap_m3ua.c b/libs/openzap/src/zap_m3ua.c index 50736b75e4..e5bc4cdd38 100644 --- a/libs/openzap/src/zap_m3ua.c +++ b/libs/openzap/src/zap_m3ua.c @@ -6,7 +6,7 @@ * Copyright 2008 Shane Burrell. All rights reserved. * * - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic * + * Copyright (c) 2007-2012, Anthony Minessale II, Nenad Corbic * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 0bd42a7d4a..5c31133aa8 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -1,6 +1,6 @@ /* * STFU (S)ort (T)ransportable (F)ramed (U)tterances - * Copyright (c) 2007 Anthony Minessale II + * Copyright (c) 2007-2012 Anthony Minessale II * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index 3e989b0a97..2b21419118 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -1,6 +1,6 @@ /* * STFU (S)ort (T)ransportable (F)ramed (U)tterances - * Copyright (c) 2007 Anthony Minessale II + * Copyright (c) 2007-2012 Anthony Minessale II * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/scripts/c/socket2me/socket2me.c b/scripts/c/socket2me/socket2me.c index 1b3aa0c6f2..9bb9551742 100644 --- a/scripts/c/socket2me/socket2me.c +++ b/scripts/c/socket2me/socket2me.c @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * Copyright (C) 2007, Anthony Minessale II + * Copyright (C) 2007-2012, Anthony Minessale II */ #include diff --git a/scripts/javascript/api.js b/scripts/javascript/api.js index 47c5770353..56a37a5cd8 100644 --- a/scripts/javascript/api.js +++ b/scripts/javascript/api.js @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/scripts/javascript/js_modules/SpeechTools.jm b/scripts/javascript/js_modules/SpeechTools.jm index 4e9628b2f5..84e6363743 100644 --- a/scripts/javascript/js_modules/SpeechTools.jm +++ b/scripts/javascript/js_modules/SpeechTools.jm @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/scripts/javascript/pizza.js b/scripts/javascript/pizza.js index 9807f5bc8d..57c8f2b116 100644 --- a/scripts/javascript/pizza.js +++ b/scripts/javascript/pizza.js @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/scripts/javascript/ps_pizza.js b/scripts/javascript/ps_pizza.js index 7fd405e009..646128e308 100644 --- a/scripts/javascript/ps_pizza.js +++ b/scripts/javascript/ps_pizza.js @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/scripts/python/freepy/__init__.py b/scripts/python/freepy/__init__.py index cebe48a0ab..2274cdc474 100644 --- a/scripts/python/freepy/__init__.py +++ b/scripts/python/freepy/__init__.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005-2011, Anthony Minessale II +Copyright (C) 2005-2012, Anthony Minessale II Version: MPL 1.1 diff --git a/scripts/python/freepy/fseventlistener.py b/scripts/python/freepy/fseventlistener.py index 6e3455f62f..fb1b430f5d 100644 --- a/scripts/python/freepy/fseventlistener.py +++ b/scripts/python/freepy/fseventlistener.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005-2011, Anthony Minessale II +Copyright (C) 2005-2012, Anthony Minessale II Version: MPL 1.1 diff --git a/scripts/python/freepy/fshelper.py b/scripts/python/freepy/fshelper.py index 090abce9d6..d258461629 100644 --- a/scripts/python/freepy/fshelper.py +++ b/scripts/python/freepy/fshelper.py @@ -2,7 +2,7 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005-2011, Anthony Minessale II +Copyright (C) 2005-2012, Anthony Minessale II Version: MPL 1.1 diff --git a/scripts/python/freepy/models.py b/scripts/python/freepy/models.py index 3dfb105424..37e595946f 100644 --- a/scripts/python/freepy/models.py +++ b/scripts/python/freepy/models.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005-2011, Anthony Minessale II +Copyright (C) 2005-2012, Anthony Minessale II Version: MPL 1.1 diff --git a/scripts/python/freepy/request.py b/scripts/python/freepy/request.py index d76fe2942c..787482be3a 100644 --- a/scripts/python/freepy/request.py +++ b/scripts/python/freepy/request.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005-2011, Anthony Minessale II +Copyright (C) 2005-2012, Anthony Minessale II Version: MPL 1.1 diff --git a/scripts/rss/rss2ivr.pl b/scripts/rss/rss2ivr.pl index ed5aabd3a3..489fc1609f 100755 --- a/scripts/rss/rss2ivr.pl +++ b/scripts/rss/rss2ivr.pl @@ -2,7 +2,7 @@ ########################################################################## # rss2ivr.pl -- A Script to turn an RSS feed into audio files. # -# Copyright (C) 2006, Anthony Minessale +# Copyright (C) 2006-2012, Anthony Minessale # # Anthony Minessale # diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 68376c273c..196f10e4f2 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch.h b/src/include/switch.h index de099f1b94..3e1bfbb77f 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index a49487c5e2..e7a41d03d9 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_bitpack.h b/src/include/switch_bitpack.h index 3209cbc282..af32b9025d 100644 --- a/src/include/switch_bitpack.h +++ b/src/include/switch_bitpack.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_buffer.h b/src/include/switch_buffer.h index 751439d1ad..920d3965fe 100644 --- a/src/include/switch_buffer.h +++ b/src/include/switch_buffer.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_caller.h b/src/include/switch_caller.h index 09ff57beb6..3618858819 100644 --- a/src/include/switch_caller.h +++ b/src/include/switch_caller.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 37bb6f1102..9bf89d5796 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_config.h b/src/include/switch_config.h index b0ef805b52..fab6832e20 100644 --- a/src/include/switch_config.h +++ b/src/include/switch_config.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_console.h b/src/include/switch_console.h index 5585a041c1..9a88f3c229 100644 --- a/src/include/switch_console.h +++ b/src/include/switch_console.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 1e3bfcba76..0011652475 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h index f72c3c5f45..e5fbf76a95 100644 --- a/src/include/switch_core_db.h +++ b/src/include/switch_core_db.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_core_event_hook.h b/src/include/switch_core_event_hook.h index ff836b3978..8f16706dd6 100644 --- a/src/include/switch_core_event_hook.h +++ b/src/include/switch_core_event_hook.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_curl.h b/src/include/switch_curl.h index a404bffb34..73cfef7474 100644 --- a/src/include/switch_curl.h +++ b/src/include/switch_curl.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 13debb4b6b..dd5991bf07 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_frame.h b/src/include/switch_frame.h index edc4f8be6c..91910f85dd 100644 --- a/src/include/switch_frame.h +++ b/src/include/switch_frame.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 0fb3c83e7f..8f553b957e 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_limit.h b/src/include/switch_limit.h index 4488b8caf0..fa9d1181fc 100644 --- a/src/include/switch_limit.h +++ b/src/include/switch_limit.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index f1fde8d7d6..3edc4dc8a7 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_log.h b/src/include/switch_log.h index 170425a2a4..a44aa29a01 100644 --- a/src/include/switch_log.h +++ b/src/include/switch_log.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index acb85407c7..af85e3ed7c 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_nat.h b/src/include/switch_nat.h index 492dbfb29d..dae74073ff 100644 --- a/src/include/switch_nat.h +++ b/src/include/switch_nat.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h index 103fe0f0d7..fd3ff888ef 100644 --- a/src/include/switch_odbc.h +++ b/src/include/switch_odbc.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index 17c972c989..3d1efe425d 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_regex.h b/src/include/switch_regex.h index 6558299b53..393341fd43 100644 --- a/src/include/switch_regex.h +++ b/src/include/switch_regex.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h index 3dff620c4b..7ae37669c7 100644 --- a/src/include/switch_resample.h +++ b/src/include/switch_resample.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_rtcp_frame.h b/src/include/switch_rtcp_frame.h index 5d06294304..7e034169e1 100644 --- a/src/include/switch_rtcp_frame.h +++ b/src/include/switch_rtcp_frame.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index 0951498c37..9d1de7a193 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_scheduler.h b/src/include/switch_scheduler.h index 8db9696f4a..6a69371d59 100644 --- a/src/include/switch_scheduler.h +++ b/src/include/switch_scheduler.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_ssl.h b/src/include/switch_ssl.h index 46cdd5cbbe..70d675e16b 100644 --- a/src/include/switch_ssl.h +++ b/src/include/switch_ssl.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_stun.h b/src/include/switch_stun.h index 426eb49628..7159cf1f3b 100644 --- a/src/include/switch_stun.h +++ b/src/include/switch_stun.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 185fdb64af..3c1cb1cf7c 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index cce5abfa2d..40560a0434 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_version.h.cmake b/src/include/switch_version.h.cmake index 6510dba154..6e36b0b1da 100644 --- a/src/include/switch_version.h.cmake +++ b/src/include/switch_version.h.cmake @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_version.h.template b/src/include/switch_version.h.template index c0e75b526e..2f75d75266 100644 --- a/src/include/switch_version.h.template +++ b/src/include/switch_version.h.template @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index 558b8522f4..f2a6eb3220 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/switch_xml_config.h b/src/include/switch_xml_config.h index 49986c9211..fc669e4fc1 100644 --- a/src/include/switch_xml_config.h +++ b/src/include/switch_xml_config.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/include/timerfd_wrap.h b/src/include/timerfd_wrap.h index bb751c93a2..7196a6c1e0 100644 --- a/src/include/timerfd_wrap.h +++ b/src/include/timerfd_wrap.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_fsk/fsk_callerid.h b/src/mod/applications/mod_fsk/fsk_callerid.h index 9018201ce5..59f6cc5e52 100644 --- a/src/mod/applications/mod_fsk/fsk_callerid.h +++ b/src/mod/applications/mod_fsk/fsk_callerid.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_mongo/mod_mongo.cpp b/src/mod/applications/mod_mongo/mod_mongo.cpp index 85bbd0ee4a..27723af13d 100644 --- a/src/mod/applications/mod_mongo/mod_mongo.cpp +++ b/src/mod/applications/mod_mongo/mod_mongo.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_mongo/mod_mongo.h b/src/mod/applications/mod_mongo/mod_mongo.h index a1c8322bd7..b336443225 100644 --- a/src/mod/applications/mod_mongo/mod_mongo.h +++ b/src/mod/applications/mod_mongo/mod_mongo.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_mongo/mongo_conn.cpp b/src/mod/applications/mod_mongo/mongo_conn.cpp index 075b8f85d6..673e1be768 100644 --- a/src/mod/applications/mod_mongo/mongo_conn.cpp +++ b/src/mod/applications/mod_mongo/mongo_conn.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_mp4/mod_mp4.cpp b/src/mod/applications/mod_mp4/mod_mp4.cpp index 0d9eac113f..56cbf53877 100644 --- a/src/mod/applications/mod_mp4/mod_mp4.cpp +++ b/src/mod/applications/mod_mp4/mod_mp4.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_osp/mod_osp.c b/src/mod/applications/mod_osp/mod_osp.c index 1775421560..6f312386f4 100644 --- a/src/mod/applications/mod_osp/mod_osp.c +++ b/src/mod/applications/mod_osp/mod_osp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp index 37f88baf99..e991728d1a 100644 --- a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp +++ b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 3ba14bcd14..d4f388dd36 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.h b/src/mod/applications/mod_spandsp/mod_spandsp_modem.h index ae9d64e71b..f04797e017 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_stress/mod_stress.cpp b/src/mod/applications/mod_stress/mod_stress.cpp index d96739da0a..4fae808c40 100644 --- a/src/mod/applications/mod_stress/mod_stress.cpp +++ b/src/mod/applications/mod_stress/mod_stress.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_voicemail_ivr/config.h b/src/mod/applications/mod_voicemail_ivr/config.h index f94fdb6f54..9d3b63d584 100644 --- a/src/mod/applications/mod_voicemail_ivr/config.h +++ b/src/mod/applications/mod_voicemail_ivr/config.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_voicemail_ivr/ivr.h b/src/mod/applications/mod_voicemail_ivr/ivr.h index a277140985..31f95732b5 100644 --- a/src/mod/applications/mod_voicemail_ivr/ivr.h +++ b/src/mod/applications/mod_voicemail_ivr/ivr.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_voicemail_ivr/menu.h b/src/mod/applications/mod_voicemail_ivr/menu.h index 6a49dedcba..1f91b658f6 100644 --- a/src/mod/applications/mod_voicemail_ivr/menu.h +++ b/src/mod/applications/mod_voicemail_ivr/menu.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_voicemail_ivr/utils.h b/src/mod/applications/mod_voicemail_ivr/utils.h index a20dfe806d..c8e9ca0868 100644 --- a/src/mod/applications/mod_voicemail_ivr/utils.h +++ b/src/mod/applications/mod_voicemail_ivr/utils.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index a4dde5189d..80fa3f2001 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009-2010, Anthony Minessale II + * Copyright (C) 2009-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_silk/mod_silk.c b/src/mod/codecs/mod_silk/mod_silk.c index 6a090bef0d..5c32b72969 100644 --- a/src/mod/codecs/mod_silk/mod_silk.c +++ b/src/mod/codecs/mod_silk/mod_silk.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h index 37eb15741c..03c14283b4 100644 --- a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2011, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index c2e450147f..30ed934f68 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2011, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index d9a5668e80..98a85765e5 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2011, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_khomp/mod_khomp.cpp b/src/mod/endpoints/mod_khomp/mod_khomp.cpp index 5e7375b0e9..557cfb46f5 100644 --- a/src/mod/endpoints/mod_khomp/mod_khomp.cpp +++ b/src/mod/endpoints/mod_khomp/mod_khomp.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 2be11bf4fc..960d960f82 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2011, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 730b592187..795f96186d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_unicall/mod_unicall.c b/src/mod/endpoints/mod_unicall/mod_unicall.c index e835647385..75680bd243 100644 --- a/src/mod/endpoints/mod_unicall/mod_unicall.c +++ b/src/mod/endpoints/mod_unicall/mod_unicall.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2008, Anthony Minessale II + * Copyright (C) 2005/2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 121e7b4f95..b6adcdafe5 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB index 68d83fe433..3cf8b2718f 100644 --- a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB +++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB @@ -1,6 +1,6 @@ -- FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application --- Copyright (C) 2005-2011, Anthony Minessale II +-- Copyright (C) 2005-2012, Anthony Minessale II -- -- Version: MPL 1.1 -- diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h index ba3c523d49..45519a844a 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.h +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 4886ae567e..adb13a43dd 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h index aeb0245f11..bca61c69ea 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * 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 542e4e6da4..b4ae2d83b4 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 4e6b21abdf..82a6837478 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 91675aa872..14d853a016 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 37e126ecb2..952e0c595e 100644 --- a/src/mod/say/mod_say_fr/mod_say_fr.c +++ b/src/mod/say/mod_say_fr/mod_say_fr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 f08a0de0a2..e7241bd80f 100644 --- a/src/mod/say/mod_say_hr/mod_say_hr.c +++ b/src/mod/say/mod_say_hr/mod_say_hr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 847d6f811d..33d07b1b65 100644 --- a/src/mod/say/mod_say_hu/mod_say_hu.c +++ b/src/mod/say/mod_say_hu/mod_say_hu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 ef4b3d2bda..1cbe1d8488 100644 --- a/src/mod/say/mod_say_it/mod_say_it.c +++ b/src/mod/say/mod_say_it/mod_say_it.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 aa11a87ebf..0da0101ea7 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 e1e822b2f6..e823a32b12 100644 --- a/src/mod/say/mod_say_nl/mod_say_nl.c +++ b/src/mod/say/mod_say_nl/mod_say_nl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 e3e7280c45..e1cc3084e1 100644 --- a/src/mod/say/mod_say_pt/mod_say_pt.c +++ b/src/mod/say/mod_say_pt/mod_say_pt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 8c413c956b..68daf19f12 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 675c1a44e6..77b62c647a 100644 --- a/src/mod/say/mod_say_th/mod_say_th.c +++ b/src/mod/say/mod_say_th/mod_say_th.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without 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 0dc566289a..33fb7d2f95 100644 --- a/src/mod/say/mod_say_zh/mod_say_zh.c +++ b/src/mod/say/mod_say_zh/mod_say_zh.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2007-2012, Anthony Minessale II * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 91d0980444..5408edb828 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/switch_limit.c b/src/switch_limit.c index 9313ecf5cf..6e792ca53d 100644 --- a/src/switch_limit.c +++ b/src/switch_limit.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * diff --git a/src/switch_nat.c b/src/switch_nat.c index dd73cd8be7..b992c19fc5 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2009, Anthony Minessale II + * Copyright (C) 2005-2012, Anthony Minessale II * * Version: MPL 1.1 * From 5e99d34fd8a9a810256031af977987507e313d7a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Apr 2012 08:10:30 -0500 Subject: [PATCH 0054/1057] FS-4146 --resolve --- src/mod/endpoints/mod_sofia/sofia_glue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 0d7f0b526a..37f840cddd 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3139,10 +3139,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f sofia_set_flag_locked(tech_pvt, TFLAG_SECURE); } - if ((var = switch_channel_get_variable(tech_pvt->channel, "sip_liberal_dtmf")) && switch_true(var)) { - sofia_set_flag_locked(tech_pvt, TFLAG_LIBERAL_DTMF); - } - if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) { status = SWITCH_STATUS_SUCCESS; goto end; @@ -4486,6 +4482,10 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } + if ((val = switch_channel_get_variable(tech_pvt->channel, "sip_liberal_dtmf")) && switch_true(val)) { + sofia_set_flag_locked(tech_pvt, TFLAG_LIBERAL_DTMF); + } + if ((m = sdp->sdp_media) && (m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive || (m->m_connections && m->m_connections->c_address && !strcmp(m->m_connections->c_address, "0.0.0.0")))) { From 820347556363f9ee88ad38473649e3027c902295 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Apr 2012 08:52:29 -0500 Subject: [PATCH 0055/1057] FS-4148 --resolve note: see switch_core_session_get_partner --- src/mod/endpoints/mod_sofia/mod_sofia.c | 1 + src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 53 +++++++++++++++++-------- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 7e031f1f26..5533ae146c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2399,6 +2399,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi char *sdp = (char *) msg->pointer_arg; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason); + sofia_clear_flag(tech_pvt, TFLAG_REINVITED); if (!zstr((sdp))) { if (!strcasecmp(sdp, "t38")) { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 795f96186d..8052d94539 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -331,6 +331,7 @@ typedef enum { TFLAG_LIBERAL_DTMF, TFLAG_GOT_ACK, TFLAG_CAPTURE, + TFLAG_REINVITED, /* No new flags below this line */ TFLAG_MAX } TFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9614b1cba0..7ec6969a92 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5521,7 +5521,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_channel_t *channel = NULL; private_object_t *tech_pvt = NULL; const char *replaces_str = NULL; - const char *uuid; switch_core_session_t *other_session = NULL; switch_channel_t *other_channel = NULL; //private_object_t *other_tech_pvt = NULL; @@ -5713,8 +5712,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; } } - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) - && (other_session = switch_core_session_locate(uuid))) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { other_channel = switch_core_session_get_channel(other_session); if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); @@ -5745,9 +5743,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (r_sdp && sofia_test_flag(tech_pvt, TFLAG_3PCC_INVITE) && !sofia_test_flag(tech_pvt, TFLAG_SDP)) { sofia_set_flag(tech_pvt, TFLAG_SDP); - - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) - && (other_session = switch_core_session_locate(uuid))) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { other_channel = switch_core_session_get_channel(other_session); //other_tech_pvt = switch_core_session_get_private(other_session); @@ -5785,6 +5781,23 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; case nua_callstate_received: if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { + private_object_t *other_tech_pvt = switch_core_session_get_private(other_session); + + if(sofia_test_flag(other_tech_pvt, TFLAG_REINVITED)) { + + /* Due to a race between simultaneous reinvites to both legs of a bridge, + an earlier call to nua_invite silently failed. + So we reject the incoming invite with a 491 and redo the failed outgoing invite. */ + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Other leg already handling a reinvite, so responding with 491\n"); + nua_respond(tech_pvt->nh, SIP_491_REQUEST_PENDING, TAG_END()); + switch_core_session_rwunlock(other_session); + sofia_glue_do_invite(session); + goto done; + } + } + if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) { if (switch_channel_test_flag(channel, CF_PROXY_MODE)) { switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOMEDIA"); @@ -5930,8 +5943,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE); if ((switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) && sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) { sofia_set_flag_locked(tech_pvt, TFLAG_3PCC); - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) - && (other_session = switch_core_session_locate(uuid))) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { switch_core_session_message_t *msg; msg = switch_core_session_alloc(other_session, sizeof(*msg)); msg->message_id = SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT; @@ -5972,11 +5984,11 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (switch_stristr("m=image", r_sdp)) { is_t38 = 1; } - + if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) - && (other_session = switch_core_session_locate(uuid))) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { switch_core_session_message_t *msg; + private_object_t *other_tech_pvt; if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 && profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) { if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp)) { @@ -6040,6 +6052,16 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } } + other_tech_pvt = switch_core_session_get_private(other_session); + if(sofia_test_flag(other_tech_pvt, TFLAG_REINVITED)) { + /* The other leg won the reinvite race */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Other leg already handling reinvite, so responding with 491\n"); + nua_respond(tech_pvt->nh, SIP_491_REQUEST_PENDING, TAG_END()); + switch_core_session_rwunlock(other_session); + goto done; + } + sofia_set_flag(tech_pvt, TFLAG_REINVITED); + msg = switch_core_session_alloc(other_session, sizeof(*msg)); msg->message_id = SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT; msg->from = __FILE__; @@ -6185,8 +6207,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } } - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) - && (other_session = switch_core_session_locate(uuid))) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { other_channel = switch_core_session_get_channel(other_session); if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); @@ -6255,8 +6276,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_channel_mark_answered(channel); if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) - && (other_session = switch_core_session_locate(uuid))) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { //other_channel = switch_core_session_get_channel(other_session); //switch_channel_answer(other_channel); switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER); @@ -6282,8 +6302,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } } - if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) - && (other_session = switch_core_session_locate(uuid))) { + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { other_channel = switch_core_session_get_channel(other_session); if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); From 37e726b7e79c3528d2a3ac10ce1aa848b5946acc Mon Sep 17 00:00:00 2001 From: William King Date: Thu, 26 Apr 2012 09:05:56 -0700 Subject: [PATCH 0056/1057] Confirm we can open the file successfully before trying to add it to a libvlc media player --- src/mod/formats/mod_vlc/mod_vlc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/formats/mod_vlc/mod_vlc.c b/src/mod/formats/mod_vlc/mod_vlc.c index 98a40f77ad..b19abd81dc 100644 --- a/src/mod/formats/mod_vlc/mod_vlc.c +++ b/src/mod/formats/mod_vlc/mod_vlc.c @@ -123,6 +123,11 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p context->m = libvlc_media_new_location(read_inst, context->path); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "VLC Path is unknown type %s\n", context->path); } + + if ( context-m == NULL ) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error opening %s for reading\n", path); + return SWITCH_STATUS_GENERR; + } context->playing = 0; context->err = 0; From b123214eff0d880770b803f0f95e517b059007c0 Mon Sep 17 00:00:00 2001 From: William King Date: Thu, 26 Apr 2012 10:13:07 -0700 Subject: [PATCH 0057/1057] typo fixed --- src/mod/formats/mod_vlc/mod_vlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/formats/mod_vlc/mod_vlc.c b/src/mod/formats/mod_vlc/mod_vlc.c index b19abd81dc..15dd6c1d95 100644 --- a/src/mod/formats/mod_vlc/mod_vlc.c +++ b/src/mod/formats/mod_vlc/mod_vlc.c @@ -124,7 +124,7 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "VLC Path is unknown type %s\n", context->path); } - if ( context-m == NULL ) { + if ( context->m == NULL ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error opening %s for reading\n", path); return SWITCH_STATUS_GENERR; } From b553d62fbd99e41778fc4ff9f59fc756ccaab72b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Apr 2012 10:35:02 -0500 Subject: [PATCH 0058/1057] add sip_require_timer=true variable to enable require timer on session refresh that breaks finicky endpoints --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c | 2 +- src/mod/endpoints/mod_sofia/sofia_glue.c | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index cf78cb49ef..a02df03209 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Apr 10 16:19:10 CDT 2012 +Thu Apr 26 10:23:33 CDT 2012 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 cc857a3716..751b1cfff8 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -4498,7 +4498,7 @@ session_timer_add_headers(struct session_timer *t, /* Min-SE: 0 is optional with initial INVITE */ || !initial, SIPTAG_MIN_SE(min_se)), - TAG_IF(0 && autorequire && refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")), + TAG_IF(autorequire && refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")), TAG_END()); return 1; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 37f840cddd..09b599cfbb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2057,6 +2057,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) char *mp = NULL, *mp_type = NULL; char *record_route = NULL; const char *recover_via = NULL; + int require_timer = 0; + if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) { const char *recover_contact = switch_channel_get_variable(tech_pvt->channel, "sip_recover_contact"); @@ -2087,6 +2089,11 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } + if ((val = switch_channel_get_variable(channel, "sip_require_timer")) && switch_true(val)) { + require_timer = 1; + } + + cid_name = caller_profile->caller_id_name; cid_num = caller_profile->caller_id_number; sofia_glue_tech_prepare_codecs(tech_pvt); @@ -2607,6 +2614,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE)), TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL)), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), + TAG_IF(!require_timer, NUTAG_TIMER_AUTOREQUIRE(0)), TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_HOLD(holdstr)), TAG_END()); } else { nua_invite(tech_pvt->nh, @@ -2632,6 +2640,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)), TAG_IF(!zstr(invite_route_uri), NUTAG_INITIAL_ROUTE_STR(invite_route_uri)), TAG_IF(tech_pvt->profile->minimum_session_expires, NUTAG_MIN_SE(tech_pvt->profile->minimum_session_expires)), + TAG_IF(!require_timer, NUTAG_TIMER_AUTOREQUIRE(0)), TAG_IF(cseq, SIPTAG_CSEQ(cseq)), NUTAG_MEDIA_ENABLE(0), SIPTAG_CONTENT_TYPE_STR(mp_type ? mp_type : "application/sdp"), From 8a4f273fd83ea8071026c4e2053bc2e4de27900a Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 26 Apr 2012 12:44:36 -0500 Subject: [PATCH 0059/1057] FS-4019 -- resolve --- Freeswitch.2010.sln | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 5079f1f987..3a8469c327 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -3453,7 +3453,7 @@ Global {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x64.ActiveCfg = Release|x64 {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 + {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x86 Setup.ActiveCfg = Release|Win32 {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 @@ -3470,7 +3470,7 @@ Global {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 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x86 Setup.ActiveCfg = Release|Win32 {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 @@ -3483,7 +3483,7 @@ Global {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 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Release|x86 Setup.ActiveCfg = Release|Win32 {50AAC2CE-BFC9-4912-87CC-C6381850D735}.All|Win32.ActiveCfg = Release|x64 {50AAC2CE-BFC9-4912-87CC-C6381850D735}.All|x64.ActiveCfg = Release|x64 {50AAC2CE-BFC9-4912-87CC-C6381850D735}.All|x64.Build.0 = Release|x64 @@ -3496,7 +3496,7 @@ Global {50AAC2CE-BFC9-4912-87CC-C6381850D735}.Release|Win32.ActiveCfg = Release|Win32 {50AAC2CE-BFC9-4912-87CC-C6381850D735}.Release|x64.ActiveCfg = Release|x64 {50AAC2CE-BFC9-4912-87CC-C6381850D735}.Release|x64 Setup.ActiveCfg = Release|x64 - {50AAC2CE-BFC9-4912-87CC-C6381850D735}.Release|x86 Setup.ActiveCfg = Release|x64 + {50AAC2CE-BFC9-4912-87CC-C6381850D735}.Release|x86 Setup.ActiveCfg = Release|Win32 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.All|Win32.ActiveCfg = Release|x64 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.All|x64.ActiveCfg = Release|x64 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.All|x64.Build.0 = Release|x64 @@ -3513,7 +3513,7 @@ Global {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x64.ActiveCfg = Release|x64 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x64.Build.0 = Release|x64 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x64 Setup.ActiveCfg = Release|x64 - {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x86 Setup.ActiveCfg = Release|x64 + {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x86 Setup.ActiveCfg = Release|Win32 {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.All|Win32.ActiveCfg = Release|x64 {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.All|x64.ActiveCfg = Release|x64 {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.All|x64.Build.0 = Release|x64 @@ -3530,7 +3530,7 @@ Global {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|x64.ActiveCfg = Release|x64 {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|x64.Build.0 = Release|x64 {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|x64 Setup.ActiveCfg = Release|x64 - {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|x86 Setup.ActiveCfg = Release|x64 + {60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|x86 Setup.ActiveCfg = Release|Win32 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|Win32.ActiveCfg = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|x64.ActiveCfg = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|x64.Build.0 = Release|x64 @@ -3543,7 +3543,7 @@ Global {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|Win32.ActiveCfg = Release|Win32 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|x64.ActiveCfg = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|x64 Setup.ActiveCfg = Release|x64 - {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|x86 Setup.ActiveCfg = Release|x64 + {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|x86 Setup.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 21b1ffbf257ff381f909495b9d0cb2db2ad01fce Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Apr 2012 11:12:11 -0500 Subject: [PATCH 0060/1057] add core-db-pre-trans-execute and core-db-post-trans-execute to switch.conf.xml to wrap sql stmts around the core transactions --- src/include/private/switch_core_pvt.h | 2 ++ src/switch_core.c | 4 ++++ src/switch_core_sqldb.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 196f10e4f2..f1d58688e4 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -261,6 +261,8 @@ struct switch_runtime { uint32_t db_handle_timeout; int cpu_count; uint32_t time_sync; + char *core_db_pre_trans_execute; + char *core_db_post_trans_execute; }; extern struct switch_runtime runtime; diff --git a/src/switch_core.c b/src/switch_core.c index a7259ce18d..5f47c68f0e 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1723,6 +1723,10 @@ static void switch_load_core_config(const char *file) switch_set_flag((&runtime), SCF_EARLY_HANGUP); } else if (!strcasecmp(var, "colorize-console") && switch_true(val)) { runtime.colorize_console = SWITCH_TRUE; + } else if (!strcasecmp(var, "core-db-pre-trans-execute") && !zstr(val)) { + runtime.core_db_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val); + } else if (!strcasecmp(var, "core-db-post-trans-execute") && !zstr(val)) { + runtime.core_db_post_trans_execute = switch_core_strdup(runtime.memory_pool, val); } else if (!strcasecmp(var, "mailer-app") && !zstr(val)) { runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val); } else if (!strcasecmp(var, "mailer-app-args") && val) { diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index d436c60596..eed753b840 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -731,6 +731,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ if (io_mutex) switch_mutex_lock(io_mutex); + if (!zstr(runtime.core_db_pre_trans_execute)) { + switch_cache_db_execute_sql_real(dbh, runtime.core_db_pre_trans_execute, &errmsg); + if (errmsg) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC [%s]\n", errmsg); + free(errmsg); + } + } + again: while (begin_retries > 0) { @@ -810,6 +818,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ switch_odbc_SQLSetAutoCommitAttr(dbh->native_handle.odbc_dbh, 1); } + if (!zstr(runtime.core_db_post_trans_execute)) { + switch_cache_db_execute_sql_real(dbh, runtime.core_db_post_trans_execute, &errmsg); + if (errmsg) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC [%s]\n", errmsg); + free(errmsg); + } + } + if (io_mutex) switch_mutex_unlock(io_mutex); return status; From f1b504402b419fc54d7310c672cbe4ecb26f8ac7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Apr 2012 11:28:47 -0500 Subject: [PATCH 0061/1057] add core-db-inner-pre-trans-execute and core-db-inner-post-trans-execute to switch.conf.xml to wrap sql stmts inside the meat of the core transactions --- src/include/private/switch_core_pvt.h | 2 ++ src/switch_core.c | 4 ++++ src/switch_core_sqldb.c | 21 +++++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index f1d58688e4..781f0e4d06 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -263,6 +263,8 @@ struct switch_runtime { uint32_t time_sync; char *core_db_pre_trans_execute; char *core_db_post_trans_execute; + char *core_db_inner_pre_trans_execute; + char *core_db_inner_post_trans_execute; }; extern struct switch_runtime runtime; diff --git a/src/switch_core.c b/src/switch_core.c index 5f47c68f0e..adb9338f68 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1727,6 +1727,10 @@ static void switch_load_core_config(const char *file) runtime.core_db_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val); } else if (!strcasecmp(var, "core-db-post-trans-execute") && !zstr(val)) { runtime.core_db_post_trans_execute = switch_core_strdup(runtime.memory_pool, val); + } else if (!strcasecmp(var, "core-db-inner-pre-trans-execute") && !zstr(val)) { + runtime.core_db_inner_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val); + } else if (!strcasecmp(var, "core-db-inner-post-trans-execute") && !zstr(val)) { + runtime.core_db_inner_post_trans_execute = switch_core_strdup(runtime.memory_pool, val); } else if (!strcasecmp(var, "mailer-app") && !zstr(val)) { runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val); } else if (!strcasecmp(var, "mailer-app-args") && val) { diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index eed753b840..d6c64758aa 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -734,7 +734,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ if (!zstr(runtime.core_db_pre_trans_execute)) { switch_cache_db_execute_sql_real(dbh, runtime.core_db_pre_trans_execute, &errmsg); if (errmsg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC [%s]\n", errmsg); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC %s [%s]\n", runtime.core_db_pre_trans_execute, errmsg); free(errmsg); } } @@ -789,6 +789,15 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ break; } + + if (!zstr(runtime.core_db_inner_pre_trans_execute)) { + switch_cache_db_execute_sql_real(dbh, runtime.core_db_inner_pre_trans_execute, &errmsg); + if (errmsg) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC %s [%s]\n", runtime.core_db_inner_pre_trans_execute, errmsg); + free(errmsg); + } + } + while (retries > 0) { switch_cache_db_execute_sql(dbh, sql, &errmsg); @@ -809,6 +818,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ } } + if (!zstr(runtime.core_db_inner_post_trans_execute)) { + switch_cache_db_execute_sql_real(dbh, runtime.core_db_inner_post_trans_execute, &errmsg); + if (errmsg) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC %s [%s]\n", runtime.core_db_inner_post_trans_execute, errmsg); + free(errmsg); + } + } + done: if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { @@ -821,7 +838,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ if (!zstr(runtime.core_db_post_trans_execute)) { switch_cache_db_execute_sql_real(dbh, runtime.core_db_post_trans_execute, &errmsg); if (errmsg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC [%s]\n", errmsg); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC %s [%s]\n", runtime.core_db_post_trans_execute, errmsg); free(errmsg); } } From 4630e3b9274743b1b1f6ab08789d90fb54131f0c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Apr 2012 11:37:21 -0500 Subject: [PATCH 0062/1057] FS-4160 try this --- src/switch_ivr_bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 206bd8787d..ab7136b9a3 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -813,7 +813,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio switch_core_session_rwunlock(other_session); if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_continue_on_cancel"))) { switch_channel_set_state(channel, CS_EXECUTE); - } else { + } else if (!switch_channel_test_flag(channel, CF_TRANSFER)) { switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL); } goto done; From 481df053aca32e9623b338e3636cc77772c92df2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Apr 2012 14:41:32 -0500 Subject: [PATCH 0063/1057] require timer by default unless its t.38 re-invite --- src/mod/endpoints/mod_sofia/mod_sofia.c | 1 + src/mod/endpoints/mod_sofia/sofia_glue.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5533ae146c..3780886287 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1924,6 +1924,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch_channel_set_flag(channel, CF_REQ_MEDIA); } sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE); + switch_channel_set_variable(channel, "sip_require_timer", "false"); sofia_glue_do_invite(session); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Request to send IMAGE on channel with not t38 options.\n", diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 09b599cfbb..e2607a5e5a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2057,7 +2057,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) char *mp = NULL, *mp_type = NULL; char *record_route = NULL; const char *recover_via = NULL; - int require_timer = 0; + int require_timer = 1; if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) { @@ -2089,8 +2089,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } - if ((val = switch_channel_get_variable(channel, "sip_require_timer")) && switch_true(val)) { - require_timer = 1; + if ((val = switch_channel_get_variable_dup(channel, "sip_require_timer", SWITCH_FALSE, -1)) && switch_false(val)) { + require_timer = 0; } From 2a0ca295cc5b88341de224d7ee2156d1739e839b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 27 Apr 2012 15:28:17 -0500 Subject: [PATCH 0064/1057] FS-4144 --resolve --- .../applications/mod_commands/mod_commands.c | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 289f6d3b02..9baa7ce0f1 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1559,27 +1559,22 @@ SWITCH_STANDARD_API(regex_function) goto error; } - if ((proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { - if (argc > 2) { - len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed; - substituted = malloc(len); - switch_assert(substituted); - memset(substituted, 0, len); - switch_replace_char(argv[2], '%', '$', SWITCH_FALSE); - switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector); + proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0])); - stream->write_function(stream, "%s", substituted); - free(substituted); - } else { - stream->write_function(stream, "true"); - } + if (argc > 2) { + len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed; + substituted = malloc(len); + switch_assert(substituted); + memset(substituted, 0, len); + switch_replace_char(argv[2], '%', '$', SWITCH_FALSE); + switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector); + + stream->write_function(stream, "%s", substituted); + free(substituted); } else { - if (argc > 2) { - stream->write_function(stream, "%s", argv[0]); - } else { - stream->write_function(stream, "false"); - } + stream->write_function(stream, proceed ? "true" : "false"); } + goto ok; error: From 017843a8cff10685a0a4ceafb1ada25a43864938 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Sat, 28 Apr 2012 09:37:56 -0500 Subject: [PATCH 0065/1057] DOH! --- freeswitch.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/freeswitch.spec b/freeswitch.spec index de2bc65ebe..a56dd90035 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1,4 +1,3 @@ -2012 ###################################################################################################################### # # spec file for package freeswitch From 428340830b13673de0407a2ec8d99a8a69a5b69d Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Sun, 29 Apr 2012 11:33:24 -0400 Subject: [PATCH 0066/1057] Fix for not handling T302 timeout in NET mode --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c | 6 ++++++ 1 file changed, 6 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 0a34068359..75575ca732 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 @@ -953,6 +953,12 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case 2: /* overlap sending */ switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_COLLECT: + /* T302 Timeout reached */ + /* Send the call to user, and see if they accept it */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + break; case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_RINGING: From acd36896662b64b109032eaaac92273bb29d4cab Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Mon, 30 Apr 2012 17:36:15 +0000 Subject: [PATCH 0067/1057] FS-4064 mod_posix_timer workaround of CentOS 5 glibc problem --- .../timers/mod_posix_timer/mod_posix_timer.c | 401 ++++++++++++--- src/mod/timers/mod_posix_timer/test/Makefile | 2 +- src/mod/timers/mod_posix_timer/test/main.c | 475 ++++++++++++++++-- src/mod/timers/mod_posix_timer/test/switch.c | 16 +- src/mod/timers/mod_posix_timer/test/switch.h | 5 +- 5 files changed, 782 insertions(+), 117 deletions(-) diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index 425e98c93d..04d694b5f7 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -1,5 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2012, Anthony Minessale II * * Version: MPL 1.1 * @@ -28,91 +29,153 @@ * */ #include -#include -#include +#include /* timer_* */ +#include /* sigaction(), timer_*, etc. */ +#include /* pipe() */ +#include /* fcntl() */ +#include /* strerror() */ +#include /* uint8_t */ +#include /* errno */ +#include /* select() */ +#include /* pthread_sigmask() */ SWITCH_MODULE_LOAD_FUNCTION(mod_posix_timer_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_posix_timer_shutdown); -SWITCH_MODULE_DEFINITION(mod_posix_timer, mod_posix_timer_load, mod_posix_timer_shutdown, NULL); +SWITCH_MODULE_RUNTIME_FUNCTION(mod_posix_timer_runtime); +SWITCH_MODULE_DEFINITION(mod_posix_timer, mod_posix_timer_load, mod_posix_timer_shutdown, mod_posix_timer_runtime); +#define SIG SIGRTMAX #define MAX_INTERVAL 2000 /* ms */ #define TIMERS_PER_INTERVAL 4 - -typedef struct { - int users; - timer_t timer; - switch_size_t tick; - switch_mutex_t *mutex; - switch_thread_cond_t *cond; - int interval; - int id; -} interval_timer_t; - -static struct { - switch_memory_pool_t *pool; - int shutdown; - interval_timer_t interval_timers[MAX_INTERVAL + 1][TIMERS_PER_INTERVAL]; - int next_interval_timer_id[MAX_INTERVAL + 1]; - switch_mutex_t *interval_timers_mutex; -} globals; +#define MAX_ACTIVE_TIMERS 256 /* one byte */ /** - * Notified by POSIX timer of a tick + * Module's internal timer data. + * Keeps track of how many users are using the timer + * and the condvar to signal threads waiting on the timer. */ -static void posix_timer_notify(union sigval data) -{ - interval_timer_t *it = (interval_timer_t *)data.sival_ptr; - switch_mutex_lock(it->mutex); - if (it->users) { - it->tick += 1 + timer_getoverrun(it->timer); - switch_thread_cond_broadcast(it->cond); - } - switch_mutex_unlock(it->mutex); +typedef struct { + /** Number of users of this timer */ + int users; + /** The POSIX timer handle */ + timer_t timer; + /** Number of ticks */ + switch_size_t tick; + /** synchronizes access to condvar, users */ + switch_mutex_t *mutex; + /** condvar for threads waiting on timer */ + switch_thread_cond_t *cond; + /** The timer period in ms */ + int interval; + /** Which timer for this interval */ + int num; + /** The timer's index into the active_interval_timers array */ + int active_id; +} interval_timer_t; - if (globals.shutdown) { - switch_mutex_lock(globals.interval_timers_mutex); - if (it->users) { - timer_delete(it->timer); - memset(&it->timer, 0, sizeof(it->timer)); - it->users = 0; +/** + * Module global data + */ +static struct { + /** Module memory pool */ + switch_memory_pool_t *pool; + /** True if module is shutting down */ + int shutdown; + /** Maps intervals to timers */ + interval_timer_t interval_timers[MAX_INTERVAL + 1][TIMERS_PER_INTERVAL]; + /** Maps IDs to timers */ + interval_timer_t *active_interval_timers[MAX_ACTIVE_TIMERS]; + /** Next timer to assign for a particular interval */ + int next_interval_timer_num[MAX_INTERVAL + 1]; + /** Synchronizes access to timer creation / deletion */ + switch_mutex_t *interval_timers_mutex; + /** Synchronizes access to active timers array */ + switch_mutex_t *active_timers_mutex; + /** number of active timers */ + int active_timers_count; + /** self-pipe to notify thread of tick from a signal handler */ + int timer_tick_pipe[2]; +} globals; + + +/** + * Handle timer signal + * @param sig the signal + * @param si the signal information + * @param cu unused + */ +static void timer_signal_handler(int sig, siginfo_t *si, void *cu) +{ + if (sig == SIG && si->si_code == SI_TIMER) { + int val = si->si_value.sival_int; + if (val >= 0 && val <= MAX_ACTIVE_TIMERS) { + uint8_t active_id = (uint8_t)val; + /* notify runtime thread that timer identified by active_id has ticked */ + write(globals.timer_tick_pipe[1], &active_id, 1); } - switch_mutex_unlock(globals.interval_timers_mutex); } } /** - * Start a new timer + * Start a new interval timer + * @param it the timer + * @param interval the timer interval + * @return SWITCH_STATUS_SUCCESS if successful */ -static switch_status_t posix_timer_start_interval(interval_timer_t *it, int interval) +static switch_status_t interval_timer_start(interval_timer_t *it, int interval) { - struct sigevent sigev; - struct itimerspec val; - if (globals.shutdown) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "module is shutting down, ignoring request\n"); return SWITCH_STATUS_GENERR; } if (it->users <= 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "starting %d ms timer #%d\n", it->interval, it->id + 1); - /* reset */ + struct sigevent sigev; + struct itimerspec val; + int active_id = -1; + int i; + + /* find an available id for this timer */ + for (i = 0; i < MAX_ACTIVE_TIMERS && active_id == -1; i++) { + switch_mutex_lock(globals.active_timers_mutex); + if(globals.active_interval_timers[i] == NULL) { + active_id = i; + } + switch_mutex_unlock(globals.active_timers_mutex); + } + if (active_id == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no more timers can be created!\n"); + return SWITCH_STATUS_GENERR; + } + it->active_id = active_id; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "starting %d ms timer #%d (%d)\n", it->interval, it->num + 1, it->active_id); + + /* reset timer data */ it->tick = 0; it->users = 0; - /* reuse, if possible */ + /* reuse mutex/condvar */ if (it->mutex == NULL) { switch_mutex_init(&it->mutex, SWITCH_MUTEX_NESTED, globals.pool); switch_thread_cond_create(&it->cond, globals.pool); } - /* create the POSIX timer. Will notify the posix_timer_notify thread on ticks. */ + /* create the POSIX timer. Will send SIG on each tick. */ memset(&sigev, 0, sizeof(sigev)); - sigev.sigev_notify = SIGEV_THREAD; - sigev.sigev_notify_function = posix_timer_notify; - sigev.sigev_value.sival_ptr = (void *)it; + sigev.sigev_notify = SIGEV_SIGNAL; + sigev.sigev_signo = SIG; + sigev.sigev_value.sival_int = active_id; if (timer_create(CLOCK_MONOTONIC, &sigev, &it->timer) == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create timer: %s\n", strerror(errno)); return SWITCH_STATUS_GENERR; } + switch_mutex_lock(globals.active_timers_mutex); + globals.active_interval_timers[it->active_id] = it; + globals.active_timers_count++; + switch_mutex_unlock(globals.active_timers_mutex); + /* start the timer to tick at interval */ memset(&val, 0, sizeof(val)); val.it_interval.tv_sec = interval / 1000; @@ -120,6 +183,11 @@ static switch_status_t posix_timer_start_interval(interval_timer_t *it, int inte val.it_value.tv_sec = 0; val.it_value.tv_nsec = 100000; if (timer_settime(it->timer, 0, &val, NULL) == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to start timer: %s\n", strerror(errno)); + switch_mutex_lock(globals.active_timers_mutex); + globals.active_interval_timers[it->active_id] = NULL; + globals.active_timers_count--; + switch_mutex_unlock(globals.active_timers_mutex); return SWITCH_STATUS_GENERR; } } @@ -129,18 +197,39 @@ static switch_status_t posix_timer_start_interval(interval_timer_t *it, int inte } /** - * Stop a timer + * Delete an interval timer + * @param it the interval timer */ -static switch_status_t posix_timer_stop_interval(interval_timer_t *it) +static void interval_timer_delete(interval_timer_t *it) +{ + /* remove from active timers */ + switch_mutex_lock(globals.active_timers_mutex); + if (globals.active_interval_timers[it->active_id]) { + globals.active_interval_timers[it->active_id] = NULL; + globals.active_timers_count--; + } + switch_mutex_unlock(globals.active_timers_mutex); + + /* delete the POSIX timer and mark interval timer as destroyed (users == 0) */ + switch_mutex_lock(it->mutex); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "deleting %d ms timer #%d (%d)\n", it->interval, it->num + 1, it->active_id); + timer_delete(it->timer); + memset(&it->timer, 0, sizeof(it->timer)); + it->users = 0; + switch_mutex_unlock(it->mutex); +} + +/** + * Remove a user from interval timer. Delete if no more users remain. + * @param it the interval timer + * @return SWITCH_STATUS_SUCCESS + */ +static switch_status_t interval_timer_stop(interval_timer_t *it) { if (it->users > 0) { it->users--; if (it->users == 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "stopping %d ms timer #%d\n", it->interval, it->id + 1); - switch_mutex_lock(it->mutex); - timer_delete(it->timer); - memset(&it->timer, 0, sizeof(it->timer)); - switch_mutex_unlock(it->mutex); + interval_timer_delete(it); } } return SWITCH_STATUS_SUCCESS; @@ -151,26 +240,27 @@ static switch_status_t posix_timer_stop_interval(interval_timer_t *it) * @param timer the timer * @return SWITCH_STATUS_SUCCESS if successful otherwise SWITCH_STATUS_GENERR */ -static switch_status_t posix_timer_init(switch_timer_t *timer) +static switch_status_t mod_posix_timer_init(switch_timer_t *timer) { interval_timer_t *it; switch_status_t status; - int interval_timer_id; + int interval_timer_num; if (timer->interval < 1 || timer->interval > MAX_INTERVAL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad interval: %d\n", timer->interval); return SWITCH_STATUS_GENERR; } switch_mutex_lock(globals.interval_timers_mutex); - interval_timer_id = globals.next_interval_timer_id[timer->interval]++; - if (globals.next_interval_timer_id[timer->interval] >= TIMERS_PER_INTERVAL) { - globals.next_interval_timer_id[timer->interval] = 0; + interval_timer_num = globals.next_interval_timer_num[timer->interval]++; + if (globals.next_interval_timer_num[timer->interval] >= TIMERS_PER_INTERVAL) { + globals.next_interval_timer_num[timer->interval] = 0; } - it = &globals.interval_timers[timer->interval][interval_timer_id]; - it->id = interval_timer_id; + it = &globals.interval_timers[timer->interval][interval_timer_num]; + it->num = interval_timer_num; it->interval = timer->interval; - status = posix_timer_start_interval(it, timer->interval); + status = interval_timer_start(it, timer->interval); timer->private_info = it; switch_mutex_unlock(globals.interval_timers_mutex); @@ -182,7 +272,7 @@ static switch_status_t posix_timer_init(switch_timer_t *timer) * @param timer the timer * @return SWITCH_STATUS_SUCCESS */ -static switch_status_t posix_timer_step(switch_timer_t *timer) +static switch_status_t mod_posix_timer_step(switch_timer_t *timer) { timer->tick++; timer->samplecount += timer->samples; @@ -193,16 +283,16 @@ static switch_status_t posix_timer_step(switch_timer_t *timer) /** * Timer module interface: wait for next tick * @param timer the timer - * @return SWITCH_STATUS_SUCCESS if successful + * @return SWITCH_STATUS_SUCCESS if successful */ -static switch_status_t posix_timer_next(switch_timer_t *timer) +static switch_status_t mod_posix_timer_next(switch_timer_t *timer) { interval_timer_t *it = timer->private_info; if ((int)(timer->tick - it->tick) < -1) { timer->tick = it->tick; } - posix_timer_step(timer); + mod_posix_timer_step(timer); switch_mutex_lock(it->mutex); while ((int)(timer->tick - it->tick) > 0 && !globals.shutdown) { @@ -218,7 +308,7 @@ static switch_status_t posix_timer_next(switch_timer_t *timer) * @param timer the timer * @return SWITCH_STATUS_SUCCESS */ -static switch_status_t posix_timer_sync(switch_timer_t *timer) +static switch_status_t mod_posix_timer_sync(switch_timer_t *timer) { interval_timer_t *it = timer->private_info; timer->tick = it->tick; @@ -232,7 +322,7 @@ static switch_status_t posix_timer_sync(switch_timer_t *timer) * @param step true if timer should be stepped * @return SWITCH_STATUS_SUCCESS if synched, SWITCH_STATUS_FALSE otherwise */ -static switch_status_t posix_timer_check(switch_timer_t *timer, switch_bool_t step) +static switch_status_t mod_posix_timer_check(switch_timer_t *timer, switch_bool_t step) { interval_timer_t *it = timer->private_info; int diff = (int)(timer->tick - it->tick); @@ -245,7 +335,7 @@ static switch_status_t posix_timer_check(switch_timer_t *timer, switch_bool_t st /* timer pending */ timer->diff = 0; if (step) { - posix_timer_step(timer); + mod_posix_timer_step(timer); } return SWITCH_STATUS_SUCCESS; } @@ -255,44 +345,195 @@ static switch_status_t posix_timer_check(switch_timer_t *timer, switch_bool_t st * @param timer the timer * @return SWITCH_STATUS_SUCCESS if successful */ -static switch_status_t posix_timer_destroy(switch_timer_t *timer) +static switch_status_t mod_posix_timer_destroy(switch_timer_t *timer) { interval_timer_t *it = timer->private_info; switch_status_t status; switch_mutex_lock(globals.interval_timers_mutex); - status = posix_timer_stop_interval(it); + status = interval_timer_stop(it); switch_mutex_unlock(globals.interval_timers_mutex); return status; } +/** + * Load the module + */ SWITCH_MODULE_LOAD_FUNCTION(mod_posix_timer_load) { switch_timer_interface_t *timer_interface; memset(&globals, 0, sizeof(globals)); + globals.timer_tick_pipe[0] = -1; + globals.timer_tick_pipe[1] = -1; globals.pool = pool; switch_mutex_init(&globals.interval_timers_mutex, SWITCH_MUTEX_NESTED, globals.pool); + switch_mutex_init(&globals.active_timers_mutex, SWITCH_MUTEX_NESTED, globals.pool); /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(globals.pool, modname); timer_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_TIMER_INTERFACE); timer_interface->interface_name = "posix"; - timer_interface->timer_init = posix_timer_init; - timer_interface->timer_next = posix_timer_next; - timer_interface->timer_step = posix_timer_step; - timer_interface->timer_sync = posix_timer_sync; - timer_interface->timer_check = posix_timer_check; - timer_interface->timer_destroy = posix_timer_destroy; + timer_interface->timer_init = mod_posix_timer_init; + timer_interface->timer_next = mod_posix_timer_next; + timer_interface->timer_step = mod_posix_timer_step; + timer_interface->timer_sync = mod_posix_timer_sync; + timer_interface->timer_check = mod_posix_timer_check; + timer_interface->timer_destroy = mod_posix_timer_destroy; + + /* the pipe allows a signal handler to notify the runtime thread in a async-signal-safe manner */ + if (pipe(globals.timer_tick_pipe) == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create pipe\n"); + globals.shutdown = 1; + return SWITCH_STATUS_GENERR; + } + fcntl(globals.timer_tick_pipe[0], F_SETFL, O_NONBLOCK); + fcntl(globals.timer_tick_pipe[1], F_SETFL, O_NONBLOCK); + + { + struct sigaction sa; + sigset_t sigmask; + + /* Prevent SIG from annoying FS process. It will be unblocked in the runtime thread. */ + sigemptyset(&sigmask); + sigaddset(&sigmask, SIG); + sigprocmask(SIG_BLOCK, &sigmask, NULL); + + /* set up signal handler */ + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_SIGINFO | SA_RESTART; + sa.sa_sigaction = timer_signal_handler; + sigfillset(&sa.sa_mask); + if (sigaction(SIG, &sa, NULL) == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set up signal handler: %s\n", strerror(errno)); + globals.shutdown = 1; + return SWITCH_STATUS_GENERR; + } + } return SWITCH_STATUS_SUCCESS; } +/** + * Runtime thread watches for timer ticks sent by signal handler over pipe. Broadcasts + * ticks to session threads waiting on timer. + */ +SWITCH_MODULE_RUNTIME_FUNCTION(mod_posix_timer_runtime) +{ + uint8_t active_ids[32]; + sigset_t sigmask; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "runtime thread starting\n"); + + /* allow SIG to be delivered to this thread. */ + sigemptyset(&sigmask); + sigaddset(&sigmask, SIG); + pthread_sigmask(SIG_UNBLOCK, &sigmask, NULL); + + /* run until module shutdown */ + while (!globals.shutdown) { + int retval, i; + fd_set read_fds; + struct timeval timeout = { 0, 200 * 1000 }; /* 200 ms */ + + /* wait for timer tick */ + FD_ZERO(&read_fds); + FD_SET(globals.timer_tick_pipe[0], &read_fds); + retval = select(globals.timer_tick_pipe[0] + 1, &read_fds, NULL, NULL, &timeout); + if (retval == -1) { + if (errno == EINTR) { + /* retry */ + continue; + } + if (errno == EBADF) { + /* done */ + break; + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error waiting on pipe: %s. Timer thread exiting\n", strerror(errno)); + break; + } else if (retval == 0) { + /* retry */ + continue; + } + if (!FD_ISSET(globals.timer_tick_pipe[0], &read_fds)) { + /* retry */ + continue; + } + + /* which timer ticked? */ + retval = read(globals.timer_tick_pipe[0], &active_ids, 32); + if (retval == -1) { + if (errno == EINTR || errno == EAGAIN) { + /* retry */ + continue; + } + if (errno == EBADF) { + /* done */ + break; + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reading from pipe: %s. Timer thread exiting\n", strerror(errno)); + break; + } else if (retval == 0) { + /* retry */ + continue; + } + + /* notify threads of timer tick */ + for (i = 0; i < retval; i++) { + interval_timer_t *it = NULL; + + /* find interval timer */ + switch_mutex_lock(globals.active_timers_mutex); + it = globals.active_interval_timers[(int)active_ids[i]]; + switch_mutex_unlock(globals.active_timers_mutex); + if (it == NULL) { + continue; + } + + /* send notification */ + switch_mutex_lock(it->mutex); + if (it->users) { + it->tick += 1 + timer_getoverrun(it->timer); + switch_thread_cond_broadcast(it->cond); + } + switch_mutex_unlock(it->mutex); + } + } + + globals.shutdown = 1; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "runtime thread finished\n"); + return SWITCH_STATUS_TERM; +} + +/** + * Module shutdown + */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_posix_timer_shutdown) { + int i; globals.shutdown = 1; + + if (globals.timer_tick_pipe[0] > 0) { + close(globals.timer_tick_pipe[0]); + } + if (globals.timer_tick_pipe[1] > 0) { + close(globals.timer_tick_pipe[1]); + } + + /* Delete all active timers */ + switch_mutex_lock(globals.interval_timers_mutex); + for (i = 0; i < MAX_ACTIVE_TIMERS; i++) { + interval_timer_t *it; + switch_mutex_lock(globals.active_timers_mutex); + it = globals.active_interval_timers[i]; + switch_mutex_unlock(globals.active_timers_mutex); + if (it) { + interval_timer_delete(it); + } + } + switch_mutex_unlock(globals.interval_timers_mutex); + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/timers/mod_posix_timer/test/Makefile b/src/mod/timers/mod_posix_timer/test/Makefile index 856345298b..eda0799146 100644 --- a/src/mod/timers/mod_posix_timer/test/Makefile +++ b/src/mod/timers/mod_posix_timer/test/Makefile @@ -1,5 +1,5 @@ all: - gcc ../mod_posix_timer.c main.c switch.c -I. -o timer_test -lpthread -lrt -g -DLOG_LEVEL=-1 + gcc ../mod_posix_timer.c main.c switch.c -I. -o timer_test -lpthread -lrt -lm -g -DLOG_LEVEL=-1 clean: -rm timer_test diff --git a/src/mod/timers/mod_posix_timer/test/main.c b/src/mod/timers/mod_posix_timer/test/main.c index 1df054566d..44f3a34aea 100644 --- a/src/mod/timers/mod_posix_timer/test/main.c +++ b/src/mod/timers/mod_posix_timer/test/main.c @@ -1,44 +1,461 @@ #include #include +#include +#include +#include +#include +#include +#include extern SWITCH_MODULE_LOAD_FUNCTION(mod_posix_timer_load); extern SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_posix_timer_shutdown); +extern SWITCH_MODULE_RUNTIME_FUNCTION(mod_posix_timer_runtime); switch_loadable_module_interface_t *mod = NULL; switch_memory_pool_t pool = { 0 }; +switch_timer_interface_t *timer_if; +pthread_t module_runtime_thread_id; -int main (int argc, char **argv) +pthread_mutex_t session_mutex = PTHREAD_MUTEX_INITIALIZER; +int pass_count; +int warn_count; +int fail_count; +int total_sessions; +int session_count; +int last_reported_session_count; +int shutdown; + + +/** + * Return a random sample from a normal distrubtion centered at mean with + * the specified standard deviation. + * + * THIS FUNCTION IS NOT REENTRANT!!! + */ +double randnorm(double mean, double std_dev) { + static double z1 = -1.0f; + double u1, u2, z0; + + /* random numbers are generated in pairs. See if new pair needs to be calculated */ + if (z1 >= 0.0f) { + z0 = z1; + z1 = -1.0f; + } else { + /* use box-muller transform to generate random number pair over normal distribution */ + u1 = drand48(); + u2 = drand48(); + z0 = sqrt(-2.0f * log(u1)) * cos(2.0f * M_PI * u2); + z1 = sqrt(-2.0f * log(u1)) * sin(2.0f * M_PI * u2); + } + + return (z0 * std_dev) + mean; +} + +/** + * Pick a random sample according the the weights + * @param weights array of weights + * @param num_weights + */ +static int sample(int *weights, int num_weights) +{ + int total_weight = weights[num_weights - 1]; + int s = floor(drand48() * total_weight); int i; - switch_timer_interface_t *timer_if; - switch_timer_t *timer[1000]; - - mod_posix_timer_load(&mod, &pool); - timer_if = mod->timer; - - - // TODO create multi-threaded test - - // create 10 ms timers - for (i = 0; i < 1000; i++) { - timer[i] = malloc(sizeof(switch_timer_t)); - memset(timer[i], 0, sizeof(switch_timer_t)); - timer[i]->interval = 1; - timer[i]->samples = 8; - timer_if->timer_init(timer[i]); + for (i = 0; i < num_weights; i++) { + if (s < weights[i]) { + return i; + } } - - for (i = 0; i < 50000; i++) { - timer_if->timer_next(timer[0]); - } - - // destroy timers - for (i = 0; i < 1000; i++) { - timer_if->timer_destroy(timer[i]); - free(timer[i]); - } - - mod_posix_timer_shutdown(); + printf ("DOH! s = %f\n", s); return 0; } + +/* + * Calculate x - y + * @return 0 if x is before y, the difference otherwise. + */ +double timespec_subtract(struct timespec *x, struct timespec *y) +{ + struct timespec result; + + /* Perform the carry for the later subtraction by updating y. */ + if (x->tv_nsec < y->tv_nsec) { + int nsec = (y->tv_nsec - x->tv_nsec) / 1000000000 + 1; + y->tv_nsec -= 1000000000 * nsec; + y->tv_sec += nsec; + } + if (x->tv_nsec - y->tv_nsec > 1000000000) { + int nsec = (x->tv_nsec - y->tv_nsec) / 1000000000; + y->tv_nsec += 1000000000 * nsec; + y->tv_sec -= nsec; + } + + /* Return 0 if result is negative. */ + if(x->tv_sec < y->tv_sec) { + return 0.0f; + } + + /* Return the difference */ + result.tv_sec = x->tv_sec - y->tv_sec; + result.tv_nsec = x->tv_nsec - y->tv_nsec; + return (double)result.tv_sec + (double)(result.tv_nsec / 1e9); +} + +/** + * Entry point for the runtime thread + */ +static void *module_thread(void *dummy) +{ + mod_posix_timer_runtime(); + return NULL; +} + +/** + * Load mod_posix_timer and start the runtime thread + */ +static void load_module() +{ + fail_count = 0; + warn_count = 0; + pass_count = 0; + total_sessions = 0; + session_count = 0; + last_reported_session_count = 0; + shutdown = 0; + mod_posix_timer_load(&mod, &pool); + timer_if = mod->timer; + pthread_create(&module_runtime_thread_id, NULL, module_thread, NULL); +} + +/** + * Shutdown mod_posix_timer + */ +static void shutdown_module() +{ + shutdown = 1; + mod_posix_timer_shutdown(); + pthread_join(module_runtime_thread_id, NULL); +} + +/** + * Test rapidly creating and destroying timers + */ +static void test_create_destroy() +{ + switch_timer_t *timers[3000] = { 0 }; + int intervals[4] = { 10, 20, 30, 40 }; + int interval_weights[4] = { 25, 50, 75, 100 }; + int interval_counts[4] = { 0, 0, 0, 0 }; + int toggle[2] = { 75, 100 }; + int timer_count = 0; + + int i = 0; + printf("test_create_destroy()\n"); + for(i = 0; i < 100000000; i++) { + int clear = i % 100000 == 0; + int j; + for (j = 0; j < 3000; j++) { + if (sample(toggle, 2) || clear) { + if (timers[j]) { + interval_counts[timers[j]->interval / 10 - 1]--; + timer_if->timer_destroy(timers[j]); + free(timers[j]); + timers[j] = NULL; + timer_count--; + } else if (!clear) { + int interval = intervals[sample(interval_weights, 4)]; + timers[j] = malloc(sizeof(switch_timer_t)); + memset(timers[j], 0, sizeof(switch_timer_t)); + timers[j]->interval = interval; + timers[j]->samples = interval * 8; + timer_if->timer_init(timers[j]); + timer_count++; + interval_counts[interval / 10 - 1]++; + } + } + } + if (i % 1000 == 0) { + printf("timers = %d, 10ms = %d, 20ms = %d, 30ms = %d, 40ms = %d\n", timer_count, interval_counts[0], interval_counts[1], interval_counts[2], interval_counts[3]); + } + } +} + +/** + * Session thread + */ +typedef struct session_thread_data +{ + int id; + int interval; + double duration; + double actual_duration; + int failed; + int detached; +} session_thread_data_t; + +/** + * Check the result of the session thread's test + * Log a message on failure. Save the result. + */ +static void check_result(session_thread_data_t *sd) +{ + double threshold = sd->interval / 1000.0f; + double diff = sd->actual_duration - sd->duration; + if (diff < 0) { + diff = diff * -1.0f; + } + if (diff > threshold * 2.0) { + sd->failed = 2; + } else if (diff > threshold) { + sd->failed = 1; + } else { + sd->failed = 0; + } + if (sd->failed > 1) { + printf("thread #%d FAILED : expected duration = %f, actual duration = %f, diff = %f, threshold = %f\n", sd->id, sd->duration, sd->actual_duration, diff, threshold); + } else { + //printf("thread #%d PASSED : expected duration = %f, actual duration = %f, diff = %f, threshold = %f\n", sd->id, sd->duration, sd->actual_duration, diff, threshold); + + } +} + +/** + * Creates a timer and advances it until duration expires + */ +void *session_thread(void *arg) +{ + int *pass = 0; + session_thread_data_t *d = (session_thread_data_t *)arg; + switch_timer_t timer = { 0 }; + + /* start the timer */ + timer.interval = d->interval; + timer.samples = d->interval * 8; + if (timer_if->timer_init(&timer) != SWITCH_STATUS_SUCCESS) { + printf("WTF!\n"); + goto done; + } + //timer_if->timer_sync(&timer); + + /* tick for duration */ + { + int i; + struct timespec start, end; + int ticks = floor(d->duration * 1000 / d->interval); + clock_gettime(CLOCK_MONOTONIC, &start); + for (i = 0; i < ticks && !shutdown; i++) { + timer_if->timer_next(&timer); + } + clock_gettime(CLOCK_MONOTONIC, &end); + d->actual_duration = timespec_subtract(&end, &start); + } + + /* stop the timer */ + timer_if->timer_destroy(&timer); + + if (!shutdown) { + check_result(d); + } + + pthread_mutex_lock(&session_mutex); + if (d->failed > 1) { + fail_count++; + } else if (d->failed > 0) { + warn_count++; + } else { + pass_count++; + } + session_count--; + if (session_count % 100 == 0 && last_reported_session_count != session_count) { + printf("sessions = %d\n", session_count); + last_reported_session_count = session_count; + } + pthread_mutex_unlock(&session_mutex); + +done: + if (d->detached) { + free(d); + return NULL; + } + + /* return result */ + return d; +} + + +/** + * @param thread the thread + * @param id for logging + * @param interval the timer period in ms + * @param duration_mean the mean duration for this thread to execute + * @param duration_std_dev the standard deviation from the mean duration + * @param detached if true this thread is detached + */ +static void create_session_thread(pthread_t *thread, int id, int interval, double duration_mean, double duration_std_dev, int detached) +{ + session_thread_data_t *d = malloc(sizeof(session_thread_data_t)); + pthread_mutex_lock(&session_mutex); + total_sessions++; + session_count++; + if (total_sessions % 100 == 0) { + printf("total sessions = %d, sessions = %d, pass = %d, warn = %d, fail = %d\n", total_sessions, session_count, pass_count, warn_count, fail_count); + } + if (session_count % 100 == 0 && last_reported_session_count != session_count) { + printf("sessions = %d\n", session_count); + last_reported_session_count = session_count; + } + pthread_mutex_unlock(&session_mutex); + if (interval == 0) { + printf("WTF WTF WTF!!\n"); + printf("id = %d, interval = %d, duration_mean = %f, duration_std_dev = %f, detached = %d\n", id, interval, duration_mean, duration_std_dev, detached); + } + d->id = id; + d->interval = interval; + d->duration = randnorm(duration_mean, duration_std_dev); + /* truncate duration to interval tick */ + d->duration = ceil(d->duration * 1000 / interval) * interval / 1000.0f; + d->detached = detached; + d->failed = 0; + pthread_create(thread, NULL, session_thread, d); + if (detached) { + pthread_detach(*thread); + } +} + + + +/** + * Create timers at a rate of CPS for test_duration. + * + * @param interval array of timer intervals in ms + * @param interval_weights array of timer intervals weights + * @param num_intervals size of interval array + * @param test_duration how long to run this test, in seconds + * @param cps the "calls per second". This is the rate at which session threads are created + * @param duration_mean mean duration for each thread + * @param duration_std_dev standard deviation from the mean duration + * @param num_timers number of threads to create + */ +static void test_timer_session(int *interval, int *interval_weights, int num_intervals, double test_duration, int cps, int max_sessions, double duration_mean, double duration_std_dev) +{ + int i = 0; + struct timespec start, now, period; + double elapsed = 0.0f; + + printf("test_timer_session(%d, %f, %d, %d, %f, %f)\n", interval[0], test_duration, cps, max_sessions, duration_mean, duration_std_dev); + + + /* create new call threads at CPS for test_duration */ + if (cps == 1) { + period.tv_sec = 1; + period.tv_nsec = 0; + } else { + period.tv_sec = 0; + period.tv_nsec = 1000000000 / cps; + } + + clock_gettime(CLOCK_MONOTONIC, &start); + while (elapsed < test_duration) { + pthread_t thread; + int retval = clock_nanosleep(CLOCK_MONOTONIC, 0, &period, NULL); + if (retval == -1) { + if (errno == EINTR) { + /* retry */ + continue; + } + printf("clock_nanosleep() error: %s\n", strerror(errno)); + break; + } + pthread_mutex_lock(&session_mutex); + if (session_count < max_sessions) { + pthread_mutex_unlock(&session_mutex); + create_session_thread(&thread, ++i, interval[sample(interval_weights, 4)], duration_mean, duration_std_dev, 1); + } else { + pthread_mutex_unlock(&session_mutex); + } + clock_gettime(CLOCK_MONOTONIC, &now); + elapsed = timespec_subtract(&now, &start); + } + + pthread_mutex_lock(&session_mutex); + while (session_count) { + struct timespec t; + t.tv_sec = 0; + t.tv_nsec = 200 * 1000; + pthread_mutex_unlock(&session_mutex); + clock_nanosleep(CLOCK_MONOTONIC, 0, &t, NULL); + pthread_mutex_lock(&session_mutex); + } + pthread_mutex_unlock(&session_mutex); + + + printf("test_timer_session(%d, %f, %d, %d, %f, %f) done\n", interval[0], test_duration, cps, max_sessions, duration_mean, duration_std_dev); +} + +/** + * Create num_timers in threads and tick until duration_mean elapses. + * + * @param interval timer interval in ms + * @param duration_mean mean duration for each thread + * @param duration_std_dev standard deviation from the mean duration + * @param num_timers number of threads to create + */ +static void test_timer(int interval, double duration_mean, double duration_std_dev, int num_timers) +{ + int i; + int pass = 1; + pthread_t *threads = malloc(sizeof(pthread_t) * num_timers); + printf("test_timer(%d, %f, %f, %d)\n", interval, duration_mean, duration_std_dev, num_timers); + + + /* create threads */ + for (i = 0; i < num_timers; i++) { + create_session_thread(&threads[i], i, interval, duration_mean, duration_std_dev, 0); + } + + /* wait for thread results */ + for (i = 0; i < num_timers; i++) { + void *d = NULL; + pthread_join(threads[i], &d); + if (d) { + int result; + session_thread_data_t *sd = (session_thread_data_t *)d; + pass = pass & (sd->failed < 2); + free(sd); + } + } + + printf("test_timer(%d, %f, %f, %d) : %s\n", interval, duration_mean, duration_std_dev, num_timers, pass ? "PASS" : "FAIL"); + free(threads); +} + +/** + * Main program + * + */ +int main (int argc, char **argv) +{ + //int intervals[4] = { 10, 20, 30, 40 }; + //int interval_weights[4] = { 2, 95, 97, 100 }; + int intervals[1] = { 20 }; + int interval_weights[1] = { 100 }; + struct timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + srand48(ts.tv_nsec); + load_module(); + //test_timer(20, 5.0f, .2f, 1000); + //test_timer_session(intervals, interval_weights, 4, 2 * 86400.0f, 90, 2000, 30.0, 5.0f); + while(1) { + /* stop periodically to trigger timer shutdown */ + test_timer_session(intervals, interval_weights, 1, 60, 150, 3000, 30.0, 5.0f); + } + //test_timer(1000, 5.0f, 1); + //test_timer(20, 5.0f, .2f, 1000); + //test_timer(30, 5.0f, 1000); + //test_create_destroy(); + shutdown_module(); + return 0; +} + diff --git a/src/mod/timers/mod_posix_timer/test/switch.c b/src/mod/timers/mod_posix_timer/test/switch.c index 7ac7a3a97c..e58b017d35 100644 --- a/src/mod/timers/mod_posix_timer/test/switch.c +++ b/src/mod/timers/mod_posix_timer/test/switch.c @@ -42,13 +42,17 @@ switch_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_me return pthread_cond_init(*cond, NULL); } -switch_status_t switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, int wait) +switch_status_t switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, long wait) { - struct timespec dur = { 0, 0 }; - clock_gettime(CLOCK_REALTIME, &dur); - dur.tv_sec = wait / 1000000000; - dur.tv_nsec = wait % 1000000000; - return pthread_cond_timedwait(cond, mutex, &dur); + struct timespec abs_time = { 0, 0 }; + /* add wait duration to current time (wait is in microseconds, pthreads wants nanosecond resolution) */ + clock_gettime(CLOCK_REALTIME, &abs_time); + abs_time.tv_sec += wait / 1000000; + abs_time.tv_nsec += (wait % 1000000) * 1000; + /* handle overflow of tv_nsec */ + abs_time.tv_sec += abs_time.tv_nsec / 1000000000; + abs_time.tv_nsec = abs_time.tv_nsec % 1000000000; + return pthread_cond_timedwait(cond, mutex, &abs_time); } switch_status_t switch_thread_cond_broadcast(switch_thread_cond_t *cond) diff --git a/src/mod/timers/mod_posix_timer/test/switch.h b/src/mod/timers/mod_posix_timer/test/switch.h index 25391943fb..7305b8b237 100644 --- a/src/mod/timers/mod_posix_timer/test/switch.h +++ b/src/mod/timers/mod_posix_timer/test/switch.h @@ -9,12 +9,15 @@ #define SWITCH_STATUS_SUCCESS 0 #define SWITCH_STATUS_GENERR 1 #define SWITCH_STATUS_FALSE 2 +#define SWITCH_STATUS_TERM 3 #define SWITCH_MUTEX_NESTED 1 #define SWITCH_CHANNEL_LOG 0 +#define SWITCH_LOG_DEBUG 0 #define SWITCH_LOG_INFO 0 +#define SWITCH_LOG_ERROR 1 typedef int switch_status_t; typedef size_t switch_size_t; @@ -113,7 +116,7 @@ switch_status_t switch_mutex_init(switch_mutex_t **mutex, int flags, switch_memo switch_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool); -switch_status_t switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, int wait); +switch_status_t switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, long wait); switch_status_t switch_thread_cond_broadcast(switch_thread_cond_t *cond); From 940636588caf9e6335d6156343f28c1834f42d4c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 30 Apr 2012 17:51:31 -0500 Subject: [PATCH 0068/1057] FS-4166 --- src/switch_ivr_originate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 3cad2e343a..4a3067afc2 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3128,7 +3128,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_session)); holding = NULL; oglobals.idx = IDX_NADA; - if (caller_channel && switch_channel_up_nosig(caller_channel)) { + if (caller_channel && switch_channel_up_nosig(caller_channel) && !switch_channel_test_flag(caller_channel, CF_INTERCEPTED)) { switch_channel_hangup(caller_channel, SWITCH_CAUSE_ATTENDED_TRANSFER); } caller_channel = NULL; From b571952909cd9c3624baee618e7f15f6aa183979 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 30 Apr 2012 18:06:20 -0500 Subject: [PATCH 0069/1057] FS-4166 --- src/switch_ivr_bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index ab7136b9a3..45155744ff 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -660,7 +660,7 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) && !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit && state != CS_PARK && state != CS_ROUTING && state == CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) { - if (switch_channel_test_flag(channel, CF_INTERCEPT)) { + if (switch_channel_test_flag(channel, CF_INTERCEPT) && !switch_channel_test_flag(channel, CF_INTERCEPTED)) { switch_channel_hangup(channel, SWITCH_CAUSE_PICKED_OFF); } else { if (!switch_channel_test_flag(channel, CF_ANSWERED)) { From e71b238e9e30d5681f0f5c0546e4a9a6be7bead3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 30 Apr 2012 18:13:32 -0500 Subject: [PATCH 0070/1057] FS-4166 --- src/switch_ivr_bridge.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 45155744ff..dc95a43114 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -660,13 +660,15 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) && !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit && state != CS_PARK && state != CS_ROUTING && state == CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) { - if (switch_channel_test_flag(channel, CF_INTERCEPT) && !switch_channel_test_flag(channel, CF_INTERCEPTED)) { - switch_channel_hangup(channel, SWITCH_CAUSE_PICKED_OFF); - } else { - if (!switch_channel_test_flag(channel, CF_ANSWERED)) { - switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL); + if (!switch_channel_test_flag(channel, CF_INTERCEPTED)) { + if (switch_channel_test_flag(channel, CF_INTERCEPT)) { + switch_channel_hangup(channel, SWITCH_CAUSE_PICKED_OFF); } else { - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + if (!switch_channel_test_flag(channel, CF_ANSWERED)) { + switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL); + } else { + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + } } } } From df8696293d9bd240852cdd92295856e911c9e556 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 30 Apr 2012 18:25:59 -0500 Subject: [PATCH 0071/1057] FS-4166 --- src/switch_ivr_bridge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index dc95a43114..abc006f566 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -660,7 +660,9 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) && !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit && state != CS_PARK && state != CS_ROUTING && state == CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) { - if (!switch_channel_test_flag(channel, CF_INTERCEPTED)) { + if (switch_channel_test_flag(channel, CF_INTERCEPTED)) { + return SWITCH_STATUS_FALSE; + } else { if (switch_channel_test_flag(channel, CF_INTERCEPT)) { switch_channel_hangup(channel, SWITCH_CAUSE_PICKED_OFF); } else { From 1c6d7ce68f24b0bb4ddd57c7a4fc80e85aaaee92 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 30 Apr 2012 19:37:59 -0500 Subject: [PATCH 0072/1057] FS-4166 --- src/switch_ivr_bridge.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index abc006f566..8025c9d01c 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -661,6 +661,8 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit && state != CS_PARK && state != CS_ROUTING && state == CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) { if (switch_channel_test_flag(channel, CF_INTERCEPTED)) { + switch_channel_clear_flag(channel, CF_INTERCEPT); + switch_channel_clear_flag(channel, CF_INTERCEPTED); return SWITCH_STATUS_FALSE; } else { if (switch_channel_test_flag(channel, CF_INTERCEPT)) { @@ -1654,7 +1656,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, c switch_channel_t *rchannel = switch_core_session_get_channel(rsession); const char *brto; - if ((brto = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE))) { + if ((brto = switch_channel_get_variable(rchannel, "orignate_signal_bond")) || + (brto = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE))) { switch_copy_string(b_uuid, brto, blen); status = SWITCH_STATUS_SUCCESS; } From 3cdb00a525ac34a445740902f106f73ffc0d6853 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 2 May 2012 00:04:23 -0500 Subject: [PATCH 0073/1057] reduce events on many to many sla --- src/mod/endpoints/mod_sofia/sofia_presence.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 72cca73d71..8dc58d1320 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1168,6 +1168,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } #endif + if (hup && dh.hits > 0) { + goto done; + } + + if (zstr(call_id) && (dh.hits && presence_source && (!strcasecmp(presence_source, "register") || switch_stristr("register", status)))) { goto done; } @@ -1284,10 +1289,10 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } - if (hup) { + if (hup && dh.hits < 1) { /* so many phones get confused when whe hangup we have to reprobe to get them all to reset to absolute states so the lights stay correct */ switch_event_t *s_event; - + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); @@ -1299,6 +1304,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } } + if (!zstr((char *) helper.stream.data)) { char *this_sql = (char *) helper.stream.data; char *next = NULL; From 40fff624dfa88e4fea415055bd8f1dc2790b5aa2 Mon Sep 17 00:00:00 2001 From: William King Date: Wed, 2 May 2012 12:55:34 -0700 Subject: [PATCH 0074/1057] Some sip notify events don't have a content type, such as notifies that only update the caller id info of a call. --- src/mod/endpoints/mod_sofia/sofia.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7ec6969a92..1dd6646a32 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -469,7 +469,8 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, if (switch_event_create(&s_event, SWITCH_EVENT_NOTIFY_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event", sip->sip_event->o_type); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "pl_data", sip->sip_payload ? sip->sip_payload->pl_data : ""); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "sip_content_type", sip->sip_content_type->c_type); + if ( sip->sip_content_type != NULL ) + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "sip_content_type", sip->sip_content_type->c_type); switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", sofia_private->gateway->profile->sip_port); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "module_name", "mod_sofia"); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", sofia_private->gateway->profile->name); From f28ba547dfbf3d603e09ba6947227e2056e852bd Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 3 May 2012 10:56:37 +0200 Subject: [PATCH 0075/1057] gsmopen: fix FS-4150 , deleted a spurious new_inbound_channel(), checked all gsmopen->fs->sip machinery, then I got problems with audio(only in gsmopen->fs->sip not the reverse): I was baffled by a snom bug for a week, then I tested with Xlite and worked, so I grow suspicious, I updated snom320 firmware and worked. Hate those things --- .../mod_gsmopen/gsmopen_protocol.cpp | 16 ++-- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 89 ++++++++++++++----- 2 files changed, 70 insertions(+), 35 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 33b06c82d6..2838bb1388 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1093,9 +1093,9 @@ read: DEBUGA_PBX("just sent GSMOPEN_CONTROL_ANSWER\n", GSMOPEN_P_LOG); } } else { + tech_pvt->interface_state = GSMOPEN_STATE_UP; + DEBUGA_PBX("just interface_state UP\n", GSMOPEN_P_LOG); } - //tech_pvt->interface_state = GSMOPEN_STATE_UP; - //DEBUGA_PBX("just interface_state UP\n", GSMOPEN_P_LOG); } if ((strcmp(tech_pvt->line_array.result[i], tech_pvt->at_call_calling) == 0)) { @@ -2528,7 +2528,6 @@ int gsmopen_answer(private_t *tech_pvt) DEBUGA_PBX("call answered\n", GSMOPEN_P_LOG); res = 0; - new_inbound_channel(tech_pvt); if (tech_pvt->owner) { DEBUGA_PBX("going to send GSMOPEN_STATE_UP\n", GSMOPEN_P_LOG); ast_setstate(tech_pvt->owner, GSMOPEN_STATE_UP); @@ -2549,13 +2548,10 @@ int gsmopen_ring(private_t *tech_pvt) switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - if (option_debug) { - //DEBUGA_PBX("ENTERING FUNC\n", GSMOPEN_P_LOG); - } - session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { switch_core_session_rwunlock(session); + //DEBUGA_PBX("got session, let's exit\n", GSMOPEN_P_LOG); return 0; } @@ -2570,8 +2566,9 @@ int gsmopen_ring(private_t *tech_pvt) switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING); if (channel) { switch_channel_mark_ring_ready(channel); + DEBUGA_GSMOPEN("switch_channel_mark_ring_ready(channel);\n", GSMOPEN_P_LOG); } else { - ERRORA("no session\n", GSMOPEN_P_LOG); + ERRORA("no channel\n", GSMOPEN_P_LOG); } switch_core_session_rwunlock(session); } else { @@ -2579,9 +2576,6 @@ int gsmopen_ring(private_t *tech_pvt) } - if (option_debug) { - DEBUGA_PBX("EXITING FUNC\n", GSMOPEN_P_LOG); - } return res; } diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 98a85765e5..2e7d950436 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -296,7 +296,9 @@ switch_status_t gsmopen_tech_init(private_t *tech_pvt, switch_core_session_t *se switch_core_timer_sync(&tech_pvt->timer_write); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_HANGUP); + switch_mutex_unlock(tech_pvt->flag_mutex); DEBUGA_GSMOPEN("gsmopen_codec SUCCESS\n", GSMOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; } @@ -474,7 +476,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session) channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); //ERRORA("%s CHANNEL INIT\n", GSMOPEN_P_LOG, tech_pvt->name); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); + switch_mutex_unlock(tech_pvt->flag_mutex); /* Move channel's state machine to ROUTING. This means the call is trying to get from the initial start where the call because, to the point @@ -549,9 +553,11 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) } DEBUGA_GSMOPEN("%s CHANNEL HANGUP\n", GSMOPEN_P_LOG, tech_pvt->name); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); switch_set_flag(tech_pvt, TFLAG_HANGUP); + switch_mutex_unlock(tech_pvt->flag_mutex); gsmopen_hangup(tech_pvt); @@ -621,18 +627,18 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch (sig) { case SWITCH_SIG_KILL: DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_SIG_KILL\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); - //switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); switch_set_flag(tech_pvt, TFLAG_HANGUP); - //switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); break; case SWITCH_SIG_BREAK: DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_SIG_BREAK\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); //switch_set_flag(tech_pvt, TFLAG_BREAK); - //switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_BREAK); - //switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); break; default: break; @@ -728,7 +734,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch samples = 320; memcpy(tech_pvt->read_frame.data, buffer2, 320); } else { - DEBUGA_GSMOPEN("read less than 320, samples=%d\n", GSMOPEN_P_LOG, samples); + if (samples != 0) { + DEBUGA_GSMOPEN("read less than 320, samples=%d\n", GSMOPEN_P_LOG, samples); + } if (tech_pvt->buffer2_full) { memcpy(tech_pvt->read_frame.data, tech_pvt->buffer2, 320); tech_pvt->buffer2_full = 0; @@ -744,10 +752,14 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch *frame = &tech_pvt->read_frame; + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_VOICE); + switch_mutex_unlock(tech_pvt->flag_mutex); if (samples != 320) { - DEBUGA_GSMOPEN("samples=%d, goto cng\n", GSMOPEN_P_LOG, samples); + if (samples != 0) { + DEBUGA_GSMOPEN("samples=%d, goto cng\n", GSMOPEN_P_LOG, samples); + } goto cng; } @@ -770,15 +782,17 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch switch_channel_queue_dtmf(channel, &dtmf); p++; } - NOTICA("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", GSMOPEN_P_LOG, digit_str, (unsigned int) new_dtmf_timestamp, + DEBUGA_GSMOPEN("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", GSMOPEN_P_LOG, digit_str, (unsigned int) new_dtmf_timestamp, (unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp)); tech_pvt->old_dtmf_timestamp = new_dtmf_timestamp; } } while (switch_test_flag(tech_pvt, TFLAG_IO)) { if (switch_test_flag(tech_pvt, TFLAG_BREAK)) { + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_BREAK); - DEBUGA_GSMOPEN("CHANNEL READ FRAME goto CNG\n", GSMOPEN_P_LOG); + switch_mutex_unlock(tech_pvt->flag_mutex); + DEBUGA_GSMOPEN("BREAK: CHANNEL READ FRAME goto CNG\n", GSMOPEN_P_LOG); goto cng; } @@ -788,7 +802,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) { + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_VOICE); + switch_mutex_unlock(tech_pvt->flag_mutex); if (!tech_pvt->read_frame.datalen) { DEBUGA_GSMOPEN("CHANNEL READ CONTINUE\n", GSMOPEN_P_LOG); continue; @@ -799,11 +815,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch switch_swap_linear((int16_t *) (*frame)->data, (int) (*frame)->datalen / 2); } #endif - //WARNINGA("HERE\n", GSMOPEN_P_LOG); + //DEBUGA_GSMOPEN("HERE\n", GSMOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; } - WARNINGA("HERE\n", GSMOPEN_P_LOG); DEBUGA_GSMOPEN("CHANNEL READ no TFLAG_VOICE\n", GSMOPEN_P_LOG); return SWITCH_STATUS_FALSE; @@ -874,20 +889,23 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) switch_assert(tech_pvt != NULL); //ERRORA("%s CHANNEL INIT\n", GSMOPEN_P_LOG, tech_pvt->name); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); + switch_mutex_unlock(tech_pvt->flag_mutex); + gsmopen_serial_answer(tech_pvt); - /* Move channel's state machine to ROUTING. This means the call is trying - to get from the initial start where the call because, to the point - where a destination has been identified. If the channel is simply - left in the initial state, nothing will happen. */ - switch_channel_set_state(channel, CS_ROUTING); switch_mutex_lock(globals.mutex); globals.calls++; switch_mutex_unlock(globals.mutex); DEBUGA_GSMOPEN("%s CHANNEL ANSWER %s\n", GSMOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); + + if (channel) { + switch_channel_mark_answered(channel); + } + DEBUGA_GSMOPEN("ANSWERED! \n", GSMOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; @@ -907,8 +925,21 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_ANSWER: { - DEBUGA_GSMOPEN("MSG_ID=%d, TO BE ANSWERED!\n", GSMOPEN_P_LOG, msg->message_id); - channel_answer_channel(session); + DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_MESSAGE_INDICATE_ANSWER\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); + if(tech_pvt->interface_state != GSMOPEN_STATE_UP && tech_pvt->phone_callflow != CALLFLOW_CALL_ACTIVE){ + DEBUGA_GSMOPEN("MSG_ID=%d, TO BE ANSWERED!\n", GSMOPEN_P_LOG, msg->message_id); + channel_answer_channel(session); + } + } + break; + + case SWITCH_MESSAGE_INDICATE_PROGRESS: + { + DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_MESSAGE_INDICATE_PROGRESS\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); + if(tech_pvt->interface_state != GSMOPEN_STATE_UP && tech_pvt->phone_callflow != CALLFLOW_CALL_ACTIVE){ + DEBUGA_GSMOPEN("MSG_ID=%d, TO BE ANSWERED!\n", GSMOPEN_P_LOG, msg->message_id); + channel_answer_channel(session); + } } break; case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC: @@ -919,9 +950,20 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s break; + case SWITCH_MESSAGE_INDICATE_TRANSFER: + DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_MESSAGE_INDICATE_TRANSFER\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); + break; + case SWITCH_MESSAGE_INDICATE_BRIDGE: + DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_MESSAGE_INDICATE_BRIDGE\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); + break; + case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY: + DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); + break; default: { - DEBUGA_GSMOPEN("MSG_ID=%d\n", GSMOPEN_P_LOG, msg->message_id); + if(msg->message_id != SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC && msg->message_id != SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE){ + DEBUGA_GSMOPEN("MSG_ID=%d\n", GSMOPEN_P_LOG, msg->message_id); + } } break; } @@ -1089,7 +1131,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_profile = tech_pvt->caller_profile; caller_profile->destination_number = rdest; + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_OUTBOUND); + switch_mutex_unlock(tech_pvt->flag_mutex); switch_channel_set_state(channel, CS_INIT); gsmopen_call(tech_pvt, rdest, 30); switch_mutex_unlock(globals.mutex); @@ -2029,11 +2073,8 @@ int new_inbound_channel(private_t *tech_pvt) return 0; } } - if (channel) { - //switch_channel_mark_answered(channel); - } - DEBUGA_GSMOPEN("new_inbound_channel\n", GSMOPEN_P_LOG); + DEBUGA_GSMOPEN("EXITING new_inbound_channel\n", GSMOPEN_P_LOG); return 0; } @@ -2727,7 +2768,7 @@ void *gsmopen_do_gsmopenapi_thread_func(void *obj) //FIXME } } else if (tech_pvt->controldevprotocol != PROTOCOL_NO_SERIAL && tech_pvt->interface_state == GSMOPEN_STATE_DIALING) { - WARNINGA("WE'RE DIALING, let's take the earlymedia\n", GSMOPEN_P_LOG); + DEBUGA_GSMOPEN("WE'RE DIALING, let's take the earlymedia\n", GSMOPEN_P_LOG); tech_pvt->interface_state = CALLFLOW_STATUS_EARLYMEDIA; remote_party_is_early_media(tech_pvt); //new_inbound_channel(tech_pvt); @@ -2736,7 +2777,7 @@ void *gsmopen_do_gsmopenapi_thread_func(void *obj) //FIXME } } else if (tech_pvt->interface_state == CALLFLOW_CALL_REMOTEANSWER) { - WARNINGA("REMOTE PARTY ANSWERED\n", GSMOPEN_P_LOG); + DEBUGA_GSMOPEN("REMOTE PARTY ANSWERED\n", GSMOPEN_P_LOG); outbound_channel_answered(tech_pvt); //new_inbound_channel(tech_pvt); //FIXME if (!gsmopen_new(p, AST_STATE_RING, tech_pvt->context)) { From 2431e0f235df4ecda5979b62b22914840d10429e Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 3 May 2012 10:58:37 +0200 Subject: [PATCH 0076/1057] gsmopen: indented --- .../mod_gsmopen/gsmopen_protocol.cpp | 350 +++++++++--------- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 40 +- 2 files changed, 188 insertions(+), 202 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 2838bb1388..a586c7658f 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1,7 +1,7 @@ #include "gsmopen.h" #ifdef WIN32 #include "win_iconv.c" -#endif// WIN32 +#endif // WIN32 #define WANT_GSMLIB #ifdef WANT_GSMLIB @@ -17,7 +17,7 @@ using namespace std; using namespace gsmlib; -#endif// WANT_GSMLIB +#endif // WANT_GSMLIB extern int running; //FIXME @@ -154,7 +154,7 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) char trash[4096]; res = tech_pvt->serialPort_serial_control->Read(trash, 4096); - if (res){ + if (res) { DEBUGA_GSMOPEN("READ %d on serialport init\n", GSMOPEN_P_LOG, res); } @@ -402,8 +402,7 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) WARNINGA("AT+CSMP do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); } } - -#else// WANT_GSMLIB +#else // WANT_GSMLIB res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); if (res) { @@ -422,11 +421,11 @@ int gsmopen_serial_config_AT(private_t *tech_pvt) WARNINGA("AT+CSMP do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); } } -#endif// WANT_GSMLIB +#endif // WANT_GSMLIB #ifdef NOTDEF //GSMLIB? XXX - else { + else { //res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSMP=17,167,0,20"); //"flash", class 0 sms 16 bit unicode res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSMP=17,167,0,8"); //unicode, 16 bit message if (res) { @@ -566,7 +565,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us int at_ack = -1; int la_read = 0; int timeout_in_msec; - int msecs_passed=0; + int msecs_passed = 0; timeout_in_msec = (timeout_sec * 1000) + (timeout_usec ? (timeout_usec / 1000) : 0); @@ -585,16 +584,16 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us PUSHA_UNLOCKA(tech_pvt->controldev_lock); LOKKA(tech_pvt->controldev_lock); - while ((!tech_pvt->controldev_dead) && msecs_passed <= timeout_in_msec){ + while ((!tech_pvt->controldev_dead) && msecs_passed <= timeout_in_msec) { char *token_ptr; timeout.tv_sec = timeout_sec; //reset the timeout, linux modify it timeout.tv_usec = timeout_usec; //reset the timeout, linux modify it -read: + read: switch_sleep(20000); msecs_passed += 20; - if (timeout_in_msec != 100){ + if (timeout_in_msec != 100) { //ERRORA("TIMEOUT=%d, PASSED=%d\n", GSMOPEN_P_LOG, timeout_in_msec, msecs_passed); } //read_count = tech_pvt->serialPort_serial_control->Readv(tmp_answer_ptr, AT_BUFSIZ - (tmp_answer_ptr - tmp_answer), (timeout_sec * 1000) + (timeout_usec ? (timeout_usec / 1000) : 0)); @@ -603,8 +602,8 @@ read: //cicopet read_count = read(tech_pvt->controldevfd, tmp_answer_ptr, AT_BUFSIZ - (tmp_answer_ptr - tmp_answer)); if (read_count == 0) { - if(msecs_passed <= timeout_in_msec){ - goto read; + if (msecs_passed <= timeout_in_msec) { + goto read; } } if (read_count == -1) { @@ -950,7 +949,7 @@ read: DEBUGA_GSMOPEN("|%s| +CREG: Display: %d, Registration=%d\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], n, stat); if (err < 2) { DEBUGA_GSMOPEN("|%s| is not formatted as: |+CREG: xx,yy|\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); - }else{ + } else { if (stat == 0) { ERRORA ("|%s| CELLPHONE is not registered to network, consider to move it or additional antenna\n", @@ -959,7 +958,7 @@ read: tech_pvt->home_network_registered = 0; tech_pvt->roaming_registered = 0; alarm_event(tech_pvt, ALARM_NO_NETWORK_REGISTRATION, - "CELLPHONE is not registered to network, consider to move it or additional antenna"); + "CELLPHONE is not registered to network, consider to move it or additional antenna"); } else if (stat == 1) { DEBUGA_GSMOPEN("|%s| CELLPHONE is registered to the HOME network\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); tech_pvt->not_registered = 0; @@ -1015,7 +1014,6 @@ read: DEBUGA_GSMOPEN("just sent GSMOPEN_CONTROL_HANGUP\n", GSMOPEN_P_LOG); } - // //tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; //gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); @@ -1660,7 +1658,7 @@ read: iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), content2, - sizeof(content2)); + sizeof(content2)); } else { ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); @@ -1691,7 +1689,7 @@ read: -#endif// WANT_GSMLIB +#endif // WANT_GSMLIB @@ -1874,23 +1872,23 @@ int gsmopen_serial_write_AT(private_t *tech_pvt, const char *data) if (res != 1) { ERRORA("Error RE-sending (carriage return): %d %d (%s)\n", GSMOPEN_P_LOG, count, res, strerror(errno)); - ERRORA - ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", - GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->controldev_dead = 1; - //cicopet close(tech_pvt->controldevfd); - ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->running = 0; - alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); - tech_pvt->active = 0; - tech_pvt->name[0] = '\0'; + ERRORA + ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", + GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->controldev_dead = 1; + //cicopet close(tech_pvt->controldevfd); + ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->running = 0; + alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); + tech_pvt->active = 0; + tech_pvt->name[0] = '\0'; - UNLOCKA(tech_pvt->controldev_lock); - if (tech_pvt->owner) { - tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; - gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); - } - switch_sleep(1000000); + UNLOCKA(tech_pvt->controldev_lock); + if (tech_pvt->owner) { + tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; + gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); + } + switch_sleep(1000000); return -1; @@ -1978,23 +1976,23 @@ int gsmopen_serial_write_AT_noack(private_t *tech_pvt, const char *data) ERRORA("Error sending data... (%s)\n", GSMOPEN_P_LOG, strerror(errno)); UNLOCKA(tech_pvt->controldev_lock); - ERRORA - ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", - GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->controldev_dead = 1; - //cicopet close(tech_pvt->controldevfd); - ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->running = 0; - alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); - tech_pvt->active = 0; - tech_pvt->name[0] = '\0'; + ERRORA + ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", + GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->controldev_dead = 1; + //cicopet close(tech_pvt->controldevfd); + ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->running = 0; + alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); + tech_pvt->active = 0; + tech_pvt->name[0] = '\0'; - UNLOCKA(tech_pvt->controldev_lock); - if (tech_pvt->owner) { - tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; - gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); - } - switch_sleep(1000000); + UNLOCKA(tech_pvt->controldev_lock); + if (tech_pvt->owner) { + tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; + gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); + } + switch_sleep(1000000); return -1; @@ -2017,23 +2015,23 @@ int gsmopen_serial_write_AT_ack(private_t *tech_pvt, const char *data) ERRORA("Error sending data... (%s) \n", GSMOPEN_P_LOG, strerror(errno)); UNLOCKA(tech_pvt->controldev_lock); - ERRORA - ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", - GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->controldev_dead = 1; - //cicopet close(tech_pvt->controldevfd); - ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->running = 0; - alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); - tech_pvt->active = 0; - tech_pvt->name[0] = '\0'; + ERRORA + ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", + GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->controldev_dead = 1; + //cicopet close(tech_pvt->controldevfd); + ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->running = 0; + alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); + tech_pvt->active = 0; + tech_pvt->name[0] = '\0'; - UNLOCKA(tech_pvt->controldev_lock); - if (tech_pvt->owner) { - tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; - gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); - } - switch_sleep(1000000); + UNLOCKA(tech_pvt->controldev_lock); + if (tech_pvt->owner) { + tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; + gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); + } + switch_sleep(1000000); return -1; @@ -2059,23 +2057,23 @@ int gsmopen_serial_write_AT_ack_nocr_longtime(private_t *tech_pvt, const char *d ERRORA("Error sending data... (%s) \n", GSMOPEN_P_LOG, strerror(errno)); UNLOCKA(tech_pvt->controldev_lock); - ERRORA - ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", - GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->controldev_dead = 1; - //cicopet close(tech_pvt->controldevfd); - ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->running = 0; - alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); - tech_pvt->active = 0; - tech_pvt->name[0] = '\0'; + ERRORA + ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", + GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->controldev_dead = 1; + //cicopet close(tech_pvt->controldevfd); + ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->running = 0; + alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); + tech_pvt->active = 0; + tech_pvt->name[0] = '\0'; - UNLOCKA(tech_pvt->controldev_lock); - if (tech_pvt->owner) { - tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; - gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); - } - switch_sleep(1000000); + UNLOCKA(tech_pvt->controldev_lock); + if (tech_pvt->owner) { + tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; + gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); + } + switch_sleep(1000000); return -1; @@ -2101,23 +2099,23 @@ int gsmopen_serial_write_AT_expect1(private_t *tech_pvt, const char *data, const ERRORA("Error sending data... (%s) \n", GSMOPEN_P_LOG, strerror(errno)); UNLOCKA(tech_pvt->controldev_lock); - ERRORA - ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", - GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->controldev_dead = 1; - //cicopet close(tech_pvt->controldevfd); - ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); - tech_pvt->running = 0; - alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); - tech_pvt->active = 0; - tech_pvt->name[0] = '\0'; + ERRORA + ("wrote -1 bytes!!! Nenormalno! Marking this gsmopen_serial_device %s as dead, andif it is owned by a channel, hanging up. Maybe the phone is stuck, switched off, power down or battery exhausted\n", + GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->controldev_dead = 1; + //cicopet close(tech_pvt->controldevfd); + ERRORA("gsmopen_serial_monitor failed, declaring %s dead\n", GSMOPEN_P_LOG, tech_pvt->controldevice_name); + tech_pvt->running = 0; + alarm_event(tech_pvt, ALARM_FAILED_INTERFACE, "gsmopen_serial_monitor failed, declaring interface dead"); + tech_pvt->active = 0; + tech_pvt->name[0] = '\0'; - UNLOCKA(tech_pvt->controldev_lock); - if (tech_pvt->owner) { - tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; - gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); - } - switch_sleep(1000000); + UNLOCKA(tech_pvt->controldev_lock); + if (tech_pvt->owner) { + tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; + gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); + } + switch_sleep(1000000); return -1; @@ -2324,10 +2322,10 @@ int ucs2_to_utf8(private_t *tech_pvt, char *ucs2_in, char *utf8_out, size_t outb GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out); #ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else// WIN32 + iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); +#else // WIN32 iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif// WIN32 +#endif // WIN32 if (iconv_res == (size_t) -1) { DEBUGA_GSMOPEN("2 ciao in=%s, inleft=%d, out=%s, outleft=%d, converted=%s, utf8_out=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out); @@ -2343,6 +2341,7 @@ int ucs2_to_utf8(private_t *tech_pvt, char *ucs2_in, char *utf8_out, size_t outb //#endif //WIN32 return 0; } + int utf8_to_iso_8859_1(private_t *tech_pvt, char *utf8_in, size_t inbytesleft, char *iso_8859_1_out, size_t outbytesleft) { /* cicopet */ @@ -2365,10 +2364,10 @@ int utf8_to_iso_8859_1(private_t *tech_pvt, char *utf8_in, size_t inbytesleft, c DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, iso_8859_1_out=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, iso_8859_1_out); #ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else// WIN32 + iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); +#else // WIN32 iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif// WIN32 +#endif // WIN32 if (iconv_res == (size_t) -1) { ERRORA("error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno); return -1; @@ -2420,10 +2419,10 @@ int iso_8859_1_to_utf8(private_t *tech_pvt, char *iso_8859_1_in, char *utf8_out, inbytesleft = strlen(iso_8859_1_in) * 2; #ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else// WIN32 + iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); +#else // WIN32 iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif// WIN32 +#endif // WIN32 if (iconv_res == (size_t) -1) { DEBUGA_GSMOPEN("ciao in=%s, inleft=%d, out=%s, outleft=%d, utf8_out=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_out); @@ -2468,10 +2467,10 @@ int utf8_to_ucs2(private_t *tech_pvt, char *utf8_in, size_t inbytesleft, char *u DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, converted=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, converted); #ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else// WIN32 + iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); +#else // WIN32 iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif// WIN32 +#endif // WIN32 if (iconv_res == (size_t) -1) { ERRORA("error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno); return -1; @@ -2659,7 +2658,8 @@ int gsmopen_senddigit(private_t *tech_pvt, char digit) sprintf(at_command, "%s=1,%c", tech_pvt->at_send_dtmf, digit); res = gsmopen_serial_write_AT_ack(tech_pvt, at_command); if (res) { - DEBUGA_GSMOPEN("XXX answer (OK) takes long to come, goes into timeout. command used: '%s=1,%c'\n", GSMOPEN_P_LOG, tech_pvt->at_send_dtmf, digit); + DEBUGA_GSMOPEN("XXX answer (OK) takes long to come, goes into timeout. command used: '%s=1,%c'\n", GSMOPEN_P_LOG, tech_pvt->at_send_dtmf, + digit); } } @@ -2707,12 +2707,12 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) if (err) { ERRORA("AT+CMGF=1 (set message sending to TEXT (as opposed to PDU) do not got OK from the phone\n", GSMOPEN_P_LOG); } -#else// WANT_GSMLIB +#else // WANT_GSMLIB err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); if (err) { ERRORA("AT+CMGF=0 (set message sending to TEXT (as opposed to PDU) do not got OK from the phone\n", GSMOPEN_P_LOG); } -#endif// WANT_GSMLIB +#endif // WANT_GSMLIB if (tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0) { @@ -2720,94 +2720,81 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) SMSMessageRef smsMessage; memset(mesg_test, '\0', sizeof(mesg_test)); - sprintf(mesg_test,":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 + sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 //sprintf(mesg_test,":) ciao belè èéàòìù"); //text=mesg_test; utf8_to_iso_8859_1(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); smsMessage = new SMSSubmitMessage(smscommand, dest); string pdu = smsMessage->encode(); - strncpy(pdu2, pdu.c_str(), sizeof(pdu2)-1); + strncpy(pdu2, pdu.c_str(), sizeof(pdu2) - 1); memset(smscommand, '\0', sizeof(smscommand)); pdulenght = pdu.length() / 2 - 1; - sprintf(smscommand, "AT+CMGS=%d", pdulenght); + sprintf(smscommand, "AT+CMGS=%d", pdulenght); #ifdef NOTDEF -*** 9. How to support unicode? + ***9. How to support unicode ? You need 6 steps : 1. set datacodingschema to DCS_SIXTEEN_BIT_ALPHABET 2. set your locale correctly, for example + , my locale, china.setlocale(LC_ALL, "chs"); -You need 6 steps: + 3. translate MBCS(multiple byte character set) string to unicode string.wchar_t wstr[1000]; + memset(wstr, 0, 2000); + mbstowcs(wstr, data.c_str(), data.length()); -1. set datacodingschema to DCS_SIXTEEN_BIT_ALPHABET + 4. get unicode string length. int wcs_len = wcslen(wstr); -2. set your locale correctly, for example, my locale, china. - setlocale(LC_ALL, "chs"); + 5. change unicode string to net order. for (int i = 0; i < wcs_len; i++) + wstr[i] = htons(wstr[i]); -3. translate MBCS(multiple byte character set) string to unicode string. - wchar_t wstr[ 1000 ]; - memset(wstr, 0, 2000); - mbstowcs(wstr, data.c_str(), data.length()); + 6. put unicode string into pdu.char content2[1000]; + SMSMessageRef sms; + //MessageType messagetype; + //Address servicecentreaddress; + //Timestamp servicecentretimestamp; + //Address sender_recipient_address; -4. get unicode string length. - int wcs_len = wcslen(wstr); + sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大 -5. change unicode string to net order. - for (int i = 0; i < wcs_len; i++) - wstr[ i ] = htons(wstr[ i ]); + DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str()); -6. put unicode string into pdu. - + memset(content2, '\0', sizeof(content2)); + if (sms->dataCodingScheme().getAlphabet() == DCS_DEFAULT_ALPHABET) { + iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); + } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { + ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), content2, + sizeof(content2)); + } else { + ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); - char content2[1000]; - SMSMessageRef sms; - //MessageType messagetype; - //Address servicecentreaddress; - //Timestamp servicecentretimestamp; - //Address sender_recipient_address; - - sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大 - - DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str()); - - memset(content2, '\0', sizeof(content2)); - if (sms->dataCodingScheme().getAlphabet() == DCS_DEFAULT_ALPHABET) { - iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); - } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { - ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), content2, - sizeof(content2)); - } else { - ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); - - } - DEBUGA_GSMOPEN("dataCodingScheme=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); - DEBUGA_GSMOPEN("dataCodingScheme=%s\n", GSMOPEN_P_LOG, sms->dataCodingScheme().toString().c_str()); - DEBUGA_GSMOPEN("address=%s\n", GSMOPEN_P_LOG, sms->address().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreAddress=%s\n", GSMOPEN_P_LOG, sms->serviceCentreAddress().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreTimestamp=%s\n", GSMOPEN_P_LOG, sms->serviceCentreTimestamp().toString().c_str()); - DEBUGA_GSMOPEN("messageType=%d\n", GSMOPEN_P_LOG, sms->messageType()); - DEBUGA_GSMOPEN("userData= |||%s|||\n", GSMOPEN_P_LOG, content2); + } + DEBUGA_GSMOPEN("dataCodingScheme=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); + DEBUGA_GSMOPEN("dataCodingScheme=%s\n", GSMOPEN_P_LOG, sms->dataCodingScheme().toString().c_str()); + DEBUGA_GSMOPEN("address=%s\n", GSMOPEN_P_LOG, sms->address().toString().c_str()); + DEBUGA_GSMOPEN("serviceCentreAddress=%s\n", GSMOPEN_P_LOG, sms->serviceCentreAddress().toString().c_str()); + DEBUGA_GSMOPEN("serviceCentreTimestamp=%s\n", GSMOPEN_P_LOG, sms->serviceCentreTimestamp().toString().c_str()); + DEBUGA_GSMOPEN("messageType=%d\n", GSMOPEN_P_LOG, sms->messageType()); + DEBUGA_GSMOPEN("userData= |||%s|||\n", GSMOPEN_P_LOG, content2); - memset(sms_body, '\0', sizeof(sms_body)); - strncpy(sms_body, content2, sizeof(sms_body)); - DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body); - strncpy(tech_pvt->sms_body, sms_body, sizeof(tech_pvt->sms_body)); - strncpy(tech_pvt->sms_sender, sms->address().toString().c_str(), sizeof(tech_pvt->sms_sender)); - strncpy(tech_pvt->sms_date, sms->serviceCentreTimestamp().toString().c_str(), sizeof(tech_pvt->sms_date)); - strncpy(tech_pvt->sms_datacodingscheme, sms->dataCodingScheme().toString().c_str(), sizeof(tech_pvt->sms_datacodingscheme)); - strncpy(tech_pvt->sms_servicecentreaddress, sms->serviceCentreAddress().toString().c_str(), - sizeof(tech_pvt->sms_servicecentreaddress)); - tech_pvt->sms_messagetype = sms->messageType(); - //messagetype = sms->messageType(); - //servicecentreaddress = sms->serviceCentreAddress(); - //servicecentretimestamp = sms->serviceCentreTimestamp(); - //sender_recipient_address = sms->address(); -#endif// NOTDEF + memset(sms_body, '\0', sizeof(sms_body)); + strncpy(sms_body, content2, sizeof(sms_body)); + DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body); + strncpy(tech_pvt->sms_body, sms_body, sizeof(tech_pvt->sms_body)); + strncpy(tech_pvt->sms_sender, sms->address().toString().c_str(), sizeof(tech_pvt->sms_sender)); + strncpy(tech_pvt->sms_date, sms->serviceCentreTimestamp().toString().c_str(), sizeof(tech_pvt->sms_date)); + strncpy(tech_pvt->sms_datacodingscheme, sms->dataCodingScheme().toString().c_str(), sizeof(tech_pvt->sms_datacodingscheme)); + strncpy(tech_pvt->sms_servicecentreaddress, sms->serviceCentreAddress().toString().c_str(), sizeof(tech_pvt->sms_servicecentreaddress)); + tech_pvt->sms_messagetype = sms->messageType(); + //messagetype = sms->messageType(); + //servicecentreaddress = sms->serviceCentreAddress(); + //servicecentretimestamp = sms->serviceCentreTimestamp(); + //sender_recipient_address = sms->address(); +#endif // NOTDEF -#else// WANT_GSMLIB +#else // WANT_GSMLIB ERRORA("tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0 && no WANT_GSMLIB\n", GSMOPEN_P_LOG); return RESULT_FAILURE; -#endif// WANT_GSMLIB +#endif // WANT_GSMLIB } else { char dest2[1048]; @@ -2857,9 +2844,9 @@ You need 6 steps: #ifndef WANT_GSMLIB memset(mesg_test, '\0', sizeof(mesg_test)); - sprintf(mesg_test,":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 + sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 //text=mesg_test; - + memset(smscommand, '\0', sizeof(smscommand)); if (tech_pvt->no_ucs2) { sprintf(smscommand, "%s", text); @@ -2869,7 +2856,7 @@ You need 6 steps: #else // WANT_GSMLIB memset(smscommand, '\0', sizeof(smscommand)); - sprintf(smscommand, "%s", pdu2); + sprintf(smscommand, "%s", pdu2); #endif // WANT_GSMLIB smscommand[strlen(smscommand)] = 0x1A; DEBUGA_GSMOPEN("smscommand len is: %d, text is:|||%s|||\n", GSMOPEN_P_LOG, (int) strlen(smscommand), smscommand); @@ -2922,13 +2909,12 @@ You need 6 steps: UNLOCKA(tech_pvt->controldev_lock); POPPA_UNLOCKA(&tech_pvt->controldev_lock); } - #ifdef NOTDEF err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); if (err) { DEBUGA_GSMOPEN("AT+CMGF=0 (set message sending to PDU (as opposed to TEXT) do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); } -#endif// NOTDEF +#endif // NOTDEF DEBUGA_GSMOPEN("FINISH\n", GSMOPEN_P_LOG); if (failed) diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 2e7d950436..917f3fccc9 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -296,9 +296,9 @@ switch_status_t gsmopen_tech_init(private_t *tech_pvt, switch_core_session_t *se switch_core_timer_sync(&tech_pvt->timer_write); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_HANGUP); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); DEBUGA_GSMOPEN("gsmopen_codec SUCCESS\n", GSMOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; } @@ -476,9 +476,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session) channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); //ERRORA("%s CHANNEL INIT\n", GSMOPEN_P_LOG, tech_pvt->name); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); /* Move channel's state machine to ROUTING. This means the call is trying to get from the initial start where the call because, to the point @@ -553,11 +553,11 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) } DEBUGA_GSMOPEN("%s CHANNEL HANGUP\n", GSMOPEN_P_LOG, tech_pvt->name); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); switch_set_flag(tech_pvt, TFLAG_HANGUP); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); gsmopen_hangup(tech_pvt); @@ -752,9 +752,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch *frame = &tech_pvt->read_frame; - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_VOICE); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); if (samples != 320) { if (samples != 0) { @@ -783,15 +783,15 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch p++; } DEBUGA_GSMOPEN("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", GSMOPEN_P_LOG, digit_str, (unsigned int) new_dtmf_timestamp, - (unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp)); + (unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp)); tech_pvt->old_dtmf_timestamp = new_dtmf_timestamp; } } while (switch_test_flag(tech_pvt, TFLAG_IO)) { if (switch_test_flag(tech_pvt, TFLAG_BREAK)) { - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_BREAK); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); DEBUGA_GSMOPEN("BREAK: CHANNEL READ FRAME goto CNG\n", GSMOPEN_P_LOG); goto cng; } @@ -802,9 +802,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) { - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_VOICE); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); if (!tech_pvt->read_frame.datalen) { DEBUGA_GSMOPEN("CHANNEL READ CONTINUE\n", GSMOPEN_P_LOG); continue; @@ -867,7 +867,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc //switch_core_timer_next(&tech_pvt->timer_write); gsmopen_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost); - if(!tech_pvt->no_sound){ + if (!tech_pvt->no_sound) { sent = tech_pvt->serialPort_serial_audio->Write((char *) frame->data, (int) (frame->datalen)); if (sent && sent != frame->datalen && sent != -1) { @@ -889,9 +889,9 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) switch_assert(tech_pvt != NULL); //ERRORA("%s CHANNEL INIT\n", GSMOPEN_P_LOG, tech_pvt->name); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); gsmopen_serial_answer(tech_pvt); @@ -926,7 +926,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s case SWITCH_MESSAGE_INDICATE_ANSWER: { DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_MESSAGE_INDICATE_ANSWER\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); - if(tech_pvt->interface_state != GSMOPEN_STATE_UP && tech_pvt->phone_callflow != CALLFLOW_CALL_ACTIVE){ + if (tech_pvt->interface_state != GSMOPEN_STATE_UP && tech_pvt->phone_callflow != CALLFLOW_CALL_ACTIVE) { DEBUGA_GSMOPEN("MSG_ID=%d, TO BE ANSWERED!\n", GSMOPEN_P_LOG, msg->message_id); channel_answer_channel(session); } @@ -936,7 +936,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s case SWITCH_MESSAGE_INDICATE_PROGRESS: { DEBUGA_GSMOPEN("%s CHANNEL got SWITCH_MESSAGE_INDICATE_PROGRESS\n", GSMOPEN_P_LOG, switch_channel_get_name(channel)); - if(tech_pvt->interface_state != GSMOPEN_STATE_UP && tech_pvt->phone_callflow != CALLFLOW_CALL_ACTIVE){ + if (tech_pvt->interface_state != GSMOPEN_STATE_UP && tech_pvt->phone_callflow != CALLFLOW_CALL_ACTIVE) { DEBUGA_GSMOPEN("MSG_ID=%d, TO BE ANSWERED!\n", GSMOPEN_P_LOG, msg->message_id); channel_answer_channel(session); } @@ -961,7 +961,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s break; default: { - if(msg->message_id != SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC && msg->message_id != SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE){ + if (msg->message_id != SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC && msg->message_id != SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE) { DEBUGA_GSMOPEN("MSG_ID=%d\n", GSMOPEN_P_LOG, msg->message_id); } } @@ -1163,7 +1163,7 @@ static switch_status_t load_config(int reload_type) SetConsoleOutputCP(65001); DEBUGA_GSMOPEN("Windows CODEPAGE Output =%d\n", GSMOPEN_P_LOG, GetConsoleOutputCP()); //let's hope to have unicode in console now. You need to use Lucida Console or, much better, Courier New font for the command prompt to show unicode -#endif// WIN32 +#endif // WIN32 NOTICA("GSMOPEN Charset Output Test 0 %s\n", GSMOPEN_P_LOG, "èéòàù"); NOTICA("GSMOPEN Charset Output Test 1 %s\n", GSMOPEN_P_LOG, "ç°§^£"); NOTICA("GSMOPEN Charset Output Test 2 %s\n", GSMOPEN_P_LOG, "новоÑти"); From e589efb17fd68d388a771108f9c1bd117bf69d97 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 3 May 2012 14:13:44 +0200 Subject: [PATCH 0077/1057] gsmopen: fix FS-4149 --- src/mod/endpoints/mod_gsmopen/gsmopen.h | 2 +- .../mod_gsmopen/gsmopen_protocol.cpp | 49 ++++++++++++++----- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index 30ed934f68..2b4c619783 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -99,9 +99,9 @@ #define PROTOCOL_FBUS2 1 #define PROTOCOL_NO_SERIAL 3 -#define AT_BUFSIZ 8192 //FIXME FIXME FIXME #define AT_MESG_MAX_LENGTH 2048 /* much more than 10 SMSs */ #define AT_MESG_MAX_LENGTH 2048 /* much more than 10 SMSs */ +#define AT_BUFSIZ AT_MESG_MAX_LENGTH //FIXME FIXME FIXME #define AT_MESG_MAX_LINES 256 /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */ #define AT_MESG_MAX_LINES 20 /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */ diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index a586c7658f..5ac4edc25a 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -557,6 +557,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us struct timeval timeout; char tmp_answer[AT_BUFSIZ]; char tmp_answer2[AT_BUFSIZ]; + char tmp_answer3[AT_BUFSIZ]; char *tmp_answer_ptr; char *last_line_ptr; int i = 0; @@ -578,13 +579,15 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us tmp_answer_ptr = tmp_answer; memset(tmp_answer, 0, sizeof(char) * AT_BUFSIZ); + memset(tmp_answer2, 0, sizeof(char) * AT_BUFSIZ); + memset(tmp_answer3, 0, sizeof(char) * AT_BUFSIZ); timeout.tv_sec = timeout_sec; timeout.tv_usec = timeout_usec; PUSHA_UNLOCKA(tech_pvt->controldev_lock); LOKKA(tech_pvt->controldev_lock); - while ((!tech_pvt->controldev_dead) && msecs_passed <= timeout_in_msec) { + while ((!tech_pvt->controldev_dead) && msecs_passed <= timeout_in_msec ) { char *token_ptr; timeout.tv_sec = timeout_sec; //reset the timeout, linux modify it timeout.tv_usec = timeout_usec; //reset the timeout, linux modify it @@ -598,6 +601,8 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us } //read_count = tech_pvt->serialPort_serial_control->Readv(tmp_answer_ptr, AT_BUFSIZ - (tmp_answer_ptr - tmp_answer), (timeout_sec * 1000) + (timeout_usec ? (timeout_usec / 1000) : 0)); read_count = tech_pvt->serialPort_serial_control->Read(tmp_answer_ptr, AT_BUFSIZ - (tmp_answer_ptr - tmp_answer)); + memset(tmp_answer3, 0, sizeof(char) * AT_BUFSIZ); + strcpy(tmp_answer3, tmp_answer_ptr); //cicopet read_count = read(tech_pvt->controldevfd, tmp_answer_ptr, AT_BUFSIZ - (tmp_answer_ptr - tmp_answer)); @@ -627,10 +632,6 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us return -1; } - if (option_debug > 90) { - //DEBUGA_GSMOPEN("1 read %d bytes, --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer_ptr); - //DEBUGA_GSMOPEN("2 read %d bytes, --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer); - } tmp_answer_ptr = tmp_answer_ptr + read_count; la_counter = 0; @@ -645,6 +646,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us GSMOPEN_P_LOG, token_ptr, tech_pvt->line_array.result[la_counter]); } la_counter++; + while ((token_ptr = strtok(NULL, "\n\r"))) { last_line_ptr = token_ptr; strncpy(tech_pvt->line_array.result[la_counter], token_ptr, AT_MESG_MAX_LENGTH); @@ -654,6 +656,14 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us GSMOPEN_P_LOG, token_ptr, tech_pvt->line_array.result[la_counter]); } la_counter++; + + if (la_counter == AT_MESG_MAX_LINES) { + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); + at_ack = AT_ERROR; + break; + } + } } else { last_line_ptr = tmp_answer; @@ -666,22 +676,34 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us } if (expected_string && !expect_crlf && !memcmp(last_line_ptr, expected_string, strlen(expected_string)) - ) { + ) { strncpy(tech_pvt->line_array.result[la_counter], last_line_ptr, AT_MESG_MAX_LENGTH); // match expected string -> accept it withtout CRLF la_counter++; - + if (la_counter == AT_MESG_MAX_LINES) { + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); + at_ack = AT_ERROR; + break; + } } /* if the last line read was not a complete line, we'll read the rest in the future */ else if (tmp_answer[strlen(tmp_answer) - 1] != '\r' && tmp_answer[strlen(tmp_answer) - 1] != '\n') la_counter--; /* let's list the complete lines read so far, without re-listing the lines that has yet been listed */ - if (option_debug > 1) { - for (i = la_read; i < la_counter; i++) - DEBUGA_GSMOPEN("Read line %d: |%s|\n", GSMOPEN_P_LOG, i, tech_pvt->line_array.result[i]); + for (i = la_read; i < la_counter; i++){ + DEBUGA_GSMOPEN("Read line %d: |%s| la_counter=%d\n", GSMOPEN_P_LOG, i, tech_pvt->line_array.result[i], la_counter); } + if (la_counter == AT_MESG_MAX_LINES) { + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); + at_ack = AT_ERROR; + break; + } + + /* let's interpret the complete lines read so far (WITHOUT looking for OK, ERROR, and EXPECTED_STRING), without re-interpreting the lines that has been yet interpreted, so we're sure we don't miss anything */ for (i = la_read; i < la_counter; i++) { @@ -1544,6 +1566,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us strncpy(tech_pvt->imsi, tech_pvt->line_array.result[i], sizeof(tech_pvt->imsi)); } } + /* if we are reading an sms message from memory, put the line into the sms buffer if the line is not "OK" or "ERROR" */ if (tech_pvt->reading_sms_msg > 1 && at_ack == -1) { int c; @@ -1706,11 +1729,13 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us if (look_for_ack && at_ack > -1) break; - if (la_counter > AT_MESG_MAX_LINES) { - ERRORA("Too many lines in result (>%d). Stopping reader.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES); + if (la_counter == AT_MESG_MAX_LINES) { + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); at_ack = AT_ERROR; break; } + } UNLOCKA(tech_pvt->controldev_lock); From a10f01f10c794c82e59470dae858a9513d4310fb Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 3 May 2012 14:15:10 +0200 Subject: [PATCH 0078/1057] gsmopen: indented --- .../mod_gsmopen/gsmopen_protocol.cpp | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 5ac4edc25a..63d2d1cad5 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -587,7 +587,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us PUSHA_UNLOCKA(tech_pvt->controldev_lock); LOKKA(tech_pvt->controldev_lock); - while ((!tech_pvt->controldev_dead) && msecs_passed <= timeout_in_msec ) { + while ((!tech_pvt->controldev_dead) && msecs_passed <= timeout_in_msec) { char *token_ptr; timeout.tv_sec = timeout_sec; //reset the timeout, linux modify it timeout.tv_usec = timeout_usec; //reset the timeout, linux modify it @@ -658,7 +658,8 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us la_counter++; if (la_counter == AT_MESG_MAX_LINES) { - ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, + AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); at_ack = AT_ERROR; break; @@ -676,12 +677,13 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us } if (expected_string && !expect_crlf && !memcmp(last_line_ptr, expected_string, strlen(expected_string)) - ) { + ) { strncpy(tech_pvt->line_array.result[la_counter], last_line_ptr, AT_MESG_MAX_LENGTH); // match expected string -> accept it withtout CRLF la_counter++; if (la_counter == AT_MESG_MAX_LINES) { - ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, + AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); at_ack = AT_ERROR; break; @@ -692,12 +694,13 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us la_counter--; /* let's list the complete lines read so far, without re-listing the lines that has yet been listed */ - for (i = la_read; i < la_counter; i++){ + for (i = la_read; i < la_counter; i++) { DEBUGA_GSMOPEN("Read line %d: |%s| la_counter=%d\n", GSMOPEN_P_LOG, i, tech_pvt->line_array.result[i], la_counter); } if (la_counter == AT_MESG_MAX_LINES) { - ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, + AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); at_ack = AT_ERROR; break; @@ -1035,7 +1038,6 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); DEBUGA_GSMOPEN("just sent GSMOPEN_CONTROL_HANGUP\n", GSMOPEN_P_LOG); } - // //tech_pvt->owner->hangupcause = GSMOPEN_CAUSE_FAILURE; //gsmopen_queue_control(tech_pvt->owner, GSMOPEN_CONTROL_HANGUP); @@ -1730,7 +1732,8 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us break; if (la_counter == AT_MESG_MAX_LINES) { - ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); + ERRORA("Too many lines in result (>%d). la_counter=%d. tech_pvt->reading_sms_msg=%d. Stop accumulating lines.\n", GSMOPEN_P_LOG, + AT_MESG_MAX_LINES, la_counter, tech_pvt->reading_sms_msg); WARNINGA("read was %d bytes, tmp_answer3= --|%s|--\n", GSMOPEN_P_LOG, read_count, tmp_answer3); at_ack = AT_ERROR; break; @@ -2766,9 +2769,9 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) memset(wstr, 0, 2000); mbstowcs(wstr, data.c_str(), data.length()); - 4. get unicode string length. int wcs_len = wcslen(wstr); + 4. get unicode string length.int wcs_len = wcslen(wstr); - 5. change unicode string to net order. for (int i = 0; i < wcs_len; i++) + 5. change unicode string to net order.for (int i = 0; i < wcs_len; i++) wstr[i] = htons(wstr[i]); 6. put unicode string into pdu.char content2[1000]; From 16662920251ace00a4c84f5c36c88992fdfe9aff Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 3 May 2012 15:22:15 +0200 Subject: [PATCH 0079/1057] gsmopen: fix FS-4181 , catch gsmlib exceptions --- src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 63d2d1cad5..40d782e7ad 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1569,6 +1569,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us } } + /* if we are reading an sms message from memory, put the line into the sms buffer if the line is not "OK" or "ERROR" */ if (tech_pvt->reading_sms_msg > 1 && at_ack == -1) { int c; @@ -1667,6 +1668,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us #ifdef WANT_GSMLIB +try{ char content2[1000]; SMSMessageRef sms; //MessageType messagetype; @@ -1712,6 +1714,10 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us //servicecentretimestamp = sms->serviceCentreTimestamp(); //sender_recipient_address = sms->address(); +} catch (GsmException &ge) + { + ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what()); + } #endif // WANT_GSMLIB @@ -2745,6 +2751,7 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) if (tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0) { #ifdef WANT_GSMLIB +try{ SMSMessageRef smsMessage; memset(mesg_test, '\0', sizeof(mesg_test)); @@ -2818,6 +2825,11 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) //servicecentretimestamp = sms->serviceCentreTimestamp(); //sender_recipient_address = sms->address(); #endif // NOTDEF +} catch (GsmException &ge) + { + ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what()); + } + #else // WANT_GSMLIB ERRORA("tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0 && no WANT_GSMLIB\n", GSMOPEN_P_LOG); From de019abd21738ac806d4325358eec217ca8078b6 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 3 May 2012 15:23:57 +0200 Subject: [PATCH 0080/1057] gsmopen: indented --- .../mod_gsmopen/gsmopen_protocol.cpp | 214 +++++++++--------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 40d782e7ad..53975b2cc1 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1668,56 +1668,56 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us #ifdef WANT_GSMLIB -try{ - char content2[1000]; - SMSMessageRef sms; - //MessageType messagetype; - //Address servicecentreaddress; - //Timestamp servicecentretimestamp; - //Address sender_recipient_address; + try { + char content2[1000]; + SMSMessageRef sms; + //MessageType messagetype; + //Address servicecentreaddress; + //Timestamp servicecentretimestamp; + //Address sender_recipient_address; - sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大 + sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大 - DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str()); + DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str()); - memset(content2, '\0', sizeof(content2)); - if (sms->dataCodingScheme().getAlphabet() == DCS_DEFAULT_ALPHABET) { - iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); - } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { - ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), content2, - sizeof(content2)); - } else { - ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); + memset(content2, '\0', sizeof(content2)); + if (sms->dataCodingScheme().getAlphabet() == DCS_DEFAULT_ALPHABET) { + iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); + } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { + ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), + content2, sizeof(content2)); + } else { + ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); + + } + DEBUGA_GSMOPEN("dataCodingScheme=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); + DEBUGA_GSMOPEN("dataCodingScheme=%s\n", GSMOPEN_P_LOG, sms->dataCodingScheme().toString().c_str()); + DEBUGA_GSMOPEN("address=%s\n", GSMOPEN_P_LOG, sms->address().toString().c_str()); + DEBUGA_GSMOPEN("serviceCentreAddress=%s\n", GSMOPEN_P_LOG, sms->serviceCentreAddress().toString().c_str()); + DEBUGA_GSMOPEN("serviceCentreTimestamp=%s\n", GSMOPEN_P_LOG, sms->serviceCentreTimestamp().toString().c_str()); + DEBUGA_GSMOPEN("messageType=%d\n", GSMOPEN_P_LOG, sms->messageType()); + DEBUGA_GSMOPEN("userData= |||%s|||\n", GSMOPEN_P_LOG, content2); + + + memset(sms_body, '\0', sizeof(sms_body)); + strncpy(sms_body, content2, sizeof(sms_body)); + DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body); + strncpy(tech_pvt->sms_body, sms_body, sizeof(tech_pvt->sms_body)); + strncpy(tech_pvt->sms_sender, sms->address().toString().c_str(), sizeof(tech_pvt->sms_sender)); + strncpy(tech_pvt->sms_date, sms->serviceCentreTimestamp().toString().c_str(), sizeof(tech_pvt->sms_date)); + strncpy(tech_pvt->sms_datacodingscheme, sms->dataCodingScheme().toString().c_str(), sizeof(tech_pvt->sms_datacodingscheme)); + strncpy(tech_pvt->sms_servicecentreaddress, sms->serviceCentreAddress().toString().c_str(), + sizeof(tech_pvt->sms_servicecentreaddress)); + tech_pvt->sms_messagetype = sms->messageType(); + //messagetype = sms->messageType(); + //servicecentreaddress = sms->serviceCentreAddress(); + //servicecentretimestamp = sms->serviceCentreTimestamp(); + //sender_recipient_address = sms->address(); } - DEBUGA_GSMOPEN("dataCodingScheme=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); - DEBUGA_GSMOPEN("dataCodingScheme=%s\n", GSMOPEN_P_LOG, sms->dataCodingScheme().toString().c_str()); - DEBUGA_GSMOPEN("address=%s\n", GSMOPEN_P_LOG, sms->address().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreAddress=%s\n", GSMOPEN_P_LOG, sms->serviceCentreAddress().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreTimestamp=%s\n", GSMOPEN_P_LOG, sms->serviceCentreTimestamp().toString().c_str()); - DEBUGA_GSMOPEN("messageType=%d\n", GSMOPEN_P_LOG, sms->messageType()); - DEBUGA_GSMOPEN("userData= |||%s|||\n", GSMOPEN_P_LOG, content2); - - - memset(sms_body, '\0', sizeof(sms_body)); - strncpy(sms_body, content2, sizeof(sms_body)); - DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body); - strncpy(tech_pvt->sms_body, sms_body, sizeof(tech_pvt->sms_body)); - strncpy(tech_pvt->sms_sender, sms->address().toString().c_str(), sizeof(tech_pvt->sms_sender)); - strncpy(tech_pvt->sms_date, sms->serviceCentreTimestamp().toString().c_str(), sizeof(tech_pvt->sms_date)); - strncpy(tech_pvt->sms_datacodingscheme, sms->dataCodingScheme().toString().c_str(), sizeof(tech_pvt->sms_datacodingscheme)); - strncpy(tech_pvt->sms_servicecentreaddress, sms->serviceCentreAddress().toString().c_str(), - sizeof(tech_pvt->sms_servicecentreaddress)); - tech_pvt->sms_messagetype = sms->messageType(); - //messagetype = sms->messageType(); - //servicecentreaddress = sms->serviceCentreAddress(); - //servicecentretimestamp = sms->serviceCentreTimestamp(); - //sender_recipient_address = sms->address(); - -} catch (GsmException &ge) - { - ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what()); - } + catch(GsmException & ge) { + ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what()); + } #endif // WANT_GSMLIB @@ -2751,84 +2751,84 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) if (tech_pvt->no_ucs2 || tech_pvt->sms_pdu_not_supported == 0) { #ifdef WANT_GSMLIB -try{ - SMSMessageRef smsMessage; + try { + SMSMessageRef smsMessage; - memset(mesg_test, '\0', sizeof(mesg_test)); - sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 - //sprintf(mesg_test,":) ciao belè èéàòìù"); - //text=mesg_test; + memset(mesg_test, '\0', sizeof(mesg_test)); + sprintf(mesg_test, ":) ciao belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大aèéàòçù"); //let's test the beauty of utf8 + //sprintf(mesg_test,":) ciao belè èéàòìù"); + //text=mesg_test; - utf8_to_iso_8859_1(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); - smsMessage = new SMSSubmitMessage(smscommand, dest); - string pdu = smsMessage->encode(); - strncpy(pdu2, pdu.c_str(), sizeof(pdu2) - 1); - memset(smscommand, '\0', sizeof(smscommand)); - pdulenght = pdu.length() / 2 - 1; - sprintf(smscommand, "AT+CMGS=%d", pdulenght); + utf8_to_iso_8859_1(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand)); + smsMessage = new SMSSubmitMessage(smscommand, dest); + string pdu = smsMessage->encode(); + strncpy(pdu2, pdu.c_str(), sizeof(pdu2) - 1); + memset(smscommand, '\0', sizeof(smscommand)); + pdulenght = pdu.length() / 2 - 1; + sprintf(smscommand, "AT+CMGS=%d", pdulenght); #ifdef NOTDEF - ***9. How to support unicode ? You need 6 steps : 1. set datacodingschema to DCS_SIXTEEN_BIT_ALPHABET 2. set your locale correctly, for example - , my locale, china.setlocale(LC_ALL, "chs"); + ***9. How to support unicode ? You need 6 steps : 1. set datacodingschema to DCS_SIXTEEN_BIT_ALPHABET 2. set your locale correctly, for example + , my locale, china.setlocale(LC_ALL, "chs"); - 3. translate MBCS(multiple byte character set) string to unicode string.wchar_t wstr[1000]; - memset(wstr, 0, 2000); - mbstowcs(wstr, data.c_str(), data.length()); + 3. translate MBCS(multiple byte character set) string to unicode string.wchar_t wstr[1000]; + memset(wstr, 0, 2000); + mbstowcs(wstr, data.c_str(), data.length()); - 4. get unicode string length.int wcs_len = wcslen(wstr); + 4. get unicode string length.int wcs_len = wcslen(wstr); - 5. change unicode string to net order.for (int i = 0; i < wcs_len; i++) - wstr[i] = htons(wstr[i]); + 5. change unicode string to net order.for (int i = 0; i < wcs_len; i++) + wstr[i] = htons(wstr[i]); - 6. put unicode string into pdu.char content2[1000]; - SMSMessageRef sms; - //MessageType messagetype; - //Address servicecentreaddress; - //Timestamp servicecentretimestamp; - //Address sender_recipient_address; + 6. put unicode string into pdu.char content2[1000]; + SMSMessageRef sms; + //MessageType messagetype; + //Address servicecentreaddress; + //Timestamp servicecentretimestamp; + //Address sender_recipient_address; - sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大 + sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новоÑти לק ר×ת ﺎﻠﺠﻤﻋﺓ 人大 - DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str()); + DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str()); - memset(content2, '\0', sizeof(content2)); - if (sms->dataCodingScheme().getAlphabet() == DCS_DEFAULT_ALPHABET) { - iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); - } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { - ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), content2, - sizeof(content2)); - } else { - ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); + memset(content2, '\0', sizeof(content2)); + if (sms->dataCodingScheme().getAlphabet() == DCS_DEFAULT_ALPHABET) { + iso_8859_1_to_utf8(tech_pvt, (char *) sms->userData().c_str(), content2, sizeof(content2)); + } else if (sms->dataCodingScheme().getAlphabet() == DCS_SIXTEEN_BIT_ALPHABET) { + ucs2_to_utf8(tech_pvt, (char *) bufToHex((unsigned char *) sms->userData().data(), sms->userData().length()).c_str(), content2, + sizeof(content2)); + } else { + ERRORA("dataCodingScheme not supported=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); - } - DEBUGA_GSMOPEN("dataCodingScheme=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); - DEBUGA_GSMOPEN("dataCodingScheme=%s\n", GSMOPEN_P_LOG, sms->dataCodingScheme().toString().c_str()); - DEBUGA_GSMOPEN("address=%s\n", GSMOPEN_P_LOG, sms->address().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreAddress=%s\n", GSMOPEN_P_LOG, sms->serviceCentreAddress().toString().c_str()); - DEBUGA_GSMOPEN("serviceCentreTimestamp=%s\n", GSMOPEN_P_LOG, sms->serviceCentreTimestamp().toString().c_str()); - DEBUGA_GSMOPEN("messageType=%d\n", GSMOPEN_P_LOG, sms->messageType()); - DEBUGA_GSMOPEN("userData= |||%s|||\n", GSMOPEN_P_LOG, content2); + } + DEBUGA_GSMOPEN("dataCodingScheme=%d\n", GSMOPEN_P_LOG, sms->dataCodingScheme().getAlphabet()); + DEBUGA_GSMOPEN("dataCodingScheme=%s\n", GSMOPEN_P_LOG, sms->dataCodingScheme().toString().c_str()); + DEBUGA_GSMOPEN("address=%s\n", GSMOPEN_P_LOG, sms->address().toString().c_str()); + DEBUGA_GSMOPEN("serviceCentreAddress=%s\n", GSMOPEN_P_LOG, sms->serviceCentreAddress().toString().c_str()); + DEBUGA_GSMOPEN("serviceCentreTimestamp=%s\n", GSMOPEN_P_LOG, sms->serviceCentreTimestamp().toString().c_str()); + DEBUGA_GSMOPEN("messageType=%d\n", GSMOPEN_P_LOG, sms->messageType()); + DEBUGA_GSMOPEN("userData= |||%s|||\n", GSMOPEN_P_LOG, content2); - memset(sms_body, '\0', sizeof(sms_body)); - strncpy(sms_body, content2, sizeof(sms_body)); - DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body); - strncpy(tech_pvt->sms_body, sms_body, sizeof(tech_pvt->sms_body)); - strncpy(tech_pvt->sms_sender, sms->address().toString().c_str(), sizeof(tech_pvt->sms_sender)); - strncpy(tech_pvt->sms_date, sms->serviceCentreTimestamp().toString().c_str(), sizeof(tech_pvt->sms_date)); - strncpy(tech_pvt->sms_datacodingscheme, sms->dataCodingScheme().toString().c_str(), sizeof(tech_pvt->sms_datacodingscheme)); - strncpy(tech_pvt->sms_servicecentreaddress, sms->serviceCentreAddress().toString().c_str(), sizeof(tech_pvt->sms_servicecentreaddress)); - tech_pvt->sms_messagetype = sms->messageType(); - //messagetype = sms->messageType(); - //servicecentreaddress = sms->serviceCentreAddress(); - //servicecentretimestamp = sms->serviceCentreTimestamp(); - //sender_recipient_address = sms->address(); + memset(sms_body, '\0', sizeof(sms_body)); + strncpy(sms_body, content2, sizeof(sms_body)); + DEBUGA_GSMOPEN("body=%s\n", GSMOPEN_P_LOG, sms_body); + strncpy(tech_pvt->sms_body, sms_body, sizeof(tech_pvt->sms_body)); + strncpy(tech_pvt->sms_sender, sms->address().toString().c_str(), sizeof(tech_pvt->sms_sender)); + strncpy(tech_pvt->sms_date, sms->serviceCentreTimestamp().toString().c_str(), sizeof(tech_pvt->sms_date)); + strncpy(tech_pvt->sms_datacodingscheme, sms->dataCodingScheme().toString().c_str(), sizeof(tech_pvt->sms_datacodingscheme)); + strncpy(tech_pvt->sms_servicecentreaddress, sms->serviceCentreAddress().toString().c_str(), sizeof(tech_pvt->sms_servicecentreaddress)); + tech_pvt->sms_messagetype = sms->messageType(); + //messagetype = sms->messageType(); + //servicecentreaddress = sms->serviceCentreAddress(); + //servicecentretimestamp = sms->serviceCentreTimestamp(); + //sender_recipient_address = sms->address(); #endif // NOTDEF -} catch (GsmException &ge) - { - ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what()); - } + } + catch(GsmException & ge) { + ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what()); + } #else // WANT_GSMLIB From 086cbf1bfcd00cccb5d0b9e53390eb490d0c78d0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 3 May 2012 13:17:05 -0500 Subject: [PATCH 0081/1057] FS-4176 --resolve --- .../mod_conference/mod_conference.c | 93 ++++++++++++++++++- 1 file changed, 89 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 89182fa6de..a46437aab3 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -335,6 +335,7 @@ typedef struct conference_obj { switch_time_t end_time; char *log_dir; struct vid_helper vh[2]; + struct vid_helper mh; } conference_obj_t; /* Relationship with another member */ @@ -477,7 +478,8 @@ static switch_status_t chat_send(switch_event_t *message_event); static void launch_conference_record_thread(conference_obj_t *conference, char *path); -static void launch_conference_video_bridge_thread(conference_member_t *member_a, conference_member_t *member_b); +static int launch_conference_video_bridge_thread(conference_member_t *member_a, conference_member_t *member_b); +static void launch_conference_video_mirror_thread(conference_member_t *member_a); typedef switch_status_t (*conf_api_args_cmd_t) (conference_obj_t *, switch_stream_handle_t *, int, char **); typedef switch_status_t (*conf_api_member_cmd_t) (conference_member_t *, switch_stream_handle_t *, void *); @@ -1221,6 +1223,56 @@ static void *SWITCH_THREAD_FUNC conference_video_bridge_thread_run(switch_thread } + +static void *SWITCH_THREAD_FUNC conference_video_mirror_thread_run(switch_thread_t *thread, void *obj) +{ + struct vid_helper *vh = obj; + switch_core_session_t *session_a = vh->member_a->session; + switch_channel_t *channel_a = switch_core_session_get_channel(session_a); + switch_status_t status; + switch_frame_t *read_frame; + conference_obj_t *conference = vh->member_a->conference; + + switch_thread_rwlock_rdlock(conference->rwlock); + switch_thread_rwlock_rdlock(vh->member_a->rwlock); + + /* Acquire locks for both sessions so the helper object and member structures don't get destroyed before we exit */ + switch_core_session_read_lock(session_a); + + vh->up = 1; + while (vh->up > 0 && switch_test_flag(vh->member_a, MFLAG_RUNNING) && + switch_channel_ready(channel_a)) { + + if (vh->up == 1) { + status = switch_core_session_read_video_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, 0); + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + if (!switch_test_flag(read_frame, SFF_CNG)) { + if (switch_core_session_write_video_frame(session_a, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + break; + } + } + } else { + switch_yield(100000); + } + } + + + switch_thread_rwlock_unlock(vh->member_a->rwlock); + + switch_core_session_rwunlock(session_a); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s video mirror thread ended.\n", switch_channel_get_name(channel_a)); + + switch_thread_rwlock_unlock(conference->rwlock); + + vh->up = 0; + return NULL; +} + + /* Main video monitor thread (1 per distinct conference room) */ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thread, void *obj) { @@ -1523,8 +1575,22 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v switch_channel_ready(switch_core_session_get_channel(video_bridge_members[0]->session)) && switch_channel_ready(switch_core_session_get_channel(video_bridge_members[1]->session)) ) { + conference->mh.up = 2; + if (launch_conference_video_bridge_thread(video_bridge_members[0], video_bridge_members[1])) { + conference->mh.up = 1; + } else { + conference->mh.up = -1; + } + } else if (conference->vh[0].up == 0 && + conference->vh[1].up == 0 && + conference->mh.up == 0 && + video_bridge_members[0] && + !video_bridge_members[1] && + switch_test_flag(video_bridge_members[0], MFLAG_RUNNING) && + switch_channel_ready(switch_core_session_get_channel(video_bridge_members[0]->session)) + ) { - launch_conference_video_bridge_thread(video_bridge_members[0], video_bridge_members[1]); + launch_conference_video_mirror_thread(video_bridge_members[0]); } } @@ -6764,11 +6830,11 @@ static void launch_conference_video_thread(conference_obj_t *conference) } /* Create a video thread for the conference and launch it */ -static void launch_conference_video_bridge_thread(conference_member_t *member_a, conference_member_t *member_b) +static int launch_conference_video_bridge_thread(conference_member_t *member_a, conference_member_t *member_b) { conference_obj_t *conference = member_a->conference; switch_memory_pool_t *pool = conference->pool; - int sanity = 10000; + int sanity = 10000, r = 0; memset(conference->vh, 0, sizeof(conference->vh)); @@ -6787,14 +6853,33 @@ static void launch_conference_video_bridge_thread(conference_member_t *member_a, if (conference->vh[0].up == 1 && conference->vh[1].up != 1) { conference->vh[0].up = -1; + r = -1; } if (conference->vh[1].up == 1 && conference->vh[0].up != 1) { conference->vh[1].up = -1; + r = -1; } + + return r; } + + +/* Create a video thread for the conference and launch it */ +static void launch_conference_video_mirror_thread(conference_member_t *member_a) +{ + conference_obj_t *conference = member_a->conference; + switch_memory_pool_t *pool = conference->pool; + + memset(&conference->mh, 0, sizeof(conference->mh)); + + conference->mh.member_a = member_a; + + launch_thread_detached(conference_video_mirror_thread_run, pool, &conference->mh); +} + static void launch_conference_record_thread(conference_obj_t *conference, char *path) { switch_thread_t *thread; From 163fffb3e8c25e650047d4e914f92a516ed9b84f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 3 May 2012 13:13:48 -0500 Subject: [PATCH 0082/1057] fix issue with threaded ivrd, forking is back by default but threaded can be chosen with -t; in both modes the fd number is not passed as the first arg to the program but in threaded mode the stdin will no longer be mapped to the socket you will have to get the first command line arg instead of fileno stdin --- libs/esl/ivrd.c | 97 +++++++++++++++++++++++++++++++------- libs/esl/src/esl.c | 59 ++++++++++++++++++++++- libs/esl/src/include/esl.h | 4 +- libs/esl/testserver.c | 2 +- 4 files changed, 141 insertions(+), 21 deletions(-) diff --git a/libs/esl/ivrd.c b/libs/esl/ivrd.c index 3032a81cd3..2e2e6b2fa4 100644 --- a/libs/esl/ivrd.c +++ b/libs/esl/ivrd.c @@ -36,11 +36,56 @@ #include #include +static void my_forking_callback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr) +{ + esl_handle_t handle = {{0}}; + char path_buffer[1024] = { 0 }; + const char *path; + char arg[64] = { 0 }; + + if (fork()) { + close(client_sock); + return; + } + + if (esl_attach_handle(&handle, client_sock, addr) != ESL_SUCCESS || !handle.info_event) { + esl_log(ESL_LOG_ERROR, "Socket Error\n"); + exit(0); + } + + if (!(path = esl_event_get_header(handle.info_event, "variable_ivr_path"))) { + esl_disconnect(&handle); + esl_log(ESL_LOG_ERROR, "Missing ivr_path param!\n"); + exit(0); + } + + snprintf(arg, sizeof(arg), "%d", client_sock); + + strncpy(path_buffer, path, sizeof(path_buffer) - 1); + + /* hotwire the socket to STDIN/STDOUT */ + /* hotwire the socket to STDIN/STDOUT */ + if (!(dup2(client_sock, STDIN_FILENO)) && !(dup2(client_sock, STDOUT_FILENO))){ + esl_disconnect(&handle); + esl_log(ESL_LOG_ERROR, "Socket Error hotwiring socket to STDIN/STDOUT!\n"); + return; + } + + /* close the handle but leak the socket on purpose cos the child will need it open */ + handle.sock = -1; + esl_disconnect(&handle); + + execl(path_buffer, path_buffer, arg, (char *)NULL); + close(client_sock); + exit(0); +} + static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr) { esl_handle_t handle = {{0}}; const char *path; - + char path_buffer[1024] = { 0 }; + if (esl_attach_handle(&handle, client_sock, addr) != ESL_SUCCESS || !handle.info_event) { close(client_sock); esl_log(ESL_LOG_ERROR, "Socket Error\n"); @@ -53,16 +98,13 @@ static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struc return; } - /* hotwire the socket to STDIN/STDOUT */ - if (!(dup2(client_sock, STDIN_FILENO)) && !(dup2(client_sock, STDOUT_FILENO))){ - esl_disconnect(&handle); - esl_log(ESL_LOG_ERROR, "Socket Error hotwiring socket to STDIN/STDOUT!\n"); - return; - } + snprintf(path_buffer, sizeof(path_buffer), "%s %d", path, client_sock); - if(system(path)) { + + if (system(path_buffer)) { esl_log(ESL_LOG_ERROR, "System Call Failed! [%s]\n", strerror(errno)); } + esl_disconnect(&handle); } @@ -71,24 +113,43 @@ int main(int argc, char *argv[]) { int i; char *ip = NULL; - int port = 0; + int port = 0, thread = 0; - for (i = 1; i + 1 < argc; ) { - if (!strcasecmp(argv[i], "-h")) { - ip = argv[++i]; - } else if (!strcasecmp(argv[i], "-p")) { - port = atoi(argv[++i]); - } else { - i++; + for (i = 1; i < argc; ) { + int cont = 0; + + if (i + 1 < argc) { + if (!strcasecmp(argv[i], "-h")) { + ip = argv[++i]; cont++; + } else if (!strcasecmp(argv[i], "-p")) { + port = atoi(argv[++i]); cont++; + } } + + if (cont) { + i++; + continue; + } + + if (!strcasecmp(argv[i], "-t")) { + thread++; + } + + i++; } if (!(ip && port)) { - fprintf(stderr, "Usage %s -h -p \n", argv[0]); + fprintf(stderr, "Usage %s [-t] -h -p \n", argv[0]); return -1; } - esl_listen(ip, port, mycallback, 100000); + if (thread) { + printf("Starting threaded listener.\n"); + esl_listen_threaded(ip, port, mycallback, 100000); + } else { + printf("Starting forking listener.\n"); + esl_listen(ip, port, my_forking_callback); + } return 0; } diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index fb50c6d0da..22b27836fd 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -649,7 +649,64 @@ static void *client_thread(esl_thread_t *me, void *obj) } -ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback, int max) +ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback) +{ + esl_socket_t server_sock = ESL_SOCK_INVALID; + struct sockaddr_in addr; + esl_status_t status = ESL_SUCCESS; + + if ((server_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + return ESL_FAIL; + } + + esl_socket_reuseaddr(server_sock); + + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_ANY); + addr.sin_port = htons(port); + + if (bind(server_sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + status = ESL_FAIL; + goto end; + } + + if (listen(server_sock, 10000) < 0) { + status = ESL_FAIL; + goto end; + } + + for (;;) { + int client_sock; + struct sockaddr_in echoClntAddr; +#ifdef WIN32 + int clntLen; +#else + unsigned int clntLen; +#endif + + clntLen = sizeof(echoClntAddr); + + if ((client_sock = accept(server_sock, (struct sockaddr *) &echoClntAddr, &clntLen)) == ESL_SOCK_INVALID) { + status = ESL_FAIL; + goto end; + } + + callback(server_sock, client_sock, &echoClntAddr); + } + + end: + + if (server_sock != ESL_SOCK_INVALID) { + closesocket(server_sock); + server_sock = ESL_SOCK_INVALID; + } + + return status; + +} + +ESL_DECLARE(esl_status_t) esl_listen_threaded(const char *host, esl_port_t port, esl_listen_callback_t callback, int max) { esl_socket_t server_sock = ESL_SOCK_INVALID; struct sockaddr_in addr; diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index 7ba705359e..4296175f3a 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -391,7 +391,9 @@ ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t s \param port Port to bind to \param callback Callback that will be called upon data received */ -ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback, int max); + +ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_listen_callback_t callback); +ESL_DECLARE(esl_status_t) esl_listen_threaded(const char *host, esl_port_t port, esl_listen_callback_t callback, int max); /*! \brief Executes application with sendmsg to a specific UUID. Used for outbound socket. \param handle Handle that the msg will be sent diff --git a/libs/esl/testserver.c b/libs/esl/testserver.c index cf60313fe7..1477d8d71e 100644 --- a/libs/esl/testserver.c +++ b/libs/esl/testserver.c @@ -48,7 +48,7 @@ static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struc int main(void) { esl_global_set_default_logger(7); - esl_listen("localhost", 8084, mycallback, 100000); + esl_listen_threaded("localhost", 8084, mycallback, 100000); return 0; } From 2368f556ac556d07f1b1fe59c726a664780c0847 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 3 May 2012 14:23:09 -0500 Subject: [PATCH 0083/1057] FS-4180 --resolve --- .../mod_event_socket/mod_event_socket.c | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) 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 518583a25d..a965780f8d 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 @@ -1354,31 +1354,26 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, if (channel && switch_channel_down(channel) && !switch_test_flag(listener, LFLAG_HANDLE_DISCO)) { switch_set_flag_locked(listener, LFLAG_HANDLE_DISCO); if (switch_test_flag(listener, LFLAG_LINGER)) { - char message[128] = ""; char disco_buf[512] = ""; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %"SWITCH_TIME_T_FMT"\n", + switch_channel_get_name(channel), listener->linger_timeout); + + switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" + "Controlled-Session-UUID: %s\n" + "Content-Disposition: linger\n" + "Channel-Name: %s\n" + "Linger-Time: %"SWITCH_TIME_T_FMT"\n" + "Content-Length: 0\n\n", + switch_core_session_get_uuid(listener->session), switch_channel_get_name(channel), listener->linger_timeout); + if (listener->linger_timeout != (time_t) -1) { listener->linger_timeout += switch_epoch_time_now(NULL); - switch_snprintf(message, sizeof(message), - "Channel %s has disconnected, lingering %d seconds by request from remote.\n", - switch_channel_get_name(channel), listener->linger_timeout); - } else { - switch_snprintf(message, sizeof(message), - "Channel %s has disconnected, lingering by request from remote.\n", - switch_channel_get_name(channel)); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s", message); - - mlen = strlen(message); - - switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" - "Controlled-Session-UUID: %s\n" - "Content-Disposition: linger\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), (int) mlen); - + len = strlen(disco_buf); switch_socket_send(listener->sock, disco_buf, &len); - len = mlen; - switch_socket_send(listener->sock, message, &len); } else { status = SWITCH_STATUS_FALSE; break; From 8664dc6d5a62460c2420bd5ff0b1096806efeba5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 3 May 2012 16:31:21 -0500 Subject: [PATCH 0084/1057] some perfomance tweaks --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 10 +- .../libsofia-sip-ua/nua/nua_common.c | 4 +- .../libsofia-sip-ua/nua/nua_server.c | 9 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 18 ++- src/mod/endpoints/mod_sofia/mod_sofia.h | 6 +- src/mod/endpoints/mod_sofia/sofia.c | 74 ++++++----- src/switch_core.c | 2 +- src/switch_event.c | 117 ++++++++++-------- src/switch_time.c | 4 +- 10 files changed, 141 insertions(+), 105 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index a02df03209..ade22984f2 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu Apr 26 10:23:33 CDT 2012 +Thu May 3 16:30:20 CDT 2012 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 5dd574b88f..bebe74262f 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -4165,7 +4165,7 @@ nta_leg_t *nta_leg_tcreate(nta_agent_t *agent, if (i == NONE) /* Magic value, used for compatibility */ no_dialog = 1; - if (!(leg = su_home_clone(agent->sa_home, sizeof(*leg)))) + if (!(leg = su_home_clone(NULL, sizeof(*leg)))) return NULL; home = leg->leg_home; @@ -4394,7 +4394,8 @@ void nta_leg_destroy(nta_leg_t *leg) static void leg_free(nta_agent_t *sa, nta_leg_t *leg) { - su_free(sa->sa_home, leg); + //su_free(sa->sa_home, leg); + su_home_unref((su_home_t *)leg); } /** Return application context for the leg */ @@ -5327,7 +5328,7 @@ nta_incoming_t *incoming_create(nta_agent_t *agent, } irq->irq_branch = sip->sip_via->v_branch; irq->irq_reliable_tp = tport_is_reliable(tport); - irq->irq_extra_100 = 1; /* Sending extra 100 trying true by default */ + irq->irq_extra_100 = 0; /* Sending extra 100 trying false by default */ if (sip->sip_timestamp) irq->irq_timestamp = sip_timestamp_copy(home, sip->sip_timestamp); @@ -6068,7 +6069,7 @@ incoming_recv(nta_incoming_t *irq, msg_t *msg, sip_t *sip, tport_t *tport) if (irq->irq_status >= 100) { SU_DEBUG_5(("nta: re-received %s request, retransmitting %u reply\n", sip->sip_request->rq_method_name, irq->irq_status)); - incoming_retransmit_reply(irq, tport); + incoming_retransmit_reply(irq, tport); } else if (irq->irq_agent->sa_extra_100 && irq->irq_extra_100) { @@ -6910,6 +6911,7 @@ _nta_incoming_timer(nta_agent_t *sa) incoming_reset_timer(irq); if(irq->irq_extra_100) { + printf("COCK FACE\n"); SU_DEBUG_5(("nta: timer N1 fired, sending %u %s\n", SIP_100_TRYING)); nta_incoming_treply(irq, SIP_100_TRYING, TAG_END()); } diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c index bc842c242d..661a18b1d2 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c @@ -109,8 +109,8 @@ nua_handle_t *nh_create_handle(nua_t *nua, assert(nua->nua_home); - if ((nh = su_home_clone(nua->nua_home, sizeof(*nh)))) { - //if ((nh = su_home_new(sizeof(*nh)))) { + //if ((nh = su_home_clone(nua->nua_home, sizeof(*nh)))) { + if ((nh = su_home_new(sizeof(*nh)))) { nh->nh_valid = nua_valid_handle_cookie; nh->nh_nua = nua; nh->nh_magic = hmagic; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c index 50150a3a42..f27c83fb92 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c @@ -261,11 +261,12 @@ int nua_stack_process_request(nua_handle_t *nh, } if (sr->sr_status <= 100) { - SR_STATUS1(sr, SIP_100_TRYING); + SR_STATUS1(sr, SIP_100_TRYING); if (method == sip_method_invite || sip->sip_timestamp) { - nta_incoming_treply(irq, SIP_100_TRYING, - SIPTAG_USER_AGENT_STR(user_agent), - TAG_END()); + nta_incoming_treply(irq, SIP_100_TRYING, + SIPTAG_USER_AGENT_STR(user_agent), + TAG_END()); + } } else { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3780886287..ea2ba7ce4d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -91,6 +91,10 @@ static switch_status_t sofia_on_init(switch_core_session_t *session) sofia_set_flag(tech_pvt, TFLAG_RECOVERED); } + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { + nua_respond(tech_pvt->nh, 101, "Dialing", TAG_END()); + } + if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) || sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) { const char *var; @@ -5343,7 +5347,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_chat_interface_t *chat_interface; switch_api_interface_t *api_interface; switch_management_interface_t *management_interface; - uint32_t cpus = switch_core_cpu_count(); struct in_addr in; memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals)); @@ -5381,9 +5384,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for profiles to start\n"); switch_yield(1500000); - /* start one message thread per cpu */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Starting %u message threads.\n", cpus); - sofia_msg_thread_start(cpus); + mod_sofia_globals.cpu_count = switch_core_cpu_count(); + mod_sofia_globals.max_msg_queues = mod_sofia_globals.cpu_count + 1; + + if (mod_sofia_globals.max_msg_queues > SOFIA_MAX_MSG_QUEUE) { + mod_sofia_globals.max_msg_queues = SOFIA_MAX_MSG_QUEUE; + } + + /* start one message thread */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Starting initial message thread.\n"); + sofia_msg_thread_start(0); if (switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL, &mod_sofia_globals.custom_node) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 8052d94539..64dfc48c8c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -336,8 +336,8 @@ typedef enum { TFLAG_MAX } TFLAGS; -#define SOFIA_MAX_MSG_QUEUE 101 -#define SOFIA_MSG_QUEUE_SIZE 5000 +#define SOFIA_MAX_MSG_QUEUE 64 +#define SOFIA_MSG_QUEUE_SIZE 100 struct mod_sofia_globals { switch_memory_pool_t *pool; @@ -347,6 +347,8 @@ struct mod_sofia_globals { uint32_t callid; int32_t running; int32_t threads; + int cpu_count; + int max_msg_queues; switch_mutex_t *mutex; char guess_ip[80]; char hostname[512]; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 1dd6646a32..eb50fda2f2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1236,8 +1236,25 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj { void *pop; switch_queue_t *q = (switch_queue_t *) obj; + int my_id; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread Started\n"); + for (my_id = 0; my_id < mod_sofia_globals.msg_queue_len; my_id++) { + if (mod_sofia_globals.msg_queue[my_id] == q) { + break; + } + } + + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MSG Thread %d Started\n", my_id); + +#ifdef HAVE_CPU_SET_MACROS + { + cpu_set_t set; + CPU_ZERO(&set); + CPU_SET(my_id, &set); + sched_setaffinity(0, sizeof(set), &set); + } +#endif while(switch_queue_pop(q, &pop) == SWITCH_STATUS_SUCCESS && pop) { @@ -1251,12 +1268,11 @@ void *SWITCH_THREAD_FUNC sofia_msg_thread_run(switch_thread_t *thread, void *obj return NULL; } -static int IDX = 0; - void sofia_msg_thread_start(int idx) { - if (idx >= SOFIA_MAX_MSG_QUEUE || (idx < mod_sofia_globals.msg_queue_len && mod_sofia_globals.msg_queue_thread[idx])) { + if (idx >= mod_sofia_globals.max_msg_queues || + idx >= SOFIA_MAX_MSG_QUEUE || (idx < mod_sofia_globals.msg_queue_len && mod_sofia_globals.msg_queue_thread[idx])) { return; } @@ -1274,7 +1290,7 @@ void sofia_msg_thread_start(int idx) switch_threadattr_create(&thd_attr, mod_sofia_globals.pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - //switch_threadattr_priority_increase(thd_attr); + switch_threadattr_priority_increase(thd_attr); switch_thread_create(&mod_sofia_globals.msg_queue_thread[i], thd_attr, sofia_msg_thread_run, @@ -1290,31 +1306,32 @@ void sofia_msg_thread_start(int idx) static void sofia_queue_message(sofia_dispatch_event_t *de) { - int idx = 0; + int idx = 0, queued = 0; - if (mod_sofia_globals.running == 0) { + if (mod_sofia_globals.running == 0 || !mod_sofia_globals.msg_queue[0]) { sofia_process_dispatch_event(&de); return; } again: - switch_mutex_lock(mod_sofia_globals.mutex); - idx = IDX; - IDX++; - if (IDX >= mod_sofia_globals.msg_queue_len) IDX = 0; - switch_mutex_unlock(mod_sofia_globals.mutex); - - sofia_msg_thread_start(idx); - - if (switch_queue_trypush(mod_sofia_globals.msg_queue[idx], de) != SWITCH_STATUS_SUCCESS) { - if (mod_sofia_globals.msg_queue_len < SOFIA_MAX_MSG_QUEUE) { - sofia_msg_thread_start(idx + 1); - goto again; - } else { - switch_queue_push(mod_sofia_globals.msg_queue[idx], de); + for (idx = 0; idx < mod_sofia_globals.msg_queue_len; idx++) { + if (switch_queue_trypush(mod_sofia_globals.msg_queue[idx], de) == SWITCH_STATUS_SUCCESS) { + queued++; + break; } } + + if (!queued) { + + if (mod_sofia_globals.msg_queue_len < mod_sofia_globals.max_msg_queues) { + sofia_msg_thread_start(mod_sofia_globals.msg_queue_len + 1); + goto again; + } + + switch_queue_push(mod_sofia_globals.msg_queue[0], de); + } + } @@ -1959,6 +1976,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NUTAG_AUTOACK(0), NUTAG_AUTOALERT(0), NUTAG_ENABLEMESSENGER(1), + NTATAG_EXTRA_100(0), TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")), TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")), TAG_IF(!sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_ALLOW("PRACK")), @@ -3652,18 +3670,6 @@ switch_status_t config_sofia(int reload, char *profile_name) mod_sofia_globals.debug_sla = atoi(val); } else if (!strcasecmp(var, "auto-restart")) { mod_sofia_globals.auto_restart = switch_true(val); - } else if (!strcasecmp(var, "message-threads")) { - int num = atoi(val); - - if (num < 1 || num > SOFIA_MAX_MSG_QUEUE - 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "message-threads must be between 1 and %d", SOFIA_MAX_MSG_QUEUE -1); - } - - if (num < 1) num = 1; - if (num > SOFIA_MAX_MSG_QUEUE - 1) num = SOFIA_MAX_MSG_QUEUE -1; - - sofia_msg_thread_start(num); - } else if (!strcasecmp(var, "reg-deny-binding-fetch-and-no-lookup")) { /* backwards compatibility */ mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup = switch_true(val); /* remove when noone complains about the extra lookup */ if (switch_true(val)) { @@ -7521,7 +7527,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ nua_respond(nh, 400, "Missing Contact Header", TAG_END()); goto fail; } - + sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port); if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) { diff --git a/src/switch_core.c b/src/switch_core.c index adb9338f68..8b93c84301 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1684,7 +1684,7 @@ static void switch_load_core_config(const char *file) } else if (end_of(val) == 'm') { tmp *= (1024 * 1024); } - + if (tmp >= 32000 && tmp < 10500000) { runtime.sql_buffer_len = tmp; } else { diff --git a/src/switch_event.c b/src/switch_event.c index 6595f61191..2203313191 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -63,7 +63,7 @@ struct switch_event_subclass { int bind; }; -#define MAX_DISPATCH_VAL 20 +#define MAX_DISPATCH_VAL 64 static unsigned int MAX_DISPATCH = MAX_DISPATCH_VAL; static unsigned int SOFT_MAX_DISPATCH = 0; static char guess_ip_v4[80] = ""; @@ -254,6 +254,16 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1; switch_mutex_unlock(EVENT_QUEUE_MUTEX); +#ifdef HAVE_CPU_SET_MACROS + { + cpu_set_t set; + CPU_ZERO(&set); + CPU_SET(my_id, &set); + sched_setaffinity(0, sizeof(set), &set); + } +#endif + + for (;;) { void *pop = NULL; switch_event_t *event = NULL; @@ -291,7 +301,6 @@ 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++; @@ -306,15 +315,6 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi for (;;) { void *pop = NULL; 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; @@ -332,19 +332,6 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi while (event) { - - if (++loops > 2) { - if (auto_pause) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event system *still* overloading.\n"); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, - "Event system overloading. Taking a 10 second break\n"); - auto_pause = 10; - switch_core_session_ctl(SCSC_PAUSE_INBOUND, &auto_pause); - } - switch_yield(1000000); - } - for (index = 0; index < SOFT_MAX_DISPATCH; index++) { if (switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event) == SWITCH_STATUS_SUCCESS) { event = NULL; @@ -358,8 +345,8 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); switch_mutex_unlock(EVENT_QUEUE_MUTEX); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of event dispatch threads! Slowing things down.\n"); - switch_yield(1000000); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of event dispatch threads! Resorting to a blocking push.... Look for laggy event consumers or event_socket connections!\n"); + switch_queue_push(EVENT_DISPATCH_QUEUE[0], event); } } } @@ -484,6 +471,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const cha SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void) { + int index; + + for (index = 0; index < SOFT_MAX_DISPATCH; index++) { + if (EVENT_DISPATCH_QUEUE[index]) { + printf("%d size: %u\n", index, switch_queue_size(EVENT_DISPATCH_QUEUE[index])); + } + } + + #ifdef SWITCH_EVENT_RECYCLE void *pop; @@ -520,9 +516,11 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) switch_mutex_unlock(EVENT_QUEUE_MUTEX); for (x = 0; x < 3; x++) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping event queue %d\n", x); - switch_queue_trypush(EVENT_QUEUE[x], NULL); - switch_queue_interrupt_all(EVENT_QUEUE[x]); + if (EVENT_QUEUE[x]) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping event queue %d\n", x); + switch_queue_trypush(EVENT_QUEUE[x], NULL); + switch_queue_interrupt_all(EVENT_QUEUE[x]); + } } for (x = 0; x < SOFT_MAX_DISPATCH; x++) { @@ -558,12 +556,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) switch_event_t *event = NULL; switch_status_t st; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping queue thread %d\n", x); - switch_thread_join(&st, EVENT_QUEUE_THREADS[x]); + if (EVENT_QUEUE_THREADS[x]) { - while (switch_queue_trypop(EVENT_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) { - event = (switch_event_t *) pop; - switch_event_destroy(&event); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping queue thread %d\n", x); + switch_thread_join(&st, EVENT_QUEUE_THREADS[x]); + + while (switch_queue_trypop(EVENT_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) { + event = (switch_event_t *) pop; + switch_event_destroy(&event); + } } } @@ -608,7 +609,11 @@ static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t switch_threadattr_priority_increase(thd_attr); switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool); while(--sanity && !EVENT_DISPATCH_QUEUE_RUNNING[index]) switch_yield(10000); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index); + if (index == 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create additional event dispatch thread %d\n", index); + } launched++; break; } @@ -618,7 +623,7 @@ static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) { - switch_threadattr_t *thd_attr;; + //switch_threadattr_t *thd_attr; /* This statement doesn't do anything commenting it out for now. @@ -626,6 +631,9 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) switch_assert(switch_arraylen(EVENT_NAMES) == SWITCH_EVENT_ALL + 1); */ + /* don't need any more dispatch threads than we have CPU's*/ + MAX_DISPATCH = switch_core_cpu_count(); + switch_assert(pool != NULL); THRUNTIME_POOL = RUNTIME_POOL = pool; @@ -640,26 +648,26 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) SYSTEM_RUNNING = -1; switch_mutex_unlock(EVENT_QUEUE_MUTEX); - switch_threadattr_create(&thd_attr, pool); + //switch_threadattr_create(&thd_attr, pool); 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); - switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL); - switch_queue_create(&EVENT_QUEUE[1], POOL_COUNT_MAX + 10, THRUNTIME_POOL); - switch_queue_create(&EVENT_QUEUE[2], POOL_COUNT_MAX + 10, THRUNTIME_POOL); + //switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL); + //switch_queue_create(&EVENT_QUEUE[1], POOL_COUNT_MAX + 10, THRUNTIME_POOL); + //switch_queue_create(&EVENT_QUEUE[2], POOL_COUNT_MAX + 10, THRUNTIME_POOL); #ifdef SWITCH_EVENT_RECYCLE switch_queue_create(&EVENT_RECYCLE_QUEUE, 250000, THRUNTIME_POOL); switch_queue_create(&EVENT_HEADER_RECYCLE_QUEUE, 250000, THRUNTIME_POOL); #endif - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_threadattr_priority_increase(thd_attr); + //switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + //switch_threadattr_priority_increase(thd_attr); launch_dispatch_threads(1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); - switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL); - switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL); - switch_thread_create(&EVENT_QUEUE_THREADS[2], thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL); + //switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL); + //switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL); + //switch_thread_create(&EVENT_QUEUE_THREADS[2], thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL); while (!THREAD_COUNT) { switch_cond_next(); @@ -1775,8 +1783,6 @@ SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, c SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data) { - int index; - switch_assert(BLOCK != NULL); switch_assert(RUNTIME_POOL != NULL); switch_assert(EVENT_QUEUE_MUTEX != NULL); @@ -1792,13 +1798,22 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, con (*event)->event_user_data = user_data; } + if (!EVENT_QUEUE_THREADS[(*event)->priority] && (*event)->priority < 3) { + switch_threadattr_t *thd_attr; + + switch_queue_create(&EVENT_QUEUE[(*event)->priority], POOL_COUNT_MAX + 10, THRUNTIME_POOL); + switch_threadattr_create(&thd_attr, THRUNTIME_POOL); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(thd_attr); + switch_thread_create(&EVENT_QUEUE_THREADS[(*event)->priority], thd_attr, switch_event_thread, EVENT_QUEUE[(*event)->priority], RUNTIME_POOL); + } + for (;;) { - for (index = (*event)->priority; index < 3; index++) { - if (switch_queue_trypush(EVENT_QUEUE[index], *event) == SWITCH_STATUS_SUCCESS) { - goto end; - } + if (switch_queue_trypush(EVENT_QUEUE[(*event)->priority], *event) == SWITCH_STATUS_SUCCESS) { + goto end; } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event queue is full!\n"); switch_yield(100000); } diff --git a/src/switch_time.c b/src/switch_time.c index 9c9ce509ec..17a0a50675 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -799,8 +799,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) if (runtime.timer_affinity > -1) { cpu_set_t set; CPU_ZERO(&set); - CPU_SET(0, &set); - sched_setaffinity(runtime.timer_affinity, sizeof(set), &set); + CPU_SET(runtime.timer_affinity, &set); + sched_setaffinity(0, sizeof(set), &set); } #endif From 0eca328f48aaba7e876faf421d46d4441473bc8a Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Thu, 3 May 2012 18:55:06 -0500 Subject: [PATCH 0085/1057] white space cleanup --- libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index bebe74262f..e690b424e7 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -6911,7 +6911,6 @@ _nta_incoming_timer(nta_agent_t *sa) incoming_reset_timer(irq); if(irq->irq_extra_100) { - printf("COCK FACE\n"); SU_DEBUG_5(("nta: timer N1 fired, sending %u %s\n", SIP_100_TRYING)); nta_incoming_treply(irq, SIP_100_TRYING, TAG_END()); } From f3f954bdb43cc3d330e0cbdf3d43734fb8241286 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 4 May 2012 02:30:58 +0000 Subject: [PATCH 0086/1057] whitespace --- src/mod/asr_tts/mod_pocketsphinx/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/asr_tts/mod_pocketsphinx/Makefile b/src/mod/asr_tts/mod_pocketsphinx/Makefile index ca72c6b0a4..c7269bd36d 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/Makefile +++ b/src/mod/asr_tts/mod_pocketsphinx/Makefile @@ -12,7 +12,7 @@ POCKETSPHINX_LA=$(POCKETSPHINX_BUILDDIR)/src/libpocketsphinx/libpocketsphinx.la SPHINXMODEL=communicator_semi_6000_20080321 LOCAL_CFLAGS=-I$(SPHINXBASE_DIR)/include -I$(POCKETSPHINX_DIR)/include -LOCAL_LIBADD=$(POCKETSPHINX_LA) $(SPHINXBASE_LA) $(SPHINXBASE_LA2) +LOCAL_LIBADD=$(POCKETSPHINX_LA) $(SPHINXBASE_LA) $(SPHINXBASE_LA2) BASE=../../../.. include $(BASE)/build/modmake.rules @@ -55,3 +55,4 @@ dictionary: @cp -f $(POCKETSPHINX_DIR)/model/lm/en_US/cmu07a.dic $(DESTDIR)$(grammardir)/default.dic local_install: $(DESTDIR)$(grammardir)/model $(DESTDIR)$(grammardir)/model/communicator dictionary + From 6a9572fca95bae923fc8e233d9e83117578280d4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 4 May 2012 02:36:29 +0000 Subject: [PATCH 0087/1057] fix mod_pocketsphinx build under make -j --- src/mod/asr_tts/mod_pocketsphinx/Makefile | 26 +++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/mod/asr_tts/mod_pocketsphinx/Makefile b/src/mod/asr_tts/mod_pocketsphinx/Makefile index c7269bd36d..9b2c6b28e4 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/Makefile +++ b/src/mod/asr_tts/mod_pocketsphinx/Makefile @@ -16,31 +16,39 @@ LOCAL_LIBADD=$(POCKETSPHINX_LA) $(SPHINXBASE_LA) $(SPHINXBASE_LA2) BASE=../../../.. include $(BASE)/build/modmake.rules +mod_pocketsphinx.lo: $(POCKETSPHINX_LA) $(SPHINXBASE_LA) $(SPHINXBASE_LA2) + $(SPHINXBASE_DIR): $(GETLIB) $(SPHINXBASE).tar.gz -$(SPHINXBASE_BUILDDIR)/buildstamp: $(SPHINXBASE_DIR) +$(SPHINXBASE_BUILDDIR)/Makefile: $(SPHINXBASE_DIR) mkdir -p $(SPHINXBASE_BUILDDIR) - test -f $(SPHINXBASE_BUILDDIR)/Makefile || (cd $(SPHINXBASE_BUILDDIR) && $(DEFAULT_VARS) $(SPHINXBASE_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(SPHINXBASE_DIR) --without-python CFLAGS=) - test -f $(SPHINXBASE_BUILDDIR)/buildstamp || (touch $(SPHINXBASE_BUILDDIR)/buildstamp) + (cd $(SPHINXBASE_BUILDDIR) && $(DEFAULT_VARS) $(SPHINXBASE_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(SPHINXBASE_DIR) --without-python CFLAGS=) + $(TOUCH_TARGET) + +$(SPHINXBASE_BUILDDIR)/buildstamp: $(SPHINXBASE_BUILDDIR)/Makefile + (cd $(SPHINXBASE_BUILDDIR) && $(MAKE)) + touch $@ $(SPHINXBASE_LA): $(SPHINXBASE_BUILDDIR)/buildstamp - cd $(SPHINXBASE_BUILDDIR) && $(MAKE) + $(TOUCH_TARGET) + +$(SPHINXBASE_LA2): $(SPHINXBASE_BUILDDIR)/buildstamp $(TOUCH_TARGET) $(POCKETSPHINX_DIR): $(GETLIB) $(POCKETSPHINX).tar.gz -$(POCKETSPHINX_BUILDDIR)/Makefile: $(POCKETSPHINX_DIR) $(SPHINXBASE_LA) +$(POCKETSPHINX_BUILDDIR)/Makefile: $(POCKETSPHINX_DIR) $(SPHINXBASE_LA) $(SPHINXBASE_LA2) mkdir -p $(POCKETSPHINX_BUILDDIR) - cd $(POCKETSPHINX_BUILDDIR) && $(DEFAULT_VARS) $(POCKETSPHINX_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(POCKETSPHINX_DIR) --without-python --with-sphinxbase=$(SPHINXBASE_DIR) --with-sphinxbase-build=$(SPHINXBASE_BUILDDIR) CFLAGS= + (cd $(POCKETSPHINX_BUILDDIR) && $(DEFAULT_VARS) $(POCKETSPHINX_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(POCKETSPHINX_DIR) --without-python --with-sphinxbase=$(SPHINXBASE_DIR) --with-sphinxbase-build=$(SPHINXBASE_BUILDDIR) CFLAGS=) $(TOUCH_TARGET) $(POCKETSPHINX_BUILDDIR)/buildstamp: $(POCKETSPHINX_BUILDDIR)/Makefile - test -f $(POCKETSPHINX_BUILDDIR)/buildstamp || touch $(POCKETSPHINX_BUILDDIR)/buildstamp + (cd $(POCKETSPHINX_BUILDDIR) && $(MAKE)) + touch $@ -$(POCKETSPHINX_LA): $(POCKETSPHINX_BUILDDIR)/Makefile - cd $(POCKETSPHINX_BUILDDIR) && $(MAKE) +$(POCKETSPHINX_LA): $(POCKETSPHINX_BUILDDIR)/buildstamp $(TOUCH_TARGET) $(DESTDIR)$(grammardir)/model: From d174c2ee3c35e77546c2f8995dcabaf8fda14bf4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 4 May 2012 02:39:22 +0000 Subject: [PATCH 0088/1057] gitignore the noreg file This file is used to squelch the advertisement for ClueCon in configure. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 55e1e9856b..b8bd5c7edf 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,7 @@ core.* /Makefile.in /modules.conf /NEWS +/noreg /Path /quiet_libtool /README From 1b399d3cf2b01179322abd7a614cd12786e6410a Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 4 May 2012 08:44:38 -0500 Subject: [PATCH 0089/1057] FS-4184 --resolve --- src/switch_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_event.c b/src/switch_event.c index 2203313191..e63ae74b3f 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -471,7 +471,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const cha SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void) { - int index; + unsigned int index; for (index = 0; index < SOFT_MAX_DISPATCH; index++) { if (EVENT_DISPATCH_QUEUE[index]) { From 1ad0d0af362869893cfd81c579d68474f3780a2d Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Fri, 4 May 2012 14:46:14 +0200 Subject: [PATCH 0090/1057] gsmopen: FS-4155, mod_sms hookup --- .../endpoints/mod_gsmopen/gsmopen_protocol.cpp | 11 +++++------ src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 53975b2cc1..2294ee4aee 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -571,7 +571,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us timeout_in_msec = (timeout_sec * 1000) + (timeout_usec ? (timeout_usec / 1000) : 0); if (timeout_in_msec != 100) - ERRORA("TIMEOUT=%d\n", GSMOPEN_P_LOG, timeout_in_msec); + DEBUGA_GSMOPEN("TIMEOUT=%d\n", GSMOPEN_P_LOG, timeout_in_msec); if (!running || !tech_pvt->running) { return -1; @@ -828,11 +828,10 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us tech_pvt->line_array.result[i], tech_pvt->callid_name, tech_pvt->callid_number); } - if ((strncmp(tech_pvt->line_array.result[i], "+CMS ERROR:", 11) == 0)) { - ERRORA("Received: \"%s\", what was this error about?\n", GSMOPEN_P_LOG); - } if ((strcmp(tech_pvt->line_array.result[i], "+CMS ERROR: 500") == 0)) { - ERRORA("Received: \"%s\", maybe this account ran OUT OF CREDIT?\n", GSMOPEN_P_LOG); + ERRORA("Received: \"%s\", generic error, maybe this account ran OUT OF CREDIT?\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); + } else if ((strncmp(tech_pvt->line_array.result[i], "+CMS ERROR:", 11) == 0)) { + ERRORA("Received: \"%s\", what was this error about?\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]); } if ((strcmp(tech_pvt->line_array.result[i], "BUSY") == 0)) { tech_pvt->phone_callflow = CALLFLOW_CALL_LINEBUSY; @@ -2113,7 +2112,7 @@ int gsmopen_serial_write_AT_ack_nocr_longtime(private_t *tech_pvt, const char *d return -1; } - at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, 5, NULL, 1); // 5.5 sec timeout + at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, 20, NULL, 1); // 20.5 sec timeout UNLOCKA(tech_pvt->controldev_lock); POPPA_UNLOCKA(tech_pvt->controldev_lock); diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 917f3fccc9..51564e0f5f 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1795,6 +1795,9 @@ static switch_status_t chat_send(switch_event_t *message_event) if (hint == NULL || !strlen(hint)) { //FIXME FIXME FIXME hint = from; } + if (subject == NULL || !strlen(subject)) { //FIXME FIXME FIXME + subject = "SIMPLE MESSAGE"; + } if (to && (user = strdup(to))) { if ((host = strchr(user, '@'))) { *host++ = '\0'; @@ -2981,7 +2984,19 @@ int sms_incoming(private_t *tech_pvt) //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname); //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE"); +/* mod_sms begin */ + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", GSMOPEN_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->sms_sender); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); +/* mod_sms end */ switch_event_add_body(event, "%s\n", tech_pvt->sms_body); + //switch_core_chat_send(GSMOPEN_CHAT_PROTO, event); /* mod_sms */ + switch_core_chat_send("GLOBAL", event); /* mod_sms */ if (session) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true"); if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) { From fd9486f0ed21e50efebc1b3ebea5d1f0c9da56af Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 07:42:49 -0500 Subject: [PATCH 0091/1057] remove --- src/switch_event.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/switch_event.c b/src/switch_event.c index e63ae74b3f..c4d118e3d2 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -471,15 +471,6 @@ SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const cha SWITCH_DECLARE(void) switch_core_memory_reclaim_events(void) { - unsigned int index; - - for (index = 0; index < SOFT_MAX_DISPATCH; index++) { - if (EVENT_DISPATCH_QUEUE[index]) { - printf("%d size: %u\n", index, switch_queue_size(EVENT_DISPATCH_QUEUE[index])); - } - } - - #ifdef SWITCH_EVENT_RECYCLE void *pop; From 5190bd08491ff9c1e9b62230ddc9b9bbb54cb1e9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 08:25:48 -0500 Subject: [PATCH 0092/1057] FS-4186 --resolve --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/switch_core.c | 5 +++++ src/switch_event.c | 7 ++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 64dfc48c8c..5a51f68a2d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -337,7 +337,7 @@ typedef enum { } TFLAGS; #define SOFIA_MAX_MSG_QUEUE 64 -#define SOFIA_MSG_QUEUE_SIZE 100 +#define SOFIA_MSG_QUEUE_SIZE 250 struct mod_sofia_globals { switch_memory_pool_t *pool; diff --git a/src/switch_core.c b/src/switch_core.c index 8b93c84301..f957a7ae5e 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -744,6 +744,8 @@ SWITCH_DECLARE(int32_t) set_auto_priority(void) runtime.cpu_count = sysinfo.dwNumberOfProcessors; #endif + if (!runtime.cpu_count) runtime.cpu_count = 1; + /* If we have more than 1 cpu, we should use realtime priority so we can have priority threads */ if (runtime.cpu_count > 1) { return set_realtime_priority(); @@ -1421,6 +1423,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc } #endif + if (!runtime.cpu_count) runtime.cpu_count = 1; + + /* INIT APR and Create the pool context */ if (apr_initialize() != SWITCH_STATUS_SUCCESS) { *err = "FATAL ERROR! Could not initialize APR\n"; diff --git a/src/switch_event.c b/src/switch_event.c index c4d118e3d2..bce57b79ee 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -35,7 +35,7 @@ #include #include //#define SWITCH_EVENT_RECYCLE -#define DISPATCH_QUEUE_LEN 10000 +#define DISPATCH_QUEUE_LEN 1000 //#define DEBUG_DISPATCH_QUEUES /*! \brief A node to store binded events */ @@ -345,8 +345,9 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); switch_mutex_unlock(EVENT_QUEUE_MUTEX); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of event dispatch threads! Resorting to a blocking push.... Look for laggy event consumers or event_socket connections!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Event Thread %d is blocking\n", my_id); switch_queue_push(EVENT_DISPATCH_QUEUE[0], event); + event = NULL; } } } @@ -623,7 +624,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) */ /* don't need any more dispatch threads than we have CPU's*/ - MAX_DISPATCH = switch_core_cpu_count(); + MAX_DISPATCH = switch_core_cpu_count() + 1; switch_assert(pool != NULL); From 29f23c1c677f7d5110d7775d9a4e2337a704e860 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 08:32:32 -0500 Subject: [PATCH 0093/1057] FS-4185 --resolve --- src/switch_ivr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index b9ef71f2bf..432bb9edc6 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2946,6 +2946,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses } return SWITCH_STATUS_SUCCESS; } else if (!strcasecmp(cmd, "stop")) { + switch_set_flag(fhp, SWITCH_FILE_DONE); return SWITCH_STATUS_FALSE; } else if (!strcasecmp(cmd, "truncate")) { switch_core_file_truncate(fhp, 0); From c64813f4fde4f5b99d8ee7cd22a3b1e17206babe Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Fri, 4 May 2012 16:31:17 +0200 Subject: [PATCH 0094/1057] skypopen: mod_sms hookup, is flawed, because it needs to CHAT CREATE, then read back the DIALOG. It will have to be spun as a separate thread, but is here as a proof of concept. I disable it right now --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 159840f5e4..4e6fec15f7 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -1957,6 +1957,7 @@ static switch_status_t chat_send(switch_event_t *message_event) while (!found) { for (i = 0; i < MAX_CHATS; i++) { + //DEBUGA_SKYPE("tech_pvt->chats[i].dialog_partner='%s' to='%s'\n", SKYPOPEN_P_LOG, tech_pvt->chats[i].dialog_partner, to); if (!strcmp(tech_pvt->chats[i].dialog_partner, to)) { snprintf(skype_msg, sizeof(skype_msg), "CHATMESSAGE %s %s", tech_pvt->chats[i].chatname, body); skypopen_signaling_write(tech_pvt, skype_msg); @@ -1969,7 +1970,7 @@ static switch_status_t chat_send(switch_event_t *message_event) } tried++; if (tried > 20) { - ERRORA("No chat with dialog_partner='%s' was found\n", SKYPOPEN_P_LOG, to); + ERRORA("No chat with dialog_partner='%s' was found. (If you're using mod_sms this is a bug of mod_skypopen when using mod_sms, from next incoming message it will probably work...)\n", SKYPOPEN_P_LOG, to); break; } switch_sleep(50000); @@ -2966,12 +2967,24 @@ int incoming_chatmessage(private_t *tech_pvt, int which) if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SKYPE_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", tech_pvt->name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->chatmessages[which].from_dispname); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->chatmessages[which].from_dispname); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", tech_pvt->chatmessages[which].from_handle); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id); +/* mod_sms begin */ + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->skype_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", SKYPE_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->chatmessages[which].from_handle); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); +/* mod_sms end */ + switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body); + switch_core_chat_send("GLOBAL", event); /* mod_sms */ if (session) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true"); if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) { From 67240d29056bea783488099a877250b0dea5e338 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Fri, 4 May 2012 16:32:38 +0200 Subject: [PATCH 0095/1057] skypopen: DISABLED (for the time being) mod_sms hookup needs to CHAT CREATE, then read back the DIALOG. It will have to be spun as a separate thread, but is here as a proof of concept. I disable it right now --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 4e6fec15f7..76ac991449 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2984,7 +2984,7 @@ int incoming_chatmessage(private_t *tech_pvt, int which) /* mod_sms end */ switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body); - switch_core_chat_send("GLOBAL", event); /* mod_sms */ + //switch_core_chat_send("GLOBAL", event); /* mod_sms */ if (session) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true"); if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) { From e8098c060d62240a9e266b8de88e5e060432fe9d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 08:47:18 -0500 Subject: [PATCH 0096/1057] FS-4184 --resolve --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 a965780f8d..b56c094872 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 @@ -1356,14 +1356,14 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, if (switch_test_flag(listener, LFLAG_LINGER)) { char disco_buf[512] = ""; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %"SWITCH_TIME_T_FMT"\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %"TIME_T_FMT"\n", switch_channel_get_name(channel), listener->linger_timeout); switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" "Controlled-Session-UUID: %s\n" "Content-Disposition: linger\n" "Channel-Name: %s\n" - "Linger-Time: %"SWITCH_TIME_T_FMT"\n" + "Linger-Time: %"TIME_T_FMT"\n" "Content-Length: 0\n\n", switch_core_session_get_uuid(listener->session), switch_channel_get_name(channel), listener->linger_timeout); From ca39f15aa92dcf04eefb63f8fd130bfa122f3d6a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 11:41:54 -0500 Subject: [PATCH 0097/1057] let the var take precedence over the profile setting --- src/mod/endpoints/mod_sofia/sofia_glue.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index e2607a5e5a..6610895927 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3131,6 +3131,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f uint32_t rtp_hold_timeout_sec = tech_pvt->profile->rtp_hold_timeout_sec; char *timer_name = NULL; const char *var; + uint32_t delay = tech_pvt->profile->rtp_digit_delay; switch_assert(tech_pvt != NULL); @@ -3528,15 +3529,14 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->cng_pt = 0; } - if (tech_pvt->profile->rtp_digit_delay || ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_digit_delay")))) { - uint32_t delay = tech_pvt->profile->rtp_digit_delay; + if (((val = switch_channel_get_variable(tech_pvt->channel, "rtp_digit_delay")))) { + int delayi = atoi(val); + if (delayi < 0) delayi = 0; + delay = (uint32_t) delay; + } - if (!delay) { - int delayi = atoi(val); - if (delayi < 0) delayi = 0; - delay = (uint32_t) delay; - } + if (delay) { switch_rtp_set_interdigit_delay(tech_pvt->rtp_session, delay); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s Set rtp dtmf delay to %u\n", switch_channel_get_name(tech_pvt->channel), delay); From 6ac20ed54d546323498a845e87bb8a79de360b82 Mon Sep 17 00:00:00 2001 From: William King Date: Fri, 4 May 2012 10:07:08 -0700 Subject: [PATCH 0098/1057] If the notify event contains call-info headers, then process the call-info linked list into comma separated values and add them to a header on the event. --- src/mod/endpoints/mod_sofia/sofia.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index eb50fda2f2..7ae868ef62 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -476,6 +476,26 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", sofia_private->gateway->profile->name); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", sofia_private->gateway->profile->url); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "gateway_name", sofia_private->gateway->name); + if ( sip->sip_call_info != NULL ) { + sip_call_info_t *call_info = sip->sip_call_info; + int cur_len = 0; + char *tmp = NULL; + char *hold = strdup(sip_header_as_string(nua_handle_home(nh), (void *) call_info)); + cur_len = strlen(hold); + + while ( call_info->ci_next != NULL) { + call_info = call_info->ci_next; + tmp = strdup(sip_header_as_string(nua_handle_home(nh), (void *) call_info)); + cur_len = cur_len + strlen(tmp) +2; + hold = realloc(hold, cur_len); + switch_assert(hold); + strcat(hold,","); + strcat(hold, tmp); + free(tmp); + } + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Call-Info", hold); + free(hold); + } switch_event_fire(&s_event); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "dispatched freeswitch event for message-summary NOTIFY\n"); } else { From fb04149a8238edd291eda25e837f4bb2d0171ae9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 4 May 2012 19:01:24 +0000 Subject: [PATCH 0099/1057] bootstrap.sh: remove broken and useless check_awk ...and replace with a TODO explaining why the function stub is there. --- bootstrap.sh | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 93c96f4088..77640722f6 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -209,24 +209,10 @@ check_make() { check_awk() { - # - # Check to make sure we have GNU Make installed - # - - awk=`which awk` - if [ -x "$awk" ]; then - awk_version=`$awk --version | head -n 1 |grep GNU` - if [ $? -ne 0 ]; then - awk=`which gawk` - if [ -x "$awk" ]; then - awk_version=`$awk --version | head -n 1 |grep GNU` - if [ $? -ne 0 ]; then - echo "GNU awk does not exist or is not executable" - exit 1; - fi - fi - fi - fi + # TODO: Building with mawk on at least Debian squeeze is know to + # work, but mawk is believed to fail on some systems. If we can + # replicate this, we need a particular behavior that we can test + # here to verify whether we have an acceptable awk. } From adfe4626918ff5a7210261715d41e6a24e779cbd Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 4 May 2012 19:10:51 +0000 Subject: [PATCH 0100/1057] bootstrap.sh: fix syntax error ...it's always the seemingly trivial changes. --- bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap.sh b/bootstrap.sh index 77640722f6..0e0ac56fc4 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -213,6 +213,7 @@ check_awk() { # work, but mawk is believed to fail on some systems. If we can # replicate this, we need a particular behavior that we can test # here to verify whether we have an acceptable awk. + : } From 56e4a5fc5d66a8f1485c82b93370e8074ee7a976 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 4 May 2012 20:31:48 +0000 Subject: [PATCH 0101/1057] mod_mongo: let mongo build with ccache --- src/mod/applications/mod_mongo/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_mongo/Makefile b/src/mod/applications/mod_mongo/Makefile index 26687b5ac6..7c79fb291b 100644 --- a/src/mod/applications/mod_mongo/Makefile +++ b/src/mod/applications/mod_mongo/Makefile @@ -24,6 +24,9 @@ $(MONGO_CXX_DRIVER_SRC): $(LIBMONGOCLIENT_A): $(MONGO_CXX_DRIVER_SRC) - cd $(MONGO_CXX_DRIVER_SRC) && scons + (cd $(MONGO_CXX_DRIVER_SRC) && \ + sed -i SConstruct -e "s/Environment()/Environment(ENV = {'PATH' : os.environ['PATH'],'CFLAGS' : os.environ['CFLAGS']})/" && \ + echo "env.Append(PATH=os.environ['PATH'])" >> SConstruct && \ + scons) $(TOUCH_TARGET) From e278c0facd4b3f12363aeb3d1b2ee152b84fcb4d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 4 May 2012 22:15:47 +0000 Subject: [PATCH 0102/1057] mod_mongo: pass CXXFLAGS to mongo build --- src/mod/applications/mod_mongo/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_mongo/Makefile b/src/mod/applications/mod_mongo/Makefile index 7c79fb291b..cdab0466be 100644 --- a/src/mod/applications/mod_mongo/Makefile +++ b/src/mod/applications/mod_mongo/Makefile @@ -25,7 +25,7 @@ $(MONGO_CXX_DRIVER_SRC): $(LIBMONGOCLIENT_A): $(MONGO_CXX_DRIVER_SRC) (cd $(MONGO_CXX_DRIVER_SRC) && \ - sed -i SConstruct -e "s/Environment()/Environment(ENV = {'PATH' : os.environ['PATH'],'CFLAGS' : os.environ['CFLAGS']})/" && \ + sed -i SConstruct -e "s/Environment()/Environment(ENV = {'PATH' : os.environ['PATH'],'CFLAGS' : os.environ['CFLAGS'],'CXXFLAGS' : os.environ['CXXFLAGS']})/" && \ echo "env.Append(PATH=os.environ['PATH'])" >> SConstruct && \ scons) $(TOUCH_TARGET) From 5c66ab479329155180cbf4e35e5be44bfb10870d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 14:07:12 -0500 Subject: [PATCH 0103/1057] fix xml object leak in conference cdrs --- src/mod/applications/mod_conference/mod_conference.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index a46437aab3..3112a781f4 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -660,9 +660,10 @@ static void conference_cdr_render(conference_obj_t *conference) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n", path, ebuf); } - + switch_safe_free(path); switch_safe_free(xml_text); + switch_xml_free(cdr); } From 64d4d9ea574eb0e11a7dd1d1c0088293e97c31ff Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 18:59:25 -0500 Subject: [PATCH 0104/1057] add pickup endpoint and app to dptools add pickup/keyname to forked dial, then route a call to call app pickup(keyname) to have your channel return from originate. sub to pickup+keyname or presence map the pickup proto to use on blf --- src/include/switch_types.h | 1 + .../applications/mod_dptools/mod_dptools.c | 504 +++++++++++++++++- src/mod/endpoints/mod_sofia/sofia_presence.c | 26 + src/switch_ivr_originate.c | 19 + 4 files changed, 549 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 3c1cb1cf7c..47336a800a 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1211,6 +1211,7 @@ typedef enum { CF_SERVICE_VIDEO, CF_ZRTP_HASH, CF_ZRTP_PASS, + CF_CHANNEL_SWAP, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 3331226e9d..4adfca6611 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -38,7 +38,8 @@ #include SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load); -SWITCH_MODULE_DEFINITION(mod_dptools, mod_dptools_load, NULL, NULL); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dptools_shutdown); +SWITCH_MODULE_DEFINITION(mod_dptools, mod_dptools_load, mod_dptools_shutdown, NULL); SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt) { @@ -3094,6 +3095,484 @@ SWITCH_STANDARD_APP(audio_bridge_function) } } +static struct { + switch_memory_pool_t *pool; + switch_hash_t *pickup_hash; + switch_mutex_t *pickup_mutex; +} globals; + +/* pickup channel */ + + + +typedef struct pickup_node_s { + char *key; + char *uuid; + struct pickup_node_s *next; +} pickup_node_t; + + +#define PICKUP_PROTO "pickup" +static int EC = 0; + +static int pickup_count(const char *key_name) +{ + int count = 0; + pickup_node_t *head, *np; + + switch_mutex_lock(globals.pickup_mutex); + if ((head = switch_core_hash_find(globals.pickup_hash, key_name))) { + for (np = head; np; np = np->next) count++; + } + switch_mutex_unlock(globals.pickup_mutex); + + return count; + +} + +static void pickup_send_presence(const char *key_name) +{ + + char *domain_name, *dup_key_name = NULL, *dup_domain_name = NULL, *dup_id = NULL; + switch_event_t *event; + int count; + + + dup_key_name = strdup(key_name); + key_name = dup_key_name; + + if ((domain_name = strchr(dup_key_name, '@'))) { + *domain_name++ = '\0'; + } + + if (zstr(domain_name)) { + dup_domain_name = switch_core_get_variable_dup("domain"); + domain_name = dup_domain_name; + } + + if (zstr(domain_name)) { + domain_name = "cluecon.com"; + } + + dup_id = switch_mprintf("%s@%s", key_name, domain_name); + + count = pickup_count(dup_id); + + if (count > 0) { + if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id); + + + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", EC++); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", key_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "confirmed"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound"); + switch_event_fire(&event); + } + } else { + if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id); + + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", EC++); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", dup_id); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound"); + switch_event_fire(&event); + } + } + + switch_safe_free(dup_domain_name); + switch_safe_free(dup_key_name); + switch_safe_free(dup_id); + +} + +static void pickup_pres_event_handler(switch_event_t *event) +{ + char *to = switch_event_get_header(event, "to"); + char *dup_to = NULL, *key_name, *dup_key_name = NULL, *domain_name, *dup_domain_name = NULL; + int count = 0; + + if (!to || strncasecmp(to, "pickup+", 7) || !strchr(to, '@')) { + return; + } + + if (!(dup_to = strdup(to))) { + return; + } + + key_name = dup_to + 7; + + if ((domain_name = strchr(key_name, '@'))) { + *domain_name++ = '\0'; + } else { + dup_domain_name = switch_core_get_variable_dup("domain"); + domain_name = dup_domain_name; + } + + if (zstr(domain_name)) { + switch_safe_free(dup_to); + return; + } + + dup_key_name = switch_mprintf("%q@%q", key_name, domain_name); + count = pickup_count(dup_key_name); + + switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN); + + if (count) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name); + + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", EC++); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", key_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "confirmed"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound"); + } else { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name); + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", EC++); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", key_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound"); + + } + + switch_event_fire(&event); + switch_safe_free(dup_to); + switch_safe_free(dup_key_name); + switch_safe_free(dup_domain_name); +} + + + +static void pickup_add_session(switch_core_session_t *session, const char *key) +{ + pickup_node_t *head, *node, *np; + char *dup_key = NULL; + + if (!strchr(key, '@')) { + dup_key = switch_mprintf("%s@%s", key, switch_core_get_variable("domain")); + key = dup_key; + } + + node = malloc(sizeof(*node)); + node->key = strdup(key); + node->uuid = strdup(switch_core_session_get_uuid(session)); + node->next = NULL; + + switch_mutex_lock(globals.pickup_mutex); + head = switch_core_hash_find(globals.pickup_hash, key); + + if (head) { + for (np = head; np && np->next; np = np->next); + np->next = node; + } else { + head = node; + switch_core_hash_insert(globals.pickup_hash, key, head); + } + + switch_mutex_unlock(globals.pickup_mutex); + + pickup_send_presence(key); + + switch_safe_free(dup_key); +} + +static char *pickup_pop_uuid(const char *key, const char *uuid) +{ + pickup_node_t *node = NULL, *head; + char *r = NULL; + char *dup_key = NULL; + + if (!strchr(key, '@')) { + dup_key = switch_mprintf("%s@%s", key, switch_core_get_variable("domain")); + key = dup_key; + } + + switch_mutex_lock(globals.pickup_mutex); + + if ((head = switch_core_hash_find(globals.pickup_hash, key))) { + + switch_core_hash_delete(globals.pickup_hash, key); + + if (uuid) { + pickup_node_t *np, *lp = NULL; + + for(np = head; np; np = np->next) { + if (!strcmp(np->uuid, uuid)) { + if (lp) { + lp->next = np->next; + } else { + head = np->next; + } + + node = np; + break; + } + + lp = np; + } + + } else { + node = head; + head = head->next; + } + + + if (head) { + switch_core_hash_insert(globals.pickup_hash, key, head); + } + } + + if (node) { + r = node->uuid; + free(node->key); + free(node); + } + + switch_mutex_unlock(globals.pickup_mutex); + + if (r) pickup_send_presence(key); + + switch_safe_free(dup_key); + + return r; +} + + +typedef struct pickup_pvt_s { + char *key; + switch_event_t *vars; +} pickup_pvt_t; + +switch_endpoint_interface_t *pickup_endpoint_interface; +static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *session, + switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, + switch_call_cause_t *cancel_cause); +switch_io_routines_t pickup_io_routines = { + /*.outgoing_channel */ pickup_outgoing_channel +}; + +static switch_status_t pickup_event_handler(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_state_t state = switch_channel_get_running_state(channel); + pickup_pvt_t *tech_pvt = switch_core_session_get_private(session); + + switch(state) { + case CS_DESTROY: + if (tech_pvt->vars) { + switch_event_destroy(&tech_pvt->vars); + } + break; + case CS_REPORTING: + return SWITCH_STATUS_FALSE; + case CS_HANGUP: + { + + if (switch_channel_test_flag(channel, CF_CHANNEL_SWAP)) { + const char *key = switch_channel_get_variable(channel, "channel_swap_uuid"); + switch_core_session_t *swap_session; + + if ((swap_session = switch_core_session_locate(key))) { + switch_channel_t *swap_channel = switch_core_session_get_channel(swap_session); + switch_channel_hangup(swap_channel, SWITCH_CAUSE_PICKED_OFF); + switch_core_session_rwunlock(swap_session); + } + switch_channel_clear_flag(channel, CF_CHANNEL_SWAP); + } + + pickup_pop_uuid(tech_pvt->key, switch_core_session_get_uuid(session)); + } + break; + default: + break; + } + + + return SWITCH_STATUS_SUCCESS; +} + +switch_state_handler_table_t pickup_event_handlers = { + /*.on_init */ pickup_event_handler, + /*.on_routing */ pickup_event_handler, + /*.on_execute */ pickup_event_handler, + /*.on_hangup */ pickup_event_handler, + /*.on_exchange_media */ pickup_event_handler, + /*.on_soft_execute */ pickup_event_handler, + /*.on_consume_media */ pickup_event_handler, + /*.on_hibernate */ pickup_event_handler, + /*.on_reset */ pickup_event_handler, + /*.on_park */ pickup_event_handler, + /*.on_reporting */ pickup_event_handler, + /*.on_destroy */ pickup_event_handler +}; + +static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *session, + switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, + switch_call_cause_t *cancel_cause) +{ + char *pickup; + switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + switch_core_session_t *nsession; + switch_channel_t *nchannel; + char *name; + pickup_pvt_t *tech_pvt; + switch_caller_profile_t *caller_profile; + + if (zstr(outbound_profile->destination_number)) { + goto done; + } + + pickup = outbound_profile->destination_number; + + + if (!(nsession = switch_core_session_request(pickup_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n"); + goto error; + } + + tech_pvt = switch_core_session_alloc(nsession, sizeof(*tech_pvt)); + tech_pvt->key = switch_core_session_strdup(nsession, pickup); + switch_event_dup(&tech_pvt->vars, var_event); + + switch_core_session_set_private(nsession, tech_pvt); + + nchannel = switch_core_session_get_channel(nsession); + caller_profile = switch_caller_profile_clone(nsession, outbound_profile); + switch_channel_set_caller_profile(nchannel, caller_profile); + + switch_channel_set_state(nchannel, CS_ROUTING); + + + + *new_session = nsession; + cause = SWITCH_CAUSE_SUCCESS; + name = switch_core_session_sprintf(nsession, "pickup/%s", pickup); + switch_channel_set_name(nchannel, name); + switch_channel_set_variable(nchannel, "process_cdr", "false"); + pickup_add_session(nsession, pickup); + + goto done; + + error: + + if (nsession) { + switch_core_session_destroy(&nsession); + } + + if (pool) { + *pool = NULL; + } + + done: + + + return cause; +} + +#define PICKUP_SYNTAX "[]" +SWITCH_STANDARD_APP(pickup_function) +{ + char *uuid = NULL; + switch_core_session_t *pickup_session; + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing data. Usage: pickup %s\n", PICKUP_SYNTAX); + return; + } + + if ((uuid = pickup_pop_uuid((char *)data, NULL))) { + if ((pickup_session = switch_core_session_locate(uuid))) { + switch_channel_t *pickup_channel = switch_core_session_get_channel(pickup_session); + switch_caller_profile_t *pickup_caller_profile = switch_channel_get_caller_profile(pickup_channel), + *caller_profile = switch_channel_get_caller_profile(channel); + const char *name, *num; + switch_event_t *event; + switch_event_header_t *hp; + pickup_pvt_t *tech_pvt = switch_core_session_get_private(pickup_session); + + for(hp = tech_pvt->vars->headers; hp; hp = hp->next) { + switch_channel_set_variable(channel, hp->name, hp->value); + } + + + switch_channel_set_flag(pickup_channel, CF_CHANNEL_SWAP); + switch_channel_set_variable(pickup_channel, "channel_swap_uuid", switch_core_session_get_uuid(session)); + + name = caller_profile->caller_id_name; + num = caller_profile->caller_id_number; + + caller_profile->caller_id_name = switch_core_strdup(caller_profile->pool, pickup_caller_profile->caller_id_name); + caller_profile->caller_id_number = switch_core_strdup(caller_profile->pool, pickup_caller_profile->caller_id_number); + + caller_profile->callee_id_name = name; + caller_profile->callee_id_number = num; + + if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) { + const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV"); + + if (!uuid) { + uuid = switch_channel_get_variable(channel, "originate_signal_bond"); + } + + + if (uuid) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid); + } + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + + + switch_channel_set_state(channel, CS_HIBERNATE); + + switch_channel_mark_answered(pickup_channel); + switch_core_session_rwunlock(pickup_session); + } + free(uuid); + } +} + + + + + /* fake chan_error */ switch_endpoint_interface_t *error_endpoint_interface; static switch_call_cause_t error_outgoing_channel(switch_core_session_t *session, @@ -3985,6 +4464,14 @@ static char *file_string_supported_formats[SWITCH_MAX_CODECS] = { 0 }; #define LOG_LONG_DESC "Logs a channel variable for the channel calling the application." #define TRANSFER_LONG_DESC "Immediately transfer the calling channel to a new extension" #define SLEEP_LONG_DESC "Pause the channel for a given number of milliseconds, consuming the audio for that period of time." + +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dptools_shutdown) +{ + switch_event_unbind_callback(pickup_pres_event_handler); + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) { switch_api_interface_t *api_interface; @@ -3993,9 +4480,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) switch_chat_interface_t *chat_interface; switch_file_interface_t *file_interface; + globals.pool = pool; + switch_core_hash_init(&globals.pickup_hash, NULL); + switch_mutex_init(&globals.pickup_mutex, SWITCH_MUTEX_NESTED, globals.pool); + /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); + switch_event_bind(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pickup_pres_event_handler, NULL); + + file_string_supported_formats[0] = "file_string"; file_interface = (switch_file_interface_t *) switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); @@ -4019,6 +4513,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) user_endpoint_interface->interface_name = "user"; user_endpoint_interface->io_routines = &user_io_routines; + pickup_endpoint_interface = (switch_endpoint_interface_t *) switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); + pickup_endpoint_interface->interface_name = "pickup"; + pickup_endpoint_interface->io_routines = &pickup_io_routines; + pickup_endpoint_interface->state_handler = &pickup_event_handlers; + SWITCH_ADD_CHAT(chat_interface, "event", event_chat_send); SWITCH_ADD_CHAT(chat_interface, "api", api_chat_send); @@ -4193,6 +4692,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "limit_execute", "Limit", LIMITEXECUTE_DESC, limit_execute_function, LIMITEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "limit_hash_execute", "Limit", LIMITHASHEXECUTE_DESC, limit_hash_execute_function, LIMITHASHEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "pickup", "Pickup", "Pickup a call", pickup_function, PICKUP_SYNTAX, SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt); /* indicate that the module should continue to be loaded */ diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 8dc58d1320..6befca3439 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1761,6 +1761,20 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char * remote_user = to_user; remote_host = local_host; } + else if (proto && !strcasecmp(proto, "pickup")) { + local_user = to_user; + local_user_param = switch_mprintf(";proto=%s", proto); + event_status = "hold"; + if (skip_proto) { + buf_to_free = switch_mprintf("sip:%s", to_user); + } else { + buf_to_free = switch_mprintf("sip:pickup+%s", to_user); + } + remote_uri = buf_to_free; + strcpy(remote_display_buf, "pickup"); + remote_user = to_user; + remote_host = local_host; + } else if (proto && !strcasecmp(proto, "conf")) { local_user = to_user; local_user_param = switch_mprintf(";proto=%s", proto); @@ -2626,6 +2640,18 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * stream.write_function(&stream, "\n", uuid); } stream.write_function(&stream, "\n"); + } else if (!strcasecmp(proto, "pickup")) { + stream.write_function(&stream, "\nsip:%s@%s;proto=pickup\n", + !zstr(clean_to_user) ? clean_to_user : "unknown", host); + stream.write_function(&stream, "\n", !zstr(clean_to_user) ? clean_to_user : "unknown", host); + stream.write_function(&stream, "\n\n\n"); + stream.write_function(&stream, "\nsip:%s\n", uuid); + if (skip_proto) { + stream.write_function(&stream, "\n", uuid); + } else { + stream.write_function(&stream, "\n", uuid); + } + stream.write_function(&stream, "\n"); } else if (!strcasecmp(proto, "conf")) { stream.write_function(&stream, "\nsip:%s@%s;proto=conference\n", !zstr(clean_to_user) ? clean_to_user : "unknown", host); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 4a3067afc2..c3da16f072 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3541,6 +3541,25 @@ 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 (switch_channel_test_flag(bchan, CF_CHANNEL_SWAP)) { + const char *key = switch_channel_get_variable(bchan, "channel_swap_uuid"); + switch_core_session_t *swap_session, *old_session; + + if ((swap_session = switch_core_session_locate(key))) { + switch_channel_clear_flag(bchan, CF_CHANNEL_SWAP); + switch_channel_hangup(bchan, SWITCH_CAUSE_PICKED_OFF); + + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(bchan), SWITCH_LOG_DEBUG, "Swapping %s for %s\n", + switch_core_session_get_name(swap_session), switch_channel_get_name(bchan)); + + old_session = *bleg; + *bleg = swap_session; + bchan = switch_core_session_get_channel(*bleg); + switch_channel_answer(bchan); + switch_core_session_rwunlock(old_session); + } + } if (session && caller_channel) { From 1374f98645f2a6f92ac2288c8d890a46712f4b19 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 19:44:29 -0500 Subject: [PATCH 0105/1057] make sched_hangup +0 the same as uuid_kill --- src/mod/applications/mod_commands/mod_commands.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 9baa7ce0f1..a812c8b994 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2644,9 +2644,10 @@ SWITCH_STANDARD_API(sched_hangup_function) char *cause_str = argv[2]; time_t when; switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT; + int sec = atol(argv[0] + 1); if (*argv[0] == '+') { - when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + sec; } else { when = atol(argv[0]); } @@ -2656,7 +2657,13 @@ SWITCH_STANDARD_API(sched_hangup_function) } if ((hsession = switch_core_session_locate(uuid))) { - switch_ivr_schedule_hangup(when, uuid, cause, SWITCH_FALSE); + if (sec == 0) { + switch_channel_t *hchannel = switch_core_session_get_channel(hsession); + switch_channel_hangup(hchannel, cause); + } else { + switch_ivr_schedule_hangup(when, uuid, cause, SWITCH_FALSE); + } + stream->write_function(stream, "+OK\n"); switch_core_session_rwunlock(hsession); } else { From 073e4056422ab82efd23fa18362a230609bcfa47 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 4 May 2012 19:48:31 -0500 Subject: [PATCH 0106/1057] do same as last patch with sched_hangup app --- src/mod/applications/mod_dptools/mod_dptools.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 4adfca6611..d5430cf1df 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1029,9 +1029,10 @@ SWITCH_STANDARD_APP(sched_hangup_function) time_t when; switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT; switch_bool_t bleg = SWITCH_FALSE; + int sec = atol(argv[0] + 1); if (*argv[0] == '+') { - when = switch_epoch_time_now(NULL) + atol(argv[0] + 1); + when = switch_epoch_time_now(NULL) + sec; } else { when = atol(argv[0]); } @@ -1044,7 +1045,11 @@ SWITCH_STANDARD_APP(sched_hangup_function) bleg = SWITCH_TRUE; } - switch_ivr_schedule_hangup(when, switch_core_session_get_uuid(session), cause, bleg); + if (sec == 0) { + switch_channel_hangup(switch_core_session_get_channel(session), cause); + } else { + switch_ivr_schedule_hangup(when, switch_core_session_get_uuid(session), cause, bleg); + } } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No time specified.\n"); } From 9181e8e51b2ffad4e8d7be6cb38afb4ea00eeda8 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 16 Feb 2012 05:57:21 +0000 Subject: [PATCH 0107/1057] debian: start over --- debian/changelog | 875 ------------------ debian/compat | 1 - debian/control | 279 ------ debian/copyright | 538 ----------- debian/dirs | 5 - debian/freeswitch-codec-passthru-amr.install | 1 - .../freeswitch-codec-passthru-amrwb.install | 1 - .../freeswitch-codec-passthru-g7231.install | 1 - debian/freeswitch-codec-passthru-g729.install | 1 - debian/freeswitch-dev.install | 5 - debian/freeswitch-freetdm.conffiles | 6 - debian/freeswitch-freetdm.install | 10 - debian/freeswitch-lang-de.conffiles | 4 - debian/freeswitch-lang-de.install | 5 - debian/freeswitch-lang-en.conffiles | 7 - debian/freeswitch-lang-en.install | 8 - debian/freeswitch-lang-es.install | 1 - debian/freeswitch-lang-fr.conffiles | 5 - debian/freeswitch-lang-fr.install | 6 - debian/freeswitch-lang-he.conffiles | 5 - debian/freeswitch-lang-he.install | 6 - debian/freeswitch-lang-it.install | 1 - debian/freeswitch-lang-nl.install | 1 - debian/freeswitch-lang-ru.conffiles | 7 - debian/freeswitch-lang-ru.install | 8 - debian/freeswitch-lua.conffiles | 1 - debian/freeswitch-lua.install | 2 - debian/freeswitch-perl.conffiles | 1 - debian/freeswitch-perl.install | 3 - debian/freeswitch-python.conffiles | 1 - debian/freeswitch-python.install | 5 - debian/freeswitch-spidermonkey.conffiles | 1 - debian/freeswitch-spidermonkey.install | 6 - debian/freeswitch.conffiles | 98 -- debian/freeswitch.default | 11 - debian/freeswitch.init | 184 ---- debian/freeswitch.install | 171 ---- debian/man/man1/freeswitch.1 | 22 - debian/monit/freeswitch.monitrc | 25 - debian/postinst | 60 -- debian/postrm | 44 - debian/rules | 236 ----- .../debian/buildsounds.sh | 15 - .../debian/changelog | 20 - .../debian/control | 66 -- .../debian/copyright | 1 - ...eeswitch-sounds-en-us-callie-16000.install | 2 - ...eeswitch-sounds-en-us-callie-32000.install | 2 - ...eeswitch-sounds-en-us-callie-48000.install | 2 - ...reeswitch-sounds-en-us-callie-8000.install | 2 - .../debian/rules | 39 - .../debian/buildsounds.sh | 12 - .../freeswitch-sounds-music/debian/changelog | 26 - .../freeswitch-sounds-music/debian/control | 66 -- .../freeswitch-sounds-music/debian/copyright | 13 - .../freeswitch-sounds-music-16000.install | 2 - .../freeswitch-sounds-music-32000.install | 2 - .../freeswitch-sounds-music-48000.install | 2 - .../freeswitch-sounds-music-8000.install | 2 - .../freeswitch-sounds-music/debian/rules | 39 - .../debian/buildsounds.sh | 15 - .../debian/changelog | 35 - .../debian/control | 61 -- .../debian/copyright | 1 - ...reeswitch-sounds-ru-ru-elena-16000.install | 2 - ...reeswitch-sounds-ru-ru-elena-32000.install | 2 - ...reeswitch-sounds-ru-ru-elena-48000.install | 2 - ...freeswitch-sounds-ru-ru-elena-8000.install | 2 - .../debian/rules | 39 - debian/sounds/getsounds.sh | 30 - debian/source/format | 1 - 71 files changed, 3161 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/dirs delete mode 100644 debian/freeswitch-codec-passthru-amr.install delete mode 100644 debian/freeswitch-codec-passthru-amrwb.install delete mode 100644 debian/freeswitch-codec-passthru-g7231.install delete mode 100644 debian/freeswitch-codec-passthru-g729.install delete mode 100644 debian/freeswitch-dev.install delete mode 100644 debian/freeswitch-freetdm.conffiles delete mode 100644 debian/freeswitch-freetdm.install delete mode 100644 debian/freeswitch-lang-de.conffiles delete mode 100644 debian/freeswitch-lang-de.install delete mode 100644 debian/freeswitch-lang-en.conffiles delete mode 100644 debian/freeswitch-lang-en.install delete mode 100644 debian/freeswitch-lang-es.install delete mode 100644 debian/freeswitch-lang-fr.conffiles delete mode 100644 debian/freeswitch-lang-fr.install delete mode 100644 debian/freeswitch-lang-he.conffiles delete mode 100644 debian/freeswitch-lang-he.install delete mode 100644 debian/freeswitch-lang-it.install delete mode 100644 debian/freeswitch-lang-nl.install delete mode 100644 debian/freeswitch-lang-ru.conffiles delete mode 100644 debian/freeswitch-lang-ru.install delete mode 100644 debian/freeswitch-lua.conffiles delete mode 100644 debian/freeswitch-lua.install delete mode 100644 debian/freeswitch-perl.conffiles delete mode 100644 debian/freeswitch-perl.install delete mode 100644 debian/freeswitch-python.conffiles delete mode 100644 debian/freeswitch-python.install delete mode 100644 debian/freeswitch-spidermonkey.conffiles delete mode 100644 debian/freeswitch-spidermonkey.install delete mode 100644 debian/freeswitch.conffiles delete mode 100644 debian/freeswitch.default delete mode 100755 debian/freeswitch.init delete mode 100644 debian/freeswitch.install delete mode 100644 debian/man/man1/freeswitch.1 delete mode 100644 debian/monit/freeswitch.monitrc delete mode 100755 debian/postinst delete mode 100755 debian/postrm delete mode 100755 debian/rules delete mode 100755 debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/control delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install delete mode 100755 debian/sounds/freeswitch-sounds-en-us-callie/debian/rules delete mode 100755 debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/changelog delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/control delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/copyright delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install delete mode 100755 debian/sounds/freeswitch-sounds-music/debian/rules delete mode 100755 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install delete mode 100755 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules delete mode 100755 debian/sounds/getsounds.sh delete mode 100644 debian/source/format diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 8e1558363a..0000000000 --- a/debian/changelog +++ /dev/null @@ -1,875 +0,0 @@ -freeswitch (1.1.beta2.1-1) unstable; urgency=low - - * Fixing FS-3449 as well as a bit of cleanup in prep for 1.2 release - packaging. Also a handful of lintian errors/warnings are now fixed. - - -- William King Thu, 19 Apr 2012 19:23:18 -0700 - -freeswitch (1.0.head-git.master.20110530.1-1) unstable; urgency=low - - * added mod_cdr_sqlite - - -- Michal Bielicki Mon, 30 May 2011 16:02:02 +0200 - -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 - - -- Michal Bielicki Wed, 30 Mar 2011 11:39:02 +0200 - -freeswitch (1.0.head~git.master.20101222.1-1) unstable; urgency=low - - * cleaning work - - -- Michal Bielicki Wed, 22 Dec 2010 22:48:02 +0200 - -freeswitch (1.0.head~git.master.20101015.1-1) unstable; urgency=low - - * reintroduced mod_flite - * disabled the patching stuff introduced by Julien ... needs an overwork - * reintroduced mod_tts_commandline - * cleaned up rules file and module make rules - * more trivial changes and updates :) - - -- Michal Bielicki Fri, 15 Oct 2010 13:14:02 +0200 - -freeswitch (1.0.head~git.master.20101014.1-1) unstable; urgency=low - - * replaced mod_openzap with mod_freetdm - * added mod_theora - * added mod_codec2 - * added mod_amrwb - * added mod_portaudio_stream - * cleaned up rules file and module make rules - * added patches from Julien Duqene (FS-369) - * Various trivial changes and updates :) - - -- Michal Bielicki Fri, 15 Oct 2010 05:05:02 +0200 - -freeswitch (1.0.head~git.master.20100601.2-1) unstable; urgency=low - - * Various trivial changes and updates. - * Change upstream package version numbering scheme for unreleased versions: - new format is major.minor.micro~git.branch.date.commits-1 - * Change source format to 3.0 (quilt). - * Upgrade debhelper compatibility to version 7. - * Update maintainer data and copyright file; now includes the full text - of the MPL since it is not (yet?) available in /usr/share/common-licenses/ - - * Build and install mod_file_string.so (FSBUILD-247) - * Work around build failure caused by clean rules for openzap. - - * Remove several libraries from explicit dependencies, there were no special - version requirements and they should be picked up by dh_shlibdeps. - * Add dh_makeshlibs and make dh_shlibsdeps work again. - * Move openssl to Suggests: as it is not a required package to install or - run freeswitch. - - * Add upstream-convert rule to apply patches, generate orig tarball - and set package version. - * Add check to ensure debian patches are applied before attempting build. - * Fix clean rule to avoid unwanted tree change before building orig.tar - archives with git-buildpackage. - - -- Julien Plissonneau Duquene Tue, 01 Jun 2010 09:53:44 -0400 - -freeswitch (1.0.6-1ubuntu1) maverick; urgency=low - - [ Gabriel Gunderson ] - * upgrade: Added mod_callcenter and pulled out Python into its own - package. - - [ Mathieu Parent ] - * Updated Uploaders list - * Updated Standards-Version to 3.9.1 - - -- Mathieu Parent Thu, 23 Sep 2010 15:34:00 +0200 - -freeswitch (1.0.4-1ubuntu2) karmic; urgency=low - - * upgrade: Add more verbosity when building to make it easier to find build - errors. - * upgrade: Remove the requirement for EXACTLY automake1.9 and change it to - need at least automake 1.9 - * upgrade: Add the modules (directory, cluechoo, and valet_parking) to the - build files. These are in the standard build, so they should be here too. - - -- William King Fri, 18 Dec 2009 14:27:42 -0800 - -freeswitch (1.0.4-1ubuntu1) karmic; urgency=low - - * upgrade: Pulling out the sounds into separate source files for easier management. - - -- William King Sun, 15 Nov 2009 16:38:13 -0800 - -freeswitch (1.0.4-1) unstable; urgency=low - - * new - - -- Mike Jerris Mon, 18 Feb 2009 17:39:00 -0500 - -freeswitch (1.0.3-1) unstable; urgency=low - - * build: add targets cd-sounds[-install] and cd-moh[-install] for 48k sounds (r:11151) - * build: autoconf detect odbc library (FSBUILD-8) - * build: fix sound install on windows build (r:11635,11638) - * build: fix configure --sysconfdir (FSBUILD-84) - * build: fix uclibc build (MODLANG-99) - * build: fix adduser in debian (FSBUILD-122, FSBUILD-102) - * core: fix buffering issues (r:11101,11145,11152-11157,11162,11191,11200) - * core: fix c leg no hangup when converting attended to blind transfer before b leg answers (MODENDP-165/r:11061) - * core: fix codec and media handling issues (r:11104) - * core: fix double close of file handles and add recording of native files (r:11108-11113,11482,11483) - * core: fix file resampling issue (r:11090) - * core: fix incorrect call progress timestamps in timetable (r:11186-11187/FSCORE-268) - * core: fix media handling issues (r:11079-11082) - * core: fix multiple 2833 dtmf handling issues (r:11149,11261,11262,11266,11293,11294,11338/FSCORE-266,FSCORE-273) - * core: send more event types verbos bridge,unbridge,park,unpark (r:11097-11098) - * core: Prevent media setup on failed originates (r:11462/FSCORE-279) - * core: fix recorded soundfiles had random data at end of file (r:11491/MODAPP-205) - * core: fix user for windows service (r:11538/FSCORE-277) - * core: modify variable expansion code to expand in more places and to fix potential security issue from injecting variables (r:11569,11570) - * core: look for soundfiles in more locations based on rate (r:11601/MODFORM-23) - * core: state machine veto behavior changed (r:11610) - * core: add enable_file_write_buffering variable (r:11677) - * core: fix garbled audio on media bug during bridge using stateful codecs (FSCORE-288) - * core: fix tone detect running multiple bugs when detecting multiple tones - * core: add {instant_ringback=true} to make ringback not wait for indication to generate ringback - * core: fix segfault from race condition on multiple reloadxml calls (MOODAPP-211) - * core: modify xml locking so phrases do not lock the xml for the duration of playing them - * core: replace resampler with the speexdsp resampler - * core: fix windows calling convention on threads launched that return a value to fix shutdown segfault (FSCORE-298) - * core: do not auto-export origination_caller_id_* to avoid confusion (r:12052) - * core: API visibility support (GCC/SUNCC) (FSCORE-264) - * core: fix leak in exposed event class serialize method (r:12068) - * core: add volume as possible return value from input callback on embedded languages (r:12114) - * core: add resampler to seech handles (r:12141) - * core: add api.getTime to embedded languages (r:12149) - * freeswitch: allow you to specify -htdocs dir at runtime. (r:11614) - * fs_cli: add "debug" command to change the esl debug level at runtime (r:11057) - * iksemel: update to 1.3 (r:11645) - * libesl: fix disconnect failure (r:11078,11083) - * libesl: fix solaris build (r:11067,11068) - * libesl: add c++ wrapper and swigged wrappers for multiple scripting languages - * libg722_1: fix dct4.h code generator to include the "f" (r:11188-11189,11367) - * libilbc: update to new library from Steve Underwood - * mod_amrwb: add amr wideband passthrough codec (r:11971) - * mod_cepstral: fix failure return code handling (MODASRTTS-9) - * mod_conference: add 'conference xml_list' and 'conference [conf_name] xml_list' (r:11062-11063) - * mod_conference: make conference verbose-events param to control if events have all the channel data or not (r:11073-11077) - * mod_conference: add MINTWO flag to end conference when down to 1 participant (r:11523) - * mod_conference: refactor conference record function (r:11626) - * mod_conference: add conference list summary command (MODAPP-197) - * mod_conference: fix Deadlock or coredump on conference commands play, transfer (MODAPP-209) - * mod_dahdi_codec: added (MODCODEC-7) - * mod_dialplan_xml: make previous auto hunt feature optional and off by defaule use auto_hunt=true session or global variable to enable (r:12144) - * mod_dptools: Add failure_causes channel variable (r:12058) - * mod_easyroute: add configuration file example for custom-query (r:11055) - * mod_easyroute: add custom-query configuration option (r:11054) - * mod_easyroute: fix build error when not configured for odbc (r:11478) - * mod_easyroute: fix memory leak (r:11611) - * mod_erlang_event: add ability to spawn a process (module/function) outbound on a specified node. (r:11460,11477) - * mod_erlang_event: Fix some issues with standing up a new outbound listener and cleaning up after a failed session (r:11479) - * mod_erlang_event: Fix setting up a listener for an outbound session if one doesn't already exist (r:11488) - * mod_erlang_event: add "erlang" fscli command (r:11488) - * mod_erlang_event: Monitor spawned outbound processes for premature exits (r:11489) - * mod_erlang_event: Allow the event encoding strategy to be configurable; choices are string or binary (r:11495) - * mod_erlang_event: Allow certain tuple elements to be binaries or strings, to reduce conversion requirements on the erlang side (r:11496) - * mod_erlang_event: Support sending a message to a registered process to request a pid (when spawning won't cut it) (r:11499) - * mod_erlang_event: Ensure events received while a pid session is being created aren't discarded but are queued instead (r:11500) - * mod_erlang_event: Add freeswitch.erl - An erlang module to make talking to mod_erlang_event more painless (r:11525) - * mod_erlang_event: use rpc:call instead of spawn and to make the registered process argument to handlecall optional (r:11542) - * mod_event_socket: add ability to use a comma sep list of events on event-sink create-listener (r:11056) - * mod_event_socket: add debug logging to event-sink (r:11060) - * mod_event_socket: fix race condition (r:11680,12146) - * mod_dptools: add all modifier to break command (r:11557,11558) - * mod_dptools: add sound_test application (r:11658) - * mod_fax: Dont hangup after sending/receiving faxes - * mod_fifo: pause media bugs while not in a bridge (r:11466,11490) - * mod_fifo: allow unpark during chime list playing (r:11555/MODAPP-206) - * mod_fifo: fix outbound fifos doesn't check if the consumer is in the fifo in question. (r:11561/MODAPP-207) - * mod_fifo: Fix segfault when no argument were supplied to fifo_member call (MODAPP-210) - * mod_lcr: added (r:11180,11184,11532,11609) - * mod_limit: fix memory corruption caused by race condition when using limit hash (r:11070-11071) - * mod_limit: Fix transfer bug, fix leak and make the channel hangup if the extension is \!hangup_cause (r:11604,11932) - * mod_limit: add write different channel variables per realm_id (r:11608) - * mod_limit: Make max argument optional on the limit app, set the limit_usage variable to current count after inserting call in the db (r:11955) - * mod_lua: Create empty argv table when no args are passed to a Lua script (r:11559) - * mod_lua: use dll for lua windows build (FSCORE-299) - * mod_openmrcp: removed (r:11176-11179) - * mod_opal: added - * mod_pocketsphinx: fix leak (r:11974) - * mod_portaudio: fix stuck channels on outbound calls (r:11160,11470,11471,11472,11475,11476,11485) - * mod_python: fix build when site dir is not /usr/lib/python2.4 (r:12070) - * mod_say_en: add short form date/time (MODAPP-180) - * mod_sofia: add auto-rtp-bugs profile option to make rtp bug compensation configurable (r :11146-11147) - * mod_sofia: add support in sdp for a=maxptime (r:11103) - * mod_sofia: fix codec change race condition (r:11143) - * mod_sofia: fix notify event wasn't allowing content-length 0 (r:11106/MODENDP-167) - * mod_sofia: fix sending extra sdp in 200 OK when using 100rel in violation of sdp o/a protocol draft-ietf-sipping-sip-offeranswer-10 (r:11088) - * mod_sofia: fix sip_auto_answer=true (r:11069) - * mod_sofia: improve outbound registration error message (r:11059) - * mod_sofia: reset media timeout on re-invite (r:11161) - * mod_sofia: fix segfault due to missing contact header in invite (r:11463/MODENDP-177) - * mod_sofia: allow tag in gateways as well as with direction inbound/outbound (default both) and call counter (r:11468) - * mod_sofia: add support or SLA, works with Polycom and Snom(Sylantro mode). (r:11562/MODENDP-179) - * mod_sofia: tolerate missing user in the request uri (r:11636) - * mod_sofia: Add purpose=gateways and profile=[name] so xml_curl requests make sense (MDXMLINT-46) - * mod_sofia: Add disable-srv and disable-naptr params to sip profiles (default false) (MODENDP-183) - * mod_sofia: add outbound-proxy param (MODENDP-184) - * mod_sofia: fix segfault with stun-enabled=false (SFSIP-120) - * mod_sofia: Profile Name in Expire Event is incorrect (MODENDP-185) - * mod_sofia: add "scrooge" mode to "inbound-codec-negotiation" (r:11881) - * mod_sofia: Add context to reconfig_sofia (r:12080) - * mod_sofia: fix segfault when calling from a Cisco 7940 using bypass_media (FSCORE-301) - * mod_sofia: ilbc to default to 30 if no mode= fmtp is defined on the inbound (r:12110) - * mod_sofia: fix challenge-realm (r:12113) - * mod_sofia: Segmentation fault when running killgw command on sofia profile without specifying a gateway (MODENDP-189) - * mod_sofia: gateways will inherit the context from its parent unless manually provided (r:12138) - * mod_sndfile: Add IMA ADPCM support (MODFORM-22) - * mod_spidermonkey: fix loading of spidermonkey modules (r:11084-11085) - * mod_spidermonkey: block some unwanted behaviours in session.originate - * mod_spidermonkey_socket: fix gc blocking (MODLANG-97) - * mod_xml_rpc: fixed authentication using @domain syntax (r:11064) - * mod_xml_rpc: fix http content types sent in responses (r:11099,11148,11150) - * mod_voicemail: voicemail insert into the proper fields (MODAPP-190) - * mod_voipcodecs: add G.726 24k (r:12083) - * sofia-sip: update to current sofia-sip repository - * spandsp: sync to latest snapshot and fix windows build - * speex: updated to 1.2rc1 - * sqlite: fix random assert on windows (FSCORE-292) - - -- Mike Jerris Mon, 18 Feb 2009 17:39:00 -0500 - -freeswitch (1.0.2-1) unstable; urgency=low - - * all: don't add module interfaces before returning from error conditions in module load functions (MDXMLINT-36) - * all: fixed multiple memory leaks - * all: improved module unloading/reloading support - * build: add support for --switchconfdir (FSBUILD-84) - * build: fixed netbsd build - * build: make freeswitch stop graceflly with /etc/init.d/freeswitch stop on debian add working dir to start-stop-dir so freeswitch dumps core in workdir - * build: multiple packaging fixes - * build: user freeswitch not added to audio group on deb install (FSBUILD-95) - * Configuration: many updates to default configuration - * core: Add ability to choose uuid from originate string, originate_uuid var (use at your own risk) - * core: add bridge_generate_comfort_noise option for bridge to generate comfort noise to the A leg when there is no audio on the B leg - * core: add chan vars to param event during hangup hook - * core: add exec directive to xml preprocessor (not available on windows) - * core: add force_transfer_dialplan and force_transfer_context variables - * core: add hashing to event header lookup - * core: add hits to tone_detect - * core: add last_dtmf_duration variable - * core: add msleep function to swigged languages - * core: add park_after_bridge variable - * core: add per leg timeouts and specific cause codes in reject_on_single_fail - * core: add runtime selection of the module dir (FSCORE-198) - * core: add scheduler support for heartbeat - * core: add session heartbeat feature - * core: add session.destroy psuedo method to sort of destroy a session at least for the sake of FS - * core: add session.unsetInputCallback - * core: add strftime format string validation for user supplied values - * core: add vars param to switch_ivr_originate for recursion (MODAPP-175) - * core: added a "group" concept to the user directory - * core: added ability to do dns lookup to find ip with host: like stun: (FSCORE-219) - * core: added better locking for codec changes during a call - * core: added current_application and current_application_data variables - * core: added error/ magic endpoint so modules can return error causes in situations like sofia_contact - * core: added read_result channel variable - * core: added support for "F" to indicate flash in dtmf (FSCORE-213) - * core: allow calls to be stolen from originate - * core: allow you to get the privacy bits in the caller_profile - * core: change dso code to load symbols local - * core: changes core flags to be array based so we have more - * core: eavesdrop causes the people being eavesdropped on to not hear ach other (MODAPP-140) - * core: expose time table to variable interface via caller field lookup - * core: fix 100% cpu when sending parked call to moh (FSCORE-234) - * core: fix bridge app to make sure both channels are ready for media when one is only in ringing state - * core: fix buffer overflow (FSCORE-188) - * core: fix conference dial by allowing multiple braces in originate, fix bad pointer op (FSCORE-208) - * core: fix double detection of DTMF in IVR (FSCORE-221) - * core: fix hangup_after_bridge is false on a bridge started with the intercept app - * core: fix issue where pid file is accidentally truncated - * core: fix ivr timeout (FSCORE-181) - * core: fix memory leak in alias tab completion code - * core: fix min digits in read app - * core: fix out-of-bounds pointer in variable expansion (FSCORE-171) - * core: fix segfault in media bugs when in bypass media (FSCORE-193) - * core: fix segfault on gtalk to sip calls (FSCORE-212) - * core: fix segfault on reloadxml (FSCORE-176) - * core: fix segfault on trasfering eavesdopping party (FSCORE-210) - * core: fix segfault using switch_system function (FSCORE-196) - * core: fix session.bridge - * core: fix setting effective_caller_id_name / effective_caller_id_number on bridge dialstring (MODAPP-122) - * core: fix stream_raw_write (MODAPP-145) - * core: fix using resampling on ringback file - * core: fixed performance bottleneck in sqlite db's - * core: fixed race in reloadxml - * core: increment app before execute in case it returns to execute it will go to the next item in the list and not the same - * core: ivr menu max_failures and max_timeouts now default to 3 if not specified or invalid (less than 1) values are specified (FSCORE-244) - * core: ivr_menu max-timeouts option, result in ivr_menu_status var (FSCORE-183) - * core: let b legs use park_after_bridge too - * core: make events less verbose unless verbose_events is set - * core: parse private events during originate - * core: pass pdd data to a leg on oubound calls using bridge - * core: prevent crash in crazy situation with xml interface lookup failures (FSCORE-169) - * core: reduce cpu requirement for generated comfort noise - * core: remove interface names from core db on unload - * core: reworked timing resulting in significant performance increase and better rtp timing - * core: rewrite switch_play_and_get_digits (MODAPP-166) - * core: session.recordFile never terminates (MODLANG-79) - * core: session.transfer make dialplan and context optional - * core: set_user app now sets domain vars as well as user vars - * core: tone_detect not triggering app after tone detection (MODAPP-182) - * core: unprivileged user setting bigger stack for switch_system thread failure (FSCORE-197) - * core: user_exists returns false when fetching a user from XML Curl or other xml interfaces - * libesl: added c event socket library and fs_cli - * libsndfile: fix autoconf 2.62 support (LBSNDF-5) - * mod commands: add "all" modifier to "break" command - * mod_celt: added new module - * mod_commands: Add support for more than 2 variables to uuid_setvar_multi (MODAPP-171) - * mod_commands: Add support for passing the cause of hangup to the uuid_kill command (FSCORE-217) - * mod_commands: add attr lookup to user_data - * mod_commands: add domain_exists fsapi command - * mod_commands: add eval fsapi command - * mod_commands: add flush_dtmf app and uuid_flush_dtmf api command - * mod_commands: add fsctl send_sighup, fsctl shutdown asap, unsched_api commands - * mod_commands: add fsctl shutdown [elegant|restart|cancel] - * mod_commands: add new syntax to uuid_setvar to allow you to unset a var. [value] (MODAPP-167) - * mod_commands: add reload fsapi command to reload a module - * mod_commands: add system fsapi and application (MODAPP-138) - * mod_commands: added hupall fsapi command - * mod_commands: added strftime_tz api command - * mod_commands: break all now stops broadcast too - * mod_commands: fix api command sent through sched_api was getting the last char lopped off - * mod_commands: fix race on transfer with -both - * mod_commands: fix system dialplan app problems (MODAPP-86) - * mod_commands: only send content-type on status when it really is http. - * mod_conference: add fsapi to stop async playback too - * mod_conference: add video caps to mod_conference with video follow audio - * mod_conference: better sound prefix handling when using say: and allow say: on kick sounds. - * mod_conference: fix race in record - * mod_conference: fix runaway thread when floor holder has no video and other people do have video - * mod_conference: fix seg when kicking many members quickly (MODAPP-129) - * mod_conference: fix segfault on invalid chat event - * mod_conference: perpetual sound does not auto-mute, you can do that yourself if you want it - * mod_dialplan_xml: add Hunt- vars in dialplan lookup after transfer - * mod_dialplan_xml: fail call on extensions with nested conditions - * mod_dingaling: (LBDING-7) fix segfault on os x - * mod_dingaling: end call on ice timeout - * mod_dingaling: fix presence on jabber to be less protocol ambiguous - * mod_dingaling: fix segfault (LBDING-10) - * mod_dingaling: update to support latest client from google - * mod_dptools: add a mechanism to tell if a file played from sendmsg over event socket - * mod_dptools: add playback_terminator support to phrase and say app - * mod_dptools: add playback_terminator_used variable (MODAPP-132) - * mod_dptools: add presence application - * mod_dptools: fix originate api not parsing users properly (FSCORE-246) - * mod_dptools: fix record and record_session to create directory if it does not exist (FSCORE-250) - * mod_dptools: fixed limit and + parsing bug in record_session app (MODAPP-148) - * mod_dptools: remove_bugs added to remove all media bugs on a session - * mod_erlang_event: add new module - * mod_event_socket: missing : after Content-Length in event socket (MODEVENT-33) - * mod_event_socket: add event socket listener filters - * mod_event_socket: add stateful listener fsapi commands for ajax-y type event interface over http - * mod_event_socket: fix arg parsing errors (MODEVENT-34) - * mod_event_socket: fix shutdown segfault race (MODEVENT-32) - * mod_event_socket: inbound connection to event_socket can now take over an existing channel with 'myevents ' to take on the behaviour of an outbound socket - * mod_event_socket: let any channel get messages - * mod_event_socket: make event socket wait for hangup on outbound mode and send disconnect message - * mod_expr: fix endless loop - * mod_fax: new module - * mod_fifo: add fifo_consumer_wrapup_time var (MODAPP-117) - * mod_fifo: added callback agents - * mod_fifo: honor keyword silence (MODAPP-118) - * mod_flite: added windows build - * mod_fsv: fix in a windows enviroment opening the record file in text mode. (MODAPP-169) - * mod_http: added new module - * mod_java: updated to new module api to support read/write locks on interface - * mod_limit: accept dialplan context for transfer (MODAPP-161) - * mod_limit: added hashtable based limit functions - * mod_limit: prevent empty error log message (MODAPP-134) - * mod_local_stream: add start_local_stream and stop_local_stream fsapi commands to start/stop dynamically (MODFORM-13) - * mod_local_stream: fix leak and improve error checking - * mod_local_stream: fix seg when no timer name specified in config file. (MODFORM-16) - * mod_loopback: add new module - * mod_lua: add local scripts directory support (MODLANG-86) - * mod_lua: don't eval blank string - * mod_lua: fix originate - * mod_lua: fix segfault (MODLANG-77) - * mod_lua: update to lua 5.1.4 (MODLANG-87) - * mod_lumenvox: removed - * mod_managed: new module replaces mod_mono now supports native .net runtime on windows as well - * mod_opal: added to trunk (still very beta) - * mod_perl: fix segfault (MODLANG-77) - * mod_pocketsphinx: fix rpm build - * mod_portaudio: fix cpu race on inbound call to pa when no ring file is set - * mod_radius_cdr: dictionary update for cause code changes (MODEVENT-27) - * mod_radius_cdr: fix unload (MODEVENT-29) - * mod_shout: add stereo recording broadcast support - * mod_shout: added windows build - * mod_shout: fix segfault when recording mp3's (MODFORM-12) - * mod_shout: improved stability of mp3 decoding - * mod_siren: added new module - * mod_sndfile added support to record 16bit for the various rates including 48kHz - * mod_sofia: Add filter to "sofia status profile XXX" (MODENDP-138) - * mod_sofia: Add force-register-db-domain which works in conjunction with force-register-domain. - * mod_sofia: Add optional and tag to tag. - * mod_sofia: Challenge the right realm when to_host is outside the users domain. (MODENDP-136) - * mod_sofia: Improve notify messages through a proxy (MODENDP-147) - * mod_sofia: MWI for multiple domains (MODAPP-126) - * mod_sofia: Move "a=sendrecv" from session to media section of SDP (MODENDP-148) - * mod_sofia: add 200 OK re-invite without sdp - * mod_sofia: add custom sofia::gateway_state event (MODENDP-112) - * mod_sofia: add fire events for the refer SIP NOTIFY event package (MODENDP-152) - * mod_sofia: add more params for xml_curl directory lookup - * mod_sofia: add new auto vals for challenge-realm param - * mod_sofia: add option to turn of auto_restart of sofia profiles on ip change - * mod_sofia: add params to use sip callid as uuid on inbound calls and uuid as sip callid on outbound calls - * mod_sofia: add parsing of Privacy header for privacy info (MODENDP-133) - * mod_sofia: add proto_specific_hangup_cause to both legs - * mod_sofia: add proxy 3pcc mode - * mod_sofia: add redirect variable to channel as well as partner channe (MODENDP-135) - * mod_sofia: add sip-forbid-register to user params to refuse to let a certian user register - * mod_sofia: add sip: into register-proxy when it's not specified - * mod_sofia: add sip_history_info var for inbound invites. - * mod_sofia: add sip_via_protocol variable - * mod_sofia: add sofia xmlstatus (MODENDP-156) - * mod_sofia: add support for params other than Replaces in Refer-To (MODENDP-143) - * mod_sofia: add support for profiles sharing databases so that you can have a domain that uses multiple profiles for split dns type setups - * mod_sofia: add support for refer transfer involving multiple machines - * mod_sofia: add support to send a notify in the invite dialog by specifying the uuid of the call. (SFSIP-92) - * mod_sofia: add suppress_from_cidname var to not have display name in from header (MODENDP-153) - * mod_sofia: added sip_hangup_disposition variable - * mod_sofia: allow send_message and notify events to send a message/notify without a body if needed. - * mod_sofia: append -1 .. -N postfix after any X-headers as vars that have the same name - * mod_sofia: cache auth_gateway_name in sofia for challenged bye - * mod_sofia: cancel proxy or no-media mode if you purposely answer or pre_answer - * mod_sofia: correct result code mapping for Unallocated Number (MODENDP-124) - * mod_sofia: disable 100rel by default - * mod_sofia: don't accept crypto in the RTP/AVP (MODENDP-126) - * mod_sofia: don't put CN in sdp answer if it was not in the offer. - * mod_sofia: fix Incorrect IP address shows up in SDP "o" field when multiple external IPs available and FS not bound to first (MODENDP-132) - * mod_sofia: fix Wrong RTP media port destination after reinvite/UNHOLD (SFSIP-82) - * mod_sofia: fix bug on linksys where they lie about the ptime and handle linksys transfer problem - * mod_sofia: fix chat (send an IM) assumes that the user's profile is the same as their domain, which isn't necessarily so (SFSIP-83) - * mod_sofia: fix dtmf handling of broken info dtmf endpoints - * mod_sofia: fix eyebeam presence to be RFC compliant (MODENDP-144) - * mod_sofia: fix ip change detection when in proxy mode - * mod_sofia: fix register_proxy ignoring the paramaters (MODENDP-121) - * mod_sofia: fix remote session refresh triggers request glare (MODENDP-131) - * mod_sofia: fix rtp auto adjust running when it should not - * mod_sofia: fix rtp sent to wrong port after some re-INVITE scenarios (MODENDP-141) - * mod_sofia: fix sending of cn packets across bridge when we shouldn't - * mod_sofia: fix sqlite issue with select of the sip contact - * mod_sofia: fixed segfault on invalid presence payload - * mod_sofia: gateway ping needs to look for 501 (SFSIP-78) - * mod_sofia: handle multi contact register responses and register timeout better - * mod_sofia: improve gateway resilience - * mod_sofia: log ip and port you get reply to invite from - * mod_sofia: make multiple-registations=true use the contact method and call-id option to do it the old way - * mod_sofia: make proxy mode pull the port from m=image as well - * mod_sofia: make register-proxy preserve the url composed from proxy but target the packets to desired address (MODENDP-121) - * mod_sofia: many fixes for sonus rtp issues silence_when_idle=400 chanvar to send generated silence duing sleeps etc - * mod_sofia: many fixes in presence handling - * mod_sofia: passthrough t.38 fixes - * mod_sofia: pick ipv4 or ipv6 based on sipip instead of having mixed in sdp - * mod_sofia: send NOTIFY on TCP/UDP depending on the SUBSCRIBE (SFSIP-104) - * mod_sofia: setting profile option multiple-registrations=contact key multi reg off the contact string - * mod_sofia: wait for a reply on refer - * mod_soundtouch: fixes and improvements, many options changed (MODAPP-149) - * mod_soundtouch: updated to new module api - * mod_spidermonkey: Segmentation fault in check_hangup_hook at mod_spidermonkey.c:1589 (MODLANG-74) - * mod_spidermonkey: fix bug in apiExecute - * mod_spidermonkey: fix memory pool handling and leaks - * mod_spidermonkey: limit recursion busting through the stack (FSCORE-202) - * mod_spidermonkey: make session.getVariable return blank string not the word false - * mod_spidermonkey_curl: add optional content-type arg - * mod_spidermonkey_odbc: fix numRows and add numCols - * mod_spidermonkey_odbc: fix segfault (MODLANG-75) - * mod_stress: new module for voice stress analysis - * mod_syslog: don't log blank lines (FSCORE-163) - * mod_tone_stream: let silence_stream://0 indicate perpetual silence - * mod_vmd: add new module to detect voicemail "beep" - * mod_voicemail: Add vm_alternate_greet_id param to directory entry (MODAPP-174) - * mod_voicemail: Patch to add voicemail preference controlling date announcement new param 'play-date-announcement' to values 'first' 'last' or 'never' defaults to first to retain previous behavior (MODAPP-121) - * mod_voicemail: Update mwi light after delete vm via web. (MODAPP-124) - * mod_voicemail: add ability to get to options without listening to every saved message (MODAPP-115) - * mod_voicemail: add ability to skip greeting when leaving a voicemail. (MODAPP-181) - * mod_voicemail: add change-pass-key config file option - * mod_voicemail: add forwarding support - * mod_voicemail: add local dtmf driven alternat vm pass - * mod_voicemail: add proper notification of a vm message being too short - * mod_voicemail: add support for auth via a1-hash - * mod_voicemail: add the "storage-dir" parameter to be set on a per-user basis (MODAPP-133) - * mod_voicemail: add voicemail_greeting_path variable - * mod_voicemail: added voicemail_alternate_greet_id variable - * mod_voicemail: allow changing of password from voicemail to update user directory if using non-static config (MODAPP-156) - * mod_voicemail: created email date (int overflow) (MODAPP-125) - * mod_voicemail: don't try to deliver vm when no file was recorded. (MODAPP-133) - * mod_voicemail: fix MWI with xml_curl used for directory (MODAPP-176) - * mod_voicemail: fix Voicemail messages occasionally lost / stranded (MODAPP-178) - * mod_voicemail: fix invalid event after message deleted (MODAPP-170) - * mod_voicemail: fix mwi for phones with multiple registrations problem (MODAPP-153) - * mod_voicemail: fix voicemail segfault on incorrect password (FSCORE-187) - * mod_voicemail: fix voicemail_inject error handling (MODAPP-133) - * mod_voicemail: fix voicemail_inject usage api call - * mod_voicemail: improve error checking (MODAPP-142) - * mod_voicemail: localize notification emails (MODAPP-139) - * mod_voicemail: make more multi-domain friendly (MODAPP-162) - * mod_voicemail: make playback created file macros optional (MODAPP-150) - * mod_voicemail: recognize operator key in more places (MODAPP-159) - * mod_voicemail: web interface displays incorrect created / last heard dates (MODAPP-123) - * mod_wanpipe: removed - * mod_xml_cdr: add https support - * mod_xml_cdr: add optional a-leg prefix to xml cdr filenames (MDXMLINT-39) - * mod_xml_cdr: add support for fallback webserver for cdr posting (FSCORE-238) - * mod_xml_curl: Allow specification of HTTP method, and dynamic expansion of variables in URI. (MDXMLINT-41) - * mod_xml_curl: added redirect following (max 10) - * mod_xml_ldap: almost a complete rewrite of this module - * mod_xml_rpc: allow setting of global realm without a global user (MDXMLINT-45) - * mod_xml_rpc: fix multiple segfaults - * mod_xml_rpc: fix segfault on originate via http - * sofia-sip: updated to 1.12.10 (plus a few patches) - - -- Mike Jerris Mon, 29 Dec 2008 14:46:00 -0500 - -freeswitch (1.0.1-1) unstable; urgency=low - - * FIX: prevent intercept race condition that can also be solved with continue_on_fail=originator_cancel - * FIX: NULL dereference detected by klockwork (www.klockwork.com) - * FIX: don't open failed local stream (MODFORM-9) - * FIX: instability in mod_local_stream in failure scenarios - * FIX: xmlrpc-c build on OS X 10.4 (FSBUILD-47) - * ENHANCEMENT: Added tab completion on many api commands in console - * ENHANCEMENT: polycom BLF support - * FIX: many sip NAT related fixes in mod_sofia - * FIX: support sip unregister with Contact: * - * FIX: multiple segfaults in xmlrpc-c - * FIX: sip unregister event being skipped - * FIX: hangup properly on malformed sip 3pcc calls being used as a way to ping - * ADD: enable-3pcc sofia profile param, it is now disabled by default. - * ADD: presence events to sip proxy mode - * ADD: legs param to cdr_csv - * ADD: support for perl as an embedded lanugage - * ENHANCEMENT: many new api's and functions to the embedded languages including api support, xml interface support, auto start scripts, and many new objects - * CHANGE: python embedded language api changed to match perl, lua, java - * FIX: many stability fixes in embedded langauges perl, lua, java, python - * ADD: failed_xml_cdr magic channel variable - * FIX: access free memory error in mod_sofia when using respond app - * ENHNACEMENT: make global_setvar only have 2 fields so you can set foo=bar=blah w/o quotes - * FIX: mod_spidermonkey keep hangup hook in the session thread - * ENHANCEMENT: mod_ldap added sasl support and search filters - * ADD: answered, waitForAnswer and mediaReady methods to embedded language Session object - * ENHANCEMENT: mod_voicemail param change to allow notification emails using templates - * ADD: per user acl in sofia - * FIX: deadlock in mod_portaudio - * ENHANCEMENT: blank username in sip will trigger a lookup for the user "nobody" - * ADD: import variable to import variables from a peer channel at time of originate - * FIX: api type fix for c++ modules when incorrectly using enums - * FIX: eliminate need for escaped , in [] on originate - * ADD: NDLB-force-rport option to force behavior as if rport was sent in the via - * ENHANCEMENT: honor execute_on_answer on outbound legs too - * ADD: execute_on_ring variable - * FIX: Seg fault in CoreSession() class destructor - * ADD: per channel caller id in originate - * ADD: sip_outgoing_call_id variable - * FIX: multiple memory leaks in mod_sofia - * FIX: find_local_ip IPv6 support - * ADD: variable expansion to on execute vars.(FSCORE-114) - * ADD: count optional arg to show calls and show channels (MODAPP-103) - * FIX: MODEVENT-25 (WSAWOULDBLOCK error on socket send in windows) in event socket - * FIX: multiple fixes to the logic in mod_say_zh - * ADD: inter digit timeout to swigged embedded languages getDigits method. (MODLANG-65) - * ADD: Linksys P-RTP-Stat SIP header values (SFSIP-66) - * FIX: small leak in core - * ADD: progress_timeout var to originate - * UPDATE: portaudio library - * FIX: added timeout to iax read - * ADD: 'pa rescan' to portaudio to look for new devices - * FIX: wait for broadcast to start when starting async hold to avoid race - * FIX: mod_rss, don't always play the first news feed - * FIX: mod_rss inverval to use the session inteval (audio problems on 30ms channels) - * ADD: Path: support in mod_sofia on register - * FIX: mod_shout record stream - * ENHANCEMENT: mod_voicemail support for effective_caller_id_name/number - * ADD: url encode/decode api calls - * FIX: "nua()" in debug information in sofia instead of the real function name - * FIX: better handling of sips: uris - * FIX: don't seg when using more than SWITCH_MAX_CODECS and bump SWITCH_MAX_CODECS to 50 (we have more than 30 in tree) (MODFORM-10) - * ADD: mod_yaml - * FIX: segfault on freeswitch startup if installed directories are removed - * FIX: segfault when intercept with inbound_late_negotiation=true set - * FIX: dont flood logs with eavesdrop messages (MODAPP-101) - * FIX: don't destroy a codec that has not been created (MODAPP-101) - * ENHANCEMENT: allows the "eavesdrop_group" variable to contain several groups, comma separated. (MODAPP-101) - * FIX: cross compile (FSBUILD-53) - * FIX: add header that Nuaunce considers mandatory (MODASRTTS-5) - * ADD: write locks to the core and a function to unregister event bindings (adds better ability to unload modules) - * ENHANCEMENT: make modules unbind events and un-reserve subclasses on module unload - * ADD: removable xml hook bindings - * ADD: EventConsumer object to embedded languages so you can make event handlers - * FIX: sending CN with supress-cng true - * FIX: segfault in the event system when trying to remove NULL event - * ADD: flags to turn off srtp auth and rtp auto adj (FSCORE-149 && MODENDP-115) - * FIX: use lighter math and avoid infinite loop in port allocator (FSCORE-148) - * ENHANCEMENT: let conference pin entry start during prompt (MODAPP-111) - * ADD: mod_pocketsphinx - * FIX: Misuse of SQLRowCount, issues with MSSQL (MODAPP-105) - * FIX: segfaults in mod_python with dtmf callback - * ENHANCEMENT: mod_conference auto-record parameter (MODAPP-112) - * ENHANCEMENT: reload support to many modules - * FIX: mod_sofia add replaces to supported header - * ENHANCEMENT: add args callback to sleep so you can process dtmf and events while "sleeping" - * ADD: mod_flite - * ENHANCEMENT: switch_xml converted back to c code and support double globs on windows - * ENHANCEMENT: mod_sofia support for adding and removing gateways without restarting profiles - * ADD: extract contact header info into A channel when unhandled 3xx response is received (MODENDP-116) - * FIX: outbound event_socket + late negotiation - * ADD: copy_xml_cdr variable - * ADD: silence_stream (like tone_stream but silent) - * ADD: module_exists api call - * ADD: emailer implementation for windows - * ADD: wait_for_silence application - * FIX: no error message generated if OS is unable to load a module ( due to dependency/installation issues ) - * FIX: segfault in media bugs - * FIX: acl lists not correctly matching all ip adresses - * FIX: mod_spidermonkey exit() does not stop script when called from the hangup callback (return "exit" from the callback) - * FIX: mod_syslog works again - * FIX: crash on terminal resize - * FIX: audio problems on big endian - * ENHANCEMENT: Disable multiple registrations on a per-device basis (MODENDP-117) - * ADD: fifo_consumer_exit_key variable (MODAPP-100) - * ADD: cidr based user auth in mod_sofia - * ADD: uuid_send_dtmf fsapi command (MODAPP-114) - * ADD: server registration fiels to sip_registration database (MODENDP-118) - * FIX: use a variable, realm or to host to find gateway when it's not obvious (handles challenged REFER) - * ADD: timeout to curl run in javascript - * ADD: voicemail_inject fsapi command - * ADD: reboot option for sip phones to flush_inboud_reg sofia profile api command - * FIX: add small padding to end of mp3 to avoid cut off mp3 recording - * FIX: patch multiple SDP connection lines in sdp for proxy media mode (MODENDP-109) - * FIX: don't parse ringback variable in proxy situations - * ADD: per call vm recording ext with vm_message_ext variable - * ADD: sip_bye_h prefix to add headers to bye - * ENHANCEMENT: more interfaces available in show fsapi command - * FIX: don't leak in buffers on realloc fail - * FIX: fail out of a conference call if write fails - * ADD: auto ip-change detection - * ADD: mod_snom - * FIX: mod_sofia don't send sipfrag on transfer to cisco so they don't hang up the call - - -- Mike Jerris Thu, 24 Jul 2008 07:00:00 -0500 - -freeswitch (1.0.1~trunk) unstable; urgency=low - - * Updated revision number - * Fixed init problem reported by Jay Binks (FSSCRIPTS-1) - * Added a patch to the debian build system add more features (thanks to Hadley Rich) (FSBUILD-45) - - Added en-us-callie sounds and music on hold packages - - Added recommends and suggests - - Added mod_say_es and mod_say_nl - - Updated descriptions - - Added mod_cdr_csv - * Fixed typos and some errors in the previous patch. - * Modified monit script. Now it should work. - * The debian build system now bootstrap automagically if it's necessary and all scripts are in place. - - -- Massimo Cetra Sun, 6 Jul 2008 16:30:00 +0100 - -freeswitch (1.0.0-1) unstable; urgency=low - - * Enhanced sofia sip nat handling - * Many fixes found by Klockwork (www.klocwork.com) - * Added disable_app_log variable - * Fixed mod_local_stream with rates on windows - * Fixed finding of files in rate dirs on windows - * Fixed memory corruption from sofia_contact function - * Added sofia profile param NDLB-received-in-nat-reg-contact - * Added sofia profile param aggressive-nat-detection - * Fixed video sip calls in proxy media mode - * Added bridge_terminate_key var - * Update xmlrpc-c lib to trunk revision from upstream, fix windows xmlrpc - * Enhanced nat handling in proxy media mode in sip - * Add progress media to timetable so you can calculate pdd - * Fixed seg when using unicast on socket when call has no read_codec - * Fixed missed log events on busy box - * Added -bleg to intercept - * Enhance configure detection of python - * Fixed build on solaris and freebsd for several modules - * Added param "vm-email-only" to make voicemail sent by email only (previously default behavior) - * Added param "vm-mailto-notify" to allow sending a notification email - * Fixed mod_java build - * Fixed mwi failures for some devices that don't subscribe - * Removed fsapi functions (killchan, transfer, session_displace, reject) - * Removed fsapi functions (session_record, broadcast, hold, media) - * Many updates to sofia-sip library including over 100 fixes - - -- Michael Jerris Tue, 27 May 2008 01:30:00 -0400 - -freeswitch (1.0~rc6-1) unstable; urgency=low - - * Changed to not allow pass_2833 on transcoded calls - (it never worked, now it will tell you) - * Enhanced sofia sip nat handling - * Fix libedit build on solaris - * Fix session timers in mod_sofia - * Fix conference fire-call - * Change: add var_event down into the endpoints so chans - with no parents can still pass options - * Added enable-post-var param to xml_rpc - * Fix mod_lua build on solaris - * Many fixes found by Klockwork (www.klocwork.com) - * Add unregister event in mod_sofia - * Enhance python configure detection - * Add vm_boxcount api func - * Fixed att_xfer issue - * Fix sip now includes the Allow-Events header in more places - - -- Michael Jerris Tue, 13 May 2008 02:01:00 -0400 - -freeswitch (1.0~rc5-1) unstable; urgency=low - - * Changed internal state names to avoid confusion - Fixed video negotiation - Enhanced accuracy of windows timer - Fixed mod_ldap build - Added dialplan and context to sql table for channels - Multiple fixes to mod_lua and mod_perl - Fixed logic bug in fifo causing segfault - internal changes to sip stack so we can remove a hash redundant to the stack - Fixed multiple memory leaks in mod_sofia - Fixed event fetch segfault on sip subscribe - Fixed segfault on timer rollover in sofia on 64bit - Fixed audio timing issues in mod_portaudio - Changed names of sip profiles in default config to avoid confusion - Fixed memory usage leak-like behavior when playing files requiring resampling - Removed some unused api's - Fix rtp timeout when playing moh - Removed some un-needed libraries and files from tree - Fixed multiple issues in sip stack including multiple segfaults - Added support for sip transfers on bypass_media and proxy_media calls - Added say application - Fixed --disable-debug configure option - Enhanced switch_cpp wrapper (and perl, python, lua, java) - Fixed segfault on inavalid stun response - Fixed configure help output - Fixed segfault on mp3 playback - Fixed assert on invalid sdp (missing m= line) - Added configurable windows service name - Fixed proxy mode call transition to non proxy call - Fixed solaris build of voipcodecs - Fixed sofia seg when call failure edge case - - -- Michael Jerris Tue, 13 May 2008 02:01:00 -0400 - -freeswitch (1.0~8327) unstable; urgency=low - - * Adding perl and lua separate packages - * Adding mod_voipcodecs - - -- root Tue, 6 May 2008 09:46:26 +0000 - -freeswitch (1.0~rc4-1) unstable; urgency=low - * Add tab completion in cli - Add "inline" dialplan - Fixed segfault in enum - Enhance enum to fork dial equal priority entries - Added auto-reload to enum - Fixed odbc bug is mod_sofia presence handling - Add presence for conference and dial an eavesdrop - Fix stack overflow segfault when recursively parking calls - Fixed race is sofia registration handling - Enhance sofia registration, unregister on keep-alive OPTIONS failure - Added internal routing loop detection/avoidance - Fixed race in bgapi in event socket - Fixed vars to execute apps before bridge "bridge_pre_execute_aleg_app" and "bridge_pre_execute_bleg_app" - Fixed re-setting sound prefix to no prefix after a pharse - Enhanced setting of bracket vars from originate so they show in the CHANNEL_ORIGINATE event - Add "enable-timer" and "enable-100rel" options to turn off default behaviors in sofia - Add originate_timeout to originate vars - Fixed hanging channels in mod_portaudio - Added auto time sync on vps migration to different hardware - Fixed seg on transfer when both legs are not sip - Added configurable dtmf duration defaults - Enhanced voicemail, allow interruption of hello message - Fixed voicemail to not light up light on saved messages - Enhance mod_amr honor disable dtx in fmtp (MODCODEC-3) - Fixed bootstrap to install automake dependencies so you can use tarball without same version of automake installed - Fixed MODLANG-56 (bad audio on originate and javascript streamFile) - Added hold/unhold dialplan apps - Enhanced sofia error checking to outlaw 0.0.0.0 in sofia ip params - Backport fixes from sofia-sip tree - Fixed MSVC build - Fixed segfault on sip SUBSCRIBE with Expires: 0 - Added mod_say_zh - Added --with-pyton and --with-pyton-config configure options - Added mod_lua - Enhanced switch_cpp wrapper in core and normalized interfaces for perl, python, lua, and java - Fixed multiple issues in cpp wrapper and the languages perl, python, lua and java - Added back mod_perl - Added sofia gateway option ping to adjust options ping frequency - Added .net event socket lib to contrib - Fixed passing of exact response codes of sip across a bridge - Added mod_reference, reference endpoint module - Enhanced build so you can now make commented out modules using "make mod_name" - - -- Michael Jerris Wed, 23 Apr 2008 12:58:00 -0400 - -freeswitch (1.0~rc3-1) unstable; urgency=low - * Enhance xml menu system - fixes upstream from sofia-sip library - Enhance mod_fifo - added close method to ODBC spidermonkey class - Fix multiple bugs in the cpp wrapper used in mod_java and mod_python - Fix hung sip channel issue using respond app or on re-invite with bypass media after 1xx or 2xx responses - - -- Michael Jerris Wed, 9 Apr 2008 12:58:22 -0400 - -freeswitch (1.0~rc2-1) unstable; urgency=low - * Fixed speex protocol negotiation issues (8k vs 16k) - Fixed mod_iax race conditions - Fixed ptime negotiation issues when re-packetizing - Added ip based acl lists - * - -- Michael Jerris Wed, 9 Apr 2008 12:58:22 -0400 - -freeswitch (1.0~rc1-1) unstable; urgency=low - * loads of fixes - new cdr-csv module - new spidermonkey-curl module - - -- Michal Bielicki Mon, 14 Jan 2008 23:37:04 +0100 - -freeswitch (1.0~beta3-1) unstable; urgency=low - - * Additional scripts for changing the user to freeswitch - Added Startup Scripts - Monit integration - Settings file for integration into init - init.d file - added user freeswitch to own and run all off freeswitch - cleaned up config file control - new upstream release - split off codec pakcages - split off spidermonkey packages - - -- Michal Bielicki Tue, 27 Nov 2007 13:20:21 +0100 - -freeswitch (1.0~beta2-1) unstable; urgency=low - - * New upstream release - - -- Paul van Genderen Wed, 17 Oct 2007 19:32:09 +0200 - -freeswitch (1.0~beta1-1) unstable; urgency=low - - * New packages. - - -- Robert McQueen Sun, 12 Nov 2006 17:32:23 -0500 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/debian/control b/debian/control deleted file mode 100644 index 7b1f3e2a78..0000000000 --- a/debian/control +++ /dev/null @@ -1,279 +0,0 @@ -Source: freeswitch -Section: comm -Priority: extra -Maintainer: FreeSWITCH developers -Uploaders: Michal Bielicki , Gabriel Gunderson , William King , Mathieu Parent -Build-Depends: debhelper (>= 7), wget, automake (>=1.9), autoconf, libtool, - unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, - libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, - libdb-dev, libgnutls-dev, libtiff4-dev, python-dev, libx11-dev, uuid-dev, - libc6-dev (>= 2), bison, gawk -Homepage: http://freeswitch.org/ -Standards-Version: 3.9.3 -Vcs-Git: git://git.freeswitch.org/freeswitch.git -Vcs-Browser: http://fisheye.freeswitch.org/browse/freeswitch.git - -Package: freeswitch -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Recommends: freeswitch-lang-en -Suggests: freeswitch-spidermonkey, freeswitch-lua, freeswitch-perl, - freeswitch-sounds-music-8000, monit, openssl -Description: open source telephony platform - 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 is the main package that includes the FreeSWITCH daemon and most modules. - -Package: freeswitch-dbg -Section: debug -Architecture: any -Depends: ${misc:Depends}, freeswitch (= ${binary:Version}) -Description: debugging symbols 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 includes the debugging symbols useful for debugging FreeSWITCH. - The debugging symbols are used for execution tracing and core dump analysis. - -Package: freeswitch-dev -Section: libdevel -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: development libraries and header 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 include files used if you wish to compile a package - which require FreeSWITCH's source file headers. - -Package: freeswitch-spidermonkey -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: Javascript engine 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_spidermonkey language module. - -Package: freeswitch-perl -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: Perl engine 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_perl language module. - -Package: freeswitch-lua -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: Lua engine 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_lua language module. - -Package: freeswitch-python -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: Python engine 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_python language module. - -Package: freeswitch-codec-passthru-g7231 -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: pass through g723.1 codec support 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_g723_1 codec module. - -Package: freeswitch-codec-passthru-amr -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: pass through AMR codec support 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_amr codec module. - -Package: freeswitch-codec-passthru-amrwb -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: pass through AMRWB codec support 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_amrwb codec module. - - -Package: freeswitch-codec-passthru-g729 -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: pass through g729 codec support 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_g729 codec module. - -Package: freeswitch-lang-en -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Recommends: freeswitch-sounds-en-us-callie-8000 -Suggests: freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000, - freeswitch-sounds-en-us-callie-48000 -Description: English 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_en module and available language - configuration files. - -Package: freeswitch-lang-de -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: German 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_de module and available language - configuration files. - -Package: freeswitch-lang-fr -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: French 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_fr module and available language - configuration files. - -Package: freeswitch-lang-it -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: Italian 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_it module and available language - configuration files. - -Package: freeswitch-lang-es -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: Spanish 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_es module and available language - configuration files. - -Package: freeswitch-lang-nl -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: Dutch 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_nl module and available language - configuration files. - -Package: freeswitch-lang-ru -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Recommends: freeswitch-sounds-ru-ru-elena-8000 -Suggests: freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-32000, - freeswitch-sounds-ru-ru-elena-48000 -Description: Russian 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_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 -Description: FreeTDM is a signaling and board API abstraction used mainly by the - FreeSWITCH project to place calls in TDM and analog telephony circuits. The library - was previously named "OpenZAP". Sangoma has worked along with the FreeSWITCH - developers in this library so Sangoma's customers can also use it to do custom - development. The library is still under heavy development but the overall API - does not change often. The intention of the library is to present a consistent - API for different telephony signaling stacks and board I/O APIs. FreeTDM can - either be used as a standalone API or along with FreeSWITCH as an endpoint - (mod_freetdm). If you want to use it as a part of FreeSWITCH remember following - the FreeSWITCH configuration section. - This package contains all the freetdm modules and libs and submodules diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index f95b7df2e0..0000000000 --- a/debian/copyright +++ /dev/null @@ -1,538 +0,0 @@ -This package was debianized by Michal Bielicki - on Nov 25, 2007. - -The source was downloaded from http://www.freewitch.org/ - -Upstream maintainers: - Current: Michal Bielicki - Past: Nicholas Amorim -See changelog.Debian.gz for a full list of contributors. - -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. - - The PRIMARY AUTHORS are (and/or have been): - - Anthony Minessale II - Primary developer of all core - components and many of the included modules. Much of freeswitch is based - on his work. - - Michael Jerris - Windows porter and responsible for the - windows\msvc build system. - -And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- -people who have submitted patches, reported bugs, and generally made Freeswitch -that much better: - - Brian K. West - For countless hours of work on BSD and Mac support, finding - countless bugs, and moral support. Xcode project files. - Joshua Colp - For his help making mod_exosip possible (which we are now - getting rid of but oh well), and for just being a swell guy! - Michal "cypromis" Bielicki (michal.bielicki AT voiceworks.pl) - Solaris - porting, and autotools enhancements, debian, rpm and solaris packaging. - James Martelletti - All around cool guy (mod_syslog) - Johny Kadarisman - Yossi Neiman of Cartis Solutions, Inc. - - implementation of mod_cdr (perldd, mysql, csv) - Stefan Knoblich - Sofia TLS, various patches and support. Thanks. - Justin Unger - Lots of help with patches and - SIP testing. Thanks! - Paul D. Tinsley - Various patches and support. - Ken Rice - - xmlcdr, sofia improvements, load - testing, 1 liners here and there. - Neal Horman - conference improvements, switch_ivr - menu additions and other tweaks. - Johny Kadarisman - mod_python fixups. - Michael Murdock - testing, documentation, bug - finding and usability enhancements. - Matt Klein - Jonas Gauffin - mod_cdr_odbc, - mod_spidermonkey_socket, Bugfixes and additions in mod_spidermonkey_odbc and - mod_spidermonkey, .net event socket library. - Damjan Jovanovic - mod_java - Juan Jose Comellas - Patch to switch_utils for arg - parsing. - Dale Thatcher - Additions to - mod_conference. - Simon Perreault & Marc Blanchet from Viagenie.ca - IPv6 Support. - -A big THANK YOU goes to: - - Justin Cassidy - Build related cleanups and automatic build setup. - Bret McDanel - Javascript Documentation, constant feedback and input, many - other things I am sure I am forgetting. - - - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``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 ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - - diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index e2957b06b5..0000000000 --- a/debian/dirs +++ /dev/null @@ -1,5 +0,0 @@ -opt/freeswitch/log -opt/freeswitch/db -opt/freeswitch/bin/scripts -etc/monit - diff --git a/debian/freeswitch-codec-passthru-amr.install b/debian/freeswitch-codec-passthru-amr.install deleted file mode 100644 index c66668b30f..0000000000 --- a/debian/freeswitch-codec-passthru-amr.install +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/mod/mod_amr.so* diff --git a/debian/freeswitch-codec-passthru-amrwb.install b/debian/freeswitch-codec-passthru-amrwb.install deleted file mode 100644 index 022462d001..0000000000 --- a/debian/freeswitch-codec-passthru-amrwb.install +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/mod/mod_amrwb.so* diff --git a/debian/freeswitch-codec-passthru-g7231.install b/debian/freeswitch-codec-passthru-g7231.install deleted file mode 100644 index 4a0ab0c2c9..0000000000 --- a/debian/freeswitch-codec-passthru-g7231.install +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/mod/mod_g723_1.so* diff --git a/debian/freeswitch-codec-passthru-g729.install b/debian/freeswitch-codec-passthru-g729.install deleted file mode 100644 index 0f94112f39..0000000000 --- a/debian/freeswitch-codec-passthru-g729.install +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/mod/mod_g729.so* diff --git a/debian/freeswitch-dev.install b/debian/freeswitch-dev.install deleted file mode 100644 index 9fcb97c816..0000000000 --- a/debian/freeswitch-dev.install +++ /dev/null @@ -1,5 +0,0 @@ -opt/freeswitch/include/* -opt/freeswitch/lib/*.a -opt/freeswitch/lib/*.la -opt/freeswitch/mod/*.a -opt/freeswitch/mod/*.la diff --git a/debian/freeswitch-freetdm.conffiles b/debian/freeswitch-freetdm.conffiles deleted file mode 100644 index f14e37f3db..0000000000 --- a/debian/freeswitch-freetdm.conffiles +++ /dev/null @@ -1,6 +0,0 @@ -opt/freeswitch/conf/tones.conf -opt/freeswitch/conf/autoload_configs/freetdm.conf.xml -opt/freeswitch/conf/pika.conf -opt/freeswitch/conf/freetdm.conf -opt/freeswitch/conf/wanpipe.conf -opt/freeswitch/conf/zt.conf diff --git a/debian/freeswitch-freetdm.install b/debian/freeswitch-freetdm.install deleted file mode 100644 index cdca887dd3..0000000000 --- a/debian/freeswitch-freetdm.install +++ /dev/null @@ -1,10 +0,0 @@ -opt/freeswitch/conf/tones.conf -opt/freeswitch/conf/autoload_configs/freetdm.conf.xml -opt/freeswitch/conf/pika.conf -opt/freeswitch/conf/freetdm.conf -opt/freeswitch/conf/wanpipe.conf -opt/freeswitch/conf/zt.conf -opt/freeswitch/lib/libfreetdm.so* -opt/freeswitch/mod/mod_freetdm.so* -opt/freeswitch/mod/ftm*.so* - diff --git a/debian/freeswitch-lang-de.conffiles b/debian/freeswitch-lang-de.conffiles deleted file mode 100644 index 5c1dded24e..0000000000 --- a/debian/freeswitch-lang-de.conffiles +++ /dev/null @@ -1,4 +0,0 @@ -/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 deleted file mode 100644 index 1b33ebec72..0000000000 --- a/debian/freeswitch-lang-de.install +++ /dev/null @@ -1,5 +0,0 @@ -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* diff --git a/debian/freeswitch-lang-en.conffiles b/debian/freeswitch-lang-en.conffiles deleted file mode 100644 index 10d6078517..0000000000 --- a/debian/freeswitch-lang-en.conffiles +++ /dev/null @@ -1,7 +0,0 @@ -/opt/freeswitch/conf/lang/en/demo/demo-ivr.xml -/opt/freeswitch/conf/lang/en/demo/demo.xml -/opt/freeswitch/conf/lang/en/dir/sounds.xml -/opt/freeswitch/conf/lang/en/dir/tts.xml -/opt/freeswitch/conf/lang/en/en.xml -/opt/freeswitch/conf/lang/en/vm/sounds.xml -/opt/freeswitch/conf/lang/en/vm/tts.xml diff --git a/debian/freeswitch-lang-en.install b/debian/freeswitch-lang-en.install deleted file mode 100644 index 73b86280b5..0000000000 --- a/debian/freeswitch-lang-en.install +++ /dev/null @@ -1,8 +0,0 @@ -opt/freeswitch/conf/lang/en/demo/demo-ivr.xml -opt/freeswitch/conf/lang/en/demo/demo.xml -opt/freeswitch/conf/lang/en/dir/sounds.xml -opt/freeswitch/conf/lang/en/dir/tts.xml -opt/freeswitch/conf/lang/en/en.xml -opt/freeswitch/conf/lang/en/vm/sounds.xml -opt/freeswitch/conf/lang/en/vm/tts.xml -opt/freeswitch/mod/mod_say_en.so* diff --git a/debian/freeswitch-lang-es.install b/debian/freeswitch-lang-es.install deleted file mode 100644 index fc91c7985e..0000000000 --- a/debian/freeswitch-lang-es.install +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/mod/mod_say_es.so* diff --git a/debian/freeswitch-lang-fr.conffiles b/debian/freeswitch-lang-fr.conffiles deleted file mode 100644 index 75055617e5..0000000000 --- a/debian/freeswitch-lang-fr.conffiles +++ /dev/null @@ -1,5 +0,0 @@ -/opt/freeswitch/conf/lang/fr/fr.xml -/opt/freeswitch/conf/lang/fr/demo/demo.xml -/opt/freeswitch/conf/lang/fr/dir/sounds.xml -/opt/freeswitch/conf/lang/fr/dir/tts.xml -/opt/freeswitch/conf/lang/fr/vm/sounds.xml diff --git a/debian/freeswitch-lang-fr.install b/debian/freeswitch-lang-fr.install deleted file mode 100644 index 141084eac3..0000000000 --- a/debian/freeswitch-lang-fr.install +++ /dev/null @@ -1,6 +0,0 @@ -opt/freeswitch/conf/lang/fr/fr.xml -opt/freeswitch/conf/lang/fr/demo/demo.xml -opt/freeswitch/conf/lang/fr/dir/sounds.xml -opt/freeswitch/conf/lang/fr/dir/tts.xml -opt/freeswitch/conf/lang/fr/vm/sounds.xml -opt/freeswitch/mod/mod_say_fr.so* diff --git a/debian/freeswitch-lang-he.conffiles b/debian/freeswitch-lang-he.conffiles deleted file mode 100644 index 37ec6015db..0000000000 --- a/debian/freeswitch-lang-he.conffiles +++ /dev/null @@ -1,5 +0,0 @@ -/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/he.xml -/opt/freeswitch/conf/lang/he/vm/sounds.xml diff --git a/debian/freeswitch-lang-he.install b/debian/freeswitch-lang-he.install deleted file mode 100644 index ed0c65813e..0000000000 --- a/debian/freeswitch-lang-he.install +++ /dev/null @@ -1,6 +0,0 @@ -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/he.xml -opt/freeswitch/conf/lang/he/vm/sounds.xml -opt/freeswitch/mod/mod_say_he.so* diff --git a/debian/freeswitch-lang-it.install b/debian/freeswitch-lang-it.install deleted file mode 100644 index 37a08020c2..0000000000 --- a/debian/freeswitch-lang-it.install +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/mod/mod_say_it.so* diff --git a/debian/freeswitch-lang-nl.install b/debian/freeswitch-lang-nl.install deleted file mode 100644 index 061a87e465..0000000000 --- a/debian/freeswitch-lang-nl.install +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/mod/mod_say_nl.so* diff --git a/debian/freeswitch-lang-ru.conffiles b/debian/freeswitch-lang-ru.conffiles deleted file mode 100644 index 55e97079d7..0000000000 --- a/debian/freeswitch-lang-ru.conffiles +++ /dev/null @@ -1,7 +0,0 @@ -/opt/freeswitch/conf/lang/ru/demo/demo-ivr.xml -/opt/freeswitch/conf/lang/ru/demo/demo.xml -/opt/freeswitch/conf/lang/ru/dir/sounds.xml -/opt/freeswitch/conf/lang/ru/dir/tts.xml -/opt/freeswitch/conf/lang/ru/ru.xml -/opt/freeswitch/conf/lang/ru/vm/sounds.xml -/opt/freeswitch/conf/lang/ru/vm/tts.xml diff --git a/debian/freeswitch-lang-ru.install b/debian/freeswitch-lang-ru.install deleted file mode 100644 index 7c58f72f12..0000000000 --- a/debian/freeswitch-lang-ru.install +++ /dev/null @@ -1,8 +0,0 @@ -opt/freeswitch/conf/lang/ru/demo/demo-ivr.xml -opt/freeswitch/conf/lang/ru/demo/demo.xml -opt/freeswitch/conf/lang/ru/dir/sounds.xml -opt/freeswitch/conf/lang/ru/dir/tts.xml -opt/freeswitch/conf/lang/ru/ru.xml -opt/freeswitch/conf/lang/ru/vm/sounds.xml -opt/freeswitch/conf/lang/ru/vm/tts.xml -opt/freeswitch/mod/mod_say_ru.so* diff --git a/debian/freeswitch-lua.conffiles b/debian/freeswitch-lua.conffiles deleted file mode 100644 index dbe8a22a9d..0000000000 --- a/debian/freeswitch-lua.conffiles +++ /dev/null @@ -1 +0,0 @@ -/opt/freeswitch/conf/autoload_configs/lua.conf.xml diff --git a/debian/freeswitch-lua.install b/debian/freeswitch-lua.install deleted file mode 100644 index af944aebea..0000000000 --- a/debian/freeswitch-lua.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/conf/autoload_configs/lua.conf.xml -opt/freeswitch/mod/mod_lua.so* diff --git a/debian/freeswitch-perl.conffiles b/debian/freeswitch-perl.conffiles deleted file mode 100644 index 6a13819992..0000000000 --- a/debian/freeswitch-perl.conffiles +++ /dev/null @@ -1 +0,0 @@ -/opt/freeswitch/conf/autoload_configs/perl.conf.xml diff --git a/debian/freeswitch-perl.install b/debian/freeswitch-perl.install deleted file mode 100644 index 706a6a091d..0000000000 --- a/debian/freeswitch-perl.install +++ /dev/null @@ -1,3 +0,0 @@ -opt/freeswitch/conf/autoload_configs/perl.conf.xml -opt/freeswitch/mod/mod_perl.so* -opt/freeswitch/perl/* diff --git a/debian/freeswitch-python.conffiles b/debian/freeswitch-python.conffiles deleted file mode 100644 index 1c1746c875..0000000000 --- a/debian/freeswitch-python.conffiles +++ /dev/null @@ -1 +0,0 @@ -opt/freeswitch/conf/autoload_configs/python.conf.xml diff --git a/debian/freeswitch-python.install b/debian/freeswitch-python.install deleted file mode 100644 index 247c26d672..0000000000 --- a/debian/freeswitch-python.install +++ /dev/null @@ -1,5 +0,0 @@ -opt/freeswitch/conf/autoload_configs/python.conf.xml -opt/freeswitch/mod/mod_python.so* -usr/lib/python2.*/*-packages/freeswitch.py* -usr/lib/python2.*/*-packages/ESL.py* -usr/lib/python2.*/*-packages/_ESL.so* diff --git a/debian/freeswitch-spidermonkey.conffiles b/debian/freeswitch-spidermonkey.conffiles deleted file mode 100644 index 2a8eeb06fa..0000000000 --- a/debian/freeswitch-spidermonkey.conffiles +++ /dev/null @@ -1 +0,0 @@ -/opt/freeswitch/conf/autoload_configs/spidermonkey.conf.xml diff --git a/debian/freeswitch-spidermonkey.install b/debian/freeswitch-spidermonkey.install deleted file mode 100644 index 882a287ba8..0000000000 --- a/debian/freeswitch-spidermonkey.install +++ /dev/null @@ -1,6 +0,0 @@ -opt/freeswitch/conf/autoload_configs/spidermonkey.conf.xml -opt/freeswitch/lib/libjs.so* -opt/freeswitch/lib/libnspr4.so* -opt/freeswitch/lib/libplc4.so* -opt/freeswitch/lib/libplds4.so* -opt/freeswitch/mod/mod_spidermonkey*.so* diff --git a/debian/freeswitch.conffiles b/debian/freeswitch.conffiles deleted file mode 100644 index c765625b6f..0000000000 --- a/debian/freeswitch.conffiles +++ /dev/null @@ -1,98 +0,0 @@ -/opt/freeswitch/conf/autoload_configs/acl.conf.xml -/opt/freeswitch/conf/autoload_configs/alsa.conf.xml -/opt/freeswitch/conf/autoload_configs/callcenter.conf.xml -/opt/freeswitch/conf/autoload_configs/cdr_csv.conf.xml -/opt/freeswitch/conf/autoload_configs/cidlookup.conf.xml -/opt/freeswitch/conf/autoload_configs/conference.conf.xml -/opt/freeswitch/conf/autoload_configs/console.conf.xml -/opt/freeswitch/conf/autoload_configs/db.conf.xml -/opt/freeswitch/conf/autoload_configs/dialplan_directory.conf.xml -/opt/freeswitch/conf/autoload_configs/dingaling.conf.xml -/opt/freeswitch/conf/autoload_configs/directory.conf.xml -/opt/freeswitch/conf/autoload_configs/easyroute.conf.xml -/opt/freeswitch/conf/autoload_configs/enum.conf.xml -/opt/freeswitch/conf/autoload_configs/event_multicast.conf.xml -/opt/freeswitch/conf/autoload_configs/event_socket.conf.xml -/opt/freeswitch/conf/autoload_configs/fax.conf.xml -/opt/freeswitch/conf/autoload_configs/fifo.conf.xml -/opt/freeswitch/conf/autoload_configs/ivr.conf.xml -/opt/freeswitch/conf/autoload_configs/java.conf.xml -/opt/freeswitch/conf/autoload_configs/lcr.conf.xml -/opt/freeswitch/conf/autoload_configs/local_stream.conf.xml -/opt/freeswitch/conf/autoload_configs/logfile.conf.xml -/opt/freeswitch/conf/autoload_configs/memcache.conf.xml -/opt/freeswitch/conf/autoload_configs/modules.conf.xml -/opt/freeswitch/conf/autoload_configs/mongo.conf.xml -/opt/freeswitch/conf/autoload_configs/nibblebill.conf.xml -/opt/freeswitch/conf/autoload_configs/opal.conf.xml -/opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml -/opt/freeswitch/conf/autoload_configs/portaudio.conf.xml -/opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml -/opt/freeswitch/conf/autoload_configs/rss.conf.xml -/opt/freeswitch/conf/autoload_configs/shout.conf.xml -/opt/freeswitch/conf/autoload_configs/skinny.conf.xml -/opt/freeswitch/conf/autoload_configs/sofia.conf.xml -/opt/freeswitch/conf/autoload_configs/switch.conf.xml -/opt/freeswitch/conf/autoload_configs/syslog.conf.xml -/opt/freeswitch/conf/autoload_configs/timezones.conf.xml -/opt/freeswitch/conf/autoload_configs/tts_commandline.conf.xml -/opt/freeswitch/conf/autoload_configs/unicall.conf.xml -/opt/freeswitch/conf/autoload_configs/voicemail.conf.xml -/opt/freeswitch/conf/autoload_configs/xml_cdr.conf.xml -/opt/freeswitch/conf/autoload_configs/xml_curl.conf.xml -/opt/freeswitch/conf/autoload_configs/xml_rpc.conf.xml -/opt/freeswitch/conf/autoload_configs/zeroconf.conf.xml -/opt/freeswitch/conf/dialplan/default/00_pizza_demo.xml -/opt/freeswitch/conf/dialplan/default/01_example.com.xml -/opt/freeswitch/conf/dialplan/default.xml -/opt/freeswitch/conf/dialplan/features.xml -/opt/freeswitch/conf/dialplan/public/00_inbound_did.xml -/opt/freeswitch/conf/dialplan/public.xml -/opt/freeswitch/conf/dialplan/skinny-patterns/20-Demo.xml -/opt/freeswitch/conf/dialplan/skinny-patterns/99-Default_Drop.xml -/opt/freeswitch/conf/dialplan/skinny-patterns/20-Local_extension.xml -/opt/freeswitch/conf/dialplan/skinny-patterns/90-External.xml -/opt/freeswitch/conf/dialplan/skinny-patterns.xml -/opt/freeswitch/conf/directory/default/1000.xml -/opt/freeswitch/conf/directory/default/1001.xml -/opt/freeswitch/conf/directory/default/1002.xml -/opt/freeswitch/conf/directory/default/1003.xml -/opt/freeswitch/conf/directory/default/1004.xml -/opt/freeswitch/conf/directory/default/1005.xml -/opt/freeswitch/conf/directory/default/1006.xml -/opt/freeswitch/conf/directory/default/1007.xml -/opt/freeswitch/conf/directory/default/1008.xml -/opt/freeswitch/conf/directory/default/1009.xml -/opt/freeswitch/conf/directory/default/1010.xml -/opt/freeswitch/conf/directory/default/1011.xml -/opt/freeswitch/conf/directory/default/1012.xml -/opt/freeswitch/conf/directory/default/1013.xml -/opt/freeswitch/conf/directory/default/1014.xml -/opt/freeswitch/conf/directory/default/1015.xml -/opt/freeswitch/conf/directory/default/1016.xml -/opt/freeswitch/conf/directory/default/1017.xml -/opt/freeswitch/conf/directory/default/1018.xml -/opt/freeswitch/conf/directory/default/1019.xml -/opt/freeswitch/conf/directory/default/brian.xml -/opt/freeswitch/conf/directory/default/default.xml -/opt/freeswitch/conf/directory/default/example.com.xml -/opt/freeswitch/conf/directory/default/skinny-example.xml -/opt/freeswitch/conf/directory/default.xml -/opt/freeswitch/conf/extensions.conf -/opt/freeswitch/conf/freeswitch.xml -/opt/freeswitch/conf/fur_elise.ttml -/opt/freeswitch/conf/ivr_menus/demo_ivr.xml -/opt/freeswitch/conf/jingle_profiles/client.xml -/opt/freeswitch/conf/jingle_profiles/server.xml -/opt/freeswitch/conf/mime.types -/opt/freeswitch/conf/notify-voicemail.tpl -/opt/freeswitch/conf/sip_profiles/external/example.xml -/opt/freeswitch/conf/sip_profiles/external.xml -/opt/freeswitch/conf/sip_profiles/internal/example.xml -/opt/freeswitch/conf/sip_profiles/internal-ipv6.xml -/opt/freeswitch/conf/sip_profiles/internal.xml -/opt/freeswitch/conf/skinny_profiles/internal.xml -/opt/freeswitch/conf/tetris.ttml -/opt/freeswitch/conf/vars.xml -/opt/freeswitch/conf/voicemail.tpl -/opt/freeswitch/conf/web-vm.tpl diff --git a/debian/freeswitch.default b/debian/freeswitch.default deleted file mode 100644 index df94d7f0df..0000000000 --- a/debian/freeswitch.default +++ /dev/null @@ -1,11 +0,0 @@ -# Startup settings for FreeSWITCH - -# Enable initd (let init handle start and stop of freeswitch). -# Set to "true" (lowercase) to enable. - -FREESWITCH_ENABLED="false" - -# The parameters Freeswitch should be started with - -FREESWITCH_PARAMS="-nc" - diff --git a/debian/freeswitch.init b/debian/freeswitch.init deleted file mode 100755 index eaf1c36629..0000000000 --- a/debian/freeswitch.init +++ /dev/null @@ -1,184 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: freeswitch -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: The FreeSWITCH Voice Switching System -# Description: An advanced platform for voice services -### END INIT INFO - -# Author: Anthony Minesalle II -# - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/freeswitch/bin -DESC="FreeSWITCH Voice Switching System" -NAME=freeswitch -DAEMON=/opt/freeswitch/bin/$NAME -USER=freeswitch -PIDFILE=/opt/freeswitch/run/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME -WORKDIR=/opt/$NAME - -# Check if we are being executed by init - -CALLEDSCRIPT=`basename $0` - -if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME; fi - -if [ "$FREESWITCH_ENABLED" != "true" ]; then - echo "$DESC not enabled yet. Edit /etc/default/$NAME first." - exit 0 ; -fi - -# Exit if the package is not installed -# [ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -# -# Function that sets ulimit values for the daemon -# -do_setlimits() { - ulimit -c unlimited - ulimit -d unlimited - ulimit -f unlimited -# ulimit -i unlimited - ulimit -n 999999 -# ulimit -q unlimited -# ulimit -u unlimited - ulimit -v unlimited -# ulimit -x unlimited - ulimit -s 240 - ulimit -l unlimited - return 0 -} - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ - || return 1 - do_setlimits - start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ - $FREESWITCH_PARAMS \ - || return 2 - # Add code here, if necessary, that waits for the process to be ready - # to handle requests from services started subsequently which depend - # on this one. As a last resort, sleep for some time. -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - $DAEMON -stop - start-stop-daemon -d $WORKDIR -c $USER --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME - RETVAL="$?" - [ "$RETVAL" = 2 ] && return 2 - # Wait for children to finish too if this is a daemon that forks - # and if the daemon is only ever run from this initscript. - # If the above conditions are not satisfied then add some other code - # that waits for the process to drop all resources that could be - # needed by services started subsequently. A last resort is to - # sleep for some time. - start-stop-daemon -d $WORKDIR -c $USER --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON - [ "$?" = 2 ] && return 2 - # Many daemons don't delete their pidfiles when they exit. - rm -f $PIDFILE - return "$RETVAL" -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - # - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - # - start-stop-daemon -c $USER --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME - return 0 -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - reload|force-reload) - # - # If do_reload() is not implemented then leave this commented out - # and leave 'force-reload' as an alias for 'restart'. - # - log_daemon_msg "Reloading $DESC" "$NAME" - do_reload - log_end_msg $? - ;; - restart) - # - # If the "reload" option is implemented then remove the - # 'force-reload' alias - # - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - #echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 - exit 3 - ;; -esac - -: diff --git a/debian/freeswitch.install b/debian/freeswitch.install deleted file mode 100644 index a72200294f..0000000000 --- a/debian/freeswitch.install +++ /dev/null @@ -1,171 +0,0 @@ -opt/freeswitch/bin/freeswitch -opt/freeswitch/bin/fs_cli -opt/freeswitch/bin/fs_encode -opt/freeswitch/bin/fs_ivrd -opt/freeswitch/bin/fsxs -opt/freeswitch/bin/gentls_cert -opt/freeswitch/conf/autoload_configs/acl.conf.xml -opt/freeswitch/conf/autoload_configs/alsa.conf.xml -opt/freeswitch/conf/autoload_configs/callcenter.conf.xml -opt/freeswitch/conf/autoload_configs/cdr_csv.conf.xml -opt/freeswitch/conf/autoload_configs/cidlookup.conf.xml -opt/freeswitch/conf/autoload_configs/conference.conf.xml -opt/freeswitch/conf/autoload_configs/console.conf.xml -opt/freeswitch/conf/autoload_configs/db.conf.xml -opt/freeswitch/conf/autoload_configs/dialplan_directory.conf.xml -opt/freeswitch/conf/autoload_configs/dingaling.conf.xml -opt/freeswitch/conf/autoload_configs/directory.conf.xml -opt/freeswitch/conf/autoload_configs/easyroute.conf.xml -opt/freeswitch/conf/autoload_configs/enum.conf.xml -opt/freeswitch/conf/autoload_configs/event_multicast.conf.xml -opt/freeswitch/conf/autoload_configs/event_socket.conf.xml -opt/freeswitch/conf/autoload_configs/fax.conf.xml -opt/freeswitch/conf/autoload_configs/spandsp.conf.xml -opt/freeswitch/conf/autoload_configs/fifo.conf.xml -opt/freeswitch/conf/autoload_configs/ivr.conf.xml -opt/freeswitch/conf/autoload_configs/java.conf.xml -opt/freeswitch/conf/autoload_configs/lcr.conf.xml -opt/freeswitch/conf/autoload_configs/local_stream.conf.xml -opt/freeswitch/conf/autoload_configs/logfile.conf.xml -opt/freeswitch/conf/autoload_configs/memcache.conf.xml -opt/freeswitch/conf/autoload_configs/modules.conf.xml -opt/freeswitch/conf/autoload_configs/mongo.conf.xml -opt/freeswitch/conf/autoload_configs/nibblebill.conf.xml -opt/freeswitch/conf/autoload_configs/opal.conf.xml -opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml -opt/freeswitch/conf/autoload_configs/portaudio.conf.xml -opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml -opt/freeswitch/conf/autoload_configs/rss.conf.xml -opt/freeswitch/conf/autoload_configs/shout.conf.xml -opt/freeswitch/conf/autoload_configs/skinny.conf.xml -opt/freeswitch/conf/autoload_configs/sofia.conf.xml -opt/freeswitch/conf/autoload_configs/switch.conf.xml -opt/freeswitch/conf/autoload_configs/syslog.conf.xml -opt/freeswitch/conf/autoload_configs/timezones.conf.xml -opt/freeswitch/conf/autoload_configs/tts_commandline.conf.xml -opt/freeswitch/conf/autoload_configs/unicall.conf.xml -opt/freeswitch/conf/autoload_configs/voicemail.conf.xml -opt/freeswitch/conf/autoload_configs/xml_cdr.conf.xml -opt/freeswitch/conf/autoload_configs/xml_curl.conf.xml -opt/freeswitch/conf/autoload_configs/xml_rpc.conf.xml -opt/freeswitch/conf/autoload_configs/zeroconf.conf.xml -opt/freeswitch/conf/dialplan/default/00_pizza_demo.xml -opt/freeswitch/conf/dialplan/default/01_example.com.xml -opt/freeswitch/conf/dialplan/default.xml -opt/freeswitch/conf/dialplan/features.xml -opt/freeswitch/conf/dialplan/public/00_inbound_did.xml -opt/freeswitch/conf/dialplan/public.xml -opt/freeswitch/conf/dialplan/skinny-patterns/20-Demo.xml -opt/freeswitch/conf/dialplan/skinny-patterns/99-Default_Drop.xml -opt/freeswitch/conf/dialplan/skinny-patterns/20-Local_extension.xml -opt/freeswitch/conf/dialplan/skinny-patterns/90-External.xml -opt/freeswitch/conf/dialplan/skinny-patterns.xml -opt/freeswitch/conf/directory/default/1000.xml -opt/freeswitch/conf/directory/default/1001.xml -opt/freeswitch/conf/directory/default/1002.xml -opt/freeswitch/conf/directory/default/1003.xml -opt/freeswitch/conf/directory/default/1004.xml -opt/freeswitch/conf/directory/default/1005.xml -opt/freeswitch/conf/directory/default/1006.xml -opt/freeswitch/conf/directory/default/1007.xml -opt/freeswitch/conf/directory/default/1008.xml -opt/freeswitch/conf/directory/default/1009.xml -opt/freeswitch/conf/directory/default/1010.xml -opt/freeswitch/conf/directory/default/1011.xml -opt/freeswitch/conf/directory/default/1012.xml -opt/freeswitch/conf/directory/default/1013.xml -opt/freeswitch/conf/directory/default/1014.xml -opt/freeswitch/conf/directory/default/1015.xml -opt/freeswitch/conf/directory/default/1016.xml -opt/freeswitch/conf/directory/default/1017.xml -opt/freeswitch/conf/directory/default/1018.xml -opt/freeswitch/conf/directory/default/1019.xml -opt/freeswitch/conf/directory/default/brian.xml -opt/freeswitch/conf/directory/default/default.xml -opt/freeswitch/conf/directory/default/example.com.xml -opt/freeswitch/conf/directory/default/skinny-example.xml -opt/freeswitch/conf/directory/default.xml -opt/freeswitch/conf/extensions.conf -opt/freeswitch/conf/freeswitch.xml -opt/freeswitch/conf/fur_elise.ttml -opt/freeswitch/conf/ivr_menus/demo_ivr.xml -opt/freeswitch/conf/jingle_profiles/client.xml -opt/freeswitch/conf/jingle_profiles/server.xml -opt/freeswitch/conf/mime.types -opt/freeswitch/conf/notify-voicemail.tpl -opt/freeswitch/conf/sip_profiles/external/example.xml -opt/freeswitch/conf/sip_profiles/external.xml -opt/freeswitch/conf/sip_profiles/internal/example.xml -opt/freeswitch/conf/sip_profiles/internal-ipv6.xml -opt/freeswitch/conf/sip_profiles/internal.xml -opt/freeswitch/conf/skinny_profiles/internal.xml -opt/freeswitch/conf/tetris.ttml -opt/freeswitch/conf/vars.xml -opt/freeswitch/conf/voicemail.tpl -opt/freeswitch/conf/web-vm.tpl -opt/freeswitch/htdocs/* -opt/freeswitch/lib/libfreeswitch*.so* -opt/freeswitch/mod/mod_avmd.so* -opt/freeswitch/mod/mod_bv.so* -opt/freeswitch/mod/mod_callcenter.so* -opt/freeswitch/mod/mod_cdr_csv.so* -opt/freeswitch/mod/mod_celt.so* -opt/freeswitch/mod/mod_cidlookup.so* -opt/freeswitch/mod/mod_cluechoo.so* -opt/freeswitch/mod/mod_console.so* -opt/freeswitch/mod/mod_codec2.so* -opt/freeswitch/mod/mod_commands.so* -opt/freeswitch/mod/mod_conference.so* -opt/freeswitch/mod/mod_console.so* -opt/freeswitch/mod/mod_curl.so* -opt/freeswitch/mod/mod_db.so* -opt/freeswitch/mod/mod_dialplan*.so* -opt/freeswitch/mod/mod_dingaling.so* -opt/freeswitch/mod/mod_directory.so* -opt/freeswitch/mod/mod_distributor.so* -opt/freeswitch/mod/mod_dptools.so* -opt/freeswitch/mod/mod_easyroute.so* -opt/freeswitch/mod/mod_enum.so* -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_flite.so* -opt/freeswitch/mod/mod_fsv.so* -opt/freeswitch/mod/mod_hash.so* -opt/freeswitch/mod/mod_h26x.so* -opt/freeswitch/mod/mod_ilbc.so* -opt/freeswitch/mod/mod_lcr.so* -opt/freeswitch/mod/mod_limit.so* -opt/freeswitch/mod/mod_local_stream.so* -opt/freeswitch/mod/mod_logfile.so* -opt/freeswitch/mod/mod_loopback.so* -opt/freeswitch/mod/mod_memcache.so* -opt/freeswitch/mod/mod_mp4v.so* -opt/freeswitch/mod/mod_native_file.so* -opt/freeswitch/mod/mod_nibblebill.so* -opt/freeswitch/mod/mod_portaudio.so* -opt/freeswitch/mod/mod_portaudio_stream.so* -opt/freeswitch/mod/mod_redis.so* -opt/freeswitch/mod/mod_rss.so* -opt/freeswitch/mod/mod_shout.so* -opt/freeswitch/mod/mod_silk.so* -opt/freeswitch/mod/mod_siren.so* -opt/freeswitch/mod/mod_skinny.so* -opt/freeswitch/mod/mod_skypopen.so* -opt/freeswitch/mod/mod_sndfile.so* -opt/freeswitch/mod/mod_snom.so* -opt/freeswitch/mod/mod_cdr_sqlite.so* -opt/freeswitch/mod/mod_sofia.so* -opt/freeswitch/mod/mod_spandsp.so* -opt/freeswitch/mod/mod_speex.so* -opt/freeswitch/mod/mod_spy.so* -opt/freeswitch/mod/mod_syslog.so* -opt/freeswitch/mod/mod_theora.so* -opt/freeswitch/mod/mod_timerfd.so* -opt/freeswitch/mod/mod_tone_stream.so* -opt/freeswitch/mod/mod_tts_commandline.so* -opt/freeswitch/mod/mod_valet_parking.so* -opt/freeswitch/mod/mod_vmd.so* -opt/freeswitch/mod/mod_voicemail.so* -opt/freeswitch/mod/mod_xml_*.so* diff --git a/debian/man/man1/freeswitch.1 b/debian/man/man1/freeswitch.1 deleted file mode 100644 index 7c5ff70485..0000000000 --- a/debian/man/man1/freeswitch.1 +++ /dev/null @@ -1,22 +0,0 @@ -.TH "FREESWITCH" "1" "October 10, 2007" "" "" -.nh -.ad l -.SH "NAME" -freeswitch \- Open Source telephony platform -.SH "SYNOPSIS" -.HP 7 -\fBfreeswitch\fR [\fIoption\fR...] -.SH "DESCRIPTION" -.PP -This manual page documents briefly the -\fBfreeswitch\fR -command. -.PP -This manual page was written for the -Debian -distribution because we're too lame to write a real manual page. But we have a superb website over here: -.UR http://www.freeswitch.org/ -.BR http://www.freeswitch.org/ -.SH "SEE ALSO" -.PP -\fBundocumented\fR(7). diff --git a/debian/monit/freeswitch.monitrc b/debian/monit/freeswitch.monitrc deleted file mode 100644 index 4c9ae8f6de..0000000000 --- a/debian/monit/freeswitch.monitrc +++ /dev/null @@ -1,25 +0,0 @@ - check process freeswitch with pidfile /opt/freeswitch/run/freeswitch.pid - group voice - start program = "/etc/init.d/freeswitch start" - stop program = "/etc/init.d/freeswitch stop" -# Checks sip port on localhost, not wlways suitable -# if failed port 5060 type UDP then restart -# Checks mod_event_socket on localhost. Maybe more suitable - if failed port 8021 type TCP then restart - if 5 restarts within 5 cycles then timeout - depends on freeswitch_bin - depends on freeswitch_rc - - check file freeswitch_bin with path /opt/freeswitch/bin/freeswitch - group voice - if failed checksum then unmonitor - if failed permission 750 then unmonitor - if failed uid freeswitch then unmonitor -# if failed gid daemon then unmonitor - - check file freeswitch_rc with path /etc/init.d/freeswitch - group voice - if failed checksum then unmonitor - if failed permission 755 then unmonitor - if failed uid root then unmonitor - if failed gid root then unmonitor diff --git a/debian/postinst b/debian/postinst deleted file mode 100755 index 696171eb5a..0000000000 --- a/debian/postinst +++ /dev/null @@ -1,60 +0,0 @@ -#! /bin/sh -# set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package -# -# quoting from the policy: -# Any necessary prompting should almost always be confined to the -# post-installation script, and should be protected with a conditional -# so that unnecessary prompting doesn't happen if a package's -# installation fails and the `postinst' is called with `abort-upgrade', -# `abort-remove' or `abort-deconfigure'. - -case "$1" in - configure) - if ! getent passwd freeswitch >/dev/null; then - adduser --disabled-password --quiet --system \ - --home /opt/freeswitch \ - --gecos "FreeSWITCH Voice Platform" --ingroup daemon \ - freeswitch - adduser freeswitch audio - else - if [ "$(getent passwd freeswitch | cut -d : -f 6)" != "/opt/freeswitch" ]; then - echo "Error: pre-existing freeswitch user with non-standard home directory." >&2 - exit 1 - fi - usermod -d /opt/freeswitch -c "FreeSWITCH daemon,,," \ - -g daemon -G audio freeswitch - fi - - mkdir -p /opt/freeswitch - chown -R freeswitch:daemon /opt/freeswitch/ - chmod -R o-rwx /opt/freeswitch/ - - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/postrm b/debian/postrm deleted file mode 100755 index 97718dfacd..0000000000 --- a/debian/postrm +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# postrm script for freeswitch -# -# see: dh_installdeb(1) - -# set -e - -# summary of how this script can be called: -# * `remove' -# * `purge' -# * `upgrade' -# * `failed-upgrade' -# * `abort-install' -# * `abort-install' -# * `abort-upgrade' -# * `disappear' overwrit>r> -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - purge) - rm -Rf /etc/opt/freeswitch - rm -Rf /opt/freeswitch - userdel freeswitch - ;; - - remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - - - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 044815a0fa..0000000000 --- a/debian/rules +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/make -f - -# Uncomment this to turn on verbose mode. -export DH_VERBOSE=1 -export DH_OPTIONS -export DEB_DH_INSTALL_SOURCEDIR=debian/tmp -export PASSTHRU_CODEC_MODULES=codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb -# Modules listed by those built by default, then those that are added in this package -export APPLICATION_MODULES_AE= applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ - applications/mod_commands applications/mod_conference applications/mod_curl applications/mod_db applications/mod_directory \ - applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ - applications/mod_esf applications/mod_expr -export APPLICATION_MODULES_FM= applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ - applications/mod_memcache -export APPLICATION_MODULES_NY= applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_snom \ - applications/mod_spandsp applications/mod_spy applications/mod_stress \ - applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail - -export APPLICATIONS_MODULES= $(APPLICATION_MODULES_AE) $(APPLICATION_MODULES_FM) $(APPLICATION_MODULES_NY) $(APPLICATION_MODULES_VZ) -export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_tts_commandline -export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ - codecs/mod_silk codecs/mod_siren codecs/mod_theora -export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml -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 event_handlers/mod_cdr_sqlite -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 -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 - -export MYMODULES= $(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(XML_INT_MODULES) $(TIMER_MODULES) -export MODULES=$(MYMODULES) - - - -ifndef AUTOCONF - AUTOCONFS := $(wildcard /usr/bin/autoconf*) - AUTOCONF = $(shell which autoconf) -ifneq (,$(findstring 2.50,${AUTOCONFS})) - AUTOCONF = /usr/bin/autoconf2.50 -endif -endif - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) - -CFLAGS = -ggdb -MOD_CFLAGS = -ggdb - -FEATURES = --enable-core-libedit-support --enable-core-odbc-support --with-libcurl --with-openssl - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - FEATURES += --disable-optimization -endif - -.pc/applied-patches: - @echo - @echo \ \ Sorry, currently this package cannot be built directly from upstream - @echo \ \ source git/tarball: patches are needed for policy compliance, and the - @echo \ \ "new 3.0 (quilt) source format requires patches to be already applied." - @echo - @echo \ \ Please first convert this tree by running: - @echo -e \\t./debian/rules upstream-convert - @echo - @echo \ \ Note that this will insert an entry in debian/changelog, rename the - @echo \ \ current directory to the version number there, create a .orig.tar.bz2 - @echo \ \ archive and apply all the patches in debian/patches/series. - @echo - @echo \ \ Using git-buildpackage is not recommended for now. - @echo - @exit 1 - -upstream-convert: - @dh_testdir - @test -s .pc/applied-patches && \ - echo "Aborted: patches are already applied." && \ - exit 1 || exit 0 - # update (or not) version number in debian/changelog - @set -e ; \ - echo Checking version number ; \ - v1="$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: //')" ; \ - v2="$${v1}" ; \ - echo " Current version: $${v1}" ; \ - if [ "$$(which git)" = "" -o ! -d .git ] ; then \ - echo Git not available. Keeping current version number. ; \ - exit 0 ; \ - fi ; \ - if [ "$$(which debchange)" = "" ] ; then \ - echo debchange not available. Keeping current version number. ; \ - exit 0 ; \ - fi ; \ - if echo -n "$${v1}" | grep -q '~git\.[a-z0-9]\+\.20[0-9]\{6\}\.[0-9]\+-[^-]\+$$' ; then \ - maj1="$$(echo -n "$${v1}" | sed -e 's/^\([^.]\+\)\..*$$/\1/')" ; \ - min1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.\([^.]\+\)\..*$$/\1/')" ; \ - mic1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.\([a-zA-Z0-9]\+\).*$$/\1/')" ; \ - b1="$$(echo -n "$${v1}" | sed -e 's/^.*~git\.\([a-z0-9]\+\)\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ - d1="$$(echo -n "$${v1}" | sed -e 's/^.*\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ - n1="$$(echo -n "$${v1}" | sed -e 's/^.*\.20[0-9]\{6\}\.\([0-9]\+\)-[^-]\+$$/\1/')" ; \ - maj2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MAJOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ - min2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MINOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ - mic2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MICRO/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ - b2="$$(git branch | sed -e '/^[^*]/ d' -e 's/* \(.*\)/\1/')" ; \ - d2="$$(TZ=UTC git log --date=local -1 --format='%ai' | sed -e 's/^\(....\).\(..\).\(..\).*$$/\1\2\3/')" ; \ - n2="$$(TZ=UTC git log --date=local --format=oneline --since="$${d2::4}-$${d2:4:2}-$${d2:6:2} 00:00" | wc -l)" ; \ - if [ "$${b2}" != "$$(echo "$${b2}" | tr -dc a-z0-9)" ] ; then \ - echo Invalid branch name "'$${b2}'". Aborted. ; \ - exit 1; \ - fi ; \ - if [ "$${b1}.$${d1}.$${n1}" != "$${b2}.$${d2}.$${n2}" \ - -o "$${maj1}.$${min1}.$${mic1}" != "$${maj2}.$${min2}.$${mic2}" ] ; then \ - v2="$$(echo -n "$${maj2}.$${min2}.$${mic2}")" ; \ - v2="$${v2}$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.[^.]\+\(.*\)~git\..*$$/\1/')" ; \ - v2="$${v2}~git.$${b2}.$${d2}.$${n2}-1" ; \ - echo " New version: $${v2}" ; \ - echo Updating debian/changelog with new version number ; \ - debchange -v "$${v2}" "New upstream release" ; \ - else \ - echo Version number already correct, no change. ; \ - fi ; \ - else \ - echo 'Not a ~git. version number. Keeping current version number.' ; \ - fi - # rename (or not) current directory to match packagename-version.number - @set -e ; \ - echo Checking directory name ; \ - d1="$$(basename "$$(cd . && echo "$$PWD")")" ; \ - d2="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ - d2="$${d2}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ - if [ "$${d1}" != "$${d2}" ] ; then \ - if [ -e "../$${d2}" ] ; then \ - test . -ef "../$${d2}" && exit 0 ; \ - echo Aborted: directory "../$${d2}" already exists. ; \ - exit 1 ; \ - fi ; \ - echo Renaming current directory to "$${d2}" ; \ - mv ../$${d1} ../$${d2} ; \ - fi - # create .orig.tar.bz2 - @set -e ; \ - n="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ - d="$${n}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ - n="$${n}_$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/').orig.tar.bz2" ; \ - echo "Creating source archive $${n}" ; \ - cd .. && tar cjf "$${n}" --exclude='.git*' "$${d}" - # apply patches - @set -e ; \ - echo "Applying patches in debian/patches/series" ; \ - QUILT_PATCHES=debian/patches ; \ - export QUILT_PATCHES ; \ - while quilt next ; do \ - quilt push -v ; \ - quilt refresh ; \ - done - # remind user to change dir - @echo Done. - @echo - @if [ "$(CURDIR)" != "$$PWD" ] ; then \ - echo \ \ You should now tell your shell to update its current working directory: ; \ - echo -e \\t'cd $$(pwd)' ; \ - echo \ \ or ; \ - echo -e "\\tcd $$PWD" ; \ - echo ; \ - fi - - -config.status: configure - dh_testdir - rm -f modules.conf - touch modules.conf - echo $(MODULES) - for i in $(MODULES); do echo $$i >> modules.conf; done - ./configure --prefix=/opt/freeswitch --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) ${FEATURES} - -build: build-arch build-indep -build-arch: build-stamp -build-indep: build-stamp -build-stamp: config.status - dh_testdir - - $(MAKE) - cd libs/esl && $(MAKE) pymod && cd - - touch $@ - -clean: # .pc/applied-patches - dh_testdir - dh_testroot - rm -f build-stamp - - [ ! -f Makefile ] || $(MAKE) distclean - rm -f config.status - rm -f */*/config.status - rm -f */*/*/config.status - dh_clean - -install: build - dh_testdir - dh_testroot - dh_prep - dh_installdirs -A - - VERBOSE=1 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - cd libs/esl && VERBOSE=1 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp pymod-install && cd - - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installdocs - dh_installchangelogs - dh_installinit - cp debian/monit/freeswitch.monitrc debian/freeswitch/etc/monit/freeswitch.monitrc - dh_install --sourcedir=debian/tmp - dh_link - dh_strip --dbg-package=freeswitch-dbg - dh_compress - dh_fixperms --exclude /opt/freeswitch/conf - dh_makeshlibs - dh_shlibdeps - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh b/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh deleted file mode 100755 index 06099e6c5e..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -sounds_location=$1 -for rate in 32000 16000 8000 -do - for i in ascii base256 conference currency digits ivr misc phonetic-ascii time voicemail zrtp - do - mkdir -p $sounds_location/$i/$rate - for f in `find $sounds_location/$i/48000 -name \*.wav` - do - echo "generating" $sounds_location/$i/$rate/`basename $f` - sox $f -r $rate $sounds_location/$i/$rate/`basename $f` - done - done -done diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog b/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog deleted file mode 100644 index 9bb038ae96..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog +++ /dev/null @@ -1,20 +0,0 @@ -freeswitch-sounds-en-us-callie (1.0.14~git.master.20101222.1-1) unstable; urgency=low - - * Bumped up to 1.0.14 version - * Clean ups - - -- Michal Bielicki Wed, 22 Dec 2010 22:55:02 +0200 - -freeswitch-sounds-en-us-callie (1.0.head~git.master.20101014.1-1) unstable; urgency=low - - * Change upstream package version numbering scheme for unreleased versions: new format is major.minor.micro~git.branch.date.commits-1 - * Change source format to 3.0 (quilt). - * Upgrade debhelper compatibility to version 7. - - -- Michal Bielicki Fri, 14 Oct 2010 05:05:02 +0200 - -freeswitch-sounds-en-us-callie (1.0.12-0ubuntu1) jaunty; urgency=low - - * Initial: This is the initial working build of the en-us-callie sounds - - -- William King Sun, 20 Sep 2009 06:56:46 -0700 diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/control b/debian/sounds/freeswitch-sounds-en-us-callie/debian/control deleted file mode 100644 index 3408328ca1..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/control +++ /dev/null @@ -1,66 +0,0 @@ -Source: freeswitch-sounds-en-us-callie -Maintainer: Freeswitch Debian Team -Section: net -Priority: extra -Build-Depends: debhelper (>= 7), sox -Homepage: http://www.freeswitch.org/ -Standards-Version: 3.8.4 - -Package: freeswitch-sounds-en-us-callie-8000 -Architecture: all -Conflicts: freeswitch-sounds-en-us-callie -Description: English language sounds for the FreeSWITCH(TM) (8000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-en-us-callie-16000 -Architecture: all -Conflicts: freeswitch-sounds-en-us-callie -Description: English language sounds for the FreeSWITCH(TM) (16000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-en-us-callie-32000 -Architecture: all -Conflicts: freeswitch-sounds-en-us-callie -Description: English language sounds for FreeSWITCH(TM) (32000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-en-us-callie-48000 -Architecture: all -Description: English language sounds for the FreeSWITCH(TM) (48000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-en-us-callie -Architecture: all -Depends: sox, freeswitch-sounds-en-us-callie-48000 -Conflicts: freeswitch-sounds-en-us-callie-omega, - freeswitch-sounds-en-us-callie-8000, freeswitch-sounds-en-us-callie-16000, - freeswitch-sounds-en-us-callie-32000 -Description: English language files for FreeSWITCH(TM) - This package generates the 8k, 16k, and 32k from the installed 48k - sounds. You can select which ones you want. - -Package: freeswitch-sounds-en-us-callie-omega -Architecture: all -Depends: freeswitch-sounds-en-us-callie-48000, - freeswitch-sounds-en-us-callie-32000, freeswitch-sounds-en-us-callie-16000, - freeswitch-sounds-en-us-callie-8000 -Conflicts: freeswitch-sounds-en-us-callie -Description: English language files for FreeSWITCH(TM) - This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds - which are downloaded from binary data files. diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright b/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright deleted file mode 100644 index 0d313323ce..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright +++ /dev/null @@ -1 +0,0 @@ -These files are licensed under the terms of the creative commons Attribution 3.0 license: http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install b/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install deleted file mode 100644 index 47c795c0f0..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/en/us/callie/*/16000/* - diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install b/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install deleted file mode 100644 index 05538a76c2..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/en/us/callie/*/32000/* - diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install b/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install deleted file mode 100644 index c796070976..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/en/us/callie/*/48000/* - diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install b/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install deleted file mode 100644 index 90e6afa388..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/en/us/callie/*/8000/* - diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules b/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules deleted file mode 100755 index a5b4f9ba15..0000000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# This file is public domain software, originally written by Joey Hess. - -# Uncomment this to turn on verbose mode. - export DH_VERBOSE=1 -export DH_OPTIONS -export DH_COMPAT=4 -export DEB_DH_INSTALL_SOURCEDIR=debian/tmp - - -build: - dh_testdir - mkdir -p debian/tmp/opt/freeswitch/sounds - cp -a en debian/tmp/opt/freeswitch/sounds/ - ./debian/buildsounds.sh debian/tmp/opt/freeswitch/sounds/en/us/callie -clean: - dh_testdir - dh_testroot - dh_clean -k - rm -f build-stamp - rm -Rf debian/tmp - -install: - dh_testdir - dh_testroot - dh_installdirs -A --sourcedir=debian/tmp - dh_install --sourcedir=debian/tmp - -# Build architecture-independent files here. -binary-indep: build install - dh_compress - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep -.PHONY: build clean binary-indep binary install diff --git a/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh b/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh deleted file mode 100755 index 5cdf9dc384..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -sounds_location=$1 -for rate in 32000 16000 8000 -do - mkdir -p $sounds_location/$rate - for f in `find $sounds_location/48000 -name \*.wav` - do - echo "generating" $sounds_location/$rate/`basename $f` - sox $f -r $rate $sounds_location/$rate/`basename $f` - done -done diff --git a/debian/sounds/freeswitch-sounds-music/debian/changelog b/debian/sounds/freeswitch-sounds-music/debian/changelog deleted file mode 100644 index c5c52da460..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/changelog +++ /dev/null @@ -1,26 +0,0 @@ -freeswitch-sounds-music (1.0.8~git.master.20101222.1-1) unstable; urgency=low - - * Clean ups - - -- Michal Bielicki Wed, 22 Dec 2010 22:55:02 +0200 - -freeswitch-sounds-music (1.0.head-git.master,20101014.1-1) unstable; urgency=low - - * Change upstream package version numbering scheme for unreleased versions: - new format is major.minor.micro~git.branch.date.commits-1 - * Change source format to 3.0 (quilt). - * Upgrade debhelper compatibility to version 7. - - -- Michal Bielicki Fri, 14 Oct 2010 05:05:02 +0200 - -freeswitch-sounds-music (1.0.8-0ubuntu3) jaunty; urgency=low - - * Fixed: empty binary files for some packages - - -- William King Thu, 24 Sep 2009 15:54:17 -0700 - -freeswitch-sounds-music (1.0.8-0ubuntu2) jaunty; urgency=low - - * Initial: This is the initial working build of the music on hold - - -- William King Sun, 20 Sep 2009 08:28:48 -0700 diff --git a/debian/sounds/freeswitch-sounds-music/debian/control b/debian/sounds/freeswitch-sounds-music/debian/control deleted file mode 100644 index 20cfd5e3df..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/control +++ /dev/null @@ -1,66 +0,0 @@ -Source: freeswitch-sounds-music -Maintainer: Freeswitch development Team -Section: net -Priority: extra -Build-Depends: debhelper (>= 7), sox -Homepage: http://www.freeswitch.org/ -Standards-Version: 3.8.4 - -Package: freeswitch-sounds-music-8000 -Architecture: all -Conflicts: freeswitch-sounds-music -Description: music for FreeSWITCH(TM) (8000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-music-16000 -Architecture: all -Conflicts: freeswitch-sounds-music -Description: music for FreeSWITCH(TM) (16000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-music-32000 -Architecture: all -Conflicts: freeswitch-sounds-music -Description: music for FreeSWITCH(TM) (32000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-music-48000 -Architecture: all -Description: music for FreeSWITCH(TM) (48000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-music -Architecture: all -Depends: sox, freeswitch-sounds-music-48000 -Conflicts: freeswitch-sounds-music-omega, - freeswitch-sounds-music-8000, freeswitch-sounds-music-16000, - freeswitch-sounds-music-32000 -Description: Music for FreeSWITCH(TM) - This package generates the 8k, 16k, and 32k from the installed 48k - sounds. You can select which ones you want. - -Package: freeswitch-sounds-music-omega -Architecture: all -Depends: freeswitch-sounds-music-48000, - freeswitch-sounds-music-32000, freeswitch-sounds-music-16000, - freeswitch-sounds-music-8000 -Conflicts: freeswitch-sounds-music -Description: Music for FreeSWITCH(TM) - This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds - which are downloaded from binary data files. diff --git a/debian/sounds/freeswitch-sounds-music/debian/copyright b/debian/sounds/freeswitch-sounds-music/debian/copyright deleted file mode 100644 index b213deb31c..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/copyright +++ /dev/null @@ -1,13 +0,0 @@ -MUSOPEN - -Musopen is an online music library of copyright free music (public domain music). -We want to give the world access to music, without the legal hassles so common today. -There is a great deal of music that has expired copyrights, but almost no recordings -of this music is in the public domain. We aim to record or obtain recordings that -have no copyrights so that our visitors may listen, re-use, or in any way enjoy music. - -Put simply, our mission is to set music free. - -Musopen is a U.S. registered 501(c)(3) tax-deductible nonprofit charity. - -http://www.musopen.com diff --git a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install b/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install deleted file mode 100644 index 3e65722dd4..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/music/16000/* - diff --git a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install b/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install deleted file mode 100644 index 042fe8bb7d..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/music/32000/* - diff --git a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install b/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install deleted file mode 100644 index 5aa199911f..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/music/48000/* - diff --git a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install b/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install deleted file mode 100644 index 4f116068a9..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/music/8000/* - diff --git a/debian/sounds/freeswitch-sounds-music/debian/rules b/debian/sounds/freeswitch-sounds-music/debian/rules deleted file mode 100755 index 83a56bb72d..0000000000 --- a/debian/sounds/freeswitch-sounds-music/debian/rules +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# This file is public domain software, originally written by Joey Hess. - -# Uncomment this to turn on verbose mode. - export DH_VERBOSE=1 -export DH_OPTIONS -export DH_COMPAT=4 -export DEB_DH_INSTALL_SOURCEDIR=debian/tmp - - -build: - dh_testdir - mkdir -p debian/tmp/opt/freeswitch/sounds - cp -a music debian/tmp/opt/freeswitch/sounds/ - ./debian/buildsounds.sh debian/tmp/opt/freeswitch/sounds/music -clean: - dh_testdir - dh_testroot - dh_clean -k - rm -f build-stamp - rm -Rf debian/tmp - -install: - dh_testdir - dh_testroot - dh_installdirs -A --sourcedir=debian/tmp - dh_install --sourcedir=debian/tmp - -# Build architecture-independent files here. -binary-indep: build install - dh_compress - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep -.PHONY: build clean binary-indep binary install diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh deleted file mode 100755 index 06099e6c5e..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -sounds_location=$1 -for rate in 32000 16000 8000 -do - for i in ascii base256 conference currency digits ivr misc phonetic-ascii time voicemail zrtp - do - mkdir -p $sounds_location/$i/$rate - for f in `find $sounds_location/$i/48000 -name \*.wav` - do - echo "generating" $sounds_location/$i/$rate/`basename $f` - sox $f -r $rate $sounds_location/$i/$rate/`basename $f` - done - done -done diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog deleted file mode 100644 index 44eb4c72b6..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog +++ /dev/null @@ -1,35 +0,0 @@ -freeswitch-sounds-ru-ru-elena (1.0.8~git.master.20101222.1-1) unstable; urgency=low - - * Clean ups - - -- Michal Bielicki Wed, 22 Dec 2010 22:55:02 +0200 - -freeswitch-sounds-ru-ru-elena (1.0.head-git.master,20101014.1-1) unstable; urgency=low - - * Change upstream package version numbering scheme for unreleased versions: - new format is major.minor.micro~git.branch.date.commits-1 - * Change source format to 3.0 (quilt). - * Upgrade debhelper compatibility to version 7. - - -- Michal Bielicki Fr, 14 Oct 2010 05:05:02 +0200 - -freeswitch-sounds-ru-ru-elena (1.0.12-0ubuntu3) jaunty; urgency=low - - * Fixed: Empty binary package bug caused by the second ru folder being - capitalized. The sounds are in ru/RU/elena/* - - -- William King Sun, 20 Sep 2009 08:21:58 -0700 - -freeswitch-sounds-ru-ru-elena (1.0.12-0ubuntu2) jaunty; urgency=low - - * Fixed: Fixed a copy/paste bug in the rules file which was trying to - copy the en directory when it should have been copying the ru - directory. - - -- William King Sun, 20 Sep 2009 07:59:20 -0700 - -freeswitch-sounds-ru-ru-elena (1.0.12-0ubuntu1) jaunty; urgency=low - - * Initial: This is the initial working build of the ru-ru-elena sounds - - -- William King Sun, 20 Sep 2009 06:56:46 -0700 diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control deleted file mode 100644 index c3181ef60a..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control +++ /dev/null @@ -1,61 +0,0 @@ -Source: freeswitch-sounds-ru-ru-elena -Maintainer: Freeswitch Debian Team -Section: net -Priority: extra -Build-Depends: debhelper (>= 5), fakeroot, sox -Standards-Version: 3.7.3 - -Package: freeswitch-sounds-ru-ru-elena-8000 -Architecture: all -Conflicts: freeswitch-sounds-ru-ru-elena -Description: English language sounds for the FreeSWITCH(TM) (8000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-ru-ru-elena-16000 -Architecture: all -Conflicts: freeswitch-sounds-ru-ru-elena -Description: English language sounds for the FreeSWITCH(TM) (16000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-ru-ru-elena-32000 -Architecture: all -Conflicts: freeswitch-sounds-ru-ru-elena -Description: English language sounds for FreeSWITCH(TM) (32000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-ru-ru-elena-48000 -Architecture: all -Description: English language sounds for the FreeSWITCH(TM) (48000) - 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 media gateway - or a media server to host IVR applications using simple scripts or XML to - control the callflow. - -Package: freeswitch-sounds-ru-ru-elena -Architecture: all -Depends: sox, freeswitch-sounds-ru-ru-elena-48000 -Conflicts: freeswitch-sounds-ru-ru-elena-omega, freeswitch-sounds-ru-ru-elena-8000, freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-32000 -Description: English language files for FreeSWITCH(TM) - This package generates the 8k, 16k, and 32k from the installed 48k - sounds. You can select which ones you want. - -Package: freeswitch-sounds-ru-ru-elena-omega -Architecture: all -Depends: freeswitch-sounds-ru-ru-elena-48000, freeswitch-sounds-ru-ru-elena-32000, freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-8000 -Conflicts: freeswitch-sounds-ru-ru-elena -Description: English language files for FreeSWITCH(TM) - This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds - which are downloaded from binary data files. diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright deleted file mode 100644 index 0d313323ce..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright +++ /dev/null @@ -1 +0,0 @@ -These files are licensed under the terms of the creative commons Attribution 3.0 license: http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install deleted file mode 100644 index 0fe9230724..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/ru/RU/elena/*/16000/* - diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install deleted file mode 100644 index d3579dfe63..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/ru/RU/elena/*/32000/* - diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install deleted file mode 100644 index c565c5a4a1..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/ru/RU/elena/*/48000/* - diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install deleted file mode 100644 index 2af0c27d72..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install +++ /dev/null @@ -1,2 +0,0 @@ -opt/freeswitch/sounds/ru/RU/elena/*/8000/* - diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules deleted file mode 100755 index 678bdf1e68..0000000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# This file is public domain software, originally written by Joey Hess. - -# Uncomment this to turn on verbose mode. - export DH_VERBOSE=1 -export DH_OPTIONS -export DH_COMPAT=4 -export DEB_DH_INSTALL_SOURCEDIR=debian/tmp - - -build: - dh_testdir - mkdir -p debian/tmp/opt/freeswitch/sounds - cp -a ru debian/tmp/opt/freeswitch/sounds/ - ./debian/buildsounds.sh debian/tmp/opt/freeswitch/sounds/ru/RU/elena -clean: - dh_testdir - dh_testroot - dh_clean -k - rm -f build-stamp - rm -Rf debian/tmp - -install: - dh_testdir - dh_testroot - dh_installdirs -A --sourcedir=debian/tmp - dh_install --sourcedir=debian/tmp - -# Build architecture-independent files here. -binary-indep: build install - dh_compress - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep -.PHONY: build clean binary-indep binary install diff --git a/debian/sounds/getsounds.sh b/debian/sounds/getsounds.sh deleted file mode 100755 index b75a86f309..0000000000 --- a/debian/sounds/getsounds.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -sounds_en_us_callie="freeswitch-sounds-en-us-callie-48000-1.0.14.tar.gz" -sounds_music="freeswitch-sounds-music-48000-1.0.8.tar.gz" -sounds_ru_RU_elena="freeswitch-sounds-ru-RU-elena-48000-1.0.12.tar.gz" - -cd freeswitch-sounds-music -if [ ! -f $sounds_music ] - then - wget http://files.freeswitch.org/$sounds_music -fi -tar zxvf $sounds_music -cd .. - - -cd freeswitch-sounds-en-us-callie -if [ ! -f $sounds_en_us_callie ] - then - wget http://files.freeswitch.org/$sounds_en_us_callie -fi -tar zxvf $sounds_en_us_callie -cd .. - - -cd freeswitch-sounds-ru-RU-elena -if [ ! -f $sounds_ru_RU_elena ] - then - wget http://files.freeswitch.org/$sounds_ru_RU_elena -fi -tar zxvf $sounds_ru_RU_elena -cd .. diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8d82..0000000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) From 4ce0f57a8b4013c5c2b7019b5463b13d739e25c7 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 24 Feb 2012 01:03:09 +0000 Subject: [PATCH 0108/1057] debian: add new and vastly improved packaging for Debian We now break out each module and component of FreeSWITCH into a separate individually-installable package. For each package with executables or modules, we also build a package that includes the stripped debugging symbols so that users can be helpful when they discover bugs in FreeSWITCH. As of this commit, we successfully build 263 distinct binary packages starting from a clean minimal image on both Debian Sid and Debian Squeeze. To keep this manageable, we include a program that generates the various Debian packaging files from a consolidated description of the modules and their metadata. The program can even generate this configuration file by walking the FreeSWITCH source tree. To provide a smooth user experience, we provide meta-packages that install sensible sets of modules and other components. All files are installed into the traditional and customary Linux directories that you would expect in accordance with the Filesystem Hierarchy Standard (FHS). This commit also adds support for running FreeSWITCH as a forked systemd service in Debian. For more information about the technical details of the source packaging, how to build the binary packages from source, and how you can contribute, please read debian/README.source. To learn about how this packaging affects you as a user and how to use the finished Debian packages, read debian/README.Debian. Signed-off-by: Travis Cross --- .gitignore | 1 + debian/.gitignore | 21 + debian/README.Debian | 18 + debian/README.source | 57 ++ debian/bootstrap.sh | 739 ++++++++++++++++++ debian/changelog | 11 + debian/compat | 1 + debian/control-modules | 640 +++++++++++++++ debian/copyright | 8 + debian/create-dbg-pkgs.sh | 17 + debian/docs | 0 debian/freeswitch-dev.install | 4 + debian/freeswitch-doc.docs | 1 + debian/freeswitch-doc.install | 1 + debian/freeswitch-htdocs-slim.install | 3 + .../freeswitch-mod-pocketsphinx.install.tmpl | 1 + debian/freeswitch-systemd.freeswitch.service | 35 + debian/freeswitch-systemd.install | 1 + debian/freeswitch-sysvinit.freeswitch.default | 2 + debian/freeswitch-sysvinit.freeswitch.init | 116 +++ debian/freeswitch.install | 3 + debian/freeswitch.postinst | 41 + debian/freeswitch.postrm | 30 + debian/freeswitch.preinst | 18 + debian/freeswitch.prerm | 18 + debian/gbp.conf | 13 + debian/rules | 116 +++ debian/source/format | 1 + 28 files changed, 1917 insertions(+) create mode 100644 debian/.gitignore create mode 100644 debian/README.Debian create mode 100644 debian/README.source create mode 100755 debian/bootstrap.sh create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control-modules create mode 100644 debian/copyright create mode 100755 debian/create-dbg-pkgs.sh create mode 100644 debian/docs create mode 100644 debian/freeswitch-dev.install create mode 100644 debian/freeswitch-doc.docs create mode 100644 debian/freeswitch-doc.install create mode 100644 debian/freeswitch-htdocs-slim.install create mode 100644 debian/freeswitch-mod-pocketsphinx.install.tmpl create mode 100644 debian/freeswitch-systemd.freeswitch.service create mode 100644 debian/freeswitch-systemd.install create mode 100644 debian/freeswitch-sysvinit.freeswitch.default create mode 100644 debian/freeswitch-sysvinit.freeswitch.init create mode 100644 debian/freeswitch.install create mode 100644 debian/freeswitch.postinst create mode 100644 debian/freeswitch.postrm create mode 100644 debian/freeswitch.preinst create mode 100644 debian/freeswitch.prerm create mode 100644 debian/gbp.conf create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/.gitignore b/.gitignore index b8bd5c7edf..f31e630473 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ core.* !/w32/Setup/inno_setup/vcredist_x86.exe /.version +/.stamp-* /a.out.dSYM /AUTHORS /ChangeLog diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 0000000000..ff6803d774 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,21 @@ +# gitignore +/.stamp-bootstrap +/control +/control-modules.* +/files +/modules.conf +/modules_.conf +/freeswitch-autotools.install +/freeswitch-mod-*.install +/freeswitch-conf-*.install +/freeswitch-sounds-*.install +/*.log +/*.substvars +/*.debhelper +/tmp +/freeswitch/ +/freeswitch-dbg/ +/freeswitch-dev/ +/freeswitch-doc/ +/freeswitch-mod-*/ +/freeswitch-sounds-*/ diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000000..607e37ec18 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,18 @@ +FreeSWITCH for Debian +-------------- + +This debian packaging breaks out every module of freeswitch into a +separate package, so be sure to verify that you are actually +installing all the modules that you need. + +As a break from the past, we now install all files into their correct +FHS locations. + +This package does not install any configuration for freeswitch into +/etc/freeswitch. We leave you, the system administrator completely +responsible for that directory. If you install one of the conf +packages, it will install the corresponding sample configuration to +/usr/share/freeswitch/conf and you'll need to copy the bits you need +to /etc/freeswitch. + + -- Travis Cross , Sat, 5 May 2012 06:31:24 +0000 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000000..9f20a9d4a2 --- /dev/null +++ b/debian/README.source @@ -0,0 +1,57 @@ +FreeSWITCH for Debian +-------------- + +You may be reading this because you're wondering where all the files +are in debian/, such as control. + +Because FreeSWITCH has so many modules it was necessary to create a +system to autogenerate the majority of the packaging. This in done +mostly in the file debian/bootstrap.sh. This bootstrap needs to run +before any other step of the packaging, though we do try to +autogenerate it when possible. + +The build dependencies, runtime dependencies, and other details about +modules can be configured in the debian/control-modules file. Even +though this file looks a bit like a debian control file and has a +similar format, we are parsing this file ourselves so the format is a +bit more restricted. + +debian/control-modules currently supports the following fields: + + # lines that begin with the hash character are comments + # + # every block must start with a Module field + Module: / + Description: + # empty lines with "."s are not yet supported + Build-Depends: + Depends: + Recommends: + Suggests: + Distro-Conflicts: # not yet implemented + +During bootstrap we build a file control-modules.gen. If the +control-modules file is properly formatted, this generated file should +be identical. This is a sanity check mechanism for our parsing, as +well as a way to automatically reorganize the file. + +If the file debian/modules.conf is present, we read that file and only +build and package the files listed there. Otherwise, we build every +module except the ones that either should not be packaged, or for +which we don't yet have good packaging. + +The format of debian/modules.conf is: + + ## comments should start with two hash characters + / + +To build this package, I recommend running the following from the root +directory of your FS git working tree: + + mkdir ../sounds + export FS_SOUNDS_DIR=$(pwd)/../sounds + git clean -fdx && git reset --hard HEAD + (cd debian && ./bootstrap.sh) + schedtool -B -e git-buildpackage --git-verbose -us -uc + + -- Travis Cross , Sat, 5 May 2012 08:04:19 +0000 diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh new file mode 100755 index 0000000000..ecf3070b9a --- /dev/null +++ b/debian/bootstrap.sh @@ -0,0 +1,739 @@ +#!/bin/bash +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- +##### Author: Travis Cross + +mod_dir="../src/mod" +conf_dir="../conf" +fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media." +mod_build_depends="." +avoid_mods=( + applications/mod_fax + applications/mod_ladspa + applications/mod_limit + applications/mod_mp4 + applications/mod_osp + applications/mod_rad_auth + applications/mod_skel + asr_tts/mod_cepstral + codecs/mod_com_g729 + codecs/mod_sangoma_codec + codecs/mod_skel_codec + codecs/mod_voipcodecs + endpoints/mod_gsmopen + endpoints/mod_h323 + endpoints/mod_khomp + endpoints/mod_opal + endpoints/mod_portaudio + endpoints/mod_reference + endpoints/mod_unicall + event_handlers/mod_snmp + formats/mod_portaudio_stream + formats/mod_vlc + languages/mod_java + languages/mod_managed + languages/mod_spidermonkey + languages/mod_yaml + sdk/autotools + xml_int/mod_xml_ldap +) + +err () { + echo "$0 error: $1" >&2 + exit 1 +} + +xread() { + local xIFS="$IFS" + IFS='' + read $@ + local ret=$? + IFS="$xIFS" + return $ret +} + +avoid_mod_filter () { + for x in "${avoid_mods[@]}"; do + [ "$1" = "$x" ] && return 1 + done + return 0 +} + +modconf_filter () { + while xread line; do + [ "$1" = "$line" ] && return 0 + done < modules.conf + return 1 +} + +mod_filter () { + if test -f modules.conf; then + modconf_filter $@ + else + avoid_mod_filter $@ + fi +} + +map_fs_modules () { + local filterfn="$1" percatfns="$2" permodfns="$3" + for x in $mod_dir/*; do + if test -d $x; then + category=${x##*/} category_path=$x + for f in $percatfns; do $f; done + for y in $x/*; do + module_name=${y##*/} module_path=$y + module=$category/$module_name + if $filterfn $category/$module; then + [ -f ${y}/module ] && . ${y}/module + for f in $permodfns; do $f; done + fi + unset module_name module_path module + done + unset category category_path + fi + done +} + +map_modules() { + local filterfn="$1" percatfns="$2" permodfns="$3" + for x in $parse_dir/*; do + test -d $x || continue + category=${x##*/} category_path=$x + for f in $percatfns; do $f; done + for y in $x/*; do + test -f $y || continue + module=${y##*/} module_path=$y + $filterfn $category/$module || continue + module="" category="" module_name="" + description="" long_description="" + build_depends="" depends="" recommends="" suggests="" + distro_conflicts="" + . $y + [ -n "$description" ] || description="$module_name" + [ -n "$long_description" ] || description="Adds ${module_name}." + for f in $permodfns; do $f; done + unset \ + module module_name module_path \ + description long_description \ + build_depends depends recommends suggests \ + distro_conflicts + done + unset category category_path + done +} + +map_confs () { + local fs="$1" + for x in $conf_dir/*; do + test ! -d $x && continue + conf=${x##*/} conf_dir=$x + for f in $fs; do $f; done + unset conf conf_dir + done +} + +print_source_control () { +cat < +Build-Depends: +# for debian + debhelper (>= 8.0.0), +# bootstrapping + automake (>= 1.9), autoconf, libtool, +# core build + build-essential, wget, pkg-config, +# configure options + libssl-dev, unixodbc-dev, + libncurses5-dev, libjpeg8-dev, + python-dev, erlang-dev, +# documentation + doxygen, +# for APR (not essential for build) + uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev, +# used by many modules + bison, zlib1g-dev, +# module build-depends + $(debian_wrap "${mod_build_depends}") +Standards-Version: 3.9.2 +Homepage: http://freeswitch.org/ +Vcs-Git: git://git.freeswitch.org/freeswitch +Vcs-Browser: http://git.freeswitch.org/git/freeswitch/ + +EOF +} + +print_core_control () { +cat <= 3.0-6) +Description: FreeSWITCH SysV init script + $(debian_wrap "${fs_description}") + . + This package contains the SysV init script for FreeSWITCH. + +Package: freeswitch-systemd +Architecture: all +Depends: \${misc:Depends} +Description: FreeSWITCH systemd configuration + $(debian_wrap "${fs_description}") + . + This package contains the systemd configuration for FreeSWITCH. + +## misc + +Package: freeswitch-htdocs-slim +Architecture: all +Depends: \${misc:Depends} +Description: FreeSWITCH htdocs slim player + $(debian_wrap "${fs_description}") + . + This package contains the slim SWF player for FreeSWITCH. + +## sounds + +Package: freeswitch-music +Architecture: all +Depends: \${misc:Depends}, + freeswitch-music-default (= \${binary:Version}) +Description: Music on hold audio for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains music on hold audio for FreeSWITCH. + +Package: freeswitch-music-default +Architecture: all +Depends: \${misc:Depends}, + freeswitch-music-default-8k (= \${binary:Version}) +Recommends: + freeswitch-music-default-16k (= \${binary:Version}), + freeswitch-music-default-32k (= \${binary:Version}), + freeswitch-music-default-48k (= \${binary:Version}) +Description: Music on hold audio for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains the default music on hold audio for FreeSWITCH. + +Package: freeswitch-sounds +Architecture: all +Depends: \${misc:Depends}, + freeswitch-sounds-en (= \${binary:Version}) +Description: Sounds for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains sounds for FreeSWITCH. + +Package: freeswitch-sounds-en +Architecture: all +Depends: \${misc:Depends}, + freeswitch-sounds-en-us (= \${binary:Version}) +Description: English sounds for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains the English sounds for FreeSWITCH. + +Package: freeswitch-sounds-en-us +Architecture: all +Depends: \${misc:Depends}, + freeswitch-sounds-en-us-callie (= \${binary:Version}) +Description: US English sounds for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains the US/English sounds for FreeSWITCH. + +Package: freeswitch-sounds-en-us-callie +Architecture: all +Depends: \${misc:Depends}, + freeswitch-sounds-en-us-callie-8k (= \${binary:Version}) +Recommends: + freeswitch-sounds-en-us-callie-16k (= \${binary:Version}), + freeswitch-sounds-en-us-callie-32k (= \${binary:Version}), + freeswitch-sounds-en-us-callie-48k (= \${binary:Version}) +Description: US English sounds for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains the Callie English sounds for FreeSWITCH. + +EOF +} + +print_mod_control () { + cat <> control +} + +gencontrol_per_cat () { + (echo "## mod/$category"; echo) >> control +} + +geninstall_per_mod () { + local f=freeswitch-${module_name//_/-}.install + (print_edit_warning; print_mod_install "$module_name") > $f + test -f $f.tmpl && cat $f.tmpl >> $f +} + +genmodules_per_cat () { + echo "## $category" >> modules_.conf +} + +genmodules_per_mod () { + echo "$module" >> modules_.conf +} + +genconf () { + print_conf_control >> control + local f=freeswitch-conf-${conf//_/-}.install + (print_edit_warning; print_conf_install) > $f + test -f $f.tmpl && cat $f.tmpl >> $f +} + +genmusic () { + rate="$1" rate_k="${rate%%000}k" + print_music_control >> control + local f=freeswitch-music-default-${rate_k}.install + (print_edit_warning; print_music_install) > $f + test -f $f.tmpl && cat $f.tmpl >> $f + unset rate rate_k +} + +gensound () { + rate="$1" rate_k="${rate%%000}k" sound_path="$2" sound="${2,,}" + language=$(echo $sound | cut -d/ -f1) + country=$(echo $sound | cut -d/ -f2) + speaker=$(echo $sound | cut -d/ -f3) + print_sound_control >> control + local f=freeswitch-sounds-${sound//\//-}-${rate_k}.install + (print_edit_warning; print_sound_install) > $f + test -f $f.tmpl && cat $f.tmpl >> $f + unset rate rate_k sound sound_path language country speaker +} + +accumulate_build_depends () { + if [ -n "$build_depends" ]; then + if [ ! "$mod_build_depends" = "." ]; then + mod_build_depends="${mod_build_depends}, ${build_depends}" + else + mod_build_depends="${build_depends}" + fi + fi +} + +genmodctl_new_mod() { + grep -e "^Module: ${module}$" control-modules >/dev/null && return 0 + cat </dev/null && return 0 + cat < control-modules.preparse + local category="" + local module_name="" + rm -rf $parse_dir + while xread l; do + if [ -z "$l" ]; then + # is newline + continue + fi + local header="${l%%:*}" + local value="${l#*: }" + if [ "$header" = "Module" ]; then + category="${value%%/*}" + module_name="${value#*/}" + mkdir -p $parse_dir/$category + (echo "module=$(var_escape "$value")"; \ + echo "category=$(var_escape "$category")"; \ + echo "module_name=$(var_escape "$module_name")"; \ + ) >> $parse_dir/$category/$module_name + else + ([ -n "$category" ] && [ -n "$module_name" ]) \ + || err "unexpected header $header" + local var_name="$(echo "$header" | sed -e 's/-/_/g' | tr '[A-Z]' '[a-z]')" + echo "${var_name}=$(var_escape "$value")" >> $parse_dir/$category/$module_name + fi + done < control-modules.preparse +} + +debian_wrap() { + local fl=true + echo "$1" | fold -s -w 69 | while xread l; do + local v="$(echo "$l" | sed -e 's/ *$//g')" + if $fl; then + fl=false + echo "$v" + else + echo " $v" + fi + done +} + +genmodctl_cat() { + (echo "## mod/$category"; echo) +} + +genmodctl_mod() { + echo "Module: $module" + echo "Description: $description" + echo "$long_description" | fold -s -w 69 | while xread l; do + local v="$(echo "$l" | sed -e 's/ *$//g')" + echo " $v" + done + [ -n "$build_depends" ] && debian_wrap "Build-Depends: $build_depends" + [ -n "$depends" ] && debian_wrap "Depends: $depends" + [ -n "$reccomends" ] && debian_wrap "Recommends: $recommends" + [ -n "$suggests" ] && debian_wrap "Suggests: $suggests" + [ -n "$distro_conflicts" ] && debian_wrap "Distro-Conflicts: $distro_conflicts" + echo +} + +echo "Please wait, this takes a few seconds..." >&2 + +parse_dir=control-modules.parse +map_fs_modules ':' 'genmodctl_new_cat' 'genmodctl_new_mod' >> control-modules +parse_mod_control +(echo "# -*- mode:debian-control -*-"; echo; \ + map_modules ':' 'genmodctl_cat' 'genmodctl_mod' \ + ) > control-modules.gen + +print_edit_warning > modules_.conf +map_modules 'mod_filter' '' 'accumulate_build_depends' +> control +(print_edit_warning; print_source_control; print_core_control) >> control +for r in 8000 16000 32000 48000; do genmusic $r; done +for x in 'en/us/callie'; do + for r in 8000 16000 32000 48000; do + gensound $r $x + done +done +(echo "### conf"; echo) >> control +map_confs 'genconf' +(echo "### modules"; echo) >> control +map_modules "mod_filter" \ + "gencontrol_per_cat genmodules_per_cat" \ + "gencontrol_per_mod geninstall_per_mod genmodules_per_mod" + +touch .stamp-bootstrap diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000..3df3c52971 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +freeswitch (1.2~alpha1-1) unstable; urgency=low + + * Initial release of FreeSWITCH in new debian packaging. + * The debian packaging has been completely rewritten from the ground up. + * We now install to the correct locations outlined in the Filesystem + Hierarchy Standard (FHS). + * All modules are packaged separately from the core. + * We have a handy system for autogenerating the final packaging + configuration from a consolidated configuration file. + + -- Travis Cross Sat, 05 May 2012 07:10:14 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control-modules b/debian/control-modules new file mode 100644 index 0000000000..bb3ed507e8 --- /dev/null +++ b/debian/control-modules @@ -0,0 +1,640 @@ +# -*- mode:debian-control -*- +##### Author: Travis Cross + +## mod/applications + +Module: applications/mod_abstraction +Description: Abstraction layer for APIs + This module provides a way to create new API functions via regex + rewriting. + +Module: applications/mod_avmd +Description: Advanced voicemail detection + This module attempts to determine when a voicemail system has + answered the call. + +Module: applications/mod_blacklist +Description: Blacklist helper + This module provides tools to blacklist callers. + +Module: applications/mod_callcenter +Description: Call center + This module implements Automated Call Distribution (ACD) queues. + +Module: applications/mod_cidlookup +Description: Caller ID name lookup + This module provides an API for querying caller ID name and location + data. + +Module: applications/mod_cluechoo +Description: Clue Choo + This demo module renders a Clue Choo train on the FreeSWITCH console. + +Module: applications/mod_commands +Description: Command module + This module provides miscellaneous API commands. + +Module: applications/mod_conference +Description: Conference + This module provides multi-party conferencing. + +Module: applications/mod_curl +Description: cURL + This module provides an API for making HTTP requests with cURL. + +Module: applications/mod_db +Description: DB + This module implements simple db API, group support, and limit db + backend. + +Module: applications/mod_directory +Description: Dial by name directory + This module implements a dial-by-name directory IVR. + +Module: applications/mod_distributor +Description: Load distributor + This module implements a mechanism for performing load balancing. + +Module: applications/mod_dptools +Description: Dialplan tools + This module implements basic dialplan tools. + +Module: applications/mod_easyroute +Description: Easyroute + This module does destination lookup based on DID. + +Module: applications/mod_enum +Description: ENUM + This module implements ENUM support. + +Module: applications/mod_esf +Description: Multicast support + This module adds multi-cast support. + +Module: applications/mod_esl +Description: Single ESL + This module adds an API for generating one-off ESL requests. + +Module: applications/mod_expr +Description: Expr + This module adds expr support for expression evaluation. + +Module: applications/mod_fax +Description: Fax + This module adds fax support provided by Steve Underwood's SpanDSP. + +Module: applications/mod_fifo +Description: FIFO + This module adds a first-in first-out queue system. + +Module: applications/mod_fsk +Description: Frequency-shift keying + This module adds frequency-shift keying support which can be used to + send and receive caller ID. + +Module: applications/mod_fsv +Description: FSV + This module provides dialplan applications for recording and playing + FSV videos. + +Module: applications/mod_hash +Description: Hash + This module provides a hash API, a key-value in-memory datastore. + +Module: applications/mod_httapi +Description: HT-TAPI Hypertext Telephony API + This module provides an API for controlling the switch by responding + to HTTP requests. + +Module: applications/mod_http_cache +Description: HTTP GET with caching + This module provides an API for making HTTP GET requests where the + result is cached. + +Module: applications/mod_ladspa +Description: LADSPA + This module provides an API for accessing LADSPA plugins. + +Module: applications/mod_lcr +Description: LCR + This module adds a facility for least-cost routing. + +Module: applications/mod_limit +Description: Limit compatibility module + This module provides a backward-compatible interface to the DB limit + system. + +Module: applications/mod_memcache +Description: Memcache + This module provides an interface to memcache servers. + +Module: applications/mod_mongo +Description: MongoDB + This module provides an interface to MongoDB. +Build-Depends: scons, libboost-dev, libboost-system-dev, + libboost-date-time-dev, libboost-thread-dev, libboost-filesystem-dev +Depends: libicu44, libboost-system1.42.0, libboost-date-time1.42.0, + libboost-serialization1.42.0, libboost-thread1.42.0, + libboost-filesystem1.42.0 + +Module: applications/mod_mp4 +Description: MP4 video support + This module adds support for MP4 video playback. + +Module: applications/mod_nibblebill +Description: Nibblebill + This module allows for real-time accounting of a cash balance and + using that information for call routing. + +Module: applications/mod_osp +Description: Open Settlement Protocol + This module adds support for the Open Settlement Protocol (OSP). + +Module: applications/mod_rad_auth +Description: RADIUS AA + This module implements RADIUS Authentication and Authorization. + +Module: applications/mod_redis +Description: Redis limit backend + This module provides a mechanism to use Redis as a backend data + store. + +Module: applications/mod_rss +Description: RSS browser + This module provides an RSS browser. + +Module: applications/mod_skel +Description: Framework demo module + This module demonstrates how to build an add-on module. + +Module: applications/mod_sms +Description: Astract SMS + This module provides an abstract facility for interfacing with SMS + systems. + +Module: applications/mod_snapshot +Description: Snapshot + This module can record a sliding window of audio and take snapshots + to disk. + +Module: applications/mod_snipe_hunt +Description: Snipe hunt + This is a framework demo module. + +Module: applications/mod_snom +Description: SNOM specific features + This module implements features specific to SNOM phones. + +Module: applications/mod_soundtouch +Description: Soundtouch + This module implements example media bugs. + +Module: applications/mod_spandsp +Description: SpanDSP + This module implements spandsp fax, dsp, and codec functionality. + +Module: applications/mod_spy +Description: UserSpy + This module adds the ability to monitor the audio of a channel. + +Module: applications/mod_stress +Description: Voice stress detection + This module attemps to detect voice stress on an audio channel. + +Module: applications/mod_valet_parking +Description: Valet parking + This module implements the valet call parking strategy. + +Module: applications/mod_vmd +Description: Voicemail detection + This module detects voicemail beeps at any frequency in O(1) time. + +Module: applications/mod_voicemail +Description: Voicemail + This module provides a voicemail system. + +Module: applications/mod_voicemail_ivr +Description: Voicemail IVR + This module provides an extensible voicemail IVR system. + +## mod/asr_tts + +Module: asr_tts/mod_cepstral +Description: mod_cepstral + Adds mod_cepstral. + +Module: asr_tts/mod_flite +Description: mod_flite + Adds mod_flite. + +Module: asr_tts/mod_pocketsphinx +Description: mod_pocketsphinx + Adds mod_pocketsphinx. + +Module: asr_tts/mod_tts_commandline +Description: mod_tts_commandline + Adds mod_tts_commandline. + +Module: asr_tts/mod_unimrcp +Description: mod_unimrcp + Adds mod_unimrcp. + +## mod/codecs + +Module: codecs/mod_amr +Description: mod_amr + Adds mod_amr. + +Module: codecs/mod_amrwb +Description: mod_amrwb + Adds mod_amrwb. + +Module: codecs/mod_bv +Description: mod_bv + Adds mod_bv. + +Module: codecs/mod_celt +Description: mod_celt + Adds mod_celt. + +Module: codecs/mod_codec2 +Description: mod_codec2 + Adds mod_codec2. + +Module: codecs/mod_com_g729 +Description: mod_com_g729 + Adds mod_com_g729. + +Module: codecs/mod_dahdi_codec +Description: mod_dahdi_codec + Adds mod_dahdi_codec. + +Module: codecs/mod_g723_1 +Description: mod_g723_1 + Adds mod_g723_1. + +Module: codecs/mod_g729 +Description: mod_g729 + Adds mod_g729. + +Module: codecs/mod_h26x +Description: mod_h26x + Adds mod_h26x. + +Module: codecs/mod_ilbc +Description: mod_ilbc + Adds mod_ilbc. + +Module: codecs/mod_isac +Description: mod_isac + Adds mod_isac. + +Module: codecs/mod_mp4v +Description: mod_mp4v + Adds mod_mp4v. + +Module: codecs/mod_opus +Description: mod_opus + Adds mod_opus. + +Module: codecs/mod_sangoma_codec +Description: mod_sangoma_codec + Adds mod_sangoma_codec. + +Module: codecs/mod_silk +Description: mod_silk + Adds mod_silk. + +Module: codecs/mod_siren +Description: mod_siren + Adds mod_siren. + +Module: codecs/mod_skel_codec +Description: mod_skel_codec + Adds mod_skel_codec. + +Module: codecs/mod_speex +Description: mod_speex + Adds mod_speex. +Build-Depends: libogg-dev +Depends: libogg0 + +Module: codecs/mod_theora +Description: mod_theora + Adds mod_theora. + +Module: codecs/mod_voipcodecs +Description: mod_voipcodecs + Adds mod_voipcodecs. + +## mod/dialplans + +Module: dialplans/mod_dialplan_asterisk +Description: mod_dialplan_asterisk + Adds mod_dialplan_asterisk. + +Module: dialplans/mod_dialplan_directory +Description: mod_dialplan_directory + Adds mod_dialplan_directory. + +Module: dialplans/mod_dialplan_xml +Description: mod_dialplan_xml + Adds mod_dialplan_xml. + +## mod/directories + +Module: directories/mod_ldap +Description: mod_ldap + Adds mod_ldap. + +## mod/endpoints + +Module: endpoints/mod_alsa +Description: mod_alsa + Adds mod_alsa. +Build-Depends: libasound2-dev +Depends: libasound2 + +Module: endpoints/mod_dingaling +Description: mod_dingaling + Adds mod_dingaling. + +Module: endpoints/mod_gsmopen +Description: mod_gsmopen + Adds mod_gsmopen. + +Module: endpoints/mod_h323 +Description: mod_h323 + Adds mod_h323. + +Module: endpoints/mod_khomp +Description: mod_khomp + Adds mod_khomp. + +Module: endpoints/mod_loopback +Description: mod_loopback + Adds mod_loopback. + +Module: endpoints/mod_opal +Description: mod_opal + Adds mod_opal. + +Module: endpoints/mod_portaudio +Description: mod_portaudio + Adds mod_portaudio. + +Module: endpoints/mod_reference +Description: mod_reference + Adds mod_reference. + +Module: endpoints/mod_rtmp +Description: mod_rtmp + Adds mod_rtmp. + +Module: endpoints/mod_skinny +Description: mod_skinny + Adds mod_skinny. + +Module: endpoints/mod_skypopen +Description: mod_skypopen + Adds mod_skypopen. +Build-Depends: libx11-dev +Depends: libpthread-stubs0 + +Module: endpoints/mod_sofia +Description: mod_sofia + Adds mod_sofia. + +Module: endpoints/mod_unicall +Description: mod_unicall + Adds mod_unicall. + +## mod/event_handlers + +Module: event_handlers/mod_cdr_csv +Description: mod_cdr_csv + Adds mod_cdr_csv. + +Module: event_handlers/mod_cdr_mongodb +Description: mod_cdr_mongodb + Adds mod_cdr_mongodb. + +Module: event_handlers/mod_cdr_pg_csv +Description: mod_cdr_pg_csv + Adds mod_cdr_pg_csv. +Build-Depends: libpq-dev +Depends: libpq5 + +Module: event_handlers/mod_cdr_sqlite +Description: mod_cdr_sqlite + Adds mod_cdr_sqlite. + +Module: event_handlers/mod_erlang_event +Description: mod_erlang_event + Adds mod_erlang_event. + +Module: event_handlers/mod_event_multicast +Description: mod_event_multicast + Adds mod_event_multicast. + +Module: event_handlers/mod_event_socket +Description: mod_event_socket + Adds mod_event_socket. + +Module: event_handlers/mod_event_test +Description: mod_event_test + Adds mod_event_test. + +Module: event_handlers/mod_event_zmq +Description: mod_event_zmq + Adds mod_event_zmq. + +Module: event_handlers/mod_json_cdr +Description: mod_json_cdr + Adds mod_json_cdr. + +Module: event_handlers/mod_radius_cdr +Description: mod_radius_cdr + Adds mod_radius_cdr. + +Module: event_handlers/mod_snmp +Description: mod_snmp + Adds mod_snmp. + +## mod/formats + +Module: formats/mod_local_stream +Description: mod_local_stream + Adds mod_local_stream. + +Module: formats/mod_native_file +Description: mod_native_file + Adds mod_native_file. + +Module: formats/mod_portaudio_stream +Description: mod_portaudio_stream + Adds mod_portaudio_stream. + +Module: formats/mod_shell_stream +Description: mod_shell_stream + Adds mod_shell_stream. + +Module: formats/mod_shout +Description: mod_shout + Adds mod_shout. + +Module: formats/mod_sndfile +Description: mod_sndfile + Adds mod_sndfile. + +Module: formats/mod_tone_stream +Description: mod_tone_stream + Adds mod_tone_stream. + +Module: formats/mod_vlc +Description: VLC streaming + This module provides VLC streaming. +Build-Depends: libvlc-dev (>= 2.0.0) +Depends: libvlc5 +Distro-Conflicts: squeeze + +## mod/languages + +Module: languages/mod_java +Description: mod_java + Adds mod_java. + +Module: languages/mod_lua +Description: mod_lua + Adds mod_lua. + +Module: languages/mod_managed +Description: mod_managed + Adds mod_managed. + +Module: languages/mod_perl +Description: mod_perl + Adds mod_perl. +Build-Depends: libperl-dev +Depends: libperl5.10 + +Module: languages/mod_python +Description: mod_python + Adds mod_python. + +Module: languages/mod_spidermonkey +Description: mod_spidermonkey + Adds mod_spidermonkey. + +Module: languages/mod_yaml +Description: mod_yaml + Adds mod_yaml. + +## mod/loggers + +Module: loggers/mod_console +Description: mod_console + Adds mod_console. + +Module: loggers/mod_logfile +Description: mod_logfile + Adds mod_logfile. + +Module: loggers/mod_syslog +Description: mod_syslog + Adds mod_syslog. + +## mod/say + +Module: say/mod_say_de +Description: mod_say_de + Adds mod_say_de. + +Module: say/mod_say_en +Description: mod_say_en + Adds mod_say_en. + +Module: say/mod_say_es +Description: mod_say_es + Adds mod_say_es. + +Module: say/mod_say_fr +Description: mod_say_fr + Adds mod_say_fr. + +Module: say/mod_say_he +Description: mod_say_he + Adds mod_say_he. + +Module: say/mod_say_hr +Description: mod_say_hr + Adds mod_say_hr. + +Module: say/mod_say_hu +Description: mod_say_hu + Adds mod_say_hu. + +Module: say/mod_say_it +Description: mod_say_it + Adds mod_say_it. + +Module: say/mod_say_ja +Description: mod_say_ja + Adds mod_say_ja. + +Module: say/mod_say_nl +Description: mod_say_nl + Adds mod_say_nl. + +Module: say/mod_say_pt +Description: mod_say_pt + Adds mod_say_pt. + +Module: say/mod_say_ru +Description: mod_say_ru + Adds mod_say_ru. + +Module: say/mod_say_th +Description: mod_say_th + Adds mod_say_th. + +Module: say/mod_say_zh +Description: mod_say_zh + Adds mod_say_zh. + +## mod/sdk + +Module: sdk/autotools +Description: autotools + Adds autotools. + +## mod/timers + +Module: timers/mod_posix_timer +Description: mod_posix_timer + Adds mod_posix_timer. + +Module: timers/mod_timerfd +Description: mod_timerfd + Adds mod_timerfd. + +## mod/xml_int + +Module: xml_int/mod_xml_cdr +Description: mod_xml_cdr + Adds mod_xml_cdr. + +Module: xml_int/mod_xml_curl +Description: mod_xml_curl + Adds mod_xml_curl. + +Module: xml_int/mod_xml_ldap +Description: mod_xml_ldap + Adds mod_xml_ldap. +Build-Depends: libsasl2-dev +Depends: libsasl2-modules + +Module: xml_int/mod_xml_rpc +Description: mod_xml_rpc + Adds mod_xml_rpc. + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000..8c08cfc189 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,8 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: freeswitch +Source: http://freeswitch.org/ + +Files: debian/* +Copyright: 2012 Travis Cross +License: MPL or GPL2+ (at your option) + diff --git a/debian/create-dbg-pkgs.sh b/debian/create-dbg-pkgs.sh new file mode 100755 index 0000000000..b6a33fa617 --- /dev/null +++ b/debian/create-dbg-pkgs.sh @@ -0,0 +1,17 @@ +#!/bin/bash +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- +##### Author: Travis Cross + +create_dbg_pkgs () { + for x in debian/*; do + test ! -d $x && continue + test "$x" = "tmp" -o "$x" = "source" && continue + test ! "$x" = "${x%-dbg}" && continue + test ! -d $x/usr/lib/debug && continue + mkdir -p $x-dbg/usr/lib + mv $x/usr/lib/debug $x-dbg/usr/lib/ + done +} + +create_dbg_pkgs + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/debian/freeswitch-dev.install b/debian/freeswitch-dev.install new file mode 100644 index 0000000000..704d7b1444 --- /dev/null +++ b/debian/freeswitch-dev.install @@ -0,0 +1,4 @@ +/usr/include +/usr/lib/freeswitch/mod/*.la +/usr/lib/*.{a,la} +/usr/lib/pkgconfig diff --git a/debian/freeswitch-doc.docs b/debian/freeswitch-doc.docs new file mode 100644 index 0000000000..d4f4542584 --- /dev/null +++ b/debian/freeswitch-doc.docs @@ -0,0 +1 @@ +#DOCS# diff --git a/debian/freeswitch-doc.install b/debian/freeswitch-doc.install new file mode 100644 index 0000000000..d4f4542584 --- /dev/null +++ b/debian/freeswitch-doc.install @@ -0,0 +1 @@ +#DOCS# diff --git a/debian/freeswitch-htdocs-slim.install b/debian/freeswitch-htdocs-slim.install new file mode 100644 index 0000000000..0975415a85 --- /dev/null +++ b/debian/freeswitch-htdocs-slim.install @@ -0,0 +1,3 @@ +/usr/share/freeswitch/htdocs/license.txt +/usr/share/freeswitch/htdocs/slim.swf +/usr/share/freeswitch/htdocs/slimtest.htm diff --git a/debian/freeswitch-mod-pocketsphinx.install.tmpl b/debian/freeswitch-mod-pocketsphinx.install.tmpl new file mode 100644 index 0000000000..8c57f297af --- /dev/null +++ b/debian/freeswitch-mod-pocketsphinx.install.tmpl @@ -0,0 +1 @@ +/usr/share/freeswitch/grammar diff --git a/debian/freeswitch-systemd.freeswitch.service b/debian/freeswitch-systemd.freeswitch.service new file mode 100644 index 0000000000..1e7d2fcad1 --- /dev/null +++ b/debian/freeswitch-systemd.freeswitch.service @@ -0,0 +1,35 @@ +;;;;; Author: Travis Cross + +[Unit] +Description=freeswitch +After=syslog.target network.target local-fs.target + +[Service] +; service +Type=forking +PIDFile=/run/freeswitch/freeswitch.pid +PermissionsStartOnly=true +ExecStartPre=/bin/mkdir -p /run/freeswitch +ExecStartPre=/bin/chown freeswitch:freeswitch /run/freeswitch +ExecStart=/usr/bin/freeswitch -nc -nonat +TimeoutSec=45s +Restart=always +; exec +WorkingDirectory=/run/freeswitch +User=freeswitch +Group=freeswitch +LimitCORE=infinity +LimitNOFILE=100000 +LimitNPROC=60000 +LimitSTACK=240 +LimitRTPRIO=infinity +LimitRTTIME=7000000 +IOSchedulingClass=realtime +IOSchedulingPriority=2 +CPUSchedulingPolicy=rr +CPUSchedulingPriority=89 +UMask=0007 + +[Install] +WantedBy=multi-user.target + diff --git a/debian/freeswitch-systemd.install b/debian/freeswitch-systemd.install new file mode 100644 index 0000000000..d647282ecd --- /dev/null +++ b/debian/freeswitch-systemd.install @@ -0,0 +1 @@ +/lib/systemd/system/freeswitch.service diff --git a/debian/freeswitch-sysvinit.freeswitch.default b/debian/freeswitch-sysvinit.freeswitch.default new file mode 100644 index 0000000000..1c939b55d0 --- /dev/null +++ b/debian/freeswitch-sysvinit.freeswitch.default @@ -0,0 +1,2 @@ +# /etc/default/freeswitch +DAEMON_OPTS="" diff --git a/debian/freeswitch-sysvinit.freeswitch.init b/debian/freeswitch-sysvinit.freeswitch.init new file mode 100644 index 0000000000..d02229b4e9 --- /dev/null +++ b/debian/freeswitch-sysvinit.freeswitch.init @@ -0,0 +1,116 @@ +#!/bin/sh +### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- +### BEGIN INIT INFO +# Provides: freeswitch +# Required-Start: $network $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: FreeSWITCH Softswitch +# Description: FreeSWITCH Softswitch +### END INIT INFO + +# Author: Travis Cross + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC=freeswitch +NAME=freeswitch +DAEMON=/usr/bin/freeswitch +DAEMON_ARGS="-u freeswitch -g freeswitch -rp -nc -nonat" +USER=freeswitch +PIDFILE=/var/run/$NAME/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +WORKDIR=/var/lib/$NAME + +[ -x $DAEMON ] || exit 0 +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +. /lib/init/vars.sh +. /lib/lsb/init-functions + +do_start() { + start-stop-daemon --start --quiet \ + --pidfile $PIDFILE --exec $DAEMON --name $NAME --user $USER \ + --test > /dev/null \ + || return 1 + ulimit -s 240 + start-stop-daemon --start --quiet \ + --pidfile $PIDFILE --exec $DAEMON --name $NAME --user $USER \ + --chdir $WORKDIR -- $DAEMON_ARGS $DAEMON_OPTS \ + || return 2 + return 0 +} + +stop_fs() { + start-stop-daemon --stop --quiet \ + --pidfile $PIDFILE --name $NAME --user $USER \ + --retry=TERM/30/KILL/5 +} + +stop_fs_children() { + start-stop-daemon --stop --quiet \ + --exec $DAEMON \ + --oknodo --retry=0/30/KILL/5 +} + +do_stop() { + stop_fs + RETVAL="$?" + [ "$RETVAL" -eq 2 ] && return 2 + stop_fs_children + [ "$?" -eq 2 ] && return 2 + rm -f $PIDFILE + return "$RETVAL" +} + +do_reload() { + start-stop-daemon --stop --quiet \ + --pidfile $PIDFILE --name $NAME --user $USER \ + --signal HUP +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + reload|force-reload) + log_daemon_msg "Reloading $DESC" "$NAME" + do_reload + log_end_msg $? + ;; + restart) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1|*) log_end_msg 1 ;; + esac + ;; + *) log_end_msg 1 ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +exit 0 diff --git a/debian/freeswitch.install b/debian/freeswitch.install new file mode 100644 index 0000000000..5c43763aa5 --- /dev/null +++ b/debian/freeswitch.install @@ -0,0 +1,3 @@ +/usr/bin +/usr/lib/libfreeswitch.so* +/usr/share/freeswitch/scripts diff --git a/debian/freeswitch.postinst b/debian/freeswitch.postinst new file mode 100644 index 0000000000..d1bbe72c15 --- /dev/null +++ b/debian/freeswitch.postinst @@ -0,0 +1,41 @@ +#!/bin/sh +set -e + +case "$1" in + configure) + if ! getent group freeswitch >/dev/null; then + groupadd --system freeswitch + fi + if ! getent passwd freeswitch >/dev/null; then + useradd --system -g freeswitch -Gaudio \ + -d /var/run/freeswitch \ + -s /bin/false \ + -e '' \ + -c 'FreeSWITCH' \ + freeswitch + fi + for x in \ + /var/lib/freeswitch \ + /var/lib/freeswitch/db \ + /var/lib/freeswitch/recordings \ + /var/lib/freeswitch/storage \ + /var/log/freeswitch \ + /var/run/freeswitch; + do + mkdir -p $x + chown -R freeswitch:freeswitch $x + chmod -R o-rwx,g+u $x + done + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# +exit 0 diff --git a/debian/freeswitch.postrm b/debian/freeswitch.postrm new file mode 100644 index 0000000000..5e21c84397 --- /dev/null +++ b/debian/freeswitch.postrm @@ -0,0 +1,30 @@ +#!/bin/sh +set -e + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + if [ "$1" = "purge" ]; then + if getent passwd freeswitch >/dev/null; then + userdel freeswitch + fi + if getent group freeswitch >/dev/null; then + groupdel freeswitch + fi + for x in \ + /var/lib/freeswitch \ + /var/log/freeswitch \ + /var/run/freeswitch; + do + rm -rf $x + done + fi + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# +exit 0 diff --git a/debian/freeswitch.preinst b/debian/freeswitch.preinst new file mode 100644 index 0000000000..56dc52da8f --- /dev/null +++ b/debian/freeswitch.preinst @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# +exit 0 diff --git a/debian/freeswitch.prerm b/debian/freeswitch.prerm new file mode 100644 index 0000000000..c2d46bc865 --- /dev/null +++ b/debian/freeswitch.prerm @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# +exit 0 diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000000..3889b7e9ee --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,13 @@ +# git-buildpackage +[git-buildpackage] +verbose=True +ignore-branch=True +ignore-new=True +upstream-branch=master +debian-branch=master +upstream-tree=branch +tag=False +force-create=True +compression=xz +compression-level=9ev +builder=debuild --prepend-path=/usr/lib/ccache -eFS_* -eCCACHE_* -i\.git -I.git -Zxz -z9 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000..c0b6bf9038 --- /dev/null +++ b/debian/rules @@ -0,0 +1,116 @@ +#!/usr/bin/make -f +# -*- mode:makefile -*- +#export DH_VERBOSE=1 + +FS_CFLAGS?=-ggdb3 -O2 +FS_CPPFLAGS?= +FS_CXXFLAGS?=$(FS_CFLAGS) +FS_INSTALL_SOUNDS?=true +export PATH?=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +export CFLAGS=$(FS_CFLAGS) +export CPPFLAGS=$(FS_CPPFLAGS) +export CXXFLAGS=$(FS_CXXFLAGS) + +show_vars= \ + echo; \ + echo "Making target $@"; \ + echo "PATH='$(PATH)'"; \ + echo "CFLAGS='$(CFLAGS)'"; \ + echo "CXXFLAGS='$(CXXFLAGS)'"; \ + echo "CCACHE_DIR='$(CCACHE_DIR)'"; \ + echo "FS_INSTALL_SOUNDS='$(FS_INSTALL_SOUNDS)'"; \ + echo; + +binary: + @$(call show_vars) + dh $@ +binary-arch: + @$(call show_vars) + dh $@ +binary-indep: + @$(call show_vars) + dh $@ +build: debian/.stamp-bootstrap + @$(call show_vars) + dh $@ +clean: + dh $@ + +override_dh_auto_clean: + dh_clean + +.stamp-bootstrap: + @$(call show_vars) + ./bootstrap.sh -j + touch $@ + +.stamp-configure: .stamp-bootstrap + @$(call show_vars) + touch noreg + cp debian/modules_.conf modules.conf + ./configure -C --enable-portable-binary --disable-dependency-tracking \ + --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ + --with-gnu-ld --with-python --with-erlang --with-openssl \ + --enable-core-odbc-support --enable-zrtp \ + --prefix=/usr --localstatedir=/var \ + --sysconfdir=/etc/freeswitch \ + --with-modinstdir=/usr/lib/freeswitch/mod \ + --with-rundir=/var/run/freeswitch \ + --with-logfiledir=/var/log/freeswitch \ + --with-dbdir=/var/lib/freeswitch/db \ + --with-htdocsdir=/usr/share/freeswitch/htdocs \ + --with-soundsdir=/usr/share/freeswitch/sounds \ + --with-grammardir=/usr/share/freeswitch/grammar \ + --with-scriptdir=/usr/share/freeswitch/scripts \ + --with-recordingsdir=/var/lib/freeswitch/recordings + touch $@ + +override_dh_auto_configure: .stamp-configure + +.stamp-build: .stamp-configure + @$(call show_vars) + make + touch $@ + +override_dh_auto_build: .stamp-build + +override_dh_auto_test: + +override_dh_strip: + dh_strip -a -k + ./debian/create-dbg-pkgs.sh + +override_dh_auto_install: + dh_auto_install + -$(FS_INSTALL_SOUNDS) && DESTDIR=debian/tmp make cd-sounds-install cd-moh-install + mkdir -p debian/tmp/lib/systemd/system + install -m0644 debian/freeswitch-systemd.freeswitch.service debian/tmp/lib/systemd/system/freeswitch.service + +override_dh_installinit: + dh_installinit -pfreeswitch-sysvinit --name=freeswitch + +debian-bootstrap: debian/.stamp-bootstrap +debian/.stamp-bootstrap: + (cd debian && ./bootstrap.sh) + touch $@ + +binary-basetest: + @$(call show_vars) + echo "applications/mod_commands" > debian/modules.conf + (cd debian && ./bootstrap.sh) + dh binary + +binary-quicktest: + @$(call show_vars) + echo "applications/mod_commands" > debian/modules.conf + (cd debian && ./bootstrap.sh) + env FS_INSTALL_SOUNDS=false dh binary \ + -Nfreeswitch-sounds-music-8k \ + -Nfreeswitch-sounds-music-16k \ + -Nfreeswitch-sounds-music-32k \ + -Nfreeswitch-sounds-music-48k \ + -Nfreeswitch-sounds-en-us-callie-8k \ + -Nfreeswitch-sounds-en-us-callie-16k \ + -Nfreeswitch-sounds-en-us-callie-32k \ + -Nfreeswitch-sounds-en-us-callie-48k + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) From b281e1340b6884c59124b81fc9acbb2c5dc7969a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 20:23:53 +0000 Subject: [PATCH 0109/1057] debian: place build utilities in a single file --- debian/rules | 2 +- debian/{create-dbg-pkgs.sh => util.sh} | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) rename debian/{create-dbg-pkgs.sh => util.sh} (85%) diff --git a/debian/rules b/debian/rules index c0b6bf9038..00f753f19e 100755 --- a/debian/rules +++ b/debian/rules @@ -78,7 +78,7 @@ override_dh_auto_test: override_dh_strip: dh_strip -a -k - ./debian/create-dbg-pkgs.sh + ./debian/util.sh create-dbg-pkgs override_dh_auto_install: dh_auto_install diff --git a/debian/create-dbg-pkgs.sh b/debian/util.sh similarity index 85% rename from debian/create-dbg-pkgs.sh rename to debian/util.sh index b6a33fa617..3b45ec391f 100755 --- a/debian/create-dbg-pkgs.sh +++ b/debian/util.sh @@ -13,5 +13,9 @@ create_dbg_pkgs () { done } -create_dbg_pkgs +cmd="$1" +shift +case "$cmd" in + create-dbg-pkgs) create_dbg_pkgs ;; +esac From 75da8722590fc9290c3275e71d9c3807af8406ab Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 20:28:46 +0000 Subject: [PATCH 0110/1057] debian: stylistic harmony --- debian/bootstrap.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index ecf3070b9a..6c41ebc817 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -42,7 +42,7 @@ err () { exit 1 } -xread() { +xread () { local xIFS="$IFS" IFS='' read $@ @@ -93,7 +93,7 @@ map_fs_modules () { done } -map_modules() { +map_modules () { local filterfn="$1" percatfns="$2" permodfns="$3" for x in $parse_dir/*; do test -d $x || continue @@ -592,7 +592,7 @@ accumulate_build_depends () { fi } -genmodctl_new_mod() { +genmodctl_new_mod () { grep -e "^Module: ${module}$" control-modules >/dev/null && return 0 cat </dev/null && return 0 cat < control-modules.preparse local category="" local module_name="" @@ -678,7 +678,7 @@ parse_mod_control() { done < control-modules.preparse } -debian_wrap() { +debian_wrap () { local fl=true echo "$1" | fold -s -w 69 | while xread l; do local v="$(echo "$l" | sed -e 's/ *$//g')" @@ -691,11 +691,11 @@ debian_wrap() { done } -genmodctl_cat() { +genmodctl_cat () { (echo "## mod/$category"; echo) } -genmodctl_mod() { +genmodctl_mod () { echo "Module: $module" echo "Description: $description" echo "$long_description" | fold -s -w 69 | while xread l; do From 6e01f3179880704f38552c398c25b0509f58394a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 20:59:09 +0000 Subject: [PATCH 0111/1057] debian: add a utility to output build dependencies for aptitude --- debian/util.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index 3b45ec391f..6deed193e9 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -2,6 +2,20 @@ ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ##### Author: Travis Cross +err () { + echo "$0 error: $1" >&2 + exit 1 +} + +xread () { + local xIFS="$IFS" + IFS='' + read $@ + local ret=$? + IFS="$xIFS" + return $ret +} + create_dbg_pkgs () { for x in debian/*; do test ! -d $x && continue @@ -13,9 +27,37 @@ create_dbg_pkgs () { done } +list_build_depends () { + test -f debian/.stamp-bootstrap || (cd debian && ./bootstrap.sh) + local deps="" found=false + while xread l; do + if [ "${l%%:*}" = "Build-Depends" ]; then + deps="${l#*:}" + found=true + continue + elif $found; then + if [ -z "$l" ]; then + # is newline + break + elif [ -z "${l##\#*}" ]; then + # is comment + continue + elif [ -z "${l## *}" ]; then + # is continuation line + deps="$deps $(echo "$l" | sed -e 's/^ *//' -e 's/ *([^)]*)//g' -e 's/,//g')" + else + # is a new header + break + fi + fi + done < debian/control + echo "${deps# }" +} + cmd="$1" shift case "$cmd" in create-dbg-pkgs) create_dbg_pkgs ;; + list-build-depends) list_build_depends ;; esac From 6c7548925ce8a8798bb1bafb85300e0135a892fd Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 20:59:50 +0000 Subject: [PATCH 0112/1057] debian: make utilities work when run from within debian/ --- debian/util.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 6deed193e9..cc4bf51f61 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -2,6 +2,10 @@ ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ##### Author: Travis Cross +pwd="$(pwd)" +ddir="debian" +[ "${pwd##*/}" = "debian" ] && ddir="." + err () { echo "$0 error: $1" >&2 exit 1 @@ -17,7 +21,7 @@ xread () { } create_dbg_pkgs () { - for x in debian/*; do + for x in $ddir/*; do test ! -d $x && continue test "$x" = "tmp" -o "$x" = "source" && continue test ! "$x" = "${x%-dbg}" && continue @@ -28,7 +32,7 @@ create_dbg_pkgs () { } list_build_depends () { - test -f debian/.stamp-bootstrap || (cd debian && ./bootstrap.sh) + test -f $ddir/.stamp-bootstrap || (cd $ddir && ./bootstrap.sh) local deps="" found=false while xread l; do if [ "${l%%:*}" = "Build-Depends" ]; then @@ -50,7 +54,7 @@ list_build_depends () { break fi fi - done < debian/control + done < $ddir/control echo "${deps# }" } From 38379a5f0db553d9f1bc8c901dcfc9121ce9af40 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 23:25:18 +0000 Subject: [PATCH 0113/1057] debian: make utilities work when run from any arbitrary directory --- debian/util.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index cc4bf51f61..24605d7073 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -2,9 +2,8 @@ ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ##### Author: Travis Cross -pwd="$(pwd)" -ddir="debian" -[ "${pwd##*/}" = "debian" ] && ddir="." +ddir="." +[ -n "${0%/*}" ] && ddir="${0%/*}" err () { echo "$0 error: $1" >&2 From b13f18ba8d531e0939a6589231e78c1a0b2a571b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 21:05:24 +0000 Subject: [PATCH 0114/1057] debian: add a utility to install necessary build dependencies --- debian/util.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/util.sh b/debian/util.sh index 24605d7073..2d00771ab7 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -57,10 +57,23 @@ list_build_depends () { echo "${deps# }" } +install_build_depends () { + local apt="" + if [ -n "$(which aptitude)" ]; then + apt=$(which aptitude) + elif [ -n "$(which apt-get)" ]; then + apt=$(which apt-get) + else + err "Can't find apt-get or aptitude; are you running on debian?" + fi + $apt install $(list_build_depends) +} + cmd="$1" shift case "$cmd" in create-dbg-pkgs) create_dbg_pkgs ;; list-build-depends) list_build_depends ;; + install-build-depends) install_build_depends ;; esac From 0a00e7e5ebcd7244defb0eaec5569947ddf7fd9f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 21:08:36 +0000 Subject: [PATCH 0115/1057] debian: install build dependencies without confirming --- debian/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 2d00771ab7..d5c9b23dbb 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -66,7 +66,7 @@ install_build_depends () { else err "Can't find apt-get or aptitude; are you running on debian?" fi - $apt install $(list_build_depends) + $apt install -y $(list_build_depends) } cmd="$1" From fa4e32984730febc9bfb9481e6c0b98163b636b3 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 21:10:47 +0000 Subject: [PATCH 0116/1057] debian: add a makefile rule to install build deps --- debian/rules | 5 +++++ debian/util.sh | 1 + 2 files changed, 6 insertions(+) diff --git a/debian/rules b/debian/rules index 00f753f19e..62fdd7a93d 100755 --- a/debian/rules +++ b/debian/rules @@ -94,6 +94,11 @@ debian/.stamp-bootstrap: (cd debian && ./bootstrap.sh) touch $@ +build-depends: debian/.stamp-build-depends +debian/.stamp-build-depends: + ./debian/util.sh install-build-depends + touch $@ + binary-basetest: @$(call show_vars) echo "applications/mod_commands" > debian/modules.conf diff --git a/debian/util.sh b/debian/util.sh index d5c9b23dbb..e8dc26448f 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -67,6 +67,7 @@ install_build_depends () { err "Can't find apt-get or aptitude; are you running on debian?" fi $apt install -y $(list_build_depends) + touch $ddir/.stamp-build-depends } cmd="$1" From eec92b51e61382bb3737fe9793de024f7181e390 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 21:11:40 +0000 Subject: [PATCH 0117/1057] debian: update .gitignore for music .install files --- debian/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/.gitignore b/debian/.gitignore index ff6803d774..c8e945b368 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -8,6 +8,7 @@ /freeswitch-autotools.install /freeswitch-mod-*.install /freeswitch-conf-*.install +/freeswitch-music-*.install /freeswitch-sounds-*.install /*.log /*.substvars From a943189e3dc422d94dd83a5305ced783384a5229 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 21:16:04 +0000 Subject: [PATCH 0118/1057] debian: update .gitignore for new debian install directories --- debian/.gitignore | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/.gitignore b/debian/.gitignore index c8e945b368..777b48dd70 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -15,8 +15,15 @@ /*.debhelper /tmp /freeswitch/ +/freeswitch-conf*/ /freeswitch-dbg/ /freeswitch-dev/ /freeswitch-doc/ +/freeswitch-htdocs-slim*/ +/freeswitch-init*/ +/freeswitch-meta*/ /freeswitch-mod-*/ -/freeswitch-sounds-*/ +/freeswitch-music*/ +/freeswitch-sounds*/ +/freeswitch-systemd/ +/freeswitch-sysvinit/ From d95ac52a159acf82f4eb44faf51f2daa77848a75 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 21:18:06 +0000 Subject: [PATCH 0119/1057] correct some module .gitignore entries --- src/mod/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/.gitignore b/src/mod/.gitignore index 064b64c73d..c4ba547b10 100644 --- a/src/mod/.gitignore +++ b/src/mod/.gitignore @@ -63,5 +63,7 @@ /loggers/mod_logfile/Makefile /loggers/mod_syslog/Makefile /say/mod_say_en/Makefile +/say/mod_say_ja/Makefile /say/mod_say_ru/Makefile +/timers/mod_posix_timer/Makefile /timers/mod_timerfd/Makefile From d281cf8ee8a2b6e15fa7d6e36f371bbdf05fea7a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 23:33:17 +0000 Subject: [PATCH 0120/1057] debian: correct indentation level --- debian/README.source | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/debian/README.source b/debian/README.source index 9f20a9d4a2..3ecd6e1294 100644 --- a/debian/README.source +++ b/debian/README.source @@ -48,10 +48,10 @@ The format of debian/modules.conf is: To build this package, I recommend running the following from the root directory of your FS git working tree: - mkdir ../sounds - export FS_SOUNDS_DIR=$(pwd)/../sounds - git clean -fdx && git reset --hard HEAD - (cd debian && ./bootstrap.sh) - schedtool -B -e git-buildpackage --git-verbose -us -uc + mkdir ../sounds + export FS_SOUNDS_DIR=$(pwd)/../sounds + git clean -fdx && git reset --hard HEAD + (cd debian && ./bootstrap.sh) + schedtool -B -e git-buildpackage --git-verbose -us -uc - -- Travis Cross , Sat, 5 May 2012 08:04:19 +0000 + -- Travis Cross , Sat, 5 May 2012 23:32:53 +0000 From f4f0d7e60fc8a4259312d4fcebe55b57cfac07a6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 5 May 2012 23:43:31 +0000 Subject: [PATCH 0121/1057] debian: add instructions on how to quickly setup a demo system --- debian/README.Debian | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/debian/README.Debian b/debian/README.Debian index 607e37ec18..72be2ce528 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -15,4 +15,12 @@ packages, it will install the corresponding sample configuration to /usr/share/freeswitch/conf and you'll need to copy the bits you need to /etc/freeswitch. - -- Travis Cross , Sat, 5 May 2012 06:31:24 +0000 +If you just want to get a working demo system up quickly, I'd +recommend doing the following: + + aptitude install -y -r -o APT::Install-Suggests=true freeswitch-meta-vanilla + cp -a /usr/share/freeswitch/conf/vanilla /etc/freeswitch + /etc/init.d/freeswitch start + fs_cli + + -- Travis Cross , Sat, 5 May 2012 23:41:29 +0000 From 3f1293fa6bbc2a96964d9a4b9483f838061a128e Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 00:17:20 +0000 Subject: [PATCH 0122/1057] ci: use bootstrap -j --- scripts/ci/src_tarball.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 1055c6c481..59c448ad43 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -64,7 +64,7 @@ cp -r . $dst_dir cd $dst_dir -./bootstrap.sh +./bootstrap.sh -j mv bootstrap.sh rebootstrap.sh rm -f docs/AUTHORS rm -f docs/COPYING From d25b2a3e9f13e229cd52b6a016c9305919cb812d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 00:24:57 +0000 Subject: [PATCH 0123/1057] ci: modify our copy of configure.in rather than the original --- scripts/ci/src_tarball.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 59c448ad43..d0f0565aa7 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -38,18 +38,6 @@ fi #stash_saved=1 #fi -sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ - -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ - -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ - -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \ - -i configure.in - -if [ -n "$rev" ]; then - sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ - -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ - -i configure.in -fi - #git add configure.in #git commit -m "Release freeswitch-$ver" #git tag -a -m "freeswitch-$ver release" v$ver @@ -64,6 +52,18 @@ cp -r . $dst_dir cd $dst_dir +sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ + -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \ + -i configure.in + +if [ -n "$rev" ]; then + sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ + -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ + -i configure.in +fi + ./bootstrap.sh -j mv bootstrap.sh rebootstrap.sh rm -f docs/AUTHORS From 52dbfabd0b1e1d9f8f0307460e22d18c68e3d246 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 01:08:44 +0000 Subject: [PATCH 0124/1057] ci: remove obsolete code --- scripts/ci/src_tarball.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index d0f0565aa7..1067f0902d 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -32,21 +32,6 @@ if [ -d "$dst_dir" ]; then exit 1; fi -# save local changes -#ret=$(git stash save "Save uncommitted changes before tagging.") -#if echo $ret | grep "^Saved"; then - #stash_saved=1 -#fi - -#git add configure.in -#git commit -m "Release freeswitch-$ver" -#git tag -a -m "freeswitch-$ver release" v$ver - -#git clone $src_repo $dst_dir -#if [ -n "$stash_saved" ]; then -# git stash pop -#fi - mkdir -p $dst_dir cp -r . $dst_dir From 000e78df0f698c9ed2f5989cec72a0678c0526e6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 01:52:50 +0000 Subject: [PATCH 0125/1057] ci: style --- scripts/ci/debsrcbuilder.sh | 23 ++++++++++++----------- scripts/ci/src_tarball.sh | 16 ++++++++-------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index ee83b6325b..63e3a3db97 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -24,22 +24,23 @@ input_distro=$3 distro=${input_distro:="unstable"} dst_version="$major.$minor.$micro" -dst_name="freeswitch-$dst_version" +dst_name="freeswitch-${dst_version}" dst_parent="/tmp/" -dst_dir="/tmp/$dst_name" -dst_full_version="$dst_version.$build" -dst_full_name="freeswitch-$dst_full_version" +dst_dir="/tmp/${dst_name}" +dst_full_version="${dst_version}.${build}" +dst_full_name="freeswitch-${dst_full_version}" mkdir -p $src_repo/debbuild/ -tar xjf src_dist/$dst_name.tar.bz2 -C $src_repo/debbuild/ -mv $src_repo/debbuild/$dst_name $src_repo/debbuild/$dst_full_name -mv src_dist/$dst_name.tar.bz2 $src_repo/debbuild/freeswitch_${dst_full_version}.orig.tar.bz2 +tar xjf src_dist/${dst_name}.tar.bz2 -C ${src_repo}/debbuild/ +mv ${src_repo}/debbuild/${dst_name} ${src_repo}/debbuild/${dst_full_name} +mv src_dist/${dst_name}.tar.bz2 \ + ${src_repo}/debbuild/freeswitch_${dst_full_version}.orig.tar.bz2 # Build the debian source package first, from the source tar file. -echo "changing directory to $src_repo/debbuild/$dst_full_name" +echo "changing directory to ${src_repo}/debbuild/${dst_full_name}" -cd $src_repo/debbuild/$dst_full_name +cd ${src_repo}/debbuild/${dst_full_name} dch -v "${dst_full_version}-1" -M --force-distribution -D "$distro" "Nightly Build" @@ -52,8 +53,8 @@ if [ $status -gt 0 ]; then else cat 1>&2 < $dst_name.tar.gz || echo "gzip not available" -bzip2 -z -k $dst_name.tar || echo "bzip2 not available" -# xz -z -9 -k $dst_name.tar || echo "xz / xz-utils not available" +# gzip -9 -c ${dst_name}.tar > $dst_name.tar.gz || echo "gzip not available" +bzip2 -z -k ${dst_name}.tar || echo "bzip2 not available" +# xz -z -9 -k ${dst_name}.tar || echo "xz / xz-utils not available" -rm -rf $dst_name.tar $dst_dir +rm -rf ${dst_name}.tar $dst_dir -mkdir -p $src_repo/src_dist -mv -f $dst_name.tar.* $src_repo/src_dist +mkdir -p ${src_repo}/src_dist +mv -f ${dst_name}.tar.* ${src_repo}/src_dist cat 1>&2 < Date: Sun, 6 May 2012 02:07:28 +0000 Subject: [PATCH 0126/1057] ci: remove unused variable --- scripts/ci/src_tarball.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 9dd755fae4..926ef6ec89 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -21,8 +21,6 @@ rev=$(echo "$ver" | cut -d. -f4) tmp_dir=${TMP_DIR:="/tmp"} -build="$2" - dst_name="freeswitch-$major.$minor.$micro" dst_parent="${tmp_dir}/jenkis.$$/" dst_dir="${tmp_dir}/jenkins.$$/$dst_name" @@ -74,7 +72,7 @@ mv -f ${dst_name}.tar.* ${src_repo}/src_dist cat 1>&2 < Date: Sun, 6 May 2012 02:08:29 +0000 Subject: [PATCH 0127/1057] ci: automatically add datestamp to debian nightly build --- scripts/ci/debsrcbuilder.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 63e3a3db97..4d9175c4ac 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -19,7 +19,9 @@ minor=$(echo "$ver" | cut -d. -f2) micro=$(echo "$ver" | cut -d. -f3) rev=$(echo "$ver" | cut -d. -f4) -build="$2" +datestamp="$(date +%Y%m%dT%H%M%SZ)" +nightly="n${datestamp}" +build="b$2" input_distro=$3 distro=${input_distro:="unstable"} @@ -27,7 +29,7 @@ dst_version="$major.$minor.$micro" dst_name="freeswitch-${dst_version}" dst_parent="/tmp/" dst_dir="/tmp/${dst_name}" -dst_full_version="${dst_version}.${build}" +dst_full_version="${dst_version}.${nightly}.${build}" dst_full_name="freeswitch-${dst_full_version}" mkdir -p $src_repo/debbuild/ @@ -42,7 +44,9 @@ echo "changing directory to ${src_repo}/debbuild/${dst_full_name}" cd ${src_repo}/debbuild/${dst_full_name} -dch -v "${dst_full_version}-1" -M --force-distribution -D "$distro" "Nightly Build" +dch -v "${dst_full_version}-1" \ + -M --force-distribution -D "$distro" \ + "Nightly build at ${datestamp}." dpkg-buildpackage -rfakeroot -S -us -uc From 02c0637c0c22e8b1e4d7e94ccfeda2f4b9ff15b4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 02:58:16 +0000 Subject: [PATCH 0128/1057] ci: factor out common code --- scripts/ci/common.sh | 29 +++++++++++++++++++++++++++++ scripts/ci/debsrcbuilder.sh | 21 ++++----------------- scripts/ci/rpmbuilder.sh | 21 ++++----------------- scripts/ci/sounds-en-us-callie.sh | 20 ++++---------------- scripts/ci/src_tarball.sh | 22 ++++------------------ 5 files changed, 45 insertions(+), 68 deletions(-) create mode 100755 scripts/ci/common.sh diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh new file mode 100755 index 0000000000..61f8549d6f --- /dev/null +++ b/scripts/ci/common.sh @@ -0,0 +1,29 @@ +#!/bin/bash +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- + +src_repo="$(pwd)" +tmp_dir=${TMP_DIR:="/tmp"} + +parse_version () { + local ver="$1" + local major=$(echo "$ver" | cut -d. -f1) + local minor=$(echo "$ver" | cut -d. -f2) + local micro=$(echo "$ver" | cut -d. -f3) + local rev=$(echo "$ver" | cut -d. -f4) + echo "ver='$ver'" + echo "major='$major'" + echo "minor='$minor'" + echo "micro='$micro'" + echo "rev='$rev'" +} + +if [ ! -d .git ]; then + echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 + exit 1; +fi + +if [ -z "$1" ]; then + echo "usage: $0 MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2 + exit 1; +fi + diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 4d9175c4ac..3551f3fc49 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -1,24 +1,11 @@ #!/bin/bash ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- -src_repo="$(pwd)" - -if [ ! -d .git ]; then - echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 - exit 1; -fi - -if [ -z "$1" ]; then - echo "usage: ./scripts/ci/debbuilder.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2 - exit 1; -fi - -ver="$1" -major=$(echo "$ver" | cut -d. -f1) -minor=$(echo "$ver" | cut -d. -f2) -micro=$(echo "$ver" | cut -d. -f3) -rev=$(echo "$ver" | cut -d. -f4) +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/common.sh +eval $(parse_version "$1") datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" build="b$2" diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 55e484d014..5f2dd20ec6 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -1,24 +1,11 @@ #!/bin/bash ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- -src_repo="$(pwd)" - -if [ ! -d .git ]; then - echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 - exit 1; -fi - -if [ -z "$1" ]; then - echo "usage: ./scripts/ci/rpmbuilder.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2 - exit 1; -fi - -ver="$1" -major=$(echo "$ver" | cut -d. -f1) -minor=$(echo "$ver" | cut -d. -f2) -micro=$(echo "$ver" | cut -d. -f3) -rev=$(echo "$ver" | cut -d. -f4) +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/common.sh +eval $(parse_version "$1") build="$2" dst_name="freeswitch-$major.$minor.$micro" diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index 1e7ec20c38..fbcf1ea422 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -1,23 +1,11 @@ #!/bin/bash ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- -src_repo="$(pwd)" - -if [ ! -d .git ]; then - echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 - exit 1; -fi - -if [ -z "$1" ]; then - echo "usage: ./scripts/ci/rpmbuilder.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2 - exit 1; -fi - -ver="$1" -major=$(echo "$ver" | cut -d. -f1) -minor=$(echo "$ver" | cut -d. -f2) -micro=$(echo "$ver" | cut -d. -f3) +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/common.sh +eval $(parse_version "$1") build="$2" cd rpmbuild/SOURCES diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 926ef6ec89..27c9c77a8a 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -1,25 +1,11 @@ #!/bin/bash ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- -src_repo="$(pwd)" +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/common.sh -if [ ! -d .git ]; then - echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 - exit 1; -fi - -if [ -z "$1" ]; then - echo "usage: ./scripts/dailys.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2 - exit 1; -fi - -ver="$1" -major=$(echo "$ver" | cut -d. -f1) -minor=$(echo "$ver" | cut -d. -f2) -micro=$(echo "$ver" | cut -d. -f3) -rev=$(echo "$ver" | cut -d. -f4) - -tmp_dir=${TMP_DIR:="/tmp"} +eval $(parse_version "$1") dst_name="freeswitch-$major.$minor.$micro" dst_parent="${tmp_dir}/jenkis.$$/" From 2769fc6585f2892e1ddcf6119c9f02b1dbde1611 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 01:12:08 +0000 Subject: [PATCH 0129/1057] ci: add support for more flexible version numbers --- scripts/ci/common.sh | 40 +++++++++++++++++++++++++++++++------ scripts/ci/debsrcbuilder.sh | 2 +- scripts/ci/rpmbuilder.sh | 6 +++--- scripts/ci/src_tarball.sh | 7 +++++-- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index 61f8549d6f..1d941d2d5a 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -5,16 +5,44 @@ src_repo="$(pwd)" tmp_dir=${TMP_DIR:="/tmp"} parse_version () { - local ver="$1" - local major=$(echo "$ver" | cut -d. -f1) - local minor=$(echo "$ver" | cut -d. -f2) - local micro=$(echo "$ver" | cut -d. -f3) - local rev=$(echo "$ver" | cut -d. -f4) + local ver="$1" major="" minor="" micro="" rev="" + local next=major + for x in $(echo "$1" | sed -e 's/\([._~-]\)/ \1 /g'); do + if [ $next = rev ]; then + rev="${rev}${x}" + elif [ "$x" = "." ] || [ "$x" = "_" ] || [ "$x" = "~" ] || [ "$x" = "-" ]; then + if [ "$x" = "_" ] || [ "$x" = "~" ] || [ "$x" = "-" ]; then + next=rev + eval $next='$x' + else + case $next in + major) next=minor;; + minor) next=micro;; + micro) next=rev;; + esac + fi + else + local tmp="$(eval echo \$$next)" + eval $next='${tmp}${x}' + fi + done + local cmajor cminor cmicro crev cver + cmajor=${major:="0"} + cminor=${minor:="0"} + cmicro=${micro:="0"} + crev="$(echo "$rev" | sed -e 's/[._~-]//')" + cver="${cmajor}.${cminor}.${cmicro}" + [ -n "$crev" ] && cver="${cver}.${crev}" echo "ver='$ver'" echo "major='$major'" echo "minor='$minor'" echo "micro='$micro'" echo "rev='$rev'" + echo "cver='$cver'" + echo "cmajor='$cmajor'" + echo "cminor='$cminor'" + echo "cmicro='$cmicro'" + echo "crev='$crev'" } if [ ! -d .git ]; then @@ -23,7 +51,7 @@ if [ ! -d .git ]; then fi if [ -z "$1" ]; then - echo "usage: $0 MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2 + echo "usage: $0 " 1>&2 exit 1; fi diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 3551f3fc49..75f7026651 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -12,7 +12,7 @@ build="b$2" input_distro=$3 distro=${input_distro:="unstable"} -dst_version="$major.$minor.$micro" +dst_version="$ver" dst_name="freeswitch-${dst_version}" dst_parent="/tmp/" dst_dir="/tmp/${dst_name}" diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 5f2dd20ec6..d5598234ec 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -8,7 +8,7 @@ sdir="." eval $(parse_version "$1") build="$2" -dst_name="freeswitch-$major.$minor.$micro" +dst_name="freeswitch-$cmajor.$cminor.$cmicro" dst_parent="/tmp/" dst_dir="/tmp/$dst_name" @@ -16,7 +16,7 @@ mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SPECS} cd $src_repo -rpmbuild --define "VERSION_NUMBER $ver" \ +rpmbuild --define "VERSION_NUMBER $cver" \ --define "BUILD_NUMBER $build" \ --define "_topdir %(pwd)/rpmbuild" \ --define "_rpmdir %{_topdir}" \ @@ -33,7 +33,7 @@ mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/. cat 1>&2 < $dst_name.tar.gz || echo "gzip not available" bzip2 -z -k ${dst_name}.tar || echo "bzip2 not available" +cp -al ${dst_name}.tar.bz2 ${dst_cname}.tar.bz2 # xz -z -9 -k ${dst_name}.tar || echo "xz / xz-utils not available" rm -rf ${dst_name}.tar $dst_dir mkdir -p ${src_repo}/src_dist mv -f ${dst_name}.tar.* ${src_repo}/src_dist +mv -f ${dst_cname}.tar.* ${src_repo}/src_dist cat 1>&2 < Date: Sun, 6 May 2012 03:24:46 +0000 Subject: [PATCH 0130/1057] ci: remove bashisms and switch to #!/bin/sh --- scripts/ci/common.sh | 2 +- scripts/ci/debsrcbuilder.sh | 2 +- scripts/ci/erlang-rpm.sh | 2 +- scripts/ci/extras/erlangbuilder.sh | 4 ++-- scripts/ci/get_extra_sources.sh | 4 ++-- scripts/ci/rpmbuilder.sh | 4 ++-- scripts/ci/sounds-en-us-callie.sh | 2 +- scripts/ci/sounds-music.sh | 2 +- scripts/ci/sounds-ru-ru-elena.sh | 2 +- scripts/ci/src_tarball.sh | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index 1d941d2d5a..d0ede5aabf 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- src_repo="$(pwd)" diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 75f7026651..02ab0f363b 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- sdir="." diff --git a/scripts/ci/erlang-rpm.sh b/scripts/ci/erlang-rpm.sh index 3557b68f42..35ae226627 100755 --- a/scripts/ci/erlang-rpm.sh +++ b/scripts/ci/erlang-rpm.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- src_repo="$(pwd)" diff --git a/scripts/ci/extras/erlangbuilder.sh b/scripts/ci/extras/erlangbuilder.sh index 51a41ac3f4..dd6fdc6803 100755 --- a/scripts/ci/extras/erlangbuilder.sh +++ b/scripts/ci/extras/erlangbuilder.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- src_repo="$(pwd)" @@ -13,7 +13,7 @@ if [ -z "$1" ]; then exit 1; fi -mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SOURCES,SPECS} +(mkdir -p rpmbuild && cd $_ && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SOURCES SPECS) cd $src_repo rpmbuild --define "_topdir %(pwd)/rpmbuild" \ diff --git a/scripts/ci/get_extra_sources.sh b/scripts/ci/get_extra_sources.sh index add57c7920..c0827c68eb 100755 --- a/scripts/ci/get_extra_sources.sh +++ b/scripts/ci/get_extra_sources.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- src_repo="$(pwd)" @@ -8,7 +8,7 @@ if [ ! -d .git ]; then exit 1; fi -mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SOURCES,SPECS} +(mkdir -p rpmbuild && cd $_ && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SOURCES SPECS) cd $src_repo/rpmbuild/SOURCES diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index d5598234ec..36b8b1d079 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- sdir="." @@ -12,7 +12,7 @@ dst_name="freeswitch-$cmajor.$cminor.$cmicro" dst_parent="/tmp/" dst_dir="/tmp/$dst_name" -mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SPECS} +(mkdir -p rpmbuild && cd $_ && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) cd $src_repo diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index fbcf1ea422..39703028ca 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- sdir="." diff --git a/scripts/ci/sounds-music.sh b/scripts/ci/sounds-music.sh index 118d6b717f..70e61eabec 100755 --- a/scripts/ci/sounds-music.sh +++ b/scripts/ci/sounds-music.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- src_repo="$(pwd)" diff --git a/scripts/ci/sounds-ru-ru-elena.sh b/scripts/ci/sounds-ru-ru-elena.sh index 93da3228f7..33a4f9d004 100755 --- a/scripts/ci/sounds-ru-ru-elena.sh +++ b/scripts/ci/sounds-ru-ru-elena.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- src_repo="$(pwd)" diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index a946976148..d847020380 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- sdir="." From 720e1dc9c4380dbc0574e36954e577c4dc965bb6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 03:32:11 +0000 Subject: [PATCH 0131/1057] ci: bootstrap the debian packaging --- scripts/ci/debsrcbuilder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 02ab0f363b..ce757bf9a4 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -30,7 +30,7 @@ mv src_dist/${dst_name}.tar.bz2 \ echo "changing directory to ${src_repo}/debbuild/${dst_full_name}" cd ${src_repo}/debbuild/${dst_full_name} - +(cd debian && ./bootstrap.sh) dch -v "${dst_full_version}-1" \ -M --force-distribution -D "$distro" \ "Nightly build at ${datestamp}." From 94d91aa4f7fa569577df0cc11f02732994d50f82 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 03:49:34 +0000 Subject: [PATCH 0132/1057] ci: version the debian nightly appropriately --- scripts/ci/debsrcbuilder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index ce757bf9a4..7d3172c5f4 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -16,7 +16,7 @@ dst_version="$ver" dst_name="freeswitch-${dst_version}" dst_parent="/tmp/" dst_dir="/tmp/${dst_name}" -dst_full_version="${dst_version}.${nightly}.${build}" +dst_full_version="${dst_version}~${nightly}~${build}" dst_full_name="freeswitch-${dst_full_version}" mkdir -p $src_repo/debbuild/ From d8376609d16421a8200a93fa2a78a4d7ae8ba102 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 04:11:40 +0000 Subject: [PATCH 0133/1057] ci: note non-base ci build dependencies --- scripts/ci/debsrcbuilder.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 7d3172c5f4..75bfe33ebc 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -31,10 +31,11 @@ echo "changing directory to ${src_repo}/debbuild/${dst_full_name}" cd ${src_repo}/debbuild/${dst_full_name} (cd debian && ./bootstrap.sh) +# dependency: libparse-debcontrol-perl dch -v "${dst_full_version}-1" \ -M --force-distribution -D "$distro" \ "Nightly build at ${datestamp}." - +# dependency: fakeroot dpkg-buildpackage -rfakeroot -S -us -uc status=$? From ab826e67ef4e98bd598be13466f1d437519bbec8 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 04:12:06 +0000 Subject: [PATCH 0134/1057] ci: strip comments from the control file for dch's weak parser --- scripts/ci/debsrcbuilder.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 75bfe33ebc..f8d382c807 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -31,6 +31,10 @@ echo "changing directory to ${src_repo}/debbuild/${dst_full_name}" cd ${src_repo}/debbuild/${dst_full_name} (cd debian && ./bootstrap.sh) +# dch can't handle comments in control file +(cd debian; \ + mv control control.orig; \ + grep -e '^#' -v control.orig > control) # dependency: libparse-debcontrol-perl dch -v "${dst_full_version}-1" \ -M --force-distribution -D "$distro" \ From 1f03d051e21a037cad1cffb0c24f9bff5bf3bd9f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 04:35:46 +0000 Subject: [PATCH 0135/1057] ci: give dch the force option in case we regress version numbers --- scripts/ci/debsrcbuilder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index f8d382c807..be768eb2e1 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -36,7 +36,7 @@ cd ${src_repo}/debbuild/${dst_full_name} mv control control.orig; \ grep -e '^#' -v control.orig > control) # dependency: libparse-debcontrol-perl -dch -v "${dst_full_version}-1" \ +dch -b -v "${dst_full_version}-1" \ -M --force-distribution -D "$distro" \ "Nightly build at ${datestamp}." # dependency: fakeroot From 29fccfc25111cef7c5e6b7a5e03bcf53f7e71609 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 04:41:53 +0000 Subject: [PATCH 0136/1057] ci: check if we have a simple version number --- scripts/ci/src_tarball.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index d847020380..18d4598e7d 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -50,14 +50,14 @@ tar -cvf ${dst_name}.tar $dst_name # gzip -9 -c ${dst_name}.tar > $dst_name.tar.gz || echo "gzip not available" bzip2 -z -k ${dst_name}.tar || echo "bzip2 not available" -cp -al ${dst_name}.tar.bz2 ${dst_cname}.tar.bz2 +[ "$dst_name" = "$dst_cname" ] || cp -al ${dst_name}.tar.bz2 ${dst_cname}.tar.bz2 # xz -z -9 -k ${dst_name}.tar || echo "xz / xz-utils not available" rm -rf ${dst_name}.tar $dst_dir mkdir -p ${src_repo}/src_dist mv -f ${dst_name}.tar.* ${src_repo}/src_dist -mv -f ${dst_cname}.tar.* ${src_repo}/src_dist +[ "$dst_name" = "$dst_cname" ] || mv -f ${dst_cname}.tar.* ${src_repo}/src_dist cat 1>&2 < Date: Sun, 6 May 2012 04:51:15 +0000 Subject: [PATCH 0137/1057] ci: reformat alpha/beta/rc versions for debian --- scripts/ci/common.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index d0ede5aabf..75236302d0 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -32,6 +32,11 @@ parse_version () { cmicro=${micro:="0"} crev="$(echo "$rev" | sed -e 's/[._~-]//')" cver="${cmajor}.${cminor}.${cmicro}" + if [ -n "${micro}" ] && echo "$micro" | grep '^\(alpha\|beta\|rc\)' >/dev/null; then + rev="~${micro}" + micro="0" + ver="${major}.${minor}${rev}" + fi [ -n "$crev" ] && cver="${cver}.${crev}" echo "ver='$ver'" echo "major='$major'" From c65aec5b49961080b7c291c5b918fcdc7b0bec75 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 04:57:57 +0000 Subject: [PATCH 0138/1057] ci: hard link the tarball from src_dst rather than moving --- scripts/ci/debsrcbuilder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index be768eb2e1..2941543f4c 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -23,7 +23,7 @@ mkdir -p $src_repo/debbuild/ tar xjf src_dist/${dst_name}.tar.bz2 -C ${src_repo}/debbuild/ mv ${src_repo}/debbuild/${dst_name} ${src_repo}/debbuild/${dst_full_name} -mv src_dist/${dst_name}.tar.bz2 \ +cp -al src_dist/${dst_name}.tar.bz2 \ ${src_repo}/debbuild/freeswitch_${dst_full_version}.orig.tar.bz2 # Build the debian source package first, from the source tar file. From 075dc90bdb54b8c87418bea7b734050a32129621 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 05:26:56 +0000 Subject: [PATCH 0139/1057] ci: build orig tarball ourselves for debian --- scripts/ci/common.sh | 23 +++++++++++++++++ scripts/ci/debsrcbuilder.sh | 49 ++++++++++++++++--------------------- scripts/ci/src_tarball.sh | 28 +++------------------ 3 files changed, 48 insertions(+), 52 deletions(-) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index 75236302d0..a570cd8008 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -50,6 +50,29 @@ parse_version () { echo "crev='$crev'" } +set_fs_ver () { + local ver="$1" major="$2" minor="$3" micro="$4" rev="$5" + sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ + -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$ver\2|" \ + -i configure.in + if [ -n "$rev" ]; then + sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ + -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ + -i configure.in + fi +} + +gnuize () { + ./bootstrap.sh -j + mv bootstrap.sh rebootstrap.sh + rm -f docs/AUTHORS + rm -f docs/COPYING + rm -f docs/ChangeLog + rm -rf .git +} + if [ ! -d .git ]; then echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 exit 1; diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 2941543f4c..647efa834e 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -9,49 +9,42 @@ eval $(parse_version "$1") datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" build="b$2" -input_distro=$3 -distro=${input_distro:="unstable"} +distro=${3:="unstable"} -dst_version="$ver" -dst_name="freeswitch-${dst_version}" -dst_parent="/tmp/" -dst_dir="/tmp/${dst_name}" -dst_full_version="${dst_version}~${nightly}~${build}" -dst_full_name="freeswitch-${dst_full_version}" +fver="${ver}~${nightly}~${build}" +fname="freeswitch-$fver" +orig="freeswitch_$fver.orig" +ddir=$src_repo/debbuild +bdir=$src_repo/debbuild/$fname -mkdir -p $src_repo/debbuild/ +mkdir -p $ddir +git clone . $bdir +cd $bdir +set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" +gnuize +sleep 2 +cd $ddir +tar -c --exclude=.git -vf $orig.tar $fname +bzip2 -z -k $orig.tar +rm $orig.tar -tar xjf src_dist/${dst_name}.tar.bz2 -C ${src_repo}/debbuild/ -mv ${src_repo}/debbuild/${dst_name} ${src_repo}/debbuild/${dst_full_name} -cp -al src_dist/${dst_name}.tar.bz2 \ - ${src_repo}/debbuild/freeswitch_${dst_full_version}.orig.tar.bz2 - -# Build the debian source package first, from the source tar file. -echo "changing directory to ${src_repo}/debbuild/${dst_full_name}" - -cd ${src_repo}/debbuild/${dst_full_name} +cd $bdir (cd debian && ./bootstrap.sh) # dch can't handle comments in control file (cd debian; \ mv control control.orig; \ grep -e '^#' -v control.orig > control) # dependency: libparse-debcontrol-perl -dch -b -v "${dst_full_version}-1" \ +dch -b -v "${fver}-1" \ -M --force-distribution -D "$distro" \ "Nightly build at ${datestamp}." # dependency: fakeroot -dpkg-buildpackage -rfakeroot -S -us -uc +dpkg-buildpackage -rfakeroot -S -us -uc || exit $? -status=$? - -if [ $status -gt 0 ]; then - exit $status -else - cat 1>&2 <&2 < $dst_name.tar.gz || echo "gzip not available" bzip2 -z -k ${dst_name}.tar || echo "bzip2 not available" -[ "$dst_name" = "$dst_cname" ] || cp -al ${dst_name}.tar.bz2 ${dst_cname}.tar.bz2 # xz -z -9 -k ${dst_name}.tar || echo "xz / xz-utils not available" rm -rf ${dst_name}.tar $dst_dir mkdir -p ${src_repo}/src_dist mv -f ${dst_name}.tar.* ${src_repo}/src_dist -[ "$dst_name" = "$dst_cname" ] || mv -f ${dst_cname}.tar.* ${src_repo}/src_dist cat 1>&2 < Date: Sun, 6 May 2012 05:38:31 +0000 Subject: [PATCH 0140/1057] ci: leave debian .orig tarball unbootstrapped --- scripts/ci/debsrcbuilder.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 647efa834e..dcac7028dd 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -21,7 +21,6 @@ mkdir -p $ddir git clone . $bdir cd $bdir set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" -gnuize sleep 2 cd $ddir tar -c --exclude=.git -vf $orig.tar $fname From ca073d61b3ba96a47e509199a915ad4fdd60fe57 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 05:44:08 +0000 Subject: [PATCH 0141/1057] ci: use xz for the debian packages --- scripts/ci/debsrcbuilder.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index dcac7028dd..5279d6c403 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -24,8 +24,8 @@ set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" sleep 2 cd $ddir tar -c --exclude=.git -vf $orig.tar $fname -bzip2 -z -k $orig.tar -rm $orig.tar +echo "Compressing $orig.tar with xz -9e..." >&2 +xz -9e $orig.tar cd $bdir (cd debian && ./bootstrap.sh) @@ -38,7 +38,7 @@ dch -b -v "${fver}-1" \ -M --force-distribution -D "$distro" \ "Nightly build at ${datestamp}." # dependency: fakeroot -dpkg-buildpackage -rfakeroot -S -us -uc || exit $? +dpkg-buildpackage -S -rfakeroot -uc -us -i\.git -I.git -Zxz -z9 || exit ? cat 1>&2 < Date: Sun, 6 May 2012 06:29:35 +0000 Subject: [PATCH 0142/1057] ci: compress xz -6 to be nice to Ken's build server --- scripts/ci/debsrcbuilder.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 5279d6c403..86e53791ea 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -24,8 +24,8 @@ set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" sleep 2 cd $ddir tar -c --exclude=.git -vf $orig.tar $fname -echo "Compressing $orig.tar with xz -9e..." >&2 -xz -9e $orig.tar +echo "Compressing $orig.tar with xz -6..." >&2 +xz -6 $orig.tar cd $bdir (cd debian && ./bootstrap.sh) From 1269891f508bce09a6a2d5bb858f56e9062ca47f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 06:48:01 +0000 Subject: [PATCH 0143/1057] ci: fix old error --- scripts/ci/src_tarball.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index a23fe8fd8c..7fd48621e3 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -8,7 +8,6 @@ sdir="." eval $(parse_version "$1") dst_name="freeswitch-$cmajor.$cminor.$cmicro" -dst_parent="${tmp_dir}/jenkis.$$/" dst_dir="${tmp_dir}/jenkins.$$/$dst_name" if [ -d "$dst_dir" ]; then @@ -23,11 +22,7 @@ cd $dst_dir set_fs_ver "$cver" "$cmajor" "$cminor" "$cmicro" "$crev" gnuize cd .. - -cd $dst_parent - ls - tar -cvf ${dst_name}.tar $dst_name # gzip -9 -c ${dst_name}.tar > $dst_name.tar.gz || echo "gzip not available" From fd6c0435fbecf3731fdc5d352cc92ae943d5318e Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 07:13:17 +0000 Subject: [PATCH 0144/1057] docs: vanity --- docs/AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/AUTHORS b/docs/AUTHORS index 1f754c50b5..6e51a00585 100644 --- a/docs/AUTHORS +++ b/docs/AUTHORS @@ -28,6 +28,7 @@ that much better: Justin Unger - Lots of help with patches and SIP testing. Thanks! Paul D. Tinsley - Various patches and support. Ken Rice - - xmlcdr, sofia improvements, load testing, 1 liners here and there. + Travis Cross - git migration, Debian packaging, ZRTP integration, and many other improvements Neal Horman - conference improvements, switch_ivr menu additions and other tweaks. Johny Kadarisman - mod_python fixups. Michael Murdock - testing, documentation, bug finding and usability enhancements. From 621ec4ae1ab97abe427a2bb39616b82733b0c78b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 07:14:22 +0000 Subject: [PATCH 0145/1057] debian: fix issues raised by lintian on source package --- debian/bootstrap.sh | 8 +++++--- debian/copyright | 21 +++++++++++++++++++-- debian/freeswitch-dev.install | 3 ++- debian/rules | 6 ++++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 6c41ebc817..2b7afe5472 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -143,7 +143,7 @@ Build-Depends: # bootstrapping automake (>= 1.9), autoconf, libtool, # core build - build-essential, wget, pkg-config, + dpkg-dev, gcc, g++, libc6-dev, make, wget, pkg-config, # configure options libssl-dev, unixodbc-dev, libncurses5-dev, libjpeg8-dev, @@ -156,7 +156,7 @@ Build-Depends: bison, zlib1g-dev, # module build-depends $(debian_wrap "${mod_build_depends}") -Standards-Version: 3.9.2 +Standards-Version: 3.9.3 Homepage: http://freeswitch.org/ Vcs-Git: git://git.freeswitch.org/freeswitch Vcs-Browser: http://git.freeswitch.org/git/freeswitch/ @@ -325,6 +325,7 @@ Description: development libraries and header files for FreeSWITCH Package: freeswitch-doc Architecture: all +Depends: \${misc:Depends} Description: documentation for FreeSWITCH $(debian_wrap "${fs_description}") . @@ -465,7 +466,8 @@ EOF print_mod_install () { cat < +Copyright: 2012, Travis Cross License: MPL or GPL2+ (at your option) + This packaging may be distributed under either (at your option) the + terms of the MPLv1.1 as described in docs/COPYING in the FreeSWITCH + source tree, or under the terms of the GNU GPL, version 2 or later, + as found on Debian systems in /usr/share/common-licenses/GPL-2. + +Files: * +Copyright: 2012, Anthony Minessale II and many other contributors +License: MPL + The contents of these files are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use these files 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. diff --git a/debian/freeswitch-dev.install b/debian/freeswitch-dev.install index 704d7b1444..97685b764b 100644 --- a/debian/freeswitch-dev.install +++ b/debian/freeswitch-dev.install @@ -1,4 +1,5 @@ /usr/include /usr/lib/freeswitch/mod/*.la -/usr/lib/*.{a,la} +/usr/lib/*.a +/usr/lib/*.la /usr/lib/pkgconfig diff --git a/debian/rules b/debian/rules index 62fdd7a93d..d8291d2548 100755 --- a/debian/rules +++ b/debian/rules @@ -30,6 +30,12 @@ binary-arch: binary-indep: @$(call show_vars) dh $@ +build-arch: + @$(call show_vars) + dh $@ +build-indep: + @$(call show_vars) + dh $@ build: debian/.stamp-bootstrap @$(call show_vars) dh $@ From 087bafe476cd945bd61f0b561d54c2211d4753bc Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 07:28:10 +0000 Subject: [PATCH 0146/1057] debian: correct new issue raised by lintian on source package --- debian/bootstrap.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 2b7afe5472..c5fa1ec3b1 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -143,7 +143,9 @@ Build-Depends: # bootstrapping automake (>= 1.9), autoconf, libtool, # core build - dpkg-dev, gcc, g++, libc6-dev, make, wget, pkg-config, + dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5) , g++ (>= 4:4.4.5), + libc6-dev (>= 2.11.3), make (>= 3.81), + wget, pkg-config, # configure options libssl-dev, unixodbc-dev, libncurses5-dev, libjpeg8-dev, From 2668e843b02b415b247f875aade0ea408fff063f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 09:01:01 +0000 Subject: [PATCH 0147/1057] ci: remove sleep --- scripts/ci/debsrcbuilder.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 86e53791ea..5361eab4ff 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -21,7 +21,6 @@ mkdir -p $ddir git clone . $bdir cd $bdir set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" -sleep 2 cd $ddir tar -c --exclude=.git -vf $orig.tar $fname echo "Compressing $orig.tar with xz -6..." >&2 From 50c0065a539b0e537e4f6dcf5c37f02babbc8f64 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 09:01:37 +0000 Subject: [PATCH 0148/1057] ci: download and bundle all external libraries into debian source package --- scripts/ci/debsrcbuilder.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 5361eab4ff..674477ef46 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -21,6 +21,32 @@ mkdir -p $ddir git clone . $bdir cd $bdir set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" +cd libs +getlib () { + f="${1##*/}" + echo "fetching: $1 to $f" >&2 + wget -N "$1" \ + && tar -xv --no-same-owner --no-same-permissions -f "$f" \ + && rm -f "$f" \ + && mkdir -p $f +} +getlib http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v1.8-latest.tgz +getlib http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz +getlib http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz +getlib http://files.freeswitch.org/downloads/libs/soundtouch-1.6.0.tar.gz +getlib http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2 +getlib http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz +getlib http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz +getlib http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz +getlib http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz +getlib http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz +getlib http://files.freeswitch.org/downloads/libs/openldap-2.4.19.tar.gz +getlib http://download.zeromq.org/zeromq-2.1.9.tar.gz \ + || getlib http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz +getlib http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.6.tar.gz +getlib http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz +getlib http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz +getlib http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz cd $ddir tar -c --exclude=.git -vf $orig.tar $fname echo "Compressing $orig.tar with xz -6..." >&2 From 5055149572ec33e20bfbf4bbd4283566b5f3f0cb Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 09:48:30 +0000 Subject: [PATCH 0149/1057] ci: cleanup after mongo --- scripts/ci/debsrcbuilder.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 674477ef46..3dc56e5faa 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -47,6 +47,9 @@ getlib http://files.freeswitch.org/downloads/libs/freeradius-client-1.1.6.tar.gz getlib http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz getlib http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz getlib http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz +cd mongo-cxx-driver-v1.8 +rm -rf config.log .sconf_temp *Test *Example +find . -name "*.o" -exec rm -f {} \; cd $ddir tar -c --exclude=.git -vf $orig.tar $fname echo "Compressing $orig.tar with xz -6..." >&2 From df0861610f7d2b8ae306a6f6390ec9080de2e48b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 10:23:37 +0000 Subject: [PATCH 0150/1057] debian: disable mod_mongo as it's causing CI problems --- debian/bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index c5fa1ec3b1..c6f1b18e12 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -10,6 +10,7 @@ avoid_mods=( applications/mod_fax applications/mod_ladspa applications/mod_limit + applications/mod_mongo applications/mod_mp4 applications/mod_osp applications/mod_rad_auth From 883dd296e750fc05b539e4000465a1256c6e37e6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 11:27:00 +0000 Subject: [PATCH 0151/1057] debian: set possible dependencies for mod_shout and disable the module --- debian/bootstrap.sh | 1 + debian/control-modules | 3 +++ 2 files changed, 4 insertions(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index c6f1b18e12..ce595d2008 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -29,6 +29,7 @@ avoid_mods=( endpoints/mod_unicall event_handlers/mod_snmp formats/mod_portaudio_stream + formats/mod_shout formats/mod_vlc languages/mod_java languages/mod_managed diff --git a/debian/control-modules b/debian/control-modules index bb3ed507e8..ffdc6b9eff 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -482,6 +482,9 @@ Description: mod_shell_stream Module: formats/mod_shout Description: mod_shout Adds mod_shout. +Build-Depends: libogg-dev, libvorbis-dev +Depends: libogg0, libvorbis0a, libvorbisenc2, libvorbisfile3, + libvorbisidec1 Module: formats/mod_sndfile Description: mod_sndfile From f1290a7bb1796980d9699d6b0263409a75cbc9fc Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 18:34:12 +0000 Subject: [PATCH 0152/1057] debian: properly label metapackages --- debian/bootstrap.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index ce595d2008..83c68e5be0 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -194,7 +194,8 @@ Suggests: Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") . - This is a meta package containing a very bare FreeSWITCH install. + This is a metapackage which depends on the packages needed for a very + bare FreeSWITCH install. Package: freeswitch-meta-default Architecture: any @@ -231,8 +232,8 @@ Suggests: Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") . - This is a meta package containing a reasonable basic FreeSWITCH - install. + This is a metapackage which depends on the packages needed for a + reasonably basic FreeSWITCH install. Package: freeswitch-meta-vanilla Architecture: any @@ -283,8 +284,8 @@ Suggests: Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") . - This is a meta package containing the FreeSWITCH modules required to - run the vanilla example configuration. + This is a metapackage which depends on the packages needed for + running the FreeSWITCH vanilla example configuration. Package: freeswitch-meta-codecs Architecture: any @@ -307,7 +308,8 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") . - This is a meta package containing most FreeSWITCH codecs. + This is a metapackage which depends on the packages needed to install + most FreeSWITCH codecs. Package: freeswitch-dbg Section: debug @@ -334,6 +336,7 @@ Description: documentation for FreeSWITCH $(debian_wrap "${fs_description}") . This package contains Doxygen-produce documentation for FreeSWITCH. + It may be an empty package at the moment. Package: freeswitch-init Architecture: all @@ -343,8 +346,8 @@ Depends: \${misc:Depends}, Description: FreeSWITCH startup configuration $(debian_wrap "${fs_description}") . - This package contains the system startup configuration for - FreeSWITCH. + This is a metapackage which depends on the default system startup + packages for FreeSWITCH. Package: freeswitch-sysvinit Architecture: all @@ -381,7 +384,8 @@ Depends: \${misc:Depends}, Description: Music on hold audio for FreeSWITCH $(debian_wrap "${fs_description}") . - This package contains music on hold audio for FreeSWITCH. + This is a metapackage which depends on the default music on hold + packages for FreeSWITCH. Package: freeswitch-music-default Architecture: all @@ -394,7 +398,8 @@ Recommends: Description: Music on hold audio for FreeSWITCH $(debian_wrap "${fs_description}") . - This package contains the default music on hold audio for FreeSWITCH. + This is a metapackage which depends on the default music on hold + packages for FreeSWITCH at various sampling rates. Package: freeswitch-sounds Architecture: all @@ -403,7 +408,8 @@ Depends: \${misc:Depends}, Description: Sounds for FreeSWITCH $(debian_wrap "${fs_description}") . - This package contains sounds for FreeSWITCH. + This is a metapackage which depends on the default sound packages for + FreeSWITCH. Package: freeswitch-sounds-en Architecture: all @@ -412,7 +418,8 @@ Depends: \${misc:Depends}, Description: English sounds for FreeSWITCH $(debian_wrap "${fs_description}") . - This package contains the English sounds for FreeSWITCH. + This is a metapackage which depends on the default English sound + packages for FreeSWITCH. Package: freeswitch-sounds-en-us Architecture: all @@ -421,7 +428,8 @@ Depends: \${misc:Depends}, Description: US English sounds for FreeSWITCH $(debian_wrap "${fs_description}") . - This package contains the US/English sounds for FreeSWITCH. + This is a metapackage which depends on the default US/English sound + packages for FreeSWITCH. Package: freeswitch-sounds-en-us-callie Architecture: all From 3ee672467a92dc117b0a44afa2b81b12a18039df Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 19:08:40 +0000 Subject: [PATCH 0153/1057] debian: fix typo --- debian/control-modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control-modules b/debian/control-modules index ffdc6b9eff..922bbf119d 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -199,7 +199,7 @@ Description: UserSpy Module: applications/mod_stress Description: Voice stress detection - This module attemps to detect voice stress on an audio channel. + This module attempts to detect voice stress on an audio channel. Module: applications/mod_valet_parking Description: Valet parking From 2439bfe90564299579059bcc626152919721ab18 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 19:09:23 +0000 Subject: [PATCH 0154/1057] debian: mark debug packages as priority extra It's required by lintian. --- debian/bootstrap.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 83c68e5be0..89b7f7acf5 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -313,6 +313,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: freeswitch-dbg Section: debug +Priority: extra Architecture: any Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) Description: debugging symbols for FreeSWITCH @@ -463,6 +464,7 @@ Description: ${description} for FreeSWITCH Package: freeswitch-${module_name//_/-}-dbg Section: debug +Priority: extra Architecture: any Depends: \${misc:Depends}, freeswitch-${module_name//_/-} (= \${binary:Version}) From 90217e864b5ebf70e3220de8f44df2489d0a11b4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 19:12:47 +0000 Subject: [PATCH 0155/1057] debian: add remote_fs and required-stop to init --- debian/freeswitch-sysvinit.freeswitch.init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/freeswitch-sysvinit.freeswitch.init b/debian/freeswitch-sysvinit.freeswitch.init index d02229b4e9..2b48cfd852 100644 --- a/debian/freeswitch-sysvinit.freeswitch.init +++ b/debian/freeswitch-sysvinit.freeswitch.init @@ -2,8 +2,8 @@ ### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ### BEGIN INIT INFO # Provides: freeswitch -# Required-Start: $network $local_fs -# Required-Stop: +# Required-Start: $network $remote_fs $local_fs +# Required-Stop: $network $remote_fs $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: FreeSWITCH Softswitch From 9a543ec9db2f4e41161ba4e88d8b562cb79a7177 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 19:26:52 +0000 Subject: [PATCH 0156/1057] debian: put freeswitch-doc into the doc section --- debian/bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 89b7f7acf5..5e29a75bb1 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -331,6 +331,7 @@ Description: development libraries and header files for FreeSWITCH This package contains include files for FreeSWITCH. Package: freeswitch-doc +Section: doc Architecture: all Depends: \${misc:Depends} Description: documentation for FreeSWITCH From 34afc6cb2e5ee986ef73bedc907027a59ce8aa80 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 22:33:46 +0000 Subject: [PATCH 0157/1057] debian: fix last empty-binary-package lintian warning --- debian/bootstrap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 5e29a75bb1..bc82e64289 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -444,7 +444,8 @@ Recommends: Description: US English sounds for FreeSWITCH $(debian_wrap "${fs_description}") . - This package contains the Callie English sounds for FreeSWITCH. + This is a metapackage which depends on the US/English Callie sound + packages for FreeSWITCH at various sampling rates. EOF } From fa55b5e82d0faf2d9da3622ea9a46d67493ff6e5 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 22:46:13 +0000 Subject: [PATCH 0158/1057] debian: avoid lintian maintainer-script-empty We are going to fill in these files with useful things. --- debian/freeswitch.preinst | 3 +++ debian/freeswitch.prerm | 1 + 2 files changed, 4 insertions(+) diff --git a/debian/freeswitch.preinst b/debian/freeswitch.preinst index 56dc52da8f..01d322e76c 100644 --- a/debian/freeswitch.preinst +++ b/debian/freeswitch.preinst @@ -3,6 +3,9 @@ set -e case "$1" in install|upgrade) + if [ -d /opt/freeswitch ]; then + echo "It looks like you have FreeSWITCH installed manually." >&2 + fi ;; abort-upgrade) diff --git a/debian/freeswitch.prerm b/debian/freeswitch.prerm index c2d46bc865..24906ff7e9 100644 --- a/debian/freeswitch.prerm +++ b/debian/freeswitch.prerm @@ -3,6 +3,7 @@ set -e case "$1" in remove|upgrade|deconfigure) + echo "We're about to remove FreeSWITCH..." >&2 ;; failed-upgrade) From 8bbfe99e19cb3cd3dff95bd80f8f92bb6185de63 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 22:46:36 +0000 Subject: [PATCH 0159/1057] debian: whitespace --- debian/freeswitch.postinst | 2 -- debian/freeswitch.postrm | 1 - debian/freeswitch.preinst | 2 -- debian/freeswitch.prerm | 2 -- 4 files changed, 7 deletions(-) diff --git a/debian/freeswitch.postinst b/debian/freeswitch.postinst index d1bbe72c15..444c602bc4 100644 --- a/debian/freeswitch.postinst +++ b/debian/freeswitch.postinst @@ -27,10 +27,8 @@ case "$1" in chmod -R o-rwx,g+u $x done ;; - abort-upgrade|abort-remove|abort-deconfigure) ;; - *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 diff --git a/debian/freeswitch.postrm b/debian/freeswitch.postrm index 5e21c84397..48852014c8 100644 --- a/debian/freeswitch.postrm +++ b/debian/freeswitch.postrm @@ -19,7 +19,6 @@ case "$1" in done fi ;; - *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 diff --git a/debian/freeswitch.preinst b/debian/freeswitch.preinst index 01d322e76c..31ad410fd7 100644 --- a/debian/freeswitch.preinst +++ b/debian/freeswitch.preinst @@ -7,10 +7,8 @@ case "$1" in echo "It looks like you have FreeSWITCH installed manually." >&2 fi ;; - abort-upgrade) ;; - *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 diff --git a/debian/freeswitch.prerm b/debian/freeswitch.prerm index 24906ff7e9..f5448bcee4 100644 --- a/debian/freeswitch.prerm +++ b/debian/freeswitch.prerm @@ -5,10 +5,8 @@ case "$1" in remove|upgrade|deconfigure) echo "We're about to remove FreeSWITCH..." >&2 ;; - failed-upgrade) ;; - *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 From c7426963b7437c4b06daabbab942eb6cc5073adb Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 23:26:37 +0000 Subject: [PATCH 0160/1057] debian: overrides some irrelevant lintian warnings --- debian/.gitignore | 1 + debian/bootstrap.sh | 67 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/debian/.gitignore b/debian/.gitignore index 777b48dd70..437658053c 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -10,6 +10,7 @@ /freeswitch-conf-*.install /freeswitch-music-*.install /freeswitch-sounds-*.install +/*.lintian-overrides /*.log /*.substvars /*.debhelper diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index bc82e64289..a91e1f0ead 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -487,6 +487,39 @@ print_mod_install () { EOF } +print_common_overrides () { + m="$1" + cat <> $f } +genoverrides_per_mod () { + local f=freeswitch-${module_name//_/-}.lintian-overrides + (print_edit_warning; print_mod_overrides freeswitch-${module_name//_/-}) > $f + test -f $f.tmpl && cat $f.tmpl >> $f +} + genmodules_per_cat () { echo "## $category" >> modules_.conf } @@ -574,17 +613,25 @@ genmodules_per_mod () { genconf () { print_conf_control >> control - local f=freeswitch-conf-${conf//_/-}.install + local p=freeswitch-conf-${conf//_/-} + local f=$p.install (print_edit_warning; print_conf_install) > $f test -f $f.tmpl && cat $f.tmpl >> $f + local f=$p.lintian-overrides + (print_edit_warning; print_conf_overrides "$p") > $f + test -f $f.tmpl && cat $f.tmpl >> $f } genmusic () { rate="$1" rate_k="${rate%%000}k" print_music_control >> control - local f=freeswitch-music-default-${rate_k}.install + local p=freeswitch-music-default-${rate_k} + local f=$p.install (print_edit_warning; print_music_install) > $f test -f $f.tmpl && cat $f.tmpl >> $f + local f=$p.lintian-overrides + (print_edit_warning; print_music_overrides "$p") > $f + test -f $f.tmpl && cat $f.tmpl >> $f unset rate rate_k } @@ -594,9 +641,13 @@ gensound () { country=$(echo $sound | cut -d/ -f2) speaker=$(echo $sound | cut -d/ -f3) print_sound_control >> control - local f=freeswitch-sounds-${sound//\//-}-${rate_k}.install + local p=freeswitch-sounds-${sound//\//-}-${rate_k} + local f=$p.install (print_edit_warning; print_sound_install) > $f test -f $f.tmpl && cat $f.tmpl >> $f + local f=$p.lintian-overrides + (print_edit_warning; print_sound_overrides "$p") > $f + test -f $f.tmpl && cat $f.tmpl >> $f unset rate rate_k sound sound_path language country speaker } @@ -752,6 +803,14 @@ map_confs 'genconf' (echo "### modules"; echo) >> control map_modules "mod_filter" \ "gencontrol_per_cat genmodules_per_cat" \ - "gencontrol_per_mod geninstall_per_mod genmodules_per_mod" + "gencontrol_per_mod geninstall_per_mod genoverrides_per_mod genmodules_per_mod" + +grep -e '^Package:' control | while xread l; do + m="${l#*: }" + f=$m.lintian-overrides + if [ ! -s $f ] || ! grep -e 'package-has-long-file-name' $f >/dev/null; then + (print_edit_warning; print_common_overrides "$m") >> $f + fi +done touch .stamp-bootstrap From 6c5abe4616a45bcb27526be54d1642c5bea326c9 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 6 May 2012 23:29:31 +0000 Subject: [PATCH 0161/1057] debian: add wildcard to lintian override --- debian/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index a91e1f0ead..66f77b6270 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -493,7 +493,7 @@ print_common_overrides () { # The long file names are caused by appending the nightly information. # Since one of these packages will never end up on a Debian CD, the # related problems with long file names will never come up here. -${m}: package-has-long-file-name +${m}: package-has-long-file-name * EOF } From 664e2e322a643cc85c6e79047bdaddc7b3b7556d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 00:45:04 +0000 Subject: [PATCH 0162/1057] debian: simplify default build PATH --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index d8291d2548..5581ffdacf 100755 --- a/debian/rules +++ b/debian/rules @@ -6,7 +6,7 @@ FS_CFLAGS?=-ggdb3 -O2 FS_CPPFLAGS?= FS_CXXFLAGS?=$(FS_CFLAGS) FS_INSTALL_SOUNDS?=true -export PATH?=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +export PATH?=/usr/lib/ccache:/usr/sbin:/usr/bin:/sbin:/bin export CFLAGS=$(FS_CFLAGS) export CPPFLAGS=$(FS_CPPFLAGS) export CXXFLAGS=$(FS_CXXFLAGS) From ffc4c83bfa8959383ed1397255bce264b88d5518 Mon Sep 17 00:00:00 2001 From: Di-Shi Sun Date: Mon, 7 May 2012 15:52:11 +0800 Subject: [PATCH 0163/1057] Added mod_osp module documentation. --- src/mod/applications/mod_osp/docs/mod_osp.txt | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/mod/applications/mod_osp/docs/mod_osp.txt diff --git a/src/mod/applications/mod_osp/docs/mod_osp.txt b/src/mod/applications/mod_osp/docs/mod_osp.txt new file mode 100644 index 0000000000..a5686a4a03 --- /dev/null +++ b/src/mod/applications/mod_osp/docs/mod_osp.txt @@ -0,0 +1,84 @@ +FreeSWITCH Open Settlement Protocol (OSP) module + +This module provides OSP based call authentication, authorization, routing lookup and call detail record (CDR) collection services using standard FreeSWITCH application and dailplan interfaces. + +The OSP module can be configured by the following parameters in osp.conf.xml: + +Global parameters: + + + + + +Global parameter names and values can be: + +debug-info: Flag to show OSP module debug information. The default is "disabled". +log-level: At which log level to show OSP module debug information. The default is "info". +crypto-hardware: If to use hardware for OpenSSL. The default is "disabled". +sip: Used SIP module and profile. The default is "sofia" and "external". +h323: Used H.323 module and profile. The default is "h323" and "external". This option has not been implemented. +iax: Used IAX2 module and profile. The default is "iax" and "external". This option has not been implemented. +skype: Used Skype module and profile. The default is "skypopen" and "external". This option has not been implemented. +default-protocol: The VoIP protocol for destinations with unknown/undefined protocol. The default is "sip". + +OSP provider parameters: + + + + + + + +OSP provider parameter names ane values cab be: + +profile: OSP provider profile name. +service-point-url: OSP service point URL. This parameter must be defined. Up to 8 URLs are allowed. +device-ip: FreeSWITCH IP for OSP module. This parameter must be defined. +ssl-lifetime: SSL lifetime. The default is 300 in seconds. +http-max-connections: HTTP max connections. The default is 20. +http-persistence: HTTP persistence. The default is 60 in seconds. +http-retry-delay: HTTP retry delay. The default is 0 in seconds. +http-retry-limit: HTTP retry times. The default is 2. +http-timeout: HTTP timeout. The default is 10000 in ms. +work-mode: OSP module work mode (direct and indirect). The default is "direct". +service-type: OSP service type (voice and npquery). The default is "voice". +max-destinations: Max destinations OSP server will return. It is up to 12. The default is 12. + +The OSP application is called in dial plan like this: + + + +The OSP dialplan is called in dial plan like this: + + + +For both OSP application and dialplan, the is an OSP service provider name configured in osp.conf.xml. If it is empty, profile "default" is used. + +Both OSP application and dialplan accept a set of inbound channel variables that are used to pass additional call information to OSP module. These channel variables include: + +osp_source_device: Actual source device IP address channel variable. It is only for FreeSWITH OSP module running in indirect mode. +osp_source_nid: Source device network ID channel variable. +osp_custom_info_N: Up to 8 custom info channel variables. N is the index starting from 1. +osp_networkid_userparam: The URI user parameter name that is used to present destination network ID. +osp_networkid_uriparam: The URI parameter name that is used to present destination network ID. +osp_user_phone: Flag to add "user=phone" URI parameter. The default is "disabled". +osp_outbound_proxy: Outbound proxy IP address channel variable. + +Both OSP application and dialplan also export a set of channel variables for outbound channels and FreeSWITCH dial plan logic (for OSP dialplan, some exported channel variables are not visible for dial plan). These channel variables include: + +osp_profile: Used OSP profile name. Used by outbound channels. +osp_transaction_id: OSP transaction ID. Used by outbound channels. +osp_calling: Original inbound calling number. Used by outbound channels. +osp_called: Original inbound called number. Used by outbound channels. +osp_start_time: Inbound call start time. Used by outbound channels. +osp_source_device: Actual source device. Used by outbound channels. It is only for FreeSWITH OSP module running in indirect mode. +osp_source_nid: Source network ID. Used by outbound channels. +osp_destination_total: Total number of destinations from OSP servers. Used by outbound channels. +osp_destination_count: Destination index. Used by outbound channels. +osp_destination_ip: Destination IP. Used by outbound channels. +osp_destination_nid: Destination network ID. Used by outbound channels. +osp_authreq_status: Authorization request result status. +osp_route_count: Number of supported destinations. +osp_route_N: Destination route string. N is the index starting from 1. +osp_auto_route: Bridge route string. + From 7f76b67f5d5e9fda0a9a713874c8112effaf5d1a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 08:17:41 -0500 Subject: [PATCH 0164/1057] FS-4191 --resolve --- src/include/switch_types.h | 1 + src/mod/applications/mod_dptools/mod_dptools.c | 1 + src/switch_ivr_originate.c | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 47336a800a..35ca619cbd 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1212,6 +1212,7 @@ typedef enum { CF_ZRTP_HASH, CF_ZRTP_PASS, CF_CHANNEL_SWAP, + CF_PICKUP, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index d5430cf1df..db259412b0 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3490,6 +3490,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio switch_channel_set_name(nchannel, name); switch_channel_set_variable(nchannel, "process_cdr", "false"); pickup_add_session(nsession, pickup); + switch_channel_set_flag(nchannel, CF_PICKUP); goto done; diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c3da16f072..1962fc0cff 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -429,6 +429,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat char bug_key[256] = ""; int send_ringback = 0; uint8_t ring_ready_val = 0; + int pickups = 0; oglobals->hups = 0; oglobals->idx = IDX_NADA; @@ -462,6 +463,11 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat } } + + if (originate_status[i].peer_channel && switch_channel_test_flag(originate_status[i].peer_channel, CF_PICKUP)) { + pickups++; + } + if (!(originate_status[i].peer_channel && originate_status[i].peer_session)) { oglobals->hups++; continue; @@ -719,7 +725,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat } } - if (oglobals->hups == len) { + if (oglobals->hups + pickups == len) { rval = 0; } else { rval = 1; From 090345de4c185fd983d72ebbacae058a4bc780ed Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 08:46:04 -0500 Subject: [PATCH 0165/1057] add outcall_flags --- src/mod/applications/mod_conference/mod_conference.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 3112a781f4..8f33a6ebe7 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5678,6 +5678,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference, char appdata[512]; int rdlock = 0; switch_bool_t have_flags = SWITCH_FALSE; + const char *outcall_flags; *cause = SWITCH_CAUSE_NORMAL_CLEARING; @@ -5763,6 +5764,12 @@ static switch_status_t conference_outcall(conference_obj_t *conference, goto done; } + if ((outcall_flags = switch_channel_get_variable(peer_channel, "outcall_flags"))) { + if (!zstr(outcall_flags)) { + flags = (char *)outcall_flags; + } + } + if (flags && strcasecmp(flags, "none")) { have_flags = SWITCH_TRUE; } From c2ac863492a43b7638a5763bc580e07da61a91d7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 08:48:22 -0500 Subject: [PATCH 0166/1057] FS-4176 send vid refresh when switching to mirror --- src/mod/applications/mod_conference/mod_conference.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 8f33a6ebe7..aa5a1a3015 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1233,12 +1233,18 @@ static void *SWITCH_THREAD_FUNC conference_video_mirror_thread_run(switch_thread switch_status_t status; switch_frame_t *read_frame; conference_obj_t *conference = vh->member_a->conference; + switch_core_session_message_t msg = { 0 }; switch_thread_rwlock_rdlock(conference->rwlock); switch_thread_rwlock_rdlock(vh->member_a->rwlock); /* Acquire locks for both sessions so the helper object and member structures don't get destroyed before we exit */ switch_core_session_read_lock(session_a); + + /* Tell the channel to request a fresh vid frame */ + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; + switch_core_session_receive_message(session_a, &msg); vh->up = 1; while (vh->up > 0 && switch_test_flag(vh->member_a, MFLAG_RUNNING) && From 258ad092ac0ee2e7b67ccdbed734e5153fa74061 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 15:38:25 +0000 Subject: [PATCH 0167/1057] debian: massage the prerm script to pass lintian --- debian/freeswitch.prerm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/freeswitch.prerm b/debian/freeswitch.prerm index f5448bcee4..9f34f0b371 100644 --- a/debian/freeswitch.prerm +++ b/debian/freeswitch.prerm @@ -3,7 +3,9 @@ set -e case "$1" in remove|upgrade|deconfigure) - echo "We're about to remove FreeSWITCH..." >&2 + if [ -d /etc/freeswitch ]; then + echo "We're about to remove a configured FreeSWITCH..." >&2 + fi ;; failed-upgrade) ;; From e2c850b797fa43ebbed98048c7866dc88274b1c1 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 16:16:58 +0000 Subject: [PATCH 0168/1057] debian: ignore final possible-gpl-code-linked-with-openssl warning --- debian/bootstrap.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 66f77b6270..c13bbbb92e 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -487,27 +487,36 @@ print_mod_install () { EOF } -print_common_overrides () { - m="$1" +print_long_filename_override () { + local p="$1" cat </dev/null; then - (print_edit_warning; print_common_overrides "$m") >> $f + [ -s $f ] || print_edit_warning >> $f + print_long_filename_override "$m" >> $f fi done +f=freeswitch.lintian-overrides +[ -s $f ] || print_edit_warning >> $f +print_gpl_openssl_override "freeswitch" >> $f touch .stamp-bootstrap From 2557e962a2a221f9a8188e28e9b3247ea9576e41 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 16:27:37 +0000 Subject: [PATCH 0169/1057] debian: move .so symlink to -dev package --- debian/freeswitch-dev.install | 1 + debian/freeswitch.install | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/freeswitch-dev.install b/debian/freeswitch-dev.install index 97685b764b..b63cfa4530 100644 --- a/debian/freeswitch-dev.install +++ b/debian/freeswitch-dev.install @@ -1,5 +1,6 @@ /usr/include /usr/lib/freeswitch/mod/*.la +/usr/lib/libfreeswitch.so /usr/lib/*.a /usr/lib/*.la /usr/lib/pkgconfig diff --git a/debian/freeswitch.install b/debian/freeswitch.install index 5c43763aa5..199329cdd3 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -1,3 +1,3 @@ /usr/bin -/usr/lib/libfreeswitch.so* +/usr/lib/libfreeswitch.so.* /usr/share/freeswitch/scripts From 8597842a56c6fb97ec1b451b721240ca92f2f43a Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 7 May 2012 17:31:20 +0200 Subject: [PATCH 0170/1057] skypopen: hook up to mod_sms, spawning a thread for servicing chatmessage --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 71 ++++++++++++++++++- .../mod_skypopen/skypopen_protocol.c | 1 + 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 76ac991449..7ef273c6d0 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2201,6 +2201,44 @@ int dtmf_received(private_t *tech_pvt, char *value) return 0; } +void *SWITCH_THREAD_FUNC skypopen_do_mod_sms_thread(switch_thread_t *thread, void *obj) +{ + switch_event_t *event; + + + event = obj; + switch_core_chat_send("GLOBAL", event); /* mod_sms */ + + return event; + +} + + + +int start_mod_sms_thread(private_t *tech_pvt, switch_event_t *event) +{ + switch_threadattr_t *mod_sms_thread_thd_attr = NULL; + switch_thread_t *mod_sms_thread; + + + switch_threadattr_create(&mod_sms_thread_thd_attr, skypopen_module_pool); + switch_threadattr_detach_set(mod_sms_thread_thd_attr, 0); + switch_threadattr_stacksize_set(mod_sms_thread_thd_attr, SWITCH_THREAD_STACKSIZE); + if (switch_thread_create(&mod_sms_thread, mod_sms_thread_thd_attr, skypopen_do_mod_sms_thread, event, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { + DEBUGA_SKYPE("started mod_sms_thread thread.\n", SKYPOPEN_P_LOG); + } else { + ERRORA("failed to start mod_sms_thread thread.\n", SKYPOPEN_P_LOG); + return -1; + } + if (mod_sms_thread == NULL) { + WARNINGA("mod_sms_thread exited\n", SKYPOPEN_P_LOG); + return -1; + } + + return 0; +} + + int start_audio_threads(private_t *tech_pvt) { switch_threadattr_t *tcp_srv_thread_thd_attr = NULL; @@ -2984,7 +3022,7 @@ int incoming_chatmessage(private_t *tech_pvt, int which) /* mod_sms end */ switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body); - //switch_core_chat_send("GLOBAL", event); /* mod_sms */ + if (session) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true"); if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) { @@ -3026,7 +3064,36 @@ int incoming_chatmessage(private_t *tech_pvt, int which) if (session) { switch_core_session_rwunlock(session); } - memset(&tech_pvt->chatmessages[which], '\0', sizeof(&tech_pvt->chatmessages[which])); + + + if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SKYPE_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->chatmessages[which].from_dispname); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", tech_pvt->chatmessages[which].from_handle); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id); +/* mod_sms begin */ + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->skype_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", SKYPE_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->chatmessages[which].from_handle); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); +/* mod_sms end */ + + switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body); + //switch_core_chat_send("GLOBAL", event); /* mod_sms */ + start_mod_sms_thread(tech_pvt, event); + //usleep(20000); + + } else { + ERRORA("cannot create event on interface %s. WHY?????\n", SKYPOPEN_P_LOG, tech_pvt->name); + } + return 0; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 95746411e9..d8e9ffa9ff 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -478,6 +478,7 @@ int skypopen_signaling_read(private_t *tech_pvt) tech_pvt->chatmessages[i].from_handle, tech_pvt->chatmessages[i].from_dispname, tech_pvt->chatmessages[i].body); if (strcmp(tech_pvt->chatmessages[i].from_handle, tech_pvt->skype_user)) { //if the message was not sent by myself incoming_chatmessage(tech_pvt, i); + memset(&tech_pvt->chatmessages[i], '\0', sizeof(&tech_pvt->chatmessages[i])); } } From dc595613240456ac4ed42e1a05242fd0ce536e60 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 16:35:48 +0000 Subject: [PATCH 0171/1057] mod_pocketsphinx: install default.dic with correct mode --- src/mod/asr_tts/mod_pocketsphinx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/asr_tts/mod_pocketsphinx/Makefile b/src/mod/asr_tts/mod_pocketsphinx/Makefile index 9b2c6b28e4..e3d795fb60 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/Makefile +++ b/src/mod/asr_tts/mod_pocketsphinx/Makefile @@ -60,7 +60,7 @@ $(DESTDIR)$(grammardir)/model/communicator: cp -rp $(switch_srcdir)/libs/Communicator_semi_40.cd_semi_6000/* $(DESTDIR)$(grammardir)/model/communicator dictionary: - @cp -f $(POCKETSPHINX_DIR)/model/lm/en_US/cmu07a.dic $(DESTDIR)$(grammardir)/default.dic + @install -m0644 $(POCKETSPHINX_DIR)/model/lm/en_US/cmu07a.dic $(DESTDIR)$(grammardir)/default.dic local_install: $(DESTDIR)$(grammardir)/model $(DESTDIR)$(grammardir)/model/communicator dictionary From b43fa94551e582af3ac38d1cb1259f4e3629268a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 10:05:51 -0500 Subject: [PATCH 0172/1057] FS-4192 --resolve found the problem, this might also fix your intercept bug --- src/switch_ivr_originate.c | 50 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 1962fc0cff..33c5e2e6d0 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -443,6 +443,32 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat } + for (i = 0; i < len; i++) { + if (switch_channel_test_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP)) { + const char *key = switch_channel_get_variable(originate_status[i].peer_channel, "channel_swap_uuid"); + switch_core_session_t *swap_session, *old_session; + + if ((swap_session = switch_core_session_locate(key))) { + switch_channel_clear_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP); + switch_channel_hangup(originate_status[i].peer_channel, SWITCH_CAUSE_PICKED_OFF); + + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(originate_status[i].peer_channel), SWITCH_LOG_DEBUG, "Swapping %s for %s\n", + switch_core_session_get_name(swap_session), switch_channel_get_name(originate_status[i].peer_channel)); + + + old_session = originate_status[i].peer_session; + originate_status[i].peer_session = swap_session; + originate_status[i].peer_channel = switch_core_session_get_channel(originate_status[i].peer_session); + originate_status[i].caller_profile = switch_channel_get_caller_profile(originate_status[i].peer_channel); + switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING); + + switch_channel_answer(originate_status[i].peer_channel); + switch_core_session_rwunlock(old_session); + break; + } + } + } + for (i = 0; i < len; i++) { switch_channel_state_t state; @@ -3195,7 +3221,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_channel_set_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL); } - if (holding && oglobals.idx != IDX_TIMEOUT && oglobals.idx != IDX_KEY_CANCEL) { + if (holding && oglobals.idx != IDX_TIMEOUT && oglobals.idx != IDX_KEY_CANCEL && oglobals.idx < 0) { switch_core_session_t *holding_session; if ((holding_session = switch_core_session_locate(holding))) { @@ -3214,7 +3240,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess 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 { @@ -3547,27 +3572,6 @@ 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 (switch_channel_test_flag(bchan, CF_CHANNEL_SWAP)) { - const char *key = switch_channel_get_variable(bchan, "channel_swap_uuid"); - switch_core_session_t *swap_session, *old_session; - - if ((swap_session = switch_core_session_locate(key))) { - switch_channel_clear_flag(bchan, CF_CHANNEL_SWAP); - switch_channel_hangup(bchan, SWITCH_CAUSE_PICKED_OFF); - - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(bchan), SWITCH_LOG_DEBUG, "Swapping %s for %s\n", - switch_core_session_get_name(swap_session), switch_channel_get_name(bchan)); - - old_session = *bleg; - *bleg = swap_session; - bchan = switch_core_session_get_channel(*bleg); - switch_channel_answer(bchan); - switch_core_session_rwunlock(old_session); - } - } - - if (session && caller_channel) { switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg)); From f7476320dbdb7afe1e305b9036ef31bff5563ca2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 10:24:08 -0500 Subject: [PATCH 0173/1057] FS-4177 play-file-done was not previously possible it was part of supressing play-file, try this patch --- src/mod/applications/mod_conference/mod_conference.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index aa5a1a3015..8b4be69b2c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -217,7 +217,8 @@ typedef enum { EFLAG_FLOOR_CHANGE = (1 << 25), EFLAG_MUTE_DETECT = (1 << 26), EFLAG_RECORD = (1 << 27), - EFLAG_HUP_MEMBER = (1 << 28) + EFLAG_HUP_MEMBER = (1 << 28), + EFLAG_PLAY_FILE_DONE = (1 << 29), } event_type_t; typedef struct conference_file_node { @@ -1621,7 +1622,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v } if (file_sample_len <= 0) { - if (test_eflag(conference, EFLAG_PLAY_FILE) && + if (test_eflag(conference, EFLAG_PLAY_FILE_DONE) && 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", "play-file-done"); @@ -6107,6 +6108,8 @@ static void clear_eflags(char *events, uint32_t *f) *f &= ~EFLAG_VOLUME_OUT_MEMBER; } else if (!strcmp(event, "play-file")) { *f &= ~EFLAG_PLAY_FILE; + } else if (!strcmp(event, "play-file-done")) { + *f &= ~EFLAG_PLAY_FILE; } else if (!strcmp(event, "play-file-member")) { *f &= ~EFLAG_PLAY_FILE_MEMBER; } else if (!strcmp(event, "speak-text")) { From 56f415a164afe33bc484dfeabb55f655546b3d95 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 7 May 2012 18:57:40 +0200 Subject: [PATCH 0174/1057] skypopen: mark chatmessages SEEN --- src/mod/endpoints/mod_skypopen/skypopen_protocol.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index d8e9ffa9ff..4bb84505e0 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -356,7 +356,7 @@ int skypopen_signaling_read(private_t *tech_pvt) } } if (!found) { - DEBUGA_SKYPE("why we do not have a chats slot free? we have more than %d chats in parallel?\n", SKYPOPEN_P_LOG, MAX_CHATS); + ERRORA("why we do not have a chats slot free? we have more than %d chats in parallel?\n", SKYPOPEN_P_LOG, MAX_CHATS); } DEBUGA_SKYPE("CHAT %s is in position %d in the chats array, chatname=%s, dialog_partner=%s\n", SKYPOPEN_P_LOG, id, i, @@ -378,6 +378,12 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_strncpy(prop, where, sizeof(prop) - 1); skypopen_strncpy(value, *stringp, sizeof(value) - 1); + if (!tech_pvt->report_incoming_chatmessages) { + if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECEIVED")) { + sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } +} else { if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECEIVED")) { DEBUGA_SKYPE("RECEIVED CHATMESSAGE %s, let's see which type it is\n", SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "GET CHATMESSAGE %s TYPE", id); @@ -396,7 +402,7 @@ int skypopen_signaling_read(private_t *tech_pvt) } } if (!found) { - DEBUGA_SKYPE("why we do not have a chatmessages slot free? we have more than %d chatmessages in parallel?\n", SKYPOPEN_P_LOG, + ERRORA("why we do not have a chatmessages slot free? we have more than %d chatmessages in parallel?\n", SKYPOPEN_P_LOG, MAX_CHATMESSAGES); } else { DEBUGA_SKYPE("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s\n", SKYPOPEN_P_LOG, id, i, @@ -479,10 +485,14 @@ int skypopen_signaling_read(private_t *tech_pvt) if (strcmp(tech_pvt->chatmessages[i].from_handle, tech_pvt->skype_user)) { //if the message was not sent by myself incoming_chatmessage(tech_pvt, i); memset(&tech_pvt->chatmessages[i], '\0', sizeof(&tech_pvt->chatmessages[i])); + + sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } } } +} } From 00a6f61a67be6c2defaeb614316e23e7462d925f Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 7 May 2012 19:01:54 +0200 Subject: [PATCH 0175/1057] skypopen: indented --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 153 ++++++------ src/mod/endpoints/mod_skypopen/skypopen.h | 2 +- .../mod_skypopen/skypopen_protocol.c | 231 +++++++++--------- 3 files changed, 196 insertions(+), 190 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 7ef273c6d0..f489cc613a 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -112,6 +112,7 @@ char *interface_status[] = { /* should match SKYPOPEN_STATE_xxx in skypopen.h */ "PREANSW", "DEAD" }; + char *skype_callflow[] = { /* should match CALLFLOW_XXX in skypopen.h */ "IDLE", "DOWN", @@ -381,7 +382,7 @@ static switch_status_t interface_exists(char *the_interface) if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) { XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(20000); + switch_sleep(20000); XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -739,6 +740,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int return SWITCH_STATUS_SUCCESS; } + static switch_status_t channel_on_consume_media(switch_core_session_t *session) { private_t *tech_pvt = NULL; @@ -765,6 +767,7 @@ static switch_status_t channel_on_soft_execute(switch_core_session_t *session) DEBUGA_SKYPE("%s CHANNEL SOFT_EXECUTE\n", SKYPOPEN_P_LOG, tech_pvt->name); return SWITCH_STATUS_SUCCESS; } + static switch_status_t channel_on_reset(switch_core_session_t *session) { private_t *tech_pvt = NULL; @@ -873,9 +876,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch switch_mutex_unlock(tech_pvt->mutex_audio_srv); if (!bytes_read) { - switch_sleep(1000); //XXX don't like this + switch_sleep(1000); //XXX don't like this try++; - if (try < 5){ + if (try < 5) { DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG); goto read; } @@ -940,19 +943,19 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch char *p = digit_str; switch_channel_t *channel = switch_core_session_get_channel(session); - if(channel){ + if (channel) { while (p && *p) { - switch_dtmf_t dtmf = {0}; + switch_dtmf_t dtmf = { 0 }; dtmf.digit = *p; dtmf.duration = SWITCH_DEFAULT_DTMF_DURATION; switch_channel_queue_dtmf(channel, &dtmf); p++; } - NOTICA("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", SKYPOPEN_P_LOG, digit_str, (unsigned int) new_dtmf_timestamp, - (unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp)); + NOTICA("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", SKYPOPEN_P_LOG, digit_str, + (unsigned int) new_dtmf_timestamp, (unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp)); tech_pvt->old_dtmf_timestamp = new_dtmf_timestamp; - }else{ + } else { WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG); } } @@ -1077,7 +1080,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } -static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t * msg) +static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) { switch_channel_t *channel; private_t *tech_pvt; @@ -1648,7 +1651,7 @@ static switch_status_t load_config(int reload_type) } else { DEBUGA_SKYPE("Initialized XInitThreads!\n", SKYPOPEN_P_LOG); } - switch_sleep(20000); + switch_sleep(20000); #endif /* WIN32 */ if (interface_id && interface_id < SKYPOPEN_MAX_INTERFACES) { @@ -1751,8 +1754,7 @@ static switch_status_t load_config(int reload_type) 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, + 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); switch_sleep(100000); @@ -1858,8 +1860,8 @@ static switch_status_t load_config(int reload_type) return SWITCH_STATUS_SUCCESS; } + static switch_status_t chat_send(switch_event_t *message_event) - { char *user = NULL, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL; private_t *tech_pvt = NULL; @@ -1867,7 +1869,7 @@ static switch_status_t chat_send(switch_event_t *message_event) char skype_msg[1024]; const char *proto; - const char *from; + const char *from; const char *to; const char *subject; const char *body; @@ -1885,7 +1887,7 @@ static switch_status_t chat_send(switch_event_t *message_event) switch_assert(proto != NULL); //DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPOPEN_P_LOG, proto, from, to, subject, body, type, - // hint ? hint : "NULL"); + // hint ? hint : "NULL"); DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, hint=%s)\n", SKYPOPEN_P_LOG, proto, from, to, subject, body, hint ? hint : "NULL"); @@ -1912,9 +1914,8 @@ static switch_status_t chat_send(switch_event_t *message_event) if ((host = strchr(user, '@'))) { *host++ = '\0'; } - //DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPOPEN_P_LOG, proto, from, to, subject, body, type, - // hint ? hint : "NULL"); + // hint ? hint : "NULL"); DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, hint=%s)\n", SKYPOPEN_P_LOG, proto, from, to, subject, body, hint ? hint : "NULL"); if (hint && strlen(hint)) { @@ -1950,7 +1951,7 @@ static switch_status_t chat_send(switch_event_t *message_event) snprintf(skype_msg, sizeof(skype_msg), "CHAT CREATE %s", to); skypopen_signaling_write(tech_pvt, skype_msg); - switch_sleep(20000); + switch_sleep(20000); } found = 0; @@ -1970,7 +1971,9 @@ static switch_status_t chat_send(switch_event_t *message_event) } tried++; if (tried > 20) { - ERRORA("No chat with dialog_partner='%s' was found. (If you're using mod_sms this is a bug of mod_skypopen when using mod_sms, from next incoming message it will probably work...)\n", SKYPOPEN_P_LOG, to); + ERRORA + ("No chat with dialog_partner='%s' was found. (If you're using mod_sms this is a bug of mod_skypopen when using mod_sms, from next incoming message it will probably work...)\n", + SKYPOPEN_P_LOG, to); break; } switch_sleep(50000); @@ -2076,7 +2079,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(20000); + switch_sleep(20000); XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -2172,7 +2175,7 @@ int dtmf_received(private_t *tech_pvt, char *value) if (channel) { if (switch_channel_test_flag(channel, CF_BRIDGED) - && !switch_true(switch_channel_get_variable(channel, "skype_add_outband_dtmf_also_when_bridged"))) { + && !switch_true(switch_channel_get_variable(channel, "skype_add_outband_dtmf_also_when_bridged"))) { NOTICA @@ -2194,7 +2197,7 @@ int dtmf_received(private_t *tech_pvt, char *value) WARNINGA("received %c DTMF, but no channel?\n", SKYPOPEN_P_LOG, value[0]); } switch_core_session_rwunlock(session); - }else{ + } else { WARNINGA("received %c DTMF, but no session?\n", SKYPOPEN_P_LOG, value[0]); } @@ -2203,14 +2206,14 @@ int dtmf_received(private_t *tech_pvt, char *value) void *SWITCH_THREAD_FUNC skypopen_do_mod_sms_thread(switch_thread_t *thread, void *obj) { - switch_event_t *event; + switch_event_t *event; event = obj; - switch_core_chat_send("GLOBAL", event); /* mod_sms */ - + switch_core_chat_send("GLOBAL", event); /* mod_sms */ + return event; - + } @@ -2218,7 +2221,7 @@ void *SWITCH_THREAD_FUNC skypopen_do_mod_sms_thread(switch_thread_t *thread, voi int start_mod_sms_thread(private_t *tech_pvt, switch_event_t *event) { switch_threadattr_t *mod_sms_thread_thd_attr = NULL; - switch_thread_t *mod_sms_thread; + switch_thread_t *mod_sms_thread; switch_threadattr_create(&mod_sms_thread_thd_attr, skypopen_module_pool); @@ -2274,7 +2277,8 @@ int start_audio_threads(private_t *tech_pvt) 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, 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); @@ -2291,7 +2295,8 @@ int start_audio_threads(private_t *tech_pvt) 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, 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); @@ -2509,24 +2514,25 @@ SWITCH_STANDARD_API(sk_function) goto end; } - + if (!strcasecmp(argv[0], "balances")) { - stream->write_function(stream, " Name \tBalance\tCurrency\n"); - stream->write_function(stream, " ==== \t=======\t========\n"); - - for (tmp_i = 0; tmp_i < SKYPOPEN_MAX_INTERFACES; tmp_i++) { - if (strlen(globals.SKYPOPEN_INTERFACES[tmp_i].name)) { - skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE"); - switch_sleep(20000); - - strncpy(tmp_message, globals.SKYPOPEN_INTERFACES[tmp_i].message, sizeof(globals.SKYPOPEN_INTERFACES[tmp_i].message)); - - skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE_CURRENCY"); - switch_sleep(20000); - if(strlen(tmp_message)>21 && strlen(globals.SKYPOPEN_INTERFACES[tmp_i].message) > 30) - stream->write_function(stream, " %s \t%s\t%s\n", globals.SKYPOPEN_INTERFACES[tmp_i].name, tmp_message+21, globals.SKYPOPEN_INTERFACES[tmp_i].message+30); - } - } + stream->write_function(stream, " Name \tBalance\tCurrency\n"); + stream->write_function(stream, " ==== \t=======\t========\n"); + + for (tmp_i = 0; tmp_i < SKYPOPEN_MAX_INTERFACES; tmp_i++) { + if (strlen(globals.SKYPOPEN_INTERFACES[tmp_i].name)) { + skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE"); + switch_sleep(20000); + + strncpy(tmp_message, globals.SKYPOPEN_INTERFACES[tmp_i].message, sizeof(globals.SKYPOPEN_INTERFACES[tmp_i].message)); + + skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE_CURRENCY"); + switch_sleep(20000); + if (strlen(tmp_message) > 21 && strlen(globals.SKYPOPEN_INTERFACES[tmp_i].message) > 30) + stream->write_function(stream, " %s \t%s\t%s\n", globals.SKYPOPEN_INTERFACES[tmp_i].name, tmp_message + 21, + globals.SKYPOPEN_INTERFACES[tmp_i].message + 30); + } + } } if (!strcasecmp(argv[0], "list")) { @@ -2542,11 +2548,11 @@ SWITCH_STANDARD_API(sk_function) for (i = 0; i < SKYPOPEN_MAX_INTERFACES; i++) { if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { - next_flag_char = i == globals.next_interface ? '*' : ' '; - ib += globals.SKYPOPEN_INTERFACES[i].ib_calls; - ib_failed += globals.SKYPOPEN_INTERFACES[i].ib_failed_calls; - ob += globals.SKYPOPEN_INTERFACES[i].ob_calls; - ob_failed += globals.SKYPOPEN_INTERFACES[i].ob_failed_calls; + next_flag_char = i == globals.next_interface ? '*' : ' '; + ib += globals.SKYPOPEN_INTERFACES[i].ib_calls; + ib_failed += globals.SKYPOPEN_INTERFACES[i].ib_failed_calls; + ob += globals.SKYPOPEN_INTERFACES[i].ob_calls; + ob_failed += globals.SKYPOPEN_INTERFACES[i].ob_failed_calls; stream->write_function(stream, "%c %d\t[%s]\t%3u/%u\t%6u/%u\t%s\t%s\t%s\n", @@ -3011,14 +3017,14 @@ int incoming_chatmessage(private_t *tech_pvt, int which) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id); /* mod_sms begin */ - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->skype_user); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", SKYPE_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->chatmessages[which].from_handle); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->skype_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", SKYPE_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->chatmessages[which].from_handle); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); /* mod_sms end */ switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body); @@ -3075,18 +3081,18 @@ int incoming_chatmessage(private_t *tech_pvt, int which) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id); /* mod_sms begin */ - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->skype_user); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", SKYPE_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->chatmessages[which].from_handle); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", tech_pvt->skype_user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_proto", SKYPE_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->chatmessages[which].from_handle); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host"); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_user", tech_pvt->name); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host"); /* mod_sms end */ switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body); - //switch_core_chat_send("GLOBAL", event); /* mod_sms */ + //switch_core_chat_send("GLOBAL", event); /* mod_sms */ start_mod_sms_thread(tech_pvt, event); //usleep(20000); @@ -3110,19 +3116,19 @@ static switch_status_t compat_chat_send(const char *proto, const char *from, con switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "subject", subject); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "type", type); switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "hint", hint); - + if (body) { switch_event_add_body(message_event, "%s", body); } } else { abort(); - } + } status = chat_send(message_event); switch_event_destroy(&message_event); return status; - + } SWITCH_STANDARD_API(skypopen_chat_function) @@ -3164,8 +3170,9 @@ SWITCH_STANDARD_API(skypopen_chat_function) goto end; } else { - NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n", SKYPOPEN_P_LOG, SKYPE_CHAT_PROTO, tech_pvt->skype_user, - argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), tech_pvt->name); + NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n", SKYPOPEN_P_LOG, SKYPE_CHAT_PROTO, + tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), + tech_pvt->name); compat_chat_send(SKYPE_CHAT_PROTO, tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, tech_pvt->name); diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 960d960f82..d2dd51bd37 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -112,7 +112,7 @@ typedef enum { #define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%-*s["SKYPOPEN_SVN_VERSION "] [WARNINGA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); #define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%-*s ["SKYPOPEN_SVN_VERSION "] [NOTICA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); -#define SKYPOPEN_P_LOG (int)((20 - (strlen(__FILE__))) + ((__LINE__ - 1000) < 0) + ((__LINE__ - 100) < 0)), " ", __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", tech_pvt ? interface_status[tech_pvt->interface_state] : "N/A", tech_pvt ? skype_callflow[tech_pvt->skype_callflow] : "N/A" +#define SKYPOPEN_P_LOG (int)((20 - (strlen(__FILE__))) + ((__LINE__ - 1000) < 0) + ((__LINE__ - 100) < 0)), " ", __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", tech_pvt ? interface_status[tech_pvt->interface_state] : "N/A", tech_pvt ? skype_callflow[tech_pvt->skype_callflow] : "N/A" /*********************************/ #define SKYPOPEN_CAUSE_NORMAL 1 diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 4bb84505e0..5aa113c3bf 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -378,121 +378,121 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_strncpy(prop, where, sizeof(prop) - 1); skypopen_strncpy(value, *stringp, sizeof(value) - 1); - if (!tech_pvt->report_incoming_chatmessages) { - if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECEIVED")) { - sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - } -} else { - if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECEIVED")) { - DEBUGA_SKYPE("RECEIVED CHATMESSAGE %s, let's see which type it is\n", SKYPOPEN_P_LOG, id); - sprintf(msg_to_skype, "GET CHATMESSAGE %s TYPE", id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - } - - if (!strcasecmp(prop, "TYPE") && !strcasecmp(value, "SAID")) { - DEBUGA_SKYPE("CHATMESSAGE %s is of type SAID, let's get the other infos\n", SKYPOPEN_P_LOG, id); - found = 0; - for (i = 0; i < MAX_CHATMESSAGES; i++) { - if (strlen(tech_pvt->chatmessages[i].id) == 0) { - strncpy(tech_pvt->chatmessages[i].id, id, sizeof(tech_pvt->chatmessages[i].id)); - strncpy(tech_pvt->chatmessages[i].type, value, sizeof(tech_pvt->chatmessages[i].type)); - found = 1; - break; - } - } - if (!found) { - ERRORA("why we do not have a chatmessages slot free? we have more than %d chatmessages in parallel?\n", SKYPOPEN_P_LOG, - MAX_CHATMESSAGES); - } else { - DEBUGA_SKYPE("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s\n", SKYPOPEN_P_LOG, id, i, - tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id); - sprintf(msg_to_skype, "GET CHATMESSAGE %s CHATNAME", id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - //skypopen_sleep(1000); - sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_HANDLE", id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - //skypopen_sleep(1000); - sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_DISPNAME", id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - //skypopen_sleep(1000); - sprintf(msg_to_skype, "GET CHATMESSAGE %s BODY", id); + if (!tech_pvt->report_incoming_chatmessages) { + if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECEIVED")) { + sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id); skypopen_signaling_write(tech_pvt, msg_to_skype); } - } - - if (!strcasecmp(prop, "CHATNAME")) { - DEBUGA_SKYPE("CHATMESSAGE %s belongs to the CHAT %s\n", SKYPOPEN_P_LOG, id, value); - found = 0; - for (i = 0; i < MAX_CHATMESSAGES; i++) { - if (!strcmp(tech_pvt->chatmessages[i].id, id)) { - strncpy(tech_pvt->chatmessages[i].chatname, value, sizeof(tech_pvt->chatmessages[i].chatname)); - found = 1; - break; - } - } - if (!found) { - DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); - } - } - if (!strcasecmp(prop, "FROM_HANDLE")) { - DEBUGA_SKYPE("CHATMESSAGE %s was sent by FROM_HANDLE %s\n", SKYPOPEN_P_LOG, id, value); - found = 0; - for (i = 0; i < MAX_CHATMESSAGES; i++) { - if (!strcmp(tech_pvt->chatmessages[i].id, id)) { - strncpy(tech_pvt->chatmessages[i].from_handle, value, sizeof(tech_pvt->chatmessages[i].from_handle)); - found = 1; - break; - } - } - if (!found) { - DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); + } else { + if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECEIVED")) { + DEBUGA_SKYPE("RECEIVED CHATMESSAGE %s, let's see which type it is\n", SKYPOPEN_P_LOG, id); + sprintf(msg_to_skype, "GET CHATMESSAGE %s TYPE", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } - } - if (!strcasecmp(prop, "FROM_DISPNAME")) { - DEBUGA_SKYPE("CHATMESSAGE %s was sent by FROM_DISPNAME %s\n", SKYPOPEN_P_LOG, id, value); - found = 0; - for (i = 0; i < MAX_CHATMESSAGES; i++) { - if (!strcmp(tech_pvt->chatmessages[i].id, id)) { - strncpy(tech_pvt->chatmessages[i].from_dispname, value, sizeof(tech_pvt->chatmessages[i].from_dispname)); - found = 1; - break; + if (!strcasecmp(prop, "TYPE") && !strcasecmp(value, "SAID")) { + DEBUGA_SKYPE("CHATMESSAGE %s is of type SAID, let's get the other infos\n", SKYPOPEN_P_LOG, id); + found = 0; + for (i = 0; i < MAX_CHATMESSAGES; i++) { + if (strlen(tech_pvt->chatmessages[i].id) == 0) { + strncpy(tech_pvt->chatmessages[i].id, id, sizeof(tech_pvt->chatmessages[i].id)); + strncpy(tech_pvt->chatmessages[i].type, value, sizeof(tech_pvt->chatmessages[i].type)); + found = 1; + break; + } } - } - if (!found) { - DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); - } - - } - if (!strcasecmp(prop, "BODY")) { - DEBUGA_SKYPE("CHATMESSAGE %s has BODY %s\n", SKYPOPEN_P_LOG, id, value); - found = 0; - for (i = 0; i < MAX_CHATMESSAGES; i++) { - if (!strcmp(tech_pvt->chatmessages[i].id, id)) { - strncpy(tech_pvt->chatmessages[i].body, value, sizeof(tech_pvt->chatmessages[i].body)); - found = 1; - break; - } - } - if (!found) { - DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); - } else { - DEBUGA_SKYPE - ("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s, chatname=%s, from_handle=%s, from_dispname=%s, body=%s\n", - SKYPOPEN_P_LOG, id, i, tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id, tech_pvt->chatmessages[i].chatname, - tech_pvt->chatmessages[i].from_handle, tech_pvt->chatmessages[i].from_dispname, tech_pvt->chatmessages[i].body); - if (strcmp(tech_pvt->chatmessages[i].from_handle, tech_pvt->skype_user)) { //if the message was not sent by myself - incoming_chatmessage(tech_pvt, i); - memset(&tech_pvt->chatmessages[i], '\0', sizeof(&tech_pvt->chatmessages[i])); - - sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id); - skypopen_signaling_write(tech_pvt, msg_to_skype); + if (!found) { + ERRORA("why we do not have a chatmessages slot free? we have more than %d chatmessages in parallel?\n", SKYPOPEN_P_LOG, + MAX_CHATMESSAGES); + } else { + DEBUGA_SKYPE("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s\n", SKYPOPEN_P_LOG, id, i, + tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id); + sprintf(msg_to_skype, "GET CHATMESSAGE %s CHATNAME", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + //skypopen_sleep(1000); + sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_HANDLE", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + //skypopen_sleep(1000); + sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_DISPNAME", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + //skypopen_sleep(1000); + sprintf(msg_to_skype, "GET CHATMESSAGE %s BODY", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } } + if (!strcasecmp(prop, "CHATNAME")) { + DEBUGA_SKYPE("CHATMESSAGE %s belongs to the CHAT %s\n", SKYPOPEN_P_LOG, id, value); + found = 0; + for (i = 0; i < MAX_CHATMESSAGES; i++) { + if (!strcmp(tech_pvt->chatmessages[i].id, id)) { + strncpy(tech_pvt->chatmessages[i].chatname, value, sizeof(tech_pvt->chatmessages[i].chatname)); + found = 1; + break; + } + } + if (!found) { + DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); + } + } + if (!strcasecmp(prop, "FROM_HANDLE")) { + DEBUGA_SKYPE("CHATMESSAGE %s was sent by FROM_HANDLE %s\n", SKYPOPEN_P_LOG, id, value); + found = 0; + for (i = 0; i < MAX_CHATMESSAGES; i++) { + if (!strcmp(tech_pvt->chatmessages[i].id, id)) { + strncpy(tech_pvt->chatmessages[i].from_handle, value, sizeof(tech_pvt->chatmessages[i].from_handle)); + found = 1; + break; + } + } + if (!found) { + DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); + } + + } + if (!strcasecmp(prop, "FROM_DISPNAME")) { + DEBUGA_SKYPE("CHATMESSAGE %s was sent by FROM_DISPNAME %s\n", SKYPOPEN_P_LOG, id, value); + found = 0; + for (i = 0; i < MAX_CHATMESSAGES; i++) { + if (!strcmp(tech_pvt->chatmessages[i].id, id)) { + strncpy(tech_pvt->chatmessages[i].from_dispname, value, sizeof(tech_pvt->chatmessages[i].from_dispname)); + found = 1; + break; + } + } + if (!found) { + DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); + } + + } + if (!strcasecmp(prop, "BODY")) { + DEBUGA_SKYPE("CHATMESSAGE %s has BODY %s\n", SKYPOPEN_P_LOG, id, value); + found = 0; + for (i = 0; i < MAX_CHATMESSAGES; i++) { + if (!strcmp(tech_pvt->chatmessages[i].id, id)) { + strncpy(tech_pvt->chatmessages[i].body, value, sizeof(tech_pvt->chatmessages[i].body)); + found = 1; + break; + } + } + if (!found) { + DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPOPEN_P_LOG, id); + } else { + DEBUGA_SKYPE + ("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s, chatname=%s, from_handle=%s, from_dispname=%s, body=%s\n", + SKYPOPEN_P_LOG, id, i, tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id, tech_pvt->chatmessages[i].chatname, + tech_pvt->chatmessages[i].from_handle, tech_pvt->chatmessages[i].from_dispname, tech_pvt->chatmessages[i].body); + if (strcmp(tech_pvt->chatmessages[i].from_handle, tech_pvt->skype_user)) { //if the message was not sent by myself + incoming_chatmessage(tech_pvt, i); + memset(&tech_pvt->chatmessages[i], '\0', sizeof(&tech_pvt->chatmessages[i])); + + sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } + } + + } } -} } @@ -896,7 +896,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { //unsigned int fdselect; - int rt=1; + int rt = 1; //fd_set fs; //struct timeval to; int nospace; @@ -1033,7 +1033,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) if (!(running && tech_pvt->running)) break; FD_ZERO(&fsgio); - togio.tv_usec = MS_SKYPOPEN * 1000 * 3; + togio.tv_usec = MS_SKYPOPEN * 1000 * 3; togio.tv_sec = 0; fdselectgio = s; FD_SET(fdselectgio, &fsgio); @@ -1148,7 +1148,7 @@ int skypopen_senddigit(private_t *tech_pvt, char digit) char msg_to_skype[1024]; DEBUGA_SKYPE("DIGIT received: %c\n", SKYPOPEN_P_LOG, digit); - if(digit != 'a' && digit != 'A' && digit != 'b' && digit != 'B' && digit != 'c' && digit != 'C' && digit != 'd' && digit != 'D'){ + if (digit != 'a' && digit != 'A' && digit != 'b' && digit != 'B' && digit != 'c' && digit != 'C' && digit != 'd' && digit != 'D') { sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit); skypopen_signaling_write(tech_pvt, msg_to_skype); } else { @@ -1701,7 +1701,7 @@ void skypopen_clean_disp(void *data) DEBUGA_SKYPE("NOT destroyed disp\n", SKYPOPEN_P_LOG); } DEBUGA_SKYPE("OUT destroyed disp\n", SKYPOPEN_P_LOG); - skypopen_sleep(20000); + skypopen_sleep(20000); } void *skypopen_do_skypeapi_thread_func(void *obj) @@ -1761,7 +1761,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) if (session) { switch_channel_t *channel = switch_core_session_get_channel(session); - if(channel){ + if (channel) { switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); @@ -1798,7 +1798,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) switch_channel_t *channel = switch_core_session_get_channel(session); - if(channel){ + if (channel) { switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); @@ -1910,7 +1910,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) case ClientMessage: if (an_event.xclient.format != 8) { - //skypopen_sleep(1000); //0.1 msec + //skypopen_sleep(1000); //0.1 msec break; } @@ -1970,11 +1970,10 @@ void *skypopen_do_skypeapi_thread_func(void *obj) //XFlush(disp); there_were_continues = 0; } - - //skypopen_sleep(1000); //0.1 msec + //skypopen_sleep(1000); //0.1 msec break; default: - //skypopen_sleep(1000); //0.1 msec + //skypopen_sleep(1000); //0.1 msec break; } //switch event.type } //while XPending From bbe3249de85bec166fedbaa9c6f5ebb1a100700e Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 7 May 2012 13:44:07 -0500 Subject: [PATCH 0176/1057] some windows changes for gsmopen for vs2008 - 2010 changes next --- Freeswitch.2008.sln | 20 +++ .../win32/gsmlib.vcproj | 162 +++++++++++++++++- .../mod_gsmopen/mod_gsmopen.2008.vcproj | 145 +++++++++++++++- 3 files changed, 325 insertions(+), 2 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 30e947b575..f984d00129 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -953,6 +953,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_abstraction", "src\mod\ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsmopen", "src\mod\endpoints\mod_gsmopen\mod_gsmopen.2008.vcproj", "{74B120FF-6935-4DFE-A142-CDB6BEA99C90}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsmlib", "src\mod\endpoints\mod_gsmopen\gsmlib\gsmlib-1.10-patched-13ubuntu\win32\gsmlib.vcproj", "{26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2698,6 +2702,20 @@ Global {BDA173DB-F8EF-4270-9553-B453AF92E43A}.Release|Win32.Build.0 = Release|Win32 {BDA173DB-F8EF-4270-9553-B453AF92E43A}.Release|x64.ActiveCfg = Release|x64 {BDA173DB-F8EF-4270-9553-B453AF92E43A}.Release|x64.Build.0 = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|Win32.ActiveCfg = Release|Win32 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|Win32.Build.0 = Release|Win32 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|x64.ActiveCfg = Release|Win32 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Debug|Win32.ActiveCfg = Debug|Win32 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Debug|x64.ActiveCfg = Debug|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|Win32.ActiveCfg = Release|Win32 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x64.ActiveCfg = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|Win32.ActiveCfg = Debug|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|Win32.Build.0 = Debug|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|x64.ActiveCfg = Debug|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Debug|Win32.ActiveCfg = Debug|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Debug|x64.ActiveCfg = Debug|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|Win32.ActiveCfg = Release|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2723,6 +2741,7 @@ Global {CC1DD008-9406-448D-A0AD-33C3186CFADB} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {48414740-C693-4968-9846-EE058020C64F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} + {74B120FF-6935-4DFE-A142-CDB6BEA99C90} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} @@ -2822,6 +2841,7 @@ Global {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} + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {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/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.vcproj b/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.vcproj index a102fe5773..16d4ae1bc0 100755 --- a/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.vcproj +++ b/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.vcproj @@ -1,7 +1,7 @@ + @@ -169,6 +172,163 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.2008.vcproj b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.2008.vcproj index 6310d34e08..a57e518ddd 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.2008.vcproj +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.2008.vcproj @@ -1,7 +1,7 @@ + @@ -107,6 +110,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 09e6152382c1afcf8c741291773515dad6717ddc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 11:41:47 -0500 Subject: [PATCH 0177/1057] FS-3995 --resolve --- src/include/switch_types.h | 1 + src/mod/applications/mod_dptools/mod_dptools.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 35ca619cbd..93a2e48ced 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -129,6 +129,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events" #define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge" #define SWITCH_READ_RESULT_VARIABLE "read_result" +#define SWITCH_ATT_XFER_RESULT_VARIABLE "att_xfer_result" #define SWITCH_COPY_XML_CDR_VARIABLE "copy_xml_cdr" #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause" diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index db259412b0..7005a701c5 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2122,6 +2122,12 @@ static switch_status_t hanguphook(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } + +static void att_xfer_set_result(switch_channel_t *channel, switch_status_t status) +{ + switch_channel_set_variable(channel, SWITCH_ATT_XFER_RESULT_VARIABLE, status == SWITCH_STATUS_SUCCESS ? "success" : "failure"); +} + SWITCH_STANDARD_APP(att_xfer_function) { switch_core_session_t *peer_session = NULL; @@ -2167,7 +2173,8 @@ SWITCH_STANDARD_APP(att_xfer_function) if (!switch_channel_down(peer_channel)) { if (!switch_channel_ready(channel)) { - switch_ivr_uuid_bridge(switch_core_session_get_uuid(peer_session), bond); + switch_status_t status = switch_ivr_uuid_bridge(switch_core_session_get_uuid(peer_session), bond); + att_xfer_set_result(peer_channel, status); br++; } else if ((b_session = switch_core_session_locate(bond))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); @@ -2185,7 +2192,8 @@ SWITCH_STANDARD_APP(att_xfer_function) } if (!br) { - switch_ivr_uuid_bridge(switch_core_session_get_uuid(session), bond); + switch_status_t status = switch_ivr_uuid_bridge(switch_core_session_get_uuid(session), bond); + att_xfer_set_result(channel, status); } } From bafba4a9913def16153fc05dac5abb220d08cc85 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 11:42:58 -0500 Subject: [PATCH 0178/1057] FS-4142 --resolve --- .../mod_erlang_event/mod_erlang_event.c | 17 +---------------- .../mod_erlang_event/mod_erlang_event.h | 3 +-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 243303d9cd..509aec7da4 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -314,8 +314,6 @@ static void destroy_session_elem(session_elem_t *session_element) switch_channel_clear_flag(switch_core_session_get_channel(session), CF_CONTROLLED); switch_core_session_rwunlock(session); } - /* this allows the application threads to exit */ - switch_clear_flag_locked(session_element, LFLAG_SESSION_ALIVE); switch_core_destroy_memory_pool(&session_element->pool); /*switch_safe_free(s); */ } @@ -1285,7 +1283,6 @@ session_elem_t *attach_call_to_registered_process(listener_t *listener, char *re session_element->process.type = ERLANG_REG_PROCESS; session_element->process.reg_name = switch_core_session_strdup(session, reg_name); - switch_set_flag(session_element, LFLAG_SESSION_ALIVE); /* attach the session to the listener */ add_session_elem_to_listener(listener, session_element); @@ -1299,7 +1296,6 @@ session_elem_t *attach_call_to_pid(listener_t *listener, erlang_pid * pid, switc session_element->process.type = ERLANG_PID; memcpy(&session_element->process.pid, pid, sizeof(erlang_pid)); - switch_set_flag(session_element, LFLAG_SESSION_ALIVE); /* attach the session to the listener */ add_session_elem_to_listener(listener, session_element); ei_link(listener, ei_self(listener->ec), pid); @@ -1381,7 +1377,6 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid)); session_element->spawn_reply = NULL; - switch_set_flag(session_element, LFLAG_SESSION_ALIVE); switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT); switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID); @@ -1487,19 +1482,9 @@ SWITCH_STANDARD_APP(erlang_outbound_function) } if (session_element) { - switch_ivr_park(session, NULL); - - /* keep app thread running for lifetime of session */ - if (switch_channel_down(switch_core_session_get_channel(session))) { - if ((session_element = switch_channel_get_private(switch_core_session_get_channel(session), "_erlang_session_"))) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "outbound session all done\n"); - switch_clear_flag_locked(session_element, LFLAG_SESSION_ALIVE); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "outbound session already done\n"); - } - } } + } switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "exit erlang_outbound_function\n"); } diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index b6adcdafe5..1721d496fb 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -35,8 +35,7 @@ typedef enum { LFLAG_WAITING_FOR_PID = (1 << 0), /* waiting for a node to return a pid */ LFLAG_OUTBOUND_INIT = (1 << 1), /* Erlang peer has been notified of this session */ - LFLAG_SESSION_ALIVE = (1 << 2), - LFLAG_SESSION_COMPLETE = (1 << 3), + LFLAG_SESSION_COMPLETE = (1 << 2), } session_flag_t; typedef enum { From ca7a1acb1df747d6d219ad0b0517d844807dca53 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 11:43:39 -0500 Subject: [PATCH 0179/1057] FS-3809 --resolve --- src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 509aec7da4..927f30b534 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1807,6 +1807,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime) if ((clientfd = ei_accept_tmo(&ec, (int) listen_list.sockfd, &conn, 500)) == ERL_ERROR) { if (prefs.done) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n"); + break; } else if (erl_errno == ETIMEDOUT) { continue; #ifdef WIN32 @@ -1820,9 +1821,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime) /* if errno didn't get set, assume nothing *too* horrible occured */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Ignorable error in ei_accept - probable bad client version, bad cookie or bad nodename\n"); - continue; } - break; + continue; } listener = new_listener(&ec, clientfd); From ce186707ff2a4b7ee2a5a3a4280bb27e734cff37 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 11:44:19 -0500 Subject: [PATCH 0180/1057] FS-3577 --resolve --- src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 927f30b534..12cf01a650 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -819,7 +819,7 @@ static void listener_main_loop(listener_t *listener) /* do we need the mutex when reading? */ /*switch_mutex_lock(listener->sock_mutex); */ - status = ei_xreceive_msg_tmo(listener->sockfd, &msg, &buf, 100); + status = ei_xreceive_msg_tmo(listener->sockfd, &msg, &buf, 10); /*switch_mutex_unlock(listener->sock_mutex); */ switch (status) { @@ -1411,8 +1411,7 @@ SWITCH_STANDARD_APP(erlang_outbound_function) char *reg_name = NULL, *node, *module = NULL, *function = NULL; listener_t *listener; int argc = 0, argc2 = 0; - char *argv[80] = { 0 }, *argv2[80] = { - 0}; + char *argv[80] = { 0 }, *argv2[80] = { 0 }; char *mydata, *myarg; char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1]; switch_bool_t new_session = SWITCH_FALSE; From 092a0f8b5f25553e721eb230bffd005844ffca16 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 13:09:38 -0500 Subject: [PATCH 0181/1057] FS-4194 --resolve --- src/switch_ivr_originate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 33c5e2e6d0..87ff02ec8c 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -444,7 +444,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat for (i = 0; i < len; i++) { - if (switch_channel_test_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP)) { + if (originate_status[i].peer_channel && switch_channel_test_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP)) { const char *key = switch_channel_get_variable(originate_status[i].peer_channel, "channel_swap_uuid"); switch_core_session_t *swap_session, *old_session; From fd622401999bae056d8f650446c5861a7875d906 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 7 May 2012 14:05:21 -0500 Subject: [PATCH 0182/1057] changes for mod_gsmopen for vs2010 --- Freeswitch.2010.sln | 32 +++ .../win32/gsmlib.2010.vcxproj | 263 ++++++++++++++++++ .../mod_gsmopen/mod_gsmopen.2010.vcxproj | 170 +++++++++++ src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 9 + 4 files changed, 474 insertions(+) create mode 100644 src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.2010.vcxproj create mode 100644 src/mod/endpoints/mod_gsmopen/mod_gsmopen.2010.vcxproj diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 3a8469c327..e7cccee08c 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -521,6 +521,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_abstraction", "src\mod\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sms", "src\mod\applications\mod_sms\mod_sms.2010.vcxproj", "{2469B306-B027-4FF2-8815-C9C1EA2CAE79}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsmlib", "src\mod\endpoints\mod_gsmopen\gsmlib\gsmlib-1.10-patched-13ubuntu\win32\gsmlib.2010.vcxproj", "{26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsmopen", "src\mod\endpoints\mod_gsmopen\mod_gsmopen.2010.vcxproj", "{74B120FF-6935-4DFE-A142-CDB6BEA99C90}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3544,6 +3548,32 @@ Global {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|x64.ActiveCfg = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|x64 Setup.ActiveCfg = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.Release|x86 Setup.ActiveCfg = Release|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|Win32.ActiveCfg = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|x64.ActiveCfg = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|x64.Build.0 = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|x64 Setup.ActiveCfg = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.All|x86 Setup.ActiveCfg = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Debug|Win32.ActiveCfg = Debug|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Debug|x64.ActiveCfg = Debug|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|Win32.ActiveCfg = Release|Win32 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|x64.ActiveCfg = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|x64 Setup.ActiveCfg = Release|x64 + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}.Release|x86 Setup.ActiveCfg = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|Win32.ActiveCfg = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|x64.ActiveCfg = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|x64.Build.0 = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|x64 Setup.ActiveCfg = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.All|x86 Setup.ActiveCfg = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Debug|Win32.ActiveCfg = Debug|Win32 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Debug|x64.ActiveCfg = Debug|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|Win32.ActiveCfg = Release|Win32 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x64.ActiveCfg = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x64 Setup.ActiveCfg = Release|x64 + {74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x86 Setup.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3569,6 +3599,7 @@ Global {48414740-C693-4968-9846-EE058020C64F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {05C9FB27-480E-4D53-B3B7-7338E2514666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} + {74B120FF-6935-4DFE-A142-CDB6BEA99C90} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} @@ -3655,6 +3686,7 @@ Global {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} + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {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/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.2010.vcxproj b/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.2010.vcxproj new file mode 100644 index 0000000000..78bc811ea1 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/gsmlib/gsmlib-1.10-patched-13ubuntu/win32/gsmlib.2010.vcxproj @@ -0,0 +1,263 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + gsmlib + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} + + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + .\Release\ + .\Release\ + .\Debug\ + .\Debug\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + MaxSpeed + OnlyExplicitInline + ../vcproject;..;.;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + true + .\Release/gsmlib.pch + .\Release/ + .\Release/ + .\Release/ + true + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + .\Release\gsmlib.lib + true + + + true + .\Release/gsmlib.bsc + + + + + Disabled + ..;.;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + .\Debug/gsmlib.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + .\Debug\gsmlib.lib + true + false + %(IgnoreSpecificDefaultLibraries) + + + true + .\Debug/gsmlib.bsc + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + ../vcproject;..;.;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + true + .\Release/gsmlib.pch + .\Release/ + .\Release/ + .\Release/ + true + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + .\Release\gsmlib.lib + true + + + true + .\Release/gsmlib.bsc + + + + + X64 + + + Disabled + ..;.;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + .\Debug/gsmlib.pch + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + .\Debug\gsmlib.lib + true + false + %(IgnoreSpecificDefaultLibraries) + + + true + .\Debug/gsmlib.bsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.2010.vcxproj b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.2010.vcxproj new file mode 100644 index 0000000000..bf4c80fd16 --- /dev/null +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.2010.vcxproj @@ -0,0 +1,170 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_gsmopen + {74B120FF-6935-4DFE-A142-CDB6BEA99C90} + mod_skypiax + Win32Proj + + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + gsmlib\gsmlib-1.10-patched-13ubuntu;libctb-0.16\include;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + NO_ALSA;%(PreprocessorDefinitions) + + + Level4 + false + + + gsmlib.lib ctbd-0.16.lib "..\..\..\..\w32\library\debug\freeswitchcore.lib" "..\..\..\..\libs\libteletone\Debug\libteletone.lib" ksuser.lib "..\..\..\..\libs\win32\apr\debug\libapr-1.lib" +rpcrt4.lib "..\..\..\..\debug\libtiff.lib" "..\..\..\..\libs\spandsp\src\debug\spandsp.lib" %(AdditionalOptions) + gsmlib\gsmlib-1.10-patched-13ubuntu\win32\Debug;libctb-0.16\lib;%(AdditionalLibraryDirectories) + false + + + + + + + gsmlib\gsmlib-1.10-patched-13ubuntu;libctb-0.16\include;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + + + + + rpcrt4.lib %(AdditionalOptions) + false + + + + + + + X64 + + + gsmlib\gsmlib-1.10-patched-13ubuntu;libctb-0.16\include;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + NO_ALSA;%(PreprocessorDefinitions) + + + Level4 + false + + + gsmlib.lib ctbd-0.16.lib "..\..\..\..\w32\library\debug\freeswitchcore.lib" "..\..\..\..\libs\libteletone\Debug\libteletone.lib" ksuser.lib "..\..\..\..\libs\win32\apr\debug\libapr-1.lib" +rpcrt4.lib "..\..\..\..\debug\libtiff.lib" "..\..\..\..\libs\spandsp\src\debug\spandsp.lib" %(AdditionalOptions) + gsmlib\gsmlib-1.10-patched-13ubuntu\win32\Debug;libctb-0.16\lib;%(AdditionalLibraryDirectories) + false + + + MachineX64 + + + + + X64 + + + gsmlib\gsmlib-1.10-patched-13ubuntu;libctb-0.16\include;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src\msvc;%(RootDir)%(Directory)..\..\..\..\libs\spandsp\src;%(RootDir)%(Directory)..\..\..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories) + + + + + rpcrt4.lib %(AdditionalOptions) + false + + + MachineX64 + + + + + + + + + + + + {26c82fce-e0cf-4d10-a00c-d8e582ffeb53} + + + + + + \ No newline at end of file diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 51564e0f5f..d75dd5e6c4 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -345,7 +345,12 @@ static switch_status_t interface_exists(char *the_interface) static switch_status_t remove_interface(char *the_interface) { int x = 10; +#ifdef WIN32 + switch_size_t howmany = 8; +#else unsigned int howmany = 8; +#endif + int interface_id = -1; private_t *tech_pvt = NULL; switch_status_t status; @@ -1922,7 +1927,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_gsmopen_shutdown) int x; private_t *tech_pvt = NULL; switch_status_t status; +#ifdef WIN32 + switch_size_t howmany = 8; +#else unsigned int howmany = 8; +#endif int interface_id; int fd; From 412c808e0cadcf8f1998a660a803238d1962524b Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 7 May 2012 15:10:25 -0400 Subject: [PATCH 0183/1057] freetdm: Added GSM module skeleton --- libs/freetdm/Makefile.am | 8 + libs/freetdm/configure.ac | 9 + libs/freetdm/mod_freetdm/mod_freetdm.c | 93 ++++ libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 424 ++++++++++++++++++ libs/freetdm/src/include/freetdm.h | 3 +- libs/freetdm/src/include/private/ftdm_types.h | 3 +- 6 files changed, 538 insertions(+), 2 deletions(-) create mode 100644 libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 35f1cecd1e..b54069a508 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -248,6 +248,14 @@ ftmod_r2_la_LDFLAGS = -shared -module -avoid-version -lopenr2 ftmod_r2_la_LIBADD = libfreetdm.la endif +if HAVE_WAT +mod_LTLIBRARIES += ftmod_gsm.la +ftmod_gsm_la_SOURCES = $(SRC)/ftmod/ftmod_gsm/ftmod_gsm.c +ftmod_gsm_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) +ftmod_gsm_la_LDFLAGS = -shared -module -avoid-version -lwat +ftmod_gsm_la_LIBADD = libfreetdm.la +endif + if HAVE_MISDN mod_LTLIBRARIES += ftmod_misdn.la ftmod_misdn_la_SOURCES = $(SRC)/ftmod/ftmod_misdn/ftmod_misdn.c diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 292c1e7cfa..cb254da56b 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -189,6 +189,14 @@ AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [HAVE_OPENR2="yes"]) AC_MSG_RESULT([checking whether to build ftmod_r2... ${HAVE_OPENR2}]) AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"]) +## +# WAT GSM stack +# +HAVE_WAT="no" +AC_CHECK_LIB([wat], [wat_version], [HAVE_WAT="yes"]) +AC_MSG_RESULT([checking whether to build ftmod_wat... ${HAVE_WAT}]) +AM_CONDITIONAL([HAVE_WAT], [test "${HAVE_WAT}" = "yes"]) + ## # Digium libpri (TODO: add checks) # @@ -450,6 +458,7 @@ AC_MSG_RESULT([ ftmod_sangoma_isdn................. ${HAVE_SNG_ISDN} ftmod_sangoma_ss7.................. ${HAVE_SNG_SS7} ftmod_r2........................... ${HAVE_OPENR2} + ftmod_gsm.......................... ${HAVE_WAT} ftmod_pritap....................... ${HAVE_PRITAP} I/O: ftmod_wanpipe...................... ${HAVE_LIBSANGOMA} diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 0fc7906331..3f461e8ab1 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2820,6 +2820,95 @@ static int add_profile_parameters(switch_xml_t cfg, const char *profname, ftdm_c return paramindex; } +static void parse_gsm_spans(switch_xml_t cfg, switch_xml_t spans) +{ + switch_xml_t myspan, param; + + for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { + ftdm_status_t zstatus = FTDM_FAIL; + const char *context = "default"; + const char *dialplan = "XML"; + ftdm_conf_parameter_t spanparameters[30]; + char *id = (char *) switch_xml_attr(myspan, "id"); + char *name = (char *) switch_xml_attr(myspan, "name"); + char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); + ftdm_span_t *span = NULL; + uint32_t span_id = 0; + unsigned paramindex = 0; + + if (!name && !id) { + CONFIG_ERROR("sangoma isdn span missing required attribute 'id' or 'name', skipping ...\n"); + continue; + } + + if (name) { + zstatus = ftdm_span_find_by_name(name, &span); + } else { + if (switch_is_number(id)) { + span_id = atoi(id); + zstatus = ftdm_span_find(span_id, &span); + } + + if (zstatus != FTDM_SUCCESS) { + zstatus = ftdm_span_find_by_name(id, &span); + } + } + + if (zstatus != FTDM_SUCCESS) { + CONFIG_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + continue; + } + + if (!span_id) { + span_id = ftdm_span_get_id(span); + } + + memset(spanparameters, 0, sizeof(spanparameters)); + paramindex = 0; + + if (configname) { + paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters)); + if (paramindex) { + ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id); + } + } + + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + if (ftdm_array_len(spanparameters) - 1 == paramindex) { + CONFIG_ERROR("Too many parameters for GSM span, ignoring any parameter after %s\n", var); + break; + } + + if (!strcasecmp(var, "context")) { + context = val; + } else if (!strcasecmp(var, "dialplan")) { + dialplan = val; + } else { + spanparameters[paramindex].var = var; + spanparameters[paramindex].val = val; + paramindex++; + } + } + + if (ftdm_configure_span_signaling(span, + "gsm", + on_clear_channel_signal, + spanparameters) != FTDM_SUCCESS) { + CONFIG_ERROR("Error configuring Sangoma ISDN FreeTDM span %d\n", span_id); + continue; + } + SPAN_CONFIG[span_id].span = span; + switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); + switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); + switch_copy_string(SPAN_CONFIG[span_id].type, "GSM", sizeof(SPAN_CONFIG[span_id].type)); + ftdm_log(FTDM_LOG_DEBUG, "Configured GSM FreeTDM span %d\n", span_id); + ftdm_span_start(span); + } +} + static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) { switch_xml_t myspan, param; @@ -2997,6 +3086,10 @@ static switch_status_t load_config(void) parse_bri_pri_spans(cfg, spans); } + if ((spans = switch_xml_child(cfg, "gsm_spans"))) { + parse_gsm_spans(cfg, spans); + } + switch_core_hash_init(&globals.ss7_configs, module_pool); if ((spans = switch_xml_child(cfg, "sangoma_ss7_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c new file mode 100644 index 0000000000..8337a3829e --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -0,0 +1,424 @@ +/* + * Copyright (c) 2011, Sangoma Technologies + * 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. + * + * Contributors: + * + * Gideon Sadan + * Moises Silva + * + */ + +#include +#include +#include +#include + +/* span monitor thread */ +static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj); + +/* IO interface for the command API */ +static ftdm_io_interface_t g_ftdm_gsm_interface; + +static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(gsm_outgoing_call) +{ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "GSM place call not implemented yet!\n"); + return FTDM_FAIL; +} + +static ftdm_status_t ftdm_gsm_start(ftdm_span_t *span) +{ + return ftdm_thread_create_detached(ftdm_gsm_run, span); +} + +static ftdm_status_t ftdm_gsm_stop(ftdm_span_t *span) +{ + ftdm_log(FTDM_LOG_CRIT, "STOP not implemented yet!\n"); + return FTDM_FAIL; +} + +static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_gsm_get_channel_sig_status) +{ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "get sig status not implemented yet!\n"); + return FTDM_FAIL; +} + +static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_gsm_set_channel_sig_status) +{ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "set sig status not implemented yet!\n"); + return FTDM_FAIL; +} + +static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_gsm_get_span_sig_status) +{ + ftdm_log(FTDM_LOG_CRIT, "span get sig status not implemented yet!\n"); + return FTDM_FAIL; +} + +static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_gsm_set_span_sig_status) +{ + ftdm_log(FTDM_LOG_CRIT, "span set sig status not implemented yet!\n"); + return FTDM_FAIL; +} + +static ftdm_state_map_t gsm_state_map = { + { + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_ANY_STATE, FTDM_END}, + {FTDM_CHANNEL_STATE_RESET, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESET, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_RING, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + }, + + /* Outbound states */ + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_ANY_STATE, FTDM_END}, + {FTDM_CHANNEL_STATE_RESET, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESET, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_DIALING, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + }, + } +}; + +static ftdm_status_t ftdm_gsm_state_advance(ftdm_channel_t *ftdmchan) +{ + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); + return FTDM_SUCCESS; +} + +static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) +{ + unsigned paramindex = 0; + const char *var = NULL; + const char *val = NULL; + + ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling cb provided\n"); + + if (span->signal_type) { + snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling."); + return FTDM_FAIL; + } + + for (; ftdm_parameters[paramindex].var; paramindex++) { + var = ftdm_parameters[paramindex].var; + val = ftdm_parameters[paramindex].val; + ftdm_log(FTDM_LOG_DEBUG, "Reading GSM parameter %s for span %d\n", var, span->span_id); + if (!strcasecmp(var, "moduletype")) { + if (!val) { + break; + } + if (ftdm_strlen_zero_buf(val)) { + ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty moduletype parameter\n"); + continue; + } + ftdm_log(FTDM_LOG_DEBUG, "Configuring GSM span %d for moduletype %s\n", span->span_id, val); + } else { + snprintf(span->last_error, sizeof(span->last_error), "Unknown GSM parameter [%s]", var); + return FTDM_FAIL; + } + } + + /* Bind function pointers for control operations */ + span->start = ftdm_gsm_start; + span->stop = ftdm_gsm_stop; + span->sig_read = NULL; + span->sig_write = NULL; + + span->signal_cb = sig_cb; + span->signal_type = FTDM_SIGTYPE_GSM; + span->signal_data = NULL; /* Gideon, plz fill me with gsm span specific data (you allocate and free) */ + span->outgoing_call = gsm_outgoing_call; + span->get_span_sig_status = ftdm_gsm_get_span_sig_status; + span->set_span_sig_status = ftdm_gsm_set_span_sig_status; + span->get_channel_sig_status = ftdm_gsm_get_channel_sig_status; + span->set_channel_sig_status = ftdm_gsm_set_channel_sig_status; + + span->state_map = &gsm_state_map; + span->state_processor = ftdm_gsm_state_advance; + + /* use signals queue */ + ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + + /* we can skip states (going straight from RING to UP) */ + ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); + +#if 0 + /* setup the scheduler (create if needed) */ + snprintf(schedname, sizeof(schedname), "ftmod_r2_%s", span->name); + ftdm_assert(ftdm_sched_create(&r2data->sched, schedname) == FTDM_SUCCESS, "Failed to create schedule!\n"); + spanpvt->sched = r2data->sched; +#endif + + return FTDM_SUCCESS; + +} + +static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) +{ + ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = (ftdm_span_t *) obj; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *citer = NULL; + int waitms = 10; + + ftdm_log(FTDM_LOG_DEBUG, "GSM monitor thread for span %s started\n", span->name); + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + if (!chaniter) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + goto done; + } + while (ftdm_running()) { + +#if 0 + /* run any span timers */ + ftdm_sched_run(r2data->sched); + +#endif + /* deliver the actual channel events to the user now without any channel locking */ + ftdm_span_trigger_signals(span); +#if 0 + /* figure out what event to poll each channel for. POLLPRI when the channel is down, + * POLLPRI|POLLIN|POLLOUT otherwise */ + memset(poll_events, 0, sizeof(short)*span->chan_count); + citer = ftdm_span_get_chan_iterator(span, chaniter); + if (!citer) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + goto done; + } + for (i = 0; citer; citer = ftdm_iterator_next(citer), i++) { + ftdmchan = ftdm_iterator_current(citer); + r2chan = R2CALL(ftdmchan)->r2chan; + poll_events[i] = FTDM_EVENTS; + if (openr2_chan_get_read_enabled(r2chan)) { + poll_events[i] |= FTDM_READ; + } + } + status = ftdm_span_poll_event(span, waitms, poll_events); + + /* run any span timers */ + ftdm_sched_run(r2data->sched); +#endif + ftdm_sleep(waitms); + + + /* this main loop takes care of MF and CAS signaling during call setup and tear down + * for every single channel in the span, do not perform blocking operations here! */ + citer = ftdm_span_get_chan_iterator(span, chaniter); + for ( ; citer; citer = ftdm_iterator_next(citer)) { + ftdmchan = ftdm_iterator_current(citer); + + ftdm_channel_lock(ftdmchan); + + ftdm_channel_advance_states(ftdmchan); + + ftdm_channel_unlock(ftdmchan); + } + } + +done: + ftdm_iterator_free(chaniter); + + ftdm_log(FTDM_LOG_DEBUG, "GSM thread ending.\n"); + + return NULL; +} + +#define FT_SYNTAX "USAGE:\n" \ +"--------------------------------------------------------------------------------\n" \ +"ftdm gsm status \n" \ +"--------------------------------------------------------------------------------\n" +static FIO_API_FUNCTION(ftdm_gsm_api) +{ + char *mycmd = NULL, *argv[10] = { 0 }; + int argc = 0; + + if (data) { + mycmd = ftdm_strdup(data); + argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argc == 1) { + if (!strcasecmp(argv[0], "version")) { + stream->write_function(stream, "libwat GSM version: implement me!!\n"); + stream->write_function(stream, "+OK.\n"); + goto done; + } + } + + stream->write_function(stream, "%s", FT_SYNTAX); + +done: + + ftdm_safe_free(mycmd); + + return FTDM_SUCCESS; + +} + +static FIO_IO_LOAD_FUNCTION(ftdm_gsm_io_init) +{ + assert(fio != NULL); + memset(&g_ftdm_gsm_interface, 0, sizeof(g_ftdm_gsm_interface)); + + g_ftdm_gsm_interface.name = "gsm"; + g_ftdm_gsm_interface.api = ftdm_gsm_api; + + *fio = &g_ftdm_gsm_interface; + + return FTDM_SUCCESS; +} + +static FIO_SIG_LOAD_FUNCTION(ftdm_gsm_init) +{ + /* this is called on module load */ + return FTDM_SUCCESS; +} + +static FIO_SIG_UNLOAD_FUNCTION(ftdm_gsm_destroy) +{ + /* this is called on module unload */ + return FTDM_SUCCESS; +} + +EX_DECLARE_DATA ftdm_module_t ftdm_module = { + /* .name */ "gsm", + /* .io_load */ ftdm_gsm_io_init, + /* .io_unload */ NULL, + /* .sig_load */ ftdm_gsm_init, + /* .sig_configure */ NULL, + /* .sig_unload */ ftdm_gsm_destroy, + /* .configure_span_signaling */ ftdm_gsm_configure_span_signaling +}; + + +/* 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/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 585a5d72ae..81f31e4ff8 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -472,9 +472,10 @@ typedef enum { FTDM_TRUNK_FXO, FTDM_TRUNK_FXS, FTDM_TRUNK_EM, + FTDM_TRUNK_GSM, FTDM_TRUNK_NONE } ftdm_trunk_type_t; -#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "NONE" +#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "GSM", "NONE" /*! \brief Move from string to ftdm_trunk_type_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t) diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 6df25fe4d2..5bacaaf9ba 100755 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -163,7 +163,8 @@ typedef enum { FTDM_SIGTYPE_SANGOMABOOST, FTDM_SIGTYPE_M3UA, FTDM_SIGTYPE_R2, - FTDM_SIGTYPE_SS7 + FTDM_SIGTYPE_SS7, + FTDM_SIGTYPE_GSM } ftdm_signal_type_t; typedef enum { From 9cb67dd0c77c9cb3136ac0414e2e646d3b979559 Mon Sep 17 00:00:00 2001 From: Gideon Sadan Date: Wed, 21 Dec 2011 18:41:56 -0500 Subject: [PATCH 0184/1057] freetdm: initializing wat library interface --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 187 ++++++++++++++++++- 1 file changed, 185 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index 8337a3829e..f0b62e36ac 100644 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -2,7 +2,7 @@ * Copyright (c) 2011, Sangoma Technologies * All rights reserved. * - * Redistribution and use in source and binary forms, with or without + Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * @@ -37,11 +37,145 @@ * */ +#define _GNU_SOURCE + +#include +#include +#include + +#include +#include +#include +#include +#include +/*========================*/ + #include #include #include #include + + +typedef struct ftdm_gsm_data_s { + + wat_interface_t wat_interface; + +} ftdm_gsm_data_t; + +/* wat callbacks */ +void on_wat_sigstatus_change(unsigned char span_id, wat_sigstatus_t sigstatus); +void on_wat_span_alarm(unsigned char span_id, wat_alarm_t alarm); +int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len); + +void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event); +void on_wat_con_sts(unsigned char span_id, uint8_t call_id, wat_con_status_t *status); +void on_wat_rel_ind(unsigned char span_id, uint8_t call_id, wat_rel_event_t *rel_event); +void on_wat_rel_cfm(unsigned char span_id, uint8_t call_id); +void on_wat_sms_ind(unsigned char span_id, wat_sms_event_t *sms_event); +void on_wat_sms_sts(unsigned char span_id, uint8_t sms_id, wat_sms_status_t *status); + + +void on_wat_log(uint8_t level, char *fmt, ...); +void *on_wat_malloc(size_t size); +void *on_wat_calloc(size_t nmemb, size_t size); +void on_wat_free(void *ptr); +void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...); + + +/* gsm_data->wat_interface.wat_log = on_log; */ + +/* gsm_data->wat_interface.wat_log_span = on_log_span; */ + +/* gsm_data->wat_interface.wat_malloc = on_wat_malloc;*/ +/* gsm_data->wat_interface.wat_calloc = on_wat_calloc;*/ +/* gsm_data->wat_interface.wat_free = on_wat_free;*/ + + +int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) +{ + int res = 0; + + return res; +} + +void on_wat_sigstatus_change(unsigned char span_id, wat_sigstatus_t sigstatus) +{ + fprintf(stdout, "span:%d Signalling status changed %d\n", span_id, sigstatus); + + return; +} + +void on_wat_span_alarm(unsigned char span_id, wat_alarm_t alrm) +{ + fprintf(stdout, "span:%d Alarm received\n", span_id); + return;ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); +} + +void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event) +{ + fprintf(stdout, "s%d: Incoming call (id:%d) Calling Number:%s type:%d plan:%d\n", span_id, call_id, con_event->calling_num.digits, con_event->calling_num.type, con_event->calling_num.plan); + + + return; +} + +void on_wat_con_sts(unsigned char span_id, uint8_t call_id, wat_con_status_t *status) +{ + return; +} + +void on_wat_rel_ind(unsigned char span_id, uint8_t call_id, wat_rel_event_t *rel_event) +{ + fprintf(stdout, "s%d: Call hangup (id:%d) cause:%d\n", span_id, call_id, rel_event->cause); + + return; +} + +void on_wat_rel_cfm(unsigned char span_id, uint8_t call_id) +{ + fprintf(stdout, "s%d: Call hangup complete (id:%d)\n", span_id, call_id); + return; +} + +void on_wat_sms_ind(unsigned char span_id, wat_sms_event_t *sms_event) +{ + return; +} + +void on_wat_sms_sts(unsigned char span_id, uint8_t sms_id, wat_sms_status_t *status) +{ + return; +} + + + +void on_wat_log(uint8_t level, char *fmt, ...) +{ + +} + + +void *on_wat_malloc(size_t size) +{ + return NULL; +} +void *on_wat_calloc(size_t nmemb, size_t size) +{ + return NULL; +} +void on_wat_free(void *ptr) +{ + +} +void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...) +{ + +} + + +/* END wat callbacks */ + /* span monitor thread */ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj); @@ -212,6 +346,49 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) const char *var = NULL; const char *val = NULL; + ftdm_gsm_data_t *gsm_data = malloc(sizeof(*gsm_data)); + if (!gsm_data) { + snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate GSM data."); + return FTDM_FAIL; + } + memset(gsm_data,0, sizeof(*gsm_data)); + + + /* */ + + +ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); + + gsm_data->wat_interface.wat_sigstatus_change = on_wat_sigstatus_change; + gsm_data->wat_interface.wat_span_write = on_wat_span_write; + + gsm_data->wat_interface.wat_log = on_wat_log; + gsm_data->wat_interface.wat_log_span = on_wat_log_span; + gsm_data->wat_interface.wat_malloc = on_wat_malloc; + gsm_data->wat_interface.wat_calloc = on_wat_calloc; + gsm_data->wat_interface.wat_free = on_wat_free; + + gsm_data->wat_interface.wat_alarm = on_wat_span_alarm; + gsm_data->wat_interface.wat_con_ind = on_wat_con_ind; + gsm_data->wat_interface.wat_con_sts = on_wat_con_sts; + gsm_data->wat_interface.wat_rel_ind = on_wat_rel_ind; + gsm_data->wat_interface.wat_rel_cfm = on_wat_rel_cfm; + gsm_data->wat_interface.wat_sms_ind = on_wat_sms_ind; + gsm_data->wat_interface.wat_sms_sts = on_wat_sms_sts; + + if (wat_register(&gsm_data->wat_interface)) { + snprintf(span->last_error, sizeof(span->last_error), "Failed to register WAT Library !!!\n"); + ftdm_log(FTDM_LOG_DEBUG, "FAILED Registering interface to WAT Library...\n"); + return FTDM_FAIL; + + } + ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); + + + /* */ + + + ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling cb provided\n"); if (span->signal_type) { @@ -219,6 +396,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) return FTDM_FAIL; } + + + for (; ftdm_parameters[paramindex].var; paramindex++) { var = ftdm_parameters[paramindex].var; val = ftdm_parameters[paramindex].val; @@ -355,12 +535,15 @@ static FIO_API_FUNCTION(ftdm_gsm_api) if (data) { mycmd = ftdm_strdup(data); + argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argc == 1) { if (!strcasecmp(argv[0], "version")) { - stream->write_function(stream, "libwat GSM version: implement me!!\n"); + uint8_t current = 0, revision = 0, age = 0; + wat_version(¤t, &revision, &age); + stream->write_function(stream, "libwat GSM VERSION: %d.%d.%d\n", current, revision, age); stream->write_function(stream, "+OK.\n"); goto done; } From f891fefcb166a3c5f054b3e88aac2225ca99435a Mon Sep 17 00:00:00 2001 From: Gideon Sadan Date: Thu, 22 Dec 2011 19:31:28 -0500 Subject: [PATCH 0185/1057] freetdm: GSM read and write initialization --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 334 ++++++++++++++++--- 1 file changed, 287 insertions(+), 47 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index f0b62e36ac..23bb118270 100644 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -55,14 +55,85 @@ #include #include +#define MAX_SPANS 32 +typedef struct ftdm_gsm_span_data_s { + ftdm_span_t *span; + fio_signal_cb_t sig_cb; + ftdm_conf_parameter_t *ftdm_parameters; +}ftdm_gsm_span_data_t; +static ftdm_gsm_span_data_t spans_info[MAX_SPANS]; +static int n_spans_info = 0; + typedef struct ftdm_gsm_data_s { wat_interface_t wat_interface; + + } ftdm_gsm_data_t; +ftdm_span_t *get_span(int span_id); + +ftdm_span_t *get_span(int span_id) +{ + int i; + for(i=0; i< n_spans_info;i++) + { + if(spans_info[i].span->span_id == span_id) { + + return spans_info[i].span; + } + + } + + return NULL; +} + +ftdm_channel_t *get_channel(int span_id, int channel_id); +ftdm_channel_t *get_channel(int span_id, int channel_id) +{ + ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t * span = get_span(span_id); + + if(!span){ + return NULL; + } + + + + + ftdm_iterator_t *citer = ftdm_span_get_chan_iterator(span, NULL); + + for ( ; citer; citer = ftdm_iterator_next(citer)) { + ftdmchan = ftdm_iterator_current(citer); + if(ftdmchan->chan_id == channel_id) { + ftdm_iterator_free(citer); + return ftdmchan; + } + + + + + } + + ftdm_iterator_free(citer); + return NULL; +} + + +static int read_channel(ftdm_channel_t *ftdm_chan , const void *buf, int size) +{ + + ftdm_size_t outsize = size; + ftdm_status_t status = ftdm_channel_read(ftdm_chan, (void *)buf, &outsize); + if (FTDM_FAIL == status) { + return -1; + } + return (int)outsize; +} + /* wat callbacks */ void on_wat_sigstatus_change(unsigned char span_id, wat_sigstatus_t sigstatus); void on_wat_span_alarm(unsigned char span_id, wat_alarm_t alarm); @@ -85,18 +156,30 @@ void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...); /* gsm_data->wat_interface.wat_log = on_log; */ -/* gsm_data->wat_interface.wat_log_span = on_log_span; */ +/* gsm_data->wat_interface.wat +_log_span = on_log_span; */ /* gsm_data->wat_interface.wat_malloc = on_wat_malloc;*/ /* gsm_data->wat_interface.wat_calloc = on_wat_calloc;*/ -/* gsm_data->wat_interface.wat_free = on_wat_free;*/ +/* gsm_data->wat_interface.wat_free = on_wat_frspanee;*/ int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) { - int res = 0; - - return res; +/* + ftdm_log(FTDM_LOG_DEBUG, "!!! on_wat_span_write(%d, %s, int)\n", span_id, buffer, len); +*/ + ftdm_channel_t * ftdm_chan = get_channel(span_id, 2); + ftdm_size_t outsize = len; + ftdm_channel_lock(ftdm_chan); + ftdm_status_t status = ftdm_channel_write(ftdm_chan, (void *)buffer, len, &outsize); + ftdm_channel_unlock(ftdm_chan); + if (FTDM_FAIL == status) { + return -1; + } + return (int)outsize; + + } void on_wat_sigstatus_change(unsigned char span_id, wat_sigstatus_t sigstatus) @@ -109,7 +192,7 @@ void on_wat_sigstatus_change(unsigned char span_id, wat_sigstatus_t sigstatus) void on_wat_span_alarm(unsigned char span_id, wat_alarm_t alrm) { fprintf(stdout, "span:%d Alarm received\n", span_id); - return;ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); + return; } void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event) @@ -153,24 +236,73 @@ void on_wat_sms_sts(unsigned char span_id, uint8_t sms_id, wat_sms_status_t *sta void on_wat_log(uint8_t level, char *fmt, ...) { + int ftdm_level; + + va_list argptr; + va_start(argptr, fmt); + + char buff[10001]; + switch(level) + { + case WAT_LOG_CRIT: ftdm_level = FTDM_LOG_LEVEL_CRIT; break; + case WAT_LOG_ERROR: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; + default: + case WAT_LOG_WARNING: ftdm_level = FTDM_LOG_LEVEL_WARNING; break; + case WAT_LOG_INFO: ftdm_level = FTDM_LOG_LEVEL_INFO; break; + case WAT_LOG_NOTICE: ftdm_level = FTDM_LOG_LEVEL_NOTICE; break; + case WAT_LOG_DEBUG: ftdm_level = FTDM_LOG_LEVEL_DEBUG; break; + + }; + + + vsprintf(buff, fmt, argptr); + + ftdm_log(FTDM_PRE, ftdm_level, "WAT :%s", buff); + + va_end(argptr); } void *on_wat_malloc(size_t size) { - return NULL; + return ftdm_malloc(size); } void *on_wat_calloc(size_t nmemb, size_t size) { - return NULL; + return ftdm_calloc(nmemb, size); } void on_wat_free(void *ptr) { - + ftdm_free(ptr); } void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...) { + int ftdm_level; + va_list argptr; + va_start(argptr, fmt); + + char buff[10001]; + switch(level) + { + case WAT_LOG_CRIT: ftdm_level = FTDM_LOG_LEVEL_CRIT; break; + case WAT_LOG_ERROR: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; + default: + case WAT_LOG_WARNING: ftdm_level = FTDM_LOG_LEVEL_WARNING; break; + case WAT_LOG_INFO: ftdm_level = FTDM_LOG_LEVEL_INFO; break; + case WAT_LOG_NOTICE: ftdm_level = FTDM_LOG_LEVEL_NOTICE; break; + case WAT_LOG_DEBUG: ftdm_level = FTDM_LOG_LEVEL_DEBUG; break; + + }; + + + vsprintf(buff, fmt, argptr); + + ftdm_log(FTDM_PRE, ftdm_level, "WAT span %d:%s", span_id, buff); + + va_end(argptr); + + } @@ -346,8 +478,26 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) const char *var = NULL; const char *val = NULL; + + if (n_spans_info >= MAX_SPANS) { + snprintf(span->last_error, sizeof(span->last_error), "MAX_SPANS Exceeded !!!\n"); + ftdm_log(FTDM_LOG_DEBUG, span->last_error); + return FTDM_FAIL; + + } + + memset(&spans_info[n_spans_info], 0 ,sizeof(spans_info[n_spans_info])); + + spans_info[n_spans_info].span = span; + spans_info[n_spans_info].sig_cb = sig_cb; + spans_info[n_spans_info].ftdm_parameters = ftdm_parameters; + n_spans_info ++; + + + ftdm_gsm_data_t *gsm_data = malloc(sizeof(*gsm_data)); if (!gsm_data) { + snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate GSM data."); return FTDM_FAIL; } @@ -357,37 +507,6 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) /* */ -ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); - - gsm_data->wat_interface.wat_sigstatus_change = on_wat_sigstatus_change; - gsm_data->wat_interface.wat_span_write = on_wat_span_write; - - gsm_data->wat_interface.wat_log = on_wat_log; - gsm_data->wat_interface.wat_log_span = on_wat_log_span; - gsm_data->wat_interface.wat_malloc = on_wat_malloc; - gsm_data->wat_interface.wat_calloc = on_wat_calloc; - gsm_data->wat_interface.wat_free = on_wat_free; - - gsm_data->wat_interface.wat_alarm = on_wat_span_alarm; - gsm_data->wat_interface.wat_con_ind = on_wat_con_ind; - gsm_data->wat_interface.wat_con_sts = on_wat_con_sts; - gsm_data->wat_interface.wat_rel_ind = on_wat_rel_ind; - gsm_data->wat_interface.wat_rel_cfm = on_wat_rel_cfm; - gsm_data->wat_interface.wat_sms_ind = on_wat_sms_ind; - gsm_data->wat_interface.wat_sms_sts = on_wat_sms_sts; - - if (wat_register(&gsm_data->wat_interface)) { - snprintf(span->last_error, sizeof(span->last_error), "Failed to register WAT Library !!!\n"); - ftdm_log(FTDM_LOG_DEBUG, "FAILED Registering interface to WAT Library...\n"); - return FTDM_FAIL; - - } - ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); - - - /* */ - - ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling cb provided\n"); @@ -426,7 +545,7 @@ ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_GSM; - span->signal_data = NULL; /* Gideon, plz fill me with gsm span specific data (you allocate and free) */ + span->signal_data = gsm_data; /* Gideon, plz fill me with gsm span specific data (you allocate and free) */ span->outgoing_call = gsm_outgoing_call; span->get_span_sig_status = ftdm_gsm_get_span_sig_status; span->set_span_sig_status = ftdm_gsm_set_span_sig_status; @@ -442,6 +561,8 @@ ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); /* we can skip states (going straight from RING to UP) */ ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); + + #if 0 /* setup the scheduler (create if needed) */ snprintf(schedname, sizeof(schedname), "ftmod_r2_%s", span->name); @@ -449,6 +570,69 @@ ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); spanpvt->sched = r2data->sched; #endif + + +ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); + + gsm_data->wat_interface.wat_sigstatus_change = on_wat_sigstatus_change; + gsm_data->wat_interface.wat_span_write = on_wat_span_write; + + gsm_data->wat_interface.wat_log = on_wat_log; + gsm_data->wat_interface.wat_log_span = on_wat_log_span; + gsm_data->wat_interface.wat_malloc = on_wat_malloc; + gsm_data->wat_interface.wat_calloc = on_wat_calloc; + gsm_data->wat_interface.wat_free = on_wat_free; + + gsm_data->wat_interface.wat_alarm = on_wat_span_alarm; + gsm_data->wat_interface.wat_con_ind = on_wat_con_ind; + gsm_data->wat_interface.wat_con_sts = on_wat_con_sts; + gsm_data->wat_interface.wat_rel_ind = on_wat_rel_ind; + gsm_data->wat_interface.wat_rel_cfm = on_wat_rel_cfm; + gsm_data->wat_interface.wat_sms_ind = on_wat_sms_ind; + gsm_data->wat_interface.wat_sms_sts = on_wat_sms_sts; + + if (wat_register(&gsm_data->wat_interface)) { + snprintf(span->last_error, sizeof(span->last_error), "Failed to register WAT Library !!!\n"); + ftdm_log(FTDM_LOG_DEBUG, "FAILED Registering interface to WAT Library...\n"); + return FTDM_FAIL; + + } + ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); + + + + + ftdm_log(FTDM_LOG_DEBUG, "Configuring span\n"); + + //sng_fd_t dev; + //sangoma_wait_obj_t *waitable; + //unsigned char wat_span_id; + + + wat_span_config_t _wat_span_config; + + + _wat_span_config.moduletype = WAT_MODULE_TELIT; + _wat_span_config.timeout_cid_num = 10; + + if (wat_span_config(span->span_id, &_wat_span_config)) { + fprintf(stderr, "Failed to configure span!!\n"); + return FTDM_FAIL; + } + + fprintf(stdout, "Starting span\n"); + if (wat_span_start(span->span_id)) { + fprintf(stderr, "Failed to start span!!\n"); + return FTDM_FAIL; + } + + + + + + + + return FTDM_SUCCESS; } @@ -459,8 +643,13 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *citer = NULL; - int waitms = 10; + int waitms = 10, i; + ftdm_status_t status; + + short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); + + unsigned next; ftdm_log(FTDM_LOG_DEBUG, "GSM monitor thread for span %s started\n", span->name); chaniter = ftdm_span_get_chan_iterator(span, NULL); @@ -468,12 +657,27 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); goto done; } + + ftdmchan = get_channel(span->span_id, 2); + + if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open channel during incoming call! [%s]\n", ftdmchan->last_error); + return NULL; + } + while (ftdm_running()) { + + wat_span_run(span->span_id); + next = wat_span_schedule_next(span->span_id); + if(next < waitms) { + next = waitms; + } + #if 0 /* run any span timers */ ftdm_sched_run(r2data->sched); - + #endif /* deliver the actual channel events to the user now without any channel locking */ ftdm_span_trigger_signals(span); @@ -483,8 +687,8 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) memset(poll_events, 0, sizeof(short)*span->chan_count); citer = ftdm_span_get_chan_iterator(span, chaniter); if (!citer) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - goto done; + ftdm_log(Fshort *poll_events = ftdm_malloc(sizeof(short) * span->chan_count);TDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + goto done;short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); } for (i = 0; citer; citer = ftdm_iterator_next(citer), i++) { ftdmchan = ftdm_iterator_current(citer); @@ -497,7 +701,7 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) status = ftdm_span_poll_event(span, waitms, poll_events); /* run any span timers */ - ftdm_sched_run(r2data->sched); + ftdm_sched_runshort *poll_events = ftdm_malloc(sizeof(short) * span->chan_count);(r2data->sched); #endif ftdm_sleep(waitms); @@ -513,6 +717,33 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) ftdm_channel_advance_states(ftdmchan); ftdm_channel_unlock(ftdmchan); + + } + + for(i=0;i< span->chan_count; i++) + poll_events[i] = FTDM_EVENTS; + + poll_events[1] |= FTDM_READ; + status = ftdm_span_poll_event(span, next, poll_events); + + if(FTDM_SUCCESS == status) + { + ftdm_channel_lock(ftdmchan); + ftdm_channel_t * ftdm_chan = get_channel(span->span_id, 2); + char buffer[11]; + int n = read_channel(ftdm_chan , buffer, sizeof(buffer)); + ftdm_channel_unlock(ftdmchan); + if(n > 0) { + + wat_span_process_read(span->span_id, buffer, n); + /* + ftdm_log(FTDM_LOG_DEBUG, "!!! read_channel got %d bytes\n", n); + */ + } + else { + ftdm_sleep(waitms); + } + } } @@ -544,6 +775,16 @@ static FIO_API_FUNCTION(ftdm_gsm_api) uint8_t current = 0, revision = 0, age = 0; wat_version(¤t, &revision, &age); stream->write_function(stream, "libwat GSM VERSION: %d.%d.%d\n", current, revision, age); + stream->write_function(stream, "+OK.\n"); + goto done; + } + + if (!strcasecmp(argv[0], "status")) { + + /*wat_chip_info_t* chip_info = wat_span_get_chip_info(span->span_id); */ + + + stream->write_function(stream, "+OK.\n"); goto done; } @@ -571,7 +812,6 @@ static FIO_IO_LOAD_FUNCTION(ftdm_gsm_io_init) return FTDM_SUCCESS; } - static FIO_SIG_LOAD_FUNCTION(ftdm_gsm_init) { /* this is called on module load */ From c268b388a7a3053731422fddf9c243e1dfb3d722 Mon Sep 17 00:00:00 2001 From: Gideon Sadan Date: Fri, 23 Dec 2011 16:59:58 -0500 Subject: [PATCH 0186/1057] freetdm: GSM - Finish adding status command + stabilizing --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 164 ++++++++++++++++--- 1 file changed, 145 insertions(+), 19 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index 23bb118270..d94e2594cc 100644 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -25,7 +25,7 @@ * 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 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OFn_spans_info * 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. @@ -74,6 +74,10 @@ typedef struct ftdm_gsm_data_s { } ftdm_gsm_data_t; + +static ftdm_status_t init_wat_lib(void); +static int wat_lib_initialized = 0; + ftdm_span_t *get_span(int span_id); ftdm_span_t *get_span(int span_id) @@ -166,9 +170,9 @@ _log_span = on_log_span; */ int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) { -/* - ftdm_log(FTDM_LOG_DEBUG, "!!! on_wat_span_write(%d, %s, int)\n", span_id, buffer, len); -*/ + +/* ftdm_log(FTDM_LOG_DEBUG, "====================>>> %s (%d) - %d\n", buffer, len, (int) span_id);*/ + ftdm_channel_t * ftdm_chan = get_channel(span_id, 2); ftdm_size_t outsize = len; ftdm_channel_lock(ftdm_chan); @@ -472,12 +476,61 @@ static ftdm_status_t ftdm_gsm_state_advance(ftdm_channel_t *ftdmchan) return FTDM_SUCCESS; } + + +static ftdm_status_t init_wat_lib(void) +{ + + if(wat_lib_initialized) + { + return FTDM_SUCCESS; + } + + wat_interface_t wat_interface; + + ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); + fprintf(stdout, "Registering interface to WAT Library...\n"); + + wat_interface.wat_sigstatus_change = on_wat_sigstatus_change; + wat_interface.wat_span_write = on_wat_span_write; + + wat_interface.wat_log = on_wat_log; + wat_interface.wat_log_span = on_wat_log_span; + wat_interface.wat_malloc = on_wat_malloc; + wat_interface.wat_calloc = on_wat_calloc; + wat_interface.wat_free = on_wat_free; + + wat_interface.wat_alarm = on_wat_span_alarm; + wat_interface.wat_con_ind = on_wat_con_ind; + wat_interface.wat_con_sts = on_wat_con_sts; + wat_interface.wat_rel_ind = on_wat_rel_ind; + wat_interface.wat_rel_cfm = on_wat_rel_cfm; + wat_interface.wat_sms_ind = on_wat_sms_ind; + wat_interface.wat_sms_sts = on_wat_sms_sts; + + if (wat_register(&wat_interface)) { + ftdm_log(FTDM_LOG_DEBUG, "FAILED Registering interface to WAT Library...\n"); + return FTDM_FAIL; + + } + ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); + + fprintf(stdout, "Registered interface to WAT Library\n"); + wat_lib_initialized = 1; + return FTDM_SUCCESS; +} + + static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) { unsigned paramindex = 0; const char *var = NULL; const char *val = NULL; + if(FTDM_SUCCESS != init_wat_lib()) + { + return FTDM_FAIL; + } if (n_spans_info >= MAX_SPANS) { snprintf(span->last_error, sizeof(span->last_error), "MAX_SPANS Exceeded !!!\n"); @@ -571,7 +624,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) #endif - +#if 0 ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); gsm_data->wat_interface.wat_sigstatus_change = on_wat_sigstatus_change; @@ -599,15 +652,13 @@ ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); } ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); +#endif ftdm_log(FTDM_LOG_DEBUG, "Configuring span\n"); - //sng_fd_t dev; - //sangoma_wait_obj_t *waitable; - //unsigned char wat_span_id; - + wat_span_config_t _wat_span_config; @@ -620,25 +671,29 @@ ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); return FTDM_FAIL; } - fprintf(stdout, "Starting span\n"); +/* + fprintf(stdout, "Starting span %d\n", span->span_id); if (wat_span_start(span->span_id)) { - fprintf(stderr, "Failed to start span!!\n"); + fprintf(stderr, "Failed to start span %d!!\n", span->span_id); return FTDM_FAIL; } + fprintf(stdout, "SUCCESS Starting span %d\n", span->span_id); - + */ - return FTDM_SUCCESS; } static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) { + + + ftdm_channel_t *ftdmchan = NULL; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_iterator_t *chaniter = NULL; @@ -646,7 +701,21 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) int waitms = 10, i; ftdm_status_t status; + + +fprintf(stdout, "Starting span %d\n", span->span_id); + + if (wat_span_start(span->span_id)) { + + fprintf(stderr, "Failed to start span %d!!\n", span->span_id); + return NULL; + } + + + fprintf(stdout, "SUCCESS Starting span %d\n", span->span_id); + + short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); unsigned next; @@ -665,6 +734,8 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) return NULL; } + + while (ftdm_running()) { @@ -682,7 +753,7 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) /* deliver the actual channel events to the user now without any channel locking */ ftdm_span_trigger_signals(span); #if 0 - /* figure out what event to poll each channel for. POLLPRI when the channel is down, + /* figure ouwat_chip_info_tt what event to poll each channel for. POLLPRI when the channel is down, * POLLPRI|POLLIN|POLLOUT otherwise */ memset(poll_events, 0, sizeof(short)*span->chan_count); citer = ftdm_span_get_chan_iterator(span, chaniter); @@ -714,6 +785,7 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) ftdm_channel_lock(ftdmchan); + ftdm_channel_advance_states(ftdmchan); ftdm_channel_unlock(ftdmchan); @@ -730,12 +802,16 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) { ftdm_channel_lock(ftdmchan); ftdm_channel_t * ftdm_chan = get_channel(span->span_id, 2); - char buffer[11]; - int n = read_channel(ftdm_chan , buffer, sizeof(buffer)); + char buffer[2001]; + memset(buffer, 0, sizeof(buffer)); + unsigned int n = 0; + n = read_channel(ftdm_chan , buffer, sizeof(buffer)); + ftdm_channel_unlock(ftdmchan); if(n > 0) { wat_span_process_read(span->span_id, buffer, n); + /*ftdm_log(FTDM_LOG_DEBUG, "<<<<<<<<<<<<<<<<<<<<<<===== %s (%d) - %d\n", buffer, n, (int) span->span_id);*/ /* ftdm_log(FTDM_LOG_DEBUG, "!!! read_channel got %d bytes\n", n); */ @@ -781,9 +857,58 @@ static FIO_API_FUNCTION(ftdm_gsm_api) if (!strcasecmp(argv[0], "status")) { - /*wat_chip_info_t* chip_info = wat_span_get_chip_info(span->span_id); */ - + int n; + for(n = 0; n < n_spans_info; n++) + { + ftdm_span_t *span = spans_info[n].span; + wat_chip_info_t* chip_info = (wat_chip_info_t*)wat_span_get_chip_info(span->span_id); + wat_sim_info_t* sim_info = (wat_sim_info_t*)wat_span_get_sim_info(span->span_id); + wat_net_info_t* net_info = (wat_net_info_t*)wat_span_get_net_info(span->span_id); + /*wat_sig_info_t* sig_info = (wat_sig_info_t*)wat_span_get_sig_info(span->span_id);*/ + /*wat_pin_stat_t* pin_stat = (wat_pin_stat_t*)wat_span_get_pin_info(span->span_id);*/ + + stream->write_function(stream, "Span %d:\n", span->span_id); + + stream->write_function(stream, "CHIP - %s (%s), revision %s, serial %s \n", + chip_info->manufacturer_name, + chip_info->manufacturer_id, + chip_info->revision, + chip_info->serial + ); + + + stream->write_function(stream, "SIM - Subscriber Type %s, imsi %s\n", + sim_info->subscriber_type, + sim_info->imsi + ); + + const char *stypes[] = {WAT_NUMBER_TYPE_STRINGS }; + const char *ptypes[] = {WAT_NUMBER_PLAN_STRINGS }; + const char *validities[] = {WAT_NUMBER_VALIDITY_STRINGS }; + + stream->write_function(stream, "Subscriber - Number %s, Plan %s, validity %s\n", + sim_info->subscriber.digits, + stypes[sim_info->subscriber.type], + ptypes[sim_info->subscriber.plan], + validities[sim_info->subscriber.validity] + + ); + + const char *net_stats[] = {WAT_NET_STAT_STRINGS}; + + + stream->write_function(stream, "Network - status %s, Area Code %d, Cell ID %d, Operator %s\n", + net_stats[net_info->stat], + net_info->lac, + net_info->ci, + net_info->operator_name + ); + + + stream->write_function(stream, "\n"); + + } stream->write_function(stream, "+OK.\n"); goto done; @@ -798,6 +923,7 @@ done: return FTDM_SUCCESS; + } static FIO_IO_LOAD_FUNCTION(ftdm_gsm_io_init) @@ -810,7 +936,7 @@ static FIO_IO_LOAD_FUNCTION(ftdm_gsm_io_init) *fio = &g_ftdm_gsm_interface; - return FTDM_SUCCESS; + return (FTDM_SUCCESS); } static FIO_SIG_LOAD_FUNCTION(ftdm_gsm_init) { From 06eee95da8794741857dfddec8dd83d0211bda27 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sat, 24 Dec 2011 23:58:03 -0500 Subject: [PATCH 0187/1057] freetdm: update ftmod_gsm.c to match latest libwat changes --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 49 ++++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index d94e2594cc..1a6c18f513 100644 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -25,7 +25,7 @@ * 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 OFn_spans_info + * 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. @@ -139,8 +139,6 @@ static int read_channel(ftdm_channel_t *ftdm_chan , const void *buf, int size) } /* wat callbacks */ -void on_wat_sigstatus_change(unsigned char span_id, wat_sigstatus_t sigstatus); -void on_wat_span_alarm(unsigned char span_id, wat_alarm_t alarm); int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len); void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event); @@ -186,17 +184,39 @@ int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) } -void on_wat_sigstatus_change(unsigned char span_id, wat_sigstatus_t sigstatus) +static void on_wat_span_status(unsigned char span_id, wat_span_status_t *status) { - fprintf(stdout, "span:%d Signalling status changed %d\n", span_id, sigstatus); - - return; -} - -void on_wat_span_alarm(unsigned char span_id, wat_alarm_t alrm) -{ - fprintf(stdout, "span:%d Alarm received\n", span_id); - return; + switch (status->type) { + case WAT_SPAN_STS_READY: + { + ftdm_log(FTDM_LOG_INFO, "span %d: Ready\n", span_id); + } + break; + case WAT_SPAN_STS_SIGSTATUS: + { + if (status->sts.sigstatus == WAT_SIGSTATUS_UP) { + ftdm_log(FTDM_LOG_INFO, "span %d: Signaling is now up\n", span_id); + } else { + ftdm_log(FTDM_LOG_INFO, "span %d: Signaling is now down\n", span_id); + } + } + break; + case WAT_SPAN_STS_SIM_INFO_READY: + { + ftdm_log(FTDM_LOG_INFO, "span %d: SIM information ready\n", span_id); + } + break; + case WAT_SPAN_STS_ALARM: + { + ftdm_log(FTDM_LOG_INFO, "span %d: Alarm received\n", span_id); + } + break; + default: + { + ftdm_log(FTDM_LOG_INFO, "span %d: Unhandled span status notification %d\n", span_id, status->type); + } + break; + } } void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event) @@ -491,7 +511,6 @@ static ftdm_status_t init_wat_lib(void) ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); fprintf(stdout, "Registering interface to WAT Library...\n"); - wat_interface.wat_sigstatus_change = on_wat_sigstatus_change; wat_interface.wat_span_write = on_wat_span_write; wat_interface.wat_log = on_wat_log; @@ -500,13 +519,13 @@ static ftdm_status_t init_wat_lib(void) wat_interface.wat_calloc = on_wat_calloc; wat_interface.wat_free = on_wat_free; - wat_interface.wat_alarm = on_wat_span_alarm; wat_interface.wat_con_ind = on_wat_con_ind; wat_interface.wat_con_sts = on_wat_con_sts; wat_interface.wat_rel_ind = on_wat_rel_ind; wat_interface.wat_rel_cfm = on_wat_rel_cfm; wat_interface.wat_sms_ind = on_wat_sms_ind; wat_interface.wat_sms_sts = on_wat_sms_sts; + wat_interface.wat_span_sts = on_wat_span_status; if (wat_register(&wat_interface)) { ftdm_log(FTDM_LOG_DEBUG, "FAILED Registering interface to WAT Library...\n"); From de9803414537a12ce687607f02fe1f66f57a6b94 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 25 Dec 2011 20:49:10 -0500 Subject: [PATCH 0188/1057] freetdm: - Extend ftdm interrupt object to notify which IO events are ready in the device - Add definition of FTDM_MAX_SIG_PARAMETERS to have a standard limit for signaling module parameters --- libs/freetdm/mod_freetdm/mod_freetdm.c | 14 ++--- libs/freetdm/src/ftdm_io.c | 2 +- libs/freetdm/src/ftdm_queue.c | 2 +- libs/freetdm/src/ftdm_state.c | 2 +- libs/freetdm/src/ftdm_threadmutex.c | 57 +++++++++++++++++---- libs/freetdm/src/include/freetdm.h | 11 ++-- libs/freetdm/src/include/ftdm_declare.h | 8 +++ libs/freetdm/src/include/ftdm_threadmutex.h | 3 +- 8 files changed, 70 insertions(+), 29 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 3f461e8ab1..ff2c94f72d 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2828,7 +2828,7 @@ static void parse_gsm_spans(switch_xml_t cfg, switch_xml_t spans) ftdm_status_t zstatus = FTDM_FAIL; const char *context = "default"; const char *dialplan = "XML"; - ftdm_conf_parameter_t spanparameters[30]; + ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; char *id = (char *) switch_xml_attr(myspan, "id"); char *name = (char *) switch_xml_attr(myspan, "name"); char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); @@ -2917,7 +2917,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) ftdm_status_t zstatus = FTDM_FAIL; const char *context = "default"; const char *dialplan = "XML"; - ftdm_conf_parameter_t spanparameters[30]; + ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; char *id = (char *) switch_xml_attr(myspan, "id"); char *name = (char *) switch_xml_attr(myspan, "name"); char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); @@ -3096,7 +3096,7 @@ static switch_status_t load_config(void) ftdm_status_t zstatus = FTDM_FAIL; const char *context = "default"; const char *dialplan = "XML"; - ftdm_conf_parameter_t spanparameters[30]; + ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; char *id = (char *) switch_xml_attr(myspan, "id"); char *name = (char *) switch_xml_attr(myspan, "name"); char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); @@ -3498,7 +3498,7 @@ static switch_status_t load_config(void) if ((spans = switch_xml_child(cfg, "pri_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { char *name = (char *) switch_xml_attr(myspan, "name"); - ftdm_conf_parameter_t spanparameters[10]; + ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; ftdm_status_t zstatus = FTDM_FAIL; const char *context = "default"; const char *dialplan = "XML"; @@ -3566,7 +3566,7 @@ static switch_status_t load_config(void) ftdm_status_t zstatus = FTDM_FAIL; unsigned paramindex = 0; - ftdm_conf_parameter_t spanparameters[10]; + ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; const char *context = "default"; const char *dialplan = "XML"; ftdm_span_t *span = NULL; @@ -3624,7 +3624,7 @@ static switch_status_t load_config(void) if ((spans = switch_xml_child(cfg, "libpri_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { char *name = (char *) switch_xml_attr(myspan, "name"); - ftdm_conf_parameter_t spanparameters[10]; + ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; ftdm_status_t zstatus = FTDM_FAIL; const char *context = "default"; const char *dialplan = "XML"; @@ -3699,7 +3699,7 @@ static switch_status_t load_config(void) uint32_t span_id = 0; ftdm_span_t *span = NULL; - ftdm_conf_parameter_t spanparameters[30]; + ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS]; unsigned paramindex = 0; if (!name) { diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index f08eeaacf7..e00e0f3141 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -5633,7 +5633,7 @@ static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj) static ftdm_status_t ftdm_cpu_monitor_start(void) { - if (ftdm_interrupt_create(&globals.cpu_monitor.interrupt, FTDM_INVALID_SOCKET) != FTDM_SUCCESS) { + if (ftdm_interrupt_create(&globals.cpu_monitor.interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed to create CPU monitor interrupt\n"); return FTDM_FAIL; } diff --git a/libs/freetdm/src/ftdm_queue.c b/libs/freetdm/src/ftdm_queue.c index 75d18033da..625f22ec36 100644 --- a/libs/freetdm/src/ftdm_queue.c +++ b/libs/freetdm/src/ftdm_queue.c @@ -98,7 +98,7 @@ static ftdm_status_t ftdm_std_queue_create(ftdm_queue_t **outqueue, ftdm_size_t goto failed; } - if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET) != FTDM_SUCCESS) { + if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) { goto failed; } diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index d3f99f6074..e2ccf83747 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -254,7 +254,7 @@ static ftdm_status_t ftdm_core_set_state(const char *file, const char *func, int } if (!ftdmchan->state_completed_interrupt) { - status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET); + status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS); if (status != FTDM_SUCCESS) { ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_CRIT, "Failed to create state change interrupt when moving from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); diff --git a/libs/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c index 56653811fa..a659adf11d 100644 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ b/libs/freetdm/src/ftdm_threadmutex.c @@ -73,6 +73,8 @@ struct ftdm_mutex { struct ftdm_interrupt { ftdm_socket_t device; + ftdm_wait_flag_t device_input_flags; + ftdm_wait_flag_t device_output_flags; #ifdef WIN32 /* for generic interruption */ HANDLE event; @@ -323,7 +325,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const c } -FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device) +FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device, ftdm_wait_flag_t device_flags) { ftdm_status_t status = FTDM_SUCCESS; ftdm_interrupt_t *interrupt = NULL; @@ -340,6 +342,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, } interrupt->device = device; + interrupt->device_input_flags = device_flags; #ifdef WIN32 interrupt->event = CreateEvent(NULL, FALSE, FALSE, NULL); if (!interrupt->event) { @@ -389,15 +392,16 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int m char pipebuf[255]; #endif - ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Condition is null!\n"); - + ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Interrupt is null!\n"); + interrupt->device_output_flags = FTDM_NO_FLAGS; /* start implementation */ #ifdef WIN32 ints[0] = interrupt->event; if (interrupt->device != FTDM_INVALID_SOCKET) { num++; ints[1] = interrupt->device; + ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_output_flags member!)\n", size); } res = WaitForMultipleObjects(num, ints, FALSE, ms >= 0 ? ms : INFINITE); switch (res) { @@ -422,7 +426,7 @@ pollagain: if (interrupt->device != FTDM_INVALID_SOCKET) { num++; ints[1].fd = interrupt->device; - ints[1].events = POLLIN; + ints[1].events = interrupt->device_input_flags; ints[1].revents = 0; } @@ -446,7 +450,17 @@ pollagain: ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno)); } } - + if (interrupt->device != FTDM_INVALID_SOCKET) { + if (ints[1].revents & POLLIN) { + interrupt->device_output_flags |= FTDM_READ; + } + if (ints[1].revents & POLLOUT) { + interrupt->device_output_flags |= FTDM_WRITE; + } + if (ints[1].revents & POLLPRI) { + interrupt->device_output_flags |= FTDM_EVENTS; + } + } return FTDM_SUCCESS; #endif } @@ -515,10 +529,12 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru for (i = 0; i < size; i++) { ints[i] = interrupts[i]->event; + interrupts[i]->device_output_flags = FTDM_NO_FLAGS; if (interrupts[i]->device != FTDM_INVALID_SOCKET) { - + /* WARNING: if the device is ready for data we must implement for Windows the device_output_flags member */ ints[size+numdevices] = interrupts[i]->device; numdevices++; + ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_data_ready member!)\n", size); } } @@ -548,17 +564,16 @@ pollagain: ints[i].events = POLLIN; ints[i].revents = 0; ints[i].fd = interrupts[i]->readfd; + interrupts[i]->device_output_flags = FTDM_NO_FLAGS; if (interrupts[i]->device != FTDM_INVALID_SOCKET) { - ints[size+numdevices].events = POLLIN; + ints[size+numdevices].events = interrupts[i]->device_input_flags; ints[size+numdevices].revents = 0; ints[size+numdevices].fd = interrupts[i]->device; - numdevices++; } } res = poll(ints, size + numdevices, ms); - if (res == -1) { if (errno == EINTR) { goto pollagain; @@ -571,7 +586,8 @@ pollagain: return FTDM_TIMEOUT; } - /* check for events in the pipes, NOT in the devices */ + /* check for events in the pipes and in the devices, but service only the pipes */ + numdevices = 0; for (i = 0; i < size; i++) { if (ints[i].revents & POLLIN) { res = read(ints[i].fd, pipebuf, sizeof(pipebuf)); @@ -579,6 +595,18 @@ pollagain: ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno)); } } + if (interrupts[i]->device != FTDM_INVALID_SOCKET) { + if (ints[size+numdevices].revents & POLLIN) { + interrupts[i]->device_output_flags |= FTDM_READ; + } + if (ints[size+numdevices].revents & POLLOUT) { + interrupts[i]->device_output_flags |= FTDM_WRITE; + } + if (ints[size+numdevices].revents & POLLPRI) { + interrupts[i]->device_output_flags |= FTDM_EVENTS; + } + numdevices++; + } } #else /* for MacOS compilation, unused vars */ @@ -587,6 +615,15 @@ pollagain: return FTDM_SUCCESS; } +FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt) +{ +#if defined(__WINDOWS__) + /* device output flags are not currently filled for Windows upon returning from a wait function */ + ftdm_log(FTDM_LOG_CRIT, "IMPLEMENT ME!\n"); +#endif + return interrupt->device_output_flags; +} + /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 81f31e4ff8..32d883c9b4 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -62,6 +62,9 @@ /*! \brief Max number of groups */ #define FTDM_MAX_GROUPS_INTERFACE FTDM_MAX_SPANS_INTERFACE +/*! \brief Max number of key=value pairs to be sent as signaling stack parameters */ +#define FTDM_MAX_SIG_PARAMETERS 30 + #define FTDM_INVALID_INT_PARM 0xFF /*! \brief Thread/Mutex OS abstraction API. */ @@ -621,14 +624,6 @@ typedef enum { FTDM_CRASH_ON_ASSERT } ftdm_crash_policy_t; -/*! \brief I/O waiting flags */ -typedef enum { - FTDM_NO_FLAGS = 0, - FTDM_READ = (1 << 0), - FTDM_WRITE = (1 << 1), - FTDM_EVENTS = (1 << 2) -} ftdm_wait_flag_t; - /*! \brief Signaling configuration parameter for the stacks (variable=value pair) */ typedef struct ftdm_conf_parameter { const char *var; diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index 9c7f9cbe4a..cf4dcdd555 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -203,6 +203,14 @@ typedef enum { FTDM_TRUE } ftdm_bool_t; +/*! \brief I/O waiting flags */ +typedef enum { + FTDM_NO_FLAGS = 0, + FTDM_READ = (1 << 0), + FTDM_WRITE = (1 << 1), + FTDM_EVENTS = (1 << 2) +} ftdm_wait_flag_t; + /*! * \brief FreeTDM channel. * This is the basic data structure used to place calls and I/O operations diff --git a/libs/freetdm/src/include/ftdm_threadmutex.h b/libs/freetdm/src/include/ftdm_threadmutex.h index 2e802fe913..b77f19f4bb 100644 --- a/libs/freetdm/src/include/ftdm_threadmutex.h +++ b/libs/freetdm/src/include/ftdm_threadmutex.h @@ -52,11 +52,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(const char *file, int line, const #define ftdm_mutex_unlock(_x) _ftdm_mutex_unlock(__FILE__, __LINE__, __FUNCTION__, _x) FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const char *func, ftdm_mutex_t *mutex); -FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device); +FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device, ftdm_wait_flag_t device_flags); FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **cond); FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *cond); FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *cond, int ms); FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms); +FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt); #ifdef __cplusplus } From cc79163da3a4e7080a9dbd73a99384ee61932d41 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 25 Dec 2011 20:55:02 -0500 Subject: [PATCH 0189/1057] freetdm: refactor ftmod_gsm.c code to use proper core functions and interrupts to wait for io and state changes --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 571 +++++++------------ 1 file changed, 204 insertions(+), 367 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index 1a6c18f513..dd46e0354c 100644 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -55,78 +55,14 @@ #include #include -#define MAX_SPANS 32 typedef struct ftdm_gsm_span_data_s { ftdm_span_t *span; - fio_signal_cb_t sig_cb; - ftdm_conf_parameter_t *ftdm_parameters; -}ftdm_gsm_span_data_t; + ftdm_channel_t *dchan; +} ftdm_gsm_span_data_t; - -static ftdm_gsm_span_data_t spans_info[MAX_SPANS]; -static int n_spans_info = 0; - -typedef struct ftdm_gsm_data_s { - - wat_interface_t wat_interface; - - - -} ftdm_gsm_data_t; - - -static ftdm_status_t init_wat_lib(void); +static ftdm_status_t init_wat_lib(void); static int wat_lib_initialized = 0; -ftdm_span_t *get_span(int span_id); - -ftdm_span_t *get_span(int span_id) -{ - int i; - for(i=0; i< n_spans_info;i++) - { - if(spans_info[i].span->span_id == span_id) { - - return spans_info[i].span; - } - - } - - return NULL; -} - -ftdm_channel_t *get_channel(int span_id, int channel_id); -ftdm_channel_t *get_channel(int span_id, int channel_id) -{ - ftdm_channel_t *ftdmchan = NULL; - ftdm_span_t * span = get_span(span_id); - - if(!span){ - return NULL; - } - - - - - ftdm_iterator_t *citer = ftdm_span_get_chan_iterator(span, NULL); - - for ( ; citer; citer = ftdm_iterator_next(citer)) { - ftdmchan = ftdm_iterator_current(citer); - if(ftdmchan->chan_id == channel_id) { - ftdm_iterator_free(citer); - return ftdmchan; - } - - - - - } - - ftdm_iterator_free(citer); - return NULL; -} - - static int read_channel(ftdm_channel_t *ftdm_chan , const void *buf, int size) { @@ -139,7 +75,7 @@ static int read_channel(ftdm_channel_t *ftdm_chan , const void *buf, int size) } /* wat callbacks */ -int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len); +int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len); void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event); void on_wat_con_sts(unsigned char span_id, uint8_t call_id, wat_con_status_t *status); @@ -155,28 +91,24 @@ void *on_wat_calloc(size_t nmemb, size_t size); void on_wat_free(void *ptr); void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...); - -/* gsm_data->wat_interface.wat_log = on_log; */ - -/* gsm_data->wat_interface.wat -_log_span = on_log_span; */ - -/* gsm_data->wat_interface.wat_malloc = on_wat_malloc;*/ -/* gsm_data->wat_interface.wat_calloc = on_wat_calloc;*/ -/* gsm_data->wat_interface.wat_free = on_wat_frspanee;*/ - - int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) { - /* ftdm_log(FTDM_LOG_DEBUG, "====================>>> %s (%d) - %d\n", buffer, len, (int) span_id);*/ - - ftdm_channel_t * ftdm_chan = get_channel(span_id, 2); + ftdm_span_t *span = NULL; + ftdm_status_t status = FTDM_FAIL; + ftdm_gsm_span_data_t *gsm_data = NULL; ftdm_size_t outsize = len; - ftdm_channel_lock(ftdm_chan); - ftdm_status_t status = ftdm_channel_write(ftdm_chan, (void *)buffer, len, &outsize); - ftdm_channel_unlock(ftdm_chan); - if (FTDM_FAIL == status) { + + status = ftdm_span_find(span_id, &span); + if (status != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Failed to find span %d to write %d bytes\n", span_id, len); + return -1; + } + + gsm_data = span->signal_data; + status = ftdm_channel_write(gsm_data->dchan, (void *)buffer, len, &outsize); + if (status != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Failed to write %d bytes to d-channel in span %s\n", len, span->name); return -1; } return (int)outsize; @@ -346,6 +278,11 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(gsm_outgoing_call) static ftdm_status_t ftdm_gsm_start(ftdm_span_t *span) { + if (wat_span_start(span->span_id)) { + ftdm_log(FTDM_LOG_ERROR, "Failed to start span %s!\n", span->name); + return FTDM_FAIL; + } + return ftdm_thread_create_detached(ftdm_gsm_run, span); } @@ -500,17 +437,15 @@ static ftdm_status_t ftdm_gsm_state_advance(ftdm_channel_t *ftdmchan) static ftdm_status_t init_wat_lib(void) { - - if(wat_lib_initialized) - { + if (wat_lib_initialized) { return FTDM_SUCCESS; } wat_interface_t wat_interface; ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); - fprintf(stdout, "Registering interface to WAT Library...\n"); + memset(&wat_interface, 0, sizeof(wat_interface)); wat_interface.wat_span_write = on_wat_span_write; wat_interface.wat_log = on_wat_log; @@ -528,13 +463,12 @@ static ftdm_status_t init_wat_lib(void) wat_interface.wat_span_sts = on_wat_span_status; if (wat_register(&wat_interface)) { - ftdm_log(FTDM_LOG_DEBUG, "FAILED Registering interface to WAT Library...\n"); + ftdm_log(FTDM_LOG_DEBUG, "Failed registering interface to WAT library ...\n"); return FTDM_FAIL; } - ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); + ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT library\n"); - fprintf(stdout, "Registered interface to WAT Library\n"); wat_lib_initialized = 1; return FTDM_SUCCESS; } @@ -542,70 +476,81 @@ static ftdm_status_t init_wat_lib(void) static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) { + wat_span_config_t span_config; + ftdm_gsm_span_data_t *gsm_data = NULL; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *citer = NULL; + ftdm_channel_t *ftdmchan = NULL; + ftdm_channel_t *dchan = NULL; unsigned paramindex = 0; const char *var = NULL; const char *val = NULL; - if(FTDM_SUCCESS != init_wat_lib()) - { + /* libwat is smart enough to set good default values for the timers if they are set to 0 */ + memset(&span_config, 0, sizeof(span_config)); + + /* set some span defaults */ + span_config.moduletype = WAT_MODULE_TELIT; + + if (FTDM_SUCCESS != init_wat_lib()) { return FTDM_FAIL; } - if (n_spans_info >= MAX_SPANS) { - snprintf(span->last_error, sizeof(span->last_error), "MAX_SPANS Exceeded !!!\n"); - ftdm_log(FTDM_LOG_DEBUG, span->last_error); - return FTDM_FAIL; - - } - - memset(&spans_info[n_spans_info], 0 ,sizeof(spans_info[n_spans_info])); - - spans_info[n_spans_info].span = span; - spans_info[n_spans_info].sig_cb = sig_cb; - spans_info[n_spans_info].ftdm_parameters = ftdm_parameters; - n_spans_info ++; - - - - ftdm_gsm_data_t *gsm_data = malloc(sizeof(*gsm_data)); - if (!gsm_data) { - - snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate GSM data."); + if (!sig_cb) { + ftdm_log(FTDM_LOG_ERROR, "No signaling callback provided\n"); return FTDM_FAIL; } - memset(gsm_data,0, sizeof(*gsm_data)); - - - /* */ - - - - ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling cb provided\n"); if (span->signal_type) { - snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling."); + ftdm_log(FTDM_LOG_ERROR, "Span %s is already configured for another signaling\n", span->name); return FTDM_FAIL; } - - + /* verify the span has one d-channel */ + chaniter = ftdm_span_get_chan_iterator(span, NULL); + if (!chaniter) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + return FTDM_FAIL; + } - for (; ftdm_parameters[paramindex].var; paramindex++) { + citer = ftdm_span_get_chan_iterator(span, chaniter); + for ( ; citer; citer = ftdm_iterator_next(citer)) { + ftdmchan = ftdm_iterator_current(citer); + if (FTDM_IS_DCHAN(ftdmchan)) { + dchan = ftdmchan; + break; + } + } + ftdm_iterator_free(chaniter); + + if (!dchan) { + ftdm_log(FTDM_LOG_CRIT, "Could not find a d-channel for GSM span %s!\n", span->name); + return FTDM_FAIL; + } + + gsm_data = ftdm_calloc(1, sizeof(*gsm_data)); + if (!gsm_data) { + return FTDM_FAIL; + } + gsm_data->dchan = dchan; + + for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { var = ftdm_parameters[paramindex].var; val = ftdm_parameters[paramindex].val; - ftdm_log(FTDM_LOG_DEBUG, "Reading GSM parameter %s for span %d\n", var, span->span_id); + if (!ftdm_strlen_zero_buf(val)) { + ftdm_log(FTDM_LOG_WARNING, "Ignoring empty GSM parameter %s for span %s\n", var, val, span->name); + continue; + } + ftdm_log(FTDM_LOG_DEBUG, "Reading GSM parameter %s=%s for span %s\n", var, val, span->name); if (!strcasecmp(var, "moduletype")) { - if (!val) { - break; - } - if (ftdm_strlen_zero_buf(val)) { - ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty moduletype parameter\n"); + span_config.moduletype = wat_str2wat_moduletype(val); + if (span_config.moduletype == WAT_MODULE_INVALID) { + ftdm_log(FTDM_LOG_DEBUG, "Unknown GSM module type %s for span %s\n", val, span->name); continue; } - ftdm_log(FTDM_LOG_DEBUG, "Configuring GSM span %d for moduletype %s\n", span->span_id, val); + ftdm_log(FTDM_LOG_DEBUG, "Configuring GSM span %s with moduletype %s\n", span->name, val); } else { - snprintf(span->last_error, sizeof(span->last_error), "Unknown GSM parameter [%s]", var); - return FTDM_FAIL; + ftdm_log(FTDM_LOG_ERROR, "Ignoring unknown GSM parameter '%s'", var); } } @@ -629,11 +574,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) /* use signals queue */ ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); /* we can skip states (going straight from RING to UP) */ ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); - + gsm_data->span = span; #if 0 /* setup the scheduler (create if needed) */ @@ -642,208 +588,105 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) spanpvt->sched = r2data->sched; #endif - -#if 0 -ftdm_log(FTDM_LOG_DEBUG, "Registering interface to WAT Library...\n"); - - gsm_data->wat_interface.wat_sigstatus_change = on_wat_sigstatus_change; - gsm_data->wat_interface.wat_span_write = on_wat_span_write; - gsm_data->wat_interface.wat_log = on_wat_log; - gsm_data->wat_interface.wat_log_span = on_wat_log_span; - gsm_data->wat_interface.wat_malloc = on_wat_malloc; - gsm_data->wat_interface.wat_calloc = on_wat_calloc; - gsm_data->wat_interface.wat_free = on_wat_free; - - gsm_data->wat_interface.wat_alarm = on_wat_span_alarm; - gsm_data->wat_interface.wat_con_ind = on_wat_con_ind; - gsm_data->wat_interface.wat_con_sts = on_wat_con_sts; - gsm_data->wat_interface.wat_rel_ind = on_wat_rel_ind; - gsm_data->wat_interface.wat_rel_cfm = on_wat_rel_cfm; - gsm_data->wat_interface.wat_sms_ind = on_wat_sms_ind; - gsm_data->wat_interface.wat_sms_sts = on_wat_sms_sts; - - if (wat_register(&gsm_data->wat_interface)) { - snprintf(span->last_error, sizeof(span->last_error), "Failed to register WAT Library !!!\n"); - ftdm_log(FTDM_LOG_DEBUG, "FAILED Registering interface to WAT Library...\n"); - return FTDM_FAIL; - - } - ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT Library\n"); - -#endif - - - - ftdm_log(FTDM_LOG_DEBUG, "Configuring span\n"); - - - - wat_span_config_t _wat_span_config; - - - _wat_span_config.moduletype = WAT_MODULE_TELIT; - _wat_span_config.timeout_cid_num = 10; - - if (wat_span_config(span->span_id, &_wat_span_config)) { - fprintf(stderr, "Failed to configure span!!\n"); + if (wat_span_config(span->span_id, &span_config)) { + ftdm_log(FTDM_LOG_ERROR, "Failed to configure span %s for GSM signaling!!\n", span->name); return FTDM_FAIL; } -/* - fprintf(stdout, "Starting span %d\n", span->span_id); - if (wat_span_start(span->span_id)) { - fprintf(stderr, "Failed to start span %d!!\n", span->span_id); - return FTDM_FAIL; - } - - - fprintf(stdout, "SUCCESS Starting span %d\n", span->span_id); - - */ - - - return FTDM_SUCCESS; } +#define GSM_POLL_INTERVAL_MS 20 static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) { - - - ftdm_channel_t *ftdmchan = NULL; ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *citer = NULL; - int waitms = 10, i; - ftdm_status_t status; + ftdm_gsm_span_data_t *gsm_data = NULL; + ftdm_status_t status = FTDM_SUCCESS; + ftdm_wait_flag_t ioflags = FTDM_NO_FLAGS; + ftdm_interrupt_t *data_sources[2] = {NULL, NULL}; + int waitms = 0; + + gsm_data = span->signal_data; + ftdm_assert_return(gsm_data != NULL, NULL, "No gsm data attached to span\n"); - - -fprintf(stdout, "Starting span %d\n", span->span_id); - - if (wat_span_start(span->span_id)) { - - fprintf(stderr, "Failed to start span %d!!\n", span->span_id); - return NULL; - } - - - fprintf(stdout, "SUCCESS Starting span %d\n", span->span_id); - - - short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); - - unsigned next; ftdm_log(FTDM_LOG_DEBUG, "GSM monitor thread for span %s started\n", span->name); - - chaniter = ftdm_span_get_chan_iterator(span, NULL); - if (!chaniter) { - ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + if (!gsm_data->dchan || ftdm_channel_open_chan(gsm_data->dchan) != FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open GSM d-channel of span %s!\n", span->name); + gsm_data->dchan = NULL; goto done; } - ftdmchan = get_channel(span->span_id, 2); - - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open channel during incoming call! [%s]\n", ftdmchan->last_error); - return NULL; + /* create an interrupt object to wait for data from the d-channel device */ + if (ftdm_interrupt_create(&data_sources[0], gsm_data->dchan->sockfd, FTDM_READ) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "Failed to create GSM d-channel interrupt for span %s\n", span->name); + goto done; + } + status = ftdm_queue_get_interrupt(span->pendingchans, &data_sources[1]); + if (status != FTDM_SUCCESS || data_sources[1] == NULL) { + ftdm_log(FTDM_LOG_CRIT, "Failed to retrieve channel queue interrupt for span %s\n", span->name); + goto done; } - - while (ftdm_running()) { + wat_span_run(span->span_id); - wat_span_run(span->span_id); - next = wat_span_schedule_next(span->span_id); - if(next < waitms) { - next = waitms; - } + waitms = wat_span_schedule_next(span->span_id); + if (waitms > GSM_POLL_INTERVAL_MS) { + waitms = GSM_POLL_INTERVAL_MS; + } #if 0 /* run any span timers */ ftdm_sched_run(r2data->sched); #endif - /* deliver the actual channel events to the user now without any channel locking */ - ftdm_span_trigger_signals(span); -#if 0 - /* figure ouwat_chip_info_tt what event to poll each channel for. POLLPRI when the channel is down, - * POLLPRI|POLLIN|POLLOUT otherwise */ - memset(poll_events, 0, sizeof(short)*span->chan_count); - citer = ftdm_span_get_chan_iterator(span, chaniter); - if (!citer) { - ftdm_log(Fshort *poll_events = ftdm_malloc(sizeof(short) * span->chan_count);TDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); - goto done;short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); - } - for (i = 0; citer; citer = ftdm_iterator_next(citer), i++) { - ftdmchan = ftdm_iterator_current(citer); - r2chan = R2CALL(ftdmchan)->r2chan; - poll_events[i] = FTDM_EVENTS; - if (openr2_chan_get_read_enabled(r2chan)) { - poll_events[i] |= FTDM_READ; + status = ftdm_interrupt_multiple_wait(data_sources, ftdm_array_len(data_sources), waitms); + switch (status) { + case FTDM_ETIMEDOUT: + break; + case FTDM_SUCCESS: + { + /* process first the d-channel if ready */ + if ((ioflags = ftdm_interrupt_device_ready(data_sources[0])) != FTDM_NO_FLAGS) { + char buffer[1024]; + unsigned int n = 0; + n = read_channel(gsm_data->dchan, buffer, sizeof(buffer)); + /* this may trigger any of the callbacks registered through wat_register() */ + wat_span_process_read(span->span_id, buffer, n); + } + + /* now process all channels with state changes pending */ + while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) { + /* double check that this channel has a state change pending */ + ftdm_channel_lock(ftdmchan); + ftdm_channel_advance_states(ftdmchan); + ftdm_channel_unlock(ftdmchan); + } + + /* deliver the actual channel events to the user now without any channel locking */ + ftdm_span_trigger_signals(span); } - } - status = ftdm_span_poll_event(span, waitms, poll_events); - - /* run any span timers */ - ftdm_sched_runshort *poll_events = ftdm_malloc(sizeof(short) * span->chan_count);(r2data->sched); -#endif - ftdm_sleep(waitms); - - - /* this main loop takes care of MF and CAS signaling during call setup and tear down - * for every single channel in the span, do not perform blocking operations here! */ - citer = ftdm_span_get_chan_iterator(span, chaniter); - for ( ; citer; citer = ftdm_iterator_next(citer)) { - ftdmchan = ftdm_iterator_current(citer); - - ftdm_channel_lock(ftdmchan); - - - ftdm_channel_advance_states(ftdmchan); - - ftdm_channel_unlock(ftdmchan); + break; + case FTDM_FAIL: + ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned error!\n", span->name); + break; + default: + ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned with unknown code\n", span->name); + break; } - for(i=0;i< span->chan_count; i++) - poll_events[i] = FTDM_EVENTS; - - poll_events[1] |= FTDM_READ; - status = ftdm_span_poll_event(span, next, poll_events); - - if(FTDM_SUCCESS == status) - { - ftdm_channel_lock(ftdmchan); - ftdm_channel_t * ftdm_chan = get_channel(span->span_id, 2); - char buffer[2001]; - memset(buffer, 0, sizeof(buffer)); - unsigned int n = 0; - n = read_channel(ftdm_chan , buffer, sizeof(buffer)); - - ftdm_channel_unlock(ftdmchan); - if(n > 0) { - - wat_span_process_read(span->span_id, buffer, n); - /*ftdm_log(FTDM_LOG_DEBUG, "<<<<<<<<<<<<<<<<<<<<<<===== %s (%d) - %d\n", buffer, n, (int) span->span_id);*/ - /* - ftdm_log(FTDM_LOG_DEBUG, "!!! read_channel got %d bytes\n", n); - */ - } - else { - ftdm_sleep(waitms); - } - - } } done: - ftdm_iterator_free(chaniter); + if (data_sources[0]) { + ftdm_interrupt_destroy(&data_sources[0]); + } ftdm_log(FTDM_LOG_DEBUG, "GSM thread ending.\n"); @@ -856,86 +699,80 @@ done: "--------------------------------------------------------------------------------\n" static FIO_API_FUNCTION(ftdm_gsm_api) { + ftdm_span_t *span = NULL; + int span_id = 0; char *mycmd = NULL, *argv[10] = { 0 }; int argc = 0; if (data) { mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } - if (argc == 1) { - if (!strcasecmp(argv[0], "version")) { - uint8_t current = 0, revision = 0, age = 0; - wat_version(¤t, &revision, &age); - stream->write_function(stream, "libwat GSM VERSION: %d.%d.%d\n", current, revision, age); - stream->write_function(stream, "+OK.\n"); + if (!strcasecmp(argv[0], "version")) { + uint8_t current = 0, revision = 0, age = 0; + wat_version(¤t, &revision, &age); + stream->write_function(stream, "libwat version: %d.%d.%d\n", current, revision, age); + stream->write_function(stream, "+OK.\n"); + goto done; + + } else if (!strcasecmp(argv[0], "status")) { + const wat_chip_info_t *chip_info = NULL; + const wat_sim_info_t *sim_info = NULL; + const wat_net_info_t *net_info = NULL; + const wat_sig_info_t *sig_info = NULL; + const wat_pin_stat_t *pin_stat = NULL; + + if (argc < 2) { + goto syntax; + } + + span_id = atoi(argv[1]); + if (ftdm_span_find_by_name(argv[1], &span) != FTDM_SUCCESS && + ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { + stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[1]); goto done; } - if (!strcasecmp(argv[0], "status")) { - - int n; - for(n = 0; n < n_spans_info; n++) - { - ftdm_span_t *span = spans_info[n].span; - wat_chip_info_t* chip_info = (wat_chip_info_t*)wat_span_get_chip_info(span->span_id); - wat_sim_info_t* sim_info = (wat_sim_info_t*)wat_span_get_sim_info(span->span_id); - wat_net_info_t* net_info = (wat_net_info_t*)wat_span_get_net_info(span->span_id); - /*wat_sig_info_t* sig_info = (wat_sig_info_t*)wat_span_get_sig_info(span->span_id);*/ - /*wat_pin_stat_t* pin_stat = (wat_pin_stat_t*)wat_span_get_pin_info(span->span_id);*/ - - stream->write_function(stream, "Span %d:\n", span->span_id); - - - stream->write_function(stream, "CHIP - %s (%s), revision %s, serial %s \n", - chip_info->manufacturer_name, - chip_info->manufacturer_id, - chip_info->revision, - chip_info->serial - ); - - - stream->write_function(stream, "SIM - Subscriber Type %s, imsi %s\n", - sim_info->subscriber_type, - sim_info->imsi - ); - - const char *stypes[] = {WAT_NUMBER_TYPE_STRINGS }; - const char *ptypes[] = {WAT_NUMBER_PLAN_STRINGS }; - const char *validities[] = {WAT_NUMBER_VALIDITY_STRINGS }; - - stream->write_function(stream, "Subscriber - Number %s, Plan %s, validity %s\n", - sim_info->subscriber.digits, - stypes[sim_info->subscriber.type], - ptypes[sim_info->subscriber.plan], - validities[sim_info->subscriber.validity] - - ); - - const char *net_stats[] = {WAT_NET_STAT_STRINGS}; - - - stream->write_function(stream, "Network - status %s, Area Code %d, Cell ID %d, Operator %s\n", - net_stats[net_info->stat], - net_info->lac, - net_info->ci, - net_info->operator_name - ); - - - stream->write_function(stream, "\n"); - - } - - stream->write_function(stream, "+OK.\n"); + if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { + stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[1]); goto done; } + + chip_info = wat_span_get_chip_info(span->span_id); + sim_info = wat_span_get_sim_info(span->span_id); + net_info = wat_span_get_net_info(span->span_id); + sig_info = wat_span_get_sig_info(span->span_id); + pin_stat = wat_span_get_pin_info(span->span_id); + + stream->write_function(stream, "Span %d (%s):\n", span->span_id, span->name); + + stream->write_function(stream, "CHIP - %s (%s), revision %s, serial %s \n", + chip_info->manufacturer_name, + chip_info->manufacturer_id, + chip_info->revision, + chip_info->serial); + + stream->write_function(stream, "SIM - Subscriber type %s, imsi %s\n", sim_info->subscriber_type, sim_info->imsi); + + stream->write_function(stream, "Subscriber - Number %s, Plan %s, validity %s\n", + sim_info->subscriber.digits, + wat_number_type2str(sim_info->subscriber.type), + wat_number_plan2str(sim_info->subscriber.plan), + wat_number_validity2str(sim_info->subscriber.validity)); + + stream->write_function(stream, "Network - status %s, Area Code %d, Cell ID %d, Operator %s\n", + wat_net_stat2str(net_info->stat), net_info->lac, net_info->ci, net_info->operator_name); + + + stream->write_function(stream, "\n"); + + stream->write_function(stream, "+OK.\n"); + goto done; } +syntax: stream->write_function(stream, "%s", FT_SYNTAX); - done: ftdm_safe_free(mycmd); From a0c5079cc3e4d8aa01ae113e8e503c54bca12170 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 7 May 2012 14:15:27 -0500 Subject: [PATCH 0190/1057] fix vs2008 pro project dependency for mod_gsmopen - if anyone wants the solution files for express and wants to help please open a Jira with a patch and I will review it. --- Freeswitch.2008.sln | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index f984d00129..781fdcb766 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -954,6 +954,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_abstraction", "src\mod\ EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsmopen", "src\mod\endpoints\mod_gsmopen\mod_gsmopen.2008.vcproj", "{74B120FF-6935-4DFE-A142-CDB6BEA99C90}" + ProjectSection(ProjectDependencies) = postProject + {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsmlib", "src\mod\endpoints\mod_gsmopen\gsmlib\gsmlib-1.10-patched-13ubuntu\win32\gsmlib.vcproj", "{26C82FCE-E0CF-4D10-A00C-D8E582FFEB53}" EndProject From f316f9307fbb91a89105fd583677200328c83738 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 7 May 2012 15:35:13 -0400 Subject: [PATCH 0191/1057] freetdm: First GSM working version - Manually merging latest code from gideon.gsm branch after review/inspection/modifications --- libs/freetdm/mod_freetdm/mod_freetdm.c | 25 +- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 868 ++++++++++++++---- .../src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 42 +- libs/freetdm/src/include/freetdm.h | 8 +- 4 files changed, 751 insertions(+), 192 deletions(-) mode change 100644 => 100755 libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c mode change 100644 => 100755 libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index e40ca5ef93..a31a5342c9 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -26,7 +26,7 @@ * Anthony Minessale II * Moises Silva * David Yat Sin - * + * Gideon Sadan * * mod_freetdm.c -- FreeTDM Endpoint Module * @@ -1887,6 +1887,24 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal) switch (sigmsg->event_id) { + case FTDM_SIGEVENT_SMS: + { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); + ftdm_sms_data_t *sms = (ftdm_sms_data_t*) caller_data->priv; + + + ftdm_log(FTDM_LOG_INFO,"FTDM_SIGEVENT_SMS from %s: %s", sms->from, sms->body); + if (switch_event_create(&event, SWITCH_EVENT_TRAP) != SWITCH_STATUS_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "failed to create SMS event\n"); + return FTDM_FAIL; + } + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", sms->from); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "body", sms->body); + alarmbits = 0; + } + //return FTDM_BREAK; + break; + case FTDM_SIGEVENT_ALARM_CLEAR: case FTDM_SIGEVENT_ALARM_TRAP: { @@ -1936,6 +1954,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal) return FTDM_SUCCESS; } break; + case FTDM_SIGEVENT_RELEASED: case FTDM_SIGEVENT_INDICATION_COMPLETED: case FTDM_SIGEVENT_DIALING: @@ -1964,6 +1983,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal) } if (event) { + + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-name", "%s", ftdm_channel_get_span_name(sigmsg->channel)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-number", "%d", ftdm_channel_get_span_id(sigmsg->channel)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "chan-number", "%d", ftdm_channel_get_id(sigmsg->channel)); @@ -2898,7 +2919,7 @@ static void parse_gsm_spans(switch_xml_t cfg, switch_xml_t spans) "gsm", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { - CONFIG_ERROR("Error configuring Sangoma ISDN FreeTDM span %d\n", span_id); + CONFIG_ERROR("Error configuring Sangoma GSM FreeTDM span %d\n", span_id); continue; } SPAN_CONFIG[span_id].span = span; diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c old mode 100644 new mode 100755 index dd46e0354c..35a7be22bb --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -37,6 +37,7 @@ * */ + #define _GNU_SOURCE #include @@ -48,31 +49,86 @@ #include #include #include -/*========================*/ +/*========================*/ #include #include #include + #include +// Debug +#define LOG_SIG_DATA 0 +#define DEBUG_STATES 0 + + +#if DEBUG_STATES // state debugging +#define STATE_ADVANCE_LOG_LEVEL FTDM_LOG_CRIT +#else +#define STATE_ADVANCE_LOG_LEVEL FTDM_LOG_DEBUG +#endif + + +/********************************************************************************/ +/* */ +/* MACROS */ +/* */ +/********************************************************************************/ +// Macro to send signals +#define SEND_STATE_SIGNAL(sig) \ + { \ + ftdm_sigmsg_t sigev; \ + memset(&sigev, 0, sizeof(sigev)); \ + sigev.event_id = sig; \ + sigev.channel = ftdmchan; \ + ftdm_span_send_signal(ftdmchan->span, &sigev); \ + } + +// Syntax message +#define FT_SYNTAX "USAGE:\n" \ +"--------------------------------------------------------------------------------\n" \ +"ftdm gsm version \n" \ +"ftdm gsm status \n" \ +"ftdm gsm sms \n" \ +"--------------------------------------------------------------------------------\n" + +// Used to declare command handler +#define COMMAND_HANDLER(name) \ + ftdm_status_t fCMD_##name(ftdm_stream_handle_t *stream, char *argv[], int argc); \ + ftdm_status_t fCMD_##name(ftdm_stream_handle_t *stream, char *argv[], int argc) + +// Used to define command entry in the command map. +#define COMMAND(name, argc) {#name, argc, fCMD_##name} + +/********************************************************************************/ +/* */ +/* types */ +/* */ +/********************************************************************************/ + +// private data typedef struct ftdm_gsm_span_data_s { ftdm_span_t *span; ftdm_channel_t *dchan; + ftdm_channel_t *bchan; + int32_t call_id; } ftdm_gsm_span_data_t; +// command handler function type. +typedef ftdm_status_t (*fCMD)(ftdm_stream_handle_t *stream, char *argv[], int argc); + + + +/********************************************************************************/ +/* */ +/* function declaration */ +/* */ +/********************************************************************************/ static ftdm_status_t init_wat_lib(void); static int wat_lib_initialized = 0; +static FIO_API_FUNCTION(ftdm_gsm_api); + -static int read_channel(ftdm_channel_t *ftdm_chan , const void *buf, int size) -{ - - ftdm_size_t outsize = size; - ftdm_status_t status = ftdm_channel_read(ftdm_chan, (void *)buf, &outsize); - if (FTDM_FAIL == status) { - return -1; - } - return (int)outsize; -} /* wat callbacks */ int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len); @@ -91,9 +147,45 @@ void *on_wat_calloc(size_t nmemb, size_t size); void on_wat_free(void *ptr); void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...); + +ftdm_span_t *GetSpanByID(unsigned char span_id, ftdm_gsm_span_data_t **gsm_data); + +static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj); + +/********************************************************************************/ +/* */ +/* static & global data */ +/* */ +/********************************************************************************/ +int g_outbound_call_id = 8; + +/* IO interface for the command API */ +static ftdm_io_interface_t g_ftdm_gsm_interface; + +/********************************************************************************/ +/* */ +/* implementation */ +/* */ +/********************************************************************************/ +static int read_channel(ftdm_channel_t *ftdm_chan , const void *buf, int size) +{ + + ftdm_size_t outsize = size; + ftdm_status_t status = ftdm_channel_read(ftdm_chan, (void *)buf, &outsize); + if (FTDM_FAIL == status) { + return -1; + } + return (int)outsize; +} + + int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) { -/* ftdm_log(FTDM_LOG_DEBUG, "====================>>> %s (%d) - %d\n", buffer, len, (int) span_id);*/ + +#if LOG_SIG_DATA + fprintf(stdout, " Out Data ====================>>> %s \r\n (%d) - %d\n", (char *)buffer, len, (int) span_id); +#endif + ftdm_span_t *span = NULL; ftdm_status_t status = FTDM_FAIL; ftdm_gsm_span_data_t *gsm_data = NULL; @@ -104,14 +196,20 @@ int on_wat_span_write(unsigned char span_id, void *buffer, unsigned len) ftdm_log(FTDM_LOG_ERROR, "Failed to find span %d to write %d bytes\n", span_id, len); return -1; } - + gsm_data = span->signal_data; status = ftdm_channel_write(gsm_data->dchan, (void *)buffer, len, &outsize); if (status != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Failed to write %d bytes to d-channel in span %s\n", len, span->name); return -1; } - return (int)outsize; + +//#if LOG_SIG_DATA +// fprintf(stdout, "\r\n==================== len=%d outsize=%d \r\n", len, (int)outsize); +//#endif + + fflush(stdout); + return len; } @@ -147,43 +245,200 @@ static void on_wat_span_status(unsigned char span_id, wat_span_status_t *status) { ftdm_log(FTDM_LOG_INFO, "span %d: Unhandled span status notification %d\n", span_id, status->type); } - break; + break; } } void on_wat_con_ind(unsigned char span_id, uint8_t call_id, wat_con_event_t *con_event) { - fprintf(stdout, "s%d: Incoming call (id:%d) Calling Number:%s type:%d plan:%d\n", span_id, call_id, con_event->calling_num.digits, con_event->calling_num.type, con_event->calling_num.plan); + //fprintf(stdout, "s%d: Incoming call (id:%d) Calling Number:%s Calling Name:\"%s\" type:%d plan:%d\n", span_id, call_id, con_event->calling_num.digits, con_event->calling_name, con_event->calling_num.type, con_event->calling_num.plan); + + ftdm_log(FTDM_LOG_INFO, "s%d: Incoming call (id:%d) Calling Number:%s Calling Name:\"%s\" type:%d plan:%d\n", span_id, call_id, con_event->calling_num.digits, con_event->calling_name, con_event->calling_num.type, con_event->calling_num.plan); + + ftdm_span_t *span = NULL; + //ftdm_status_t ftdm_status = FTDM_FAIL; + ftdm_gsm_span_data_t *gsm_data = NULL; + + if(!(span = GetSpanByID(span_id, &gsm_data))) { + return; + } + + gsm_data->call_id = call_id; + + #define ZERO_ARRAY(arr) memset(arr, 0, sizeof(arr)) + // cid date + { + time_t t; + struct tm *tmp; + t = time(NULL); + tmp = localtime(&t); + if (tmp == NULL) { + ZERO_ARRAY(gsm_data->bchan->caller_data.cid_date); + strftime(gsm_data->bchan->caller_data.cid_date, sizeof(gsm_data->bchan->caller_data.cid_date), "%y/%m/%d", tmp); + } + + } + + // cid name + ZERO_ARRAY(gsm_data->bchan->caller_data.cid_name); + strncpy(gsm_data->bchan->caller_data.cid_name, con_event->calling_name,sizeof(gsm_data->bchan->caller_data.cid_name)); + + // dnis + ZERO_ARRAY(gsm_data->bchan->caller_data.dnis.digits); + strncpy(gsm_data->bchan->caller_data.dnis.digits, con_event->calling_num.digits, FTDM_DIGITS_LIMIT); + + //collected + ZERO_ARRAY(gsm_data->bchan->caller_data.collected); + strncpy(gsm_data->bchan->caller_data.collected, con_event->calling_num.digits, FTDM_DIGITS_LIMIT); + + ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_RING); + + if (ftdm_channel_open_chan(gsm_data->bchan) != FTDM_SUCCESS) { + ftdm_log_chan(gsm_data->bchan, FTDM_LOG_ERROR, "Failed to open GSM b-channel of span %s!\n", span->name); + } + +} + + +ftdm_span_t *GetSpanByID(unsigned char span_id, ftdm_gsm_span_data_t **gsm_data) +{ + ftdm_status_t ftdm_status = FTDM_FAIL; + ftdm_span_t *span = NULL; + if(gsm_data) { + (*gsm_data) = NULL; + } + + ftdm_status = ftdm_span_find(span_id, &span); + if (ftdm_status != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "GetSpanByID - Failed to find span %d\n", span_id); + return NULL; + } + + if(gsm_data) { + (*gsm_data) = span->signal_data; + } + + return span; - - return; } void on_wat_con_sts(unsigned char span_id, uint8_t call_id, wat_con_status_t *status) { + + ftdm_span_t *span = NULL; + //ftdm_status_t ftdm_status = FTDM_FAIL; + ftdm_gsm_span_data_t *gsm_data = NULL; + + if(!(span = GetSpanByID(span_id, &gsm_data))) { + return; + } + + + + switch(status->type) { + + case WAT_CON_STATUS_TYPE_RINGING: + ftdm_log(FTDM_LOG_INFO, "on_wat_con_sts - WAT_CON_STATUS_TYPE_RINGING\r\n"); + ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_RINGING); + break; + + case WAT_CON_STATUS_TYPE_ANSWER: + ftdm_log(FTDM_LOG_INFO, "on_wat_con_sts - WAT_CON_STATUS_TYPE_ANSWER\r\n"); + ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + break; + default: + ftdm_log(FTDM_LOG_INFO, "on_wat_con_sts - Unhandled state %d\n", span_id); + + }; + + return; } void on_wat_rel_ind(unsigned char span_id, uint8_t call_id, wat_rel_event_t *rel_event) { - fprintf(stdout, "s%d: Call hangup (id:%d) cause:%d\n", span_id, call_id, rel_event->cause); + ftdm_log(FTDM_LOG_INFO, "s%d: Call hangup (id:%d) cause:%d\n", span_id, call_id, rel_event->cause); - return; + ftdm_span_t *span = NULL; + //ftdm_status_t ftdm_status = FTDM_FAIL; + ftdm_gsm_span_data_t *gsm_data = NULL; + + if(!(span = GetSpanByID(span_id, &gsm_data))) { + return; + } + + ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_HANGUP); + + } void on_wat_rel_cfm(unsigned char span_id, uint8_t call_id) { - fprintf(stdout, "s%d: Call hangup complete (id:%d)\n", span_id, call_id); - return; + ftdm_log(FTDM_LOG_INFO, "s%d: Call hangup complete (id:%d)\n", span_id, call_id); + ftdm_span_t *span = NULL; + //ftdm_status_t ftdm_status = FTDM_FAIL; + ftdm_gsm_span_data_t *gsm_data = NULL; + + if(!(span = GetSpanByID(span_id, &gsm_data))) { + return; + } + + switch(gsm_data->dchan->state) { + case FTDM_CHANNEL_STATE_UP: + ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_HANGUP); + break; + default: + ftdm_set_state(gsm_data->bchan, FTDM_CHANNEL_STATE_DOWN); + break; + } + } void on_wat_sms_ind(unsigned char span_id, wat_sms_event_t *sms_event) { + //printf("on_wat_sms_ind\r\n"); + + ftdm_span_t *span = NULL; + ftdm_channel_t *ftdmchan; + + ftdm_gsm_span_data_t *gsm_data = NULL; + + if(!(span = GetSpanByID(span_id, &gsm_data))) { + return; + } + + ftdmchan = gsm_data->dchan; + + { + ftdm_sms_data_t sms_data; + memset(&sms_data, 0, sizeof(sms_data)); + + strncpy(sms_data.from, sms_event->from.digits, sizeof(sms_data.from)); + strncpy(sms_data.body, sms_event->content.data, sizeof(sms_data.body)); + + ftdm_sigmsg_t sigev; + memset(&sigev, 0, sizeof(sigev)); + sigev.event_id = FTDM_SIGEVENT_SMS; + sigev.channel = ftdmchan ; + gsm_data->dchan->caller_data.priv = (void *)&sms_data; + ftdm_span_send_signal(span, &sigev); + } +// SEND_STATE_SIGNAL(FTDM_SIGEVENT_SMS); return; } void on_wat_sms_sts(unsigned char span_id, uint8_t sms_id, wat_sms_status_t *status) { + + if(status->success) { + ftdm_log(FTDM_LOG_INFO, "Span %d SMS Send - OK\n", span_id ); + } + else { + ftdm_log(FTDM_LOG_CRIT, "Span %d SMS Send - FAIL (%s)\n", span_id, status->error); + + } + + return; } @@ -198,8 +453,7 @@ void on_wat_log(uint8_t level, char *fmt, ...) va_start(argptr, fmt); char buff[10001]; - switch(level) - { + switch(level) { case WAT_LOG_CRIT: ftdm_level = FTDM_LOG_LEVEL_CRIT; break; case WAT_LOG_ERROR: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; default: @@ -223,27 +477,30 @@ void *on_wat_malloc(size_t size) { return ftdm_malloc(size); } + void *on_wat_calloc(size_t nmemb, size_t size) { return ftdm_calloc(nmemb, size); } + void on_wat_free(void *ptr) { ftdm_free(ptr); } + void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...) { int ftdm_level; - +return; va_list argptr; va_start(argptr, fmt); char buff[10001]; - switch(level) - { + switch(level) { case WAT_LOG_CRIT: ftdm_level = FTDM_LOG_LEVEL_CRIT; break; case WAT_LOG_ERROR: ftdm_level = FTDM_LOG_LEVEL_ERROR; break; default: + case WAT_LOG_WARNING: ftdm_level = FTDM_LOG_LEVEL_WARNING; break; case WAT_LOG_INFO: ftdm_level = FTDM_LOG_LEVEL_INFO; break; case WAT_LOG_NOTICE: ftdm_level = FTDM_LOG_LEVEL_NOTICE; break; @@ -265,22 +522,17 @@ void on_wat_log_span(uint8_t span_id, uint8_t level, char *fmt, ...) /* END wat callbacks */ /* span monitor thread */ -static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj); - -/* IO interface for the command API */ -static ftdm_io_interface_t g_ftdm_gsm_interface; - static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(gsm_outgoing_call) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "GSM place call not implemented yet!\n"); - return FTDM_FAIL; + + return FTDM_SUCCESS; } static ftdm_status_t ftdm_gsm_start(ftdm_span_t *span) { if (wat_span_start(span->span_id)) { ftdm_log(FTDM_LOG_ERROR, "Failed to start span %s!\n", span->name); - return FTDM_FAIL; + return FTDM_SUCCESS; } return ftdm_thread_create_detached(ftdm_gsm_run, span); @@ -288,32 +540,38 @@ static ftdm_status_t ftdm_gsm_start(ftdm_span_t *span) static ftdm_status_t ftdm_gsm_stop(ftdm_span_t *span) { - ftdm_log(FTDM_LOG_CRIT, "STOP not implemented yet!\n"); - return FTDM_FAIL; + return FTDM_SUCCESS; } static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_gsm_get_channel_sig_status) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "get sig status not implemented yet!\n"); - return FTDM_FAIL; + ftdm_log(FTDM_LOG_INFO, "\r\nftdm_gsm_get_channel_sig_status\r\n"); + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + *status = FTDM_SIG_STATE_UP; + } + else { + *status = FTDM_SIG_STATE_DOWN; + } + *status = FTDM_SIG_STATE_UP; + return FTDM_SUCCESS; + } static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_gsm_set_channel_sig_status) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "set sig status not implemented yet!\n"); - return FTDM_FAIL; + return FTDM_SUCCESS; } static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_gsm_get_span_sig_status) { - ftdm_log(FTDM_LOG_CRIT, "span get sig status not implemented yet!\n"); - return FTDM_FAIL; + *status = FTDM_SIG_STATE_UP; + return FTDM_SUCCESS; } static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_gsm_set_span_sig_status) { - ftdm_log(FTDM_LOG_CRIT, "span set sig status not implemented yet!\n"); - return FTDM_FAIL; + return FTDM_SUCCESS; } static ftdm_state_map_t gsm_state_map = { @@ -393,10 +651,12 @@ static ftdm_state_map_t gsm_state_map = { { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END} + {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_RINGING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_RINGING, FTDM_END} }, + + { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, @@ -429,7 +689,135 @@ static ftdm_state_map_t gsm_state_map = { static ftdm_status_t ftdm_gsm_state_advance(ftdm_channel_t *ftdmchan) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); + + ftdm_log_chan(ftdmchan, STATE_ADVANCE_LOG_LEVEL , "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); + + ftdm_channel_complete_state(ftdmchan); + + switch (ftdmchan->state) { + + /* starting an incoming call */ + case FTDM_CHANNEL_STATE_COLLECT: + { + + + } + break; + + /* starting an outgoing call */ + case FTDM_CHANNEL_STATE_DIALING: + { + uint32_t interval = 0; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting outgoing call with interval %d\n", interval); + + { + + ftdm_gsm_span_data_t *gsm_data; + gsm_data = ftdmchan->span->signal_data; + gsm_data->call_id = g_outbound_call_id++; + wat_con_event_t con_event; + memset(&con_event, 0, sizeof(con_event)); + sprintf(con_event.called_num.digits, ftdmchan->caller_data.dnis.digits); + ftdm_log(FTDM_LOG_DEBUG, "Dialing number %s\n", con_event.called_num.digits); + wat_con_req(ftdmchan->span->span_id, gsm_data->call_id , &con_event); + + SEND_STATE_SIGNAL(FTDM_SIGEVENT_DIALING); + + + } + + + } + break; + + /* incoming call was offered */ + case FTDM_CHANNEL_STATE_RING: + + /* notify the user about the new call */ + + ftdm_log(FTDM_LOG_INFO, "Answering Incomming Call\r\n"); + SEND_STATE_SIGNAL(FTDM_SIGEVENT_START); + + break; + + /* the call is making progress */ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + { + SEND_STATE_SIGNAL(FTDM_SIGEVENT_PROGRESS_MEDIA); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); + } + break; + + /* the call was answered */ + case FTDM_CHANNEL_STATE_UP: + { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + + SEND_STATE_SIGNAL(FTDM_SIGEVENT_UP); + } + else { + ftdm_gsm_span_data_t *gsm_data; + gsm_data = ftdmchan->span->signal_data; + wat_con_cfm(ftdmchan->span->span_id, gsm_data->call_id); + } + + + } + break; + + /* just got hangup */ + case FTDM_CHANNEL_STATE_HANGUP: + { + ftdm_gsm_span_data_t *gsm_data; + gsm_data = ftdmchan->span->signal_data; + wat_rel_req(ftdmchan->span->span_id, gsm_data->call_id); + gsm_data->call_id = 0; + SEND_STATE_SIGNAL(FTDM_SIGEVENT_STOP); + } + break; + + case FTDM_CHANNEL_STATE_TERMINATING: + { + SEND_STATE_SIGNAL(FTDM_SIGEVENT_STOP); + } + break; + + /* finished call for good */ + case FTDM_CHANNEL_STATE_DOWN: + { + ftdm_channel_t *closed_chan; + closed_chan = ftdmchan; + ftdm_channel_close(&closed_chan); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "State processing ended.\n"); + SEND_STATE_SIGNAL(FTDM_SIGEVENT_STOP); + } + break; + + /* INDICATE_RINGING doesn't apply to MFC/R2. maybe we could generate a tone */ + case FTDM_CHANNEL_STATE_RINGING: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RINGING indicated, ignoring it as it doesn't apply to MFC/R2\n"); + SEND_STATE_SIGNAL(FTDM_SIGEVENT_RINGING); + + break; + + /* put the r2 channel back to IDLE, close ftdmchan and set it's state as DOWN */ + case FTDM_CHANNEL_STATE_RESET: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RESET indicated, putting the R2 channel back to IDLE\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } + break; + + default: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); + } + break; + } + + return FTDM_SUCCESS; } @@ -465,8 +853,8 @@ static ftdm_status_t init_wat_lib(void) if (wat_register(&wat_interface)) { ftdm_log(FTDM_LOG_DEBUG, "Failed registering interface to WAT library ...\n"); return FTDM_FAIL; - } + ftdm_log(FTDM_LOG_DEBUG, "Registered interface to WAT library\n"); wat_lib_initialized = 1; @@ -482,10 +870,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) ftdm_iterator_t *citer = NULL; ftdm_channel_t *ftdmchan = NULL; ftdm_channel_t *dchan = NULL; + ftdm_channel_t *bchan = NULL; + unsigned paramindex = 0; const char *var = NULL; const char *val = NULL; - + /* libwat is smart enough to set good default values for the timers if they are set to 0 */ memset(&span_config, 0, sizeof(span_config)); @@ -508,6 +898,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) /* verify the span has one d-channel */ chaniter = ftdm_span_get_chan_iterator(span, NULL); + if (!chaniter) { ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); return FTDM_FAIL; @@ -516,10 +907,14 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) citer = ftdm_span_get_chan_iterator(span, chaniter); for ( ; citer; citer = ftdm_iterator_next(citer)) { ftdmchan = ftdm_iterator_current(citer); - if (FTDM_IS_DCHAN(ftdmchan)) { + + if ((NULL == dchan) && FTDM_IS_DCHAN(ftdmchan)) { dchan = ftdmchan; - break; } + if ((NULL == bchan) && FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + bchan = ftdmchan; + } + } ftdm_iterator_free(chaniter); @@ -527,12 +922,24 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) ftdm_log(FTDM_LOG_CRIT, "Could not find a d-channel for GSM span %s!\n", span->name); return FTDM_FAIL; } + if (!bchan) { + ftdm_log(FTDM_LOG_CRIT, "Could not find a b-channel for GSM span %s!\n", span->name); + return FTDM_FAIL; + } + + + + gsm_data = ftdm_calloc(1, sizeof(*gsm_data)); if (!gsm_data) { return FTDM_FAIL; } gsm_data->dchan = dchan; + gsm_data->bchan = bchan; + + //sprintf(gsm_data->dchan->chan_name, "%s\t\n", "GSM dchan"); + //sprintf(gsm_data->bchan->chan_name, "%s\r\n", "GSM bchan"); for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { var = ftdm_parameters[paramindex].var; @@ -569,6 +976,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) span->get_channel_sig_status = ftdm_gsm_get_channel_sig_status; span->set_channel_sig_status = ftdm_gsm_set_channel_sig_status; + //printf("\r\nspan->state_map = &gsm_state_map;\r\n"); span->state_map = &gsm_state_map; span->state_processor = ftdm_gsm_state_advance; @@ -589,11 +997,21 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) #endif +fprintf(stdout, "Configuring wat span %d %s \r\n", span->span_id, span->name); if (wat_span_config(span->span_id, &span_config)) { ftdm_log(FTDM_LOG_ERROR, "Failed to configure span %s for GSM signaling!!\n", span->name); return FTDM_FAIL; } + { + int codec = FTDM_CODEC_SLIN; + int interval = 20; + + ftdm_channel_command(gsm_data->bchan, FTDM_COMMAND_SET_NATIVE_CODEC, &codec); + ftdm_channel_command(gsm_data->bchan, FTDM_COMMAND_SET_CODEC, &codec); + ftdm_channel_command(gsm_data->bchan, FTDM_COMMAND_SET_INTERVAL, &interval); + } + return FTDM_SUCCESS; } @@ -601,11 +1019,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) #define GSM_POLL_INTERVAL_MS 20 static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) { + + ftdm_log(FTDM_LOG_INFO,"ftdm_gsm_run\r\n"); + ftdm_channel_t *ftdmchan = NULL; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_gsm_span_data_t *gsm_data = NULL; - ftdm_status_t status = FTDM_SUCCESS; - ftdm_wait_flag_t ioflags = FTDM_NO_FLAGS; ftdm_interrupt_t *data_sources[2] = {NULL, NULL}; int waitms = 0; @@ -620,16 +1039,8 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) goto done; } - /* create an interrupt object to wait for data from the d-channel device */ - if (ftdm_interrupt_create(&data_sources[0], gsm_data->dchan->sockfd, FTDM_READ) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to create GSM d-channel interrupt for span %s\n", span->name); - goto done; - } - status = ftdm_queue_get_interrupt(span->pendingchans, &data_sources[1]); - if (status != FTDM_SUCCESS || data_sources[1] == NULL) { - ftdm_log(FTDM_LOG_CRIT, "Failed to retrieve channel queue interrupt for span %s\n", span->name); - goto done; - } + + while (ftdm_running()) { @@ -640,47 +1051,48 @@ static void *ftdm_gsm_run(ftdm_thread_t *me, void *obj) waitms = GSM_POLL_INTERVAL_MS; } -#if 0 - /* run any span timers */ - ftdm_sched_run(r2data->sched); +///////////////////// + + + { + ftdm_wait_flag_t flags = FTDM_READ | FTDM_EVENTS; + ftdm_status_t status = ftdm_channel_wait(gsm_data->dchan, &flags, waitms); + + /* double check that this channel has a state change pending */ + ftdm_channel_lock(gsm_data->bchan); + ftdm_channel_advance_states(gsm_data->bchan); + + if(FTDM_SUCCESS == status ) { + + if(flags &FTDM_READ ) { + char buffer[1025]; + int n = 0, m = 0; + memset(buffer, 0, sizeof(buffer)); + + n = read_channel(gsm_data->dchan, buffer, sizeof(buffer)-1); + m = strlen(buffer); + wat_span_process_read(span->span_id, buffer, m); +#if LOG_SIG_DATA + printf("<<======================= incomming data len = %d, %s\r\n", n, buffer); #endif - status = ftdm_interrupt_multiple_wait(data_sources, ftdm_array_len(data_sources), waitms); - switch (status) { - case FTDM_ETIMEDOUT: - break; - case FTDM_SUCCESS: - { - /* process first the d-channel if ready */ - if ((ioflags = ftdm_interrupt_device_ready(data_sources[0])) != FTDM_NO_FLAGS) { - char buffer[1024]; - unsigned int n = 0; - n = read_channel(gsm_data->dchan, buffer, sizeof(buffer)); - /* this may trigger any of the callbacks registered through wat_register() */ - wat_span_process_read(span->span_id, buffer, n); - } - /* now process all channels with state changes pending */ - while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) { - /* double check that this channel has a state change pending */ - ftdm_channel_lock(ftdmchan); - ftdm_channel_advance_states(ftdmchan); - ftdm_channel_unlock(ftdmchan); } - - /* deliver the actual channel events to the user now without any channel locking */ - ftdm_span_trigger_signals(span); } - break; - case FTDM_FAIL: - ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned error!\n", span->name); - break; + + ftdm_channel_advance_states(gsm_data->bchan); + + ftdm_channel_unlock(gsm_data->bchan); + - default: - ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned with unknown code\n", span->name); - break; } + + + + ftdm_span_trigger_signals(span); + + } done: @@ -693,94 +1105,7 @@ done: return NULL; } -#define FT_SYNTAX "USAGE:\n" \ -"--------------------------------------------------------------------------------\n" \ -"ftdm gsm status \n" \ -"--------------------------------------------------------------------------------\n" -static FIO_API_FUNCTION(ftdm_gsm_api) -{ - ftdm_span_t *span = NULL; - int span_id = 0; - char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - } - - if (!strcasecmp(argv[0], "version")) { - uint8_t current = 0, revision = 0, age = 0; - wat_version(¤t, &revision, &age); - stream->write_function(stream, "libwat version: %d.%d.%d\n", current, revision, age); - stream->write_function(stream, "+OK.\n"); - goto done; - - } else if (!strcasecmp(argv[0], "status")) { - const wat_chip_info_t *chip_info = NULL; - const wat_sim_info_t *sim_info = NULL; - const wat_net_info_t *net_info = NULL; - const wat_sig_info_t *sig_info = NULL; - const wat_pin_stat_t *pin_stat = NULL; - - if (argc < 2) { - goto syntax; - } - - span_id = atoi(argv[1]); - if (ftdm_span_find_by_name(argv[1], &span) != FTDM_SUCCESS && - ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { - stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[1]); - goto done; - } - - if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { - stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[1]); - goto done; - } - - chip_info = wat_span_get_chip_info(span->span_id); - sim_info = wat_span_get_sim_info(span->span_id); - net_info = wat_span_get_net_info(span->span_id); - sig_info = wat_span_get_sig_info(span->span_id); - pin_stat = wat_span_get_pin_info(span->span_id); - - stream->write_function(stream, "Span %d (%s):\n", span->span_id, span->name); - - stream->write_function(stream, "CHIP - %s (%s), revision %s, serial %s \n", - chip_info->manufacturer_name, - chip_info->manufacturer_id, - chip_info->revision, - chip_info->serial); - - stream->write_function(stream, "SIM - Subscriber type %s, imsi %s\n", sim_info->subscriber_type, sim_info->imsi); - - stream->write_function(stream, "Subscriber - Number %s, Plan %s, validity %s\n", - sim_info->subscriber.digits, - wat_number_type2str(sim_info->subscriber.type), - wat_number_plan2str(sim_info->subscriber.plan), - wat_number_validity2str(sim_info->subscriber.validity)); - - stream->write_function(stream, "Network - status %s, Area Code %d, Cell ID %d, Operator %s\n", - wat_net_stat2str(net_info->stat), net_info->lac, net_info->ci, net_info->operator_name); - - - stream->write_function(stream, "\n"); - - stream->write_function(stream, "+OK.\n"); - goto done; - } - -syntax: - stream->write_function(stream, "%s", FT_SYNTAX); -done: - - ftdm_safe_free(mycmd); - - return FTDM_SUCCESS; - - -} static FIO_IO_LOAD_FUNCTION(ftdm_gsm_io_init) { @@ -827,3 +1152,178 @@ EX_DECLARE_DATA ftdm_module_t ftdm_module = { * For VIM: * vim:set softtabstop=4 shiftwidth=4 tabstop=4: */ + + +/********************************************************************************/ +/* */ +/* COMMAND HANDLERS */ +/* */ +/********************************************************************************/ + + +// Version Command Handler +COMMAND_HANDLER(version) +{ + uint8_t current = 0, revision = 0, age = 0; + wat_version(¤t, &revision, &age); + stream->write_function(stream, "libwat version: %d.%d.%d\n", current, revision, age); + stream->write_function(stream, "+OK.\n"); + return FTDM_SUCCESS; +} + + +// Status Command Handler +COMMAND_HANDLER(status) +{ + int span_id = 0; + ftdm_span_t *span = NULL; + const wat_chip_info_t *chip_info = NULL; + const wat_sim_info_t *sim_info = NULL; + const wat_net_info_t *net_info = NULL; + const wat_sig_info_t *sig_info = NULL; + const wat_pin_stat_t *pin_stat = NULL; + + + span_id = atoi(argv[0]); + if (ftdm_span_find_by_name(argv[0], &span) != FTDM_SUCCESS && ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { + stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[1]); + return FTDM_FAIL; + } + + if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { + stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[1]); + return FTDM_FAIL; + } + + chip_info = wat_span_get_chip_info(span->span_id); + sim_info = wat_span_get_sim_info(span->span_id); + net_info = wat_span_get_net_info(span->span_id); + sig_info = wat_span_get_sig_info(span->span_id); + pin_stat = wat_span_get_pin_info(span->span_id); + + stream->write_function(stream, "Span %d (%s):\n", span->span_id, span->name); + + stream->write_function(stream, "CHIP type - %s (%s), revision %s, serial %s \n", + chip_info->manufacturer, + chip_info->model, + chip_info->revision, + chip_info->serial); + + stream->write_function(stream, "SIM - Subscriber type %s, imsi %s\n", sim_info->subscriber_type, sim_info->imsi); + + stream->write_function(stream, "Subscriber - Number %s, Plan %s, validity %s\n", + sim_info->subscriber.digits, + wat_number_type2str(sim_info->subscriber.type), + wat_number_plan2str(sim_info->subscriber.plan), + wat_number_validity2str(sim_info->subscriber.validity)); + + stream->write_function(stream, "Network - status %s, Area Code %d, Cell ID %d, Operator %s\n", + wat_net_stat2str(net_info->stat), net_info->lac, net_info->ci, net_info->operator_name); + + + stream->write_function(stream, "\n"); + + stream->write_function(stream, "+OK.\n"); + + return FTDM_SUCCESS; +} + +// SMS Command Handler +COMMAND_HANDLER(sms) +{ + int span_id = 0,i; + ftdm_span_t *span = NULL; + wat_sms_event_t sms; + + + span_id = atoi(argv[0]); + if (ftdm_span_find_by_name(argv[0], &span) != FTDM_SUCCESS && ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { + stream->write_function(stream, "-ERR Failed to find GSM span '%s'\n", argv[1]); + return FTDM_FAIL; + } + + if (!span || !span->signal_data || (span->start != ftdm_gsm_start)) { + stream->write_function(stream, "-ERR '%s' is not a valid GSM span\n", argv[1]); + return FTDM_FAIL; + } + + memset(&sms, 0, sizeof(sms)); + + strcpy(sms.to.digits, argv[1]); + sms.type = WAT_SMS_TXT; + sms.content.data[0] = '\0'; + for(i=2;ispan_id, g_outbound_call_id++ , &sms)) { + stream->write_function(stream, "Failed to Send SMS \n"); + } + else { + stream->write_function(stream, "SMS Sent.\n"); + } + return FTDM_SUCCESS; +} + + + +// command map +struct { + const char*CMD; // command + int Argc; // minimum args + fCMD Handler; // handling function +} + GSM_COMMANDS[] = { + COMMAND(version, 0), + COMMAND(status, 1), + COMMAND(sms, 3) + }; + +// Commnand API entry point +static FIO_API_FUNCTION(ftdm_gsm_api) +{ + + char *mycmd = NULL, *argv[10] = { 0 }; + int argc = 0; + int i; + ftdm_status_t status = FTDM_FAIL; + ftdm_status_t syntax = FTDM_FAIL; + + + if (data) { + mycmd = ftdm_strdup(data); + argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if(argc > 0) { + for(i=0;i= GSM_COMMANDS[i].Argc) { + syntax = FTDM_SUCCESS; + status = GSM_COMMANDS[i].Handler(stream, &argv[1], argc-1); + + } + + break; + } + + } + } + + if(FTDM_SUCCESS != syntax) { + stream->write_function(stream, "%s", FT_SYNTAX); + } + else + if(FTDM_SUCCESS != status) { + stream->write_function(stream, "%s Command Failed\r\n", GSM_COMMANDS[i].CMD); + } + ftdm_safe_free(mycmd); + + return FTDM_SUCCESS; +} + + diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c old mode 100644 new mode 100755 index 1e9f3b059f..75d165be1d --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -36,9 +36,9 @@ * David Yat Sin * Nenad Corbic * Arnaldo Pereira + * Gideon Sadan * - */ - + */ #ifdef WP_DEBUG_IO #define _BSD_SOURCE #include @@ -121,6 +121,16 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event); FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event); FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event); +static void wp_swap16(char *data, int datalen) +{ + int i = 0; + uint16_t *samples = data; + for (i = 0; i < datalen/2; i++) { + uint16_t sample = ((samples[i] & 0x00FF) << 8) | ((samples[i] & 0xFF00) >> 8); + samples[i] = sample; + } +} + /** * \brief Poll for event on a wanpipe socket * \param fd Wanpipe socket descriptor @@ -305,11 +315,20 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start err = sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api); + + if (tdm_api.wp_tdm_cmd.hw_tdm_coding) { chan->native_codec = chan->effective_codec = FTDM_CODEC_ALAW; } else { chan->native_codec = chan->effective_codec = FTDM_CODEC_ULAW; } + + + if ((span->trunk_type == FTDM_TRUNK_GSM) && (chan->type == FTDM_CHAN_TYPE_B)) { + chan->native_codec = FTDM_CODEC_SLIN; + chan->native_interval = 20; + chan->packet_len = 320; + } err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api); if (err > 0) { @@ -580,8 +599,9 @@ static FIO_OPEN_FUNCTION(wanpipe_open) ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL); ftdmchan->effective_interval = ftdmchan->native_interval = wp_globals.codec_ms; - ftdmchan->packet_len = ftdmchan->native_interval * 8; - + + /* The packet len will depend on the codec and interval */ + ftdmchan->packet_len = ftdmchan->native_interval * ((ftdmchan->native_codec==FTDM_CODEC_SLIN) ? 16 : 8); if (wp_globals.txqueue_size > 0) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &wp_globals.txqueue_size); } @@ -772,6 +792,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) case FTDM_COMMAND_SET_INTERVAL: { err=sangoma_tdm_set_usr_period(ftdmchan->sockfd, &tdm_api, FTDM_COMMAND_OBJ_INT); + ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); } break; @@ -793,7 +814,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) FTDM_COMMAND_OBJ_INT = wanpipe_swap_bits(rbsbits); } #else - // does sangoma_tdm_read_rbs is available here? + /* is sangoma_tdm_read_rbs available here? */ FTDM_COMMAND_OBJ_INT = ftdmchan->rx_cas_bits; #endif } @@ -969,12 +990,15 @@ static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx * \param datalen Size of data buffer * \return Success, failure or timeout */ + + static FIO_READ_FUNCTION(wanpipe_read) { int rx_len = 0; int rq_len = (int)*datalen; wp_tdm_api_rx_hdr_t hdrframe; + #ifdef WP_DEBUG_IO wp_channel_t *wchan = ftdmchan->io_data; ftdm_time_t time_diff = 0; @@ -1034,6 +1058,10 @@ static FIO_READ_FUNCTION(wanpipe_read) wanpipe_read_stats(ftdmchan, &hdrframe); } + if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) { + wp_swap16(data, *datalen); + } + return FTDM_SUCCESS; } @@ -1050,6 +1078,10 @@ static FIO_WRITE_FUNCTION(wanpipe_write) int err = 0; wp_tdm_api_tx_hdr_t hdrframe; + if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) { + wp_swap16(data, *datalen); + } + /* Do we even need the headerframe here? on windows, we don't even pass it to the driver */ memset(&hdrframe, 0, sizeof(hdrframe)); if (*datalen == 0) { diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 165f243cf3..b48bb50ae5 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -346,6 +346,11 @@ typedef struct { uint8_t plan; } ftdm_number_t; +typedef struct { + char from[FTDM_MAX_NUMBER_STR_SZ]; + char body[FTDM_MAX_NAME_STR_SZ]; +} ftdm_sms_data_t; + /*! \brief Caller information */ typedef struct ftdm_caller_data { char cid_date[8]; /*!< Caller ID date */ @@ -456,12 +461,13 @@ typedef enum { FTDM_SIGEVENT_INDICATION_COMPLETED, /*!< Last requested indication was completed */ FTDM_SIGEVENT_DIALING, /*!< Outgoing call just started */ FTDM_SIGEVENT_TRANSFER_COMPLETED, /*!< Transfer request is completed */ + FTDM_SIGEVENT_SMS, FTDM_SIGEVENT_INVALID, /*! Date: Mon, 7 May 2012 16:26:48 -0400 Subject: [PATCH 0192/1057] Fixes before merging sangoma repo with upstream --- libs/freetdm/mod_freetdm/mod_freetdm.c | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index ede617c153..6238513be2 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2859,7 +2859,7 @@ static void parse_gsm_spans(switch_xml_t cfg, switch_xml_t spans) unsigned paramindex = 0; if (!name && !id) { - CONFIG_ERROR("sangoma isdn span missing required attribute 'id' or 'name', skipping ...\n"); + CONFIG_ERROR("GSM span missing required attribute 'id' or 'name', skipping ...\n"); continue; } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c46cadfb27..ea2ba7ce4d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1415,7 +1415,6 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi switch (dtmf_type) { case DTMF_2833: { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Enqueuing RFC2833 DTMF %c of length %d\n", dtmf->digit, dtmf->duration); return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf); } case DTMF_INFO: @@ -1425,7 +1424,6 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi } else if (dtmf->digit == 'W') { switch_yield(1000000); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending INFO DTMF %c of length %d\n", dtmf->digit, dtmf->duration / 8); snprintf(message, sizeof(message), "Signal=%c\r\nDuration=%d\r\n", dtmf->digit, dtmf->duration / 8); switch_mutex_lock(tech_pvt->sofia_mutex); nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"), SIPTAG_PAYLOAD_STR(message), TAG_END()); @@ -1434,9 +1432,6 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, const swi } break; case DTMF_NONE: - { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding DTMF %c of length %d, DTMF type is NONE\n", dtmf->digit, dtmf->duration); - } break; default: switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unhandled DTMF type!\n"); From a511ff3026b8efdfc185723bf9d0728e0f8a86ca Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 May 2012 13:44:10 -0500 Subject: [PATCH 0193/1057] re-implement sla barge using eavesdrop backend --- src/include/private/switch_core_pvt.h | 3 + src/include/switch_core.h | 12 +- src/include/switch_ivr.h | 5 + src/include/switch_resample.h | 2 +- src/include/switch_types.h | 8 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 34 +++++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 98 ++++++-------- src/mod/endpoints/mod_sofia/sofia_presence.c | 1 + src/switch_core_io.c | 60 +++++++-- src/switch_core_media_bug.c | 83 +++++++++++- src/switch_ivr_async.c | 132 ++++++++++++++++++- src/switch_resample.c | 19 +++ 13 files changed, 378 insertions(+), 80 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 781f0e4d06..95e66f2f6d 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -171,6 +171,8 @@ struct switch_core_session { uint32_t soft_lock; switch_ivr_dmachine_t *dmachine[2]; plc_state_t *plc; + uint8_t recur_buffer[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_size_t recur_buffer_len; }; struct switch_media_bug { @@ -199,6 +201,7 @@ struct switch_media_bug { uint32_t record_pre_buffer_count; uint32_t record_pre_buffer_max; switch_frame_t *ping_frame; + switch_frame_t *read_demux_frame; struct switch_media_bug *next; }; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 0011652475..91cff21d67 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -137,6 +137,11 @@ SWITCH_DECLARE(void) switch_core_session_disable_heartbeat(switch_core_session_t #define switch_core_session_get_name(_s) switch_channel_get_name(switch_core_session_get_channel(_s)) +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t *orig_session, const char *function, switch_media_bug_t **pop); + +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session, + const char *function, switch_media_bug_exec_cb_t cb, void *user_data); + /*! \brief Add a media bug to the session \param session the session to add the bug to @@ -193,7 +198,7 @@ SWITCH_DECLARE(void) switch_core_media_bug_set_write_replace_frame(_In_ switch_m \param bug the bug to get the data from */ SWITCH_DECLARE(switch_frame_t *) switch_core_media_bug_get_read_replace_frame(_In_ switch_media_bug_t *bug); - +SWITCH_DECLARE(void) switch_core_media_bug_set_read_demux_frame(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame); /*! \brief Obtain the session from a media bug \param bug the bug to get the data from @@ -225,6 +230,7 @@ SWITCH_DECLARE(uint32_t) switch_core_cpu_count(void); \param bug bug to remove \return SWITCH_STATUS_SUCCESS if the operation was a success */ + SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(_In_ switch_core_session_t *session, _Inout_ switch_media_bug_t **bug); SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *session); @@ -247,7 +253,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(_Inout_ switch_media \param session the session to remove the bugs from \return SWITCH_STATUS_SUCCESS if the operation was a success */ -SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(_In_ switch_core_session_t *session); +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(_In_ switch_core_session_t *session, const char *function); + +#define switch_core_media_bug_remove_all(_s) switch_core_media_bug_remove_all_function(_s, NULL) SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream); SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session); diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 8f553b957e..ef5155512c 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -269,6 +269,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_start_input_timers(swit */ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh); + +SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_pop_eavesdropper(switch_core_session_t *session, switch_core_session_t **sessionp); +SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_exec_all(switch_core_session_t *session, const char *app, const char *arg); +SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_update_display(switch_core_session_t *session, const char *name, const char *number); + /*! \brief Eavesdrop on a another session \param session our session diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h index 7ae37669c7..f85a61f065 100644 --- a/src/include/switch_resample.h +++ b/src/include/switch_resample.h @@ -170,7 +170,7 @@ SWITCH_DECLARE(void) switch_change_sln_volume_granular(int16_t *data, uint32_t s ///\} SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples); - +SWITCH_DECLARE(uint32_t) switch_unmerge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples); SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t channels); SWITCH_END_EXTERN_C diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 93a2e48ced..5fda9c369e 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -288,7 +288,8 @@ typedef enum { ED_NONE = 0, ED_MUX_READ = (1 << 0), ED_MUX_WRITE = (1 << 1), - ED_DTMF = (1 << 2) + ED_DTMF = (1 << 2), + ED_COPY_DISPLAY = (1 << 3) } switch_eavesdrop_flag_enum_t; typedef uint32_t switch_eavesdrop_flag_t; @@ -1434,7 +1435,8 @@ typedef enum { SMBF_THREAD_LOCK = (1 << 7), SMBF_PRUNE = (1 << 8), SMBF_NO_PAUSE = (1 << 9), - SMBF_STEREO_SWAP = (1 << 10) + SMBF_STEREO_SWAP = (1 << 10), + SMBF_LOCK = (1 << 11) } switch_media_bug_flag_enum_t; typedef uint32_t switch_media_bug_flag_t; @@ -1821,6 +1823,8 @@ struct switch_console_callback_match { }; typedef struct switch_console_callback_match switch_console_callback_match_t; +typedef void (*switch_media_bug_exec_cb_t)(switch_media_bug_t *bug, void *user_data); + typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data); typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches); typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ea2ba7ce4d..a71dc4c714 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2100,6 +2100,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi number = tech_pvt->caller_profile->destination_number; } + switch_ivr_eavesdrop_update_display(session, name, number); + if (!sofia_test_flag(tech_pvt, TFLAG_UPDATING_DISPLAY) && switch_channel_test_flag(channel, CF_ANSWERED)) { if (zstr(tech_pvt->last_sent_callee_id_name) || strcmp(tech_pvt->last_sent_callee_id_name, name) || zstr(tech_pvt->last_sent_callee_id_number) || strcmp(tech_pvt->last_sent_callee_id_number, number)) { @@ -5342,11 +5344,40 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor } +SWITCH_STANDARD_APP(sofia_sla_function) +{ + private_object_t *tech_pvt; + switch_core_session_t *bargee_session; + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: \n"); + return; + } + + if ((bargee_session = switch_core_session_locate((char *)data))) { + if (bargee_session == session) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "BARGE: %s (cannot barge on myself)\n", (char *) data); + } else { + if (switch_core_session_check_interface(bargee_session, sofia_endpoint_interface)) { + tech_pvt = switch_core_session_get_private(bargee_session); + sofia_set_flag(tech_pvt, TFLAG_SLA_BARGE); + switch_ivr_transfer_variable(bargee_session, session, SWITCH_SIGNAL_BOND_VARIABLE); + } + } + + switch_core_session_rwunlock(bargee_session); + } + + switch_ivr_eavesdrop_session(session, data, NULL, ED_MUX_READ | ED_MUX_WRITE | ED_COPY_DISPLAY); +} + + SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) { switch_chat_interface_t *chat_interface; switch_api_interface_t *api_interface; switch_management_interface_t *management_interface; + switch_application_interface_t *app_interface; struct in_addr in; memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals)); @@ -5468,6 +5499,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) management_interface->relative_oid = "1001"; management_interface->management_function = sofia_manage; + SWITCH_ADD_APP(app_interface, "sofia_sla", "private sofia sla function", + "private sofia sla function", sofia_sla_function, "", SAF_NONE); + SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, " "); SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function, " [ivar|ovar|var] "); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5a51f68a2d..b66b29fb44 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -332,6 +332,7 @@ typedef enum { TFLAG_GOT_ACK, TFLAG_CAPTURE, TFLAG_REINVITED, + TFLAG_SLA_BARGE, /* No new flags below this line */ TFLAG_MAX } TFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7ae868ef62..26815b6f5e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -599,6 +599,43 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, status = 200; phrase = "OK"; + if (sofia_test_flag(tech_pvt, TFLAG_SLA_BARGE)) { + switch_core_session_t *new_session, *other_session; + const char *other_uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE); + char *cmd = NULL; + + if (!zstr(other_uuid) && (other_session = switch_core_session_locate(other_uuid))) { + switch_channel_t *other_channel = switch_core_session_get_channel(other_session); + + switch_mutex_lock(profile->ireg_mutex); + if (switch_ivr_eavesdrop_pop_eavesdropper(session, &new_session) == SWITCH_STATUS_SUCCESS) { + switch_channel_t *new_channel = switch_core_session_get_channel(new_session); + const char *new_uuid = switch_core_session_get_uuid(new_session); + + + switch_channel_set_variable(new_channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL); + + switch_channel_set_flag(other_channel, CF_REDIRECT); + + switch_channel_set_state(new_channel, CS_RESET); + + switch_ivr_uuid_bridge(new_uuid, other_uuid); + cmd = switch_core_session_sprintf(session, "sleep:500,sofia_sla:%s inline", new_uuid); + + switch_channel_clear_flag(other_channel, CF_REDIRECT); + + switch_core_session_rwunlock(new_session); + } + switch_mutex_unlock(profile->ireg_mutex); + + switch_core_session_rwunlock(other_session); + } + + if (!zstr(cmd)) { + switch_ivr_eavesdrop_exec_all(session, "transfer", cmd); + } + } + sofia_set_flag_locked(tech_pvt, TFLAG_BYE); call_info = switch_channel_get_variable(channel, "presence_call_info_full"); @@ -8354,8 +8391,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if ((b_session = switch_core_session_locate(b_private->uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); const char *uuid; - int one_leg = 1; - private_object_t *b_tech_pvt = NULL; const char *app = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_VARIABLE); const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE); switch_caller_profile_t *orig_cp; @@ -8387,68 +8422,15 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "answer,conference:%s+flags{dist-dtmf}", data); tech_pvt->caller_profile->dialplan = "inline"; } else { - if (switch_core_session_check_interface(b_session, sofia_endpoint_interface)) { - b_tech_pvt = switch_core_session_get_private(b_session); - } - - if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) { - one_leg = 0; - } else { + if (!(uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) { uuid = switch_core_session_get_uuid(b_session); } if (uuid) { - switch_core_session_t *c_session = NULL; - int do_conf = 0; - const char *c_app = NULL; - const char *c_data = NULL; - uuid = switch_core_session_strdup(b_session, uuid); + tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, + "answer,sofia_sla:%s", b_private->uuid); - if (call_info && (c_session = switch_core_session_locate(uuid))) { - switch_channel_t *c_channel = switch_core_session_get_channel(c_session); - private_object_t *c_tech_pvt = NULL; - - c_app = switch_channel_get_variable(c_channel, SWITCH_CURRENT_APPLICATION_VARIABLE); - c_data = switch_channel_get_variable(c_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE); - - if (switch_core_session_check_interface(c_session, sofia_endpoint_interface)) { - c_tech_pvt = switch_core_session_get_private(c_session); - } - - - 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(session, "answer,conference:%s@sla+flags{mintwo|dist-dtmf}", uuid); - - switch_channel_set_flag(c_channel, CF_REDIRECT); - switch_ivr_session_transfer(b_session, ext, "inline", NULL); - switch_ivr_session_transfer(c_session, ext, "inline", NULL); - switch_channel_clear_flag(c_channel, CF_REDIRECT); - do_conf = 1; - } - switch_core_session_rwunlock(c_session); - } - - if (do_conf) { - tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, - "answer,conference:%s@sla+flags{mintwo|dist-dtmf}", uuid); - } else { - if (one_leg && c_app) { - if (c_data) { - tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, - "answer,%s:%s", c_app, c_data); - } else { - tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, - "answer,%s", c_app); - } - } else { - switch_channel_mark_hold(b_channel, SWITCH_FALSE); - tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, - "answer,intercept:%s", uuid); - } - } tech_pvt->caller_profile->dialplan = "inline"; } diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 6befca3439..c4eb565f85 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1167,6 +1167,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } } #endif + if (hup && dh.hits > 0) { goto done; diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 020556a490..f20fa7bff9 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -498,21 +498,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi continue; } - if (bp->ready && switch_test_flag(bp, SMBF_READ_STREAM)) { - switch_mutex_lock(bp->read_mutex); - switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen); - - if (bp->callback) { - ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ); - } - switch_mutex_unlock(bp->read_mutex); - } - if (ok && switch_test_flag(bp, SMBF_READ_REPLACE)) { do_bugs = 0; if (bp->callback) { bp->read_replace_frame_in = read_frame; bp->read_replace_frame_out = read_frame; + bp->read_demux_frame = NULL; if ((ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_REPLACE)) == SWITCH_TRUE) { read_frame = bp->read_replace_frame_out; } @@ -532,6 +523,55 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } } + if (session->bugs) { + switch_media_bug_t *bp; + switch_bool_t ok = SWITCH_TRUE; + int prune = 0; + switch_thread_rwlock_rdlock(session->bug_rwlock); + + for (bp = session->bugs; bp; bp = bp->next) { + if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + continue; + } + + if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) { + continue; + } + if (switch_test_flag(bp, SMBF_PRUNE)) { + prune++; + continue; + } + + if (ok && bp->ready && switch_test_flag(bp, SMBF_READ_STREAM)) { + switch_mutex_lock(bp->read_mutex); + if (bp->read_demux_frame) { + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + int bytes = read_frame->datalen / 2; + + memcpy(data, read_frame->data, read_frame->datalen); + switch_unmerge_sln((int16_t *)data, bytes, bp->read_demux_frame->data, bytes); + switch_buffer_write(bp->raw_read_buffer, data, read_frame->datalen); + } else { + switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen); + } + + if (bp->callback) { + ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ); + } + switch_mutex_unlock(bp->read_mutex); + } + + if ((bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) || ok == SWITCH_FALSE) { + switch_set_flag(bp, SMBF_PRUNE); + prune++; + } + } + switch_thread_rwlock_unlock(session->bug_rwlock); + if (prune) { + switch_core_media_bug_prune(session); + } + } + if (do_bugs) { goto done; } diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index f5d14137b7..a320d9a345 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -72,6 +72,9 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_test_flag(switch_media_bug_t *bug SWITCH_DECLARE(uint32_t) switch_core_media_bug_set_flag(switch_media_bug_t *bug, uint32_t flag) { + if ((flag & SMBF_PRUNE)) { + switch_clear_flag(bug, SMBF_LOCK); + } return switch_set_flag(bug, flag); } @@ -105,6 +108,11 @@ SWITCH_DECLARE(void) switch_core_media_bug_set_read_replace_frame(switch_media_b bug->read_replace_frame_out = frame; } +SWITCH_DECLARE(void) switch_core_media_bug_set_read_demux_frame(switch_media_bug_t *bug, switch_frame_t *frame) +{ + bug->read_demux_frame = frame; +} + SWITCH_DECLARE(void *) switch_core_media_bug_get_user_data(switch_media_bug_t *bug) { return bug->user_data; @@ -175,6 +183,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b bytes = read_impl.decoded_bytes_per_packet; + if (0 && bug->session->recur_buffer_len) { + frame->datalen = bug->session->recur_buffer_len; + frame->samples = bug->session->recur_buffer_len / sizeof(int16_t); + frame->rate = read_impl.actual_samples_per_second; + frame->codec = NULL; + memcpy(frame->data, bug->session->recur_buffer, bug->session->recur_buffer_len); + return SWITCH_STATUS_SUCCESS; + } + + if (frame->buflen < bytes) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "%s frame buffer too small!\n", switch_channel_get_name(bug->session->channel)); @@ -363,6 +381,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b return SWITCH_STATUS_BREAK; } + memcpy(bug->session->recur_buffer, frame->data, frame->datalen); + bug->session->recur_buffer_len = frame->datalen; + return SWITCH_STATUS_SUCCESS; } @@ -552,6 +573,53 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t *orig_session, const char *function, switch_media_bug_t **pop) +{ + switch_media_bug_t *bp; + + if (orig_session->bugs) { + switch_thread_rwlock_wrlock(orig_session->bug_rwlock); + for (bp = orig_session->bugs; bp; bp = bp->next) { + if (!strcmp(bp->function, function)) { + switch_set_flag(bp, SMBF_LOCK); + break; + } + } + switch_thread_rwlock_unlock(orig_session->bug_rwlock); + + if (bp) { + *pop = bp; + return SWITCH_STATUS_SUCCESS; + } else { + *pop = NULL; + } + } + + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session, + const char *function, switch_media_bug_exec_cb_t cb, void *user_data) +{ + switch_media_bug_t *bp; + int x = 0; + + switch_assert(cb); + + if (orig_session->bugs) { + switch_thread_rwlock_wrlock(orig_session->bug_rwlock); + for (bp = orig_session->bugs; bp; bp = bp->next) { + if (!switch_test_flag(bp, SMBF_PRUNE) && !switch_test_flag(bp, SMBF_LOCK) && !strcmp(bp->function, function)) { + cb(bp, user_data); + x++; + } + } + switch_thread_rwlock_unlock(orig_session->bug_rwlock); + } + + return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream) { switch_media_bug_t *bp; @@ -579,7 +647,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_session_t *session) +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch_core_session_t *session, const char *function) { switch_media_bug_t *bp; switch_status_t status = SWITCH_STATUS_FALSE; @@ -587,10 +655,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_ses if (session->bugs) { switch_thread_rwlock_wrlock(session->bug_rwlock); for (bp = session->bugs; bp; bp = bp->next) { - if (bp->thread_id && bp->thread_id != switch_thread_self()) { + if ((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BUG is thread locked skipping.\n"); continue; } + + if (!zstr(function) && strcmp(bp->function, function)) { + continue; + } + if (bp->callback) { bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_CLOSE); @@ -614,7 +687,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t * { switch_media_bug_t *bp = *bug; if (bp) { - if (bp->thread_id && bp->thread_id != switch_thread_self()) { + if ((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(*bug)), SWITCH_LOG_DEBUG, "BUG is thread locked skipping.\n"); return SWITCH_STATUS_FALSE; } @@ -637,6 +710,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session { switch_media_bug_t *bp = NULL, *last = NULL; switch_status_t status = SWITCH_STATUS_FALSE; + + if (switch_core_media_bug_test_flag(*bug, SMBF_LOCK)) { + return status; + } switch_thread_rwlock_wrlock(session->bug_rwlock); if (session->bugs) { diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index ecddfdbbb6..5d6127d054 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1148,9 +1148,14 @@ struct eavesdrop_pvt { switch_mutex_t *r_mutex; switch_buffer_t *w_buffer; switch_mutex_t *w_mutex; + switch_core_session_t *eavesdropper; uint32_t flags; + switch_frame_t demux_frame; + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; }; + + static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) user_data; @@ -1190,13 +1195,18 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data if (switch_buffer_inuse(ep->r_buffer) >= rframe->datalen) { uint32_t bytes; switch_buffer_lock(ep->r_buffer); - bytes = (uint32_t) switch_buffer_read(ep->r_buffer, data, rframe->datalen); + bytes = (uint32_t) switch_buffer_read(ep->r_buffer, ep->data, rframe->datalen); - rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) data, bytes / 2) * 2; + rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) ep->data, bytes / 2) * 2; rframe->samples = rframe->datalen / 2; + ep->demux_frame.data = ep->data; + ep->demux_frame.datalen = bytes; + ep->demux_frame.samples = bytes / 2; + switch_buffer_unlock(ep->r_buffer); switch_core_media_bug_set_read_replace_frame(bug, rframe); + switch_core_media_bug_set_read_demux_frame(bug, &ep->demux_frame); } } } @@ -1229,6 +1239,99 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data return SWITCH_TRUE; } +SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_pop_eavesdropper(switch_core_session_t *session, switch_core_session_t **sessionp) +{ + switch_media_bug_t *bug; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (switch_core_media_bug_pop(session, "eavesdrop", &bug) == SWITCH_STATUS_SUCCESS) { + struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) switch_core_media_bug_get_user_data(bug); + + if (ep && ep->eavesdropper && ep->eavesdropper != session) { + switch_core_session_read_lock(ep->eavesdropper); + *sessionp = ep->eavesdropper; + switch_core_media_bug_set_flag(bug, SMBF_PRUNE); + status = SWITCH_STATUS_SUCCESS; + } + } + + + return status; +} + +struct exec_cb_data { + switch_core_session_t *caller; + char *var; + char *val; +}; + +static void exec_cb(switch_media_bug_t *bug, void *user_data) +{ + struct exec_cb_data *data = (struct exec_cb_data *) user_data; + struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) switch_core_media_bug_get_user_data(bug); + + if (ep && ep->eavesdropper && ep->eavesdropper != data->caller) { + switch_channel_t *a = switch_core_session_get_channel(ep->eavesdropper); + switch_channel_t *b = switch_core_session_get_channel(data->caller); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s telling %s to exec %s:%s\n", + switch_channel_get_name(b), switch_channel_get_name(a), data->var, data->val); + + switch_core_session_execute_application(ep->eavesdropper, data->var, data->val); + } +} + +static void display_exec_cb(switch_media_bug_t *bug, void *user_data) +{ + struct exec_cb_data *data = (struct exec_cb_data *) user_data; + struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) switch_core_media_bug_get_user_data(bug); + + if (ep && ep->eavesdropper && ep->eavesdropper != data->caller) { + switch_core_session_message_t msg = { 0 }; + + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY; + msg.string_array_arg[0] = data->var; + msg.string_array_arg[1] = data->val; + + switch_core_session_receive_message(ep->eavesdropper, &msg); + } +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_exec_all(switch_core_session_t *session, const char *app, const char *arg) +{ + struct exec_cb_data *data = NULL; + + data = switch_core_session_alloc(session, sizeof(*data)); + data->var = switch_core_session_strdup(session, app); + data->val = switch_core_session_strdup(session, arg); + data->caller = session; + + return switch_core_media_bug_exec_all(session, "eavesdrop", exec_cb, data); +} + + +SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_update_display(switch_core_session_t *session, const char *name, const char *number) +{ + struct exec_cb_data *data = NULL; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status = SWITCH_STATUS_FALSE; + + data = switch_core_session_alloc(session, sizeof(*data)); + data->var = switch_core_session_strdup(session, name); + data->val = switch_core_session_strdup(session, number); + data->caller = session; + + if (!switch_channel_test_app_flag_key("EAVESDROP", channel, 1)) { + switch_channel_set_app_flag_key("EAVESDROP", channel, 1); + status = switch_core_media_bug_exec_all(session, "eavesdrop", display_exec_cb, data); + switch_channel_clear_app_flag_key("EAVESDROP", channel, 1); + } + + return status; +} + + SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session, const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags) { @@ -1236,6 +1339,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session switch_status_t status = SWITCH_STATUS_FALSE; switch_channel_t *channel = switch_core_session_get_channel(session); int codec_initialized = 0; + const char *name, *num; if ((tsession = switch_core_session_locate(uuid))) { struct eavesdrop_pvt *ep = NULL; @@ -1341,6 +1445,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session write_frame.buflen = sizeof(buf); write_frame.rate = codec.implementation->actual_samples_per_second; + ep->eavesdropper = session; ep->flags = flags; switch_mutex_init(&ep->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession)); switch_buffer_create_dynamic(&ep->buffer, 2048, 2048, 8192); @@ -1370,9 +1475,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session /* Tell the channel we are going to be in a bridge */ msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; switch_core_session_receive_message(session, &msg); - cp = switch_channel_get_caller_profile(tchannel); - switch_snprintf(cid_buf, sizeof(cid_buf), "%s|%s", cp->caller_id_number, cp->caller_id_name); + name = cp->caller_id_name; + num = cp->caller_id_number; + + if (flags & ED_COPY_DISPLAY) { + const char *tmp_name = NULL, *tmp_num = NULL; + name = cp->callee_id_name; + num = cp->callee_id_number; + + if (!((tmp_name = switch_channel_get_variable(tchannel, "last_sent_callee_id_name")) + && (tmp_num = switch_channel_get_variable(tchannel, "last_sent_callee_id_number")))) { + + tmp_name = switch_channel_get_variable(tchannel, "callee_id_name"); + tmp_num = switch_channel_get_variable(tchannel, "callee_id_number"); + } + + if (tmp_name) name = tmp_name; + if (tmp_num) num = tmp_num; + + } + + switch_snprintf(cid_buf, sizeof(cid_buf), "%s|%s", name, num); msg.string_arg = cid_buf; msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY; switch_core_session_receive_message(session, &msg); diff --git a/src/switch_resample.c b/src/switch_resample.c index 136adc9694..6722d6f448 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -252,6 +252,25 @@ SWITCH_DECLARE(uint32_t) switch_merge_sln(int16_t *data, uint32_t samples, int16 return x; } + +SWITCH_DECLARE(uint32_t) switch_unmerge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples) +{ + int i; + int32_t x; + + if (samples > other_samples) { + x = other_samples; + } else { + x = samples; + } + + for (i = 0; i < x; i++) { + data[i] -= other_data[i]; + } + + return x; +} + SWITCH_DECLARE(void) switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t channels) { int16_t *buf; From c204243b1bdf860a26f5b8d984a0dc4504474e79 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 20:52:50 +0000 Subject: [PATCH 0194/1057] tagscript: reindent --- scripts/tagscript.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 1ac817cb74..91f37bceb0 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -1,26 +1,28 @@ #!/bin/bash +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- +##### release a version of FreeSWITCH src_repo="$(pwd)" if [ ! -d .git ]; then - echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 - exit 1; + echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 + exit 1; fi showusage() { - echo "usage: ./scripts/tagscript.sh [-s] MAJOR.MINOR.MICRO[.REVISION]" 1>&2 - exit 1; + echo "usage: ./scripts/tagscript.sh [-s] MAJOR.MINOR.MICRO[.REVISION]" 1>&2 + exit 1; } while getopts "s" o; do - case "$o" in - s) opts="-s" ;; - esac + case "$o" in + s) opts="-s" ;; + esac done shift $(($OPTIND-1)) if [ -z "$1" ]; then - showusage + showusage fi ver="$1" @@ -33,26 +35,26 @@ dst_name="freeswitch-$major.$minor.$micro" dst_dir="$src_repo/../$dst_name" if [ -d "$dst_dir" ]; then - echo "error: destination directory $dst_dir already exists." 1>&2 - exit 1; + echo "error: destination directory $dst_dir already exists." 1>&2 + exit 1; fi # save local changes ret=$(git stash save "Save uncommitted changes before tagging.") if echo $ret | grep "^Saved"; then - stash_saved=1 + stash_saved=1 fi sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ - -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ - -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ - -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \ - -i configure.in + -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ + -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \ + -i configure.in if [ -n "$rev" ]; then - sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ - -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ - -i configure.in + sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ + -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ + -i configure.in fi git add configure.in @@ -61,7 +63,7 @@ git tag -a ${opts} -m "freeswitch-$ver release" v$ver git clone $src_repo $dst_dir if [ -n "$stash_saved" ]; then - git stash pop + git stash pop fi cd $dst_dir @@ -87,3 +89,4 @@ server (I didn't do that for you, as you might want to review first). ---------------------------------------------------------------------- EOF +exit 0 From 20ac9757ba69b78e17eb8895dfb32144a11ce740 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 20:56:45 +0000 Subject: [PATCH 0195/1057] ci: wrap sanity checks --- scripts/ci/common.sh | 20 ++++++++++++-------- scripts/ci/debsrcbuilder.sh | 2 ++ scripts/ci/rpmbuilder.sh | 2 ++ scripts/ci/sounds-en-us-callie.sh | 2 ++ scripts/ci/src_tarball.sh | 2 ++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index a570cd8008..5967ae8262 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -73,13 +73,17 @@ gnuize () { rm -rf .git } -if [ ! -d .git ]; then - echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 - exit 1; -fi +check_pwd () { + if [ ! -d .git ]; then + echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 + exit 1; + fi +} -if [ -z "$1" ]; then - echo "usage: $0 " 1>&2 - exit 1; -fi +check_input_ver_build () { + if [ -z "$1" ]; then + echo "usage: $0 " 1>&2 + exit 1; + fi +} diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 3dc56e5faa..e5e429b153 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -5,6 +5,8 @@ sdir="." [ -n "${0%/*}" ] && sdir="${0%/*}" . $sdir/common.sh +check_pwd +check_input_ver_build eval $(parse_version "$1") datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 36b8b1d079..563bfca104 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -5,6 +5,8 @@ sdir="." [ -n "${0%/*}" ] && sdir="${0%/*}" . $sdir/common.sh +check_pwd +check_input_ver_build eval $(parse_version "$1") build="$2" diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index 39703028ca..6b3b0df0a6 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -5,6 +5,8 @@ sdir="." [ -n "${0%/*}" ] && sdir="${0%/*}" . $sdir/common.sh +check_pwd +check_input_ver_build eval $(parse_version "$1") build="$2" diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 7fd48621e3..d4c3adffa7 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -5,6 +5,8 @@ sdir="." [ -n "${0%/*}" ] && sdir="${0%/*}" . $sdir/common.sh +check_pwd +check_input_ver_build eval $(parse_version "$1") dst_name="freeswitch-$cmajor.$cminor.$cmicro" From 985fad9e32813b840ebd918e1303219fdd5bbba1 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 21:34:08 +0000 Subject: [PATCH 0196/1057] prepare the tag script for the new release --- scripts/ci/common.sh | 10 ++++ scripts/tagscript.sh | 125 ++++++++++++++++++++++++++----------------- 2 files changed, 85 insertions(+), 50 deletions(-) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index 5967ae8262..ef191676b3 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -37,6 +37,11 @@ parse_version () { micro="0" ver="${major}.${minor}${rev}" fi + gver="$(echo "$ver" | sed -e 's/[~_]/-/')" + grev="$(echo "$rev" | sed -e 's/[~_]/-/')" + gmajor="$major" + gminor="$minor" + gmicro="$micro" [ -n "$crev" ] && cver="${cver}.${crev}" echo "ver='$ver'" echo "major='$major'" @@ -48,6 +53,11 @@ parse_version () { echo "cminor='$cminor'" echo "cmicro='$cmicro'" echo "crev='$crev'" + echo "gver='$gver'" + echo "gmajor='$gmajor'" + echo "gminor='$gminor'" + echo "gmicro='$gmicro'" + echo "grev='$grev'" } set_fs_ver () { diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 91f37bceb0..005fab5499 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -2,20 +2,38 @@ ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ##### release a version of FreeSWITCH -src_repo="$(pwd)" +sdir="." +[ -n "${0%/*}" ] && sdir="${0%/*}" +. $sdir/ci/common.sh -if [ ! -d .git ]; then - echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 - exit 1; -fi +check_pwd showusage() { - echo "usage: ./scripts/tagscript.sh [-s] MAJOR.MINOR.MICRO[.REVISION]" 1>&2 + cat >&2 < + +where follows the format: + +1.2-alpha3 +1.2-beta3 +1.2-rc3 +1.2 +1.2.13-rc4 +1.2.13 +etc. + +I'll take care of correctly naming the tag to be consistent with +FreeSWITCH git policy from there. + +EOF exit 1; } -while getopts "s" o; do +opts="" +debug=false +while getopts "ds" o; do case "$o" in + d) debug=true ;; s) opts="-s" ;; esac done @@ -25,67 +43,74 @@ if [ -z "$1" ]; then showusage fi -ver="$1" -major=$(echo "$ver" | cut -d. -f1) -minor=$(echo "$ver" | cut -d. -f2) -micro=$(echo "$ver" | cut -d. -f3) -rev=$(echo "$ver" | cut -d. -f4) +eval $(parse_version "$1") -dst_name="freeswitch-$major.$minor.$micro" -dst_dir="$src_repo/../$dst_name" +ngrep () { grep -e "$1" >/dev/null; } -if [ -d "$dst_dir" ]; then - echo "error: destination directory $dst_dir already exists." 1>&2 - exit 1; +if ! $debug && ! (echo "$opts" | ngrep '-s'); then + cat >&2 <&2 + read r + [ -z "$r" ] && continue + if [ "$r" = yes ] || [ "$r" = y ]; then + (echo; echo "OK, I believe you."; echo) >&2 + break + else + (echo; echo "This is a bad idea then."; echo) >&2 + fi + while true; do + echo -n "Are you really really sure? (yes/no): " >&2 + read r + [ -z "$r" ] && continue + if [ "$r" = yes ] || [ "$r" = y ]; then + (echo; echo "As you wish, you've been warned."; echo) >&2 + break + else + (echo; echo "Great; go setup a GPG key and try again with -s"; echo) >&2 + exit 1 + fi + break + done + break + done fi -# save local changes +echo "Saving uncommitted changes before tagging..." >&2 ret=$(git stash save "Save uncommitted changes before tagging.") -if echo $ret | grep "^Saved"; then +if (echo "$ret" | ngrep '^Saved'); then stash_saved=1 fi -sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ - -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ - -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ - -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \ - -i configure.in - -if [ -n "$rev" ]; then - sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ - -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ - -i configure.in -fi +echo "Changing the version of configure.in..." >&2 +set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" +echo "Committing the new version..." >&2 git add configure.in -git commit -m "Release freeswitch-$ver" -git tag -a ${opts} -m "freeswitch-$ver release" v$ver +git commit -m "Release freeswitch-$gver" +echo "Tagging freeswitch v$gver..." >&2 +git tag -a ${opts} -m "freeswitch-$gver release" "v$gver" -git clone $src_repo $dst_dir if [ -n "$stash_saved" ]; then - git stash pop + echo "Restoring your uncommitted changes to your working directory..." >&2 + git stash pop >/dev/null fi -cd $dst_dir - -./bootstrap.sh -mv bootstrap.sh rebootstrap.sh -rm -f docs/AUTHORS -rm -f docs/COPYING -rm -f docs/ChangeLog -rm -rf .git -cd .. -tar -cvf $dst_name.tar $dst_dir -gzip -9 -c $dst_name.tar > $dst_name.tar.gz || echo "gzip not available" -bzip2 -z -k $dst_name.tar || echo "bzip2 not available" -xz -z -9 -k $dst_name.tar || echo "xz / xz-utils not available" -rm -rf $dst_name.tar $dst_dir - cat 1>&2 < Date: Mon, 7 May 2012 21:47:25 +0000 Subject: [PATCH 0197/1057] tagscript: refactor --- scripts/tagscript.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 005fab5499..12fafc42ff 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -44,10 +44,9 @@ if [ -z "$1" ]; then fi eval $(parse_version "$1") +ngrep () { (echo "$2" | grep -e "$1" >/dev/null); } -ngrep () { grep -e "$1" >/dev/null; } - -if ! $debug && ! (echo "$opts" | ngrep '-s'); then +if ! ($debug || ngrep '-s' "$opts"); then cat >&2 <&2 ret=$(git stash save "Save uncommitted changes before tagging.") -if (echo "$ret" | ngrep '^Saved'); then +if (ngrep '^Saved' "$ret"); then stash_saved=1 fi From 55330e0e564da82aa65b767a1dc5166450f3ca13 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 21:49:00 +0000 Subject: [PATCH 0198/1057] tagscript: follow our git subject line capitalization convention --- scripts/tagscript.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 12fafc42ff..faccf47081 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -92,7 +92,7 @@ set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" echo "Committing the new version..." >&2 git add configure.in -git commit -m "Release freeswitch-$gver" +git commit -m "release freeswitch-$gver" echo "Tagging freeswitch v$gver..." >&2 git tag -a ${opts} -m "freeswitch-$gver release" "v$gver" From d864e66d623c58a38c7063f038e1e6d3b1d52271 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 22:02:44 +0000 Subject: [PATCH 0199/1057] tagscript: add sanity checks on version number --- scripts/tagscript.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index faccf47081..4e74ebe9a5 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -45,6 +45,19 @@ fi eval $(parse_version "$1") ngrep () { (echo "$2" | grep -e "$1" >/dev/null); } +err () { echo "$1" >&2; exit 1; } + +ngrep '^[1-9]*$' "$gmajor" || \ + err "The major version '$gmajor' appears invalid." +ngrep '^[0-9]*$' "$gminor" || \ + err "The minor version '$gminor' appears invalid." +[ -z "$gmicro" ] || ngrep '^[0-9]*$' "$gmicro" || \ + err "The micro version '$gmicro' appears invalid." +[ -z "$grev" ] || ngrep '^[.-]' "$grev" || \ + err "The revision '$grev' appears invalid." + +echo "We're going to release freeswitch v$gver" >&2 +echo >&2 if ! ($debug || ngrep '-s' "$opts"); then cat >&2 < Date: Mon, 7 May 2012 22:15:59 +0000 Subject: [PATCH 0200/1057] tagscript: add better usage instructions and error checking --- scripts/tagscript.sh | 62 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 4e74ebe9a5..920d312d65 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -10,20 +10,34 @@ check_pwd showusage() { cat >&2 < +SYNOPSIS + $0 [-s] -where follows the format: +DESCRIPTION + Creates a new FreeSWITCH tag after performing some sanity checks. + The tag is optionally signed if '-s' is provided, but you should + really sign any public release tags, so pass '-s'. -1.2-alpha3 -1.2-beta3 -1.2-rc3 -1.2 -1.2.13-rc4 -1.2.13 -etc. + follows the format: + + 1.2-alpha3 + 1.2-beta3 + 1.2-rc3 + 1.2 + 1.2.13-rc4 + 1.2.13 + etc. -I'll take care of correctly naming the tag to be consistent with -FreeSWITCH git policy from there. + This tool will take care of correctly naming the tag to be + consistent with FreeSWITCH git policy from there. + +OPTIONS + -s + Signs the resulting tag. + + -d + Debug mode. Remove the tag after creating it and don't warn about + the lack of a signature. EOF exit 1; @@ -105,9 +119,31 @@ set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" echo "Committing the new version..." >&2 git add configure.in -git commit -m "release freeswitch-$gver" +if ! (git commit --allow-empty -m "release freeswitch-$gver"); then + cat >&2 <&2 -git tag -a ${opts} -m "freeswitch-$gver release" "v$gver" +if ! (git tag -a ${opts} -m "freeswitch-$gver release" "v$gver"); then + cat >&2 <&2 + git tag -d "v$gver" || true + git reset --hard HEAD^ || true +fi if [ -n "$stash_saved" ]; then echo "Restoring your uncommitted changes to your working directory..." >&2 From a9b997468d22f2ccc04eb0d220c18a466afe6bf0 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 7 May 2012 17:25:33 -0500 Subject: [PATCH 0201/1057] fix compiler warning --- src/switch_core_media_bug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index a320d9a345..3d5c26b531 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -183,6 +183,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b bytes = read_impl.decoded_bytes_per_packet; +#ifdef TESTINGONLY if (0 && bug->session->recur_buffer_len) { frame->datalen = bug->session->recur_buffer_len; frame->samples = bug->session->recur_buffer_len / sizeof(int16_t); @@ -191,6 +192,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b memcpy(frame->data, bug->session->recur_buffer, bug->session->recur_buffer_len); return SWITCH_STATUS_SUCCESS; } +#endif if (frame->buflen < bytes) { From 581e04c4f0d89f8b6f9dbbcead1d09872ea66ca1 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 22:28:33 +0000 Subject: [PATCH 0202/1057] tagscript: improve formatting of commits and tags --- scripts/tagscript.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 920d312d65..30222641a6 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -119,7 +119,7 @@ set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" echo "Committing the new version..." >&2 git add configure.in -if ! (git commit --allow-empty -m "release freeswitch-$gver"); then +if ! (git commit --allow-empty -m "release FreeSWITCH $gver"); then cat >&2 <&2 -if ! (git tag -a ${opts} -m "freeswitch-$gver release" "v$gver"); then +if ! (git tag -a ${opts} -m "FreeSWITCH $gver" "v$gver"); then cat >&2 < Date: Mon, 7 May 2012 22:39:39 +0000 Subject: [PATCH 0203/1057] ci: fix 20ac9757ba --- scripts/ci/debsrcbuilder.sh | 2 +- scripts/ci/rpmbuilder.sh | 2 +- scripts/ci/sounds-en-us-callie.sh | 2 +- scripts/ci/src_tarball.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index e5e429b153..70aceeeee0 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -6,7 +6,7 @@ sdir="." . $sdir/common.sh check_pwd -check_input_ver_build +check_input_ver_build $@ eval $(parse_version "$1") datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 563bfca104..78c4c3ca73 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -6,7 +6,7 @@ sdir="." . $sdir/common.sh check_pwd -check_input_ver_build +check_input_ver_build $@ eval $(parse_version "$1") build="$2" diff --git a/scripts/ci/sounds-en-us-callie.sh b/scripts/ci/sounds-en-us-callie.sh index 6b3b0df0a6..32fbc0a400 100755 --- a/scripts/ci/sounds-en-us-callie.sh +++ b/scripts/ci/sounds-en-us-callie.sh @@ -6,7 +6,7 @@ sdir="." . $sdir/common.sh check_pwd -check_input_ver_build +check_input_ver_build $@ eval $(parse_version "$1") build="$2" diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index d4c3adffa7..826b8a27b7 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -6,7 +6,7 @@ sdir="." . $sdir/common.sh check_pwd -check_input_ver_build +check_input_ver_build $@ eval $(parse_version "$1") dst_name="freeswitch-$cmajor.$cminor.$cmicro" From 0553518f678fe62bff0270fb03ad8a3f42723cf6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 22:52:48 +0000 Subject: [PATCH 0204/1057] ci/debian: accept the codename for which we are packaging --- debian/bootstrap.sh | 10 ++++++++++ scripts/ci/debsrcbuilder.sh | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index c13bbbb92e..2ee3bb8efc 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -788,6 +788,16 @@ genmodctl_mod () { echo } +codename="sid" +while getopts "r:" o; do + case "$o" in + r) codename="$OPTARG" ;; + esac +done +shift $(($OPTIND-1)) + +echo "Bootstrapping debian/ for ${codename}" >&2 +echo >&2 echo "Please wait, this takes a few seconds..." >&2 parse_dir=control-modules.parse diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 70aceeeee0..4e0d5aad57 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -12,6 +12,7 @@ datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" build="b$2" distro=${3:="unstable"} +codename=${4:="sid"} fver="${ver}~${nightly}~${build}" fname="freeswitch-$fver" @@ -58,13 +59,13 @@ echo "Compressing $orig.tar with xz -6..." >&2 xz -6 $orig.tar cd $bdir -(cd debian && ./bootstrap.sh) +(cd debian && ./bootstrap.sh -c "$codename") # dch can't handle comments in control file (cd debian; \ mv control control.orig; \ grep -e '^#' -v control.orig > control) # dependency: libparse-debcontrol-perl -dch -b -v "${fver}-1" \ +dch -b -v "${fver}-1~${codename}+1" \ -M --force-distribution -D "$distro" \ "Nightly build at ${datestamp}." # dependency: fakeroot From 5c18656a9133843a5b775945d0c4e712dff4061e Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 23:32:09 +0000 Subject: [PATCH 0205/1057] debian: build different sets of modules based on the debian codename --- debian/bootstrap.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 2ee3bb8efc..16848e3ddd 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -30,14 +30,16 @@ avoid_mods=( event_handlers/mod_snmp formats/mod_portaudio_stream formats/mod_shout - formats/mod_vlc languages/mod_java languages/mod_managed - languages/mod_spidermonkey languages/mod_yaml sdk/autotools xml_int/mod_xml_ldap ) +avoid_mods_squeeze=( + formats/mod_vlc + languages/mod_spidermonkey +) err () { echo "$0 error: $1" >&2 @@ -54,7 +56,8 @@ xread () { } avoid_mod_filter () { - for x in "${avoid_mods[@]}"; do + local mods=("$(eval echo \${avoid_mods_$codename[@]})" "${avoid_mods[@]}") + for x in "${mods[@]}"; do [ "$1" = "$x" ] && return 1 done return 0 From bc2783effdf63309003fba0b34cd2ff4f4f67e45 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 7 May 2012 23:45:38 +0000 Subject: [PATCH 0206/1057] ci: fix up variadic invocation --- scripts/ci/debsrcbuilder.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 4e0d5aad57..d693777500 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -10,9 +10,9 @@ check_input_ver_build $@ eval $(parse_version "$1") datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" -build="b$2" -distro=${3:="unstable"} -codename=${4:="sid"} +build="b${2-0}" +distro="${3-unstable}" +codename="${4-sid}" fver="${ver}~${nightly}~${build}" fname="freeswitch-$fver" From a1177a79941d2d667c6c399199c9ff2f6f1cbfb0 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 8 May 2012 00:02:56 -0500 Subject: [PATCH 0207/1057] release FreeSWITCH 1.2-rc1 --- configure.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index f6d2e091ef..7b76740d62 100644 --- a/configure.in +++ b/configure.in @@ -3,11 +3,11 @@ # Must change all of the below together # For a release, set revision for that tagged release as well and uncomment -AC_INIT([freeswitch], [1.1.beta1], BUG-REPORT-ADDRESS) +AC_INIT([freeswitch], [1.2-rc1], BUG-REPORT-ADDRESS) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) -AC_SUBST(SWITCH_VERSION_MINOR, [1]) -AC_SUBST(SWITCH_VERSION_MICRO, [beta1]) -#AC_SUBST(SWITCH_VERSION_REVISION, []) +AC_SUBST(SWITCH_VERSION_MINOR, [2]) +AC_SUBST(SWITCH_VERSION_MICRO, [0]) +AC_SUBST(SWITCH_VERSION_REVISION, [-rc1]) AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template]) AC_CONFIG_FILES([.version:.version.in]) From c5b6166538cbece8727e1d45c08461f66e80f202 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 14:34:47 +0000 Subject: [PATCH 0208/1057] debian: fix use of bash arrays and display excludes/includes --- debian/bootstrap.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 242e2cb9c4..947388e632 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -56,16 +56,23 @@ xread () { } avoid_mod_filter () { - local mods=("$(eval echo \${avoid_mods_$codename[@]})" "${avoid_mods[@]}") + local x="avoid_mods_$codename[@]" + local -a mods=("${avoid_mods[@]}" "${!x}") for x in "${mods[@]}"; do - [ "$1" = "$x" ] && return 1 + if [ "$1" = "$x" ]; then + [ "$2" = "show" ] && echo "excluding module $x" >&2 + return 1 + fi done return 0 } modconf_filter () { - while xread line; do - [ "$1" = "$line" ] && return 0 + while xread l; do + if [ "$1" = "$l" ]; then + [ "$2" = "show" ] && echo "including module $l" >&2 + return 0 + fi done < modules.conf return 1 } @@ -78,6 +85,10 @@ mod_filter () { fi } +mod_filter_show () { + mod_filter "$1" show +} + map_fs_modules () { local filterfn="$1" percatfns="$2" permodfns="$3" for x in $mod_dir/*; do @@ -806,6 +817,7 @@ echo "Please wait, this takes a few seconds..." >&2 parse_dir=control-modules.parse map_fs_modules ':' 'genmodctl_new_cat' 'genmodctl_new_mod' >> control-modules parse_mod_control +map_modules 'mod_filter_show' '' '' (echo "# -*- mode:debian-control -*-"; echo; \ map_modules ':' 'genmodctl_cat' 'genmodctl_mod' \ ) > control-modules.gen From 1edf94b5d9624aa4d28b3c6a21d2ef15f54b0c1c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 14:43:26 +0000 Subject: [PATCH 0209/1057] debian: add progress output to bootstrap --- debian/bootstrap.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 947388e632..acb63dcd67 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -814,31 +814,42 @@ echo "Bootstrapping debian/ for ${codename}" >&2 echo >&2 echo "Please wait, this takes a few seconds..." >&2 +echo "Adding any new modules to control-modules..." >&2 parse_dir=control-modules.parse map_fs_modules ':' 'genmodctl_new_cat' 'genmodctl_new_mod' >> control-modules +echo "Parsing control-modules..." >&2 parse_mod_control +echo "Displaying includes/excludes..." >&2 map_modules 'mod_filter_show' '' '' +echo "Generating control-modules.gen as sanity check..." >&2 (echo "# -*- mode:debian-control -*-"; echo; \ map_modules ':' 'genmodctl_cat' 'genmodctl_mod' \ ) > control-modules.gen -print_edit_warning > modules_.conf +echo "Accumulating build dependencies from modules..." >&2 map_modules 'mod_filter' '' 'accumulate_build_depends' +echo "Generating debian/..." >&2 > control (print_edit_warning; print_source_control; print_core_control) >> control +echo "Generating debian/ (music)..." >&2 for r in 8000 16000 32000 48000; do genmusic $r; done +echo "Generating debian/ (sounds)..." >&2 for x in 'en/us/callie'; do for r in 8000 16000 32000 48000; do gensound $r $x done done +echo "Generating debian/ (conf)..." >&2 (echo "### conf"; echo) >> control map_confs 'genconf' +echo "Generating debian/ (modules)..." >&2 (echo "### modules"; echo) >> control +print_edit_warning > modules_.conf map_modules "mod_filter" \ "gencontrol_per_cat genmodules_per_cat" \ "gencontrol_per_mod geninstall_per_mod genoverrides_per_mod genmodules_per_mod" +echo "Generating additional lintian overrides..." >&2 grep -e '^Package:' control | while xread l; do m="${l#*: }" f=$m.lintian-overrides @@ -851,4 +862,5 @@ f=freeswitch.lintian-overrides [ -s $f ] || print_edit_warning >> $f print_gpl_openssl_override "freeswitch" >> $f +echo "Done bootstrapping debian/" >&2 touch .stamp-bootstrap From 024e5fdefd9bbcc9e2abe6abc170b428399ac392 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 07:41:10 -0500 Subject: [PATCH 0210/1057] FS-4196 --resolve --- src/include/switch_ivr.h | 9 + src/mod/event_handlers/mod_json_cdr/Makefile | 23 - .../mod_json_cdr/mod_json_cdr.c | 435 +----------------- src/switch_ivr.c | 254 ++++++++++ 4 files changed, 270 insertions(+), 451 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index ef5155512c..9d3d5f2ea5 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -41,6 +41,7 @@ #define SWITCH_IVR_H #include +#include "switch_json.h" SWITCH_BEGIN_EXTERN_C struct switch_unicast_conninfo { switch_core_session_t *session; @@ -82,6 +83,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_ char *local_ip, switch_port_t local_port, char *remote_ip, switch_port_t remote_port, char *transport, char *flags); +/*! + \brief Generate an JSON CDR report. + \param session the session to get the data from. + \param json_cdr pointer to the json object + \return SWITCH_STATUS_SUCCESS if successful + \note on success the json object must be freed +*/ +SWITCH_DECLARE(switch_status_t) switch_ivr_generate_json_cdr(switch_core_session_t *session, cJSON **json_cdr, switch_bool_t urlencode); /*! \brief Generate an XML CDR report. diff --git a/src/mod/event_handlers/mod_json_cdr/Makefile b/src/mod/event_handlers/mod_json_cdr/Makefile index 0620c7df63..c9dfa5399e 100644 --- a/src/mod/event_handlers/mod_json_cdr/Makefile +++ b/src/mod/event_handlers/mod_json_cdr/Makefile @@ -1,27 +1,4 @@ -json-c=json-c-0.9 BASE=../../../.. - -JSON_DIR=$(switch_srcdir)/libs/$(json-c) -JSON_BUILDDIR=$(switch_builddir)/libs/$(json-c) - -JSONLA=$(JSON_BUILDDIR)/libjson.la - -LOCAL_CFLAGS=-I$(JSON_DIR) -LOCAL_LIBADD=$(JSONLA) - include $(BASE)/build/modmake.rules -$(JSON_DIR): - $(GETLIB) $(json-c).tar.gz - -$(JSON_BUILDDIR)/Makefile: $(JSON_DIR) - mkdir -p $(JSON_BUILDDIR) - cd $(JSON_BUILDDIR) && $(DEFAULT_VARS) $(JSON_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(JSON_DIR) CPPFLAGS= LDFLAGS= - $(TOUCH_TARGET) - -$(JSONLA): $(JSON_BUILDDIR)/Makefile - cd $(JSON_BUILDDIR) && $(MAKE) - $(TOUCH_TARGET) - - diff --git a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c index 92a51c65cb..36626461a5 100644 --- a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c +++ b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c @@ -33,7 +33,6 @@ #include #include #include -#include #define MAX_URLS 20 #define MAX_ERR_DIRS 20 @@ -181,432 +180,11 @@ static switch_status_t set_json_cdr_log_dirs() return status; } -#define json_object_safe_new_string(str) json_object_new_string(str ? str : "") -#define JSON_ENSURE_SUCCESS(obj) if (is_error(obj)) { return; } -static void set_json_profile_data(struct json_object *json, switch_caller_profile_t *caller_profile) -{ - struct json_object *param = NULL; - - param = json_object_safe_new_string((char *)caller_profile->username); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "username", param); - - param = json_object_safe_new_string((char *)caller_profile->dialplan); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "dialplan", param); - - param = json_object_safe_new_string((char *)caller_profile->caller_id_name); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "caller_id_name", param); - - param = json_object_safe_new_string((char *)caller_profile->ani); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "ani", param); - - param = json_object_safe_new_string((char *)caller_profile->aniii); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "aniii", param); - - param = json_object_safe_new_string((char *)caller_profile->caller_id_number); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "caller_id_number", param); - - param = json_object_safe_new_string((char *)caller_profile->network_addr); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "network_addr", param); - - param = json_object_safe_new_string((char *)caller_profile->rdnis); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "rdnis", param); - - param = json_object_safe_new_string(caller_profile->destination_number); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "destination_number", param); - - param = json_object_safe_new_string(caller_profile->uuid); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "uuid", param); - - param = json_object_safe_new_string((char *)caller_profile->source); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "source", param); - - param = json_object_safe_new_string((char *)caller_profile->context); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "context", param); - - param = json_object_safe_new_string(caller_profile->chan_name); - JSON_ENSURE_SUCCESS(param); - json_object_object_add(json, "chan_name", param); - -} - -static void set_json_chan_vars(struct json_object *json, switch_channel_t *channel) -{ - struct json_object *variable = NULL; - switch_event_header_t *hi = switch_channel_variable_first(channel); - - if (!hi) - return; - - for (; hi; hi = hi->next) { - if (!zstr(hi->name) && !zstr(hi->value)) { - char *data = hi->value; - if (globals.encode_values == ENCODING_DEFAULT) { - switch_size_t dlen = strlen(hi->value) * 3; - - if ((data = malloc(dlen))) { - memset(data, 0, dlen); - switch_url_encode(hi->value, data, dlen); - } - } - - variable = json_object_safe_new_string(data); - if (!is_error(variable)) { - json_object_object_add(json, hi->name, variable); - } - - if (data != hi->value) { - switch_safe_free(data); - } - } - } - switch_channel_variable_last(channel); -} - - - -static switch_status_t generate_json_cdr(switch_core_session_t *session, struct json_object **json_cdr) -{ - - struct json_object *cdr = json_object_new_object(); - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_caller_profile_t *caller_profile; - struct json_object *variables, *j_main_cp, *j_caller_profile, *j_caller_extension, *j_times, *time_tag, - *j_application, *j_callflow, *j_inner_extension, *j_apps, *j_o, *j_channel_data, *j_field; - switch_app_log_t *app_log; - char tmp[512], *f; - - if (is_error(cdr)) { - return SWITCH_STATUS_FALSE; - } - - j_channel_data = json_object_new_object(); - if (is_error(j_channel_data)) { - goto error; - } - json_object_object_add(cdr, "channel_data", j_channel_data); - - - j_field = json_object_safe_new_string((char *) switch_channel_state_name(switch_channel_get_state(channel))); - json_object_object_add(j_channel_data, "state", j_field); - - j_field = json_object_safe_new_string(switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"); - - json_object_object_add(j_channel_data, "direction", j_field); - - - switch_snprintf(tmp, sizeof(tmp), "%d", switch_channel_get_state(channel)); - j_field = json_object_new_string((char *) tmp); - json_object_object_add(j_channel_data, "state_number", j_field); - - - if ((f = switch_channel_get_flag_string(channel))) { - j_field = json_object_safe_new_string((char *) f); - json_object_object_add(j_channel_data, "flags", j_field); - free(f); - } - - if ((f = switch_channel_get_cap_string(channel))) { - j_field = json_object_safe_new_string((char *) f); - json_object_object_add(j_channel_data, "caps", j_field); - free(f); - } - - - variables = json_object_new_object(); - json_object_object_add(cdr, "variables", variables); - - if (is_error(variables)) { - goto error; - } - - set_json_chan_vars(variables, channel); - - - if ((app_log = switch_core_session_get_app_log(session))) { - switch_app_log_t *ap; - - j_apps = json_object_new_object(); - - if (is_error(j_apps)) { - goto error; - } - - json_object_object_add(cdr, "app_log", j_apps); - - for (ap = app_log; ap; ap = ap->next) { - j_application = json_object_new_object(); - - if (is_error(j_application)) { - goto error; - } - - json_object_object_add(j_application, "app_name", json_object_safe_new_string(ap->app)); - json_object_object_add(j_application, "app_data", json_object_safe_new_string(ap->arg)); - - json_object_object_add(j_apps, "application", j_application); - } - } - - - caller_profile = switch_channel_get_caller_profile(channel); - - while (caller_profile) { - - j_callflow = json_object_new_object(); - - if (is_error(j_callflow)) { - goto error; - } - - json_object_object_add(cdr, "callflow", j_callflow); - - if (!zstr(caller_profile->dialplan)) { - json_object_object_add(j_callflow, "dialplan", json_object_safe_new_string((char *)caller_profile->dialplan)); - } - - if (!zstr(caller_profile->profile_index)) { - json_object_object_add(j_callflow, "profile_index", json_object_safe_new_string((char *)caller_profile->profile_index)); - } - - if (caller_profile->caller_extension) { - switch_caller_application_t *ap; - - j_caller_extension = json_object_new_object(); - - if (is_error(j_caller_extension)) { - goto error; - } - - json_object_object_add(j_callflow, "extension", j_caller_extension); - - json_object_object_add(j_caller_extension, "name", json_object_safe_new_string(caller_profile->caller_extension->extension_name)); - json_object_object_add(j_caller_extension, "number", json_object_safe_new_string(caller_profile->caller_extension->extension_number)); - - if (caller_profile->caller_extension->current_application) { - json_object_object_add(j_caller_extension, "current_app", json_object_safe_new_string(caller_profile->caller_extension->current_application->application_name)); - } - - for (ap = caller_profile->caller_extension->applications; ap; ap = ap->next) { - j_application = json_object_new_object(); - - if (is_error(j_application)) { - goto error; - } - - - json_object_object_add(j_caller_extension, "application", j_application); - - if (ap == caller_profile->caller_extension->current_application) { - json_object_object_add(j_application, "last_executed", json_object_new_string("true")); - } - json_object_object_add(j_application, "app_name", json_object_safe_new_string(ap->application_name)); - json_object_object_add(j_application, "app_data", json_object_safe_new_string(switch_str_nil(ap->application_data))); - } - - if (caller_profile->caller_extension->children) { - switch_caller_profile_t *cp = NULL; - for (cp = caller_profile->caller_extension->children; cp; cp = cp->next) { - - if (!cp->caller_extension) { - continue; - } - - j_inner_extension = json_object_new_object(); - if (is_error(j_inner_extension)) { - goto error; - } - - json_object_object_add(j_caller_extension, "sub_extensions", j_inner_extension); - - - j_caller_extension = json_object_new_object(); - if (is_error(j_caller_extension)) { - goto error; - } - - json_object_object_add(j_inner_extension, "extension", j_caller_extension); - - json_object_object_add(j_caller_extension, "name", json_object_safe_new_string(cp->caller_extension->extension_name)); - json_object_object_add(j_caller_extension, "number", json_object_safe_new_string(cp->caller_extension->extension_number)); - - json_object_object_add(j_caller_extension, "dialplan", json_object_safe_new_string((char *)cp->dialplan)); - - if (cp->caller_extension->current_application) { - json_object_object_add(j_caller_extension, "current_app", json_object_safe_new_string(cp->caller_extension->current_application->application_name)); - } - - for (ap = cp->caller_extension->applications; ap; ap = ap->next) { - j_application = json_object_new_object(); - - if (is_error(j_application)) { - goto error; - } - json_object_object_add(j_caller_extension, "application", j_application); - - if (ap == cp->caller_extension->current_application) { - json_object_object_add(j_application, "last_executed", json_object_new_string("true")); - } - json_object_object_add(j_application, "app_name", json_object_safe_new_string(ap->application_name)); - json_object_object_add(j_application, "app_data", json_object_safe_new_string(switch_str_nil(ap->application_data))); - } - } - } - } - - j_main_cp = json_object_new_object(); - if (is_error(j_main_cp)) { - goto error; - } - - json_object_object_add(j_callflow, "caller_profile", j_main_cp); - - set_json_profile_data(j_main_cp, caller_profile); - - if (caller_profile->originator_caller_profile) { - switch_caller_profile_t *cp = NULL; - - j_o = json_object_new_object(); - if (is_error(j_o)) { - goto error; - } - - json_object_object_add(j_main_cp, "originator", j_o); - - for (cp = caller_profile->originator_caller_profile; cp; cp = cp->next) { - j_caller_profile = json_object_new_object(); - if (is_error(j_caller_profile)) { - goto error; - } - - json_object_object_add(j_o, "originator_caller_profile", j_caller_profile); - - set_json_profile_data(j_caller_profile, cp); - } - } - - if (caller_profile->originatee_caller_profile) { - switch_caller_profile_t *cp = NULL; - - j_o = json_object_new_object(); - if (is_error(j_o)) { - goto error; - } - - json_object_object_add(j_main_cp, "originatee", j_o); - - for (cp = caller_profile->originatee_caller_profile; cp; cp = cp->next) { - - j_caller_profile = json_object_new_object(); - if (is_error(j_caller_profile)) { - goto error; - } - - json_object_object_add(j_o, "originatee_caller_profile", j_caller_profile); - set_json_profile_data(j_caller_profile, cp); - } - } - - if (caller_profile->times) { - - j_times = json_object_new_object(); - if (is_error(j_times)) { - goto error; - } - - json_object_object_add(j_callflow, "times", j_times); - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "created_time", time_tag); - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "profile_created_time", time_tag); - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "progress_time", time_tag); - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "progress_media_time", time_tag); - - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "answered_time", time_tag); - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "hangup_time", time_tag); - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->resurrected); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "resurrect_time", time_tag); - - switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred); - time_tag = json_object_new_string(tmp); - if (is_error(time_tag)) { - goto error; - } - json_object_object_add(j_times, "transfer_time", time_tag); - - } - - caller_profile = caller_profile->next; - } - - *json_cdr = cdr; - - return SWITCH_STATUS_SUCCESS; - - error: - - if (cdr) { - json_object_put(cdr); - } - - return SWITCH_STATUS_FALSE; -} - static switch_status_t my_on_reporting(switch_core_session_t *session) { - struct json_object *json_cdr = NULL; - const char *json_text = NULL; + cJSON *json_cdr = NULL; + char *json_text = NULL; char *path = NULL; char *curl_json_text = NULL; const char *logdir = NULL; @@ -637,12 +215,12 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) a_prefix = "a_"; - if (generate_json_cdr(session, &json_cdr) != SWITCH_STATUS_SUCCESS) { + if (switch_ivr_generate_json_cdr(session, &json_cdr, globals.encode_values == ENCODING_DEFAULT) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n"); return SWITCH_STATUS_FALSE; } - json_text = json_object_to_json_string(json_cdr); + json_text = cJSON_PrintUnformatted(json_cdr); if (!json_text) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); @@ -705,6 +283,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_b64_encode((unsigned char *) json_text, need_bytes / 3, (unsigned char *) json_text_escaped, need_bytes); } + switch_safe_free(json_text); json_text = json_text_escaped; if (!(curl_json_text = switch_mprintf("cdr=%s", json_text))) { @@ -861,8 +440,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_safe_free(curl_json_text); } - json_object_put(json_cdr); - switch_safe_free(json_text_escaped); + cJSON_Delete(json_cdr); + switch_safe_free(json_text); return status; } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 432bb9edc6..7a24eff193 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2472,6 +2472,260 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ return SWITCH_STATUS_FALSE; } +static void switch_ivr_set_json_profile_data(cJSON *json, switch_caller_profile_t *caller_profile) +{ + cJSON_AddItemToObject(json, "username", cJSON_CreateString((char *)caller_profile->username)); + cJSON_AddItemToObject(json, "dialplan", cJSON_CreateString((char *)caller_profile->dialplan)); + cJSON_AddItemToObject(json, "caller_id_name", cJSON_CreateString((char *)caller_profile->caller_id_name)); + cJSON_AddItemToObject(json, "ani", cJSON_CreateString((char *)caller_profile->ani)); + cJSON_AddItemToObject(json, "aniii", cJSON_CreateString((char *)caller_profile->aniii)); + cJSON_AddItemToObject(json, "caller_id_number", cJSON_CreateString((char *)caller_profile->caller_id_number)); + cJSON_AddItemToObject(json, "network_addr", cJSON_CreateString((char *)caller_profile->network_addr)); + cJSON_AddItemToObject(json, "rdnis", cJSON_CreateString((char *)caller_profile->rdnis)); + cJSON_AddItemToObject(json, "destination_number", cJSON_CreateString(caller_profile->destination_number)); + cJSON_AddItemToObject(json, "uuid", cJSON_CreateString(caller_profile->uuid)); + cJSON_AddItemToObject(json, "source", cJSON_CreateString((char *)caller_profile->source)); + cJSON_AddItemToObject(json, "context", cJSON_CreateString((char *)caller_profile->context)); + cJSON_AddItemToObject(json, "chan_name", cJSON_CreateString(caller_profile->chan_name)); +} + +static void switch_ivr_set_json_chan_vars(cJSON *json, switch_channel_t *channel, switch_bool_t urlencode) +{ + switch_event_header_t *hi = switch_channel_variable_first(channel); + + if (!hi) + return; + + for (; hi; hi = hi->next) { + if (!zstr(hi->name) && !zstr(hi->value)) { + char *data = hi->value; + if (urlencode) { + switch_size_t dlen = strlen(hi->value) * 3; + + if ((data = malloc(dlen))) { + memset(data, 0, dlen); + switch_url_encode(hi->value, data, dlen); + } + } + + cJSON_AddItemToObject(json, hi->name, cJSON_CreateString(data)); + + if (data != hi->value) { + switch_safe_free(data); + } + } + } + switch_channel_variable_last(channel); +} + + + +SWITCH_DECLARE(switch_status_t) switch_ivr_generate_json_cdr(switch_core_session_t *session, cJSON **json_cdr, switch_bool_t urlencode) +{ + cJSON *cdr = cJSON_CreateObject(); + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_caller_profile_t *caller_profile; + cJSON *variables, *j_main_cp, *j_caller_profile, *j_caller_extension, *j_times, + *j_application, *j_callflow, *j_inner_extension, *j_apps, *j_o, *j_channel_data; + switch_app_log_t *app_log; + char tmp[512], *f; + + j_channel_data = cJSON_CreateObject(); + + cJSON_AddItemToObject(cdr, "channel_data", j_channel_data); + + cJSON_AddItemToObject(j_channel_data, "state", cJSON_CreateString((char *) switch_channel_state_name(switch_channel_get_state(channel)))); + cJSON_AddItemToObject(j_channel_data, "direction", cJSON_CreateString(switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound")); + + switch_snprintf(tmp, sizeof(tmp), "%d", switch_channel_get_state(channel)); + cJSON_AddItemToObject(j_channel_data, "state_number", cJSON_CreateString((char *) tmp)); + + if ((f = switch_channel_get_flag_string(channel))) { + cJSON_AddItemToObject(j_channel_data, "flags", cJSON_CreateString((char *) f)); + free(f); + } + + if ((f = switch_channel_get_cap_string(channel))) { + cJSON_AddItemToObject(j_channel_data, "caps", cJSON_CreateString((char *) f)); + free(f); + } + + variables = cJSON_CreateObject(); + cJSON_AddItemToObject(cdr, "variables", variables); + + switch_ivr_set_json_chan_vars(variables, channel, urlencode); + + + if ((app_log = switch_core_session_get_app_log(session))) { + switch_app_log_t *ap; + + j_apps = cJSON_CreateObject(); + + cJSON_AddItemToObject(cdr, "app_log", j_apps); + + for (ap = app_log; ap; ap = ap->next) { + j_application = cJSON_CreateObject(); + + cJSON_AddItemToObject(j_application, "app_name", cJSON_CreateString(ap->app)); + cJSON_AddItemToObject(j_application, "app_data", cJSON_CreateString(ap->arg)); + + cJSON_AddItemToObject(j_apps, "application", j_application); + } + } + + + caller_profile = switch_channel_get_caller_profile(channel); + + while (caller_profile) { + + j_callflow = cJSON_CreateObject(); + + cJSON_AddItemToObject(cdr, "callflow", j_callflow); + + if (!zstr(caller_profile->dialplan)) { + cJSON_AddItemToObject(j_callflow, "dialplan", cJSON_CreateString((char *)caller_profile->dialplan)); + } + + if (!zstr(caller_profile->profile_index)) { + cJSON_AddItemToObject(j_callflow, "profile_index", cJSON_CreateString((char *)caller_profile->profile_index)); + } + + if (caller_profile->caller_extension) { + switch_caller_application_t *ap; + + j_caller_extension = cJSON_CreateObject(); + + cJSON_AddItemToObject(j_callflow, "extension", j_caller_extension); + + cJSON_AddItemToObject(j_caller_extension, "name", cJSON_CreateString(caller_profile->caller_extension->extension_name)); + cJSON_AddItemToObject(j_caller_extension, "number", cJSON_CreateString(caller_profile->caller_extension->extension_number)); + + if (caller_profile->caller_extension->current_application) { + cJSON_AddItemToObject(j_caller_extension, "current_app", cJSON_CreateString(caller_profile->caller_extension->current_application->application_name)); + } + + for (ap = caller_profile->caller_extension->applications; ap; ap = ap->next) { + j_application = cJSON_CreateObject(); + + cJSON_AddItemToObject(j_caller_extension, "application", j_application); + + if (ap == caller_profile->caller_extension->current_application) { + cJSON_AddItemToObject(j_application, "last_executed", cJSON_CreateString("true")); + } + cJSON_AddItemToObject(j_application, "app_name", cJSON_CreateString(ap->application_name)); + cJSON_AddItemToObject(j_application, "app_data", cJSON_CreateString(switch_str_nil(ap->application_data))); + } + + if (caller_profile->caller_extension->children) { + switch_caller_profile_t *cp = NULL; + for (cp = caller_profile->caller_extension->children; cp; cp = cp->next) { + + if (!cp->caller_extension) { + continue; + } + + j_inner_extension = cJSON_CreateObject(); + cJSON_AddItemToObject(j_caller_extension, "sub_extensions", j_inner_extension); + + j_caller_extension = cJSON_CreateObject(); + cJSON_AddItemToObject(j_inner_extension, "extension", j_caller_extension); + + cJSON_AddItemToObject(j_caller_extension, "name", cJSON_CreateString(cp->caller_extension->extension_name)); + cJSON_AddItemToObject(j_caller_extension, "number", cJSON_CreateString(cp->caller_extension->extension_number)); + + cJSON_AddItemToObject(j_caller_extension, "dialplan", cJSON_CreateString((char *)cp->dialplan)); + + if (cp->caller_extension->current_application) { + cJSON_AddItemToObject(j_caller_extension, "current_app", cJSON_CreateString(cp->caller_extension->current_application->application_name)); + } + + for (ap = cp->caller_extension->applications; ap; ap = ap->next) { + j_application = cJSON_CreateObject(); + cJSON_AddItemToObject(j_caller_extension, "application", j_application); + + if (ap == cp->caller_extension->current_application) { + cJSON_AddItemToObject(j_application, "last_executed", cJSON_CreateString("true")); + } + cJSON_AddItemToObject(j_application, "app_name", cJSON_CreateString(ap->application_name)); + cJSON_AddItemToObject(j_application, "app_data", cJSON_CreateString(switch_str_nil(ap->application_data))); + } + } + } + } + + j_main_cp = cJSON_CreateObject(); + cJSON_AddItemToObject(j_callflow, "caller_profile", j_main_cp); + + switch_ivr_set_json_profile_data(j_main_cp, caller_profile); + + if (caller_profile->originator_caller_profile) { + switch_caller_profile_t *cp = NULL; + + j_o = cJSON_CreateObject(); + cJSON_AddItemToObject(j_main_cp, "originator", j_o); + + for (cp = caller_profile->originator_caller_profile; cp; cp = cp->next) { + j_caller_profile = cJSON_CreateObject(); + cJSON_AddItemToObject(j_o, "originator_caller_profile", j_caller_profile); + + switch_ivr_set_json_profile_data(j_caller_profile, cp); + } + } + + if (caller_profile->originatee_caller_profile) { + switch_caller_profile_t *cp = NULL; + + j_o = cJSON_CreateObject(); + cJSON_AddItemToObject(j_main_cp, "originatee", j_o); + + for (cp = caller_profile->originatee_caller_profile; cp; cp = cp->next) { + j_caller_profile = cJSON_CreateObject(); + cJSON_AddItemToObject(j_o, "originatee_caller_profile", j_caller_profile); + switch_ivr_set_json_profile_data(j_caller_profile, cp); + } + } + + if (caller_profile->times) { + + j_times = cJSON_CreateObject(); + cJSON_AddItemToObject(j_callflow, "times", j_times); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created); + cJSON_AddItemToObject(j_times, "created_time", cJSON_CreateString(tmp)); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created); + cJSON_AddItemToObject(j_times, "profile_created_time", cJSON_CreateString(tmp)); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress); + cJSON_AddItemToObject(j_times, "progress_time", cJSON_CreateString(tmp)); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media); + cJSON_AddItemToObject(j_times, "progress_media_time", cJSON_CreateString(tmp)); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered); + cJSON_AddItemToObject(j_times, "answered_time", cJSON_CreateString(tmp)); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup); + cJSON_AddItemToObject(j_times, "hangup_time", cJSON_CreateString(tmp)); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->resurrected); + cJSON_AddItemToObject(j_times, "resurrect_time", cJSON_CreateString(tmp)); + + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred); + cJSON_AddItemToObject(j_times, "transfer_time", cJSON_CreateString(tmp)); + + } + + caller_profile = caller_profile->next; + } + + *json_cdr = cdr; + + return SWITCH_STATUS_SUCCESS; + +} + + SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); From 1fc57f98285d866b1f305889f060ae38018cf57f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 07:43:01 -0500 Subject: [PATCH 0211/1057] FS-4198 --resolve --- src/include/switch_types.h | 1 + src/switch_ivr_bridge.c | 42 ++++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 5fda9c369e..edd630ffcb 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -131,6 +131,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_READ_RESULT_VARIABLE "read_result" #define SWITCH_ATT_XFER_RESULT_VARIABLE "att_xfer_result" #define SWITCH_COPY_XML_CDR_VARIABLE "copy_xml_cdr" +#define SWITCH_COPY_JSON_CDR_VARIABLE "copy_json_cdr" #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause" #define SWITCH_TRANSFER_HISTORY_VARIABLE "transfer_history" diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 8025c9d01c..b2cd384098 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1366,21 +1366,41 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE, switch_channel_cause2str(cause)); } - if (switch_channel_down_nosig(peer_channel) && switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE))) { - switch_xml_t cdr = NULL; - char *xml_text; + if (switch_channel_down_nosig(peer_channel)) { + switch_bool_t copy_xml_cdr = switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE)); + switch_bool_t copy_json_cdr = switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_JSON_CDR_VARIABLE)); - switch_channel_wait_for_state(peer_channel, caller_channel, CS_DESTROY); + if (copy_xml_cdr || copy_json_cdr) { + char *cdr_text = NULL; - if (switch_ivr_generate_xml_cdr(peer_session, &cdr) == SWITCH_STATUS_SUCCESS) { - if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) { - switch_channel_set_variable(caller_channel, "b_leg_cdr", xml_text); - switch_safe_free(xml_text); + switch_channel_wait_for_state(peer_channel, caller_channel, CS_DESTROY); + + if (copy_xml_cdr) { + switch_xml_t cdr = NULL; + + if (switch_ivr_generate_xml_cdr(peer_session, &cdr) == SWITCH_STATUS_SUCCESS) { + cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE); + switch_xml_free(cdr); + } } - switch_xml_free(cdr); - } - } + if (copy_json_cdr) { + cJSON *cdr = NULL; + if (switch_ivr_generate_json_cdr(peer_session, &cdr, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + cdr_text = cJSON_PrintUnformatted(cdr); + cJSON_Delete(cdr); + } + } + + if (cdr_text) { + switch_channel_set_variable(caller_channel, "b_leg_cdr", cdr_text); + switch_channel_set_variable_name_printf(caller_channel, cdr_text, "b_leg_cdr_%s", switch_core_session_get_uuid(peer_session)); + switch_safe_free(cdr_text); + } + } + + } + switch_core_session_rwunlock(peer_session); } else { From 8ca2ed72b8fec56c43ce0cfee4cd98c98e37383c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 13:58:44 +0000 Subject: [PATCH 0212/1057] ci/debian: synchronize codename flag --- debian/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 16848e3ddd..242e2cb9c4 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -792,9 +792,9 @@ genmodctl_mod () { } codename="sid" -while getopts "r:" o; do +while getopts "c:" o; do case "$o" in - r) codename="$OPTARG" ;; + c) codename="$OPTARG" ;; esac done shift $(($OPTIND-1)) From eb92a4d22127e068624f813def702a5f03af980a Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 8 May 2012 10:06:35 -0500 Subject: [PATCH 0213/1057] small tweak to not bomb on some version numbers --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index c6e112c4b9..a752497dc8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -411,7 +411,7 @@ $(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool src/include/switch_version.h: src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS) @have_version=1 ; \ force=0 ; \ - grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null && have_version=0 ; \ + grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null && have_version=0 ; \ test ! -f src/include/switch_version.h || grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \ if test $$have_version = 1 ; then \ cat src/include/switch_version.h.in > src/include/switch_version.h ; \ From 2325dfbc4af50d59cdf3a9a21b8edf573eeac81c Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 8 May 2012 10:10:21 -0500 Subject: [PATCH 0214/1057] Missed a grep --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index a752497dc8..c3f3a2fc28 100644 --- a/Makefile.am +++ b/Makefile.am @@ -412,7 +412,7 @@ src/include/switch_version.h: src/include/switch_version.h.in .version $(libfree @have_version=1 ; \ force=0 ; \ grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null && have_version=0 ; \ - test ! -f src/include/switch_version.h || grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \ + test ! -f src/include/switch_version.h || grep -- "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \ if test $$have_version = 1 ; then \ cat src/include/switch_version.h.in > src/include/switch_version.h ; \ touch .version ; \ From 07204a1fb51fb949cd2be8592af17cf76060c02d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 08:50:33 -0500 Subject: [PATCH 0215/1057] add param:confirm-blind-transfer var:confirm_blind_transfer that makes blind transfers keep the transferrer on the line until its confirmed that the call was completed or brings it back to the bridge. blind_transfer_ack app can be executed in the dp by the transferee to indicate sucess or fail or a sucessful bridge will automatically trigger a success --- src/include/switch_types.h | 2 + .../applications/mod_dptools/mod_dptools.c | 30 +++++++++ src/mod/endpoints/mod_sofia/mod_sofia.c | 24 ++++++- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 67 +++++++++++++------ src/switch_core_session.c | 19 ++++++ src/switch_core_state_machine.c | 20 ++++++ 7 files changed, 143 insertions(+), 20 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index edd630ffcb..477aa3b877 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -887,6 +887,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_SIGNAL_DATA, SWITCH_MESSAGE_INDICATE_INFO, SWITCH_MESSAGE_INDICATE_AUDIO_DATA, + SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, SWITCH_MESSAGE_INVALID } switch_core_session_message_types_t; @@ -1216,6 +1217,7 @@ typedef enum { CF_ZRTP_PASS, CF_CHANNEL_SWAP, CF_PICKUP, + CF_CONFIRM_BLIND_TRANSFER, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 7005a701c5..8ae6e6f221 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -4462,6 +4462,34 @@ static char *file_string_supported_formats[SWITCH_MAX_CODECS] = { 0 }; /* /FILE STRING INTERFACE */ +SWITCH_STANDARD_APP(blind_transfer_ack_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_bool_t val = 0; + + if (data) { + val = switch_true((char *) val); + } + + if (switch_channel_test_flag(channel, CF_CONFIRM_BLIND_TRANSFER)) { + switch_core_session_t *other_session; + const char *uuid = switch_channel_get_variable(channel, "blind_transfer_uuid"); + + switch_channel_clear_flag(channel, CF_CONFIRM_BLIND_TRANSFER); + + if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) { + switch_core_session_message_t msg = { 0 }; + msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE; + msg.from = __FILE__; + msg.numeric_arg = val; + switch_core_session_receive_message(other_session, &msg); + switch_core_session_rwunlock(other_session); + } + } +} + + + #define SPEAK_DESC "Speak text to a channel via the tts interface" #define DISPLACE_DESC "Displace audio from a file to the channels input" @@ -4541,6 +4569,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, ""); SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, PRESENCE_USAGE); + SWITCH_ADD_APP(app_interface, "blind_transfer_ack", "", "", blind_transfer_ack_function, "[true|false]", SAF_NONE); + SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action", "bind a key sequence or regex to an action", bind_digit_action_function, BIND_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index a71dc4c714..620030164c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1653,6 +1653,28 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } goto end; + case SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE: + { + const char *event = switch_channel_get_variable(channel, "sip_blind_transfer_event"); + const char *uuid = switch_channel_get_variable(channel, "blind_transfer_uuid"); + char *xdest; + + if (event && uuid) { + nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), + NUTAG_SUBSTATE(nua_substate_terminated), + SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), + SIPTAG_PAYLOAD_STR(msg->numeric_arg ? "SIP/2.0 200 OK\r\n" : "SIP/2.0 403 Forbidden\r\n"), + SIPTAG_EVENT_STR(event), TAG_END()); + + + if (!msg->numeric_arg) { + xdest = switch_core_session_sprintf(session, "intercept:%s", uuid); + switch_ivr_session_transfer(session, xdest, "inline", NULL); + } + } + + } + goto end; case SWITCH_MESSAGE_INDICATE_UNBRIDGE: if (switch_rtp_ready(tech_pvt->rtp_session)) { @@ -5343,7 +5365,6 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor return status; } - SWITCH_STANDARD_APP(sofia_sla_function) { private_object_t *tech_pvt; @@ -5502,6 +5523,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) SWITCH_ADD_APP(app_interface, "sofia_sla", "private sofia sla function", "private sofia sla function", sofia_sla_function, "", SAF_NONE); + SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, " "); SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function, " [ivar|ovar|var] "); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index b66b29fb44..2da82ac0c2 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -264,6 +264,7 @@ typedef enum { PFLAG_PRESENCE_MAP, PFLAG_OPTIONS_RESPOND_503_ON_BUSY, PFLAG_PRESENCE_DISABLE_EARLY, + PFLAG_CONFIRM_BLIND_TRANSFER, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 26815b6f5e..f87e8581b0 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3105,6 +3105,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } + } else if (!strcasecmp(var, "confirm-blind-transfer")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER); + } else { + sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER); + } } else if (!strcasecmp(var, "presence-proto-lookup")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_MAP); @@ -3892,6 +3898,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } + } else if (!strcasecmp(var, "confirm-blind-transfer")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER); + } else { + sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER); + } } else if (!strcasecmp(var, "presence-proto-lookup")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_MAP); @@ -7093,37 +7105,54 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t if (exten) { switch_channel_t *channel = switch_core_session_get_channel(session); const char *br; + switch_core_session_t *b_session; - if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { - switch_core_session_t *b_session; + if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(br))) { - if ((b_session = switch_core_session_locate(br))) { - switch_channel_t *b_channel = switch_core_session_get_channel(b_session); - switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user); - if (!zstr(full_ref_by)) { - switch_channel_set_variable(b_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by); - } - if (!zstr(full_ref_to)) { - switch_channel_set_variable(b_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to); - } + const char *var; + switch_channel_t *b_channel = switch_core_session_get_channel(b_session); - if (switch_true(switch_channel_get_variable(channel, "recording_follow_transfer"))) { - switch_core_media_bug_transfer_recordings(session, b_session); - } + switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user); + if (!zstr(full_ref_by)) { + switch_channel_set_variable(b_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by); + } - switch_ivr_session_transfer(b_session, exten, NULL, NULL); - switch_core_session_rwunlock(b_session); + if (!zstr(full_ref_to)) { + switch_channel_set_variable(b_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to); + } + + if (switch_true(switch_channel_get_variable(channel, "recording_follow_transfer"))) { + switch_core_media_bug_transfer_recordings(session, b_session); } switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "BLIND_TRANSFER"); - nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), - NUTAG_SUBSTATE(nua_substate_terminated),SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END()); + + if (((var = switch_channel_get_variable(channel, "confirm_blind_transfer")) && switch_true(var)) || + sofia_test_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER)) { + switch_channel_set_state_flag(b_channel, CF_CONFIRM_BLIND_TRANSFER); + switch_channel_set_variable(channel, "sip_blind_transfer_event", etmp); + switch_channel_set_variable(b_channel, "blind_transfer_uuid", switch_core_session_get_uuid(session)); + switch_channel_set_variable(channel, "blind_transfer_uuid", switch_core_session_get_uuid(b_session)); + + switch_channel_set_variable(channel, "park_timeout", "600:blind_transfer"); + switch_channel_set_state(channel, CS_PARK); + } else { + nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), + NUTAG_SUBSTATE(nua_substate_terminated), + SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), + SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END()); + } + + switch_ivr_session_transfer(b_session, exten, NULL, NULL); + switch_core_session_rwunlock(b_session); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n"); switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR"); nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), - NUTAG_SUBSTATE(nua_substate_terminated),SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END()); + NUTAG_SUBSTATE(nua_substate_terminated), + SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), + SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END()); } } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 6551158522..56c6e0b3a4 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -640,6 +640,7 @@ static const char *message_names[] = { "SIGNAL_DATA", "INFO", "AUDIO_DATA", + "BLIND_TRANSFER_RESPONSE", "INVALID" }; @@ -722,6 +723,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit break; } } + + + if (message->message_id == SWITCH_MESSAGE_INDICATE_BRIDGE && + switch_channel_test_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER)) { + switch_core_session_t *other_session; + const char *uuid = switch_channel_get_variable(session->channel, "blind_transfer_uuid"); + + switch_channel_clear_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER); + + if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) { + switch_core_session_message_t msg = { 0 }; + msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE; + msg.from = __FILE__; + msg.numeric_arg = 1; + switch_core_session_receive_message(other_session, &msg); + switch_core_session_rwunlock(other_session); + } + } } diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 7b2e900e7f..61fa9290e5 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -188,6 +188,7 @@ static void switch_core_standard_on_routing(switch_core_session_t *session) static void switch_core_standard_on_execute(switch_core_session_t *session) { switch_caller_extension_t *extension; + const char *uuid; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard EXECUTE\n", switch_channel_get_name(session->channel)); @@ -222,6 +223,25 @@ static void switch_core_standard_on_execute(switch_core_session_t *session) } + if (switch_channel_ready(session->channel) && switch_channel_get_state(session->channel) == CS_EXECUTE && + switch_channel_test_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER) && + (uuid = switch_channel_get_variable(session->channel, "blind_transfer_uuid"))) { + switch_core_session_t *other_session; + + if ((other_session = switch_core_session_locate(uuid))) { + switch_core_session_message_t msg = { 0 }; + msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE; + msg.from = __FILE__; + msg.numeric_arg = 0; + switch_core_session_receive_message(other_session, &msg); + switch_core_session_rwunlock(other_session); + + switch_channel_set_variable(session->channel, "park_timeout", "10:blind_transfer"); + switch_channel_set_state(session->channel, CS_PARK); + switch_channel_clear_flag(session->channel, CF_CONFIRM_BLIND_TRANSFER); + } + } + if (switch_channel_ready(session->channel) && switch_channel_get_state(session->channel) == CS_EXECUTE) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s has executed the last dialplan instruction, hanging up.\n", switch_channel_get_name(session->channel)); From 1ecb6be00915107491f66f14298930317409e8e0 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 8 May 2012 11:04:01 -0500 Subject: [PATCH 0216/1057] release FreeSWITCH 1.2-rc2 --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 7b76740d62..5dbe6d9e12 100644 --- a/configure.in +++ b/configure.in @@ -3,11 +3,11 @@ # Must change all of the below together # For a release, set revision for that tagged release as well and uncomment -AC_INIT([freeswitch], [1.2-rc1], BUG-REPORT-ADDRESS) +AC_INIT([freeswitch], [1.2-rc2], BUG-REPORT-ADDRESS) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [2]) AC_SUBST(SWITCH_VERSION_MICRO, [0]) -AC_SUBST(SWITCH_VERSION_REVISION, [-rc1]) +AC_SUBST(SWITCH_VERSION_REVISION, [-rc2]) AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template]) AC_CONFIG_FILES([.version:.version.in]) From 53f1b51c1aa6a5391ac2ac97bdf780caf3907abc Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 15:53:45 +0000 Subject: [PATCH 0217/1057] ci: generalize version number handling a bit --- scripts/ci/common.sh | 59 ++++++++++++++++++++++++++++++------- scripts/ci/debsrcbuilder.sh | 4 +-- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index ef191676b3..25fd27a5e2 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -4,6 +4,8 @@ src_repo="$(pwd)" tmp_dir=${TMP_DIR:="/tmp"} +zgrep () { (echo "$2" | grep -e "$1" >/dev/null); } + parse_version () { local ver="$1" major="" minor="" micro="" rev="" local next=major @@ -26,38 +28,73 @@ parse_version () { eval $next='${tmp}${x}' fi done + # The major version should never be null + if [ -z "$major" ]; then + echo "WARNING: parse_version was called with '$1' which is missing a major version number" >&2 + fi + # If someone asks for the minor or micro specificially, they + # probably expect that it won't be null. Also, vX.Y should never be + # different from vX.Y.0 (that would be crazy), so we don't lose + # meaningful generality by setting minor or micro to zero on vX or + # vX.Y style versions. + minor="${minor:-0}" + micro="${micro:-0}" + # centos-style versions (don't mess with the argument given for now) + # TODO: what is the CentOS version number policy? local cmajor cminor cmicro crev cver - cmajor=${major:="0"} - cminor=${minor:="0"} - cmicro=${micro:="0"} + cmajor="${major:-0}" + cminor="${minor:-0}" + cmicro="${micro:-0}" crev="$(echo "$rev" | sed -e 's/[._~-]//')" cver="${cmajor}.${cminor}.${cmicro}" - if [ -n "${micro}" ] && echo "$micro" | grep '^\(alpha\|beta\|rc\)' >/dev/null; then - rev="~${micro}" + [ -n "$crev" ] && cver="${cver}.${crev}" + # fix up if the revision was passed in the minor or micro number + if zgrep '^\(alpha\|beta\|rc\)' "$minor"; then + rev="-${minor}" + minor="0" + micro="0" + ver="${major}${rev}" + fi + if zgrep '^\(alpha\|beta\|rc\)' "$micro"; then + rev="-${micro}" micro="0" ver="${major}.${minor}${rev}" fi + # git-style versions + local gmajor gminor gmicro grev gver gver="$(echo "$ver" | sed -e 's/[~_]/-/')" grev="$(echo "$rev" | sed -e 's/[~_]/-/')" gmajor="$major" gminor="$minor" gmicro="$micro" - [ -n "$crev" ] && cver="${cver}.${crev}" + # debian-style versions + local dmajor dminor dmicro drev dver + dver="$(echo "$ver" | sed -e 's/[-_]/~/')" + drev="$(echo "$rev" | sed -e 's/[-_]/~/')" + dmajor="$major" + dminor="$minor" + dmicro="$micro" + # return variables echo "ver='$ver'" echo "major='$major'" echo "minor='$minor'" echo "micro='$micro'" echo "rev='$rev'" - echo "cver='$cver'" - echo "cmajor='$cmajor'" - echo "cminor='$cminor'" - echo "cmicro='$cmicro'" - echo "crev='$crev'" echo "gver='$gver'" echo "gmajor='$gmajor'" echo "gminor='$gminor'" echo "gmicro='$gmicro'" echo "grev='$grev'" + echo "dver='$dver'" + echo "dmajor='$dmajor'" + echo "dminor='$dminor'" + echo "dmicro='$dmicro'" + echo "drev='$drev'" + echo "cver='$cver'" + echo "cmajor='$cmajor'" + echo "cminor='$cminor'" + echo "cmicro='$cmicro'" + echo "crev='$crev'" } set_fs_ver () { diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index d693777500..8b06ab4794 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -14,7 +14,7 @@ build="b${2-0}" distro="${3-unstable}" codename="${4-sid}" -fver="${ver}~${nightly}~${build}" +fver="${dver}~${nightly}~${build}" fname="freeswitch-$fver" orig="freeswitch_$fver.orig" ddir=$src_repo/debbuild @@ -23,7 +23,7 @@ bdir=$src_repo/debbuild/$fname mkdir -p $ddir git clone . $bdir cd $bdir -set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" +set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" cd libs getlib () { f="${1##*/}" From ee8caf78f198d8d32ccb989ec059867c8927c73b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 15:54:33 +0000 Subject: [PATCH 0218/1057] ci: be more consistent about the version in configure.in --- scripts/ci/src_tarball.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/src_tarball.sh b/scripts/ci/src_tarball.sh index 826b8a27b7..0cab5f5d58 100755 --- a/scripts/ci/src_tarball.sh +++ b/scripts/ci/src_tarball.sh @@ -21,7 +21,7 @@ mkdir -p $dst_dir cp -r . $dst_dir cd $dst_dir -set_fs_ver "$cver" "$cmajor" "$cminor" "$cmicro" "$crev" +set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" gnuize cd .. ls From 42dab8396651f5c82d6da40a1dc13781e8c3d53b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 16:35:08 +0000 Subject: [PATCH 0219/1057] ci: add automatic mechanism for determining next version number --- build/next-release.txt | 1 + scripts/ci/debsrcbuilder.sh | 6 +++++- scripts/tagscript.sh | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 build/next-release.txt diff --git a/build/next-release.txt b/build/next-release.txt new file mode 100644 index 0000000000..996f71d3b9 --- /dev/null +++ b/build/next-release.txt @@ -0,0 +1 @@ +1.2-rc3 diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 8b06ab4794..e64093d120 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -7,7 +7,11 @@ sdir="." check_pwd check_input_ver_build $@ -eval $(parse_version "$1") +in_ver="$1" +if [ "$in_ver" = "auto" ]; then + in_ver="$(cat build/next-release.txt)" +fi +eval $(parse_version "$in_ver") datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" build="b${2-0}" diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 30222641a6..78253a10c5 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -114,6 +114,22 @@ if (ngrep '^Saved' "$ret"); then stash_saved=1 fi +echo "Determining next-release (release+1) version..." >&2 +if [ -n "$grev" ] && ngrep '[0-9]*$' "$grev"; then + rev_ver="$(echo "$grev" | sed -e 's/^[^0-9]*\([0-9]*\)$/\1/')" + next_rev="$((rev_ver+1))" + next_ver="${gver%%$rev_ver}${next_rev}" +elif [ -n "$grev" ]; then + next_ver="${gver}1" +elif ! [ "$gmicro" = "0" ]; then + next_ver="${gver%%$micro}$((micro+1))" +else + next_ver="${gmajor}.$((gminor+1))-rc1" +fi +echo "Setting next-release version ($next_ver)..." >&2 +echo "${next_ver}" > build/next-release.txt +git add build/next-release.txt + echo "Changing the version of configure.in..." >&2 set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev" From c728efdbb987834f8d76dac51132d0a724380902 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 18:13:07 +0000 Subject: [PATCH 0220/1057] mod_posix_timer: comply with gcc -pedantic Thanks to Thierry Panthier for pointing this out. --- src/mod/timers/mod_posix_timer/mod_posix_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index 04d694b5f7..c170d8fa20 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -111,7 +111,9 @@ static void timer_signal_handler(int sig, siginfo_t *si, void *cu) if (val >= 0 && val <= MAX_ACTIVE_TIMERS) { uint8_t active_id = (uint8_t)val; /* notify runtime thread that timer identified by active_id has ticked */ - write(globals.timer_tick_pipe[1], &active_id, 1); + if (write(globals.timer_tick_pipe[1], &active_id, 1) == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing to pipe: %s\n", strerror(errno)); + } } } } From bb90d52df7cdda00668fc1706536d4347475e161 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 18:55:44 +0000 Subject: [PATCH 0221/1057] don't use bootstrap.sh -j anywhere but devel-bootstrap.sh We believe there may be a race condition in bootstrap.sh when run with -j. We know that running it without -j should be at least deterministic (whether or not correct), so we'll go with that in anticipation of releasing v1.2. --- debian/rules | 2 +- freeswitch.spec | 2 +- scripts/ci/common.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 5581ffdacf..0cc293a346 100755 --- a/debian/rules +++ b/debian/rules @@ -47,7 +47,7 @@ override_dh_auto_clean: .stamp-bootstrap: @$(call show_vars) - ./bootstrap.sh -j + ./bootstrap.sh touch $@ .stamp-configure: .stamp-bootstrap diff --git a/freeswitch.spec b/freeswitch.spec index a56dd90035..470866ab2c 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1433,7 +1433,7 @@ export ACLOCAL_FLAGS="-I /usr/share/aclocal" if test ! -f Makefile.in then - ./bootstrap.sh -j + ./bootstrap.sh fi %configure -C \ diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index 25fd27a5e2..3aa6bb3441 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -112,7 +112,7 @@ set_fs_ver () { } gnuize () { - ./bootstrap.sh -j + ./bootstrap.sh mv bootstrap.sh rebootstrap.sh rm -f docs/AUTHORS rm -f docs/COPYING From 9a802cd4d3e03102204f65d2642bd33693101dd6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 11:51:46 -0500 Subject: [PATCH 0222/1057] FS-4160 --- src/switch_ivr_bridge.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index b2cd384098..6a2cee0405 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1491,21 +1491,26 @@ static void cleanup_proxy_mode_b(switch_core_session_t *session) static void cleanup_proxy_mode_a(switch_core_session_t *session) { switch_core_session_t *sbsession; - switch_channel_t *channel = switch_core_session_get_channel(session); - + int done = 0; if (switch_channel_test_flag(channel, CF_PROXY_MODE)) { - const char *sbv = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); - if (!zstr(sbv) && (sbsession = switch_core_session_locate(sbv))) { + if (switch_core_session_get_partner(session, &sbsession) == SWITCH_STATUS_SUCCESS) { 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); + + if (switch_channel_test_flag(sbchannel, CF_PROXY_MODE)) { + /* 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); + } else { + done = 1; + } switch_core_session_rwunlock(sbsession); } } + if (done) return; + switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL); switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL); switch_channel_set_variable(channel, SWITCH_BRIDGE_UUID_VARIABLE, NULL); From 33da6bf3b3d92193f7d363d6122db85ada3b1b18 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 8 May 2012 15:24:55 -0400 Subject: [PATCH 0223/1057] wait better --- bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap.sh b/bootstrap.sh index 0e0ac56fc4..d199a73226 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -457,6 +457,7 @@ bootstrap_libs() { ((libbootstrap ${i} ; bootstrap_libs_post ${i}) &) fi done + ${BGJOB} && wait } run() { From 8f8a9a8075b3f80e687c047b70b8edeab7c6e793 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 8 May 2012 15:28:48 -0400 Subject: [PATCH 0224/1057] wait better, you need to wait in the same function, so bging this one doesn't help --- bootstrap.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index d199a73226..b8f1dcd843 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -343,11 +343,7 @@ bootstrap_apr() { echo "Entering directory ${LIBDIR}/apr-util" cd ${LIBDIR}/apr-util - if ! ${BGJOB}; then - ./buildconf - else - ./buildconf & - fi + ./buildconf } bootstrap_libzrtp() { From 76c0201e8993c35ea05be5fda0196bd4fe785137 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 12:52:47 -0500 Subject: [PATCH 0225/1057] dtmf tweak --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- src/switch_rtp.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6610895927..f787ac3cbb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3532,7 +3532,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, "rtp_digit_delay")))) { int delayi = atoi(val); if (delayi < 0) delayi = 0; - delay = (uint32_t) delay; + delay = (uint32_t) delayi; } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 72d7a8e71c..d481a17d49 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2300,6 +2300,7 @@ static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms, uint32_t max_ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { rtp_session->max_next_write_samplecount = rtp_session->timer.samplecount + max_upsamp; rtp_session->next_write_samplecount = rtp_session->timer.samplecount + upsamp; + rtp_session->last_write_ts += upsamp; } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms); @@ -2349,7 +2350,7 @@ static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session) } } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d lw=%d\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d lw=%u\n", loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_sofar, @@ -4378,7 +4379,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, rtp_session->write_msg.header.seq = htons(++rtp_session->seq); rtp_session->write_msg.header.ts = htonl(ts); rtp_session->write_msg.header.pt = payload; - rtp_session->write_msg.header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; + rtp_session->write_msg.header.m = m; memcpy(rtp_session->write_msg.body, data, datalen); bytes = rtp_header_len + datalen; From 89c590cda8f732820f899bb75d60549bafb21d6e Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 19:40:43 +0000 Subject: [PATCH 0226/1057] bootstrap.sh: wait better Be more explicit about what we're waiting for, among other changes. This appears to fully correct the wait issues. --- bootstrap.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index b8f1dcd843..5aaed673c5 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -438,10 +438,16 @@ bootstrap_libs_post() { } bootstrap_libs() { + local jobs="" for i in ${SUBDIRS}; do case "$i" in apr|fs|libzrtp) - ${BGJOB} && wait + if ${BGJOB}; then + for x in $jobs; do + wait $jobs + done + fi + jobs="" bootstrap_$i continue ;; @@ -450,10 +456,16 @@ bootstrap_libs() { if ! ${BGJOB}; then libbootstrap ${i} ; bootstrap_libs_post ${i} else - ((libbootstrap ${i} ; bootstrap_libs_post ${i}) &) + (libbootstrap ${i} ; bootstrap_libs_post ${i}) & + local x=$! + jobs="$jobs $x" fi done - ${BGJOB} && wait + if ${BGJOB}; then + for x in $jobs; do + wait $x + done + fi } run() { @@ -468,7 +480,6 @@ run() { check_libtoolize print_autotools_vers bootstrap_libs - ${BGJOB} && wait return 0 } From 9d341184672077c80fb6b06cc08fbced91ff9156 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 20:14:19 +0000 Subject: [PATCH 0227/1057] bootstrap.sh: wait more simply now that we've found the problem --- bootstrap.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5aaed673c5..5c9ab26f03 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -438,16 +438,10 @@ bootstrap_libs_post() { } bootstrap_libs() { - local jobs="" for i in ${SUBDIRS}; do case "$i" in apr|fs|libzrtp) - if ${BGJOB}; then - for x in $jobs; do - wait $jobs - done - fi - jobs="" + ${BGJOB} && wait bootstrap_$i continue ;; @@ -457,15 +451,9 @@ bootstrap_libs() { libbootstrap ${i} ; bootstrap_libs_post ${i} else (libbootstrap ${i} ; bootstrap_libs_post ${i}) & - local x=$! - jobs="$jobs $x" fi done - if ${BGJOB}; then - for x in $jobs; do - wait $x - done - fi + ${BGJOB} && wait } run() { From c985853cbffc641d790c9e2ed7b0c2876e852f5a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 8 May 2012 20:45:05 +0000 Subject: [PATCH 0228/1057] mod_posix_timer: we'll find a better way to comply with gcc -pedantic on lucid We shouldn't be logging in a signal handler. This reverts commit c728efdbb987834f8d76dac51132d0a724380902. --- src/mod/timers/mod_posix_timer/mod_posix_timer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mod/timers/mod_posix_timer/mod_posix_timer.c b/src/mod/timers/mod_posix_timer/mod_posix_timer.c index c170d8fa20..04d694b5f7 100644 --- a/src/mod/timers/mod_posix_timer/mod_posix_timer.c +++ b/src/mod/timers/mod_posix_timer/mod_posix_timer.c @@ -111,9 +111,7 @@ static void timer_signal_handler(int sig, siginfo_t *si, void *cu) if (val >= 0 && val <= MAX_ACTIVE_TIMERS) { uint8_t active_id = (uint8_t)val; /* notify runtime thread that timer identified by active_id has ticked */ - if (write(globals.timer_tick_pipe[1], &active_id, 1) == -1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing to pipe: %s\n", strerror(errno)); - } + write(globals.timer_tick_pipe[1], &active_id, 1); } } } From d82a38dfd655a29b3008bdac19048ced905d3852 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 19:25:14 -0500 Subject: [PATCH 0229/1057] fix missing close brace --- .../applications/mod_spandsp/mod_spandsp_modem.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index e3f8afa89f..f1a1fdb7b0 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -230,13 +230,14 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl #if USE_OPENPTY if (openpty(&modem->master, &modem->slave, NULL, NULL, NULL)) { - if (modem->master < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to initialize pty\n"); - status = SWITCH_STATUS_FALSE; - goto end; - } + if (modem->master < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to initialize pty\n"); + status = SWITCH_STATUS_FALSE; + goto end; + } - modem->stty = ttyname(modem->slave); + modem->stty = ttyname(modem->slave); + } #else #if WIN32 modem->slot = 4+globals.NEXT_ID++; /* need work here we start at COM4 for now*/ From f106c18f51e03fd9acda72fed1141d6cd0e15b78 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 19:33:53 -0500 Subject: [PATCH 0230/1057] tweak to confirm blind transfer patch --- src/include/switch_ivr.h | 1 + .../applications/mod_dptools/mod_dptools.c | 17 +------------ src/switch_core_state_machine.c | 7 ++++-- src/switch_ivr.c | 25 +++++++++++++++++++ 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 9d3d5f2ea5..9299c584d9 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -970,6 +970,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_insert_file(switch_core_session_t *se SWITCH_DECLARE(switch_status_t) switch_ivr_create_message_reply(switch_event_t **reply, switch_event_t *message, const char *new_proto); SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name, const char *domain_name); SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause); +SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success); /** @} */ diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 8ae6e6f221..b07f1a21ed 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -4464,28 +4464,13 @@ static char *file_string_supported_formats[SWITCH_MAX_CODECS] = { 0 }; SWITCH_STANDARD_APP(blind_transfer_ack_function) { - switch_channel_t *channel = switch_core_session_get_channel(session); switch_bool_t val = 0; if (data) { val = switch_true((char *) val); } - if (switch_channel_test_flag(channel, CF_CONFIRM_BLIND_TRANSFER)) { - switch_core_session_t *other_session; - const char *uuid = switch_channel_get_variable(channel, "blind_transfer_uuid"); - - switch_channel_clear_flag(channel, CF_CONFIRM_BLIND_TRANSFER); - - if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) { - switch_core_session_message_t msg = { 0 }; - msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE; - msg.from = __FILE__; - msg.numeric_arg = val; - switch_core_session_receive_message(other_session, &msg); - switch_core_session_rwunlock(other_session); - } - } + switch_ivr_blind_transfer_ack(session, val); } diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 61fa9290e5..e567daa9fb 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -174,8 +174,11 @@ static void switch_core_standard_on_routing(switch_core_session_t *session) } if (!extension) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No Route, Aborting\n"); - switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION); + + if (switch_ivr_blind_transfer_ack(session, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No Route, Aborting\n"); + switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION); + } } end: diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 7a24eff193..325a8083a2 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3501,6 +3501,31 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_ca } } +SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status = SWITCH_STATUS_FALSE; + + if (switch_channel_test_flag(channel, CF_CONFIRM_BLIND_TRANSFER)) { + switch_core_session_t *other_session; + const char *uuid = switch_channel_get_variable(channel, "blind_transfer_uuid"); + + switch_channel_clear_flag(channel, CF_CONFIRM_BLIND_TRANSFER); + + if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) { + switch_core_session_message_t msg = { 0 }; + msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE; + msg.from = __FILE__; + msg.numeric_arg = success; + switch_core_session_receive_message(other_session, &msg); + switch_core_session_rwunlock(other_session); + status = SWITCH_STATUS_SUCCESS; + } + } + + return status; + +} /* For Emacs: * Local Variables: From 225eebc20dddf42d3e6cd0fc856e70c8b5446919 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 8 May 2012 19:44:39 -0500 Subject: [PATCH 0231/1057] take out 101 dialing --- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 620030164c..cf095386e5 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -91,10 +91,6 @@ static switch_status_t sofia_on_init(switch_core_session_t *session) sofia_set_flag(tech_pvt, TFLAG_RECOVERED); } - if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { - nua_respond(tech_pvt->nh, 101, "Dialing", TAG_END()); - } - if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) || sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) { const char *var; From 0165a813d70bbefc0aaa9ede9a55251f44c0f28f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 14:10:20 +0000 Subject: [PATCH 0232/1057] remove questionable idiom --- scripts/ci/extras/erlangbuilder.sh | 2 +- scripts/ci/get_extra_sources.sh | 2 +- scripts/ci/rpmbuilder.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ci/extras/erlangbuilder.sh b/scripts/ci/extras/erlangbuilder.sh index dd6fdc6803..f944e987d4 100755 --- a/scripts/ci/extras/erlangbuilder.sh +++ b/scripts/ci/extras/erlangbuilder.sh @@ -13,7 +13,7 @@ if [ -z "$1" ]; then exit 1; fi -(mkdir -p rpmbuild && cd $_ && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SOURCES SPECS) +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SOURCES SPECS) cd $src_repo rpmbuild --define "_topdir %(pwd)/rpmbuild" \ diff --git a/scripts/ci/get_extra_sources.sh b/scripts/ci/get_extra_sources.sh index c0827c68eb..a22281b477 100755 --- a/scripts/ci/get_extra_sources.sh +++ b/scripts/ci/get_extra_sources.sh @@ -8,7 +8,7 @@ if [ ! -d .git ]; then exit 1; fi -(mkdir -p rpmbuild && cd $_ && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SOURCES SPECS) +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SOURCES SPECS) cd $src_repo/rpmbuild/SOURCES diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 78c4c3ca73..9842112d86 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -14,7 +14,7 @@ dst_name="freeswitch-$cmajor.$cminor.$cmicro" dst_parent="/tmp/" dst_dir="/tmp/$dst_name" -(mkdir -p rpmbuild && cd $_ && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) +(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) cd $src_repo From 56d3a866fc98d4ff1b5a6b049f2f4c95c42a45b3 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 14:14:15 +0000 Subject: [PATCH 0233/1057] ci: fixup rpmbuilder.sh --- scripts/ci/rpmbuilder.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 9842112d86..312902faf7 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -17,6 +17,7 @@ dst_dir="/tmp/$dst_name" (mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) cd $src_repo +cp -a src_dist/* rpmbuild/SOURCES/ rpmbuild --define "VERSION_NUMBER $cver" \ --define "BUILD_NUMBER $build" \ From 4fbf8625edf107e1d6382c24c32266b9e215a0ba Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 9 May 2012 09:20:10 -0500 Subject: [PATCH 0234/1057] OPENZAP-183 --resolve --- libs/freetdm/src/ftdm_threadmutex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c index 0b63f7c0ae..302cd32e64 100644 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ b/libs/freetdm/src/ftdm_threadmutex.c @@ -401,7 +401,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int m if (interrupt->device != FTDM_INVALID_SOCKET) { num++; ints[1] = interrupt->device; - ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_output_flags member!)\n", size); + ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_output_flags member!)\n"); } res = WaitForMultipleObjects(num, ints, FALSE, ms >= 0 ? ms : INFINITE); switch (res) { From 849dd7376fa9602515581dbc0b339882fe0a0b1f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 14:23:03 +0000 Subject: [PATCH 0235/1057] ci: expect that jenkins might do this itself --- scripts/ci/rpmbuilder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/rpmbuilder.sh b/scripts/ci/rpmbuilder.sh index 312902faf7..8d633d6d80 100755 --- a/scripts/ci/rpmbuilder.sh +++ b/scripts/ci/rpmbuilder.sh @@ -17,7 +17,7 @@ dst_dir="/tmp/$dst_name" (mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS) cd $src_repo -cp -a src_dist/* rpmbuild/SOURCES/ +cp -a src_dist/* rpmbuild/SOURCES/ || true rpmbuild --define "VERSION_NUMBER $cver" \ --define "BUILD_NUMBER $build" \ From 2a4eb84e4d97dbbd51a7d78830f7c29f53596d1c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 May 2012 08:39:23 -0500 Subject: [PATCH 0236/1057] confirm_transfer tweak --- 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 b07f1a21ed..7cf262acbe 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3058,7 +3058,8 @@ SWITCH_STANDARD_APP(audio_bridge_function) } } } - if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && switch_channel_get_state(caller_channel) != CS_ROUTING) { + if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(caller_channel, CF_CONFIRM_BLIND_TRANSFER) && + switch_channel_get_state(caller_channel) != CS_ROUTING) { switch_channel_hangup(caller_channel, cause); } return; From 99bac0d05b4ddabe5f441f24285aee174c4036ef Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 May 2012 09:06:21 -0500 Subject: [PATCH 0237/1057] add video_refresh dp and uuid_video_refresh fsapi --- .../applications/mod_commands/mod_commands.c | 40 +++++++++++++++++++ .../applications/mod_dptools/mod_dptools.c | 13 ++++++ 2 files changed, 53 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index a812c8b994..470c7b02c9 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3089,6 +3089,45 @@ SWITCH_STANDARD_API(uuid_send_info_function) } +#define VIDEO_REFRESH_SYNTAX "" +SWITCH_STANDARD_API(uuid_video_refresh_function) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + char *mycmd = NULL, *argv[2] = { 0 }; + int argc = 0; + + if (!zstr(cmd) && (mycmd = strdup(cmd))) { + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argc < 1) { + stream->write_function(stream, "-USAGE: %s\n", VIDEO_REFRESH_SYNTAX); + } else { + switch_core_session_message_t msg = { 0 }; + switch_core_session_t *lsession = NULL; + + msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; + msg.string_array_arg[2] = argv[1]; + msg.from = __FILE__; + + if ((lsession = switch_core_session_locate(argv[0]))) { + status = switch_core_session_receive_message(lsession, &msg); + switch_core_session_rwunlock(lsession); + } + } + + if (status == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK Success\n"); + } else { + stream->write_function(stream, "-ERR Operation Failed\n"); + } + + switch_safe_free(mycmd); + + return SWITCH_STATUS_SUCCESS; +} + + #define DEBUG_AUDIO_SYNTAX " " SWITCH_STANDARD_API(uuid_debug_audio_function) { @@ -5436,6 +5475,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) 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_send_info", "Send info to the endpoint", uuid_send_info_function, INFO_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_video_refresh", "Send video refresh.", uuid_video_refresh_function, VIDEO_REFRESH_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_outgoing_answer", "Answer Outgoing Channel", outgoing_answer_function, OUTGOING_ANSWER_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); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 7cf262acbe..0e441dc731 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1185,6 +1185,17 @@ SWITCH_STANDARD_APP(redirect_function) switch_core_session_receive_message(session, &msg); } +SWITCH_STANDARD_APP(video_refresh_function) +{ + switch_core_session_message_t msg = { 0 }; + + /* Tell the channel to refresh video */ + msg.from = __FILE__; + msg.string_arg = data; + msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; + switch_core_session_receive_message(session, &msg); +} + SWITCH_STANDARD_APP(send_info_function) { switch_core_session_message_t msg = { 0 }; @@ -4633,6 +4644,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "video_refresh", "Send video refresh.", "Send video refresh.", video_refresh_function, "", + SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "send_info", "Send info", "Send info", send_info_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.", jitterbuffer_function, "", SAF_SUPPORT_NOMEDIA); From 13498d59f0b80daf96a0e104477cbe8399f1d968 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 9 May 2012 17:13:21 +0000 Subject: [PATCH 0238/1057] debian: spidermonkey doesn't build correctly on wheezy either --- debian/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index acb63dcd67..4c40b7eaed 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -32,13 +32,13 @@ avoid_mods=( formats/mod_shout languages/mod_java languages/mod_managed + languages/mod_spidermonkey languages/mod_yaml sdk/autotools xml_int/mod_xml_ldap ) avoid_mods_squeeze=( formats/mod_vlc - languages/mod_spidermonkey ) err () { From 5a059ef6307f4d3864d1468f01c759a7b3edc8ea Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 May 2012 12:11:13 -0500 Subject: [PATCH 0239/1057] add autocomplete for uuid_video_refresh --- src/mod/applications/mod_commands/mod_commands.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 470c7b02c9..0a9cac196c 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -5640,6 +5640,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_simplify ::console::list_uuid"); switch_console_set_complete("add uuid_transfer ::console::list_uuid"); switch_console_set_complete("add uuid_dual_transfer ::console::list_uuid"); + switch_console_set_complete("add uuid_video_refresh ::console::list_uuid"); switch_console_set_complete("add version"); switch_console_set_complete("add uuid_warning ::console::list_uuid"); switch_console_set_complete("add ..."); From 6bb33d7683bfd8d91e0fa8dfb5a1f033cc3f48f4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 May 2012 14:05:03 -0500 Subject: [PATCH 0240/1057] add libscgi (SCGI Client) --- libs/libscgi/Makefile | 32 ++ libs/libscgi/protocol.txt | 101 +++++++ libs/libscgi/src/include/scgi.h | 210 +++++++++++++ libs/libscgi/src/scgi.c | 520 ++++++++++++++++++++++++++++++++ libs/libscgi/testclient.c | 39 +++ 5 files changed, 902 insertions(+) create mode 100644 libs/libscgi/Makefile create mode 100644 libs/libscgi/protocol.txt create mode 100644 libs/libscgi/src/include/scgi.h create mode 100644 libs/libscgi/src/scgi.c create mode 100644 libs/libscgi/testclient.c diff --git a/libs/libscgi/Makefile b/libs/libscgi/Makefile new file mode 100644 index 0000000000..fb59cb7848 --- /dev/null +++ b/libs/libscgi/Makefile @@ -0,0 +1,32 @@ +PWD=$(shell pwd) +INCS=-I$(PWD)/src/include +DEBUG=-g -ggdb +BASE_FLAGS=$(INCS) $(DEBUG) -fPIC +PICKY=-O2 +CFLAGS=$(BASE_FLAGS) $(PICKY) +CXXFLAGS=$(BASE_FLAGS) +MYLIB=libscgi.a +LIBS= +LDFLAGS=-L. +OBJS=src/scgi.o +SRC=src/scgi.c +HEADERS=src/include/scgi.h +SOLINK=-shared -Xlinker -x + + +all: $(MYLIB) testclient + +$(MYLIB): $(OBJS) $(HEADERS) $(SRC) + ar rcs $(MYLIB) $(OBJS) + ranlib $(MYLIB) + +%.o: %.c $(HEADERS) + $(CC) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@ + +testclient: $(MYLIB) testclient.c + $(CC) $(CC_CFLAGS) $(CFLAGS) testclient.c -o testclient -lscgi $(LDFLAGS) $(LIBS) + + + +clean: + rm -f *.o src/*.o libscgi.a *~ src/*~ src/include/*~ testclient diff --git a/libs/libscgi/protocol.txt b/libs/libscgi/protocol.txt new file mode 100644 index 0000000000..34c128005f --- /dev/null +++ b/libs/libscgi/protocol.txt @@ -0,0 +1,101 @@ +SCGI: A Simple Common Gateway Interface alternative +Neil Schemenauer +2008-06-23 + +1. Introduction + + The SCGI protocol is a replacement for the Common Gateway Interface + (CGI) protocol. It is a standard for applications to interface with + HTTP servers. It is similar to FastCGI but is designed to be easier + to implement. + + In this document, a string of 8-bit bytes may be written in two + different forms: as a series of hexadecimal numbers between angle + brackets, or as a sequence of ASCII characters between double quotes. + For example, <68 65 6c 6c 6f 20 77 6f 72 6c 64 21> is a string of + length 12; it is the same as the string "hello world!". Note that + these notations are part of this document, not part of the protocol. + + +2. Protocol + + The client connects to a SCGI server over a reliable stream protocol + allowing transmission of 8-bit bytes. The client begins by sending a + request. See section 3 for the format of the request. When the SCGI + server sees the end of the request it sends back a response and closes + the connection. The format of the response is not specified by this + protocol. + + +3. Request Format + + A request consists of a number of headers and a body. The format of + the headers is: + + headers ::= header* + header ::= name NUL value NUL + name ::= notnull+ + value ::= notnull* + notnull ::= <01> | <02> | <03> | ... | + NUL = <00> + + Duplicate names are not allowed in the headers. The first header + must have the name "CONTENT_LENGTH" and a value that is a nonempty + sequence of ASCII digits giving the of the body length in decimal. + The "CONTENT_LENGTH" header must always be present, even if its + value is "0". There must also always be a header with the name + "SCGI" and a value of "1". In order to facilitate the transition + from CGI, standard CGI environment variables should be provided as + SCGI headers. + + The headers are sent encoded as a netstring. Netstring encoding is + explained in section 4. The body is sent following the headers and + its length is specified by the "CONTENT_LENGTH" header. + + +4. Netstrings + + Any string of 8-bit bytes may be encoded as [len]":"[string]",". Here + [string] is the string and [len] is a nonempty sequence of ASCII + digits giving the length of [string] in decimal. The ASCII digits are + <30> for 0, <31> for 1, and so on up through <39> for 9. Extra zeros + at the front of [len] are prohibited: [len] begins with <30> exactly + when [string] is empty. + + For example, the string "hello world!" is encoded as <31 32 3a 68 65 + 6c 6c 6f 20 77 6f 72 6c 64 21 2c>, i.e., "12:hello world!,". The empty + string is encoded as "0:,". + + [len]":"[string]"," is called a netstring. [string] is called the + interpretation of the netstring. + + +5. Example + + The web server (a SCGI client) opens a connection and sends the + concatenation of the following strings: + + "70:" + "CONTENT_LENGTH" <00> "27" <00> + "SCGI" <00> "1" <00> + "REQUEST_METHOD" <00> "POST" <00> + "REQUEST_URI" <00> "/deepthought" <00> + "," + "What is the answer to life?" + + The SCGI server sends the following response: + + "Status: 200 OK" <0d 0a> + "Content-Type: text/plain" <0d 0a> + "" <0d 0a> + "42" + + The SCGI server closes the connection. + + +6. Copyright + + This document has been placed in the public domain. + + +/* vim: set ai tw=74 et sw=4 sts=4: */ diff --git a/libs/libscgi/src/include/scgi.h b/libs/libscgi/src/include/scgi.h new file mode 100644 index 0000000000..ea8d30ade4 --- /dev/null +++ b/libs/libscgi/src/include/scgi.h @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2012-2013, Anthony Minessale II + * 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. + */ + +#ifndef _SCGI_H_ +#define _SCGI_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ +#if EMACS_BUG +} +#endif + +#ifdef _MSC_VER +#define FD_SETSIZE 8192 +#define SCGI_USE_SELECT +#else +#define SCGI_USE_POLL +#endif + + + +#ifdef SCGI_USE_POLL +#include +#endif + +#ifdef WIN32 +#include +#include +typedef SOCKET scgi_socket_t; +typedef unsigned __int64 uint64_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int8 uint8_t; +typedef __int64 int64_t; +typedef __int32 int32_t; +typedef __int16 int16_t; +typedef __int8 int8_t; +typedef intptr_t scgi_ssize_t; +typedef int scgi_filehandle_t; +#define SCGI_SOCK_INVALID INVALID_SOCKET +#define strerror_r(num, buf, size) strerror_s(buf, size, num) +#if defined(SCGI_DECLARE_STATIC) +#define SCGI_DECLARE(type) type __stdcall +#define SCGI_DECLARE_NONSTD(type) type __cdecl +#define SCGI_DECLARE_DATA +#elif defined(SCGI_EXPORTS) +#define SCGI_DECLARE(type) __declspec(dllexport) type __stdcall +#define SCGI_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl +#define SCGI_DECLARE_DATA __declspec(dllexport) +#else +#define SCGI_DECLARE(type) __declspec(dllimport) type __stdcall +#define SCGI_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl +#define SCGI_DECLARE_DATA __declspec(dllimport) +#endif +#else +#define SCGI_DECLARE(type) type +#define SCGI_DECLARE_NONSTD(type) type +#define SCGI_DECLARE_DATA +#include +#include +#include +#include +#include +#include +#include +#define SCGI_SOCK_INVALID -1 +typedef int scgi_socket_t; +typedef ssize_t scgi_ssize_t; +typedef int scgi_filehandle_t; +#endif + + +#include +#ifndef WIN32 +#include +#endif + +#include +#include +#include +#include +#ifndef WIN32 +#include +#include +#include +#include +#include +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif +#include + +#if (_MSC_VER >= 1400) // VC8+ +#define scgi_assert(expr) assert(expr);__analysis_assume( expr ) +#endif + +#ifndef scgi_assert +#define scgi_assert(_x) assert(_x) +#endif + +#define scgi_safe_free(_x) if (_x) free(_x); _x = NULL +#define scgi_strlen_zero(s) (!s || *(s) == '\0') +#define scgi_strlen_zero_buf(s) (*(s) == '\0') +#define end_of(_s) *(*_s == '\0' ? _s : _s + strlen(_s) - 1) + + +typedef enum { + SCGI_POLL_READ = (1 << 0), + SCGI_POLL_WRITE = (1 << 1), + SCGI_POLL_ERROR = (1 << 2) +} scgi_poll_t; + + +typedef struct scgi_param_s { + char *name; + char *value; + struct scgi_param_s *next; +} scgi_param_t; + +typedef struct scgi_handle_s { + scgi_param_t *params; + char *body; + struct sockaddr_in sockaddr; + struct hostent hostent; + char hostbuf[256]; + scgi_socket_t sock; + char err[256]; + int errnum; + int connected; + struct sockaddr_in addr; + int destroyed; +} scgi_handle_t; + + +typedef int16_t scgi_port_t; +typedef size_t scgi_size_t; + +typedef enum { + SCGI_SUCCESS, + SCGI_FAIL, + SCGI_BREAK, + SCGI_DISCONNECTED, + SCGI_GENERR +} scgi_status_t; + + + +SCGI_DECLARE(scgi_status_t) scgi_connect(scgi_handle_t *handle, const char *host, scgi_port_t port, uint32_t timeout); +SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle); +SCGI_DECLARE(int) scgi_wait_sock(scgi_socket_t sock, uint32_t ms, scgi_poll_t flags); +SCGI_DECLARE(ssize_t) scgi_recv(scgi_handle_t *handle, unsigned char *buf, size_t buflen); +SCGI_DECLARE(scgi_status_t) scgi_send_request(scgi_handle_t *handle); +SCGI_DECLARE(scgi_status_t) scgi_add_param(scgi_handle_t *handle, const char *name, const char *value); +SCGI_DECLARE(scgi_status_t) scgi_add_body(scgi_handle_t *handle, const char *value); +SCGI_DECLARE(size_t) scgi_build_message(scgi_handle_t *handle, char **buffer); +SCGI_DECLARE(scgi_status_t) scgi_destroy_params(scgi_handle_t *handle); + +#ifdef __cplusplus +} +#endif /* defined(__cplusplus) */ + + +#endif /* defined(_SCGI_H_) */ + +/* 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/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c new file mode 100644 index 0000000000..eeec39a07b --- /dev/null +++ b/libs/libscgi/src/scgi.c @@ -0,0 +1,520 @@ +/* + * Copyright (c) 2012-2013, Anthony Minessale II + * 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. + */ + +#include + +#ifndef WIN32 +#define closesocket(x) shutdown(x, 2); close(x) +#include +#include +#else +#pragma warning (disable:6386) +/* These warnings need to be ignored warning in sdk header */ +#include +#include +#ifndef errno +#define errno WSAGetLastError() +#endif +#ifndef EINTR +#define EINTR WSAEINTR +#endif +#pragma warning (default:6386) +#endif + +static scgi_status_t scgi_push_param(scgi_handle_t *handle, const char *name, const char *value); + +static int sock_setup(scgi_handle_t *handle) +{ + + if (handle->sock == SCGI_SOCK_INVALID) { + return SCGI_FAIL; + } + +#ifdef WIN32 + { + BOOL bOptVal = TRUE; + int bOptLen = sizeof(BOOL); + setsockopt(handle->sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&bOptVal, bOptLen); + } +#else + { + int x = 1; + setsockopt(handle->sock, IPPROTO_TCP, TCP_NODELAY, &x, sizeof(x)); + } +#endif + + return SCGI_SUCCESS; +} + + +SCGI_DECLARE(size_t) scgi_build_message(scgi_handle_t *handle, char **bufferp) +{ + scgi_param_t *pp; + size_t len = 0, plen = 0, ctlen = 0; + char *s, *bp; + char *buffer = NULL; + char tmp[128] = ""; + + scgi_push_param(handle, "SCGI", "1"); + + if (handle->body) { + ctlen = strlen(handle->body); + } + + snprintf(tmp, sizeof(tmp), "%ld", ctlen); + + scgi_push_param(handle, "CONTENT_LENGTH", tmp); + + + for(pp = handle->params; pp; pp = pp->next) { + plen += (strlen(pp->name) + strlen(pp->value) + 2); + } + + snprintf(tmp, sizeof(tmp), "%ld", plen + ctlen); + + len = plen + ctlen + strlen(tmp) + 2; + + buffer = malloc(len); + memset(buffer, 0, len); + + snprintf(buffer, len, "%ld:", plen); + bp = buffer + strlen(buffer); + + for(pp = handle->params; pp; pp = pp->next) { + + for (s = pp->name; s && *s; s++) { + *bp++ = *s; + } + + *bp++ = '\0'; + + for (s = pp->value; s && *s; s++) { + *bp++ = *s; + } + + *bp++ = '\0'; + } + + *bp++ = ','; + + if (handle->body) { + for (s = handle->body; s && *s; s++) { + *bp++ = *s; + } + } + + *bufferp = buffer; + + return len; +} + +SCGI_DECLARE(scgi_status_t) scgi_destroy_params(scgi_handle_t *handle) +{ + scgi_param_t *param, *pp; + + pp = handle->params; + + while(pp) { + param = pp; + pp = pp->next; + + free(param->name); + free(param->value); + free(param); + } + + handle->params = NULL; + + return SCGI_SUCCESS; +} + +SCGI_DECLARE(scgi_status_t) scgi_add_body(scgi_handle_t *handle, const char *value) +{ + handle->body = strdup(value); + + return SCGI_SUCCESS; +} + +SCGI_DECLARE(scgi_status_t) scgi_add_param(scgi_handle_t *handle, const char *name, const char *value) +{ + scgi_param_t *param, *pp; + + for(pp = handle->params; pp && pp->next; pp = pp->next) { + if (!strcasecmp(pp->name, name)) { + return SCGI_FAIL; + } + } + + param = malloc(sizeof(*param)); + memset(param, 0, sizeof(*param)); + + param->name = strdup(name); + param->value = strdup(value); + + if (!pp) { + handle->params = param; + } else { + pp->next = param; + } + + return SCGI_SUCCESS; +} + +static scgi_status_t scgi_push_param(scgi_handle_t *handle, const char *name, const char *value) +{ + scgi_param_t *param; + + param = malloc(sizeof(*param)); + memset(param, 0, sizeof(*param)); + + param->name = strdup(name); + param->value = strdup(value); + + param->next = handle->params; + handle->params = param; + + return SCGI_SUCCESS; +} + +SCGI_DECLARE(scgi_status_t) scgi_send_request(scgi_handle_t *handle) +{ + scgi_status_t status; + char *buffer = NULL; + size_t bytes = 0; + ssize_t sent = 0; + + if (handle->connected != 1) { + return SCGI_FAIL; + } + + bytes = scgi_build_message(handle, &buffer); + sent = send(handle->sock, buffer, bytes, 0); + + if (sent <= 0) { + handle->connected = -1; + } + + scgi_safe_free(buffer); + + return status; +} + + +SCGI_DECLARE(ssize_t) scgi_recv(scgi_handle_t *handle, unsigned char *buf, size_t buflen) +{ + ssize_t recvd; + + if (handle->connected != 1) { + return -1; + } + + recvd = recv(handle->sock, buf, buflen, 0); + + if (recvd == 0) { + handle->connected = -1; + } + + + return recvd; +} + +SCGI_DECLARE(scgi_status_t) scgi_connect(scgi_handle_t *handle, const char *host, scgi_port_t port, uint32_t timeout) +{ + int rval = 0; + + struct addrinfo hints = { 0 }, *result; +#ifndef WIN32 + int fd_flags = 0; +#else + WORD wVersionRequested = MAKEWORD(2, 0); + WSADATA wsaData; + int err = WSAStartup(wVersionRequested, &wsaData); + if (err != 0) { + snprintf(handle->err, sizeof(handle->err), "WSAStartup Error"); + return SCGI_FAIL; + } + +#endif + + handle->sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + + if (handle->sock == SCGI_SOCK_INVALID) { + snprintf(handle->err, sizeof(handle->err), "Socket Error"); + return SCGI_FAIL; + } + + + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + + if (getaddrinfo(host, NULL, &hints, &result)) { + strncpy(handle->err, "Cannot resolve host", sizeof(handle->err)); + goto fail; + } + + memcpy(&handle->sockaddr, result->ai_addr, sizeof(handle->sockaddr)); + handle->sockaddr.sin_family = AF_INET; + handle->sockaddr.sin_port = htons(port); + freeaddrinfo(result); + + if (timeout) { +#ifdef WIN32 + u_long arg = 1; + if (ioctlsocket(handle->sock, FIONBIO, &arg) == SOCKET_ERROR) { + snprintf(handle->err, sizeof(handle->err), "Socket Connection Error"); + goto fail; + } +#else + fd_flags = fcntl(handle->sock, F_GETFL, 0); + if (fcntl(handle->sock, F_SETFL, fd_flags | O_NONBLOCK)) { + snprintf(handle->err, sizeof(handle->err), "Socket Connection Error"); + goto fail; + } +#endif + } + + rval = connect(handle->sock, (struct sockaddr*)&handle->sockaddr, sizeof(handle->sockaddr)); + + if (timeout) { + int r; + + + r = scgi_wait_sock(handle->sock, timeout, SCGI_POLL_WRITE); + + if (r <= 0) { + snprintf(handle->err, sizeof(handle->err), "Connection timed out"); + goto fail; + } + + if (!(r & SCGI_POLL_WRITE)) { + snprintf(handle->err, sizeof(handle->err), "Connection timed out"); + goto fail; + } + +#ifdef WIN32 + { + u_long arg = 0; + if (ioctlsocket(handle->sock, FIONBIO, &arg) == SOCKET_ERROR) { + snprintf(handle->err, sizeof(handle->err), "Socket Connection Error"); + goto fail; + } + } +#else + fcntl(handle->sock, F_SETFL, fd_flags); +#endif + rval = 0; + } + + result = NULL; + + if (rval) { + snprintf(handle->err, sizeof(handle->err), "Socket Connection Error"); + goto fail; + } + + sock_setup(handle); + + handle->connected = 1; + + + return SCGI_SUCCESS; + + fail: + + handle->connected = 0; + scgi_disconnect(handle); + + return SCGI_FAIL; +} + + + +SCGI_DECLARE(scgi_status_t) scgi_disconnect(scgi_handle_t *handle) +{ + scgi_status_t status = SCGI_FAIL; + + if (handle->destroyed) { + return SCGI_FAIL; + } + + handle->destroyed = 1; + handle->connected = 0; + + scgi_destroy_params(handle); + scgi_safe_free(handle->body); + + if (handle->sock != SCGI_SOCK_INVALID) { + closesocket(handle->sock); + handle->sock = SCGI_SOCK_INVALID; + status = SCGI_SUCCESS; + } + + return status; +} + + +/* USE WSAPoll on vista or higher */ +#ifdef SCGI_USE_WSAPOLL +SCGI_DECLARE(int) scgi_wait_sock(scgi_socket_t sock, uint32_t ms, scgi_poll_t flags) +{ +} +#endif + + +#ifdef SCGI_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 +SCGI_DECLARE(int) scgi_wait_sock(scgi_socket_t sock, uint32_t ms, scgi_poll_t flags) +{ + int s = 0, r = 0; + fd_set rfds; + fd_set wfds; + fd_set efds; + struct timeval tv; + + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + +#ifndef WIN32 + /* Wouldn't you rather know?? */ + assert(sock <= FD_SETSIZE); +#endif + + if ((flags & SCGI_POLL_READ)) { + +#ifdef WIN32 +#pragma warning( push ) +#pragma warning( disable : 4127 ) + FD_SET(sock, &rfds); +#pragma warning( pop ) +#else + FD_SET(sock, &rfds); +#endif + } + + if ((flags & SCGI_POLL_WRITE)) { + +#ifdef WIN32 +#pragma warning( push ) +#pragma warning( disable : 4127 ) + FD_SET(sock, &wfds); +#pragma warning( pop ) +#else + FD_SET(sock, &wfds); +#endif + } + + if ((flags & SCGI_POLL_ERROR)) { + +#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 & SCGI_POLL_READ) ? &rfds : NULL, (flags & SCGI_POLL_WRITE) ? &wfds : NULL, (flags & SCGI_POLL_ERROR) ? &efds : NULL, &tv); + + if (s < 0) { + r = s; + } else if (s > 0) { + if ((flags & SCGI_POLL_READ) && FD_ISSET(sock, &rfds)) { + r |= SCGI_POLL_READ; + } + + if ((flags & SCGI_POLL_WRITE) && FD_ISSET(sock, &wfds)) { + r |= SCGI_POLL_WRITE; + } + + if ((flags & SCGI_POLL_ERROR) && FD_ISSET(sock, &efds)) { + r |= SCGI_POLL_ERROR; + } + } + + return r; + +} +#ifdef WIN32 +#pragma warning( pop ) +#endif +#endif + +#ifdef SCGI_USE_POLL +SCGI_DECLARE(int) scgi_wait_sock(scgi_socket_t sock, uint32_t ms, scgi_poll_t flags) +{ + struct pollfd pfds[2] = { { 0 } }; + int s = 0, r = 0; + + pfds[0].fd = sock; + + if ((flags & SCGI_POLL_READ)) { + pfds[0].events |= POLLIN; + } + + if ((flags & SCGI_POLL_WRITE)) { + pfds[0].events |= POLLOUT; + } + + if ((flags & SCGI_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 |= SCGI_POLL_READ; + } + if ((pfds[0].revents & POLLOUT)) { + r |= SCGI_POLL_WRITE; + } + if ((pfds[0].revents & POLLERR)) { + r |= SCGI_POLL_ERROR; + } + } + + return r; + +} +#endif diff --git a/libs/libscgi/testclient.c b/libs/libscgi/testclient.c new file mode 100644 index 0000000000..c43fe237c4 --- /dev/null +++ b/libs/libscgi/testclient.c @@ -0,0 +1,39 @@ +#include + + +int main(int argc, char *argv[]) +{ + char buf[16336] = ""; + ssize_t len; + scgi_handle_t handle = { 0 }; + char *ip; + int port = 0; + + if (argc < 2) { + fprintf(stderr, "usage: testclient "); + } + + ip = argv[1]; + port = atoi(argv[2]); + + + + scgi_add_param(&handle, "REQUEST_METHOD", "POST"); + scgi_add_param(&handle, "REQUEST_URI", "/deepthought"); + scgi_add_param(&handle, "TESTING", "TRUE"); + scgi_add_param(&handle, "TESTING", "TRUE"); + scgi_add_body(&handle, "What is the answer to life?"); + + + scgi_connect(&handle, ip, port, 10000); + + scgi_send_request(&handle); + + + while((len = scgi_recv(&handle, buf, sizeof(buf))) > 0) { + printf("READ [%s]\n", buf); + } + + scgi_disconnect(&handle); + +} From d7cf0bbed0994ae480fdb10c4fe18166ed932792 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 May 2012 14:06:00 -0500 Subject: [PATCH 0241/1057] add mod_xml_scgi (like xml_curl minus the web server direct to an application backend that supports the SCGI protocol) --- src/mod/xml_int/mod_xml_scgi/Makefile | 5 + .../conf/autoload_configs/xml_scgi.conf.xml | 12 + .../mod_xml_scgi/mod_xml_scgi.2008.vcproj | 287 +++++++++++++++ .../mod_xml_scgi/mod_xml_scgi.2010.vcxproj | 131 +++++++ src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 340 ++++++++++++++++++ .../xml_int/mod_xml_scgi/xml_scgi_server.pl | 93 +++++ 6 files changed, 868 insertions(+) create mode 100644 src/mod/xml_int/mod_xml_scgi/Makefile create mode 100644 src/mod/xml_int/mod_xml_scgi/conf/autoload_configs/xml_scgi.conf.xml create mode 100644 src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2008.vcproj create mode 100644 src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2010.vcxproj create mode 100644 src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c create mode 100644 src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl diff --git a/src/mod/xml_int/mod_xml_scgi/Makefile b/src/mod/xml_int/mod_xml_scgi/Makefile new file mode 100644 index 0000000000..2c7a91d26d --- /dev/null +++ b/src/mod/xml_int/mod_xml_scgi/Makefile @@ -0,0 +1,5 @@ +BASE=../../../.. +LOCAL_SOURCES = $(BASE)/libs/libscgi/src/scgi.c +LOCAL_OBJS = $(BASE)/libs/libscgi/src/scgi.o +LOCAL_CFLAGS = -I. -I$(BASE)/libs/libscgi/src/include +include $(BASE)/build/modmake.rules diff --git a/src/mod/xml_int/mod_xml_scgi/conf/autoload_configs/xml_scgi.conf.xml b/src/mod/xml_int/mod_xml_scgi/conf/autoload_configs/xml_scgi.conf.xml new file mode 100644 index 0000000000..b9662d1638 --- /dev/null +++ b/src/mod/xml_int/mod_xml_scgi/conf/autoload_configs/xml_scgi.conf.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2008.vcproj b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2008.vcproj new file mode 100644 index 0000000000..7718059dd5 --- /dev/null +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2008.vcproj @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2010.vcxproj b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2010.vcxproj new file mode 100644 index 0000000000..cde0e239e9 --- /dev/null +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.2010.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_xml_scgi + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39} + mod_xml_scgi + 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 + + + + + + diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c new file mode 100644 index 0000000000..687ec3aeb9 --- /dev/null +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -0,0 +1,340 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2012, 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_xml_scgi.c -- SCGI XML Gateway + * + */ +#include +#include + + +SWITCH_MODULE_LOAD_FUNCTION(mod_xml_scgi_load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_scgi_shutdown); +SWITCH_MODULE_DEFINITION(mod_xml_scgi, mod_xml_scgi_load, mod_xml_scgi_shutdown, NULL); + + +struct xml_binding { + char *host; + switch_port_t port; + char *url; + + int timeout; + switch_hash_t *vars_map; + char *bindings; + +}; + +static int GLOBAL_DEBUG = 0; + +typedef struct xml_binding xml_binding_t; + +#define XML_SCGI_MAX_BYTES 1024 * 1024 + +typedef struct hash_node { + switch_hash_t *hash; + struct hash_node *next; +} hash_node_t; + +static struct { + switch_memory_pool_t *pool; + hash_node_t *hash_root; + hash_node_t *hash_tail; +} globals; + +#define XML_SCGI_SYNTAX "[debug_on|debug_off]" +SWITCH_STANDARD_API(xml_scgi_function) +{ + if (session) { + return SWITCH_STATUS_FALSE; + } + + if (zstr(cmd)) { + goto usage; + } + + if (!strcasecmp(cmd, "debug_on")) { + GLOBAL_DEBUG = 1; + } else if (!strcasecmp(cmd, "debug_off")) { + GLOBAL_DEBUG = 0; + } else { + goto usage; + } + + stream->write_function(stream, "OK\n"); + return SWITCH_STATUS_SUCCESS; + + usage: + stream->write_function(stream, "USAGE: %s\n", XML_SCGI_SYNTAX); + return SWITCH_STATUS_SUCCESS; +} + + +static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, + void *user_data) +{ + switch_xml_t xml = NULL; + char *data = NULL; + xml_binding_t *binding = (xml_binding_t *) user_data; + char hostname[256] = ""; + char basic_data[512]; + unsigned char buf[16336] = ""; + ssize_t len = -1, bytes = 0; + scgi_handle_t handle = { 0 }; + switch_stream_handle_t stream = { 0 }; + char *txt = NULL; + + strncpy(hostname, switch_core_get_switchname(), sizeof(hostname)); + + if (!binding) { + return NULL; + } + + switch_snprintf(basic_data, sizeof(basic_data), "hostname=%s§ion=%s&tag_name=%s&key_name=%s&key_value=%s", + hostname, section, switch_str_nil(tag_name), switch_str_nil(key_name), switch_str_nil(key_value)); + + data = switch_event_build_param_string(params, basic_data, binding->vars_map); + switch_assert(data); + + scgi_add_param(&handle, "REQUEST_METHOD", "POST"); + scgi_add_param(&handle, "REQUEST_URI", binding->url); + scgi_add_body(&handle, data); + + if (scgi_connect(&handle, binding->host, binding->port, binding->timeout * 1000) == SCGI_SUCCESS) { + scgi_send_request(&handle); + + SWITCH_STANDARD_STREAM(stream); + txt = (char *) stream.data; + + while((len = scgi_recv(&handle, buf, sizeof(buf))) > 0) { + + bytes += len; + + if (bytes > XML_SCGI_MAX_BYTES) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Data too big!\n"); + len = -1; + break; + } + + stream.write_function(&stream, "%s", buf); + } + + scgi_disconnect(&handle); + } + + if (GLOBAL_DEBUG) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DEBUG:\nURL: %s\nPOST_DATA:\n%s\n\nRESPONSE:\n%s\n\n", binding->url, data, txt); + } + + if (!len) { + if (!(xml = switch_xml_parse_str(txt, strlen(txt)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result! [%s]\ndata: [%s]\n", binding->url, data); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received error trying to fetch %s\ndata: [%s]\n", binding->url, data); + switch_safe_free(stream.data); + xml = NULL; + } + + switch_safe_free(data); + + + return xml; +} + +#define ENABLE_PARAM_VALUE "enabled" +static switch_status_t do_config(void) +{ + char *cf = "xml_scgi.conf"; + switch_xml_t cfg, xml, bindings_tag, binding_tag, param; + xml_binding_t *binding = NULL; + int x = 0; + int need_vars_map = 0; + switch_hash_t *vars_map = NULL; + + if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf); + return SWITCH_STATUS_TERM; + } + + if (!(bindings_tag = switch_xml_child(cfg, "bindings"))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing tag!\n"); + goto done; + } + + for (binding_tag = switch_xml_child(bindings_tag, "binding"); binding_tag; binding_tag = binding_tag->next) { + char *bname = (char *) switch_xml_attr_soft(binding_tag, "name"); + char *host = "127.0.0.1"; + char *port = "8080"; + char *bind_mask = NULL; + int timeout = 0; + + hash_node_t *hash_node; + need_vars_map = 0; + vars_map = NULL; + + for (param = switch_xml_child(binding_tag, "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, "host")) { + bind_mask = (char *) switch_xml_attr_soft(param, "bindings"); + if (val) { + host = val; + } + } else if (!strcasecmp(var, "port")) { + port = val; + } else if (!strcasecmp(var, "timeout")) { + int tmp = atoi(val); + if (tmp >= 0) { + timeout = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set a negative timeout!\n"); + } + } else if (!strcasecmp(var, "enable-post-var")) { + if (!vars_map && need_vars_map == 0) { + if (switch_core_hash_init(&vars_map, globals.pool) != SWITCH_STATUS_SUCCESS) { + need_vars_map = -1; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't init params hash!\n"); + continue; + } + need_vars_map = 1; + } + + if (vars_map && val) { + if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't add %s to params hash!\n", val); + } + } + } + } + + if (!host) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Binding has no host!\n"); + if (vars_map) { + switch_core_hash_destroy(&vars_map); + } + continue; + } + + if (!(binding = switch_core_alloc(globals.pool, sizeof(*binding)))) { + if (vars_map) { + switch_core_hash_destroy(&vars_map); + } + goto done; + } + memset(binding, 0, sizeof(*binding)); + + binding->timeout = timeout; + binding->host = switch_core_strdup(globals.pool, host); + binding->port = atoi(port); + binding->vars_map = vars_map; + binding->url = switch_mprintf("scgi://%s:%s", host, port); + + if (bind_mask) { + binding->bindings = switch_core_strdup(globals.pool, bind_mask); + } + + if (vars_map) { + switch_zmalloc(hash_node, sizeof(hash_node_t)); + hash_node->hash = vars_map; + hash_node->next = NULL; + + if (!globals.hash_root) { + globals.hash_root = hash_node; + globals.hash_tail = globals.hash_root; + } + + else { + globals.hash_tail->next = hash_node; + globals.hash_tail = globals.hash_tail->next; + } + + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n", + zstr(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all"); + switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding); + x++; + binding = NULL; + } + + done: + switch_xml_free(xml); + + return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_xml_scgi_load) +{ + switch_api_interface_t *xml_scgi_api_interface; + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + memset(&globals, 0, sizeof(globals)); + globals.pool = pool; + globals.hash_root = NULL; + globals.hash_tail = NULL; + + if (do_config() != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + + SWITCH_ADD_API(xml_scgi_api_interface, "xml_scgi", "XML SCGI", xml_scgi_function, XML_SCGI_SYNTAX); + switch_console_set_complete("add xml_scgi debug_on"); + switch_console_set_complete("add xml_scgi debug_off"); + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_scgi_shutdown) +{ + hash_node_t *ptr = NULL; + + while (globals.hash_root) { + ptr = globals.hash_root; + switch_core_hash_destroy(&ptr->hash); + globals.hash_root = ptr->next; + switch_safe_free(ptr); + } + + switch_xml_unbind_search_function_ptr(xml_url_fetch); + + 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/xml_int/mod_xml_scgi/xml_scgi_server.pl b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl new file mode 100644 index 0000000000..bf56c9c0c1 --- /dev/null +++ b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl @@ -0,0 +1,93 @@ +# +# Copyright (c) 2012-2013, Anthony Minessale II +# 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. +# + +### EXAMPLE SERVER SIDE FOR mod_xml_SCGI +### You will need the SCGI module from CPAN + +use SCGI; +use CGI; +use IO::Socket; +use Data::Dumper; + +my $socket = IO::Socket::INET->new(Listen => 5, ReuseAddr => 1, LocalPort => 8080) + or die "cannot bind to port 8080: $!"; + +my $scgi = SCGI->new($socket, blocking => 1); + + +my $xml = qq# + +